8,367
edits
Changes
→40pin GPIO port test
=== 40pin GPIO port test ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''The Linux system released by Orange Pi has a pre-installed blink_all_gpio program, which will set all 28 GPIO ports in the 40pin to switch between high and low levels continuously.'''
'''After running the blink_all_gpio program, when using a multimeter to measure the level of the GPIO port, you will find that the GPIO pin will switch between 0 and 3.3v continuously. Using this program we can test whether the GPIO port is working properly.'''
orangepi@orangepicm4:~$ '''sudo blink_all_gpio''' # Remember to add sudo permission [sudo] password for orangepi: # A password is required here|}
# There are a total of 28 GPIO ports in the 40pins of the development board that can be used. The following uses pin 7—the corresponding GPIO is GPIO4_C3——the corresponding wPi serial number is 2—as an example to demonstrate how to set the high and low levels of the GPIO port
::[[File:cm4-img257.png]]
<ol start="2" style="list-style-type: decimal;">
<li>First set the GPIO port to output mode, where the third parameter needs to input the serial number of wPi corresponding to the pin</li></ol>{| class="wikitable" style="width:800px;" |-|
root@orangepi:~/wiringOP# '''gpio mode 2 out'''
|}</ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then set the GPIO port to output low level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 0v, it means that the low level is set successfully.</li></ol>{| class="wikitable" style="width:800px;" |-|
root@orangepi:~/wiringOP# '''gpio write 2 0'''
|}
Use gpio readall to see that the value (V) of pin 7 has changed to 0
[[File:cm4-img258.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then set the GPIO port to output a high level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 3.3v, it means that the high level is set successfully</li></ol>{| class="wikitable" style="width:800px;" |-|
root@orangepi:~/wiringOP# '''gpio write 2 1'''
|}
Use gpio readall to see that the value (V) of pin 7 has changed to 1
[[File:cm4-img259.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>The setting method of other pins is similar, just modify the serial number of wPi to the corresponding serial number of the pin</li></ol>
<span id="how-to-set-the-pull-up-and-pull-down-resistance-of-40pin-gpio-port"></span>
=== How to set the pull-up and pull-down resistance of 40pin GPIO port ===