8,367
edits
Changes
→40pin UART test
# As can be seen from the table below, the available uarts of Orange Pi CM4 are three sets of uart buses: uart3, uart7 and uart9
::[[File:cm4-img273.png]]
::{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''As can be seen from the above table, i2c3_m0 and uart3_m0 are multiplexed pins, and both cannot be opened at the same time'''</big>|}
<ol start="2" style="list-style-type: decimal;">
<li><p>In the linux system, the UART in the 40 pins is closed by default, and it needs to be opened manually to use. The detailed steps are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li>First run '''orangepi-config''', common users remember to add '''sudo''' permission</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''sudo orangepi-config'''
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>Then select '''System'''</li></ol>
[[File:cm4-img263.png]]
</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>Then select '''Hardware'''</li></ol>
[[File:cm4-img264.png]]
</ol>
<ol start="4" style="list-style-type: lower-alpha;">
<li>Then use the arrow keys on the keyboard to navigate to the position shown in the figure below, and then use the space to select the UART configuration you want to open</li></ol>
[[File:cm4-img274.png]]
</ol>
<ol start="5" style="list-style-type: lower-alpha;">
<li>Then select'''<Save>''' Save</li></ol>
[[File:cm4-img275.png]]
</ol>
<ol start="6" style="list-style-type: lower-alpha;">
<li>Then select '''<Back>'''</li></ol>
[[File:cm4-img276.png]]
</ol>
<ol start="7" style="list-style-type: lower-alpha;">
<li>Then select'''<Reboot>'''Restart the system for the configuration to take effect</li></ol>
[[File:cm4-img268.png]]
</ol></li></ol>
<ol start="3" style="list-style-type: decimal;">
<li>After entering the Linux system, first confirm whether there is a device node corresponding to uart under /dev</li></ol>{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~# '''ls /dev/ttyS*'''
/dev/ttyS1 '''/dev'''/'''ttyS3 /dev/ttyS7 /dev/ttyS9'''|}</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then start to test the uart interface, first use the DuPont line to short the rx and tx of the uart interface to be tested</li></ol>
{| class="wikitable" style="width:800px;text-align: center;"
|-
|
[[File:cm4-img277.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li><p>Use the '''serialTest.py''' program in the examples to test the loopback function of the serial port as shown below. If you can see the following print, it means that the serial port communication is normal</p>
<ol style="list-style-type: lower-alpha;">
<li>Test UART3</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
root@orangepi:~/wiringOP-Python/examples# '''python3 serialTest.py --device \'''
exit
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>Test UART7</li></ol>{| class="wikitable" style="width:800px;" |-|
root@orangepi:~/wiringOP-Python/examples# '''python3 serialTest.py --device \'''
exit
|}</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>Test UART9</li></ol>{| class="wikitable" style="width:800px;" |-|
root@orangepi:~/wiringOP-Python/examples# '''python3 serialTest.py --device \'''
exit
|}</ol></li></ol>
<span id="hardware-watchdog-test"></span>