EasyManua.ls Logo

ORANGE Pi 3B - Page 215

ORANGE Pi 3B
366 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd
207
3) First check whether there is a spidev3.0 device node in the Linux system. If it exists,
it means that SPI3 has been set up and can be used directly
orangepi@orangepi:~$ ls /dev/spidev3.0
/dev/spidev3.0
4) 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:
a. --channelSpecify the channel number of SPI
b. --portSpecify the port number of the SPI
5) Do not short-circuit the mosi and miso pins of SPI3, the output of running
spidev_test.py is as follows, you can see that the data of TX and RX are inconsistent
root@orangepi:~/wiringOP-Python# cd examples
root@orangepi:~/wiringOP-Python/examples# python3 spidev_test.py \
--channel 3 --port 0
spi mode: 0x0
max speed: 500000 Hz (500 KHz)
Opening device /dev/spidev3.0
TX | FF FF FF FF FF FF 40 00 00 00 00 95 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 |.................|
6) Then use the Dupont wire to short-circuit the two pins of txd (pin 19 in the 40pin
interface) and rxd (pin 21 in the 40pin interface) of SPI3 and then run the output of
spidev_test.py as follows, you can see The data sent and received are the same, indicating
that the SPI3 loopback test is normal
root@orangepi:~/wiringOP-Python# cd examples
root@orangepi:~/wiringOP-Python/examples# python3 spidev_test.py \
--channel 3 --port 0
spi mode: 0x0
max speed: 500000 Hz (500 KHz)
Opening device /dev/spidev3.0
TX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF

Table of Contents