Changes

Jump to: navigation, search

Orange Pi 5 Plus

668 bytes added, 19:03, 6 June 2023
40 pin SPI test
<li><p>The corresponding pins of SPI0 and SPI4 in 40pin are shown in the table below. SPI4_M1 and SPI4_M2 can only use one of them at the same time, and they cannot be used at the same time. They are all the same SPI4, but they are connected to different pins. Please don't think that they are two different sets of SPI buses.</p></li></ol>
{| class="wikitable" style="width:800px;"
|-
|
| '''Pin 26'''
| '''Pin 38'''
| '''<span style="color:#FF0000">none</span>'''
|-
| '''dtbo confi guration'''
<ol style="list-style-type: lower-alpha;">
<li><p>First run '''orangepi-config''', normal users remember to add &gt; '''sudo''' permission</p>
{| class="wikitable" style="width:800px;" |-|<p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li>
<li><p>Then select '''System'''</p>
<p>[[File:media/image234.png|413x191px]]</p></li>
</li>
<li><p>After restarting, enter the system and first check whether there is a '''spidevx.x''' device node in the linux system. If it exists, it means that the SPI has been set up and can be used directly.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''ls /dev/spidev*'''</p>
<p>/dev/spidev0.0 /dev/spidev0.1 /dev/spidev4.0 /dev/spidev4.1</p>
|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''The above is the result displayed after turning on spi0-m2-cs0-cs1-spidev and spi4-m1-cs0-cs1-spidev.'''</p></big>|}</li>
<li><p>Then you can use the '''spidev_test.py''' program in the examples to test the loopback function of the SPI. The '''spidev_test.py''' program needs to specify the following two parameters:</p>
<ol style="list-style-type: lower-alpha;">
</li>
<li><p>Do not short-circuit the MOSI and MISO pins of the SPI, the output of running '''spidev_test.py''' is as follows, you can see that the data of TX and RX are inconsistent</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''The x after the --channel and --port parameters needs to be replaced with the channel number of the specific SPI and the port number of the SPI.'''</p></big>|} {| class="wikitable" style="width:800px;" |-|<p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p></li></ol>
root@orangepi:~/wiringOP-Python/examples# '''python3 spidev_test.py --channel x --port x'''
Opening device /dev/spidev4.1
TX | FF FF FF FF FF FF '''<span style="color:#FF0000">40 00 00 00 00 95</span>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…| RX | FF FF FF FF FF FF '''FF FF FF FF FF FF''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF |.............….|
RX | FF FF FF FF FF FF '''<span style="color:#FF0000">FF FF FF FF FF FF</span>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF |.............….|
|}
</li></ol>
<ol start="7" style="list-style-type: decimal;">
<li><p>Then use the Dupont wire to short-circuit the MOSI and MISO pins of the SPI, and then run the output of spidev_test.py as follows, you can see that the data sent and received are the same, indicating that the SPI loopback test is normal</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''The x after the --channel and --port parameters needs to be replaced with the channel number of the specific SPI and the port number of the SPI.'''</p></big>|}{| class="wikitable" style="width:800px;" |-|<p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p></li></ol>
root@orangepi:~/wiringOP-Python/examples# '''python3 spidev_test.py --channel x --port x'''
Opening device /dev/spidev4.1
TX | FF FF FF FF FF FF '''<span style="color:#FF0000">40 00 00 00 00 95</span>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…|
RX | FF FF FF FF FF FF '''<span style="color:#FF0000">40 00 00 00 00 95</span>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…||}</li></ol><span id="pin-i2c-test-1"></span>
<span id="pin-i2c-test-1"></span>
=== 40 pin I2C test ===

Navigation menu