8,367
edits
Changes
→Interface details of Orange Pi 3B
|-
|
<big>'''The diameter of the four positioning holes is 32.0mm7mm, and the diameter of the M.2 PICE device fixing hole is 32.5mm9mm.'''</big>
|}
|}
# 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:pi3b-img259-1.png]]
<span id="pin-gpio-port--down-and-downward-pull--down-resistance-setting-method"></span>
=== 40Pin 40pin GPIO Port -down and downward port pull -down resistance setting method ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|
<big>'''Note that the 4 GPIO pins below Orange Pi 3B are invalid because there are 3.3V on the outside, so setting drop -down is invalid. Other pins can be set normally'''</big>
[[File:pi3b-img262-1.png|center]]
|}
# Below the No. 11 11 pin—corresponding to GPIO 3_C6-corresponding WPI wPi serial number 5—to demonstrate how to set up and down pull-down resistance of the GPIO port
::[[File:pi3b-img263-1.png]]
<ol start="2" style="list-style-type: decimal;">
<li>First of all, you need to set the GPIO port as the input mode. The third parameter needs to enter the serial number of the wpi wPi corresponding to the pins</li>
{| class="wikitable" style="width:800px;"
|-
</ol>
<ol start="3" style="list-style-type: decimal;">
<li>After the setting is set to input mode, execute the following command to set the GPIO port as the pull -down mode</li>
{| class="wikitable" style="width:800px;"
|-
</ol>
<ol start="6" style="list-style-type: decimal;">
<li>Then enter the following command to read the level of the GPIO port. If the level is 0, it means that the drop -down mode is set successfully</li>
{| class="wikitable" style="width:800px;"
|-
# From the schematic diagram of the 40PIN interface, the SPI available for Orange Pi 3B is spi3
::[[File:pi3b-img264-1.png]]
<ol start="2" style="list-style-type:decimal;"><li><p>In the linux system, the SPI in the 40 pin is closed by default, and it needs to be opened manually before it can be used. The detailed steps are as follows:</p><ol style="list-style-type: lower-alpha;"><li><p>First run '''orangepi-config''', normal users remember to add sudo permission</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|
<bigp>'''In the Linux system, the SPI3 in 40pin is closed by default, and it needs to be opened manually to use.''' '''Add the configuration of the red font part below to the /boot/orangepiEnv.txt, and then restart the Linux system to open the spi3.''' orangepi@orangepi:~$ '''sudo vim /boot/orangepiEnv.txt''' '''<span style="color:#FF0000">overlays=spi3-m0orangepi-cs0-spidev</span>config'''</bigp>
|}
</li>
<li><p>Then select '''System'''</p>
<p>[[File:pi3b-1.png]]</p>
</li>
<li><p>Then select '''Hardware'''</p>
<p>[[File:pi3b-2.png]]</p>
</li>
<li><p>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 SPI configuration you want to open</p>
<p>[[File:pi3b-3.png]]</p>
</li>
<li><p>Then select '''<Save>''' to save</p>
<p>[[File:pi3b-4.png]]</p>
</li>
<li><p>Then select '''<Back>'''</p>
<p>[[File:pi3b-5.png]]</p>
</li>
<li><p>Then select '''<Reboot>''' to restart the system to make the configuration take effect</p>
<p>[[File:pi3b-6.png]]</p>
</li>
</ol>
</li></ol>
<ol start="23" style="list-style-type: decimal;"><li>First After restarting, enter the system to check whether there is a '''spidev3.0''' device node in the Linux system. If it exists, it means that the SPI3 has been set. You up and can use it be used directly</li>
{| class="wikitable" style="width:800px;"
|}
</ol>
<ol start="34" style="list-style-type: decimal;"><li>Do not shorten short-circuit the two mosi and miso pins of the SPI3 MOSI and MISO, and run the output result of the running spidev_test is as shown below. You follows, you can see that the data of TX and RX is are inconsistent</li>
{| class="wikitable" style="width:800px;"
|}
</ol>
<ol start="45" style="list-style-type: decimal;"><li>Then short-circuit the two pins of the SPI3 MOSI mosi (No. 19 pins pin 19 in the 40pin interface) and MISO miso (No. 21 pin 21 in the 40PIN 40pin interface) of SPI3, and then run the output of SPIDEV_TEST spidev_test as follows.You , you can see that the sending and receiving same data is the same.</li>
[[File:pi3b-img265.png]]
# From the table below, the I2C available for Orange Pi 3B is I2C2, I2C3, and I2C4 a total of three groups of I2C bus.
::[[File:pi3b-img266-1.png]]
::{| class="wikitable" style="background-color:#ffffdc;width:800px;"
<big>'''It can be seen from the above table that i2c4_m0 and spi3_m0 are pins. The two cannot be opened at the same time. i2c3_m0 and uart3_m0 are also reused. The two cannot be opened at the same time'''</big>
|}
<ol start="2" style="list-style-type:decimal;"><li><p>In the linux system, the I2C bus in the 40 pin is closed by default, and it needs to be opened manually to use it. The detailed steps are as follows:</p><ol style="list-style-type: lower-alpha;"><li><p>First run '''orangepi-config''', normal users remember to add '''sudo''' permission</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|
<bigp>'''In the Linux system, the i2c in 40Pin is closed by default, and it needs to be opened manually to use.''' '''Add the configuration of the red font part below to the /boot/orangepiEnv.txt, and then restart the Linux system to open the i2c2, i2c3, and i2c4 at the same time. If you only need to open one, then fill in one.'''</big> orangepi@orangepi:~$ '''sudo vim /boot/orangepiEnv.txt''' orangepi-config'''<span style="color:#FF0000">overlays=i2c2-m1 i2c3-m0 i2c4-m0</spanp>'''
|}
</li>
<li><p>Then select '''System'''</p>
<p>[[File:pi3b-1.png]]</p>
</li>
<li><p>Then select '''Hardware'''</p>
<p>[[File:pi3b-2.png]]</p>
</li>
<li><p>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 I2C configuration you want to open</p>
<p>[[File:pi3b-3-2.png]]</p>
</li>
<li><p>Then select '''<Save>''' to save</p>
<p>[[File:pi3b-4.png]]</p>
</li>
<li><p>Then select '''<Back>'''</p>
<p>[[File:pi3b-5.png]]</p>
</li>
<li><p>Then select '''<Reboot>''' to restart the system to make the configuration take effect</p>
<p>[[File:pi3b-6.png]]</p>
</li>
</ol>
</li></ol>
<ol start="23" style="list-style-type: decimal;">
<li>After starting the Linux system, first confirm that the i2c device node exists under/dev</li>
{| class="wikitable" style="width:800px;"
|}
</ol>
<ol start="34" style="list-style-type: decimal;">
<li>Then connect a i2c device on the i2c pin of the 40Pin connector</li>
|}
</ol>
<ol start="45" style="list-style-type: decimal;">
<li>Then use the '''i2cdetect -y''' command if the address of the connected I2C device can be detected, it means that the I2C can be used normally</li>
{| class="wikitable" style="width:800px;"
# As can be seen from the table below, the uart available for Orange Pi 3B is uart3, uart7, and uart9. There are three sets of uart bus
::[[File:pi3b-img268-1.png]]
::{| class="wikitable" style="background-color:#ffffdc;width:800px;"
<big>'''As can be seen from the above table, i2c3_m0 and uart3_m0 are reused by pins, and the two 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 before it can be used. The detailed steps are as follows:</p><ol style="list-style-type: lower-alpha;"><li><p>First run '''orangepi-config''', normal users remember to add sudo permission</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|
<bigp>'''In the Linux system, the uart in 40pin is closed by default, and it needs to be opened manually to use.'''</big> '''Add the configuration of the red font part below to the /boot/orangepiEnv.txt, and then restart the Linux system to open the uart3, uart7, and uart9 at the same time. If you only need to open one, you can fill in one..''' orangepi@orangepi:~$ '''sudo vim /boot/orangepiEnv.txt''' orangepi-config'''<span style="color:#FF0000">overlays=uart3-m0 uart7-m2 uart9-m2</spanp>'''
|}
</li>
<li><p>Then select '''System'''</p>
<p>[[File:pi3b-1.png]]</p>
</li>
<li><p>Then select '''Hardware'''</p>
<p>[[File:pi3b-2.png]]</p>
</li>
<li><p>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</p>
<p>[[File:pi3b-3-3.png]]</p>
</li>
<li><p>Then select '''<Save>''' to save</p>
<p>[[File:pi3b-4.png]]</p>
</li>
<li><p>Then select '''<Back>'''</p>
<p>[[File:pi3b-5.png]]</p>
</li>
<li><p>Then select '''<Reboot>''' to restart the system to make the configuration take effect</p>
<p>[[File:pi3b-6.png]]</p>
</li>
</ol>
</li></ol>
<ol start="23" 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>
<ol start="34" style="list-style-type: decimal;">
<li>Then start testing the uart interface, first use the rx and tx of the uart interface to be tested by DuPont</li>
|Corresponding to the 27 pin
|Corresponding to the 15 pin
|Corresponding to the 7 22 pin
|}
[[File:pi3b-img269-1.png]]
</ol>
<ol start="45" style="list-style-type: decimal;">
<li><p>Use the '''gpio serial''' command to test the loop function of the serial port as shown below. If you can see the following printing, it means that the serial communication is normal</p>
<ol style="list-style-type: lower-alpha;">
# From the table below, the pwm11 available for Orange Pi 3B
::[[File:pi3b-img270-1.png]]
<ol start="2" style="list-style-type:decimal;"><li><p>In the linux system, the PWM in the 40 pin is turned off by default, and it needs to be turned on manually before it can be used. The detailed steps are as follows:</p><ol style="list-style-type: lower-alpha;"><li><p>First run '''orangepi-config''', normal users remember to add sudo permission</p>{| class="wikitable" style="width:800px;"
|-
|
|}
</li>
<li><p>Then select '''System'''</p>
<p>[[File:pi3b-1.png]]</p>
</li>
<li><p>Then select '''Hardware'''</p>
<p>[[File:pi3b-2.png]]</p>
</li>
<li><p>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 PWM configuration you want to open</p>
<p>[[File:pi3b-3-4.png]]</p>
</li>
<li><p>Then select '''<Save>''' to save</p>
<p>[[File:pi3b-4.png]]</p>
</li>
<li><p>Then select '''<Back>'''</p>
<p>[[File:pi3b-5.png]]</p>
</li>
<li><p>Then select '''<Reboot>''' to restart the system to make the configuration take effect</p>
<p>[[File:pi3b-6.png]]</p>
</li>
</ol>
</li></ol>
<ol start="23" style="list-style-type: decimal;"><li>After opening a pwm, a there will be an extra pwmchipX in '''/sys/class/pwm/''' (X is a specific number) will be available in, for example, after opening pwm11, check the pwmchipX under '''/sys/class/pwm/'''one becomes two</li>
{| class="wikitable" style="width:800px;"
|-
|}
</ol>
<ol start="34" style="list-style-type: decimal;"><li><p>Which pwmchip above corresponds to pwm11 above? Let, let's first check out the output of the '''ls /sys/class/pwm/ -l''' commandfirst, as shown below: </p></li><li><p>The Then it can be known from the table below that the base address of the pwm11 register is Fe6F0030. Then see fe6f0030, and then look at the output of the '''ls /sys/class/pwm/ -l''' command, you can see that the pwmchip1 is linked to fe6f0030.pwm is connected to the pwmchip1, so the PWM11 corresponding pwm11 corresponds to pwmchip is as pwmchip1</p></li>
<div class="figure">
</div></ol>
<ol start="56" style="list-style-type: decimal;"><li>Then use the following command to allow make pwm11 to output a 50Hz square wave (please switch to the root user first, and then execute the following command)</li>
{| class="wikitable" style="width:800px;"
|-
[[File:pi3b-img272.png]]
<li>The test method of pwm11 demonstrated above is similar to other pwm test methods.</li>
</ol>
<span id="how-to-install-and-use-wiringop-python"></span>
== How to install and use WiringopwiringOP-Python ==
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|
<big>'''WiringopwiringOP-Python is the library of the Python language version of Wiringop. It wiringOP, which is used to operate the hardware resources of the development board's , such as GPIO, I2C, SPI and UART hardware resources such as the development board , in the Python program.'''
'''Please In addition, please note that all the following command below is commands are operated under the <span style="color:#FF0000">root</span> user.'''</big>
|}
<span id="wiringop-python-installation-method"></span>
=== WiringopwiringOP-Python installation method ===
# First install the dependency package
|-
|
<big>'''Note that the following git clone--recursivee command will automatically download the source code of WiringopwiringOP, because WiringopwiringOP-Python depends on WiringopwiringOP. Please make sure that the download process does not report an error due to network problems.'''
'''If there is a problem with the download code from GitHub, you can use the WiringopwiringOP-Python source code that comes with the Linux image directly, and the storage location is:/usr/src/wiringOP-Python'''</big>
|}
{| class="wikitable" style="width:800px;"
</ol>
<ol start="5" style="list-style-type: decimal;">
<li><p>Test whether the WiringopwiringOP-Python is installed successfully under the Python command line is shown below: </p>
<ol style="list-style-type: lower-alpha;">
<li>First use the Python3 command to enter the command line mode of Python3</li>
</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>Enter the following command to view the help information of WiringopwiringOP-Python, and press the '''q''' key to exit the interface of the help information</li>
{| class="wikitable" style="width:800px;"
|-
|-
|
<big>'''WiringopwiringOP-Python is the same as Wiringop. You wiringOP, you can also determine which GPIO pink can be determined pin to operate by specifying the WPI wPi number. Because , because there is no command to check the WPI wPi number in WiringopwiringOP-Python, so you can only check the board WPI wPi number and physical physical physics through the GPIO command in Wiringop. The corresponding relationship of the pinCorrespondence between pins.'''</big>
<div class="figure">