User Manual Orange Pi Zero 3

  Features   |  Use   |    Linux     |  Linux SDK   |  Android   |  Android SRC   |

RU          EN  

Chapt 3. Instructions for use of Debian/Ubuntu Server and Xfce desktop system
Страница:   25    26    27    28    29    30    31    32    33    34    35    36    37    38    39    40    41    42    43    44    45    46    47    48    49    50    51    52    53    54    55    56    57    58    59    60    61    62    63    64    65    66    67    68    69    70    71    72    73    74    75    76    77    78    79    80    81    82    83    84    85    86    87    88    89    90    91    92    93    94    95    96    97    98    99    100    101    102    103    104    105    106    107    108    109    110    111    112    113    114    115    116    117    118    119    120    121    122  


3.19.3. 26pin SPI test

  • 1) According to the schematic diagram of the 26pin interface, the available spi is spi 1


    Img 3.145

  • 2) The spi 1 is disabled by default in the Linux system and needs to be manually enabled before it can be used. The steps to open are as follows:

    a. First run orangepi-config, normal users remember to add sudo permission

    orangepi@orangepi:~$ sudo orangepi-config

    b. Then select System



    Img 3.146

    c. Then select Hardware



    Img 3.147

    d. 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 spi1-cs1-spidev



    Img 3.148

    e. Then select 'Save' to save



    Img 3.149

    f. Then select 'Back'



    Img 3.150

    g. Then select 'Reboot' to restart the system to make the configuration take effect



    Img 3.151

  • 3) Then check whether there is a spidev1.1 device node in the Linux system. If it exists, it means that the configuration of SPI1 has taken effect

    orangepi@orangepi:~$ ls /dev/spidev1*
    /dev/spidev1.1

  • 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. --channel: Specify the channel number of SPI

    b. --port: specify the port number of SPI

  • 5) Do not short-circuit the mosi and miso pins of SPI1, the output result 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 1 --port 1
    spi mode: 0x0
    max speed: 500000 Hz (500 KHz)
    Opening device /dev/spidev1.1
    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 26pin interface) and rxd (pin 21 in the 26pin interface) of SPI1 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 SPI1 loopback test is normal

    FF FF FF FF FF F0 0D |......@..........|


     <         > 


  • Страница:   25    26    27    28    29    30    31    32    33    34    35    36    37    38    39    40    41    42    43    44    45    46    47    48    49    50    51    52    53    54    55    56    57    58    59    60    61    62    63    64    65    66    67    68    69    70    71    72    73    74    75    76    77    78    79    80    81    82    83    84    85    86    87    88    89    90    91    92    93    94    95    96    97    98    99    100    101    102    103    104    105    106    107    108    109    110    111    112    113    114    115    116    117    118    119    120    121    122