8,367
edits
Changes
→Download orangepi-build from github
<div class="figure">
[[File:zero2w-img3.png|800px]]
</div>
<div class="figure">
[[File:zero2w-img4.png|800px]]
</div>
<div class="figure">
[[File:zero2w-img5.png|800px]]
</div>
<span id="orange-pi-zero-2w-24pin-expansion-board-interface-details"></span>
== Orange Pi Zero 2w 24pin expansion board interface details ==
<div class="figure">
[[File:zero2w-img6.png|800px]]
</div>
[[File:zero2w-img7.png|800px]]
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
<p>[[File:zero2w-img171.png]]</p></li>
<li><p>First set the GPIO port to output mode, and the third parameter needs to be the serial number of the wPi corresponding to the input pin.</p>
{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP# '''gpio mode <span style="color:#FF0000">2 </span> out'''</p>|}</li>
<li><p>Then set the GPIO port to output a low level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 0v, it means the low level is set successfully.</p>
{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP# '''gpio write 2 <span style="color:#FF0000">0</span>'''</p>|}</li>
<li><p>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 the setting of the high level is successful.</p>
{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP# '''gpio write 2 <span style="color:#FF0000">1</span>'''</p>|}</li>
<li><p>The setting method for other pins is similar. You only need to modify the serial number of wPi to the serial number corresponding to the pin.</p></li></ol>
<span id="how-to-set-the-pull-down-resistor-of-40-pin-gpio-port"></span>
=== How to set the pull-down resistor of 40 Pin GPIO port ===
<p>[[File:zero2w-img171.png]]</p></li>
<li><p>First, you need to set the GPIO port to input mode, and the third parameter needs to be the serial number of the wPi corresponding to the input pin.</p>
{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP# '''gpio mode <span style="color:#FF0000">2 </span> in'''</p>|}</li>
<li><p>After setting to input mode, execute the following command to set the GPIO port to pull-up mode.</p>
{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP# '''gpio mode <span style="color:#FF0000">2 </span> up'''</p>|}</li>
<li><p>Then enter the following command to read the level of the GPIO port. If the level is 1, it means that the pull-up mode is set successfully.</p>
{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP# '''gpio read <span style="color:#FF0000">2</span>'''</p><p>'''<span style="color:#FF0000">1</span>'''</p>|}</li>
<li><p>Then execute the following command to set the GPIO port to pull-down mode</p>
{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP# '''gpio mode <span style="color:#FF0000">2 </span> down'''</p>|}</li>
<li><p>Then enter the following command to read the level of the GPIO port. If the level is 0, it means that the pull-down mode is set successfully.</p>
{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP# '''gpio read <span style="color:#FF0000">2</span>'''</p><p>'''<span style="color:#FF0000">0</span>'''</p>|}</li></ol>
<span id="pin-spi-test"></span>
=== 40pin SPI test ===
# As can be seen from the table below, the spi available for the 40pin interface is spi1, and there are two chip select pins cs0 and cs1
<div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO序号GPIO NO.'''
| '''GPIO'''
| '''Function'''
| '''pin'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-
| '''264'''
| '''TWI1-SDA'''
| '''3'''
|-
| '''263'''
| '''TWI1-SCL'''
| '''5'''
| '''PI13'''
| '''PWM3/UART4_TX'''
| '''7'''
|-
| style="text-align: left;"|
| '''GND'''
| '''9'''
|-
| '''226'''
| '''UART5_TX'''
| '''11'''
|-
| '''227'''
| '''UART5_RX'''
| '''13'''
|-
| '''261'''
| '''TWI0_SCL/UART2_TX'''
| '''15'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|-
| '''<span style="color:#FF0000">231</span>'''| '''<span style="color:#FF0000">PH7</span>'''| '''<span style="color:#FF0000">SPI1_MOSI</span>'''| '''19'''|| '''20'''| '''GND'''| <span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"|>19</span>'''
|-
| '''<span style="color:#FF0000">232</span>'''| '''<span style="color:#FF0000">PH8</span>'''| '''<span style="color:#FF0000">SPI1_MISO</span>'''| '''<span style="color:#FF0000">21'''|| '''22'''| '''TWI0_SDA</UART2_RX'''| '''PI6'''| '''262span>'''
|-
| '''<span style="color:#FF0000">230</span>'''| '''<span style="color:#FF0000">PH6</span>'''| '''<span style="color:#FF0000">SPI1_CLK</span>'''| '''<span style="color:#FF0000">23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229</span>'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
| '''266'''
| '''PI10'''
| '''TWI2-SDA/UART3_RX'''
| '''27'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|}
|-
|-
| style="text-align: left;"|
|-
| '''4'''
| '''5V'''
| style="text-align: left;"|
|-
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''8'''
| '''UART0_TX'''
| '''224'''
|-
| '''10'''
| '''UART0_RX'''
| '''225'''
|-
| '''12'''
| style="text-align: left;"|
| '''257'''
|-
| '''14'''
| '''GND'''
| style="text-align: left;"|
|-
| '''16'''
| '''PWM4/UART4_RX'''
| '''270'''
|-
| '''18'''
| style="text-align: left;"|
| '''228'''
|-
| '''20'''
| '''GND'''
| style="text-align: left;"|
|-
| '''22'''
| '''TWI0_SDA/UART2_RX'''
| '''262'''
|-
| '''230<span style="color:#FF0000">24</span>'''| '''<span style="color:#FF0000">SPI1_CS0</span>'''| '''<span style="color:#FF0000">PH5</span>'''| '''<span style="color:#FF0000">229</span>'''|-| '''PH6<span style="color:#FF0000">26</span>'''| '''SPI1_CLK<span style="color:#FF0000">SPI1_CS1</span>'''| '''23<span style="color:#FF0000">PH9</span>'''|'''<span style="color:#FF0000">233</span>'''|-| '''2428'''| '''SPI1_CS0TWI2-SCL/UART3_TX'''| '''PH5PI9'''| '''229265'''
|-
| '''30'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
| '''32'''
| '''PWM1'''
| '''267'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
|-
| '''36'''
| style="text-align: left;"|
| '''76'''
|-
| '''38'''
| style="text-align: left;"|
| '''260'''
|-
| '''40'''
| style="text-align: left;"|
| '''259'''
|}
</div>
<ol start="2" style="list-style-type: decimal;"><li><p>i2c In Linux systems, spi1 is turned off by default in Linux systems and needs to be turned on manually to use before itcan be used. The opening steps are as follows: </p>
<ol style="list-style-type: lower-alpha;">
<li><p>First run '''orangepi-config'''. Ordinary users remember to add > '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li><li><p>Then select '''System'''</p><p>[[File:zero2w-img80.png]]</p></li>
<li><p>Then select '''Hardware'''</p>
<p>[[File:zero2w-img81.png]]</p></li>
<li><p>Then use the keyboard's arrow keys to locate the position shown > in the picture figure below, and then use the '''space''' to select the > corresponding i2c dtbo configuration in of the picture belowSPI you want to open.</p></li></ol></li></ol>
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''Multiplexing function in 40pindtbo configuration'''| '''Corresponding dtbo configurationillustrate'''
|-
| '''40pin spi1- i2c0cs0-cs1-spidev'''| '''pi-i2c0Open cs0 and cs1 of spi1 at the same time'''
|-
| '''40pin spi1- i2c1cs0-spidev'''| '''pi-i2c1Only open cs0 of spi1'''
|-
| '''40pin spi1- i2c2cs1-spidev'''| '''pi-i2c2Only open cs1 of spi1'''
|}
[[File:zero2w-img173img172.png]]</ol>
<ol start="5" style="list-style-type: lower-alpha;">
<li><p>Then select <span class="mark">'''<Save></span> ''' to save</p>
<p>[[File:zero2w-img83.png]]</p></li>
<li><p>Then select '''<Back>'''</p>
<p>[[File:zero2w-img84.png]]</p></li>
<li><p>Then select '''<Reboot>''' to restart the system to make the > configuration take effect.</p>
<p>[[File:zero2w-img85.png]]</p></li></ol>
</li></ol>
<ol start="2" style="list-style-type: decimal;">
<li><p>Then check whether there is a '''spidev1.x''' device node in the Linux system. If it exists, it means that the SPI1 configuration has taken effect.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''ls /dev/spidev1*'''</p>
<p>/dev/spidev1.0 /dev/spidev1.1</p>
|}
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|
<big><p>'''Note that only when you open spi1-cs0-cs1-spidev, you will see the device nodes of the two spi.'''</p></big>
|}
</li>
<li><p>Next, start the spi loopback test. Do not short-circuit the mosi and miso pins of SPI1 first. The output result of running spidev_test is as follows. You can see that the data of TX and RX are inconsistent.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo spidev_test -v -D /dev/spidev1.0'''</p>
<p>spi mode: 0x0</p>
<p>bits per word: 8</p>
<p>max speed: 500000 Hz (500 KHz)</p>
<p>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 | ......@.…▒..................▒.</p>
<p>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 | ............................….</p>
|}
</li>
<li><p>Then short-circuit the two pins of SPI1 mosi (pin 19 in the 40pin interface) and miso (pin 21 in the 40pin interface) and then run spidev_test. The output is as follows. You can see the sending and receiving The data is the same, indicating that the loopback test passed.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo spidev_test -v -D /dev/spidev1.0'''</p>
<p>spi mode: 0x0</p>
<p>bits per word: 8</p>
<p>max speed: 500000 Hz (500 KHz)</p>
<p>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 | ......@.…▒..................▒.</p>
<p>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 | ......@.…▒..................▒.</p>
|}
</li></ol>
<!-- --><ol start="3" stylespan id="list-style-type: decimal;"><li><p>After starting the Linux system, first confirm that there is an open i2c device node under /dev</p><p>orangepi@orangepi:~$ '''ls /dev/i2c-*'''</p><p>'''/dev/i2c-*'''</p><p>'''Sometimes the i2c device node and the i2c bus serial number do not correspond one to one. For example, the i2c device node of the i2c1 bus may be /dev/i2c-3.'''</p><p>'''The method to accurately confirm the device node under /dev corresponding to the i2c bus is: '''</p></li></ol> <!-- --><ol style="list-style-type: lower-alpha;"><li><p>'''First run the following command to check the corresponding relationship of i2c'''</p><p>orangepi@orangepizero2w:~$ '''ls /sys/devices/platform/soc*/*/i2c-* | grep "i2c-[0-9]"'''</p><p>/sys/devices/platform/soc/5002000.i2c/i2c-0:</p><p>/sys/devices/platform/soc/5002400.i2c/i2c-3:</p><p>/sys/devices/platform/soc/5002800.i2c/i2cpin-4:</p><p>/sys/devices/platform/soc/5002c00.i2c/i2c-5:</p><p>/sys/devices/platform/soc/6000000.hdmi/i2c-2:</p><p>/sys/devices/platform/soc/7081400.i2c/i2c-1:</p></li><li><p>'''In the above output'''</p></li></ol> <!-- --><ol style="list-style-type: lower-alpha;test"><li><p>5002000 is the register base address of the i2c0 bus, and i2c-0 shown behind it is its corresponding i2c device node</p></li><li><p>5002400 is the register base address of the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li><li><p>5002800 is the register base address of the i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p></li></olspan>
</div></li></ol> <span idstyle="pin-uart-testdisplay: flex;"></span>=== 40pin UART test === # As can be seen from the table below, the available uarts are uart2, uart3, uart4 and uart5. Please note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial port. ::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO NO.'''
| '''Function'''
| '''pin'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-| '''2<span style="color:#FF0000">264</span>'''| '''5V<span style="color:#FF0000">PI8</span>'''| '''<span style="color:#FF0000">TWI1-SDA</span>'''| '''<span style="color:#FF0000">3</span>'''|-| '''<span style="color:#FF0000">263</span>'''| '''<span style="color:#FF0000">v</span>'''| '''<span style="color:#FF0000">TWI1-SCL</span>'''| '''<span style="color:#FF0000">5</span>'''|-| '''269'''| '''PI13'''| '''PWM3/UART4_TX'''| '''7'''|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''9'''
|-
| '''11'''
|-
| '''227'''
| '''UART5_RX'''
| '''13'''
|-
| '''<span style="color:#FF0000">261</span>'''| '''<span style="color:#FF0000">PI5</span>'''| '''<span style="color:#FF0000">TWI0_SCL</span>/UART2_TX'''| '''<span style="color:#FF0000">15'''|| '''16'''| '''PWM4</UART4_RX'''| '''PI14'''| '''270span>'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
| '''PH7'''
| '''SPI1_MOSI'''
| '''19'''
|-
| '''232'''
| '''SPI1_MISO'''
| '''21'''
|-
| '''230'''
| '''SPI1_CLK'''
| '''23'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|-
| '''<span style="color:#FF0000">266</span>'''| '''<span style="color:#FF0000">PI10</span>'''| '''<span style="color:#FF0000">TWI2-SDA</span>/UART3_RX'''| '''<span style="color:#FF0000">27'''|| '''28'''| '''TWI2-SCL</UART3_TX'''| '''PI9'''| '''265span>'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''pin'40''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''4'''| '''5V'''| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''Multiplexing function in 40pin6'''| '''Corresponding dtbo configurationGND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - uart28'''| '''pi-uart2UART0_TX'''| '''PH0'''| '''224'''
|-
| '''40pin - uart310'''| '''pi-uart3UART0_RX'''| '''PH1'''| '''225'''
|-
| '''40pin 12'''| style="text- uart4align: left;"|| '''PI1'''| '''pi-uart4257'''
|-
| '''40pin - uart514'''| '''ph-uart5GND'''|} [[File:zero2w-img175.png]] <ol start="5" style="listtext-style-typealign: lower-alphaleft;">|<li><p>Then select '''<Save>''' to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''<Back>'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''<Reboot>''' to restart the system to make the > configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol> <!-- --><ol start="3" | style="list-style-type: decimal;"><li><p>After entering the Linux system, first confirm whether there is a uart5 device node under '''/dev'''</p><p>'''Note that the linux5.4 system is /dev/ttyASx.'''</p><p>orangepi@orangepi:~$ '''ls /dev/ttyS*'''</p><p>/dev/ttySx</p></li><li><p>Then start testing the uart interface. First use Dupont wire to shorttext-circuit the rx and tx pins of the uart interface to be tested.</p></li><li><p>Use the '''gpio''' command in wiringOP to test the loopback function of the serial port as shown below. If you can see the following print, it means the serial port communication is normal.</p><p>'''Note that the last x in the gpio serial /dev/ttySx command needs to be replaced with the serial number of the corresponding uart device node.'''</p><p>orangepi@orangepi:~$ '''gpio serial /dev/ttySx # linux-6.1 test command'''</p><p>orangepi@orangepialign:~$ '''gpio serial /dev/ttyASx # linux-5.4 test command'''</p><p>Out: 0: -> 0</p><p>Out: 1: -> 1</p><p>Out: 2: -> 2</p><p>Out: 3: ->left; 3^C</p></li></ol> <span id="pwm-test-method"></span>=== PWM test method === # As can be seen from the following table, the available pwm are pwm1, pwm2, pwm3 and pwm4. {| class="wikitable"
|-
| '''GPIO NO.16'''| '''GPIOPWM4/UART4_RX'''| '''FunctionPI14'''| '''Pin'''|| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.270'''
|-
| '''18'''
| style="text-align: left;"|
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''264<span style="color:#FF0000">22</span>'''| '''PI8<span style="color:#FF0000">TWI0_SDA</span>/UART2_RX'''| '''TWI1-SDA'''| '''3'''|| '''4<span style="color:#FF0000">PI6</span>'''| '''5V'''| <span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"|>262</span>'''
|-
| '''26324'''| '''PI7SPI1_CS0'''| '''TWI1PH5'''| '''229'''|-| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''<span style="color:#FF0000">28</span>'''| '''<span style="color:#FF0000">TWI2-SCL</span>/UART3_TX'''| '''5<span style="color:#FF0000">PI9</span>'''|'''<span style="color:#FF0000">265</span>'''|-| '''630'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26932'''| '''PI13PWM1'''| '''PWM3/UART4_TXPI11'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224267'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''1236'''
| style="text-align: left;"|
| '''PI1PC12'''| '''25776'''
|-
| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|| '''14'''| '''GND38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| '''40'''
| style="text-align: left;"|
| '''PI3'''
| '''259'''
|}
</div>
<ol start="2" style="list-style-type: decimal;">
<li><p>i2c is turned off by default in Linux systems and needs to be turned on manually to use it. The opening steps are as follows: </p>
<ol style="list-style-type: lower-alpha;">
<li><p>First run '''orangepi-config'''. Ordinary users remember to add '''sudo''' permissions.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>
|}
</li>
<li><p>Then select '''System'''</p>
<p>[[File:zero2w-img80.png]]</p></li>
<li><p>Then select '''Hardware'''</p>
<p>[[File:zero2w-img81.png]]</p></li>
<li><p>Then use the keyboard's arrow keys to locate the position shown in the picture below, and then use the '''space''' to select the corresponding i2c configuration in the picture below.</p></li>
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''261Multiplexing function in 40pin'''| '''PI5'''| '''TWI0_SCL/UART2_TX'''| '''15'''|| '''16'''| '''PWM4/UART4_RX'''| '''PI14'''| '''270'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''17'''|| '''18'''| style="text-align: left;"|| '''PH4'''| '''228Corresponding dtbo configuration'''
|-
| '''23140pin - i2c0'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|| '''20'''| '''GNDpi-i2c0'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''23240pin - i2c1'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''TWI0_SDA/UART2_RX'''| '''PI6'''| '''262pi-i2c1'''
|-
| '''23040pin - i2c2'''| '''PH6pi-i2c2'''| } [[File:zero2w-img173.png]]</ol><ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select <span class="mark"><Save></span> to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''SPI1_CLK<Back>'''</p>| <p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''23<Reboot>'''to restart the system to make the configuration take effect.</p>|<p>[[File:zero2w-img85.png]]</p></li></ol>| '''24'''</li></ol>| '''SPI1_CS0'''<ol start="3" style="list-style-type: decimal;">| '''PH5'''<li><p>After starting the Linux system, first confirm that there is an open i2c device node under /dev</p>{| '''229'''class="wikitable" style="width:800px;"
|-
|-
| <big><p>'''266Sometimes the i2c device node and the i2c bus serial number do not correspond one to one. For example, the i2c device node of the i2c1 bus may be /dev/i2c-3.'''</p>| <p>'''PI10The method to accurately confirm the device node under /dev corresponding to the i2c bus is: '''</p></big> | <ol style="list-style-type: lower-alpha;"><li><p>'''TWI2-SDA/UART3_RXFirst run the following command to check the corresponding relationship of i2c'''</p>| <p>orangepi@orangepizero2w:~$ '''27ls /sys/devices/platform/soc*/*/i2c-* | grep "i2c-[0-9]"'''</p><p>/sys/devices/platform/soc/5002000.i2c/i2c-0:</p><p>/sys/devices/platform/soc/5002400.i2c/i2c-3:</p><p>/sys/devices/platform/soc/5002800.i2c/i2c-4:</p><p>/sys/devices/platform/soc/5002c00.i2c/i2c-5:</p><p>/sys/devices/platform/soc/6000000.hdmi/i2c-2:</p><p>/sys/devices/platform/soc/7081400.i2c/i2c-1:</p></li> || <li><p>'''28In the above output'''</p><ol style="list-style-type: none;"><li><p>a) 5002000 is the register base address of the i2c0 bus, and i2c-0 shown behind it is its corresponding i2c device node</p></li><li><p>b) 5002400 is the register base address of the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li><li><p>c) 5002800 is the register base address of the i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p></li></ol></li></ol>| '''TWI2}</li></ol><ol start="4" style="list-style-type: decimal;"><li><p>Then start testing i2c, first install i2c-SCLtools</UART3_TX'''p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''PI9sudo apt-get update'''</p>| <p>orangepi@orangepi:~$ '''265sudo apt-get install -y i2c-tools'''</p>|-}</li>| '''256'''<li><p>Then connect an i2c device to the i2c pin of the 40pin connector</p></li>| <li><p>Then use the '''PI0i2cdetect -y x'''x command. If the address of the connected i2c device can be detected, it means that i2c can be used normally.</p>{| class="wikitable" style="textbackground-aligncolor:#ffffdc;width: left800px;"|| '''29'''-|| <big><p>'''30Note that x in the i2cdetect -y x command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p>| <p>'''GNDDifferent i2c device addresses are different. The 0x50 address in the picture below is just an example. Please refer to what you actually see.'''</p></big>| }<div class="figure"> [[File:zero2w-img174.png]] </div></li></ol> <span id="pin-uart-test"></span> === 40pin UART test === # As can be seen from the table below, the available uarts are uart2, uart3, uart4 and uart5. Please note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial port. <div style="text-aligndisplay: leftflex;"|>::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: leftcenter;"|
|-
| '''271GPIO NO.'''| '''PI15'''| style="text-align: left;"|| '''31'''|| '''32'''| '''PWM1GPIO'''| '''PI11Function'''| '''267pin'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-
| '''258264'''| '''PI2PI8'''| '''TWI1-SDA'''| '''3'''|-| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''| style="text-align: left;"|'''269'''| '''35PI13'''|'''PWM3/UART4_TX'''| '''367'''|-| style="text-align: left;"|
| style="text-align: left;"|
| '''PC12GND'''| '''769'''|-| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-| '''261'''| '''PI5'''| '''TWI0_SCL/UART2_TX'''| '''15'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''PI43.3V'''| '''26017'''|-| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|-| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''3925'''|-| '''40266'''| '''PI10'''| '''TWI2-SDA/UART3_RX'''| '''27'''|-| '''256'''| '''PI0'''| style="text-align: left;"|| '''29'''|-| '''271'''| '''PI15'''| style="text-align: left;"|| '''31'''|-| '''268'''| '''PI12'''| '''PWM2'''| '''33'''|-| '''258'''| '''PI2'''| style="text-align: left;"|| '''35'''|-| '''272'''| '''PI16'''| style="text-align: left;"|| '''37'''|-| style="text-align: left;"|
| style="text-align: left;"|
| '''PI3GND'''| '''25939'''
|}
{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''pin'''
| '''Function'''
| '''GPIO'''
| '''GPIO NO.'''
|-
| '''2'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''4'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''6'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''8'''
| '''UART0_TX'''
| '''PH0'''
| '''224'''
|-
| '''10'''
| '''UART0_RX'''
| '''PH1'''
| '''225'''
|-
| '''12'''
| style="text-align: left;"|
| '''PI1'''
| '''257'''
|-
| '''14'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''16'''
| '''PWM4/UART4_RX'''
| '''PI14'''
| '''270'''
|-
| '''18'''
| style="text-align: left;"|
| '''PH4'''
| '''228'''
|-
| '''20'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''22'''
| '''TWI0_SDA/UART2_RX'''
| '''PI6'''
| '''262'''
|-
| '''24'''
| '''SPI1_CS0'''
| '''PH5'''
| '''229'''
|-
| '''26'''
| '''SPI1_CS1'''
| '''PH9'''
| '''233'''
|-
| '''28'''
| '''TWI2-SCL/UART3_TX'''
| '''PI9'''
| '''265'''
|-
| '''30'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''32'''
| '''PWM1'''
| '''PI11'''
| '''267'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''36'''
| style="text-align: left;"|
| '''PC12'''
| '''76'''
|-
| '''38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| '''40'''
| style="text-align: left;"|
| '''PI3'''
| '''259'''
|}
</div>
<ol start="2" style="list-style-type: decimal;"><li><p>pwm In Linux systems, uart is turned off by default in Linux systems and needs to be turned on manually to use before itcan be used. The opening steps are as follows:</p><ol style="list-style-type: lower-alpha;"><li><p>First run '''orangepi-config'''. Ordinary users remember to add > '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li><li><p>Then select '''System'''</p><p>[[File:zero2w-img80.png]]</p></li><li><p>Then select '''Hardware'''</p><p>[[File:zero2w-img81.png]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown > in the figure picture below, and then use the '''space''' to select the > configuration corresponding to the pwm serial port you want to open.</p><p>[[File:zero2w-img176.png]]</p></li><li><p>Then select '''<Save>''' to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''<Back>'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''<Reboot>''' to restart the system to make the > configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol></li><li><p>After restarting, you can start the PWM test</p><p>'''Please execute the following commands under the root user.'''</p><ol style="list-style-type: lower-alpha;"><li><p>Enter the following command on the command line to make pwm1 > output a 50Hz square wave</p><p>root@orangepi:~# '''echo 1 > /sys/class/pwm/pwmchip0/export'''</p><p>root@orangepi:~# '''echo 20000000 > /sys/class/pwm/pwmchip0/pwm1/period'''</p><p>root@orangepi:~# '''echo 1000000 > /sys/class/pwm/pwmchip0/pwm1/duty_cycle'''</p><p>root@orangepi:~# '''echo 1 > /sys/class/pwm/pwmchip0/pwm1/enable'''</p></li><li><p>Enter the following command on the command line to make pwm2 > output a 50Hz square wave</p></li></ol></li></ol> root@orangepi:~# '''echo 2 > /sys/class/pwm/pwmchip0/export''' root@orangepi:~# '''echo 20000000 > /sys/class/pwm/pwmchip0/pwm2/period''' root@orangepi:~# '''echo 1000000 > /sys/class/pwm/pwmchip0/pwm2/duty_cycle''' root@orangepi:~# '''echo 1 > /sys/class/pwm/pwmchip0/pwm2/enable''' <ol start="3" style="list-style-type: lower-alpha;"><li>Enter the following command on the command line to make pwm3 output > a 50Hz square wave</li></ol> root@orangepi:~# '''echo 3 > /sys/class/pwm/pwmchip0/export''' root@orangepi:~# '''echo 20000000 > /sys/class/pwm/pwmchip0/pwm3/period''' root@orangepi:~# '''echo 1000000 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle''' root@orangepi:~# '''echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable''' <ol start="4" style="list-style-type: lower-alpha;"><li>Enter the following command on the command line to make pwm4 output > a 50Hz square wave</li></ol> root@orangepi:~# '''echo 4 > /sys/class/pwm/pwmchip0/export''' root@orangepi:~# '''echo 20000000 > /sys/class/pwm/pwmchip0/pwm4/period''' root@orangepi:~# '''echo 1000000 > /sys/class/pwm/pwmchip0/pwm4/duty_cycle''' root@orangepi:~# '''echo 1 > /sys/class/pwm/pwmchip0/pwm4/enable''' <div class="figure"> [[File:zero2w-img177.png]] </div><span id="how-to-install-and-use-wiringop-python"></span> == How to install and use wiringOP-Python == '''Note: The pin header on the 40pin interface is not soldered by default, and you need to solder it yourself before it can be used.''' '''wiringOP-Python is the Python language version of wiringOP library, used to operate the development board's GPIO, I2C, SPI, UART and other hardware resources in the Python program''' '''Also please note that all the following commands are operated under the root user.''' <span id="how-to-install-wiringop-python"></span>=== How to install wiringOP-Python === <ol style="list-style-type: decimal;"><li><p>First install dependency packages</p><p>root@orangepi:~# '''sudo apt-get update'''</p><p>root@orangepi:~# '''sudo apt-get -y install git swig python3-dev python3-setuptools'''</p></li><li><p>Then use the following command to download the source code of wiringOP-Python</p></li></ol> '''Note that the following git clone--recursive command will automatically download the source code of wiringOP, because wiringOP-Python depends on wiringOP. Please make sure there are no errors during the download process due to network problems.''' If there is a problem downloading the code from GitHub, you can directly use the wiringOP-Python source code that comes with the Linux image. The storage location is: '''/usr/src/wiringOP-Python''' root@orangepi:~# '''git clone --recursive https://github.com/orangepi-xunlong/wiringOP-Python -b next''' root@orangepi:~# '''cd wiringOP-Python''' root@orangepi:~/wiringOP-Python# '''git submodule update --init --remote''' <ol start="3" style="list-style-type: decimal;"><li><p>Then use the following command to compile wiringOP-Python and install it into the Linux system of the development board</p><p>root@orangepi:~# '''cd wiringOP-Python'''</p><p>root@orangepi:~/wiringOP-Python# '''python3 generate-bindings.py > bindings.i'''</p><p>root@orangepi:~/wiringOP-Python# '''sudo python3 setup.py install'''</p></li><li><p>Then enter the following command. If helpful information is output, it means wiringOP-Python is successfully installed. Press the '''q''' key to exit the help information interface.</p></li></ol>
[[File:zero2w-img175.png]]</ol><ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select '''<Save>''' to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''<Back>'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''<Reboot>''' to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol></li></ol><!-- --><ol start="3" style="list-style-type: decimal;"><li><p>After entering the Linux system, first confirm whether there is a uart5 device node under '''/dev'''</p>{| class="wikitable" style="background-color:# Do not make changes ffffdc;width:800px;" |-| <big><p>'''Note that the linux5.4 system is /dev/ttyASx.'''</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''ls /dev/ttyS*'''</p><p>/dev/ttySx</p>|}</li><li><p>Then start testing the uart interface. First use Dupont wire to short-circuit the rx and tx pins of the uart interface to be tested.</p></li><li><p>Use the '''gpio''' command in wiringOP to this file unless test the loopback function of the serial port as shown below. If you know what you are doingcan see the following print, it means the serial port communication is normal.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that the last x in the gpio serial /dev/ttySx command needs to be replaced with the serial number of the corresponding uart device node.'''</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''gpio serial /dev/ttySx # linux-6.1 test command'''</p><p>orangepi@orangepi:~$ '''gpio serial /dev/ttyASx # linux-modify5.4 test command'''</p>
<ol start="5" style="listp>Out: 0: -style-type: decimal>"0</p><li><p>The steps to test whether wiringOPOut: 1: -Python is installed successfully under the python command line are as follows:> 1</p><ol style="list-style-typep>Out: 2: lower-alpha>"2</p><lip>First use the python3 command to enter the command line mode of Out: 3: -> python33^C</li></olp>|}
</li></ol>
<ol start="3" div style="list-style-typedisplay: lower-alphaflex;"><li>Finally, enter the following command to view the help information of > wiringOP-Python. Press the q key to exit the help information > interface.</li></ol> >>> '''help(wiringpi)''' Help on module wiringpi: NAME wiringpi DESCRIPTION # This file was automatically generated by SWIG (http://www.swig.org). # Version 4.0.2 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. CLASSES builtins.object GPIO I2C Serial nes {| class GPIO(builtins.object) | GPIO(pinmode=0) | >>> <span id="pin-gpio-port-test-1"></span>=== 40pin GPIO port test === '''Like wiringOP, wiringOP-Python can also determine which GPIO pin to operate by specifying the wPi number. Because there is no command to view the wPi number in wiringOP-Python, you can only view the board's wPi number and physics through the gpio command in wiringOP Correspondence of pins.''' [[File:zero2w-img170.png]] <ol style="list-style-type: decimal;wikitable"><li><p>The following uses pin No. 7 - corresponding to GPIO PI13 - corresponding to wPi serial number 2 - as an example to demonstrate how to set the high and low levels of the GPIO port.</p><p>[[File:zero2w-img171.png]]</p></li><li><p>The steps for testing directly with commands are as follows:</p><ol style="list-style-typewidth: lower-alpha390px;"><li><p>First set the GPIO port to output mode, where the first > parameter of the '''pinMode''' function is the serial number of > the wPi corresponding to the pin, and the second parameter is > the GPIO mode.</p><p>root@orangepi:~/wiringOPmargin-Python# '''python3 -c "import wiringpi; \'''</p><p>'''from wiringpi import GPIO; wiringpi.wiringPiSetup() ; \'''</p><p>'''wiringpi.pinMode(2, GPIO.OUTPUT) ; "'''</p></li><li><p>Then set the GPIO port to output a low level. After setting, you > can use a multimeter to measure the voltage value of the pin. > If it is 0v, it means the low level is set successfully.</p><p>root@orangepi:~/wiringOP-Python# '''python3 -c "import wiringpi; \'''</p><p>'''from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\'''</p><p>'''wiringpi.digitalWrite(2, GPIO.LOW)"'''</p></li><li><p>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 the setting of the high level is > successful.</p><p>root@orangepiright:~/wiringOP-Python# '''python3 -c "import wiringpi; \'''</p><p>'''from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\'''</p><p>'''wiringpi.digitalWrite(2, GPIO.HIGH)"20px;'''</p></li></ol></li><li><p>The steps for testing in the command line of python3 are as follows:</p><ol style="listtext-style-typealign: lower-alpha;"><li><p>First use the python3 command to enter the command line mode of > python3</p><p>root@orangepi:~# '''python3'''</p></li><li><p>Then import the python module of wiringpi</p><p>>>> '''import wiringpi'''</p><p>>>> '''from wiringpi import GPIO'''</p></li><li><p>Then set the GPIO port to output mode, where the first parameter > of the '''pinMode'''function is the serial number of the wPi > corresponding to the pin, and the second parameter is the GPIO > mode.</p><p>>>> '''wiringpi.wiringPiSetup()'''</p><p>0</p><p>>>> '''wiringpi.pinMode(2, GPIO.OUTPUT)'''</p></li><li><p>Then set the GPIO port to output a low level. After setting, you > can use a multimeter to measure the voltage value of the pin. > If it is 0v, it means the low level is set successfully.</p><p>>>> '''wiringpi.digitalWrite(2, GPIO.LOW)'''</p></li><li><p>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 the setting of the high level is > successful.</p><p>>center;>> '''wiringpi.digitalWrite(2, GPIO.HIGH)'''</p></li></ol></li><li><p>For wiringOP-Python to set the GPIO high and low levels in the python code, you can refer to the '''blink.py''' test program in the examples. The '''blink.py''' test program will set the voltage of all GPIO ports in the 40 Pin of the development board to continuously change high and low.</p><p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p><p>root@orangepi:~/wiringOP-Python/examples# '''ls blink.py'''</p><p>'''blink.py'''</p><p>root@orangepi:~/wiringOP-Python/examples'''# python3 blink.py'''</p></li></ol> <span id="pin-spi-test-1"></span>=== 40pin SPI test === # As can be seen from the table below, the spi available for the 40pin interface is spi1, and there are two chip select pins cs0 and cs1 {| class="wikitable"
|-
| '''GPIO NO.'''
| '''Function'''
| '''Pin'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-
| '''264'''
| '''TWI1-SDA'''
| '''3'''
|-
| '''263'''
| '''TWI1-SCL'''
| '''5'''
|-
| '''<span style="color:#FF0000">269</span>'''| '''<span style="color:#FF0000">PI13</span>'''| '''<span style="color:#FF0000">PWM3</span>/UART4_TX'''| '''<span style="color:#FF0000">7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224</span>'''
|-
| style="text-align: left;"|
| '''GND'''
| '''9'''
|-
| '''226'''
| '''UART5_TX'''
| '''11'''
|-
| '''227'''
| '''UART5_RX'''
| '''13'''
|-
| '''261'''
| '''TWI0_SCL/UART2_TX'''
| '''15'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|-
| '''231'''
| '''SPI1_MOSI'''
| '''19'''
|-
| '''232'''
| '''SPI1_MISO'''
| '''21'''
| '''PH6'''
| '''SPI1_CLK'''
| '''23'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|-
| '''266'''
| '''TWI2-SDA/UART3_RX'''
| '''27'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|-
| '''<span style="color:#FF0000">268</span>'''| '''<span style="color:#FF0000">PI12</span>'''| '''<span style="color:#FF0000">PWM2</span>'''| '''33'''|| '''34'''| '''GND'''| <span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"|>33</span>'''
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|}
|-
| '''dtbo configuration8'''| '''illustrateUART0_TX'''| '''PH0'''| '''224'''
|-
| '''spi1-cs0-cs1-spidev10'''| '''Open cs0 and cs1 of spi1 at the same timeUART0_RX'''| '''PH1'''| '''225'''
|-
| '''spi112'''| style="text-cs0-spidevalign: left;"|| '''PI1'''| '''Only open cs0 of spi1257'''
|-
| '''spi1-cs1-spidev14'''| '''Only open cs1 of spi1GND'''|} <ol start="5" style="listtext-style-typealign: lower-alphaleft;"><li><p>Then select '''<Save>''' to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''<Back>'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''<Reboot>''' to restart the system to make the > configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol> <!-- --><ol start="3" style="list-style-type: decimal;"><li><p>Then check whether there is a '''spidev1.x''' device node in the Linux system. If it exists, it means that the SPI1 configuration has taken effect.</p><p>orangepi@orangepi:~$ '''ls /dev/spidev1*'''</p><p>/dev/spidev1.0 /dev/spidev1.1</p><p>'''Note that only when you open spi1-cs0-cs1-spidev, you will see the device nodes of the two spi.'''</p></li><li><p>Then you can use the '''spidev_test.py''' program in examples to test the SPI loopback function. The '''spidev_test.py''' program needs to specify the following two parameters:</p><ol style="list-style-type: lower-alpha;"><li><p>'''--channel''': Specify the channel number of SPI</p></li><li><p>'''--port''': Specify the port number of the SPI</p></li></ol></li><li><p>Without shorting 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.</p><p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p></li></ol> root@orangepi:~/wiringOP-Python/examples# '''python3 spidev_test.py \''' '''--channel 1 --port 0''' 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 |.............….| <ol start="6" style="listtext-style-typealign: decimalleft;"><li><p>Then use Dupont wire to short-circuit the txd (pin 19 in the 40pin interface) and rxd (pin 21 in the 40pin interface) of SPI1 and then run spidev_test.py. The output is as follows, you can see If the data sent and received are the same, it means that the SPI1 loopback test is normal.</p><p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p></li></ol> root@orangepi:~/wiringOP-Python/examples# '''python3 spidev_test.py \''' '''--channel 1 --port 0''' 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 '''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 |......@.......…| <span id="pin-i2c-test-1"></span>=== 40pin I2C test === # As can be seen from the table below, the i2c available for the 40pin interface are i2c0, i2c1 and i2c2 {| class="wikitable"
|-
| '''GPIO NO.<span style="color:#FF0000">16</span>'''| '''GPIO<span style="color:#FF0000">PWM4</span>/UART4_RX'''| '''Function<span style="color:#FF0000">PI14</span>'''| '''Pin'''|| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.<span style="color:#FF0000">270</span>'''
|-
| '''18'''
| style="text-align: left;"|
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26422'''| '''PI8TWI0_SDA/UART2_RX'''| '''TWI1PI6'''| '''262'''|-SDA| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''3229'''|-| '''426'''| '''5VSPI1_CS1'''| '''PH9'''| '''233'''| style="text-align: left;"|'''28'''| style="text'''TWI2-align: left;"SCL/UART3_TX'''|'''PI9'''| '''265'''
|-
| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|| '''630'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''269<span style="color:#FF0000">32</span>'''| '''PI13<span style="color:#FF0000">PWM1</span>'''| '''PWM3<span style="color:#FF0000">PI11</UART4_TXspan>'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224<span style="color:#FF0000">267</span>'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''1236'''
| style="text-align: left;"|
| '''PI1PC12'''| '''25776'''
|-
| '''22738'''| '''PH3'''style="text-align: left;"|| '''UART5_RXPI4'''| '''13260'''|-| '''1440'''| '''GND'''| style="text-align: left;"|
| style="text-align: left;"|
| '''PI3'''
| '''259'''
|}
</div>
<ol start="2" style="list-style-type: decimal;">
<li><p>pwm is turned off by default in Linux systems and needs to be turned on manually to use it. The opening steps are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First run '''orangepi-config'''. Ordinary users remember to add '''sudo''' permissions.</p>
{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''261sudo orangepi-config'''</p>| }</li><li><p>Then select '''PI5System'''</p><p>[[File:zero2w-img80.png]]</p></li>| <li><p>Then select '''TWI0_SCL/UART2_TXHardware'''</p><p>[[File:zero2w-img81.png]]</p></li>| <li><p>Then use the keyboard's arrow keys to locate the position shown in the figure below, and then use the '''15space'''to select the configuration corresponding to the pwm you want to open.</p>|<p>[[File:zero2w-img176.png]]</p></li>| <li><p>Then select '''16<Save>'''to save</p><p>[[File:zero2w-img83.png]]</p></li>| <li><p>Then select '''PWM4/UART4_RX<Back>'''</p><p>[[File:zero2w-img84.png]]</p></li>| <li><p>Then select '''PI14<Reboot>'''to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol></li><li><p>After restarting, you can start the PWM test</p>{| '''270'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|-
| <p>root@orangepi:~# '''231echo 1 > /sys/class/pwm/pwmchip0/export'''</p>| <p>root@orangepi:~# '''PH7echo 20000000 > /sys/class/pwm/pwmchip0/pwm1/period'''</p>| <p>root@orangepi:~# '''SPI1_MOSIecho 1000000 > /sys/class/pwm/pwmchip0/pwm1/duty_cycle'''</p>| <p>root@orangepi:~# '''19echo 1 > /sys/class/pwm/pwmchip0/pwm1/enable'''</p>|}| '''20'''</li>| '''GND'''<li><p>Enter the following command on the command line to make pwm2 output a 50Hz square wave</p></li>{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| root@orangepi:~# '''232echo 2 > /sys/class/pwm/pwmchip0/export'''| root@orangepi:~# '''PH8echo 20000000 > /sys/class/pwm/pwmchip0/pwm2/period'''| '''SPI1_MISO'''| root@orangepi:~# '''21echo 1000000 > /sys/class/pwm/pwmchip0/pwm2/duty_cycle'''|| root@orangepi:~# '''22echo 1 > /sys/class/pwm/pwmchip0/pwm2/enable'''| '''TWI0_SDA}</UART2_RX'''ol><ol start="3" style="list-style-type: lower-alpha;">| '''PI6'''<li>Enter the following command on the command line to make pwm3 output a 50Hz square wave</li>{| '''262'''class="wikitable" style="width:800px;"
|-
| root@orangepi:~# '''230echo 3 > /sys/class/pwm/pwmchip0/export'''| root@orangepi:~# '''PH6echo 20000000 > /sys/class/pwm/pwmchip0/pwm3/period'''| root@orangepi:~# '''SPI1_CLKecho 1000000 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle'''| root@orangepi:~# '''23echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable'''|}| '''24'''</ol>| '''SPI1_CS0'''<ol start="4" style="list-style-type: lower-alpha;">| '''PH5'''<li>Enter the following command on the command line to make pwm4 output a 50Hz square wave</li>{| '''229'''class="wikitable" style="width:800px;"
|-
|-
| '''266'''| ''<big>'PI10''Note: The pin header on the 40pin interface is not soldered by default, and you need to solder it yourself before it can be used.'| '''TWI2-SDA</UART3_RX'''| '''27'''big>|}{| '''28'''| '''TWI2class="wikitable" style="background-SCL/UART3_TX'''| '''PI9'''| '''265'''color:#ffffdc;width:800px;"
|-
| <big>'''wiringOP-Python is the Python language version of wiringOP library, used to operate the development board'256s GPIO, I2C, SPI, UART and other hardware resources in the Python program'''| '''PI0Also please note that all the following commands are operated under the root user.'''</big>| style} <span id="texthow-to-install-align: left;wiringop-python"|></span>| '''29'''=== How to install wiringOP-Python ===|| '''30'''| '''GND'''| <ol style="textlist-alignstyle-type: leftdecimal;"|><li><p>First install dependency packages</p>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| <p>root@orangepi:~# '''271sudo apt-get update'''</p>| <p>root@orangepi:~# '''PI15sudo apt-get -y install git swig python3-dev python3-setuptools'''</p>|}</li><li><p>Then use the following command to download the source code of wiringOP-Python</p></li>{| class="wikitable" style="textbackground-aligncolor:#ffffdc;width: left800px;"|| '''31'''|| '''32'''| '''PWM1'''| '''PI11'''| '''267'''
|-
| '''268'''| <big>'''PI12Note that the following git clone--recursive command will automatically download the source code of wiringOP, because wiringOP-Python depends on wiringOP. Please make sure there are no errors during the download process due to network problems.'''| '''PWM2'''| '''33'''|| '''34If there is a problem downloading the code from GitHub, you can directly use the wiringOP-Python source code that comes with the Linux image. The storage location is: /usr/src/wiringOP-Python'''</big>| '''GND'''}{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| root@orangepi:~# '''258git clone --recursive https://github.com/orangepi-xunlong/wiringOP-Python -b next'''| root@orangepi:~# '''PI2cd wiringOP-Python'''| style="textroot@orangepi:~/wiringOP-align: left;"|| Python# '''35git submodule update --init --remote'''|}| '''36'''</ol>| <ol start="3" style="textlist-style-aligntype: leftdecimal;"|>| '''PC12'''<li><p>Then use the following command to compile wiringOP-Python and install it into the Linux system of the development board</p>{| '''76'''class="wikitable" style="width:800px;"
|-
| <p>root@orangepi:~# '''272cd wiringOP-Python'''</p>| <p>root@orangepi:~/wiringOP-Python# '''PI16python3 generate-bindings.py > bindings.i'''</p>| style="text<p>root@orangepi:~/wiringOP-align: left;"|| Python# '''37sudo python3 setup.py install'''</p>|}| </li><li><p>Then enter the following command. If helpful information is output, it means wiringOP-Python is successfully installed. Press the '''38q'''key to exit the help information interface.</p></li>{| class="wikitable" style="text-alignwidth: left800px;"|| '''PI4'''| '''260'''
|-
| style="text-alignroot@orangepi: left;"|| style="text~/wiringOP-align: left;"|| '''GND'''| '''39'''|| '''40Python# '''| style="textpython3 -align: leftc "import wiringpi; help(wiringpi)""|| '''PI3'''| '''259'''|}Help on module wiringpi:
: # the SWIG interface file instead.|}</ol><ol start="75" style="list-style-type: decimal;"><li><p>Then you can run the '''ds1307.py''' The steps to test program in '''examples''' to read whether wiringOP-Python is installed successfully under the RTC timepython command line are as follows:</p><pol style="list-style-type: lower-alpha;"><li>'''Note that First use the x in i2c-x in the following python3 command needs to be replaced with enter the serial number command line mode of the device node corresponding to the i2c bus.'''> python3</pli><p>{| class="wikitable" style="width:800px;" |-| root@orangepi:~/wiringOP-Python# '''cd examplespython3'''|}</pol><p>root@orangepi:~/wiringOPol start="2" style="list-Python/examples# '''python3 ds1307.py style-type: lower-device \'''alpha;"><li>Then import the python module of wiringpi</pli><p>{| class="wikitable" style="width:800px;" |-| >>> '''"/dev/i2c-x"import wiringpi;'''|}</pol><p>Thu 2022ol start="3" style="list-06style-16 04type:35:46</plower-alpha;"><pli>Thu 2022Finally, enter the following command to view the help information of > wiringOP-06-16 04:35:47Python. Press the q key to exit the help information > interface.</pli><p>Thu 2022{| class="wikitable" style="width:800px;" |-06-16 04| >>> '''help(wiringpi)''' Help on module wiringpi:35 NAME :48</p>wiringpi DESCRIPTION<p>^C</p><p>exit<: # This file was automatically generated by SWIG (http:/p></li></ol>www.swig.org). : # Version 4.0.2 : # : # Do not make changes to this file unless you know what you are doing--modify
|-
| <big>'''264Like wiringOP, wiringOP-Python can also determine which GPIO pin to operate by specifying the wPi number. Because there is no command to view the wPi number in wiringOP-Python, you can only view the board's wPi number and physics through the gpio command in wiringOP Correspondence of pins.'''</big> [[File:zero2w-img170.png| '''PI8'''center]]| '''TWI1} <ol style="list-style-type: decimal;"><li><p>The following uses pin No. 7 - corresponding to GPIO PI13 - corresponding to wPi serial number 2 -SDA'''as an example to demonstrate how to set the high and low levels of the GPIO port.</p>| '''3'''<p>[[File:zero2w-img171.png]]</p></li>|<li><p>The steps for testing directly with commands are as follows:</p>| '''4'''<ol style="list-style-type: lower-alpha;">| <li><p>First set the GPIO port to output mode, where the first parameter of the '''5VpinMode'''function is the serial number of the wPi corresponding to the pin, and the second parameter is the GPIO mode.</p>{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| '''263'''| <p>root@orangepi:~/wiringOP-Python# '''PI7python3 -c "import wiringpi; \'''</p>| <p>'''TWI1-SCLfrom wiringpi import GPIO; wiringpi.wiringPiSetup() ; \'''</p>| <p>'''5wiringpi.pinMode(<span style="color:#FF0000">2, GPIO.OUTPUT</span>) ; "'''</p>|}| '''6'''</li>| '''GND'''<li><p>Then set the GPIO port to output a low level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 0v, it means the low level is set successfully.</p>{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| <p>root@orangepi:~/wiringOP-Python# '''269python3 -c "import wiringpi; \'''</p>| <p>'''PI13from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\'''</p>| <p>'''PWM3wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.LOW</UART4_TXspan>)"'''</p>| '''7'''}|</li>| '''8'''<li><p>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 the setting of the high level is successful.</p>{| '''UART0_TX'''| '''PH0'''| '''224'''class="wikitable" style="width:800px;"
|-
| style="text-align<p>root@orangepi: left;"|| style="text~/wiringOP-align: left;"|| Python# '''GNDpython3 -c "import wiringpi; \'''</p>| <p>'''9from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\'''</p>|| <p>'''10wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.HIGH</span>)"'''</p>| '''UART0_RX'''}</li></ol></li><li><p>The steps for testing in the command line of python3 are as follows:</p><ol style="list-style-type: lower-alpha;">| '''PH1'''<li><p>First use the python3 command to enter the command line mode of python3</p>{| '''225'''class="wikitable" style="width:800px;"
|-
| '''226'''| <p>root@orangepi:~# '''PH2python3'''</p>| '''UART5_TX'''}| '''11'''</li>|| '''12'''<li><p>Then import the python module of wiringpi</p>{| class="wikitable" style="text-alignwidth: left800px;"|| '''PI1'''| '''257'''
|-
| '''227'''| <p>>>> '''PH3import wiringpi'''</p>| <p>>>> '''UART5_RXfrom wiringpi import GPIO'''</p>| '''13'''}|| '''14'''</li>| <li><p>Then set the GPIO port to output mode, where the first parameter of the '''GNDpinMode'''function is the serial number of the wPi corresponding to the pin, and the second parameter is the GPIO mode.</p>{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| <p>>>> '''wiringpi.wiringPiSetup()'''</p><p>0</p><p>>>> '''261wiringpi.pinMode(<span style="color:#FF0000">2, GPIO.OUTPUT</span>)'''</p>|}</li><li><p>Then set the GPIO port to output a low level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 0v, it means the low level is set successfully.</p>{| class="wikitable" style="width:800px;" |-| <p>>>> '''PI5wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.LOW</span>)'''</p>|}</li><li><p>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 the setting of the high level is successful.</p>{| class="wikitable" style="width:800px;" |-| <p>>>> '''TWI0_SCLwiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.HIGH</UART2_TXspan>)'''</p>| }</li></ol></li><li><p>For wiringOP-Python to set the GPIO high and low levels in the python code, you can refer to the '''blink.py''' test program in the examples. The '''15blink.py'''test program will set the voltage of all GPIO ports in the 40 Pin of the development board to continuously change high and low.</p>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP-Python# '''16cd examples'''</p><p>root@orangepi:~/wiringOP-Python/examples# '''ls blink.py'''</p><p>'''blink.py'''</p><p>root@orangepi:~/wiringOP-Python/examples'''# python3 blink.py'''</p>|}</li></ol> <span id="pin-spi-test-1"></span> === 40pin SPI test === # As can be seen from the table below, the spi available for the 40pin interface is spi1, and there are two chip select pins cs0 and cs1 <div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''PWM4/UART4_RXGPIO NO.'''| '''GPIO'''| '''PI14Function'''| '''270Pin'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''17'''|| '''18'''| style="text-align: left;"|| '''PH4'''| '''2281'''
|-
| '''231264'''| '''PH7PI8'''| '''SPI1_MOSI'''| '''19TWI1-SDA'''|| '''203'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''232263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|-| '''269'''| '''PI13'''| '''PWM3/UART4_TX'''| '''7'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''9'''|-| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-| '''261'''| '''PI5'''| '''TWI0_SCL/UART2_TX'''| '''15'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''17'''|-| '''<span style="color:#FF0000">231</span>'''| '''PH8<span style="color:#FF0000">PH7</span>'''| '''SPI1_MISO<span style="color:#FF0000">SPI1_MOSI</span>'''| '''21<span style="color:#FF0000">19</span>'''|-| '''22<span style="color:#FF0000">232</span>'''| '''TWI0_SDA<span style="color:#FF0000">PH8</UART2_RXspan>'''| '''PI6<span style="color:#FF0000">SPI1_MISO</span>'''| '''262<span style="color:#FF0000">21</span>'''
|-
| '''<span style="color:#FF0000">230</span>'''| '''<span style="color:#FF0000">PH6</span>'''| '''<span style="color:#FF0000">SPI1_CLK</span>'''| '''<span style="color:#FF0000">23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229</span>'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|-
| '''266'''
| '''TWI2-SDA/UART3_RX'''
| '''27'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|}
|-
| '''Multiplexing function in 40pinPin'''| '''Corresponding dtbo configurationFunction'''| '''GPIO'''| '''GPIO NO.'''
|-
| '''40pin - uart22'''| '''pi-uart25V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - uart34'''| '''pi-uart35V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin 6'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''8'''| '''UART0_TX'''| '''PH0'''| '''224'''|-| '''10'''| '''UART0_RX'''| '''PH1'''| '''225'''|-| '''12'''| style="text-align: left;"|| '''PI1'''| '''257'''|-| '''14'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||- uart4| '''16'''| '''PWM4/UART4_RX'''| '''PI14'''| '''270'''|-| '''pi18'''| style="text-uart4align: left;"|| '''PH4'''| '''228'''
|-
| '''40pin - uart520'''| '''ph-uart5GND'''|} [[File:zero2w-img175.png]] <ol startstyle="5text-align: left;" || style="list-styletext-typealign: lower-alphaleft;">||-<li><p>Then select | '''22'''<Save>| ''' to save<TWI0_SDA/p>UART2_RX'''| '''PI6'''| '''262'''|-| '''<p>[[Filespan style="color:zero2w-img83.png]]</p#FF0000">24</lispan>'''| '''<lispan style="color:#FF0000">SPI1_CS0<p/span>Then select '''<Back>| '''</p><p>[[Filespan style="color:zero2w-img84.png]]</p#FF0000">PH5</lispan><li><p>Then select '''<Reboot>| ''' to restart the system to make the > configuration take effect.</p><p>[[Filespan style="color:zero2w-img85.png]]</p#FF0000">229</li></olspan>''' <!|-- -->| '''<ol start="3" span style="list-style-typecolor: decimal;#FF0000">26<li/span><p>After entering the Linux system, first confirm whether there is a uart5 device node under '''| '''<span classstyle="markcolor:#FF0000">/devSPI1_CS1</span>'''| '''</pspan style="color:#FF0000">PH9<p/span>'''注意, linux5.4系统为/dev/ttyASx.| '''<span style="color:#FF0000">233</pspan>'''|-<p>orangepi@orangepi:~$ | '''ls /dev/ttyS*28'''</p><p>/dev/ttySx</p></li><li><p>Then start testing the uart interface. First use Dupont wire to short| '''TWI2-circuit the rx and tx pins of the uart interface to be tested.<SCL/p></li>UART3_TX'''<li><p>Use the | '''gpioPI9''' command in wiringOP to test the loopback function of the serial port as shown below. If you can see the following print, it means the serial port communication is normal.</p><p>| '''Note that the last x in the gpio serial /dev/ttySx command needs to be replaced with the serial number of the corresponding uart device node.265'''</p><p>orangepi@orangepi:~$ |-| '''gpio serial /dev/ttySx # linux-6.1 test command30'''</p><p>orangepi@orangepi:~$ | '''gpio serial /dev/ttyASx # linux-5.4 test commandGND'''</p><p>Out: 0| style="text-align: ->left; 0</p>"|<p>Out| style="text-align: 1: ->left; 1</p>"|<p>Out: 2: |-> 2</p><p>Out: 3: -> 3^C</p></li>| '''32'''<li><p>Finally, you can run the | '''serialTest.pyPWM1''' program in examples to test the loopback function of the serial port. If you can see the following print, it means that the serial port loopback test is normal.</p><p>| '''Note that the x in /dev/ttySx or /dev/ttyASx in the command needs to be replaced with the serial number of the corresponding uart device node.PI11'''</p><p>root@orangepi:~/wiringOP-Python# | '''cd examples267'''</p><p>root@orangepi:~/wiringOP|-Python/examples# | '''python3 serialTest.py --device "/dev/ttySx" # linux6.1 use34'''</p><p>root@orangepi:~/wiringOP-Python/examples# | '''python3 serialTest.py --device "/dev/ttyASx" # linux5.4 useGND'''</p><p>Out: 0| style="text-align: ->left; 0</p>"|<p>Out| style="text-align: 1: ->left; 1</p>"|<p>Out: 2: |-> 2</p><p>Out: 3| '''36'''| style="text-align: ->left; 3</p>"|<p>Out: 4:^C</p>| '''PC12'''<p>exit</p></li></ol>| '''76'''|-<span id| '''38'''| style="hardwaretext-watchdog-testalign: left;"></span>|== Hardware watchdog test ==| '''PI4'''| '''260'''The watchdog_test program is pre|-installed in the Linux system released by Orange Pi and can be tested directly.| '''40'''The method to run the watchdog_test program is as follows| style="text-align:left;"|| '''PI3'''| '''259'''|}</div>
<ol start="2" style="list-style-type: decimal;">
<li><p>In Linux systems, spi1 is turned off by default and needs to be turned on manually before it can be used. The opening steps are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The second parameter 10 represents the counting time of the watchdogFirst run '''orangepi-config'''. If the dog is not fed within this time, the system will restartOrdinary users remember to add '''sudo''' permissions.</p></li><li><p>We can feed the dog by pressing any key on the keyboard (except ESC). After feeding the dog, the program will print a line "{| class="wikitable" style="width:800px;keep alive" to indicate that the dog feeding is successful.</p>" |-| <p>orangepi@orangepi:~$ '''sudo watchdog_test 10orangepi-config'''</p><p>open success|}</pli><pli>options is 33152,identity is sunxi-wdt</p><p>put_usr return,if 0,success:0Then select '''System'''</p><p>The old reset time is[[File: 16zero2w-img80.png]]</p><p>return ENOTTY,if -1,success:0</pli><p>return ENOTTY,if -1,success:0</pli><p>put_user return,if 0,success:0Then select '''Hardware'''</p><p>put_usr return,if 0,success[[File:0zero2w-img81.png]]</p><p>keep alive</pli><pli>keep alive</p><p>keep aliveThen use the keyboard's arrow keys to locate the position shown in the figure below, and then use the '''space''' to select the dtbo configuration of the SPI you want to open.</p></li></ol>
<ol style="list-style-type: lower-alpha;">
<li><p>First create a new '''~/.pip''' directory, then add the > '''pip.conf''' configuration file, and set the pip source in it > to Tsinghua source.</p><p>orangepi@orangepi:~$ '''mkdir -p ~/.pip-channel'''</p><p>orangepi@orangepi:~$ '''cat <<EOF > ~/.pip/pip.conf'''Specify the channel number of SPI</p><p>'''[global]'''</pli><p>'''timeout = 6000'''</pli><p>'''index-url = https://pypi.tuna.tsinghua.edu.cn/simple'''</p><p>'''trusted-host = pypi.tuna.tsinghua.edu.cnport'''</p><p>'''EOF'''</p></li><li><p>Then use pip3 to install : Specify the port number of the Python library very quicklySPI</p></li></ol>
</li>
<li><p>How to temporarily change Without shorting the pip source under Linuxmosi and miso pins of SPI1, where '''<packagename>''' needs to be replaced with a specific package namethe output result of running spidev_test.py is as follows. You can see that the data of TX and RX are inconsistent.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepiroot@orangepi:~$ '''pip3 install <packagename> /wiringOP-i \'''</p><p>Python# '''https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cncd examples'''</p></li></ol>
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 |......@.......…|
<span iddiv style="how-to-install-home-assistantdisplay: flex;"></span>::{| class="wikitable" style= How to install Home Assistant == "width:390px;margin-right: 20px;text-align: center;"|-| '''Note that this article will only provide methods for installing Home Assistant in Ubuntu or Debian systems. For detailed usage of Home Assistant, please refer to the official documentation or corresponding booksGPIO NO.'''| '''GPIO'''<span id="installation-via-docker"></span>| '''Function'''=== Installation via docker ===| '''Pin'''|-<ol | style="list-styletext-typealign: decimalleft;">|<li><p>First, please install docker and ensure that docker can run normally| style="text-align: left;"|| '''3. For the installation steps of docker, please refer to the instructions in the [[\l3V'''|'''How to Install Docker1''']] section.</p></li>|-| '''<lispan style="color:#FF0000"><p>Then you can search for the docker image of Home Assistant264</p><pspan>orangepi@orangepi:~$ '''docker search homeassistant| '''</pspan style="color:#FF0000">PI8</lispan>'''| '''<lispan style="color:#FF0000"><p>Then use the following command to download the Docker image of Home Assistant to your local computer. The image size is about 1GB, and the download time will be relatively long. Please be patient and wait for the download to complete.TWI1-SDA</p><pspan>orangepi@orangepi:~$ '''docker pull homeassistant/home-assistant| '''</pspan style="color:#FF0000"><p>Using default tag: latest3</pspan>'''|-| '''<pspan style="color:#FF0000">latest: Pulling from homeassistant/home-assistant263</pspan>'''| '''<p>be307f383eccspan style="color: Downloading</p#FF0000"><p>5fbc4c07ac88: Download completev</pspan>'''<p>| '''...... (Omit some output)<span style="color:#FF0000">TWI1-SCL</span>'''</p>| '''<p>3cc6a1510c9fspan style="color: Pull complete</p#FF0000"><p>7a4e4d5b979f: Pull complete5</pspan>'''<p>Digest: sha256:81d381f5008c082a37da97d8b08dd8b358dae7ecf49e62ce3ef1eeaefc4381bb</p><p>Status: Downloaded newer image for homeassistant/home|-assistant:latest</p><p>docker.io/homeassistant/home-assistant:latest</p></li><li><p>Then you can use the following command to view the docker image of Home Assistant you just downloaded</p><p>orangepi@orangepi:~$ | '''269''docker images homeassistant/home-assistant'| '''PI13'''</p><p>REPOSITORY TAG IMAGE ID CREATED SIZE<| '''PWM3/p>UART4_TX'''<p>homeassistant/home-assistant latest bfa0ab9e1cf5 2 months ago | '''1.17GB7'''</p></li><li><p>At this point you can run the Home Assistant docker container</p>|-| style="text-align: left;"|<p>orangepi@orangepi| style="text-align:~$ 'left;"|| '''docker run -d \GND'''</p><p>| '''--name homeassistant \9'''</p><p>|-| '''--privileged \226'''</p><p>| '''--restart=unless-stopped \PH2'''</p><p>| '''-e TZ=Asia/Shanghai \UART5_TX'''</p><p>| '''-v /home/orangepi/home-assistant:/config \11'''</p><p>|-| '''--network=host \227'''</p><p>| '''homeassistant/home-assistant:latestPH3'''</p></li><li><p>Then enter【the IP address of the development board: 8123】in the browser to see the Home Assistant interface</p>| '''UART5_RX'''<p>| '''It takes a while for the Home Assistant container to start. If the interface below does not display normally, please wait a few seconds before refreshing it. If the following interface is not displayed normally after waiting for more than a minute, it means there is a problem with the Home Assistant installation. At this time, you need to check whether there is a problem with the previous installation and setting process.13'''</p>|-| '''<div classspan style="figurecolor:#FF0000"> [[File:zero2w-img180.png]] 261</div></li><li><pspan>Then enter your '''name, username| ''' and '''password<span style="color:#FF0000">PI5</span>''' and click '''Create Account| '''</p><div classspan style="figurecolor:#FF0000"> [[File:zero2w-img181.png]] TWI0_SCL</divspan></li>UART2_TX'''| '''<li><pspan style="color:#FF0000">Then follow the interface prompts to set according to your own preferences, and then click Next15</pspan>'''<div class|-| style="figuretext-align: left;">|| style="text-align: left;"|[[File:zero2w-img182| '''3.png]]3V'''| '''17'''</div></li><li><p>Then click Next</p><div class="figure"> [[File:zero2w|-img183.png]]| '''231'''</div></li>| '''PH7'''<li><p>Then click Finish</p>| '''SPI1_MOSI'''<div class="figure">| '''19''' [[File:zero2w|-img184.png]]| '''232'''</div></li>| '''PH8'''<li><p>The main interface finally displayed by Home Assistant is as shown below</p>| '''SPI1_MISO'''<p>[[File:zero2w| '''21'''|-img185.png]]</p></li><li><p>Method to stop Home Assistant container</p>| '''230'''<ol style="list-style-type: lower-alpha;"><li><p>The command to view the docker container is as follows</p><p>orangepi@orangepi:~$ | '''docker ps -aPH6'''| '''SPI1_CLK'''</p></li><li><p>The command to stop the Home Assistant container is as follows</p><p>orangepi@orangepi:~$ | '''docker stop homeassistant23'''</p></li><li><p>The command to delete the Home Assistant container is as follows</p>|-| style="text-align: left;"|<p>orangepi@orangepi| style="text-align:~$ left;"|| '''docker rm homeassistantGND'''| '''25'''|-| '''</pspan style="color:#FF0000">266</li></olspan>'''</li></ol> | '''<span idstyle="installation-via-pythoncolor:#FF0000">PI10</span>=== Installation via python === '''Before installation, please change the source of pip to a domestic source to speed up the installation of Python packages. For the configuration method, see the instructions in the section "[[\l|How to Change the Pip Source of Python]]"''' <ol span style="list-style-typecolor: decimal;#FF0000">TWI2-SDA<li><p/span>First install dependency packages</p><p>orangepi@orangepi:~$ UART3_RX'''sudo apt-get update| '''</pspan style="color:#FF0000">27<p/span>orangepi@orangepi:~$ '''sudo apt-get install -y python3 python3-dev python3|-venv \'''</p><p>| '''python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \256'''</p><p>| '''libopenjp2-7 libtiff5 libturbojpeg0-dev tzdataPI0'''</p><p>| style="text-align: left;"|| '''If it is debian12, please use the following command:29'''</p><p>orangepi@orangepi:~$ |-| '''sudo apt-get update271'''</p><p>orangepi@orangepi:~$ | '''sudo apt-get install -y python3 python3-dev python3-venv \PI15'''</p><p>| style="text-align: left;"|| '''31''python3-pip libffi'|-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \| '''268'''</p><p>| '''libopenjp2-7 libturbojpeg0-dev tzdataPI12'''</p></li><li><p>Then you need to compile and install Python3.9. For the method, please refer to the [[\l|| '''PWM2'Python source code compilation and installation method''']] section.</p><p>| '''The default Python version of Debian Bullseye is Python3.9, so there is no need to compile and install it.33'''</p><p>|-| '''The default Python version of Ubuntu Jammy is Python3.10, so there is no need to compile and install it.258'''</p><p>| '''The default Python version of Debian Bookworm is Python3.11, so there is no need to compile and install it.PI2'''</p></li><li><p>Then create a Python virtual environment</p>| style="text-align: left;"|<p>| '''Debian Bookworm is python3.11, please remember to replace the corresponding command.35'''</p><p>orangepi@orangepi:~$ |-| '''sudo mkdir /srv/homeassistant272'''</p><p>orangepi@orangepi:~$ | '''sudo chown orangepi:orangepi /srv/homeassistantPI16'''</p><p>orangepi@orangepi:~$ | style="text-align: left;"|| '''cd /srv/homeassistant37'''</p><p>orangepi@orangepi:~$ '''python3.9 |-m venv .'''</p><p>orangepi@orangepi| style="text-align: left;"|| style="text-align:~$ left;"|| '''source bin/activateGND'''</p><p>(homeassistant) orangepi@orangepi:/srv/homeassistant$</p></li><li><p>Then install the required Python packages</p><p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ | '''python3 -m pip install wheel39'''</p></li><li><p>Then you can install Home Assistant Core</p>|}<p>(homeassistant) orangepi@orangepi{| class="wikitable" style="width:390px;margin-right:/srv/homeassistant$ '20px;text-align: center;"|-| '''pip3 install homeassistantPin'''</p></li><li><p>Then enter the following command to run Home Assistant Core</p>| '''Function'''<p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ | '''hassGPIO'''</p></li><li><p>Then enter【| '''development board IP address: 8123GPIO NO.'''】 in the browser to see the Home Assistant interface</p><p>|-| '''When you run the hass command for the first time, some libraries and dependency packages necessary for operation will be downloaded, installed and cached. This process may take several minutes. Note that you cannot see the Home Assistant interface in the browser at this time. Please wait for a while and then refresh it.2'''| '''5V'''</p><div class| style="figuretext-align: left;">| [[File:zero2w| style="text-img180.png]]align: left;"||-</div></li></ol>| '''4''' <span id| '''5V'''| style="opencvtext-installation-methodalign: left;"></span>|== OpenCV installation method == <span id| style="usetext-apt-to-install-opencvalign: left;"></span>|=== Use apt to install OpenCV ===|-| '''6'''<ol style="list| '''GND'''| style="text-align: left;"|| style="text-typealign: decimalleft;">|<li><p>The installation command is as follows</p>|-<p>orangepi@orangepi:~$ | '''sudo apt-get update8'''</p><p>orangepi@orangepi:~$ | '''sudo apt-get install -y libopencv-dev python3-opencvUART0_TX'''</p></li><li><p>Then use the following command to print the version number of OpenCV. The output is normal, indicating that the OpenCV installation is successful.</p>| '''PH0'''| '''224'''<ol style="list|-style-type: lower-alpha;"><li><p>The version of OpenCV in Ubuntu22.04 is as follows:</p><p>orangepi@orangepi:~$ | '''python3 -c "import cv2; print(cv2.__version__)"10'''</p><p>| '''4.5.4UART0_RX'''</p></li><li><p>The version of OpenCV in Ubuntu20.04 is as follows:</p><p>orangepi@orangepi:~$ | '''python3 -c "import cv2; print(cv2.__version__)"PH1'''</p><p>| '''4.2.0225'''</p></li><li><p>The version of OpenCV in Debian11 is as follows:</p>|-<p>orangepi@orangepi:~$ | '''python3 -c "import cv2; print(cv2.__version__)"12'''</p><p>| style="text-align: left;"|| '''4.5.1PI1'''</p></li><li><p>The version of OpenCV in Debian12 is as follows:</p><p>orangepi@orangepi:~$ | ''''python3 -c "import cv2; print(cv2.__version__)"257'''</p><p>|-| '''4.6.014'''</p></li></ol></li></ol>| '''GND''' <span id| style="settext-up-the-chinese-environment-and-install-the-chinese-input-methodalign: left;"></span>|| style== Set up the Chinese environment and install the Chinese input method =="text-align: left;"||-| '''Note, before installing the Chinese input method, please make sure that the Linux system used by the development board is a desktop version.16''' <span id="debian-system-installation-method"><| '''PWM4/span>UART4_RX'''=== Debian system installation method ===| '''PI14'''| '''270'''<ol style="list-style|-type: decimal;"><li><p>First set the default | '''locale18''' to Chinese</p><ol | style="listtext-style-typealign: lower-alphaleft;">|<li><p>Enter the following command to start configuring | '''localePH4'''</p><p>orangepi@orangepi:~$ | '''228'''sudo dpkg|-reconfigure locales| '''</p></li><li><p>Then select 20'''zh_CN.UTF-8 UTF-8| ''' in the pop-up interface (use > the up and down keys on the keyboard to move up and down, use > the space bar to select, and finally use the Tab key to move > the cursor to GND'''<| style="text-align: left;OK>''', and then return Car can be used)</p>"|<p>[[File| style="text-align:zero2wleft;"||-img186.png]]| '''</pspan style="color:#FF0000">22</lispan>'''| '''<lispan style="color:#FF0000">TWI0_SDA<p/span>Then set the default /UART2_RX'''locale| ''' to <span style="color:#FF0000">PI6</span>'''zh_CN.UTF-8| '''</p><p>[[Filespan style="color:zero2w-img187.png]]</p#FF0000">262</li><lispan><p>After exiting the interface, the '''locale|-| '''24''' setting will begin. > The output displayed on the command line is as follows:</p><p>orangepi@orangepi:~$ | '''sudo dpkg-reconfigure localesSPI1_CS0'''</p><p>Generating locales (this might take a while)...</p>| '''PH5'''| '''229'''<p>en_US.UTF|-8... done</p><p>zh_CN.UTF-8... done</p><p>Generation complete.</p></li></ol></li><li><p>Then open | '''26'''Input Method| '''SPI1_CS1'''</p><p>[[File:zero2w-img188.png]]</p></li><li><p>Then select | '''OKPH9'''</p><p>[[File:zero2w| '''233'''|-img189.png]]| '''</pspan style="color:#FF0000">28</lispan><li><p>Then select '''Yes| '''</pspan style="color:#FF0000"><p>[[File:zero2wTWI2-img190.png]]SCL</pspan></li><li><p>Then select UART3_TX'''fcitx| '''</pspan style="color:#FF0000">PI9<p/span>[[File'''| '''<span style="color:zero2w-img191.png]]</p#FF0000">265</li><lispan><p>Then select '''OK|-| '''30'''</p><p>[[File:zero2w-img192.png]]</p></li><li><p>| '''Then restart the Linux system to make the configuration take effect.GND'''</p></li><li><p>Then open | style="text-align: left;"|| style="text-align: left;"||-| '''Fcitx configuration32'''| '''PWM1'''</p><p>[[File:zero2w-img193.png]]</p></li>| '''PI11'''<li><p>Then click the + sign as shown in the picture below</p>| '''267'''<p>[[File:zero2w|-img194.png]]</p></li><li><p>Then search '''Google Pinyin''' and click '''OK'''| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''36'''| style="text-align: left;"|| '''PC12'''| '''76'''|-| '''38'''| style="text-align: left;"|| '''PI4'''| '''260'''|-| '''40'''| style="text-align: left;"|| '''PI3'''| '''259'''|}</p><div class="figure">
<ol start="2" style="list-style-type: decimal;"><li><p>i2c is turned off by default in Linux systems and needs to be turned on manually to use it. The opening steps are as follows:</p><ol style="list-style-type: lower-alpha;"><li><p>First run '''orangepi-config'''. Ordinary users remember to add '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li><li><p>Then select '''System'''</p><p>[[File:zero2w-img195img80.png]]</p></li><li><p>Then select '''Hardware'''</p><p>[[File:zero2w-img81.png]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown in the picture below, and then use the '''space''' to select the corresponding i2c configuration in the picture below.</p></li>
[[File:zero2w-img173.png]]</ol><ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select <span class="mark"><Save></span> to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select <span idclass="installationmark"><Back></span></p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select <span class="mark"><Reboot></span> to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol></li></ol><!--method-of-ubuntu><ol start="3" style="list-20.04style-type: decimal;"><li><p>After starting the Linux system, first confirm that there is an open i2c device node under <span class="mark">/dev</span></p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''ls /dev/i2c-*'''</p><p>'''/dev/i2c-*'''</p>|}{| class= Installation method of Ubuntu 20.04 system "wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''注意,这里说的Linux镜像具体指的是从Orange Pi资料下载页面下载的Debian或者Ubuntu这样的Linux发行版镜像。'''</big>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Sometimes the i2c device node and the i2c bus serial number do not correspond one to one. For example, the i2c device node of the i2c1 bus may be /dev/i2c-3.'''</p><p>'''The method to accurately confirm the device node under /dev corresponding to the i2c bus is: '''</p></big>
<li><p>'''In the above output'''</p>
<ol style="list-style-type: none;">
<li><p>a) 5002000 is the register base address of the i2c0 bus, and i2c-0 shown behind it is its corresponding i2c device node</p></li>
<li><p>b) 5002400 is the register base address of the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li>
<li><p>c) 5002800 is the register base address of the i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p></li></ol>
</li></ol>
|}
</li></ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>Then select '''Apply Systemstart testing i2c, first install i2c-Wide''' to apply the Chinese settings to the entire systemtools</p>{| class="wikitable" style="width:800px;" |-| <p>[[Fileorangepi@orangepi:zero2w~$ '''sudo apt-img212.png]]get update'''</p></li><li><p>orangepi@orangepi:~$ '''sudo'''''Then restart the Linux system to make the configuration take effect'apt-get install -y i2c-tools'''</p>|}</li><li><p>After re-entering Then connect an i2c device to the system, please select '''Do not ask me again''' in i2c pin of the following interface, and then please decide whether 40pin connector. Here we take the standard folder should also be updated to Chinese according to your own preferencesDS1307 RTC module as an example.</p><p>[[File:zero2w-img206img178.png]]</p></li><li><p>Then you use the '''i2cdetect -y x'''command. If the address of the connected i2c device can see be detected, it means that the desktop i2c device is displayed in Chineseconnected correctly.</p><p>[[File{| class="wikitable" style="background-color:#ffffdc;width:zero2w800px;" |-img207.png]]</p></li>| <libig>'''<p>Then open '''Note that x in the Fcitx5 configuration program</p><p>[[File:zero2wi2cdetect -img213y x command needs to be replaced with the serial number of the device node corresponding to the i2c bus.png]]'''</p>'''</li><li><p>Then choose to use Pinyin input method</pbig><div class="figure">|}
[[File:zero2w-img214img179.png]] </div></li><li><p>The interface after selection is as shown below, then click OK</pol><p>[[Fileol start="7" style="list-style-type:zero2w-img215.png]]</p></lidecimal;"><li><p>Then we you can open run the '''Geanyds1307.py''' to test the Chinese input method. The opening method is as shown program in '''examples''' to read the figure belowRTC time</p><p>[[File{| class="wikitable" style="background-color:#ffffdc;width:zero2w800px;" |-img208.png]]</p></li>| <libig><p>After opening '''Geany''', Note that the English input method is still x in i2c-x in the default. We can switch following command needs to be replaced with the serial number of the Chinese input method through device node corresponding to the i2c bus.'''Ctrl+Space''' shortcut key, and then we can enter Chinese.</p><p>[[File:zero2w-img216.png]]</p></li></olbig>|}<span id{| class="wikitable" style="how-to-remotely-log-in-to-the-linux-system-desktopwidth:800px;"></span>== How to remotely log in to the Linux system desktop ==|-| <span id="remote-login-using-nomachine"p><root@orangepi:~/span>=== Remote login using NoMachine === wiringOP-Python# '''Please ensure that the Ubuntu or Debian system installed on the development board is a desktop version of the system. In addition, NoMachine also provides detailed usage documentation. It is strongly recommended to read this document thoroughly to become familiar with the use of NoMachine. The document link is as follows:cd examples'''</p> '''https<p>root@orangepi:~/wiringOP-Python/knowledgebase.nomachine.com/DT10R00166''' examples# '''NoMachine supports Windows, Mac, Linux, iOS and Android platforms, so we can remotely log in and control the Orange Pi development board through NoMachine on a variety of devices. The following demonstrates how to remotely log in to the Linux system desktop of the Orange Pi development board through NoMachine in Windows. For installation methods on other platforms, please refer to NoMachine's official documentationpython3 ds1307.py --device \'''</p> <p>'''Before operating, please make sure that the Windwos computer and the development board are in the same LAN, and that you can log in to the Ubuntu or Debian system of the development board through ssh normally."/dev/i2c-x"'''</p><ol style="listp>Thu 2022-style06-type16 04:35: decimal;"46</p><li><p>First download the installation package of the NoMachine software Linux '''arm64''' deb version, and then install it into the Linux system of the development boardThu 2022-06-16 04:35:47</p><ol style="listp>Thu 2022-style06-type16 04:35: lower-alpha;"48</p><lip>Since H618 is an ARMv8 architecture SOC and the system we use is > Ubuntu or Debian, we need to download the '''NoMachine for ARM > ARMv8 DEB''' installation package. The download link is as > follows:^C</lip><p>exit</olp>|}
</li></ol>
<ol startdiv style="display: flex;">::{| class="2wikitable" style="listwidth:390px;margin-styleright: 20px;text-typealign: lower-alphacenter;"><li><p>In addition, you can also download the |-| '''NoMachineGPIO NO.'''| '''GPIO''' installation > package from the official tool.</p><p>[[File:zero2w-img218.png]]</p><p>First enter the | '''remote login software-NoMachineFunction''' folder</p><p>[[File:zero2w| '''Pin'''|-img219.png]]</p><p>Then download the arm64 version of the deb installation package</p><p>[[File| style="text-align:zero2w-img220.png]]</p></li>left;"|| style="text-align: left;"|<li><p>Then upload the downloaded | '''nomachine_x3.x.x_x_arm64.deb3V'''| ' to the > Linux system of the development board</p></li>''1'''|-<li><p>Then use the following command to install | '''NoMachine264''' in the Linux > system of the development board</p><p>orangepi@orangepi:~$ | '''sudo dpkg -i nomachine_x.x.x_x_arm64_arm64.debPI8'''| '''TWI1-SDA'''</p></li></ol>| '''3'''<!|-- --><ol start="2" style="list-style-type: decimal;"><li>Then download the installation package of the Windows version of the NoMachine software. The download address is as follows</li></ol> | '''Note that this download link may change.263'''| '''PI7'''| '''https://downloads.nomachine.com/download/?id=9TWI1-SCL'''| '''5'''[[File:zero2w|-img221.png]]| '''269'''<ol start="3" style="list-style-type: decimal;"><li><p>Then install NoMachine in Windows. | '''PI13'Please restart your computer after installation.''| '<''PWM3/p></li>UART4_TX'''<li><p>Then open | '''NoMachine7''' in Window</p><p>[[File:zero2w|-img222.png]]</p></li><li><p>After NoMachine is started, it will automatically scan other devices with NoMachine installed on the LAN. After entering the main interface of NoMachine, you can see that the development board is already in the list of connectable devices, and then click on the location shown in the red box in the picture below You can now log in to the Linux system desktop of the development board.</p>| style="text-align: left;"|<p>[[File| style="text-align:zero2w-img223.png]]</p></li>left;"|| '''GND'''<li><p>Then click | '''OK9'''</p><p>[[File:zero2w|-img224.png]]</p></li><li><p>Then enter the username and password of the development board Linux system in the corresponding positions in the figure below, and then click OK to start logging in.</p>| '''226'''| '''PH2'''<p>[[File:zero2w| '''UART5_TX'''| '''11'''|-img225.png]]</p></li><li><p>Then click OK in the next interface.</p></li>| '''227'''<li><p>Finally you can see the desktop of the development board Linux system</p>| '''PH3'''<p>[[File:zero2w-img226.png]]</p></li></ol>| '''UART5_RX'''| '''13'''<span id="remote-login-using|-vnc"></span>=== Remote login using VNC ===| '''261'''| '''PI5'''| '''Before operating, please make sure that the Windwos computer and the development board are in the same LAN, and that you can log in to the Ubuntu or Debian system of the development board through ssh normally.TWI0_SCL/UART2_TX''' | '''There are many problems with VNC testing in Ubuntu20.04, please do not use this method.15'''|-<ol | style="listtext-style-typealign: decimalleft;"|| style="text-align: left;">|<li><p>First run the | '''set_vnc3.sh3V''' script to set up vnc, | '''remember to add sudo permission17'''s</p><p>orangepi@orangepi:~$ |-| '''sudo set_vnc.sh231'''</p><p>You will require a password to access your desktops.</p><p>Password: | '''#Set the vnc password here, 8 charactersPH7'''</p><p>Verify: | '''#Set the vnc password here, 8 charactersSPI1_MOSI'''</p><p>Would you like to enter a view-only password (y/n)? | '''n19'''</p><p>xauth: file /root/.Xauthority does not exist</p>|-<p>New | '''232''X' desktop is orangepi:1</p><p>Creating default startup script /root/.vnc/xstartup</p>| '''PH8'''<p>Starting applications specified in /root/.vnc/xstartup</p>| '''SPI1_MISO'''<p>Log file is /root/.vnc/orangepi:1.log</p>| '''21'''<p>Killing Xtightvnc process ID 3047</p>|-<p>New | '''230''X' desktop is orangepi:1</p><p>Starting applications specified in /root/.vnc/xstartup</p>| '''PH6'''<p>Log file is /root/.vnc/orangepi:1.log</p></li>| '''SPI1_CLK'''<li><p>The steps to use MobaXterm software to connect to the development board Linux system desktop are as follows:</p>| '''23'''<ol |-| style="listtext-align: left;"|| style="text-typealign: lower-alphaleft;">|| '''GND'''<li>First click Session, then select VNC, then fill in the IP > address and port of the development board, and finally click > OK to confirm.</li></ol>| '''25'''</li></ol>|-| '''266'''<div class="figure">| '''PI10''' [[File:zero2w| '''TWI2-img227.png]]SDA/UART3_RX'''| '''27'''</div>|-<ol start="2" | '''256'''| '''PI0'''| style="listtext-style-typealign: lower-alphaleft;">|<li><p>Then enter the VNC password set earlier</p>| '''29'''<p>[[File:zero2w|-img228.png]]</p></li><li><p>After successful login, the interface is displayed as shown below, > and then you can remotely operate the desktop of the development > board Linux system.</p></li></ol>| '''271'''| '''PI15'''[[File:zero2w-img229.png]] <span id| style="qttext-installation-methodalign: left;"></span>== QT installation method ==|| '''31'''<ol style="list-style|-type: decimal;"><li><p>Use the following script to install QT5 and QT Creator</p>| '''268'''<p>orangepi@orangepi:~$ | '''install_qt.shPI12'''</p></li><li><p>After installation, the QT version number will be automatically printed.</p>| '''PWM2'''<ol style="list-style-type: lower-alpha;"><li><p>The qt version that comes with Ubuntu20.04 is | '''33''5.12.8'|-| '''258'''</p><p>orangepi@orangepi:~$ | '''install_qt.shPI2'''</p><p>......</p><p>QMake version 3.1</p>| style="text-align: left;"|<p>Using Qt version | '''5.12.835''' in /usr/lib/aarch64|-linux-gnu</p></li><li><p>The QT version that comes with Ubuntu22.04 is | '''5.15.3272'''</p><p>orangepi@orangepi:~$ | '''install_qt.shPI16'''</p><p>......</p>| style="text-align: left;"|<p>QMake version 3.1</p><p>Using Qt version | '''37'''5.15.3''' in /usr/lib/aarch64|-linux| style="text-gnu</p></li>align: left;"|| style="text-align: left;"|<li><p>The QT version that comes with Debian11 is | '''5.15.2GND'''</p><p>orangepi@orangepi:~$ | '''39'install_qt.sh'''</p><p>......</p>|}<p>QMake version 3.1</p>{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-<p>Using Qt version | '''Pin'5.15.2''| ' in /usr/lib/aarch64-linux-gnu</p></li><li><p>The QT version that comes with Debian12 is ''Function'5.15.8'''</p><p>orangepi@orangepi:~$ | '''install_qt.shGPIO'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version | '''5GPIO NO.15.8''' in /usr/lib/aarch64-linux|-gnu</p></li></ol></li><li><p>Then you can see the QT Creator startup icon in | '''Applications2'''</p><p>[[File:zero2w-img230.png]]</p><p>You can also use the following command to open QT Creator</p><p>orangepi@orangepi:~$ | '''qtcreator5V'''</p></li><li><p>The interface after QT Creator is opened is as follows</p>| style="text-align: left;"|<p>[[File| style="text-align:zero2wleft;"||-img231.png]]</p></li><li><p>The version of QT Creator is as follows</p>| '''4'''| '''5V'''<ol | style="listtext-style-typealign: lower-alphaleft;">|| style="text-align: left;"||-<li><p>The default version of QT Creator in | '''Ubuntu20.046''' is as > follows</p><p>[[File:zero2w-img232.png]]</p></li><li><p>The default version of QT Creator in '''Ubuntu22.04| '''GND'''' is as > follows</p><p>[[File| style="text-align:zero2wleft;"|| style="text-align: left;"||-img233.png]]</p></li><li><p>The default version of QT Creator in | '''Debian118''' is as follows</p><p>[[File:zero2w-img234.png]]</p></li>| '''UART0_TX'''<li><p>The default version of QT Creator in | '''Debian12PH0''' is as follows</p><p>[[File:zero2w| '''224'''|-img235.png]]</p></li></ol></li>| '''10'''<li><p>Then set up QT</p><ol style="list-style-type: lower-alpha;"><li><p>First open | '''UART0_RX'''Help| '''->PH1'''About Plugins...| '''225'''.</p><p>[[File:zero2w|-img236.png]]</p></li><li><p>Then remove the check mark of | '''ClangCodeModel12'''</p><p>[[File| style="text-align:zero2w-img237.png]]</p></li>left;"|<li><p>| '''PI1'After setting up, you need to restart QT Creator''| '''257'''</p></li><li><p>Then make sure the GCC compiler used by QT Creator. If the > default is Clang, please change it to GCC.</p>|-<p>| '''Debian12 please skip this step.14'''</p><p>[[File| '''GND'''| style="text-align:zero2wleft;"|| style="text-img238.png]]</p><p>[[Filealign:zero2wleft;"||-img239.png]]</p></li></ol><| '''16'''| '''PWM4/li>UART4_RX'''<li><p>Then you can open a sample code</p>| '''PI14'''| '''270'''<p>[[File:zero2w|-img240.png]]</p></li><li><p>After clicking on the sample code, the corresponding instruction document will automatically open. You can read the instructions carefully.</p><p>[[File:zero2w-img241.png]]</p></li><li><p>Then click | '''Configure Project18'''</p><p>[[File| style="text-align:zero2w-img242.png]]</p></li><li><p>Then click the green triangle in the lower left corner to compile and run the sample code</p>;"|<p>[[File:zero2w| '''PH4'''| '''228'''|-img243.png]]</p></li><li><p>After waiting for a period of time, the interface shown in the figure below will pop up, which means that QT can compile and run normally.</p>| '''20'''| '''GND'''<p>[[File| style="text-align:zero2w-img244.png]]</p></li>left;"|| style="text-align: left;"|<li><p>References</p>|-<p>[https://wiki.qt.io/Install_Qt_5_on_Ubuntu | '''https://wiki.qt.io/Install_Qt_5_on_Ubuntu22''']</p><p>[https://download.qt.io/archive/qtcreator | '''https:/TWI0_SDA/download.qt.io/archive/qtcreatorUART2_RX'''| '''PI6''']</p><p>[https://download.qt.io/archive/qt | '''https://download.qt.io/archive/qt262'''|-| '''24''']</p></li></ol>| '''SPI1_CS0'''<span id="ros-installation-method"></span>| '''PH5'''== ROS installation method ==| '''229'''|-<span id="how-to-install-ros-1-noetic-on-ubuntu20.04"></span>=== How to install ROS 1 Noetic on Ubuntu20.04 ===| '''26''' # The currently active version of ROS 1 is as follows, the recommended version is | '''Noetic NinjemysSPI1_CS1'''| '''PH9'''[[File:zero2w-img245.png]] [[File:zero2w-img246.png]] [http://docs.ros.org/ | '''http://docs.ros.org233''']|-| '''https://wiki.ros.org28'''| '''TWI2-SCL/DistributionsUART3_TX'''| '''PI9'''<ol start="2" style="list| '''265'''|-style-type: decimal;"><li><p>The link to the official installation documentation of ROS 1 | '''Noetic Ninjemys30''' is as follows:</p><p>[http://wiki.ros.org/noetic/Installation/Ubuntu | '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''http://wiki.ros.org/noetic/Installation/Ubuntu32''']</p></li><li><p>In the official installation documentation of ROS | '''Noetic NinjemysPWM1''', Ubuntu recommends using Ubuntu20.04, so please ensure that the system used by the development board is | '''Ubuntu20.04 desktop systemPI11'''.</p><p>[http://wiki.ros.org/noetic/Installation | '''267'''|-| '''http://wiki.ros.org/noetic/Installation34''']</p><p>[[File:zero2w-img247.png]]</p></li><li><p>Then use the script below to install ros1</p><p>orangepi@orangepi:~$ | '''GND''install_ros.sh ros1'''</p></li><li><p>Before using the ROS tool, you first need to initialize rosdep. Then when compiling the source code, you can quickly install some system dependencies and some core components in ROS.</p></li></ol>| style="text-align: left;"|| style="text-align: left;"||-| '''Note that when running the following command, you need to ensure that the development board can access github normally, otherwise an error will be reported due to network problems.36'''| style="text-align: left;"|| '''The install_ros.sh script will try to modify /etc/hosts and automatically run the following commands. However, this method cannot guarantee that github can be accessed normally every time. If install_ros.sh prompts the following error after installing ros1, please find other ways to allow the linux system of the development board to access github normally, and then manually run the following Order.PC12''' | '''''https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml76'''|-| '''Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml38''' | style="text-align: left;"|| '''ERROR: error loading sources list:PI4''' | '''The read operation timed out260'''|-orangepi@orangepi:~$ | '''source /opt/ros/noetic/setup.bash40'''| style="text-align: left;"|orangepi@orangepi:~$ | '''sudo rosdep initPI3''' Wrote /etc/ros/rosdep/sources.list.d/20-default.list Recommended: please run rosdep update orangepi@orangepi:~$ | ''''rosdep update259'''|}reading in sources list data from </etc/ros/rosdep/sources.list.d Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yamldiv>
<div classspan id="figurehow-to-compile-and-install-python-source-code"></span>=== How to compile and install Python source code ===
<ol style="list-style-type: decimal;">
<li><p>The currently active version of ROS 2 is as follows, First install the recommended version is '''Galactic Geochelone'''dependency packages needed to compile Python</p>{| class="wikitable" style="width:800px;" |-| <p>[[Fileorangepi@orangepi:zero2w~$ '''sudo apt-img251.png]]get update'''</p><p>[[Fileorangepi@orangepi:zero2w~$ '''sudo apt-img252.png]]get install -y build-essential zlib1g-dev \'''</p><p>[http://docs.ros.org/ '''http://docs.ros.orglibncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev \''']</p><p>'''http://docs.ros.org/en/galactic/Releases.htmllibreadline-dev libffi-dev curl libbz2-dev'''</p>|}</li><li><p>The link to Then download the official installation documentation latest version of ROS 2 '''Galactic Geochelone''' is as follows:Python3.9 source code and unzip it</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''docs.ros.org/en/galactic/Installation.htmlwget \'''</p><p>'''httphttps://docswww.rospython.org/enftp/galacticpython/Installation3.9.10/UbuntuPython-Install-Debians3.9.10.htmltgz'''</p></li><li><p>In the official installation documentation of ROS 2 orangepi@orangepi:~$ '''Galactic Geochelone''', Ubuntu Linux recommends using Ubuntu20.04, so please ensure that the system used by the development board is the '''Ubuntu20tar xvf Python-3.04 desktop system'''9. There are several ways to install ROS 210. The following demonstrates how to install ROS 2 tgz'''Galactic Geochelone''' through '''Debian packages'''.</p>|}</li><li><p>Use Then run the '''install_ros.sh''' script to install ros2configuration command</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''install_roscd Python-3.sh ros29.10'''</p></li><li><p>The orangepi@orangepi:~$ '''install_ros.sh''' script will automatically run the '''ros2 /configure --enable-hoptimizations''' command after installing ros2. If you can see the following print, it means that the ros2 installation is complete.</p><p>usage: ros2 [-h] Call `ros2 <command> -h` for more detailed usage. ...</p>|}<p>ros2 is an extensible command-line tool for ROS 2.</pli><pli>optional arguments:</p><p>-h, --help show this help message Then compile and exitinstall Python3.9. The compilation time takes about half an hour.</p><p>Commands{| class="wikitable" style="width:</p>800px;" <p>action Various action related sub|-commands</p><p>bag Various rosbag related sub-commands</p>| <p>component Various component related sub-commands</p><p>daemon Various daemon related sub-commands</p><p>doctor Check ROS setup and other potential issues</p><p>interface Show information about ROS interfaces</p><p>launch Run a launch file</p><p>lifecycle Various lifecycle related sub-commands</p><p>multicast Various multicast related sub-commands</p><p>node Various node related sub-commands</p><p>param Various param related sub-commands</p><p>pkg Various package related sub-commands</p><p>run Run a package specific executable</p><p>security Various security related sub-commands</p><p>service Various service related sub-commands</p><p>topic Various topic related sub-commands</p><p>wtf Use `wtf` as alias to `doctor`</p><p>Call `ros2 <command> -h` for more detailed usage.</p></li><li><p>Then you can use the orangepi@orangepi:~$ '''test_ros.shmake -j4''' script to test whether ROS 2 is installed successfully. If you can see the following print, it means ROS 2 can run normally.</p><p>orangepi@orangepi:~$ '''test_ros.sh'''</p><p>[INFO] [1671174101.200091527] [talker]: Publishing: sudo make altinstall'Hello World: 1'</p><p>[INFO] [1671174101.235661048] [listener]: I heard: [Hello World: 1]</p><p>[INFO] [1671174102.199572327] [talker]: Publishing: 'Hello World: 2'</p><p>[INFO] [1671174102.204196299] [listener]: I heard: [Hello World: 2]</p><p>[INFO] [1671174103.199580322] [talker]: Publishing: 'Hello World: 3'</p>|}<p>[INFO] [1671174103.204019965] [listener]: I heard: [Hello World: 3]</p></li><li><p>Run After installation, you can use the following command to open rviz2check the version number of the Python you just installed.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''source /opt/ros/galactic/setuppython3.bash9 --version'''</p><p>orangepi@orangepi:~$ '''ros2 run rviz2 rviz2Python 3.9.10'''</p><p>[[File:zero2w-img253.png]]</p>|}</li><li><p>For how to use ROS, please refer to the documentation of ROS 2.Then update pip</p>{| class="wikitable" style="width:800px;" |-| <p>[httporangepi@orangepi://docs.ros.org/en/galactic/Tutorials.html ~$ '''http:/usr/docs.ros.orglocal/enbin/galactic/Tutorialspython3.html9 -m pip install --upgrade pip''']</p>|}</li></ol>
<span id="how-to-installreplace-rospip-2source-humblein-on-ubuntu22.04python"></span>=== How to install ROS 2 Humble on Ubuntu22.04 ===
<ol style="list-style-type: decimal;">
<li><p>The Linux image released by OPi comes with the deb package of the kernel header file by default, and the storage location is First install '''/opt/python3-pip'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''ls /opt/linuxsudo apt-headers*get update'''</p><p>/opt/linux-headers-xxx-sun50iw9_x.x.x_arm64.deb</p></li><li><p>Use the following command to install the deb package of the kernel header file</p><p>orangepi@orangepi:~$ '''sudo dpkg apt-get install -i /opt/linuxy python3-headers*.debpip'''</p>|}</li><li><p>After installation, you can see How to permanently change the folder where the kernel header file is located pip source under '''/usr/src'''.Linux</p><p>orangepi@orangepiol style="list-style-type:~$ '''ls /usr/src'''</p><p>linuxlower-headers-x.x.x</p></lialpha;"><li><p>Then you can compile the source code of the hello kernel module that comes with the Linux image. The source code of the hello module is in First create a new '''~/usr/src/hello.pip'''. After entering this directory, then use add the '''pip.conf''' configuration file, and set the make command pip source in it to compileTsinghua source.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''cd /usr/src/hellomkdir -p ~/.pip'''</p><p>orangepi@orangepi:/usr/src/hello~$ '''sudo makecat <<EOF > ~/.pip/pip.conf'''</p><p>make -C /lib/modules/5.4.125/build M=/usr/src/hello modules</p><p>make'''[1global]: Entering directory '/usr/src/linux-headers-5.4.125''</p><p>CC [M] /usr/src/hello/hello.o'''timeout = 6000'''</p><p>Building modules, stage 2.<'''index-url = https:/p><p>MODPOST 1 modules</p><p>CC [M] /usr/src/hello/hellopypi.tuna.modtsinghua.o</p><p>LD [M] /usr/src/hello/helloedu.ko<cn/p><p>make[1]: Leaving directory simple''/usr/src/linux-headers-5.4.125'</p></li><li><p>After compilation, the '''hellotrusted-host = pypi.kotuna.tsinghua.edu.cn''' kernel module will be generated</p><p>orangepi@orangepi:/usr/src/hello$ '''ls *.koEOF'''</p><p>hello.ko</p>|}</li><li><p>Use the '''insmod''' command Then use pip3 to insert install the '''hello.ko''' kernel module into the kernelPython library very quickly</p><p/li>orangepi@orangepi:/usr/src/hello$ '''sudo insmod hello.ko'''</pol></li><li><p>Then use the '''demsg''' command How to view temporarily change the output of the '''hello.ko''' kernel module. If you can see the following outputpip source under Linux, it means that the where '''hello.ko<packagename>''' kernel module is loaded correctly.needs to be replaced with a specific package name</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:/usr/src/hello~$ '''dmesg | grep pip3 install "lt;Hellopackagename"gt;'''</p><p>[ 2871.893988] '''Hello Orange Pi -- initi \'''</p></li><li><p>Use the '''rmmod''' command to uninstall the '''hello.ko''' kernel module</p><p>orangepi@orangepihttps:/usr/srcpypi.tuna.tsinghua.edu.cn/hello$ '''sudo rmmod hellosimple --trusted-host pypi.tuna.tsinghua.edu.cn'''</p><p>orangepi@orangepi:/usr/src/hello$ '''dmesg | grep "Hello"'''}</pli><p>[ 2871.893988] Hello Orange Pi -- init</pol> <p>[ 3173.800892] '''Hello Orange Pi span id="how-to-install- exit'''</pdocker"></li></olspan> == How to install Docker ==
'''<ol span style="list-style-typecolor: decimal;#FF0000"><li><p>Debian Bookworm is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.Hello from Docker!</pspan>''' '''<ol span style="list-style-typecolor: lower-alpha;#FF0000"><li><p>The version of aThis message shows that your installation appears to be working correctly.gcc is as follows</p><pspan>orangepi@orangepi:~$ '''gcc --version'''</p><p>gcc (Debian 12.2.0-14) 12.2.0</p><p>Copyright (C) 2022 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p></li><li><p>Write the '''hello_world.c….''' program in C language</p><p>orangepi@orangepi:~$ |} When using the docker command, if you are prompted for '''vim hello_world.cpermission denied'''</p><p>#include <stdio, please add the current user to the docker user group so that you can run the docker command without sudo.h></p><p>int main(void)</p><p>{</p><p>printf("| class="wikitable" style="width:800px;Hello World!\n");</p>" <p>return 0;</p>|-<p>}</p></li><li><p>Then compile and run '''hello_world.c'''</p>| <p>orangepi@orangepi:~$ '''gcc sudo usermod -o hello_world hello_world.c'''</p><p>orangepi@orangepi:~aG docker $ USER'''./hello_world'''</p><p>Hello World!</p></li></ol>|}</li><li><p>Debian Bookworm has Python3 installed by default</p><ol {| class="wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;"><li><p>The specific version of Python is as follows</p>|-| <pbig>orangepi@orangepi:~$ '''python3'''</p><p>Python 3.11.2 (main, Mar 13 2023, 12Note:18:29) [GCC 12.2.0] on linux</p><p>Type "help", "copyright", "credits" or "license" for more information.</p><p>>>></p><p>'''Use You need to log out and log in again to the Ctrl+D shortcut key system to exit python's interactive modetake effect.'''</p></li><li><p>Write You can also restart the '''hello_worldsystem.py''' program in Python language</pbig><p>orangepi@orangepi:~$ '''vim hello_world.py'''</p><p>print('Hello World!')</p></li>|}<li><p>The result of running '''hello_world.py''' is as follows</p><p>orangepi@orangepi:~$ '''python3 hello_world.py'''</p><p>Hello World!</p></li></ol></li><li><p>Debian Bookworm does not install Java compilation tools and operating environment by default.</p><ol stylespan id="list-style-type: lowerhow-alpha;"><li><p>You can use the following command to install openjdk. The latest > version in Debian Bookworm is openjdk-17</p><p>orangepi@orangepi:~$ '''sudo apt install -y openjdkhome-17-jdk'''</passistant"></lispan><li><p>After installation, you can check the Java version.</p><p>orangepi@orangepi:~$ '''java --version'''</p></li>== How to install Home Assistant ==<li><p>Write the Java version of '''hello_world.java'''</p><p>orangepi@orangepi{| class="wikitable" style="background-color:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p><p>public static void main(String[] args)</p><p>{</p><p>System.out.println("#ffffdc;Hello World!"width:800px;);</p>" <p>}</p>|-<p>}</p></li>| <li><pbig>Then compile and run '''hello_worldNote that this article will only provide methods for installing Home Assistant in Ubuntu or Debian systems.java'''</p><p>orangepi@orangepi:~$ '''javac hello_worldFor detailed usage of Home Assistant, please refer to the official documentation or corresponding books.java'''</pbig><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p></li></ol></li></ol>|}
<span id="ubuntuinstallation-focalvia-systemdocker"></span>=== Ubuntu Focal system Installation via docker ===
<ol style="list-style-type: decimal;">
<li><p>Ubuntu Focal is installed with the gcc compilation tool chain by defaultFirst, which please install docker and ensure that docker can directly compile C language programs in run normally. For the Linux system installation steps of docker, please refer to the development boardinstructions in the [[Orange Pi Zero 2W#How to install Docker|'''How to Install Docker''']] section.</p><ol style="list-style-type: lower-alpha;"/li><li><p>The version Then you can search for the docker image of a.gcc is as followsHome Assistant</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''gcc --versiondocker search homeassistant'''</p><p>gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0|}</pli><p>Copyright (C) 2019 Free Software Foundation, Inc.</pli><p>This Then use the following command to download the Docker image of Home Assistant to your local computer. The image size is free software; see about 1GB, and the source download time will be relatively long. Please be patient and wait for copying conditionsthe download to complete. There is NO</p><p>warranty{| class="wikitable" style="width:800px; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p></li>" |-<li><p>Write the '''hello_world.c''' program in C language</p>| <p>orangepi@orangepi:~$ '''vim hello_world.cdocker pull homeassistant/home-assistant'''</p><p>#include <stdio.h>Using default tag: latest</p><p>int main(void)latest: Pulling from homeassistant/home-assistant</p><p>{be307f383ecc: Downloading</p><p>printf("Hello World!\n");5fbc4c07ac88: Download complete</p><p>return 0;'''...... (Omit some output)'''</p><p>}3cc6a1510c9f: Pull complete</p></li><li><p>Then compile and run '''hello_world.c'''7a4e4d5b979f: Pull complete</p><p>orangepi@orangepiDigest: sha256:~$ '''gcc -o hello_world hello_world.c'''81d381f5008c082a37da97d8b08dd8b358dae7ecf49e62ce3ef1eeaefc4381bb</p><p>orangepi@orangepiStatus:~$ '''.Downloaded newer image for homeassistant/hello_world'''home-assistant:latest</p><p>Hello World!<docker.io/p><homeassistant/li>home-assistant:latest</olp>|}
</li>
<li><p>Ubuntu Focal has Python3 installed by defaultThen you can use the following command to view the docker image of Home Assistant you just downloaded</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>The specific version of Python3 is as follows</p>|-| <p>orangepi@orangepi:~$ '''python3docker images homeassistant/home-assistant'''</p><p>Python 3.8.10 (default, Nov 14 2022, 12:59:47)REPOSITORY TAG IMAGE ID CREATED SIZE</p><p>[GCC 9.4.0] on linux<homeassistant/p><p>Type home-assistant latest "nbsp;helpbfa0ab9e1cf5 "nbsp;, "nbsp;copyright"nbsp;, "nbsp;credits"nbsp; or 2 months ago "nbsp;license"nbsp; for more information.</p><p>>nbsp;>nbsp;>nbsp;</p><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p></li><li><p>Write the '''hello_world.py''' program in Python language</p><p>orangepi@orangepispan style="color:~$ '''vim hello_world.py'''</p#FF0000"><p>print('Hello World!')</p></li><li><p>The result of running '''hello_world1.py''' is as follows17GB</pspan><p>orangepi@orangepi:~$ '''python3 hello_world.py'''</p><p>Hello World!</p></li></ol>|}
</li>
<li><p>Ubuntu Focal does not have Java compilation tools and running environment installed by default.At this point you can run the Home Assistant docker container</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>You can use the following command to install openjdk|-17</p>| <p>orangepi@orangepi:~$ '''sudo apt install docker run -y openjdk-17-jdkd \'''</p></li><li>:<p>After installation, you can check the Java version.'''--name homeassistant \'''</p>:<p>orangepi@orangepi:~$ '''java --versionprivileged \'''</p>:<p>openjdk 17.0.2 2022'''--01restart=unless-18stopped \'''</p>:<p>OpenJDK Runtime Environment (build 17.0.2+8'''-Ubuntu-120.04)e TZ=Asia/Shanghai \'''</p>:<p>OpenJDK 64'''-Bit Server VM (build 17.0.2+8v /home/orangepi/home-Ubuntu-120.04, mixed mode, sharing)assistant:/config \'''</p></li><li>:<p>Write the Java version of '''hello_world.java--network=host \'''</p>:<p>orangepi@orangepi:~$ '''vim hello_world.javahomeassistant/home-assistant:latest'''</p><p>public class hello_world|}</pli><pli>{</p><p>public static void main(String[] args)Then enter【the IP address of the development board: 8123】in the browser to see the Home Assistant interface</p><p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| </pbig><p>System'''It takes a while for the Home Assistant container to start. If the interface below does not display normally, please wait a few seconds before refreshing it.outIf the following interface is not displayed normally after waiting for more than a minute, it means there is a problem with the Home Assistant installation. At this time, you need to check whether there is a problem with the previous installation and setting process.println("Hello World!");'''</p><p/big>|}</pdiv class="figure"><p>}[[File:zero2w-img180.png]] </pdiv></li><li><p>Then compile enter your '''name, username''' and '''password''' and run click '''hello_world.javaCreate Account'''</p><pdiv class="figure">orangepi@orangepi [[File:~$ '''javac hello_worldzero2w-img181.java'''png]] </div></li><li><p>Then follow the interface prompts to set according to your own preferences, and then click Next</p><pdiv class="figure">orangepi@orangepi [[File:~$ '''java hello_world'''zero2w-img182.png]] </div></pli><li><p>Hello World!Then click Next</p><div class="figure"> [[File:zero2w-img183.png]] </lidiv></olli></li><p>Then click Finish</olp><div class="figure">
<ol style="list-style-type: decimal;"/div></li><li><p>Ubuntu Jammy The main interface finally displayed by Home Assistant is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development boardas shown below</p><p>[[File:zero2w-img185.png]]</p></li><li><p>Method to stop Home Assistant container</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The version of a.gcc command to view the docker container is as follows</p><p>orangepi@orangepi{| class="wikitable" style="width:~$ '''gcc --version'''</p>800px;" <p>gcc (Ubuntu 11.3.0|-1ubuntu1~22.04.1) '''11.3.0'''</p><p>Copyright (C) 2021 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p></li><li><p>Write the '''hello_world.c''' program in C language</p>| <p>orangepi@orangepi:~$ '''vim hello_world.cdocker ps -a'''</p><p>#include <stdio.h></p><p>int main(void)</p><p>{</p><p>printf("Hello World!\n");</p><p>return 0;</p>|}<p>}</p></li><li><p>Then compile and run '''hello_world.c'''The command to stop the Home Assistant container is as follows</p><p>orangepi@orangepi{| class="wikitable" style="width:~$ '''gcc 800px;" |-o hello_world hello_world.c'''</p>| <p>orangepi@orangepi:~$ '''./hello_worlddocker stop homeassistant'''</p><p>Hello World!</p></li></ol>|}
</li>
</li></ol>
<span id="methodinstallation-ofvia-uploading-files-to-the-development-board-linux-systempython"></span>== Method of uploading files to the development board Linux system ==
<ol style="list-style-type: decimal;">
<li><p>Use the scp command to upload files to the Linux system of the development board in Ubuntu PC. The specific command is as followsFirst install dependency packages</p><ol {| class="wikitable" style="listwidth:800px;" |-style-type| <p>orangepi@orangepi: lower~$ '''sudo apt-alpha;"get update'''</p><lip>orangepi@orangepi:~$ '''sudo apt-get install -y python3 python3-dev python3-venv \'''</p><p>'''file_path: python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \'''Needs to be replaced with the path of the file to > be uploaded</p><p>'''libopenjp2-7 libtiff5 libturbojpeg0-dev tzdata'''</lip>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <libig><p>'''If it is debian12, please use the following command:'''</p></big><p>orangepi@orangepi: ~$ '''This is the user name of the development boardsudo apt-get update'''s > Linux system. It can also be replaced with something else, > such as root.</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y python3 python3-dev python3-venv \'''</lip><lip>'''python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \'''</p><p>'''192.168.xx.xx:libopenjp2-7 libturbojpeg0-dev tzdata''' This is the IP address of the development > board. Please modify it according to the actual situation.</p>|}</li><li><p>Then you need to compile and install Python3.9. For the method, please refer to the [[Orange Pi Zero 2W#Python related instructions|'''Python source code compilation and installation method''']] section.</home/orangepip>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>''' The path in the development board Linux > system can also be modified default Python version of Debian Bullseye is Python3.9, so there is no need to other pathscompile and install it.'''</p><p>test@test:~$ '''scp file_path orangepi@192The default Python version of Ubuntu Jammy is Python3.16810, so there is no need to compile and install it.xx.xx:/home/orangepi/'''</p><p>'''The default Python version of Debian Bookworm is Python3.11, so there is no need to compile and install it.'''</lip></olbig>|}
</li>
<li><p>If you want to upload Then create a folderPython virtual environment</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Debian Bookworm is python3.11, you need please remember to add replace the corresponding command.'''</p></big>|}{| class="wikitable" style="width:800px;" |-r parameter| <p>orangepi@orangepi:~$ '''sudo mkdir /srv/homeassistant'''</p><p>testorangepi@testorangepi:~$ '''scp -r dir_path sudo chown orangepi:orangepi /srv/homeassistant'''</p><p>orangepi@orangepi:~$ '''cd /srv/homeassistant'''</p><p>orangepi@192orangepi:~$ '''python3.1689 -m venv .xx.xx'''</p><p>orangepi@orangepi:~$ '''source bin/activate'''</p><p>(homeassistant) orangepi@orangepi:/srv/homeassistant$</p>|}</li><li><p>Then install the required Python packages</p>{| class="wikitable" style="width:800px;" |-| <p>(homeassistant) orangepi@orangepi:/homesrv/homeassistant$ '''python3 -m pip install wheel'''</p>|}</li><li><p>Then you can install Home Assistant Core</p>{| class="wikitable" style="width:800px;" |-| <p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ '''pip3 install homeassistant'''</p>|}</li><li><p>There are more usages of scp, please use Then enter the following command to view run Home Assistant Core</p>{| class="wikitable" style="width:800px;" |-| <p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ '''hass'''</p>|}</li><li><p>Then enter【'''development board IP address: 8123'''】 in the browser to see the man manualHome Assistant interface</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''When you run the hass command for the first time, some libraries and dependency packages necessary for operation will be downloaded, installed and cached. This process may take several minutes. Note that you cannot see the Home Assistant interface in the browser at this time. Please wait for a while and then refresh it.'''</lip></olbig>|}<div class="figure">
<span id="how-to-upload-files-using-filezilla"/div></li></spanol>==== How to upload files using filezilla ====
<ol stylespan id="listopencv-styleinstallation-type: decimal;method"><li><p>First install filezilla in Ubuntu PC</p><p>test@test:~$ '''sudo apt install -y filezilla'''</p></li><li><p>Then use the following command to open filezilla</p><p>test@test:~$ '''filezilla'''</p></li><li><p>The interface after opening filezilla is as shown below. At this time, the remote site on the right is empty.</p><div class="figure"span>
</divspan id="use-apt-to-install-opencv"></lispan><li><p>The method of connecting the development board is as shown in the figure below</p></li></ol>=== Use apt to install OpenCV ===
<div ol style="list-style-type: decimal;"><li><p>The installation command is as follows</p>{| class="figurewikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y libopencv-dev python3-opencv'''</p>|}</li><li><p>Then use the following command to print the version number of OpenCV. The output is normal, indicating that the OpenCV installation is successful.</p><ol style="list-style-type: lower-alpha;"><li><p>The version of OpenCV in Ubuntu22.04 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 -c "import cv2; print(cv2.__version__)"'''</p><p>'''4.5.4'''</p>|}</li><li><p>The version of OpenCV in Ubuntu20.04 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 -c "import cv2; print(cv2.__version__)"'''</p><p>'''4.2.0'''</p>|}</li><li><p>The version of OpenCV in Debian11 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 -c "import cv2; print(cv2.__version__)"'''</p><p>'''4.5.1'''</p>|}</li><li><p>The version of OpenCV in Debian12 is as follows:</p>{| class="wikitable" style="width:800px;"|-| <p>orangepi@orangepi:~$ '''python3 -c "import cv2; print(cv2.__version__)"'''</p><p>'''4.6.0'''</p>|}</li></ol></li></ol>
<ol style="list-style-type: decimal;">
<li><p>First set the default '''locale''' to Chinese</p>
<ol style="list-style-type: lower-alpha;">
<li><p>Enter the following command to start configuring '''locale'''</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo dpkg-reconfigure locales'''</p>
|}
</li>
<li><p>Then select '''zh_CN.UTF-8 UTF-8''' in the pop-up interface (use the up and down keys on the keyboard to move up and down, use the space bar to select, and finally use the Tab key to move the cursor to '''<OK>''', and then return Car can be used)</p>
<p>[[File:zero2w-img186.png]]</p></li>
<li><p>Then set the default '''locale''' to '''zh_CN.UTF-8'''</p>
<p>[[File:zero2w-img187.png]]</p></li>
<li><p>After exiting the interface, the '''locale''' setting will begin. The output displayed on the command line is as follows:</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo dpkg-reconfigure locales'''</p>
<p>Generating locales (this might take a while)...</p>
:<p>en_US.UTF-8... done</p>
:<p>zh_CN.UTF-8... done</p>
<p>Generation complete.</p>
|}
</li></ol>
</li>
<li><p>Then open '''Input Method'''</p>
<p>[[File:zero2w-img188.png]]</p></li>
<li><p>Then select '''OK'''</p>
<p>[[File:zero2w-img189.png]]</p></li>
<li><p>Then select '''Yes'''</p>
<p>[[File:zero2w-img190.png]]</p></li>
<li><p>Then select '''fcitx'''</p>
<p>[[File:zero2w-img191.png]]</p></li>
<li><p>Then select '''OK'''</p>
<p>[[File:zero2w-img192.png]]</p></li>
<li><p>'''<span style="color:#FF0000">Then restart the Linux system to make the configuration take effect.</span>'''</p></li>
<li><p>Then open '''Fcitx configuration'''</p>
<p>[[File:zero2w-img193.png]]</p></li>
<li><p>Then click the + sign as shown in the picture below</p>
<p>[[File:zero2w-img194.png]]</p></li>
<li><p>Then search '''Google Pinyin''' and click '''OK'''</p>
<div class="figure">
[[File:zero2w-img259img195.png]]
</div></li><li><p>Then put '''Google Pinyin''' on top</p><ol start="8" style="listp>[[File:zero2w-styleimg196.png]]</p><p>[[File:zero2w-type: decimal;"img197.png]]</p></li><li><p>Then select open the path to be uploaded '''Geany''' editor to test the development board on the right side of the filezilla software, select the file to be uploaded in Ubuntu PC on the left side of the filezilla software, rightChinese input method</p><p>[[File:zero2w-click the mouse, and then click the upload option to start uploading the file to the development boardimg198.png]]</p></li><li><p>The Chinese input method test is as follows</olp> <div class="figure"p> [[File:zero2w-img260img199.png]]</p></li><li><p>You can switch between Chinese and English input methods through the '''Ctrl+Space''' shortcut key</p></li><li><p>If you need the entire system to be displayed in Chinese, you can set all variables in '''/etc/default/locale''' to '''zh_CN.UTF-8'''</divp><ol start{| class="9wikitable" style="listwidth:800px;" |-| <p>orangepi@orangepi:~$ '''sudo vim /etc/default/locale'''</p><p># File generated by update-locale</p><p>LC_MESSAGES='''<span style="color:#FF0000">zh_CN.UTF-type8</span>'''</p><p>LANG='''<span style="color: decimal;#FF0000">zh_CN.UTF-8</span>'''</p><lip>LANGUAGE='''<pspan style="color:#FF0000">After the upload is completed, you can go to the corresponding path in the development board Linux system to view the uploaded filezh_CN.UTF-8</span>'''</p>|}</li><li><p>The method of uploading a folder is Then '''<span style="color:#FF0000">restart the same as system</span>''' and you will see that the method of uploading a file, so I won't go into details heresystem is displayed in Chinese.</p><p>[[File:zero2w-img200.png]]</p></li></ol>
<span id="installation-method-toof-uploadubuntu-files-from-windows-pc-to-development-board-linux20.04-system"></span>=== Method to upload files from Windows PC to development board Linux system ===
<div classol style="figurelist-style-type: decimal;"><li><p>First open '''Language Support'''</p><p>[[File:zero2w-img262img201.png]] </divp><ol start="2" style="list-style-type: decimal;"/li><li><p>The downloaded installation package is as shown below, then double-click to install it directlyThen find the '''Chinese (China)''' option</p><p>'''FileZilla_Server_1.5.1_win64[[File:zero2w-setupimg210.exe'''png]]</p></li><li></olp> During Then please use the left button of the installation process, please mouse to select '''DeclineChinese (China)''' on and hold it down, then drag it up to the following installation interfacestarting position. After dragging, and then select '''Next>'''the display will be as shown below:</p><div class="figure"p> [[File:zero2w-img263img211.png]] </divp></li><ol start{| class="3wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;">|-| <libig>The interface after opening filezilla '''Note that this step is as shown below. At this timenot easy to drag, the remote site on the right is emptyplease be patient and try it a few times.'''</libig></ol> <div class="figure"> [[File:zero2w-img264.png]]|}</divol>
<ol start="4" style="list-style-type: decimal;">
<li>The method of connecting <p>Then select '''Apply System-Wide''' to apply the Chinese settings to the entire system</p><p>[[File:zero2w-img212.png]]</p></li><li><p>'''<span style="color:#FF0000">Then restart the Linux system to make the configuration take effect</span>'''</p></li><li><p>After re-entering the system, please select '''Do not ask me again''' in the following interface, and then please decide whether the standard folder should also be updated to Chinese according to your own preferences.</p><p>[[File:zero2w-img206.png]]</p></li><li><p>Then you can see that the development board desktop is as shown displayed in Chinese</p><p>[[File:zero2w-img207.png]]</p></li><li><p>Then open the figure belowFcitx5 configuration program</p><p>[[File:zero2w-img213.png]]</p></li><li><p>Then choose to use Pinyin input method</olp>
<div class="figure">
[[File:zero2w-img256img214.png]]
</div></li><ol start="5" style="listli><p>The interface after selection is as shown below, then click OK</p><p>[[File:zero2w-style-type: decimal;"img215.png]]</p></li><li><p>Then choose we can open '''Geany''' to test the Chinese input method. The opening method is as shown in the figure below</p><p>[[File:zero2w-img208.png]]</p></li><li><p>After opening '''save the passwordGeany''' and click , the English input method is still the default. We can switch to the Chinese input method through the '''OKCtrl+Space'''shortcut key, and then we can enter Chinese.</p><p>[[File:zero2w-img216.png]]</p></li></ol>
<div classspan id="figurehow-to-remotely-log-in-to-the-linux-system-desktop"></span>
</div><ol startspan id="6" style="listremote-login-styleusing-type: decimal;nomachine"><li>Then select '''Always trust this host''' and click '''OK'''</li></olspan>=== Remote login using NoMachine ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Please ensure that the Ubuntu or Debian system installed on the development board is a <div classspan style="figurecolor:#FF0000">desktop version</span> of the system. In addition, NoMachine also provides detailed usage documentation. It is strongly recommended to read this document thoroughly to become familiar with the use of NoMachine. The document link is as follows:'''
</divol style="list-style-type: decimal;"><ol startli><p>First download the installation package of the NoMachine software Linux '''<span style="7color:#FF0000" >arm64</span>''' deb version, and then install it into the Linux system of the development board</p><ol style="list-style-type: decimallower-alpha;"><li>After Since H618 is an ARMv8 architecture SOC and the connection system we use is successfulUbuntu or Debian, you can see we need to download the directory structure of the development board's Linux file system on ''NoMachine for ARM ARMv8 DEB''' installation package. The download link is as follows:</li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note that this download link may change, please look for the right side Armv8/Arm64 version of the filezilla softwaredeb package.'''</libig><|}{| class="wikitable" style="width:800px;" |-| [https://www.nomachine.com/download/download&id=112&s=ARM '''https://downloads.nomachine.com/download/ol>?id=118&distro=ARM''']|}
[[File:zero2w-img217.png]]<div /ol><ol start="2" style="list-style-type: lower-alpha;"><li><p>In addition, you can also download the '''NoMachine''' installation package from the official tool.</p><p>[[File:zero2w-img218.png]]</p><p>First enter the '''remote login software-NoMachine''' folder</p><p>[[File:zero2w-img219.png]]</p><p>Then download the arm64 version of the deb installation package</p><p>[[File:zero2w-img220.png]]</p></li><li><p>Then upload the downloaded '''nomachine_x.x.x_x_arm64.deb''' to the Linux system of the development board</p></li><li><p>Then use the following command to install '''NoMachine''' in the Linux system of the development board</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo dpkg -i nomachine_x.x.x_x_arm64_arm64.deb'''</p>|}</li></ol></li></ol><ol start="2" style="list-style-type: decimal;"><li>Then download the installation package of the Windows version of the NoMachine software. The download address is as follows</li>{| class="figurewikitable" style="background-color:#ffffdc;width:800px;"|-| <big>'''Note that this download link may change.'''</big>|}{| class="wikitable" style="width:800px;" |-| '''https://downloads.nomachine.com/download/?id=9'''|}
[[File:zero2w-img267img221.png]]</ol><ol start="3" style="list-style-type: decimal;"><li><p>Then install NoMachine in Windows. '''Please restart your computer after installation.'''</p></li><li><p>Then open '''NoMachine''' in Window</p><p>[[File:zero2w-img222.png]]</p></li><li><p>After NoMachine is started, it will automatically scan other devices with NoMachine installed on the LAN. After entering the main interface of NoMachine, you can see that the development board is already in the list of connectable devices, and then click on the location shown in the red box in the picture below You can now log in to the Linux system desktop of the development board.</p><p>[[File:zero2w-img223.png]]</p></li><li><p>Then click '''OK'''</p><p>[[File:zero2w-img224.png]]</p></li><li><p>Then enter the username and password of the development board Linux system in the corresponding positions in the figure below, and then click OK to start logging in.</p><p>[[File:zero2w-img225.png]]</p></li><li><p>Then click OK in the next interface.</p></li><li><p>Finally you can see the desktop of the development board Linux system</p><p>[[File:zero2w-img226.png]]</p></li></ol>
</div><ol startspan id="8" style="listremote-login-styleusing-type: decimal;vnc"><li>Then select the path to be uploaded to the development board on the right side of the filezilla software, select the file to be uploaded on the Windows PC on the left side of the filezilla software, right-click the mouse, and then click the upload option to start uploading the file to the development board.</li></olspan>
'''</div><ol start="9" span style="list-style-typecolor: decimal;#FF0000"><li><p>After the upload is completed, you can go to the corresponding path There are many problems with VNC testing in the development board Linux system to view the uploaded fileUbuntu20.</p></li><li><p>The 04, please do not use this method of uploading a folder is the same as the method of uploading a file, so I won't go into details here.</p></li></ol> <span id="instructions-for-using-the-logo-on-and-off-the-machine">'''</spanbig>== Instructions for using the logo on and off the machine ==|}
<ol style="list-style-type: decimal;">
<li><p>The power on/off logo will only be displayed on the desktop version of the system by default.</p></li><li><p>Set First run the '''bootlogoset_vnc.sh''' variable script to set up vnc, '''false''' in '''/boot/orangepiEnv.txt''' remember to turn off the switch logo.</p><p>orangepi@orangepi:~$ '''add sudo vim /boot/orangepiEnv.txtpermission'''s</p><p>verbosity{| class="wikitable" style=1</p>"width:800px;" <p>'''bootlogo=false'''</p></li>|-<li><p>Set the '''bootlogo''' variable to '''true''' in '''/boot/orangepiEnv.txt''' to enable the power on/off logo.</p>| <p>orangepi@orangepi:~$ '''sudo vim /boot/orangepiEnvset_vnc.txtsh'''</p><p>verbosity=1</p><p>'''bootlogo=true'''</p></li><li><p>The location of the boot logo picture in the Linux system is</p><p>'''/usr/share/plymouth/themes/orangepi/watermarkYou will require a password to access your desktops.png'''</p></li><li><p>After replacing the boot logo image, you need to run the following command to take effect</p><p>orangepi@orangepi:~$ '''sudo update-initramfs -u'''</p></li></ol>
<span id="how-to-shut-down-and-restart-the-development-board"p>Creating default startup script /root/.vnc/xstartup</p><p>Starting applications specified in /root/.vnc/xstartup</spanp>== How to shut down and restart the development board ==<p>Log file is /root/.vnc/orangepi:1.log</p>
<span id="linux-sdkorangepi-build-usage-instructions"p>Killing Xtightvnc process ID 3047</spanp>
<span id="compilation-system-requirements"p>New 'X' desktop is orangepi:1</spanp>== Compilation system requirements ==
<ol style="list-style-type: decimal;">
<li><p>Use the following script to install QT5 and QT Creator</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''install_qt.sh'''</p>
|}
</li>
<li><p>After installation, the QT version number will be automatically printed.</p>
<ol style="list-style-type: lower-alpha;">
<li>For the method of replacing Tsinghua Source, please refer to the instructions on this page.</lip></ol> [https://mirrorsThe qt version that comes with Ubuntu20.tuna.tsinghua.edu.cn/help/ubuntu/ 04 is '''https://mirrors5.tuna12.tsinghua.edu.cn/help/ubuntu/8''']</p> <ol start{| class="2wikitable" style="list-style-typewidth: lower-alpha800px;"><li>Note that the Ubuntu version needs to be switched to 22.04.</li></ol> [[File:zero2w|-img271.png]]| <ol start="3" style="list-style-type: lower-alpha;"><lip>The contents of the '''/etc/apt/sources.list''' file that need to be replaced are:</li></ol> testorangepi@testorangepi:~$ '''sudo mv /etc/apt/sources.list cat /etc/apt/sources.listinstall_qt.baksh''' test@test:~$ '''sudo vim </etc/apt/sources.list'''p> # The source code image is commented by default to improve apt update speed<p>. You can uncomment it yourself if necessary. deb https://mirrors.tuna.tsinghua.edu.cn</ubuntu/ jammy main restricted universe multiversep> # deb-src https://mirrors<p>QMake version 3.tuna.tsinghua.edu.cn1</ubuntu/ jammy main restricted universe multiversep> deb https<p>Using Qt version '''<span style="color://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse # deb-src https://mirrorsFF0000">5.tuna12.tsinghua.edu.cn8</ubuntuspan>''' in / jammy-updates main restricted universe multiverse deb https:usr/lib/mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammyaarch64-backports main restricted universe multiverse # deblinux-src https:gnu<//mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiversep>|}deb https:<//mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse # Pre-release software source, not recommended to be enabled # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverseli><ol start="4" style="list-style-type: lower-alpha;"li><lip>After the replacement, you need to update the package information and ensure The QT version that no errors are reportedcomes with Ubuntu22.</li></ol> test@test:~$ 04 is '''sudo apt-get update5.15.3'''</p> <ol start{| class="5wikitable" style="list-style-typewidth: lower-alpha800px;">|-| <lip>orangepi@orangepi:~$ '''In addition, since the source code of the kernel and Uboot are stored on GitHub, it is very important to ensure that the computer can download the code from GitHub normally when compiling the imageinstall_qt.sh'''</lip><p>......</olp> <span id="obtain-the-source-code-of-linux-sdk"p>QMake version 3.1</spanp>== Obtain the source code of linux sdk == <p>Using Qt version '''<span idstyle="download-orangepi-build-from-githubcolor:#FF0000">5.15.3</span>=== Download orangepi-build from github === Linux sdk refers to the orangepi-build set of codes. Orangepi-build is modified based on the armbian build compilation system. Multiple versions of Linux images can be compiled using orangepi-build. Use the following command to download the orangepi-build code: test@test:~$ '''sudo apt-get update''' test@test:~$ '''sudo apt-get install -y git''' test@test:~$ '''git clone https:in /usr/github.comlib/orangepiaarch64-xunlong/orangepi-build.git linux-b next''' '''Note that when using the H618 Soc development board, you need to download the source code of the next branch of orangepi-build. The above git clone command needs to specify the branch of the orangepi-build source code as next.''' gnu<div class="figure"/p> [[File:zero2w-img272.png]]|}</divli><li><p>The QT version that comes with Debian11 is '''When downloading the orangepi-build code through the git clone command, you do not need to enter the user name and password of the github account (the same is true for downloading other codes in this manual)5. If after entering the git clone command, Ubuntu PC prompts you to enter the user name of the github account. The name and password are usually entered incorrectly in the address of the orangepi-build warehouse behind git clone. Please carefully check whether there are any errors in the spelling of the command, rather than thinking that we have forgotten to provide the username and password of the github account15.2''' The u-boot and linux kernel versions currently used by the H618 series development boards are as follows:</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''branchinstall_qt.sh'''</p>| <p>......</p><p>QMake version 3.1</p><p>Using Qt version '''u-boot Version<span style="color:#FF0000">5.15.2</span>'''in /usr/lib/aarch64-linux-gnu</p>| }</li><li><p>The QT version that comes with Debian12 is '''linux Kernel version5.15.8'''</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''install_qt.sh'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version '''current<span style="color:#FF0000">5.15.8</span>'''in /usr/lib/aarch64-linux-gnu</p>| }</li></ol></li><li><p>Then you can see the QT Creator startup icon in '''uApplications'''</p><p>[[File:zero2w-boot v2018img230.05png]]</p><p>You can also use the following command to open QT Creator</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''qtcreator'''</p>| }</li><li><p>The interface after QT Creator is opened is as follows</p><p>[[File:zero2w-img231.png]]</p></li><li><p>The version of QT Creator is as follows</p><ol style="list-style-type: lower-alpha;"><li><p>The default version of QT Creator in '''Ubuntu20.04''' is as follows</p><p>[[File:zero2w-img232.png]]</p></li><li><p>The default version of QT Creator in '''Ubuntu22.04''' is as follows</p><p>[[File:zero2w-img233.png]]</p></li><li><p>The default version of QT Creator in '''Debian11''' is as follows</p><p>[[File:zero2w-img234.png]]</p></li><li><p>The default version of QT Creator in '''Debian12''' is as follows</p><p>[[File:zero2w-img235.png]]</p></li></ol></li><li><p>Then set up QT</p><ol style="list-style-type: lower-alpha;"><li><p>First open '''Help'''->'''About Plugins...'''linux5.4</p><p>[[File:zero2w-img236.png]]</p></li><li><p>Then remove the check mark of '''ClangCodeModel'''</p><p>[[File:zero2w-img237.png]]</p></li><li><p>'''<span style="color:#FF0000">After setting up, you need to restart QT Creator</span>'''</p></li><li><p>Then make sure the GCC compiler used by QT Creator. If the default is Clang, please change it to GCC.</p>{|class="wikitable" style="background-color:#ffffdc;width:800px;" | -| <big><p>'''nextDebian12 please skip this step.'''</p></big>| }<p>[[File:zero2w-img238.png]]</p><p>[[File:zero2w-img239.png]]</p></li></ol></li><li><p>Then you can open a sample code</p><p>[[File:zero2w-img240.png]]</p></li><li><p>After clicking on the sample code, the corresponding instruction document will automatically open. You can read the instructions carefully.</p><p>[[File:zero2w-img241.png]]</p></li><li><p>Then click '''uConfigure Project'''</p><p>[[File:zero2w-img242.png]]</p></li><li><p>Then click the green triangle in the lower left corner to compile and run the sample code</p><p>[[File:zero2w-img243.png]]</p></li><li><p>After waiting for a period of time, the interface shown in the figure below will pop up, which means that QT can compile and run normally.</p><p>[[File:zero2w-img244.png]]</p></li><li><p>References</p>{| class="wikitable" style="width:800px;" |-boot v2021| <p>[https://wiki.07qt.io/Install_Qt_5_on_Ubuntu '''https://wiki.qt.io/Install_Qt_5_on_Ubuntu''']</p>| <p>[https://download.qt.io/archive/qtcreator '''https://download.qt.io/archive/qtcreator''']</p><p>[https://download.qt.io/archive/qt '''linux6https://download.1qt.io/archive/qt''']</p>
|}
</li></ol>
::{| class="wikitable" style="width:800px;" |-| [http://docs.ros.org/ '''buildhttp://docs.sh external LICENSE READMEros.md scriptsorg''']
'''If you downloaded the orangepi-build code from github, after downloading, you may find that orangepi-build does not contain the source code of u-boot and linux kernel, and there is no cross-compilation tool required to compile u-boot and linux kernelhttps://wiki. chain, this is normal, because these things are stored in other separate github repositories or some servers (their addresses will be detailed below). Orangepi-build will specify the addresses of u-boot, Linux kernel and cross-compilation tool chain in the script and configuration file. When running orangepi-build, when it finds that these things are not available locally, it will automatically download them from the corresponding placesros.org/Distributions'''|}
<span idol start="2" style="downloadlist-style-type: decimal;"><li><p>The link to theofficial installation documentation of ROS 1 '''Noetic Ninjemys''' is as follows:</p>{| class="wikitable" style="width:800px;" |-cross-compilation-tool-chain| <p>[http://wiki.ros.org/noetic/Installation/Ubuntu '''http://wiki.ros.org/noetic/Installation/Ubuntu''']</p>|}</li><li><p>In the official installation documentation of ROS '''Noetic Ninjemys''', Ubuntu recommends using Ubuntu20.04, so please ensure that the system used by the development board is '''<span style="color:#FF0000">Ubuntu20.04 desktop system</span>'''.</p>{| class="wikitable" style="width:800px;" |-| <p>[http://wiki.ros.org/noetic/Installation '''http://wiki.ros.org/noetic/Installation''']</p><p>[[File:zero2w-img247.png]]</p>|}</li><li><p>Then use the script below to install ros1</p>{| class="wikitable" style= Download "width:800px;" |-| <p>orangepi@orangepi:~$ '''install_ros.sh ros1'''</p>|}</li><li><p>Before using the cross-compilation ROS tool chain , you first need to initialize rosdep. Then when compiling the source code, you can quickly install some system dependencies and some core components in ROS.</p></li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''<span style="color:#FF0000">Note that when running the following command, you need to ensure that the development board can access github normally, otherwise an error will be reported due to network problems.</span>'''
Add distro "rolling" updated cache in /home/orangepi/.ros/rosdep/sources.cache|}</ol><ol start="26" style="list-style-type: decimal;"><li>Select <p>Then open a command line terminal window on the '''desktop''', and then use the '''test_ros.sh'''Uscript to start a small turtle routine to test whether ROS can be used normally.</p>{| class="wikitable" style="width:800px;" |-boot package| <p>orangepi@orangepi:~$ ''' and press Entertest_ros.sh'''</p>|}</li><li><p>After running the '''test_ros.sh''' script, a small turtle as shown in the picture below will pop up.</p><p>[[File:zero2w-img248.png]]</p></li><li><p>Then please keep the terminal window you just opened at the top</olp></li>
<div class="figure">
[[File:zero2w-img274img249.png]] </div></ol><ol start="9" style="list-style-type: decimal;"><li><p>At this time, press the direction keys on the keyboard to control the little turtle to move up, down, left, and right.</p><p>[[File:zero2w-img250.png]]</p></li></ol>
</div><ol startspan id="3" style="listhow-to-install-ros-2-galactic-styleon-type: decimal;ubuntu20.04"><li>Then select the model of the development board</li></olspan>
<ol start="4" style="list-style-type: decimal;"><li><p>Then select The currently active version of ROS 2 is as follows, the branch type of urecommended version is '''Galactic Geochelone'''</p><p>[[File:zero2w-bootimg251.png]]</p><ol p>[[File:zero2w-img252.png]]</p>{| class="wikitable" style="list-style-typewidth: lower-alpha800px;"|-| <p>[http://docs.ros.org/ '''http://docs.ros.org''']</p><p>'''http://docs.ros.org/en/galactic/Releases.html'''</p>|}</li><li><p>The current branch will compile link to the uofficial installation documentation of ROS 2 '''Galactic Geochelone''' is as follows:</p>{| class="wikitable" style="width:800px;" |-boot v2018| <p>'''docs.05 version code that needs to be used by the linux5ros.org/en/galactic/Installation.html'''</p><p>'''http://docs.ros.4 imageorg/en/galactic/Installation/Ubuntu-Install-Debians.html'''</p>|}</li><li><p>The next branch will compile In the u-boot v2021official installation documentation of ROS 2 '''Galactic Geochelone''', Ubuntu Linux recommends using Ubuntu20.07 version code 04, so please ensure that needs to be the system used by the linux6development board is the '''<span style="color:#FF0000">Ubuntu20.04 desktop system</span>'''.1 imageThere are several ways to install ROS 2. The following demonstrates how to install ROS 2 '''Galactic Geochelone''' through '''Debian packages'''.</p></li><li><p>[[File:zero2w-img276Use the '''install_ros.png]]sh''' script to install ros2</p>{| class="wikitable" style="width:800px;" |-| </lip>orangepi@orangepi:~$ '''install_ros.sh ros2'''</olp>|}
</li>
<li><p>The '''install_ros.sh''' script will automatically run the '''ros2 -h''' command after installing ros2. If you select the next branch, you will also be prompted to select can see the memory sizefollowing print, and you do not need to select it means that the current branchros2 installation is complete.</p>{| class="wikitable" style="width:800px;" |-| </lip>usage: ros2 [-h] Call `ros2 <command> -h` for more detailed usage. ...</olp>
<ol start="2" style="listp>Commands:</p>:<p>action Various action related sub-stylecommands</p>:<p>bag Various rosbag related sub-typecommands</p>: lower<p>component Various component related sub-alpha;"commands</p>:<lip>Version of the crossdaemon Various daemon related sub-compilation tool chaincommands</lip>:<p>doctor Check ROS setup and other potential issues</p>:<p>interface Show information about ROS interfaces</p>:<p>launch Run a launch file</p>:<p>lifecycle Various lifecycle related sub-commands</p>:<p>multicast Various multicast related sub-commands</p>:<p>node Various node related sub-commands</p>:<p>param Various param related sub-commands</p>:<p>pkg Various package related sub-commands</p>:<p>run Run a package specific executable</p>:<p>security Various security related sub-commands</p>:<p>service Various service related sub-commands</p>:<p>topic Various topic related sub-commands</p>:<p>wtf Use `wtf` as alias to `doctor`</olp>
:<p>Call `ros2 <command> -h` for more detailed usage.</p>|}</li><li><p>Then you can use the '''test_ros.sh''' script to test whether ROS 2 is installed successfully. If you can see the following print, it means ROS 2 can run normally.<ol start/p>{| class="3wikitable" style="listwidth:800px;" |-| <p>orangepi@orangepi:~$ '''test_ros.sh'''</p><p>[INFO] [1671174101.200091527] [talker]: Publishing: 'Hello World: 1'</p><p>[INFO] [1671174101.235661048] [listener]: I heard: [Hello World: 1]</p><p>[INFO] [1671174102.199572327] [talker]: Publishing: 'Hello World: 2'</p><p>[INFO] [1671174102.204196299] [listener]: I heard: [Hello World: 2]</p><p>[INFO] [1671174103.199580322] [talker]: Publishing: 'Hello World: 3'</p><p>[INFO] [1671174103.204019965] [listener]: I heard: [Hello World: 3]</p>|}</li><li><p>Run the following command to open rviz2</p>{| class="wikitable" style="width:800px;" |-type| <p>orangepi@orangepi:~$ '''source /opt/ros/galactic/setup.bash'''</p><p>orangepi@orangepi:~$ '''ros2 run rviz2 rviz2'''</p>|}<p>[[File: lowerzero2w-alpha;"img253.png]]</p></li><li>Path <p>For how to use ROS, please refer to the compiled udocumentation of ROS 2.</p>{| class="wikitable" style="width:800px;" |-boot deb package| <p>[http://docs.ros.org/en/galactic/Tutorials.html '''http://docs.ros.org/en/galactic/Tutorials.html''']</p>|}</li></ol>
:<ol start="8" style="listp>Call `ros2 <command> -style-type: decimal;"h` for more detailed usage.</p>|}</li><li>When the orangepi-bulid compilation system compiles the u-boot source code, it will first synchronize the u-boot source code with the u-boot source code of the github server. Therefore, if <p>Then you want to modify can use the u-boot source code, you first need to turn off the download and update function of the source code'''test_ros. (sh'''You need script to completely compile u-boot before test whether ROS 2 is successfully installed. If you can turn off this functionsee the following print, otherwise it will prompt that the source code of umeans ROS 2 can run normally.</p>{| class="wikitable" style="width:800px;" |-boot cannot be found| <p>orangepi@orangepi:~$ '''test_ros.sh'''), otherwise the modifications will be restored</p><p>[INFO] [1671174101. The method is as follows200091527] [talker]: Publishing: 'Hello World:1'</lip><p>[INFO] [1671174101.235661048] [listener]: I heard: [Hello World: 1]</olp> <blockquotep>Set the IGNORE_UPDATES variable in u[INFO] [1671174102.199572327] [talker]: Publishing: 'Hello World: 2''userpatches</p><p>[INFO] [1671174102.204196299] [listener]: I heard: [Hello World: 2]</config-defaultp><p>[INFO] [1671174103.conf'199580322] [talker]: Publishing: 'Hello World: 3' </p><p>[INFO] [1671174103.204019965] [listener]: I heard: [Hello World: 3]</p>|}</li><li><p>Run the following command to "yes"open rviz2</p>{| class="wikitable" style="width:800px;" |-| </blockquotep>testorangepi@testorangepi:~/orangepi-build$ '''vim userpatchessource /config-defaultopt/ros/humble/setup.confbash'''</p> ...... IGNORE_UPDATES="<p>orangepi@orangepi:~$ '''yesros2 run rviz2 rviz2'''"</p><p>[[File:zero2w-img254......png]]</p>|}<ol start="9" style="list-style-type: decimal;"/li><li><p>When debugging u-boot code, you can use the following method to update u-boot in the linux image for testingReference documentation</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;">|-| <lip>First upload the compiled deb package of u-boot to the Linux system of the development board'''http://docs.ros.org/en/humble/index.html'''</lip><p>[http:/ol/docs.ros.org/en/galactic/Tutorials.html '''http://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html''']</p>|}
</li></ol>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb [mailtoDebian11 system with <span style="color:root@192.168#FF0000">Linux6.1.xxx:</root root@192span> kernel will report GCC error when compiling kernel module.168So if you want to compile the kernel module, please use Debian12 or Ubuntu22.104.xxx:/root]'''</big>|}
<ol start="2" style="list-style-type: lower-alphadecimal;"><li>Install <p>The Linux image released by OPi comes with the deb package of the kernel header file by default, and the new ustorage location is '''/opt/'''</p>{| class="wikitable" style="width:800px;" |-boot | <p>orangepi@orangepi:~$ '''ls /opt/linux-headers*'''</p><p>/opt/linux-headers-xxx-sun50iw9_x.x.x_arm64.deb package just uploaded</p>|}</li><li><p>Use the following command to install the deb package of the kernel header file</olp>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo dpkg -i/opt/linux-headers*.deb'''</p>|}</li><li><p>After installation, you can see the folder where the kernel header file is located under '''/usr/src'''.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ ''' ls /usr/src'''</p><p>linux-uheaders-bootx.x.x</p>|}</li><li><p>Then you can compile the source code of the hello kernel module that comes with the Linux image. The source code of the hello module is in '''/usr/src/hello'''. After entering this directory, then use the make command to compile.</p>{| class="wikitable" style="width:800px;" |-next| <p>orangepi@orangepi:~$ '''cd /usr/src/hello/'''</p><p>orangepi@orangepi:/usr/src/hello$ '''sudo make'''</p><p>make -orangepizero2w_xC /lib/modules/5.4.x125/build M=/usr/src/hello modules</p><p>make[1]: Entering directory '/usr/src/linux-headers-5.x_arm644.deb125'</p>:<p>CC [M] /usr/src/hello/hello.o</p>:<p>Building modules, stage 2.</p>:<p>MODPOST 1 modules</p>:<p>CC [M] /usr/src/hello/hello.mod.o</p>:<p>LD [M] /usr/src/hello/hello.ko</p><p>make[1]: Leaving directory '/usr/src/linux-headers-5.4.125'</p>|}<ol start/li><li><p>After compilation, the '''hello.ko''' kernel module will be generated</p>{| class="3wikitable" style="listwidth:800px;" |-| <p>orangepi@orangepi:/usr/src/hello$ '''ls *.ko'''</p><p>hello.ko</p>|}</li><li><p>Use the '''insmod''' command to insert the '''hello.ko''' kernel module into the kernel</p>{| class="wikitable" style-type="width: lower-alpha800px;"|-| <p>orangepi@orangepi:/usr/src/hello$ '''sudo insmod hello.ko'''</p>|}</li><li><p>Then run use the '''demsg''' command to view the output of the '''hello.ko''' kernel module. If you can see the nandfollowing output, it means that the '''hello.ko''' kernel module is loaded correctly.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:/usr/src/hello$ '''dmesg | grep "Hello"'''</p><p>[ 2871.893988] '''Hello Orange Pi -sata-install scriptinit'''</p>|}</li><li><p>Use the '''rmmod''' command to uninstall the '''hello.ko''' kernel module</olp>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~/usr/src/hello$ '''sudo nandrmmod hello'''</p><p>orangepi@orangepi:/usr/src/hello$ '''dmesg | grep "Hello"'''</p><p>[ 2871.893988] Hello Orange Pi -- init</p><p>[ 3173.800892] '''Hello Orange Pi -sata-installexit'''</p>|}</li></ol>
<ol startspan id="4" style="listtesting-of-some-programming-languages-supported-styleby-type: lowerlinux-alpha;system"><li>Then select '''5 Install/Update the bootloader on SD/eMMC'''</li></olspan>
<ol style="list-style-type: decimal;">
<li><p>Debian Bullseye is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.</p>
<ol style="list-style-type: lower-alpha;">
<li>If you do <p>The version of a.gcc is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''gcc --version'''</p><p>gcc (Debian 10.2.1-6) 10.2.1 20210110</p><p>Copyright (C) 2020 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not need to modify even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>|}</li><li><p>Write the kernel configuration options, when running the build'''hello_world.sh script, pass c'''KERNEL_CONFIGUREprogram in C language</p>{| class=no"wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ ''' to temporarily block the pop-up of the kernel configuration interfacevim hello_world.c'''</lip><p>#include <stdio.h></olp>
:<p>return 0;<ol start/p><p>}</p>|}</li><li><p>Then compile and run '''hello_world.c'''</p>{| class="7wikitable" style="listwidth:800px;" |-style| <p>orangepi@orangepi:~$ '''gcc -typeo hello_world hello_world.c'''</p><p>orangepi@orangepi: decimal;"~$ '''./hello_world'''</p><p>Hello World!</p>|}</li></ol></li><li><p>Part of the information prompted when compiling the next branch kernel source code is explained as follows:Debian Bullseye has Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li>Version <p>The specific version of Python is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3'''</p><p>'''Python 3.9.2''' (default, Feb 28 2021, 17:03:44)</p><p>[GCC 10.2.1 20210110] on linux</p><p>Type "help", "copyright", "credits" or "license" for more information.</p><p>>>></p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Use the linux kernel source codeCtrl+D shortcut key to exit python's interactive mode.'''</p></big>|}</li><li><p>Write the '''hello_world.py''' program in Python language</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.py'''</p><p>print('Hello World!')</p>|}</li><li><p>The result of running '''hello_world.py''' is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 hello_world.py'''</p><p>Hello World!</olp>|}
</li></ol>
<ol style="list-style-type: lower-alpha;">
<li><p>You can use the following command to install openjdk. The latest version in Debian Bullseye is openjdk-17</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''linuxsudo apt install -dtby openjdk-next17-sun50iw9_x.x.x_arm64.debjdk''' Contains dtb files used by the kernel</p>|}</li><li><p>After installation, you can check the Java version.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''linuxjava -headers-nextversion'''</p>|}</li><li><p>Write the Java version of '''hello_world.java'''</p>{| class="wikitable" style="width:800px;" |-sun50iw9_x.x| <p>orangepi@orangepi:~$ '''vim hello_world.x_arm64.debjava''' Contains kernel header files</p><p>public class hello_world</p><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println("Hello World!");</p>:<p>}</p><p>}</p>|}</li><li><p>Then compile and run '''linuxhello_world.java'''</p>{| class="wikitable" style="width:800px;" |-image-next-sun50iw9_x| <p>orangepi@orangepi:~$ '''javac hello_world.x.x_arm64.debjava'''</p><p>orangepi@orangepi:~$ '''java hello_world''' Contains kernel images and kernel modules</p><p>Hello World!</p>|}</li></ol>
</li></ol>
<ol style="list-style-type: lower-alpha;">
<li>Upload the compiled deb package of the Linux kernel to the Linux system <p>The version of a.gcc is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''gcc --version'''</p><p>gcc (Debian 12.2.0-14) 12.2.0</p><p>Copyright (C) 2022 Free Software Foundation, Inc.</p><p>This is free software; see the development boardsource for copying conditions. There is NO</lip><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</olp>|}</li><li><p>Write the '''hello_world.c''' program in C language</olp>{| class="wikitable" style="width:800px;" |-| test<p>orangepi@testorangepi:~/orangepi-build$ '''cd output/debsvim hello_world.c'''</p><p>#include <stdio.h></p>
<ol style="list-style-type: lower-alpha;">
<li><p>In the current branch, you can see three options: debian11, ubuntu20.04, and ubuntu22.04.The specific version of Python is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3'''</lip><li><p>In the next branchPython 3.11.2 (main, Mar 13 2023, you can see three options12: debian11, debian12, and ubuntu2218:29) [GCC 12.042.0] on linux</p></lip>Type "help", "copyright", "credits" or "license" for more information.</olp></lip>>>></olp>|}[[File:zero2w-img276.png]] <ol start{| class="5wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;"|-| <big><lip>Then select '''Use the type of rootfsCtrl+D shortcut key to exit python's interactive mode.'''</lip></olbig> [[File:zero2w-img286.png]]|}<ol start="6" style="list-style-type: decimal;"/li><li><p>Then select Write the type of image'''hello_world.py''' program in Python language</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li>|-| <p>orangepi@orangepi:~$ '''Image with console interface vim hello_world.py'''</p><p>print(server)'Hello World!'' Represents the image of the server version, which is relatively small in size.)</p>|}</li><li><p>The result of running '''Image with desktop environmenthello_world.py''' Represents an image with a desktop, which is relatively large in sizeas follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 hello_world.py'''</p></lip>Hello World!</olp>|}
</li></ol>
<ol style="list-style-type: lower-alpha;">
<li>Type <p>You can use the following command to install openjdk. The latest version in Debian Bookworm is openjdk-17</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''</p>|}</li><li><p>After installation, you can check the Java version.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''java --version'''</p>|}</li><li><p>Write the Java version of rootfs'''hello_world.java'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println("Hello World!");</p>:<p>}</p><p>}</p>|}</li><li><p>Then compile and run '''hello_world.java'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''javac hello_world.java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p>|}</li></ol>
</li></ol>
<ol style="list-style-type: lower-alpha;">
<li><p>The version of a.gcc is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''bullseyegcc -xfce-arm64version'''</p><p>gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0</p><p>Copyright (C) 2019 Free Software Foundation, Inc.5250ec7002de9e81a41de169f1f89721</p><p>This is free software; see the source for copying conditions.tarThere is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.lz4</p>|}</li><li><p>Write the ''' It is a compressed package of rootfshello_world. The meaning of each field c''' program in the name isC language</lip>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.c'''</olp></lip>#include <stdio.h></olp>
</li></ol>
</li>
<li><p>Then select the type of rootfs</p></li></ol> [[File:zero2w-img286.png]] <ol start="7" style="list-style-type: decimal;"><li><p>Then select the type of imageUbuntu Focal has Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The specific version of Python3 is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3'''Image with console interface </p><p>Python 3.8.10 (serverdefault, Nov 14 2022, 12:59:47)</p><p>[GCC 9.4.0] on linux</p><p>Type "help", "copyright", "credits" or "license" for more information.</p><p>>>></p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>''' Represents Use the image Ctrl+D shortcut key to exit python's interactive mode.'''</p></big>|}</li><li><p>Write the '''hello_world.py''' program in Python language</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.py'''</p><p>print('Hello World!')</p>|}</li><li><p>The result of running '''hello_world.py''' is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 hello_world.py'''</p><p>Hello World!</p>|}</li></ol></li><li><p>Ubuntu Focal does not have Java compilation tools and running environment installed by default.</p><ol style="list-style-type: lower-alpha;"><li><p>You can use the following command to install openjdk-17</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''</p>|}</li><li><p>After installation, you can check the server Java version.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''java --version'''</p><p>openjdk 17.0.2 2022-01-18</p><p>OpenJDK Runtime Environment (build 17.0.2+8-Ubuntu-120.04)</p><p>OpenJDK 64-Bit Server VM (build 17.0.2+8-Ubuntu-120.04, mixed mode, which is relatively small in sizesharing)</p>|}</li><li><p>Write the Java version of '''hello_world.java'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println("Hello World!");</p>:<p>}</p><p>}</p>|}</li><li><p>Then compile and run '''hello_world.java'''Image with desktop environment</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''Represents an image with a desktop, which is relatively large in sizejavac hello_world.java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p>|}</li></ol>
</li></ol>
<div classspan id="figureubuntu-jammy-system"></span>
|-
| <p>orangepi@orangepi:~$ '''Motherboard functionspython3'''</p><p>Python 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0] on linux</p><p>Type "help", "copyright", "credits" or "license" for more information.</p><p>>>></p>|}{| '''OPi OS Arch'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big><p>'''HDMI videoUse the Ctrl+D shortcut key to exit python's interactive mode.'''</p></big>| }</li><li><p>Write the '''OKhello_world.py'''program in Python language</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''vim hello_world.py''HDMI Audio'</p><p>print('Hello World!')</p>| }</li><li><p>The result of running '''OKhello_world.py'''is as follows</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''Type-C USB2python3 hello_world.0 x 2py'''</p><p>Hello World!</p>| '''OK'''}</li></ol></li><li><p>Ubuntu Jammy does not install Java compilation tools and operating environment by default.</p>|<ol style="list-style-type: lower-alpha;">| '''TF Card Startup'''<li><p>You can use the following command to install openjdk-18</p>{| '''OK'''class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''WIFIsudo apt install -y openjdk-18-jdk'''</p>|}</li><li><p>After installation, you can check the Java version.</p>{| '''OK'''class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''Bluetoothjava --version'''</p><p>openjdk 18.0.2-ea 2022-07-19</p><p>OpenJDK Runtime Environment (build 18.0.2-ea+9-Ubuntu-222.04)</p><p>OpenJDK 64-Bit Server VM (build 18.0.2-ea+9-Ubuntu-222.04, mixed mode, sharing)</p>| }</li><li><p>Write the Java version of '''OKhello_world.java'''</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''LED Lightvim hello_world.java'''</p><p>public class hello_world</p><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println("Hello World!");</p>:<p>}</p><p>}</p>| }</li><li><p>Then compile and run '''OKhello_world.java'''</p>{| class="wikitable" style="width:800px;"
|-
| '''40pin GPIO'''| '''OK'''|-| '''40pin I2C'''| '''OK'''|-| '''40pin SPI'''| '''OK'''|-| '''40pin UART'''| '''OK'''|-| '''40pin PWM'''| '''OK'''|-| '''Temperature Sensor'''| <p>orangepi@orangepi:~$ '''OKjavac hello_world.java'''</p>|-| <p>orangepi@orangepi:~$ '''Hardware watchdogjava hello_world'''</p>| '''OK'''|-| '''Mali GPU'''| '''NO'''|-| '''Video codec'''| '''NO'''<p>Hello World!</p>
|}
</li></ol>
</li></ol>
<ol style="list-style-type: decimal;">
<li><p>Use the scp command to upload files to the Linux system of the development board in Ubuntu PC. The specific command is as follows</p>
<ol style="list-style-type: lower-alpha;">
<li><p>After burning '''file_path: '''Needs to be replaced with the path of the file to be uploaded</p></li><li><p>'''orangepi: '''This is the user name of the development board's Linux system. It can also be replaced with something else, when you start such as root.</p></li><li><p>'''192.168.xx.xx:''' This is the IP address of the development board. Please modify it for according to the first time and enter actual situation.</p></li><li><p>'''/home/orangepi:''' The path in the desktopdevelopment board Linux system can also be modified to other paths.</p>{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''scp file_path orangepi@192.168.xx.xx:/home/orangepi/'''</p>|}</li></ol></li><li><p>If you want to upload a folder, you will see need to add the user wizard program shown in the figure below-r parameter</p>{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''scp <span style="color:#FF0000">-r</span> dir_path orangepi@192.168.xx.xx:/home/orangepi/'''</p>|}</li><li><p>There are more usages of scp, please use the following command to view the man manual</p><div /li>{| class="figurewikitable" style="width:800px;" |-| test@test:~$ '''man scp'''|}</ol><span id="how-to-upload-files-using-filezilla"></span>
<ol style="list-style-type: decimal;"><li><p>First install filezilla in Ubuntu PC</p>{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''sudo apt install -y filezilla'''</divp>|}</li><li><p>First you need Then use the following command to select open filezilla</p>{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''filezilla'''</p>|}</li><li><p>The interface after opening filezilla is as shown below. At this time, the remote site on the language you wantright is empty.</p>
<div class="figure">
[[File:zero2w-img294img255.png]]
</div></li>
<li><p>After selecting The method of connecting the language, the user wizard will immediately switch to the corresponding language interface, development board is as shown in the figure below in Chinese</p></li>
<div class="figure">
[[File:zero2w-img295img256.png]] </div></ol><ol start="5" style="list-style-type: decimal;"><li><p>Then choose to '''save the password''' and click '''OK'''</p><p>[[File:zero2w-img257.png]]</p></li><li><p>Then select '''Always trust this host''' and click '''OK'''</p></li>
<div class="figure">
[[File:zero2w-img296img258.png]] </div></ol><ol start="7" style="list-style-type: decimal;"><li>After the connection is successful, you can see the directory structure of the development board's Linux file system on the right side of the filezilla software.</li>
<div class="figure">
[[File:zero2w-img297img259.png]]
</div></liol><liol start="8" style="list-style-type: decimal;"><pli>Then create a new username select the path to be uploaded to the development board on the right side of the filezilla software, select the file to be uploaded in Ubuntu PC on the left side of the filezilla software, right-click the mouse, and set a passwordthen click the upload option to start uploading the file to the development board.</pli><div class="figure"> [[File:zero2w-img298.png]]
<div class="figure">
[[File:zero2w-img299img260.png]]
</div></liol><ol start="9" style="list-style-type: decimal;"><li><p>Then wait for After the installation upload is completed, you can go to completethe corresponding path in the development board Linux system to view the uploaded file.</p></li><div class="figure"li><p>The method of uploading a folder is the same as the method of uploading a file, so I won't go into details here.</p></li></ol>
=== Method to upload files from Windows PC to development board Linux system === </divspan id="how-to-upload-files-using-filezilla-1"></lispan><li><p>After ==== How to upload files using filezilla ==== # First download the installation file of the Windows version of the filezilla software. The download link is complete, you need to click the as follows ::{| class="wikitable" style="width:800px;" |-| [https://filezilla-project.org/download.php?type=client '''Finishhttps://filezilla-project.org/download.php?type=client''' button to restart the system]|} ::[[File:zero2w-img261.</p><div class="figure">png]]
<div class="figure">
::[[File:zero2w-img302img262.png]]
</div>
<ol start="2" style="list-style-type: decimal;"><li><p>At this pointThe downloaded installation package is as shown below, you can use the newly created username and password to log in then double-click to the OPi OS system through the serial port or ssh.install it directly</p>{| class="wikitable" style="width:800px;" |-| <p>'''FileZilla_Server_1.5.1_win64-setup.exe'''</lip>|}During the installation process, please select '''Decline''' on the following installation interface, and then select '''Next>''' </oldiv class="figure"> [[File:zero2w-img263.png]]
<span id/div></li></ol><ol start="3" style="how-to-setlist-dtstyle-overlaystype: decimal;"><li>The interface after opening filezilla is as shown below. At this time, the remote site on the right is empty.</spanli>== How to set DT overlays ==
</div></ol><ol start="5" style="list-style-type: decimal;"><li>Then choose to '''Note that xxx.dtbo in FDTOVERLAYS /dtbs/allwinner/overlay/xxx.dtbo needs to be replaced with save the specific dtbo configuration, please do not copy it.password'''and click '''OK'''</li>
</div></ol><ol start="37" style="list-style-type: decimal;"><li><p>The storage path of xxx.dtbo in After the OPi OS Arch image connection is as follows. Please note that not all dtbo under this path successful, you can be used.</p><p>'''/boot/dtbs/allwinner/overlay/'''</p></li><li><p>The DT overlays configuration that can be used by see the directory structure of the development board is as follows</p>'s Linux file system on the right side of the filezilla software.</li></ol>
<span id="how-to-installturn-softwareon-the-power-button-in-linux5.4"></span>== How to install software ==
<span idol style="supportedlist-androidstyle-versionstype: decimal;"><li><p>First run '''orangepi-config'''. Ordinary users remember to add '''sudo''' permissions.</spanp>== Supported Android versions == {| class="wikitable" style="width:800px;"
|-
| Android Version| Kernel version|-| <p>orangepi@orangepi:~$ '''Android 12 TV Version'''| '''linux5.4sudo orangepi-config'''</p>
|}
</li>
<li><p>Then select '''System'''</p>
<p>[[File:zero2w-img80.png]]</p></li>
<li><p>Then select '''Hardware'''</p>
<p>[[File:zero2w-img81.png]]</p></li>
<li><p>Then use the keyboard's arrow keys to locate the position shown in the picture below, and then use the '''space''' to select the dtbo configuration of the SPI you want to open.</p>
<p>[[File:zero2w-img270.png]]</p></li>
<li><p>Then select '''<Save>''' to save</p>
<p>[[File:zero2w-img83.png]]</p></li>
<li><p>Then select '''<Back>'''</p>
<p>[[File:zero2w-img84.png]]</p></li>
<li><p>Then select '''<Reboot>''' to restart the system to make the configuration take effect.</p>
<p>[[File:zero2w-img85.png]]</p></li></ol>
<span id="how-to-shut-down-and-restart-the-development-board"></span>
== How to shut down and restart the development board ==
<span idol style="androidlist-12style-tv-function-adaptation-statustype: decimal;"><li><p>During the running of the Linux system, if you directly unplug the power supply, it may cause the file system to lose some data. It is recommended to use the '''poweroff''' command to shut down the Linux system of the development board before powering off, and then unplug the power supply.</spanp>== Android 12 TV function adaptation status == {| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''Motherboard functionssudo poweroff'''</p>| '''Android12 TV'''}{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big><p>'''HDMI videoNote that after turning off the development board, you need to unplug and replug the power supply before it can be turned on.'''</p></big>|}</li><li><p>In addition to using the poweroff command to shut down, you can also use the power on/off button on the expansion board to shut down.</p><p>[[File:zero2w-img269.png]]</p>{| '''OK'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big><p>'''HDMI AudioNote that Linux 5.4 requires manual configuration of the power on/off button before it can be used. For the opening method, please refer to [[Orange Pi Zero 2W#How to turn on the power button in Linux5.4|the method of opening the power button in Linux5.4]].'''</p></big>| }</li><li><p>Use the '''OKreboot'''command to restart the Linux system in the development board</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''sudo''' '''Typereboot'''</p>|}</li></ol> <span id="linux-C USB2sdkorangepi-build-usage-instructions"></span> = '''Linux SDK——orangepi-build usage instructions''' = <span id="compilation-system-requirements"></span>== Compilation system requirements == The Linux SDK, '''orangepi-build''', only supports running on X64 computers with '''<span style="color:#FF0000">Ubuntu 22.0 x 204</span>'''| installed. Therefore, before downloading orangepi-build, please first ensure that the Ubuntu version installed on your computer is Ubuntu 22.04. The command to check the Ubuntu version installed on the computer is as follows. If the Release field does not display '''OK<span style="color:#FF0000">22.04</span>''', it means that the Ubuntu version currently used does not meet the requirements. Please change the system before performing the following operations. {| class="wikitable" style="width:800px;"
|-
| test@test:~$ '''TF card startuplsb_release -a'''| No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04 LTS Release: '''OK<span style="color:#FF0000">22.04</span>'''|-| Codename: '''WIFIjammy'''| } If the computer is installed with a Windows system and does not have Ubuntu 22.04 installed on it, you can consider using'''VirtualBox''' or '''OKVMware'''to install an Ubuntu 22.04 virtual machine in the Windows system. But please note, do not compile orangepi-build on the WSL virtual machine, because orangepi-build has not been tested in the WSL virtual machine, so there is no guarantee that orangepi-build can be used normally in WSL. In addition, please do not compile the Linux system on the development board. Use orangepi-build. The installation image download address of Ubuntu 22.04 amd64 version is: {| class="wikitable" style="width:800px;"
|-
| '''Bluetooth'''| '''OK'''|-| '''USB Camera'''| '''OK'''|[https://repo.huaweicloud.com/ubuntu-| '''LED Light'''| '''OK'''|releases/21.04/ubuntu-| '''40pin GPIO'''| '''OK'''|-| '''40pin I2C'''| '''OK'''|-| '''40pin SPI1'''| '''OK'''|21.04-| '''40pin UART'''| '''OK'''|desktop-| '''40pin PWM'''| amd64.iso '''OK'''|https://mirrors.tuna.tsinghua.edu.cn/ubuntu-| '''Temperature Sensor'''| '''OK'''|releases/22.04/ubuntu-| '''Hardware watchdog'''| '''OK'''|22.04-| '''Mali GPU'''| '''OK'''|desktop-| '''Video codec'''| '''OKamd64.iso''']
|}
After installing Ubuntu 22.04 on your computer or virtual machine, please first set the software source of Ubuntu 22.04 to Tsinghua source (or other domestic sources that you think is fast), otherwise it is easy to make errors due to network reasons when installing the software later. The steps to replace Tsinghua Source are as follows: <ol style="list-style-type: lower-alpha;"><li>For the method of replacing Tsinghua Source, please refer to the instructions on this page.</li> {| class="wikitable" style="width:800px;"
|-
| [https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/ '''24pin Expansion board functionhttps://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/''']| }</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Note that the Ubuntu version needs to be switched to 22.04.</li> [[File:zero2w-img271.png]]</ol><ol start="3" style="list-style-type: lower-alpha;"><li>The contents of the '''Android12 TV/etc/apt/sources.list'''file that need to be replaced are:</li>{| class="wikitable" style="width:800px;"
|-
| '''100M network port'''| test@test:~$ '''OK'''|-| '''100M Ethernet port light'''| '''OK'''|-| '''USB2sudo mv /etc/apt/sources.0 HOST x 2'''| '''OK'''|-| '''Infrared reception'''| '''OK'''|-| '''Headphone audio playback'''| '''OK'''|-| '''Onlist cat /etc/apt/off button'''| '''OK'''|-| '''LRADC''' '''Custom buttons x 2'''| '''OK, The default setting is the volume up and down keyssources.list.bak'''|-| '''TV-OUT'''| '''OK'''|}
'''# Make sure the '''servicedeb-src https://mirrors.adbtuna.tcptsinghua.port''' of the Android system is set to 5555 port numberedu.cn/ubuntu/ jammy-security main restricted universe multiverse
'''#''' deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
|}
</ol>
<ol start="4" style="list-style-type: lower-alpha;">
<li>After the replacement, you need to update the package information and ensure that no errors are reported.</li>
{| class="wikitable" style="width:800px;"
|-
|
test@test:~$ '''sudo apt-get update'''
|}
</ol>
<ol start="5" style="list-style-type: lower-alpha;">
<li>'''<span style="color:#FF0000">In addition, since the source code of the kernel and Uboot are stored on GitHub, it is very important to ensure that the computer can download the code from GitHub normally when compiling the image.</span>'''</li></ol>
test@test:~$ '''adb devicesgit clone https://github.com/orangepi-xunlong/orangepi-build.git -b next'''|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note that when using the H618 Soc development board, you need to download the source code of the <span style="color:#FF0000">next</span> branch of orangepi-build. The above git clone command needs to specify the branch of the orangepi-build source code as next.'''</big>
<ol start/div>|}{| class="5wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;">|-| <libig>Then '''When downloading the orangepi-build code through the git clone command, you can log do not need to enter the user name and password of the github account (the same is true for downloading other codes in to this manual). If after entering the android system through adb shell on git clone command, Ubuntu PCprompts you to enter the user name of the github account. The name and password are usually entered incorrectly in the address of the orangepi-build warehouse behind git clone. Please carefully check whether there are any errors in the spelling of the command, rather than thinking that we have forgotten to provide the username and password of the github account.'''</li></olbig>|}
<ol startspan id="2" style="listdownload-the-cross-compilation-styletool-type: decimal;chain"><li>Install adb tool on Ubuntu PC</li></olspan>
<ol startdiv class="3figure" style="list-style-type: decimal;"><li>Check whether the ADB device is recognized</li></ol>
{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''adb shellls toolchains/'''
<ol startspan id="4" style="listcompile-styleu-type: decimal;boot"><li>After turning on WI-FI, you can see the searched signals under '''Available networks'''.</li></olspan>
<div class="figure">
[[File:zero2w-img318.png]] </div><ol start="7" style="list-style-type: decimal;"><li>The display after successful WI-FI connection is as shown below</li></ol> [[File:zero2w-img319.png]] <span id="how-to-use-wi-fi-hotspot"></span>== How to use WI-FI hotspot == # First, please make sure that the Ethernet port is connected to the network cable and can access the Internet normally.# Then select '''Settings''' [[File:zero2w-img306img274.png]]
</div></ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then select '''Network & Internet'''the model of the development board</li></ol> [[File:zero2w-img314.png]]
[[File:zero2w-img275.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>Then select '''WIFI hotspot'''the branch type of u-boot</p><ol style="list-style-type: lower-alpha;"><li><p>The current branch will compile the u-boot v2018.05 version code that needs to be used by the linux5.4 image.</p></olli><li><p>The next branch will compile the u-boot v2021.07 version code that needs to be used by the linux6.1 image.</p><p>[[File:zero2w-img320img276.png]]</p></li></ol></li><li><p>If you select the next branch, you will also be prompted to select the memory size, and you do not need to select the current branch.</p><ol start="5" style="list-style-type: decimallower-alpha;"><li>Then open '''Hotspot Enable'''. You can also see <p>If the name and password development board you purchased has a memory size of the generated hotspot in the picture below1. Remember them and use them when connecting to the hotspot (if you need to modify 5GB, please select the name and password of the hotspot, you need to close Hotspot Enable firstoption. Then you can modify it)</p></li><li><p>If the development board you purchased has 1GB or 2GB or 4GB memory size, please choose the second option.</olp> <p>[[File:zero2w-img321img277.png]]</p></li></ol></li></ol>
<ol start="6" style="list-style-type: decimal;">
<li>At this time, you can take out your mobile phone<p>Then it will start to compile u-boot. If everything is normal, you can find Some of the WIFI hotspot with information prompted when compiling the same name (next branch is as follows:</p><ol style="list-style-type: lower-alpha;"><li>Version of u-boot source code</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Compiling u-boot [ '''here AndroidAP_7132v2021.07''') shown under ]|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Version of the cross-compilation tool chain</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Compiler version [ '''Hotspot nameaarch64-linux-gnu-gcc 11''' in ]|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>Path to the picture above in the WIcompiled u-boot deb package</li>{| class="wikitable" style="width:800px;" |-FI list searched by the mobile phone| [ o. Then you can click AndroidAP_7132 to connect to the hotspotk. The password can be seen under the ] Target directory [ '''Hotspot passwordorangepi-build/output/debs/u-boot''' in ]|}</ol><ol start="4" style="list-style-type: lower-alpha;"><li>The package name of the picture above.compiled u-boot deb package</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] File name [ '''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb''' ]|}</ol><ol start="5" style="list-style-type: lower-alpha;"><li>Compilation time</li>[[File{| class="wikitable" style="width:zero2w800px;" |-img322| [ o.k.png]Runtime [ '''1 min''' ]|}</ol><ol start="76" style="list-style-type: decimallower-alpha;"><li>After Repeat the connection is successful, it will be displayed as shown below (command to compile u-boot. Use the interface will be different on different mobile phones, following command without selecting through the specific graphical interface is subject to the one displayed on your mobile phone). At this time, you You can open a web page on your mobile phone to see if you can access the Internetstart compiling u-boot directly.</li>{| class="wikitable" style="width:800px;" |-| [ o.k. If the web page can be opened normally, it means that the ] Repeat Build Options [ '''WIsudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=u-FI Hotspotboot''' of the development board can be used normally.]|}</ol></li></ol> [[File:zero2w-img323.png]] <span idol start="how7" style="list-to-check-the-ip-address-ofstyle-type: decimal;"><li>View thecompiled u-ethernet-port">boot deb package</spanli>{| class="wikitable" style= How to check the IP address of the Ethernet port =="width:800px;" |-| test@test:~/orangepi-build$ '''ls output/debs/u-boot/'''
'''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb [[Filemailto:root@192.168.1.xxx:/root root@192.168.1.xxx:/root]'''|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Install the new u-boot deb package just uploaded</li>{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:zero2w~$ '''sudo dpkg -i''' '''linux-u-boot-img327next-orangepizero2w_x.x.x_arm64.png]]deb'''|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>Then run the nand-sata-install script</li>{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''sudo nand-sata-install'''|}</ol><ol start="4" style="list-style-type: lower-alpha;"><li>Then select '''5 Install/Update the bootloader on SD/eMMC'''</li>
[[File:zero2w-img278.png]]</ol><ol start="35" style="list-style-type: decimallower-alpha;"><li>Then Open '''Bluetooth Enable'''After pressing the Enter key, a Warning will pop up first.</li></ol>
[[File:zero2w-img328img279.png]]</ol><ol start="6" style="list-style-type: lower-alpha;"><li>Press the Enter key again to start updating u-boot. After the update is completed, the following information will be displayed.</li>
[[File:zero2w-img280.png]]</ol><ol start="47" style="list-style-type: decimallower-alpha;"><li>Then click '''Pair new device'''you can restart the development board to start scanning for surrounding Bluetooth devicestest whether the u-boot modification has taken effect.</li></ol></li></ol><span id="compile-the-linux-kernel"></span>
<ol start="62" style="list-style-type: decimal;"><li>Then click on the Bluetooth device you want to connect to start pairing. When the following interface pops up, please use the mouse to select the Select '''PairKernel package'''optionand press Enter</li></ol>
[[File:zero2w-img282.png]]</ol><ol start="84" style="list-style-type: decimal;"><li>After pairing is completed, open '''Paired devices''' and you will see Then select the model of the paired Bluetooth devices.development board</li></ol>
[[File:zero2w-img333img275.png]]</ol><ol start="5" style="list-style-type: decimal;"><li>Then select the branch type of the kernel source code</li>
::[[File:zero2w-img276.png]]</ol><ol start="106" style="list-style-type: decimal;"><li>Pictures received by If you choose to display the Bluetooth system of kernel configuration menu (the development board Android system can be viewed second option) in step 3), the kernel configuration interface opened through '''Received filesmake menuconfig'''will pop up. At this time, you can directly modify the kernel configuration. After modification, save and exit. Yes, compilation of the kernel source code will begin after exiting.</li></ol>
[[File:zero2w-img335img283.png]] <span id="how-to-set-usb0-to-host-mode-1"></span>== How to set USB0 to HOST mode == As shown in the figure below, there are two Type-C interfaces on the motherboard of the development board: USB0 and USB1. Both of these interfaces can be used to power the development board, and they can also be used as USB2.0 HOST interfaces. The difference between USB0 and USB1 is that in addition to being set to HOST mode, USB0 can also be set to Device mode, while USB1 only has HOST mode. [[File:zero2w-img160.png]] USB0 of the Android12 TV system released by Orange Pi is set to Device mode by default, so when there is no need to use USB0 Device mode (ADB function needs to ensure that USB0 is in Device mode), it is recommended to use USB0 for power supply, so that USB1 can be directly used to connect USB devices . If you want to use USB0 to connect USB devices, you need to set USB0 to HOST mode. The method is as follows:
<ol style="list-style-type: lower-alpha;">
<li>Run If you do not need to modify the following command kernel configuration options, when running the build.sh script, pass '''KERNEL_CONFIGURE=no''' to set USB0 to HOST mode:temporarily block the pop-up of the kernel configuration interface.</li></ol>{| class="wikitable" style="width:800px;" apollo|-p2| test@test:~/ # orangepi-build$ '''cat /sys/devices/platform/soc@3000000sudo ./soc@3000000\:usbc0@0/usb_hostbuild.sh KERNEL_CONFIGURE=no'''|}host_chose finished! apollo-p2:</ #ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>Run <p>b. You can also set '''KERNEL_CONFIGURE=no''' in the orangepi-build/userpatches/config-default.confconfiguration file to permanently disable this function.</p></li><li><p>If the following command error is prompted when compiling the kernel, it is because the Ubuntu PC terminal interface is too small, causing the make menuconfig interface to switch back be unable to Device modebe displayed. Please increase the Ubuntu PC terminal to the maximum size, and then rerun the build.sh script.</lip></olli>
{| class="wikitable" style="width:800px;" |-| test@test:~/devorangepi-build$ '''vim userpatches/video0config-default.conf'''
IGNORE_UPDATES="'''<span style="color:#FF0000">yes</span>'''"|}</ol><ol start="310" style="list-style-type: decimal;"><li><p>Then make sure that If the kernel is modified, you can use the adb connection between following method to update the Ubuntu PC kernel and kernel module of the development board is normal. For how to use adb, please refer to the instructions in the section "'''How to use ADB'''".Linux system</p></liol style="list-style-type: lower-alpha;"><li><p>Download Upload the compiled deb package of the USB camera test APP from Linux kernel to the '''official tool''' on Linux system of the development board information download page</pli><{| class="wikitable" style="width:800px;" |-| test@test:~/li><orangepi-build$ '''cd output/ol>debs'''
<ol startdiv class="6figure" style="list-style-type: decimal;"><li>After installation, you can see the startup icon of the USB camera on the Android desktop.</li></ol>
[[File:zero2w-img338img285.png]]
</div></ol><ol start="73" style="list-style-type: decimal;"><li>Then double-click to open the USB camera APP and you can see select the output video model of the USB camera.development board</li></ol>
[[File:zero2w-img275.png]]</ol><span idol start="4" style="androidlist-style-systemtype: decimal;"><li><p>Then select the branch type of the kernel source code. Different versions of the kernel source code maintain different rootfs types.</p><ol style="list-rootstyle-descriptiontype: lower-alpha;"><li><p>In the current branch, you can see three options: debian11, ubuntu20.04, and ubuntu22.04.</p></spanli>== Android system ROOT description ==<li><p>In the next branch, you can see three options: debian11, debian12, and ubuntu22.04.</p></li>
<div class="figure">
[[File:zero2w-img336img287.png]] </div></ol></li></ol><ol start="7" style="list-style-type: decimal;"><li>If you are compiling the server version of the image, you can also choose to compile the Standard version or the Minimal version. The Minimal version will have much less pre-installed software than the Standard version ('''please do not choose the Minimal version without special needs, because many things are not pre-installed by default. Some functions may not be available''')</li>
<div class="figure">
[[File:zero2w-img339img288.png]]
</div>
</ol><ol start="28" style="list-style-type: decimal;"><li><p>Then make sure that the adb connection between If you are compiling a desktop version of the Ubuntu PC and the development board is normal. For how to use adbimage, please refer you also need to select the instructions in the section "'''How to use ADB'''"type of desktop environment.</p></li><li><p>Then use the adb command to install rootcheck.apk into the Android system. Of courseCurrently, only XFCE is maintained, you can also use a USB disk copy to install itso please select an XFCE type desktop.</p></li></ol>
[[File:zero2w-img291.png]]</ol><ol start="59" style="list-style-type: decimal;"><li>The display interface after opening <p>Then the '''ROOT test tool''' for compilation of rootfs will start. Some of the first time is information prompted during compilation are as shown belowfollows:</p><ol style="list-style-type: lower-alpha;"><li>Type of rootfs</olli>{| class="wikitable" style="width:800px;" |-| [[File:zero2w-img341o.k.png]local not found [ Creating new rootfs cache for '''bullseye''' ]|}</ol><ol start="62" style="list-style-type: decimallower-alpha;"><li>Then you can click '''CHECK NOW''' to start checking the ROOT status The storage path of the Android system. After the check is completed, the display is as follows. You can see that the Android system has obtained ROOT permissions.compiled rootfs compressed package</li></ol>{| class="wikitable" style="width:800px;" |-| [o.k. ] Target directory [File:zero2w'''orangepi-img342.png]build/external/cache/rootfs''' ]|}<span id="how-to-use-miracastreceiver-to-cast-the-mobile-phone-screen-to-the-development-board"></spanol>== How to use MiracastReceiver to cast the mobile phone screen to the development board == <ol start="3" style="list-style-type: decimallower-alpha;"><li>The name of the rootfs compressed package generated by compilation<p/li>First, please make sure that both the development board and the mobile phone are connected to the same WIFI hotspot{| class="wikitable" style="width:800px;" |-| [ o.k. For the method of connecting the development board to WIFI, please refer to ] File name [ '''the instructions in the WIbullseye-xfce-FI connection methodarm64.5250ec7002de9e81a41de169f1f89721.tar.lz4''']|}</pol></li></ol><ol start="10" style="list-style-type: decimal;"><li><p>Then open the '''MiracastReceiver'''application in the Android system of View the development boardcompiled rootfs compressed package</p><p>[[Fileol style="list-style-type:zero2wlower-img343.png]]</p></lialpha;"><li><p>The interface after '''MiracastReceiverbullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4''' It is opened a compressed package of rootfs. The meaning of each field in the name is as follows</p><div class="figure"li>
<span iddiv class="pin-interface-gpio-uart-spi-testfigure"></span>== 40pin interface GPIO, UART, SPI test ==
<span id/div></ol><ol start="pin-gpio-port3" style="list-teststyle-methodtype: decimal;"><li>Then select the model of the development board</spanli>=== 40pin GPIO port test method ===
[[File:zero2w-img351img276.png]]</ol></li></ol><ol start="5" style="list-style-type: decimal;"><li><p>If you select the next branch, you will also be prompted to select the memory size, and you do not need to select the current branch.</p><ol style="list-style-type: lower-alpha;"><li><p>If the development board you purchased has a memory size of 1.5GB, please select the first option.</p></li><li><p>If the development board you purchased has 1GB or 2GB or 4GB memory size, please choose the second option.</p><p>[[File:zero2w-img277.png]]</p></li></ol></li><li><p>Then select the type of rootfs</p></li>
[[File:zero2w-img286.png]]</ol><ol start="27" style="list-style-type: decimal;"><li><p>Then click select the type of image</p><ol style="list-style-type: lower-alpha;"><li><p>'''GPIO_TESTImage with console interface (server)''' button to open Represents the GPIO test interfaceimage of the server version, which is relatively small in size.</p></li><li><p>'''Image with desktop environment'''Represents an image with a desktop, which is relatively large in size.</olp></li>
<div class="figure">
[[File:zero2w-img354img288.png]]
</div></ol><ol start="59" style="list-style-type: decimal;"><li>There If you are compiling a total of 28 GPIO ports available in the 40-pin development board. The following takes pin 12 - corresponding to GPIO PI01 - corresponding to wPi serial number 6 - as an example to demonstrate how to set the high and low levels desktop version of the GPIO port. First click the '''CheckBox''' button corresponding to pin 12. When the button is selected, pin 12 will be set to high level. After settingimage, you can use a multimeter also need to measure select the value type of the voltage of the pindesktop environment. If it Currently, only XFCE is '''3.3v'''maintained, it means the setting High level successso please select an XFCE type desktop.</li></ol>
[[File:zero2w-img355img289.png]]
[[File:zero2w-img291.png]]</ol><ol start="710" style="list-style-type: decimal;"><li>Click Then the '''CheckBox''' button in compilation of the picture below again to uncheck it, and pin 12 linux image will be set to low levelbegin. After setting, you can use a multimeter to measure the voltage value The general process of the pin. If it is '''0v''', it means the low level setting compilation is successful.as follows</li></ol>
::o. Finally, write the bin file of u-boot into the image through the dd command.</ol><ol start="11" style="list-style-type: decimal;"><li><p>After compiling the image, the following message will be displayed</p><ol style="list-style-type: lower-alpha;"><li>The storage path of the compiled image</li>{| class="wikitable" style="width:800px;"
|-
| '''GPIO序号'''| [ o.k. ] Done building [ '''GPIOoutput/images/orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop/orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop.img''']| '''功能'''}| '''引脚'''|| '''引脚'''</ol>| '''功能'''<ol start="2" style="list-style-type: lower-alpha;">| '''GPIO'''<li>Compilation time</li>{| '''GPIO序号'''class="wikitable" style="width:800px;"
|-
|-
| [ o.k. ] Repeat Build Options [ '''264sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=image RELEASE=bullseye BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_CONFIGURE=yes''']| '''PI8'''}</ol></li></ol>| '''TWI1<span id="instructions-for-using-the-orange-pi-os-arch-SDA'''system"></span>| '''3'''|| = '''4Instructions for using the Orange Pi OS Arch system'''=| '''5V'''| style<span id="textorange-pi-os-arch-system-function-adaptation-align: left;status"|></span>== Orange Pi OS Arch system function adaptation status == {| class="wikitable" style="width:800px;text-align: leftcenter;"|
|-
| '''263Motherboard functions'''| '''PI7OPi OS Arch'''| '''TWI1-SCL'''| '''5'''|| '''6HDMI video'''| '''GNDOK'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''269HDMI Audio'''| '''PI13'''| '''PWM3'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224OK'''
|-
|-
| '''226TF Card Startup'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''12'''| style="text-align: left;"|| '''PI1'''| '''257OK'''
|-
| '''227WIFI'''| '''PH3OK'''| '''UART5_RX'''| '''13'''|| '''14'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''261Bluetooth'''| '''PI5'''| '''UART2_TX'''| '''15'''|| '''16'''| '''PWM4'''| '''PI14'''| '''270OK'''
|-
|-
| '''23140pin GPIO'''| '''PH7OK'''| '''SPI1_MOSI'''| '''19'''|| '''20'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''23240pin I2C'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''UART2_RX'''| '''PI6'''| '''262OK'''
|-
| '''23040pin SPI'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229OK'''
|-
|-
| '''26640pin PWM'''| '''PI10OK'''| '''TWI2-SDA'''| '''27'''|| '''28'''| '''TWI2-SCL'''| '''PI9Temperature Sensor'''| '''265OK'''
|-
| '''256Hardware watchdog'''| '''PI0OK'''| style="text-align: left;"|| '''29'''|| '''30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''271Mali GPU'''| '''PI15'''| <span style="text-aligncolor: left;#FF0000"|| '''31'''|| '''32'''| '''PWM1'''| '''PI11'''| '''267>NO</span>'''
|-
| '''268Video codec'''| '''PI12'''| '''PWM2'''| '''33<span style="color:#FF0000">NO</span>'''|}| '''34'''| '''GND'''{| styleclass="text-align: left;wikitable"|| style="width:800px;text-align: leftcenter;"|
|-
| '''25824pin expansion board function'''| '''PI2'''| style="text-align: left;"|| '''35'''|| '''36'''| style="text-align: left;"|| '''PC12'''| '''76OPi OS Arch'''
|-
| '''272100M network port'''| '''PI16OK'''| style="text-align: left;"| '''100M Ethernet port light'''| '''OK'''|-| '''USB2.0 HOST x 2'''| '''OK'''|-|'''Infrared reception'''| '''37OK'''|-| '''Headphone audio playback'''| '''38OK'''| style="text-align: left;"|'''On/off button'''| '''OK'''| -| '''LRADC''' '''PI4Custom buttons x 2'''| '''260OK'''
|-
|}
<ol startspan id="2" style="listorange-pi-os-arch-system-user-styleguide-type: decimal;instructions"><li>The device node corresponding to uart2 is '''/dev/ttyAS2''', and the device node corresponding to uart5 is'''/dev/ttyAS5'''</li></olspan>
</div></li><li><p>Then select the area</p><div class="figure"> [[File:zero2w-img362img296.png]] </div></li><li><p>Then select the keyboard model</p><div class="figure"> [[File:zero2w-img297.png]] </div></li><li><p>Then create a new username and set a password</p><div class="figure"> [[File:zero2w-img298.png]] </div></li><li><p>Then make sure there is no problem with the selection, and then click the install '''button'''</p><div class="figure"> [[File:zero2w-img299.png]] </div></li><li><p>Then wait for the installation to complete</p><div class="figure"> [[File:zero2w-img300.png]] </div></li><li><p>After the installation is complete, you need to click the '''Finish''' button to restart the system.</p><div class="figure">
<ol startspan id="10" style="listhow-to-set-styledt-type: decimal;overlays"><li>If everything is normal, the received string will be displayed in the receiving box</li></olspan>== How to set DT overlays ==
# As can be seen from First open the table below, the spi available for the 40pin interface is spi1, and there are two chip select pins cs0 and cs1'''/boot/extlinux/extlinux.conf''' configuration file
::{| class="wikitable" style="width:800px;"
|-
| [orangepi@orangepi-pc ~]$ '''GPIO serial numbersudo vim /boot/extlinux/extlinux.conf'''| } <ol start="2" style="list-style-type: decimal;"><li>Then open the corresponding configuration by adding '''GPIOFDTOVERLAYS'''| '''Function/dtbs/allwinner/overlay/xxx.dtbo'''| in '''pin/boot/extlinux/extlinux.conf'''</li> {|class="wikitable" style="background-color:#ffffdc;width:800px;" | '''pin'''-| <big>'''FunctionNote that xxx.dtbo in FDTOVERLAYS /dtbs/allwinner/overlay/xxx.dtbo needs to be replaced with the specific dtbo configuration, please do not copy it.'''</big>| '''GPIO'''}{| '''GPIO serial number'''class="wikitable" style="width:800px;"
|-
|-
| '''264'''| <p>'''PI8/boot/dtbs/allwinner/overlay/'''</p>| '''TWI1-SDA'''}| '''3'''</li>|<li><p>The DT overlays configuration that can be used by the development board is as follows</p></li>| '''4'''| '''5V'''{| styleclass="text-align: left;wikitable"|| style="width:800px;text-align: leftcenter;"|
|-
| '''263Functions on the development board'''| '''PI7Corresponding DT overlays configuration'''| '''TWI1-SCL'''| '''5'''|| '''6'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''26940pin - i2c0'''| '''PI13'''| '''PWM3'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224sun50i-h616-pi-i2c0.dtbo'''
|-
|-
| '''22640pin - i2c2'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''12'''| style="textsun50i-h616-pi-align: left;"|| '''PI1'''| '''257i2c2.dtbo'''
|-
| '''22740pin - uart2'''| '''PH3'''| '''UART5_RX'''| '''13'''|| '''14''sun50i-h616-pi-uart2.dtbo'| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''26140pin - uart3'''| '''PI5'''| '''UART2_TX'''| '''15'''|| '''16'''| '''PWM4'''| '''PI14'''| '''270sun50i-h616-pi-uart3.dtbo'''
|-
|-
| '''23140pin - uart5'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|| '''20''sun50i-h616-ph-uart5.dtbo'| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''23240pin - pwm1'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''UART2_RX'''| '''PI6'''| '''262sun50i-h616-pi-pwm1.dtbo'''
|-
| '''23040pin - pwm2'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229sun50i-h616-pi-pwm2.dtbo'''
|-
|-
| '''26640pin - pwm4'''| '''PI10'''| '''TWI2sun50i-h616-SDA'''| '''27'''|| '''28'''| '''TWI2pi-SCL'''| '''PI9'''| '''265pwm4.dtbo'''
|-
| '''25640pin - spi1 cs0'''| '''PI0'''| style="textsun50i-h616-spi1-cs0-align: left;"|| '''29'spidev.dtbo''|| '''30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''27140pin - spi1 cs1'''| '''PI15sun50i-h616-spi1-cs1-spidev.dtbo'''| style="text-align: left;"|| '''3140pin - spi1 cs0 cs1'''|| '''32sun50i-h616-spi1-cs0-cs1-spidev.dtbo'''| '''PWM1'''-| '''PI11设Set USB0 to Host mode'''| '''267sun50i-h616-usb0-host.dtbo'''
|-
| '''268Turn off the green LED light'''| '''PI12'''| '''PWM2'''| '''33'''|| '''34''sun50i-h616-zero2w-disable-led.dtbo'| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''258How to close the UART0 debugging serial port'''| '''PI2'''| style="textsun50i-h616-align: left;"|| '''35'''|| '''36'''| style="textdisable-align: left;"|| '''PC12'''| '''76uart0.dtbo'''
|}
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>If you need to open multiple configurations at the same time, just add the paths of multiple configurations directly after '''FDTOVERLAYS.''' For example, the configuration of opening i2c1 and uart5 at the same time is as follows</li>
{| class="wikitable" style="width:800px;"
|-
|
[orangepi@orangepi-pc ~]$ '''sudo vim /boot/extlinux/extlinux.conf'''
'''FDTOVERLAYS <span style="color:#FF0000">/dtbs/allwinner/overlay/sun50i-h616-pi-i2c1.dtbo /dtbs/allwinner/overlay/sun50i-h616-ph-uart5.dtbo</span>'''|}</ol><ol start="36" style="list-style-type: decimal;"><li>Here is a demonstration After setting, you need to test restart the SPI1 interface through system for the configuration to take effect.</li>{| class="wikitable" style="width:800px;" |-| [orangepi@orangepi-pc ~]$ '''w25qxxsudo reboot''' module. First, connect the w25qxx module to the SPI1 interface.|}</liol><span id="how-to-install-software"></olspan>
{| class="wikitable" style="width:800px;" |-| [[File:zero2worangepi@orangepi-img351.png]pc ~]$ '''sudo pacman -Syy vim'''|}
<ol startspan id="5" style="listandroid-12-tv-system-styleusage-type: decimal;instructions"><li>Then click the '''SPI_TEST''' button to open the SPI test interface</li></olspan>
<ol startspan id="6" style="listsupported-styleandroid-type: decimal;versions"><li><p>Then select the spi device node in the upper left corner. If you test the onboard SPIFlash directly, just keep the default '''/dev/spidev0.0'''. If the '''w25qxx''' module is connected to the 40pin spi1 cs0, then please select'''/dev/spidev1.0''', if the w25qxx module is connected to the 40pin spi1 cs1, then please select '''/dev/spidev1.1'''</pspan><div class="figure">= Supported Android versions ==
</divspan id="android-12-tv-function-adaptation-status"></lispan><li><p>Then click the '''OPEN''' button to initialize the SPI</p></li></ol>== Android 12 TV function adaptation status ==
|-
| '''GPIO serial numberHDMI video'''| '''GPIO'''| '''Function'''| '''pin'''|| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO serial numberOK'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''1'''|| '''2HDMI Audio'''| '''5VOK'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''264'''| '''PI8'''| '''TWI1Type-SDA'''| '''3C USB2.0 x 2'''|| '''4OK'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''263TF card startup'''| '''PI7OK'''| '''TWI1-SCL'''| '''5'''|| '''6'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''269WIFI'''| '''PI13'''| '''PWM3'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224OK'''
|-
|-
| '''226USB Camera'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''12'''| style="text-align: left;"|| '''PI1'''| '''257OK'''
|-
| '''227LED Light'''| '''PH3OK'''| '''UART5_RX'''-| '''1340pin GPIO'''|| '''14'OK''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''26140pin I2C'''| '''PI5'''| '''UART2_TX'''| '''15'''|| '''16'''| '''PWM4'''| '''PI14'''| '''270OK'''
|-
|-
| '''23140pin UART'''| '''PH7OK'''| '''SPI1_MOSI'''| '''19'''|| '''20'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''23240pin PWM'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''UART2_RX'''| '''PI6'''| '''262OK'''
|-
| '''230Temperature Sensor'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229OK'''
|-
|-
| '''266Mali GPU'''| '''PI10'''| '''TWI2-SDA'''| '''27'''|| '''28'''| '''TWI2-SCL'''| '''PI9'''| '''265OK'''
|-
| '''256Video codec'''| '''PI0OK'''| style="text-align: left;"|| '''29'''}|{| '''30'''| '''GND'''| styleclass="text-align: left;wikitable"|| style="width:800px;text-align: leftcenter;"|
|-
| '''27124pin Expansion board function'''| '''PI15'''| style="text-align: left;"|| '''31'''|| '''32'''| '''PWM1'''| '''PI11'''| '''267Android12 TV'''
|-
| '''268100M network port'''| '''PI12OK'''| '''PWM2'''| '''33'''|| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''258100M Ethernet port light'''| '''PI2OK'''| style="text-align: left;"|'''USB2.0 HOST x 2'''| '''35OK'''|-| '''36Infrared reception'''| '''OK'''| style="text-align: left;"|'''Headphone audio playback'''| '''OK'''|-| '''PC12On/off button'''| '''76OK'''
|-
| '''272LRADC'''| '''PI16'''| style="text-align: left;"|| '''37'''|| '''38'''| style="text-align: left;"|| '''PI4Custom buttons x 2'''| '''260OK, The default setting is the volume up and down keys.'''
|-
|}
<ol startspan id="2" style="listonboard-styleled-type: decimal;"><li>The device node corresponding to i2c1 is '''/dev/i2clight-1''', and the device node corresponding to i2c2 is '''/dev/i2cdisplay-2'''</liinstructions"></olspan>== Onboard LED light display instructions ==
<ol startspan id="5" style="listuse-network-connection-styleadb-type: decimal;debugging"><li>The i2c test interface of wiringOP is shown in the figure below</li></olspan>=== Use network connection adb debugging ===
apollo-p2:/ # '''start adbd'''|}</ol><span idol start="3" style="pinlist-pwmstyle-testtype: decimal;"><li>Install adb tool on Ubuntu PC</spanli>{| class="wikitable" style== 40pin PWM test ==="width:800px;" |-| # As can be seen from the table below, the available pwm are pwm1, pwm2, pwm3 and pwm4.test@test:~$ '''sudo apt-get update'''
test@test:~$ '''sudo apt-get install -y adb'''|}</ol><ol start="4" style="list-style-type: decimal;"><li>Then connect network adb on Ubuntu PC</li>{| class="wikitable" style="width:800px;"
|-
| test@test:~$ '''GPIO serial numberadb connect 192.168.1.xxx:5555'''| '''GPIO(Need to be modified to the IP address of the development board)'''| <p>* daemon not running; starting now at tcp:5037</p> <p>* daemon started successfully</p> connected to 192.168.1.xxx:5555 test@test:~$ '''Functionadb devices'''| '''pin'''List of devices attached 192.168.1.xxx:5555 device|}| '''pin'''</ol>| '''Function'''<ol start="5" style="list-style-type: decimal;">| '''GPIO'''<li>Then you can log in to the android system through adb shell on Ubuntu PC</li>{| '''GPIO serial number'''class="wikitable" style="width:800px;"
|-
| style="texttest@test:~$ '''adb shell''' apollo-alignp2: left;"/ #|}| style</ol><span id="textuse-data-cable-to-connect-align: left;adb-debugging"|></span> === Use data cable to connect adb debugging === | # Prepare a USB Type C interface data cable, plug one end of the USB interface into the USB interface of the computer, and plug one end of the USB Type C interface into the USB0 interface of the development board (see the description of the picture on the right below for the location of USB0). In this case, the development board is powered by the computer's USB interface, so please ensure that the computer''3s USB interface can provide the most sufficient power to drive the development board.3V'''| '''1'''|::[[File:zero2w-img304.png]] [[File:zero2w-img305.png]] | '''<ol start="2'''| '''5V'''| " style="textlist-style-aligntype: leftdecimal;"|><li>Install adb tool on Ubuntu PC</li>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| test@test:~$ '''264sudo apt-get update'''| '''PI8'''| test@test:~$ '''TWI1sudo apt-get install -SDAy adb'''| '''3'''}|</ol>| '''4'''| '''5V'''| <ol start="3" style="textlist-style-aligntype: leftdecimal;"|><li>Check whether the ADB device is recognized</li>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| test@test:~$ '''263adb devices'''| '''PI7'''| '''TWI1-SCL'''List of devices attached| '''5'''|4c00146473c28651dd0 device| '''6'''}| '''GND'''</ol>| <ol start="4" style="textlist-style-aligntype: leftdecimal;"|><li>Then you can log in to the android system through adb shell on Ubuntu PC</li>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| test@test:~$ '''269adb shell''' apollo-p2:/ $| }</ol><span id="view-how-to-set-hdmi-display-resolution"></span> == View how to set HDMI display resolution == <ol style="list-style-type: decimal;"><li><p>Enter first '''PI13Settings'''</p><p>[[File:zero2w-img306.png]]</p></li>| <li><p>Then select '''PWM3Device Preferences'''</p>| <p>[[File:zero2w-img307.png]]</p></li><li><p>Then select '''7Display & Sound'''</p>|<p>[[File:zero2w-img308.png]]</p></li>| <li><p>Then select '''8Advanced display settings'''</p>| <p>[[File:zero2w-img309.png]]</p></li><li><p>Then select '''UART0_TXHDMI output mode'''</p>| '''PH0'''<p>[[File:zero2w-img310.png]]</p></li><li><p>Then you can see the list of resolutions supported by the monitor. At this time, clicking the corresponding option will switch to the corresponding resolution. Please note that different monitors may support different resolutions. If you connect it to a TV, you will generally see more resolution options than the picture below.</p><p>[[File:zero2w-img311.png]]</p></li><li><p>The HDMI output of the development board supports 4K display. When connected to a 4K TV, you can see the 4K resolution option.</p><p>[[File:zero2w-img312.png]]</p></li></ol> <span id="hdmi-to-vga-display-test-1"></span>=== HDMI to VGA display test === <ol style="list-style-type: decimal;"><li><p>First you need to prepare the following accessories</p><ol style="list-style-type: lower-alpha;"><li>HDMI to VGA converter</li>| '''224'''|[[File:zero2w-img144.png]]| </ol><ol start="2" style="textlist-alignstyle-type: leftlower-alpha;"|><li>A VGA cable and a Mini HDMI male to HDMI female adapter</li> [[File:zero2w-img145.png]] [[File:zero2w-img146.png]]</ol>| <ol start="3" style="textlist-style-aligntype: leftlower-alpha;"|><li>A monitor or TV that supports VGA interface</li></ol></li></ol>| '''GND'''| '''9'''<ol start="2" style="list-style-type: decimal;">|<li>HDMI to VGA display test is as follows</li>| '''10'''| '''UART0_RX'''[[File:zero2w-img313.png]]| '''PH1'''{| '''225'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| '''226'''| <big>'''PH2When using HDMI to VGA display, the development board and the Android system of the development board do not need to make any settings. You only need the Mini HDMI interface of the development board to display normally. So if there is a problem with the test, please check whether there is a problem with the HDMI to VGA converter, VGA cable and monitor.'''</big>| '''UART5_TX'''}| '''11'''</ol>|| '''12'''| style<span id="textwi-fi-connection-align: left;method"|| '''PI1'''></span>| '''257'''|== WI-FI connection method ==| '''227'''| # Choose first '''PH3Settings'''| '''UART5_RX'''| '''13'''::[[File:zero2w-img306.png]]|| '''14'''| '''GND'''| style<ol start="text-align: left;2"|| style="textlist-style-aligntype: leftdecimal;"||->| <li>Then select '''261'''| '''PI5Network & Internet'''</li>| '''UART2_TX'''| '''15'''[[File:zero2w-img314.png]]|</ol>| '''16'''<ol start="3" style="list-style-type: decimal;">| '''PWM4'''<li>Then turn on WI-FI</li>| '''PI14'''| '''270'''[[File:zero2w-img315.png]]|-</ol>| style<ol start="text-align: left;4"|| style="textlist-style-aligntype: leftdecimal;"|>| <li>After turning on WI-FI, you can see the searched signals under '''3.3VAvailable networks'''.</li>| '''17'''|[[File:zero2w-img316.png]]| '''18'''</ol>| <ol start="5" style="textlist-style-aligntype: leftdecimal;"|| '''PH4'''| '''228'''>|<li>After selecting the WI-FI you want to connect to, the password input interface shown below will pop up.</li>| '''231'''| '''PH7'''<div class="figure">| '''SPI1_MOSI'''| '''19'''[[File:zero2w-img317.png]]|| '''20'''</div></ol>| '''GND'''| <ol start="6" style="textlist-style-aligntype: leftdecimal;"|><li>Then use the keyboard to enter the password corresponding to the WI-FI, and then use the mouse to click the Enter button on the virtual keyboard to start connecting to the WI-FI.</li> <div class="figure"> [[File:zero2w-img318.png]] </div></ol>| <ol start="7" style="textlist-style-aligntype: leftdecimal;"|>|<li>The display after successful WI-FI connection is as shown below</li>| '''232'''| '''PH8'''[[File:zero2w-img319.png]]| '''SPI1_MISO'''</ol>| '''21'''<span id="how-to-use-wi-fi-hotspot"></span>|| '''22'''| '''UART2_RX'''| '''PI6'''| '''262'''|== How to use WI-FI hotspot ==| '''230'''| '''PH6'''# First, please make sure that the Ethernet port is connected to the network cable and can access the Internet normally.| # Then select '''SPI1_CLKSettings'''| '''23'''|::[[File:zero2w-img306.png]]| '''24'''| '''SPI1_CS0'''<ol start="3" style="list-style-type: decimal;">| <li>Then select '''PH5Network & Internet'''</li>| '''229'''|[[File:zero2w-img314.png]]</ol>| style<ol start="text-align: left;4"|| style="textlist-alignstyle-type: leftdecimal;"|>| <li>Then select '''GNDWIFI hotspot'''</li>| '''25'''|[[File:zero2w-img320.png]]| '''26'''</ol>| '''SPI1_CS1'''<ol start="5" style="list-style-type: decimal;">| <li>Then open '''PH9Hotspot Enable'''. You can also see the name and password of the generated hotspot in the picture below. Remember them and use them when connecting to the hotspot (if you need to modify the name and password of the hotspot, you need to close Hotspot Enable first. Then you can modify it)</li>| '''233'''|[[File:zero2w-img321.png]]| '''266'''| '''PI10'''</ol>| '''TWI2<ol start="6" style="list-style-SDA'''type: decimal;">| <li>At this time, you can take out your mobile phone. If everything is normal, you can find the WIFI hotspot with the same name ('''27here AndroidAP_7132'''|| '''28) shown under the '''| Hotspot name'''TWI2in the picture above in the WI-SCLFI list searched by the mobile phone. Then you can click AndroidAP_7132 to connect to the hotspot. The password can be seen under the '''| '''PI9Hotspot password'''in the picture above.</li>| '''265'''|[[File:zero2w-img322.png]]| '''256'''| '''PI0'''</ol>| <ol start="7" style="textlist-style-aligntype: leftdecimal;"|>| <li>After the connection is successful, it will be displayed as shown below (the interface will be different on different mobile phones, the specific interface is subject to the one displayed on your mobile phone). At this time, you can open a web page on your mobile phone to see if you can access the Internet. If the web page can be opened normally, it means that the '''29WI-FI Hotspot'''of the development board can be used normally.</li>|| '''30'''[[File:zero2w-img323.png]]| '''GND'''</ol>| style<span id="texthow-to-check-the-ip-address-of-the-ethernet-align: left;port"|></span> | style="text-align= How to check the IP address of the Ethernet port == # There is no wired network interface on the main board of the development board. We can expand the 100M Ethernet through a 24pin expansion board. ::[[File: left;"||zero2w-img107.png]]| '''271'''| '''PI15'''| <ol start="2" style="textlist-style-aligntype: leftdecimal;"|><li><p>Then make sure the network port of the expansion board is connected to the router or switch</p></li>| <li><p>Then open '''31Settings'''</p>|<p>[[File:zero2w-img324.png]]</p></li>| <li><p>Then select '''32Network & Internet'''</p><p>[[File:zero2w-img325.png]]</p></li>| '''PWM1''<li><p>Then you can see the IP address of the development board's wired network port at the location shown in the picture below.</p>| '''PI11'''<p>[[File:zero2w-img326.png]]</p></li></ol>| '''267'''|<span id="bluetooth-connection-method"></span>| '''268'''| '''PI12'''== Bluetooth connection method ==| '''PWM2'''| # Choose first '''33Settings'''|| '''34'''::[[File:zero2w-img306.png]]| '''GND'''| style<ol start="text-align: left;2"|| style="textlist-style-aligntype: leftdecimal;"||->| <li>Then select '''258Bluetooth'''</li>| '''PI2'''| [[File:zero2w-img327.png]]</ol><ol start="3" style="textlist-style-aligntype: leftdecimal;"|>| <li>Then Open '''35Bluetooth Enable'''</li> |[[File:zero2w-img328.png]]| '''36'''</ol>| <ol start="4" style="textlist-alignstyle-type: leftdecimal;"|>| <li>Then click '''PC12Pair new device'''to start scanning for surrounding Bluetooth devices</li>| '''76'''|[[File:zero2w-img329.png]]| '''272'''</ol>| '''PI16'''| style<ol start="text-align: left;5"|| '''37'''|| '''38'''| style="textlist-style-aligntype: leftdecimal;"|>| <li>The searched Bluetooth devices will be displayed under '''PI4Available devices'''</li>| '''260'''|[[File:zero2w-img330.png]]| style</ol><ol start="text-align: left;6"|| style="textlist-style-aligntype: leftdecimal;"|>| <li>Then click on the Bluetooth device you want to connect to start pairing. When the following interface pops up, please use the mouse to select the '''GNDPair'''option</li>| '''39'''|[[File:zero2w-img331.png]]| '''40'''</ol>| <ol start="7" style="textlist-style-aligntype: leftdecimal;"|>| '''PI3'''| '''259'''|}<li>What is tested here is the Bluetooth configuration process between the development board and the Android phone. At this time, the following confirmation interface will pop up on the phone. Click the pairing button on the phone to start the pairing process.</li>
[[File:zero2w-img332.png]]</ol><ol start="28" style="list-style-type: decimal;"><li>First click After pairing is completed, open '''Paired devices''' and you will see the wiringOP icon to open wiringOP APPpaired Bluetooth devices.</li></ol>
[[File:zero2w-img351img333.png]]</ol><ol start="9" style="list-style-type: decimal;"><li>At this time, you can use the Bluetooth of your mobile phone to send a picture to the development board. After sending, you can see the following confirmation interface in the Android system of the development board, and then click '''Accept''' to start receiving the pictures sent by the mobile phone.</li>
[[File:zero2w-img334.png]]</ol><ol start="310" style="list-style-type: decimal;"><li>Then click Pictures received by the Bluetooth system of the development board Android system can be viewed in '''PWM_TESTReceived files''' button on the main interface of wiringOP to enter the PWM test interface.</li></ol>
[[File:zero2w-img380img335.png]]</ol><span id="how-to-set-usb0-to-host-mode-1"></span>
[[File:zero2w-img381img160.png]]
<ol start="6" style="list-style-type: decimallower-alpha;"><li>Then you can Run the following command to set the PWM period. The default configuration is USB0 to HOST mode:</li>{| class="wikitable" style="width:800px;" |-| apollo-p2:/ # '''50000ns'''. The converted PWM frequency is ''cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_host'20KHz'''</li></ol>
apollo-p2:/ #|}</ol><ol start="72" style="list-style-type: decimallower-alpha;"><li>Then click Run the following command to switch back to Device mode</li>{| class="wikitable" style="width:800px;" |-| apollo-p2:/ # '''EXPORTcat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_device'''button to export PWM</li></ol>
apollo-p2:/ #|}</ol><ol start="83" style="list-style-type: decimallower-alpha;"><li>Then drag the progress bar below The command to change view the PWM duty cycle, and then check current mode of USB0 is</li>{| class="wikitable" style="width:800px;" |-| apollo-p2:/ # '''Enablecat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/otg_role''' to output the PWM waveform.</li></ol>
<span idol start="download-the3" style="list-sourcestyle-code-of-android-12type: decimal;"><li><p>Then make sure that the adb connection between the Ubuntu PC and the development board is normal. For how to use adb, please refer to the instructions in the section "[[Orange Pi Zero 2W#How to use ADB|'''How to use ADB''']]".</spanp></li>== <li><p>Download the source code of Android 12 ==USB camera test APP from the '''official tool''' on the development board information download page</p></li>
<ol stylediv class="list-style-type: decimal;figure"><li><p>First download the compressed package of the Android 12 source code and the compressed package of the files modified by Orange Pi Zero2w from Google Cloud Drive</p><ol style="list-style-type: lower-alpha;"><li>Google Cloud Drive</li></ol></li></ol>
[[File:zero2w-img387img336.png]] </div><div class="figure">
</div></ol><ol start="5" style="list-style-type: decimal;"><li>Then use the adb command to install the USB camera test APP into the Android system. Of course, you can also use a USB disk copy to install it.</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''md5sum -c H618-Android12-Src.tar.gzadb install usbcamera.md5sumapk'''|}</ol><ol start="6" style="list-style-type: decimal;"><li>After installation, you can see the startup icon of the USB camera on the Android desktop.</li>
</div><ol start="2" style="list-style-type: decimal;"><li><p>Then make sure that the adb connection between the Ubuntu PC and the development board is normal. For how to use adb, please refer to the instructions in the section "[[Orange Pi Zero 2W#How to use ADB|'''opizero2w_android12_patchesHow to use ADB''' opizero2w_android12_patches]]".</p></li><li><p>Then use the adb command to install rootcheck.apk into the Android system. Of course, you can also use a USB disk copy to install it.tar</p></li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''adb install rootcheck.apk'''|}</ol><ol start="4" style="list-style-type: decimal;"><li>After installation, you can see the startup icon of the ROOT test tool on the Android desktop.gz</li>
[[File:zero2w-img340.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>Then copy The display interface after opening the files modified by Orange Pi Zero2w to '''ROOT test tool''' for the Android source codefirst time is as shown below</li></ol>
[[File:zero2w-img342.png]]</ol><span id="compilehow-to-use-miracastreceiver-to-cast-the-sourcemobile-codephone-ofscreen-androidto-12the-development-board"></span>== Compile the source code of Android 12 ==
Opios-arch-aarch64-xfce-opizero2w-23.09-linux6.1.31.img.xz