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;"
<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>First run '''orangepi-config'''. Ordinary users remember to add > '''sudo''' permissions.</p>
{| class="wikitable" style="width:800px;"
|-
<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 below, and then use the '''space''' to select the > dtbo configuration of the SPI you want to open.</p></li>
{| class="wikitable" style="width:800px;text-align: center;"
<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>
=== 40pin GPIO port test ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''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.'''</big>
[[File:zero2w-img170.png|center]]|}
<ol style="list-style-type: decimal;">
<li><p>The steps for testing directly with commands are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<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>{| class="wikitable" style="width:800px;" |-|
<p>root@orangepi:~/wiringOP-Python# '''python3 -c "import wiringpi; \'''</p>
<p>'''from wiringpi import GPIO; wiringpi.wiringPiSetup() ; \'''</p>
<p>'''wiringpi.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>root@orangepi:~/wiringOP-Python# '''python3 -c "import wiringpi; \'''</p>
<p>'''from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\'''</p>
<p>'''wiringpi.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>root@orangepi:~/wiringOP-Python# '''python3 -c "import wiringpi; \'''</p>
<p>'''from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\'''</p>
<p>'''wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.HIGH</span>)"'''</p>|}</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;">
<li><p>First use the python3 command to enter the command line mode of > python3</p>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~# '''python3'''</p>|}</li>
<li><p>Then import the python module of wiringpi</p>
{| class="wikitable" style="width:800px;"
|-
|
<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>{| class="wikitable" style="width:800px;" |-|
<p>>>> '''wiringpi.wiringPiSetup()'''</p>
<p>0</p>
<p>>>> '''wiringpi.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>>>> '''wiringpi.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>>>> '''wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.HIGH</span>)'''</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>
{| class="wikitable" style="width:800px;"
|-
|
<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
<div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO NO.'''
| '''Function'''
| '''Pin'''
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-
| '''264'''
| '''TWI1-SDA'''
| '''3'''
|-
| '''263'''
| '''TWI1-SCL'''
| '''5'''
|-
| '''269'''
| '''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'''
| '''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'''
|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''40Pin'''| '''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;"|
|-
| '''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.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;"|
|-
| '''26422'''| '''PI8TWI0_SDA/UART2_RX'''| '''TWI1PI6'''| '''262'''|-| '''<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>'''|-| '''<span style="color:#FF0000">26</span>'''| '''<span style="color:#FF0000">SPI1_CS1</span>'''| '''<span style="color:#FF0000">PH9</span>'''| '''<span style="color:#FF0000">233</span>'''|-| '''28'''| '''TWI2-SDASCL/UART3_TX'''| '''3PI9'''|'''265'''|-| '''430'''| '''5VGND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26332'''| '''PI7PWM1'''| '''TWI1-SCLPI11'''| '''5267'''|-| '''634'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26936'''| '''PI13'''| '''PWM3/UART4_TX'''style="text-align: left;"| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0PC12'''| '''22476'''
|-
| '''38'''
| style="text-align: left;"|
|-
| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''1240'''
| style="text-align: left;"|
| '''PI1PI3'''| '''257259'''|}</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>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 below, and then use the '''space''' to select the dtbo configuration of the SPI you want to open.</p></li> {| class="wikitable" style="width:800px;text-align: center;"
|-
| '''227dtbo configuration'''| '''PH3illustrate'''| '''UART5_RX'''| '''13'''|| '''14'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''261spi1-cs0-cs1-spidev'''| '''PI5'''| '''TWI0_SCL/UART2_TX'''| '''15'''|| '''16'''| '''PWM4/UART4_RX'''| '''PI14'''| '''270Open cs0 and cs1 of spi1 at the same time'''
|-
|-
| '''231spi1-cs1-spidev'''| '''PH7Only open cs1 of spi1'''| }</ol><ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select '''SPI1_MOSI<Save>'''to save</p><p>[[File:zero2w-img83.png]]</p></li>| <li><p>Then select '''19<Back>'''</p>|<p>[[File:zero2w-img84.png]]</p></li>| <li><p>Then select '''20<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>Then check whether there is a '''GNDspidev1.x'''device node in the Linux system. If it exists, it means that the SPI1 configuration has taken effect.</p>{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| '''232'''| <p>orangepi@orangepi:~$ '''PH8ls /dev/spidev1*'''</p>| '''SPI1_MISO'''| '''21'''|| '''22'''| '''TWI0_SDA<p>/dev/spidev1.0 /dev/spidev1.1</UART2_RX'''p>| '''PI6'''}{| '''262'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big><p>'''230Note that only when you open spi1-cs0-cs1-spidev, you will see the device nodes of the two spi.'''</p></big>| }</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''PH6': 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>{| class="wikitable" style="width:800px;" | -| <p>root@orangepi:~/wiringOP-Python# '''SPI1_CLKcd examples'''</p> 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 '''23<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 |......@.......…| 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 |.............….||}</li></ol><ol start="6" style="list-style-type: decimal;"><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>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p> 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 '''<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 |......@.......…| 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 |......@.......…||}</li></ol><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 <div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''24GPIO NO.'''| '''SPI1_CS0GPIO'''| '''PH5Function'''| '''229Pin'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND3.3V'''| '''25'''|| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''2331'''
|-
| '''266<span style="color:#FF0000">264</span>'''| '''PI10<span style="color:#FF0000">PI8</span>'''| '''TWI2<span style="color:#FF0000">TWI1-SDA</UART3_RXspan>'''| '''27<span style="color:#FF0000">3</span>'''|-| '''<span style="color:#FF0000">263</span>'''| '''28<span style="color:#FF0000">v</span>'''| '''TWI2<span style="color:#FF0000">TWI1-SCL</UART3_TXspan>'''| '''PI9<span style="color:#FF0000">5</span>'''|-| '''269'''| '''PI13'''| '''PWM3/UART4_TX'''| '''2657'''
|-
| style="text-align: left;"|
| '''29'''style="text-align: left;"|| '''30'''
| '''GND'''
| style="text'''9'''|-align: left;"| '''226'''| '''PH2'''| '''UART5_TX'''|'''11'''| style="text-align: left;"| '''227'''| '''PH3'''| '''UART5_RX'''|'''13'''
|-
| '''271<span style="color:#FF0000">261</span>'''| '''PI15'''| <span style="text-aligncolor: left;#FF0000"|| '''31>PI5</span>'''|| '''32<span style="color:#FF0000">TWI0_SCL</span>/UART2_TX'''| '''PWM1'''| '''PI11'''| '''267<span style="color:#FF0000">15</span>'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|-
| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|-| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|-| style="text-align: left;"|| 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</span>'''|-| '''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'''
| style="text-align: left;"|
| '''37'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|}
|-
| '''Multiplexing function in 40pin10'''| '''Corresponding dtbo configurationUART0_RX'''| '''PH1'''| '''225'''
|-
| '''40pin 12'''| style="text- i2c0align: left;"|| '''PI1'''| '''pi-i2c0257'''
|-
| '''40pin - i2c114'''| '''pi-i2c1GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - i2c216'''| '''pi-i2c2PWM4/UART4_RX'''|} [[File:zero2w-img173.png]] <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 class="mark"><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> <!-- --><ol start="3" style="list-style-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><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 start="3" style="list-style-type: lower-alpha;"><li><p>'''First run the following command to check the corresponding relationship of i2cPI14'''</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/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>'''In the above output270'''</p></li></ol> <!-- --><ol start="4" style="list-style-type: lower-alpha;"><li><p>002000 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></ol> <!-- --><ol start="4" style="list-style-type: decimal;"><li><p>Then start testing i2c, first install i2c-tools</p><p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo''' '''apt-get install -y i2c-tools'''</p></li><li><p>Then connect an i2c device to the i2c pin of the 40pin connector. Here we take the DS1307 RTC module as an example.</p><p>[[File:zero2w-img178.png]]</p></li><li><p>Then use the '''i2cdetect -y x'''command. If the address of the connected i2c device can be detected, it means that the i2c device is connected correctly.</p><p>'''Note 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></li></ol> [[File:zero2w-img179.png]] <ol start="7" style="list-style-type: decimal;"><li><p>Then you can run the '''ds1307.py''' test program in '''examples''' to read the RTC time</p><p>'''Note that the x in i2c-x in the following command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p><p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p><p>root@orangepi:~/wiringOP-Python/examples# '''python3 ds1307.py --device \'''</p><p>'''"/dev/i2c-x"'''</p><p>Thu 2022-06-16 04:35:46</p><p>Thu 2022-06-16 04:35:47</p><p>Thu 2022-06-16 04:35:48</p><p>^C</p><p>exit</p></li></ol> <span id="pin-uart-test-1"></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"
|-
| '''GPIO NO.18'''| '''GPIO'''| '''Function'''style="text-align: left;"| '''Pin'''|| '''Pin'''| '''Function'''| '''GPIOPH4'''| '''GPIO NO.228'''
|-
| '''20'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-| '''<span style="color:#FF0000">22</span>'''| '''<span style="color:#FF0000">TWI0_SDA</span>/UART2_RX'''| '''<span style="color:#FF0000">PI6</span>'''| '''<span style="color:#FF0000">262</span>'''|-| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''<span style="color:#FF0000">28</span>'''| '''<span style="color:#FF0000">TWI2-SCL</span>/UART3_TX'''| '''3.3V<span style="color:#FF0000">PI9</span>'''| '''1<span style="color:#FF0000">265</span>'''|-| '''230'''| '''5VGND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26432'''| '''PI8PWM1'''| '''TWI1-SDAPI11'''| '''3267'''|| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|| '''634'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26936'''| '''PI13'''| '''PWM3/UART4_TX'''style="text-align: left;"| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0PC12'''| '''22476'''
|-
| '''38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| '''40'''
| style="text-align: left;"|
| '''GNDPI3'''| '''9259'''|}</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:~$ '''10sudo orangepi-config'''</p>| }</li><li><p>Then select '''UART0_RXSystem'''</p><p>[[File:zero2w-img80.png]]</p></li>| <li><p>Then select '''PH1Hardware'''</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 '''225space'''to select the corresponding i2c configuration in the picture below.</p></li> {| class="wikitable" style="width:800px;text-align: center;"
|-
| '''226Multiplexing function in 40pin'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''12'''| style="text-align: left;"|| '''PI1'''| '''257Corresponding dtbo configuration'''
|-
| '''22740pin - i2c0'''| '''PH3'''| '''UART5_RX'''| '''13'''|| '''14'''| '''GNDpi-i2c0'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''26140pin - i2c1'''| '''PI5'''| '''TWI0_SCL/UART2_TX'''| '''15'''|| '''16'''| '''PWM4/UART4_RX'''| '''PI14'''| '''270pi-i2c1'''
|-
| '''40pin - i2c2'''| '''pi-i2c2'''|} [[File:zero2w-img173.png]]</ol><ol start="5" style="textlist-style-aligntype: leftlower-alpha;"|>| style<li><p>Then select <span class="textmark"><Save></span> to save</p><p>[[File:zero2w-alignimg83.png]]</p></li><li><p>Then select <span class="mark"><Back></span></p><p>[[File: leftzero2w-img84.png]]</p></li><li><p>Then select <span class="mark"><"|Reboot></span> to restart the system to make the configuration take effect.</p>| '''3<p>[[File:zero2w-img85.3V'''png]]</p></li></ol>| '''17'''</li></ol>|<!-- -->| '''18'''| <ol start="3" style="textlist-style-aligntype: leftdecimal;"|>| '''PH4'''<li><p>After starting the Linux system, first confirm that there is an open i2c device node under <span class="mark">/dev</span></p>{| '''228'''class="wikitable" style="width:800px;"
|-
| '''231'''| <p>orangepi@orangepi:~$ '''PH7ls /dev/i2c-*'''</p>| <p>'''SPI1_MOSI/dev/i2c-*'''</p>| '''19'''}{|| '''20'''| '''GND'''| styleclass="text-align: left;wikitable"|| style="textbackground-aligncolor: left#ffffdc;width:800px;"|
|-
| '''232'''| ''<big>'PH8''注意,这里说的Linux镜像具体指的是从Orange Pi资料下载页面下载的Debian或者Ubuntu这样的Linux发行版镜像。'| '''SPI1_MISO'''| '''21'''|| '''22'''| '''TWI0_SDA</UART2_RX'''big>| '''PI6'''}{| '''262'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big><p>'''230Sometimes 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>'''PH6The 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>'''SPI1_CLKFirst run the following command to check the corresponding relationship of i2c'''</p>| <p>orangepi@orangepizero2w:~$ '''23ls /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>'''24In 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>| '''SPI1_CS0'''}</li></ol><ol start="4" style="list-style-type: decimal;">| '''PH5'''<li><p>Then start testing i2c, first install i2c-tools</p>{| '''229'''class="wikitable" style="width:800px;"
|-
|-
| '''266'''| <big>'''PI10<p>'''| Note 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.'''TWI2-SDA</UART3_RXp>'''</big>| '''27'''} [[File:zero2w-img179.png]]|</li></ol>| '''28'''<ol start="7" style="list-style-type: decimal;">| <li><p>Then you can run the '''TWI2-SCL/UART3_TXds1307.py'''| test program in '''PI9examples'''to read the RTC time</p>{| '''265'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| '''256'''| <big><p>'''PI0'''| style="textNote that the x in i2c-align: left;"|| '''29x in the following command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p></big>|}{| '''30'''| '''GND'''| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| <p>root@orangepi:~/wiringOP-Python# '''271cd examples'''</p>| <p>root@orangepi:~/wiringOP-Python/examples# '''python3 ds1307.py --device \'''</p><p>'''PI15"/dev/i2c-x"'''</p><p>Thu 2022-06-16 04:35:46</p><p>Thu 2022-06-16 04:35:47</p><p>Thu 2022-06-16 04:35:48</p><p>^C</p><p>exit</p>|}</li></ol> <span id="pin-uart-test-1"></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="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: leftcenter;"|| '''31'''|-| '''32GPIO NO.'''| '''PWM1GPIO'''| '''PI11Function'''| '''267Pin'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-
| '''264'''
| '''PI8'''
| '''TWI1-SDA'''
| '''3'''
|-
| '''263'''
| '''PI7'''
| '''TWI1-SCL'''
| '''5'''
|-
| '''269'''
| '''PI13'''
| '''PWM3/UART4_TX'''
| '''7'''
|-
| 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;"|
| '''PI329'''|-| '''259271'''|}'''PI15''' <ol start="2" | style="listtext-style-typealign: decimalleft;">|<li><p>In Linux systems, uart is turned off by default and needs to be turned on manually before it can be used. The opening steps are as follows:: </p>| '''31'''<ol style="list-style-type: lower|-alpha;"><li><p>First run | '''orangepi-config268'''. Ordinary users remember to add > | '''sudoPI12''' permissions.</p><p>orangepi@orangepi:~$ | '''sudo orangepi-configPWM2'''</p></li><li><p>Then select | '''System33'''</p><p>[[File:zero2w|-img80.png]]</p></li><li><p>Then select | '''Hardware258'''</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 ''PI2'space''' to select the > serial port you want to open.</p></li></ol></li></ol> {| classstyle="wikitabletext-align: left;"|| '''35'''
|-
| '''Multiplexing function in 40pin272'''| '''Corresponding dtbo configurationPI16'''| style="text-align: left;"|| '''37'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''40pin - uart2GND'''| '''pi-uart239'''|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''40pin - uart3Pin'''| '''pi-uart3Function'''| '''GPIO'''| '''GPIO NO.'''
|-
| '''40pin - uart42'''| '''pi-uart45V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - uart54'''| '''ph-uart55V'''|} [[File:zero2w-img175.png]] <ol startstyle="5text-align: left;" || 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>6'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select | '''<Reboot>GND''' to restart the system to make the > configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol> <!-- --><ol start| style="3text-align: left;" || style="list-styletext-typealign: decimalleft;">|<li><p>After entering the Linux system, first confirm whether there is a uart5 device node under |-| '''<span class="mark">/dev</span>8'''</p><p>| '''注意, linux5.4系统为/dev/ttyASx.UART0_TX'''</p><p>orangepi@orangepi:~$ | '''ls /dev/ttyS*PH0'''</p><p>/dev/ttySx</p></li>| '''224'''<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 | '''gpio10''' 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.UART0_RX'''</p><p>orangepi@orangepi:~$ | '''gpio serial /dev/ttySx # linux-6.1 test commandPH1'''</p><p>orangepi@orangepi:~$ | '''gpio serial /dev/ttyASx # linux-5.4 test command225'''</p><p>Out: 0: |-> 0</p><p>Out: 1: -> 1</p>| '''12'''<p>Out: 2: | style="text-> 2</p><p>Outalign: 3: ->left; 3^C</p></li>"|<li><p>Finally, you can run the | '''serialTest.pyPI1''' 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.257'''</p><p>root@orangepi:~/wiringOP|-Python# | '''cd examples14'''</p><p>root@orangepi:~/wiringOP-Python/examples# | '''GND'''python3 serialTest.py | style="text-align: left;"|| style="text-device "align: left;/dev/ttySx" # linux6.1 use"||-| '''16'''</p><p>root@orangepi:~/wiringOP-Python/examples# | '''python3 serialTest.py --device "PWM4/dev/ttyASx" # linux5.4 useUART4_RX'''</p><p>Out: 0: -> 0</p>| '''PI14'''<p>Out: 1: -> 1</p>| '''270'''<p>Out: 2: |-> 2</p><p>Out: 3: -> 3</p>| '''18'''<p>Out: 4:^C</p><p>exit</p></li></ol> <span id| style="hardwaretext-watchdog-testalign: left;"></span>|| '''PH4'''== Hardware watchdog test ==| '''228''' The watchdog_test program is pre|-installed in the Linux system released by Orange Pi and can be tested directly.| '''20'''The method to run the watchdog_test program is as follows:| '''GND''' <ol | style="listtext-align: left;"|| style="text-typealign: lower-alphaleft;">|<li><p>The second parameter 10 represents the counting time of the watchdog. If the dog is not fed within this time, the system will restart.</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 "keep alive" to indicate that the dog feeding is successful.</p><p>orangepi@orangepi:~$ | '''sudo watchdog_test 1022'''</p><p>open success<| '''TWI0_SDA/p>UART2_RX'''<p>options is 33152,identity is sunxi-wdt</p>| '''PI6'''<p>put_usr return,if 0,success:0</p>| '''262'''<p>The old reset time is: 16</p><p>return ENOTTY,if |-1,success:0</p><p>return ENOTTY,if -1,success:0</p>| '''24'''<p>put_user return,if 0,success:0</p>| '''SPI1_CS0'''<p>put_usr return,if 0,success:0</p>| '''PH5'''<p>keep alive</p>| '''229'''<p>keep alive</p><p>keep alive</p></li></ol> <span id="check|-the-chipid-of-h618-chip"></span>== Check the chipid of H618 chip ==| '''26'''| '''SPI1_CS1'''The command to view the H618 chip chipid is as follows. The chipid of each chip is different, so you can use chipid to distinguish multiple development boards.| '''PH9''' orangepi@orangepi:~$ | '''cat /sys/class/sunxi_info/sys_info | grep "chipid"233'''|-sunxi_chipid : 338020004c0048080147478824681ed1| '''28''' <span id="python| '''TWI2-related-instructions"><SCL/span>UART3_TX'''== Python related instructions ==| '''PI9'''| '''265'''<span id="how-to-compile-and-install|-python-source-code"></span>=== How to compile and install Python source code === | '''If the Python version in the Ubuntu or Debian system software repository you are using does not meet the development requirements and you want to use the latest version of Python, you can use the following method to download the Python source code package to compile and install the latest version of Python.30''' | '''The following demonstration is to compile and install the latest version of Python 3.9. If you want to compile and install other versions of Python, the method is the same (you need to download the source code corresponding to the Python you want to install).GND''' <ol | style="listtext-align: left;"|| style="text-typealign: decimalleft;">|<li><p>First install the dependency packages needed to compile Python</p>|-<p>orangepi@orangepi:~$ | '''sudo apt-get update32'''</p><p>orangepi@orangepi:~$ | '''sudo apt-get install -y build-essential zlib1g-dev \PWM1'''</p><p>| '''libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev \PI11'''</p><p>| '''267'''libreadline|-dev libffi-dev curl libbz2-dev| '''34'''</p></li><li><p>Then download the latest version of Python3.9 source code and unzip it</p><p>orangepi@orangepi:~$ | '''wget \GND'''</p><p>[https| style="text-align: left;"|| style="text-align://www.python.org/ftp/python/3.9.10/Pythonleft;"||-3.9.10.tgz | '''https://www.python.org/ftp/python/3.9.10/Python-3.9.10.tgz36''']</p><p>orangepi@orangepi| style="text-align:~$ left;"|| '''tar xvf Python-3.9.10.tgzPC12'''</p></li><li><p>Then run the configuration command</p><p>orangepi@orangepi:~$ | '''cd Python-3.9.1076'''</p><p>orangepi@orangepi:~$ |-| '''./configure --enable-optimizations38'''</p></li><li><p>Then compile and install Python3.9. The compilation time takes about half an hour.</p>| style="text-align: left;"|<p>orangepi@orangepi:~$ | '''make -j4PI4'''</p><p>orangepi@orangepi:~$ | '''sudo make altinstall260'''</p></li><li><p>After installation, you can use the following command to check the version number of the Python you just installed.</p>|-<p>orangepi@orangepi:~$ | '''python3.9 --version40'''</p><p>| style="text-align: left;"|| '''Python 3.9.10PI3'''</p></li><li><p>Then update pip</p><p>orangepi@orangepi:~$ | '''/usr/local/bin/python3.9 -m pip install --upgrade pip259'''|}</p></li></oldiv>
<span idol start="how-to-replace-pip-source-in-python2"></span>=== How to replace pip source in Python === '''The default source used by Linux system pip is the official source of Python. However, accessing the official source of Python in China is very slow, and the installation of Python software packages often fails due to network reasons. So when using pip to install the Python library, please remember to change the pip source.''' <ol style="list-style-type: decimal;"><li><p>First install '''python3-pip'''</p><p>orangepi@orangepiIn Linux systems, uart is turned off by default and needs to be turned on manually before it can be used. The opening steps are as follows:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y python3-pip'''</p></li><li><p>How to permanently change the pip source under Linux</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First create a new run '''~/.piporangepi-config''' directory, then . Ordinary users remember to add the > '''pip.confsudo''' configuration file, and set the pip source in it > to Tsinghua sourcepermissions.</p><p>orangepi@orangepi{| class="wikitable" style="width:~$ '''mkdir 800px;" |-p ~/.pip'''</p>| <p>orangepi@orangepi:~$ '''cat <<EOF > ~/.pip/pip.conf'''</p><p>'''[global]'''</p><p>'''timeout = 6000'''</p><p>'''index-url = https://pypi.tuna.tsinghua.edu.cn/simple'''</p><p>'''trustedsudo orangepi-host = pypi.tuna.tsinghua.edu.cn'''</p><p>'''EOFconfig'''</p></li><li><p>Then use pip3 to install the Python library very quickly</p></li></ol>|}
</li>
<li><p>How to temporarily change the pip source under Linux, where Then select '''<packagename>System''' needs to be replaced with a specific package name</p><p>orangepi@orangepi[[File:~$ zero2w-img80.png]]</p></li><li><p>Then select '''pip3 install <packagename> -i \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 '''https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cnspace'''to select the serial port you want to open.</p></li></ol>
<ol style="list-style-type: lower-alpha;"><li><p>The second parameter 10 represents the counting time of the watchdog. If the dog is not fed within this time, the system will restart.</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 "keep alive" to indicate that the dog feeding is successful.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''This message shows that your installation appears to be working correctly.sudo watchdog_test 10'''</p><p>open success</p><p>options is 33152,identity is sunxi-wdt</p><p>put_usr return,if 0,success:0</p><p>The old reset time is: 16</p><p>return ENOTTY,if -1,success:0</p><p>return ENOTTY,if -1,success:0</p><p>put_user return,if 0,success:0</p><p>put_usr return,if 0,success:0</p><p>keep alive</p><p>keep alive</p><p>keep alive</p>|}</li></ol>
{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''Note: You need to log out and log in again to the system to take effect. You can also restart the system.cat /sys/class/sunxi_info/sys_info | grep "chipid"'''
<ol stylespan id="listhow-style-type: decimal;"><li><p>First, please install docker and ensure that docker can run normally. For the installation steps of docker, please refer to the instructions in the [[\l|'''How to Install Docker''']] section.</p></li><li><p>Then you can search for the docker image of Home Assistant</p><p>orangepi@orangepi:~$ '''docker search homeassistant'''</p></li><li><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.</p><p>orangepi@orangepi:~$ '''docker pull homeassistant/home-assistant'''</p><p>Using default tag: latest</p><p>latest: Pulling from homeassistant/home-assistant</p><p>be307f383ecc: Downloading</p><p>5fbc4c07ac88: Download complete</p><p>'''...... (Omit some output)'''</p><p>3cc6a1510c9f: Pull complete</p><p>7a4e4d5b979f: Pull complete</p><p>Digest: sha256:81d381f5008c082a37da97d8b08dd8b358dae7ecf49e62ce3ef1eeaefc4381bb</p><p>Status: Downloaded newer image for homeassistant/homecompile-assistant:latest</p><p>docker.io/homeassistant/homeand-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:~$ '''docker images homeassistant/home-assistant'''</p><p>REPOSITORY TAG IMAGE ID CREATED SIZE</p><p>homeassistant/home-assistant latest bfa0ab9e1cf5 2 months ago '''1.17GB'''</p></li><li><p>At this point you can run the Home Assistant docker container</p><p>orangepi@orangepi:~$ '''docker run install-d \'''</p><p>'''python-source-name homeassistant \'''</p><pcode">'''--privileged \'''</pspan><p>'''--restart=unless-stopped \'''</p><p>'''-e TZ=Asia/Shanghai \'''</p><p>'''-v /home/orangepi/home-assistant:/config \'''</p><p>'''--network=host \'''</p><p>'''homeassistant/home-assistant:latest'''</p></li><li><p>Then enter【the IP address of the development board: 8123】in the browser to see the Home Assistant interface</p><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 How to check whether there is a problem with the previous installation compile and setting process.'''</p><div classinstall Python source code ==="figure">
<ol style="list-style-type: decimal;">
<li><p>First install dependency packages'''python3-pip'''</p>{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepi:~$ '''sudo apt-get update'''</p>
<p>orangepi@orangepi:~$ '''sudo apt-get install -y python3 python3-dev python3-venv \pip'''</p><p>'''python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \'''|}</pli><p>'''libopenjp2-7 libtiff5 libturbojpeg0-dev tzdata'''</pli><p>'''If it is debian12, please use How to permanently change the following command:'''pip source under Linux</p><p>orangepi@orangepiol style="list-style-type:~$ '''sudo aptlower-get update'''</palpha;"><pli>orangepi@orangepi:~$ '''sudo apt-get install -y python3 python3-dev python3-venv \'''</p><p>First create a new '''python3-~/.pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \'''</p><p>'''libopenjp2-7 libturbojpeg0-dev tzdata'''</p></li><li><p>Then you need to compile and install Python3.9. For the methoddirectory, please refer to then add the [[\l|'''Python source code compilation and installation method''']] sectionpip.</p><p>conf'''The default Python version of Debian Bullseye is Python3.9configuration file, so there is no need to compile and install set the pip source in itto Tsinghua source.'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''The default Python version of Ubuntu Jammy is Python3.10, so there is no need to compile and install itmkdir -p ~/.pip'''</p><p>orangepi@orangepi:~$ '''The default Python version of Debian Bookworm is Python3cat <<EOF > ~/.11, so there is no need to compile and install itpip/pip.conf'''</p></li><li><p>Then create a Python virtual environment</p><p>'''Debian Bookworm is python3.11, please remember to replace the corresponding command.[global]'''</p><p>orangepi@orangepi:~$ '''sudo mkdir /srv/homeassistanttimeout = 6000'''</p><p>orangepi@orangepi:~$ '''sudo chown orangepiindex-url = https:orangepi /srv/homeassistant'''<pypi.tuna.tsinghua.edu.cn/p><p>orangepi@orangepi:~$ '''cd /srv/homeassistantsimple'''</p><p>orangepi@orangepi:~$ '''python3trusted-host = pypi.tuna.tsinghua.9 -m venv edu.cn'''</p><p>orangepi@orangepi:~$ '''source bin/activateEOF'''</p><p>(homeassistant) orangepi@orangepi:/srv/homeassistant$</p>|}</li><li><p>Then use pip3 to install the required Python packageslibrary very quickly</p><p/li>(homeassistant) orangepi@orangepi:/srv/homeassistant$ '''python3 -m pip install wheel'''</pol></li><li><p>Then you can install Home Assistant Core</p><p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ How to temporarily change the pip source under Linux, where '''pip3 install homeassistant<packagename>'''needs to be replaced with a specific package name</p></li><li><p>Then enter the following command to run Home Assistant Core</p>{| class="wikitable" style="width:800px;" |-| <p>(homeassistant) orangepi@orangepi:/srv/homeassistant~$ '''hasspip3 install <packagename> -i \'''</p></li><li><p>Then enter【'''development board IP addresshttps: 8123'''】 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/pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi. This process may take several minutestuna. Note that you cannot see the Home Assistant interface in the browser at this timetsinghua. Please wait for a while and then refresh itedu.cn'''</p>|}<div class="figure"/li></ol>
'''<span idstyle="installation-method-of-ubuntu-20.04-systemcolor:#FF0000">Hello from Docker!</span>=== Installation method of Ubuntu 20.04 system ==='''
'''<ol span style="list-style-typecolor: decimal;#FF0000"><li><p>First open '''Language Support'''</p><p>[[File:zero2w-img201.png]]</p></li><li><p>Then find the '''Chinese (China)''' option</p><p>[[File:zero2w-img202This message shows that your installation appears to be working correctly.png]]</pspan></li><li><p>Then please use the left button of the mouse to select '''Chinese (China)''' and hold it down, then drag it up to the starting position. After dragging, the display will be as shown below:</p><p>[[File:zero2w-img203.png]]</p></li></ol>
'''Note that this step is not easy to drag, please be patient and try it a few times.….'''|}
<ol style="list-style-type: decimal;">
<li><p>First download , please install docker and ensure that docker can run normally. For the installation package steps of docker, please refer to the NoMachine software Linux instructions in the [[Orange Pi Zero 2W#How to install Docker|'''arm64How to Install Docker''' deb version]] section.</p></li><li><p>Then you can search for the docker image of Home Assistant</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''docker search homeassistant'''</p>|}</li><li><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 then install it into the Linux system of download time will be relatively long. Please be patient and wait for the development boarddownload to complete.</p><ol {| class="wikitable" style="listwidth:800px;" |-| <p>orangepi@orangepi:~$ '''docker pull homeassistant/home-assistant'''</p><p>Using default tag: latest</p><p>latest: Pulling from homeassistant/home-styleassistant</p><p>be307f383ecc: Downloading</p><p>5fbc4c07ac88: Download complete</p><p>'''...... (Omit some output)'''</p><p>3cc6a1510c9f: Pull complete</p><p>7a4e4d5b979f: Pull complete</p><p>Digest: sha256:81d381f5008c082a37da97d8b08dd8b358dae7ecf49e62ce3ef1eeaefc4381bb</p><p>Status: Downloaded newer image for homeassistant/home-typeassistant: lowerlatest</p><p>docker.io/homeassistant/home-alpha;"assistant:latest</p>|}</li><li>Since H618 is an ARMv8 architecture SOC and <p>Then you can use the system we use is > Ubuntu or Debian, we need following command to download view the docker image of Home Assistant you just downloaded</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''docker images homeassistant/home-assistant'''NoMachine for ARM </p><p>REPOSITORY TAG IMAGE ID CREATED SIZE</p><p>homeassistant/home-assistant latest bfa0ab9e1cf5 2 months ago >nbsp; ARMv8 DEB''' installation package<span style="color:#FF0000">1. The download link is as >17GB</span>'''</p>|}</li><li><p>At this point you can run the Home Assistant docker container</p>{| class="wikitable" style="width:800px; follows" |-| <p>orangepi@orangepi:~$ '''docker run -d \'''</p>:<p>'''--name homeassistant \'''</p>:<p>'''--privileged \'''</p>:<p>'''--restart=unless-stopped \'''</p>:<p>'''-e TZ=Asia/Shanghai \'''</p>:<p>'''-v /home/orangepi/home-assistant:/config \'''</p>:<p>'''--network=host \'''</p>:<p>'''homeassistant/home-assistant:latest'''</p>|}</li><li><p>Then enter【the IP address of the development board: 8123】in the browser to see the Home Assistant interface</olp>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><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.'''</lip></olbig>|}<div class="figure">
[[File:zero2w-img217img181.png]]
[[File:zero2w-img221img184.png]]
<span id="remoteinstallation-loginvia-using-vncpython"></span>=== Remote login using VNC ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''There are many problems with VNC testing in Ubuntu20.04Before installation, please do not use this 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 "[[Orange Pi Zero 2W#How to replace pip source in Python|How to Change the Pip Source of Python]]"'''</big>|}
<ol style="list-style-type: decimal;">
<li><p>First run the '''set_vnc.sh''' script to set up vnc, '''remember to add sudo permission'''sinstall dependency packages</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo set_vnc.shapt-get update'''</p><p>You will require a password to access your desktops.</p><p>Passwordorangepi@orangepi: ~$ '''#Set the vnc password here, 8 characterssudo apt-get install -y python3 python3-dev python3-venv \'''</p><p>Verify: '''#Set the vnc password here, 8 characterspython3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \'''</p><p>Would you like to enter a view-only password (y/n)? '''nlibopenjp2-7 libtiff5 libturbojpeg0-dev tzdata'''</p><p>xauth: file /root/.Xauthority does not exist</p><p>New 'X' desktop is orangepi:1</p><p>Creating default startup script /root/.vnc/xstartup</p>|}<p>Starting applications specified in /root/.vnc/xstartup</p><p>Log file is /root/.vnc/orangepi:1.log</p><p>Killing Xtightvnc process ID 3047</p><p>New 'X' desktop is orangepi:1</p><p>Starting applications specified in /root/.vnc/xstartup</p><p>Log file is /root/.vnc/orangepi:1.log</p></li><li><p>The steps to use MobaXterm software to connect to the development board Linux system desktop are as follows:</p><ol style="list-style-type: lower-alpha;"><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></li></ol> <div {| class="figure"> [[File:zero2w-img227.png]] </div><ol start="2wikitable" style="listbackground-style-typecolor: lower-alpha#ffffdc;"><li><p>Then enter the VNC password set earlier</p><p>[[Filewidth:zero2w-img228.png]]</p></li><li><p>After successful login, the interface is displayed as shown below, >800px; and then you can remotely operate the desktop of the development > board Linux system.</p></li></ol>" [[File:zero2w|-img229.png]] <span id="qt-installation-method"></span>== QT installation method ==| <ol style="list-style-type: decimal;"><libig><p>Use the following script to install QT5 and QT Creator</p><p>orangepi@orangepi:~$ '''install_qt.sh'''</p></li><li><p>After installationIf it is debian12, please use the QT version number will be automatically printed.</p><ol style="list-style-type: lower-alpha;"><li><p>The qt version that comes with Ubuntu20.04 is '''5.12.8'''</p><p>orangepi@orangepifollowing command:~$ '''install_qt.sh'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version '''5.12.8''' in /usr/lib/aarch64-linux-gnu</p></li><li><p>The QT version that comes with Ubuntu22.04 is '''5.15.3'''</pbig><p>orangepi@orangepi:~$ '''install_qt.sh'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version '''5.15.3''' in /usr/lib/aarch64-linuxsudo apt-gnu</p></li><li><p>The QT version that comes with Debian11 is '''5.15.2get update'''</p><p>orangepi@orangepi:~$ '''install_qt.shsudo apt-get install -y python3 python3-dev python3-venv \'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version '''5.15.2''' in /usr/lib/aarch64python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-linuxdev autoconf build-gnu</p></li><li><p>The QT version that comes with Debian12 is '''5.15.8essential \'''</p><p>orangepi@orangepi:~$ '''install_qt.shlibopenjp2-7 libturbojpeg0-dev tzdata'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version '''5.15.8''' in /usr/lib/aarch64-linux-gnu</p></li></ol>|}
</li>
<li><p>Then you can see need to compile and install Python3.9. For the method, please refer to the QT Creator startup icon in [[Orange Pi Zero 2W#Python related instructions|'''ApplicationsPython source code compilation and installation method''']] section.</p><p>[[File{| class="wikitable" style="background-color:#ffffdc;width:zero2w800px;" |-img230.png]]| </pbig><p>You can also use the following command '''The default Python version of Debian Bullseye is Python3.9, so there is no need to open QT Creatorcompile and install it.'''</p><p>orangepi@orangepi:~$ '''qtcreatorThe default Python version of Ubuntu Jammy is Python3.10, so there is no need to compile and install it.'''</p></li><li><p>'''The interface after QT Creator default Python version of Debian Bookworm is opened Python3.11, so there is as followsno need to compile and install it.'''</p><p>[[File:zero2w-img231.png]]</pbig>|}</li><li><p>The version of QT Creator is as followsThen create a Python virtual environment</p><ol {| class="wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;">|-| <libig><p>The default version of QT Creator in '''Ubuntu20Debian Bookworm is python3.11, please remember to replace the corresponding command.04''' is as > follows</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>[[Fileorangepi@orangepi:zero2w-img232.png]]~$ '''sudo mkdir /srv/homeassistant'''</p><p>orangepi@orangepi:~$ '''sudo chown orangepi:orangepi /srv/homeassistant'''</lip><li><p>The default version of QT Creator in orangepi@orangepi:~$ '''Ubuntu22.04cd /srv/homeassistant''' is as > follows</p><p>[[Fileorangepi@orangepi:zero2w~$ '''python3.9 -img233m venv .png]]'''</p></li><li><p>The default version of QT Creator in orangepi@orangepi:~$ '''Debian11source bin/activate''' is as follows</p><p>[[File(homeassistant) orangepi@orangepi:zero2w-img234.png]]/srv/homeassistant$</p>|}</li><li><p>The default version of QT Creator in '''Debian12''' is as followsThen install the required Python packages</p>{| class="wikitable" style="width:800px;" |-| <p>[[File(homeassistant) orangepi@orangepi:zero2w/srv/homeassistant$ '''python3 -img235.png]]m pip install wheel'''</p></li></ol>|}
</li>
<li><p>Then set up QTyou can install Home Assistant Core</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>First open '''Help'''|->'''About Plugins...'''.</p><p>[[File:zero2w-img236.png]]</p></li>| <li><p>Then remove the check mark of '''ClangCodeModel'''</p><p>[[File(homeassistant) orangepi@orangepi:zero2w-img237.png]]</p></li><li><p>'''After setting up, you need to restart QT Creator'''</p></li><li><p>Then make sure the GCC compiler used by QT Creator. If the > default is Clang, please change it to GCC.<srv/p><p>homeassistant$ '''Debian12 please skip this step.pip3 install homeassistant'''</p><p>[[File:zero2w-img238.png]]</p><p>[[File:zero2w-img239.png]]</p></li></ol>|}
</li>
<li><p>Then you can open a sample codeenter the following command to run Home Assistant Core</p><p>[[File{| class="wikitable" style="width:zero2w800px;" |-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(homeassistant) orangepi@orangepi:zero2w-img241.png]]</p><srv/li><li><p>Then click homeassistant$ '''Configure Projecthass'''</p><p>[[File:zero2w-img242.png]]</p>|}</li><li><p>Then click the green triangle enter【'''development board IP address: 8123'''】 in the lower left corner browser to compile and run see the sample codeHome Assistant interface</p><p>[[File{| class="wikitable" style="background-color:#ffffdc;width:zero2w800px;" |-img243.png]]</p></li>| <libig><p>After waiting '''When you run the hass command for a period of the first time, the interface shown in the figure below some libraries and dependency packages necessary for operation will pop upbe downloaded, which means that QT can compile installed and run normally.</p><p>[[File:zero2w-img244.png]]</p></li><li><p>References</p><p>[https://wikicached.qtThis process may take several minutes.io/Install_Qt_5_on_Ubuntu '''https://wikiNote that you cannot see the Home Assistant interface in the browser at this time.qtPlease wait for a while and then refresh it.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 '''https://download.qt.io/archive/qt''']</p></li></olbig>|}<span iddiv class="ros-installation-methodfigure"></span>== ROS installation method ==
<ol style="list-style-type: decimal;"><li><p>The installation command is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt-get update'''https</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y libopencv-dev python3-opencv'''</p>|}</wikili><li><p>Then use the following command to print the version number of OpenCV.rosThe output is normal, indicating that the OpenCV installation is successful.org</Distributionsp><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 startspan id="2" style="listset-styleup-type: decimal;"><li><p>The link to the official installation documentation of ROS 1 '''Noetic Ninjemys''' is as follows:</p><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 '''Ubuntu20.04 desktop system'''.</p><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 chinese-environment-and-install ros1</p><p>orangepi@orangepi:~$ '''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-chinese-input-method"></olspan>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''The install_ros.sh script will try to modify /etc/hosts and automatically run Note, before installing the following commands. However, this Chinese input 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 make sure that the linux Linux system of used by the development board to access github normally, and then manually run the following Orderis a desktop version.'''</big>|}
<ol style="list-style-type: decimal;"><li><p>First set the default '''locale'''Hit httpsto 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'''</rawp><p>[[File:zero2w-img187.githubusercontentpng]]</p></li><li><p>After exiting the interface, the '''locale''' setting will begin.comThe output displayed on the command line is as follows:</rosp>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo dpkg-reconfigure locales'''</rosdistrop><p>Generating locales (this might take a while)...</masterp>:<p>en_US.UTF-8... done</rosdepp>:<p>zh_CN.UTF-8... done</basep><p>Generation complete.yaml</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">
</div></li><li><p>Then put '''Google Pinyin'''The read operation timed outon top</p><p>[[File:zero2w-img196.png]]</p><p>[[File:zero2w-img197.png]]</p></li><li><p>Then open the '''Geany'''editor to test the Chinese input method</p><p>[[File:zero2w-img198.png]]</p></li><li><p>The Chinese input method test is as follows</p>orangepi@orangepi<p>[[File:~$ zero2w-img199.png]]</p></li><li><p>You can switch between Chinese and English input methods through the '''Ctrl+Space'''source shortcut key</optp></rosli><li><p>If you need the entire system to be displayed in Chinese, you can set all variables in '''/etc/noeticdefault/setuplocale''' to '''zh_CN.bashUTF-8'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo rosdep initvim /etc/default/locale'''</p><p># File generated by update-locale</p>Wrote <p>LC_MESSAGES='''<span style="color:#FF0000">zh_CN.UTF-8</etcspan>'''</rosp><p>LANG='''<span style="color:#FF0000">zh_CN.UTF-8</rosdepspan>'''</sourcesp><p>LANGUAGE='''<span style="color:#FF0000">zh_CN.listUTF-8</span>'''</p>|}</li><li><p>Then '''<span style="color:#FF0000">restart the system</span>''' and you will see that the system is displayed in Chinese.d</20p><p>[[File:zero2w-defaultimg200.list Recommended: please runpng]]</p></li></ol>
<ol start="6" p>Password: '''<span style="list-style-typecolor: decimal;#FF0000">#Set the vnc password here, 8 characters<li/span><p>Then open a command line terminal window on the '''desktop''', and then use the '''test_ros.sh''' script to start a small turtle routine to test whether ROS can be used normally.</p><p>orangepi@orangepiVerify:~$ '''test_ros.sh<span style="color:#FF0000">#Set the vnc password here, 8 characters</span>'''</p></li><li><p>After running the Would you like to enter a view-only password (y/n)? '''test_ros.sh<span style="color:#FF0000">n</span>''' script, a small turtle as shown in the picture below will pop up.</p><p>[[Filexauth:zero2w-img248.png]]<file /p><root/li><li><p>Then please keep the terminal window you just opened at the top.Xauthority does not exist</p></li></ol>
<span id="how-to-install-ros-2-galactic-on-ubuntu20p>Creating default startup script /root/.04"vnc/xstartup</p><p>Starting applications specified in /root/.vnc/xstartup</spanp>=== How to install ROS 2 Galactic on Ubuntu20<p>Log file is /root/.04 ===vnc/orangepi:1.log</p>
<span id="how-to-install-ros-2-humble-on-ubuntu22.04"p>Killing Xtightvnc process ID 3047</spanp>=== How to install ROS 2 Humble on Ubuntu22.04 ===
<span id="how-to-install-kernel-header-files"p>New 'X' desktop is orangepi:1</spanp>== How to install kernel header files ==
[[File:zero2w-img229.png]]</ol></li></ol><span id="testing-of-some-programming-languages-supported-byqt-linuxinstallation-systemmethod"></span>== Testing of some programming languages supported by Linux system ==
<ol style="list-style-type: decimal;">
<li><p>Debian Bullseye is installed with Use the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.following script to install QT5 and QT Creator</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>The version of a.gcc is as follows</p><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 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_worldinstall_qt.csh'''</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'''</p><p>orangepi@orangepi:~$ '''gcc -o hello_world hello_world.c'''</p><p>orangepi@orangepi:~$ '''./hello_world'''</p><p>Hello World!</p></li></ol>
</li>
<li><p>Debian Bullseye has Python3 installed by defaultAfter installation, the QT version number will be automatically printed.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The specific qt version of Python that comes with Ubuntu20.04 is as follows'''5.12.8'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3install_qt.sh'''</p><p>'''Python 3.9.2''' (default, Feb 28 2021, 17:03:44)....</p><p>[GCC 10.2QMake version 3.1 20210110] on linux</p><p>Type "help", "copyright", "credits" or "license" for more information.Using Qt version '''</pspan style="color:#FF0000"><p>>>>5.12.8</p><pspan>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''in /usr/lib/aarch64-linux-gnu</p>|}</li><li><p>Write the The QT version that comes with Ubuntu22.04 is '''hello_world5.15.py3''' program in Python language</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_worldinstall_qt.pysh'''</p><p>print(......</p><p>QMake version 3.1</p><p>Using Qt version ''Hello World!')<span style="color:#FF0000">5.15.3</span>''' in /usr/lib/aarch64-linux-gnu</p>|}</li><li><p>The result of running QT version that comes with Debian11 is '''hello_world5.py15.2''' is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 hello_worldinstall_qt.pysh'''</p><p>Hello World!......</p><p>QMake version 3.1</lip><p>Using Qt version '''<span style="color:#FF0000">5.15.2</span>''' in /usr/lib/aarch64-linux-gnu</olp>|}
</li>
<li><p>Debian Bullseye does not install Java compilation tools and operating environment by defaultThe QT version that comes with Debian12 is '''5.15.8'''</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>You can use the following command to install openjdk. The latest > version in Debian Bullseye is openjdk|-17</p>| <p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdkinstall_qt.sh'''</p></li><li><p>After installation, you can check the Java version......</p><p>orangepi@orangepi:~$ '''java --QMake version'''3.1</p></li><li><p>Write the Java Using Qt version of '''hello_world.java'''</p><p>orangepi@orangepispan style="color:~$ '''vim hello_world.java'''</p#FF0000"><p>public class hello_world</p><p>{</p><p>public static void main(String[] args)</p><p>{</p><p>System5.out15.println("Hello World!");</p><p>}8</pspan><p>}</p></li><li><p>Then compile and run '''hello_world.java'''<in /usr/p><p>orangepi@orangepi:~$ '''javac hello_world.java'''<lib/p><p>orangepi@orangepi:~$ '''java hello_world'''aarch64-linux-gnu</p><p>Hello World!</p></li></ol>|}
</li></ol>
</li>
<li><p>Debian Bookworm has Python3 installed by defaultThen you can see the QT Creator startup icon in '''Applications'''</p><p>[[File:zero2w-img230.png]]</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 specific default version of Python is as follows</p><p>orangepi@orangepi:~$ QT Creator in '''python3Ubuntu20.04'''is as follows</p><p>Python 3.11.2 (main, Mar 13 2023, 12:18[[File:29) [GCC 12zero2w-img232.2.0png]] on linux</p><p/li>Type "help", "copyright", "credits" or "license" for more information.</pli><p>>>>The default version of QT Creator in '''Ubuntu22.04''' is as follows</p><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode[[File:zero2w-img233.'''png]]</p></li><li><p>Write the The default version of QT Creator in '''hello_world.pyDebian11''' program in Python languageis as follows</p><p>orangepi@orangepi[[File:~$ '''vim hello_worldzero2w-img234.py'''</p><p>print('Hello World!')png]]</p></li><li><p>The result default version of running QT Creator in '''hello_world.pyDebian12''' is as follows</p><p>orangepi@orangepi[[File:~$ '''python3 hello_worldzero2w-img235.py'''</p><p>Hello World!png]]</p></li></ol>
</li>
<li><p>Debian Bookworm does not install Java compilation tools and operating environment by default.Then set up QT</p>
<ol style="list-style-type: lower-alpha;">
<li><p>You can use the following command to install openjdk. The latest First open '''Help'''-> version in Debian Bookworm is openjdk-17</p><p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdkAbout Plugins...'''</p></li><li><p>After installation, you can check the Java version.</p><p>orangepi@orangepi[[File:~$ '''java zero2w--version'''img236.png]]</p></li><li><p>Write Then remove the Java version check mark of '''hello_world.javaClangCodeModel'''</p><p>orangepi@orangepi[[File:~$ '''vim hello_worldzero2w-img237.java'''</p><p>public class hello_world</p><p>{</p><p>public static void main(String[png]] 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'''</pspan style="color:#FF0000"><p>orangepi@orangepi:~$ '''javac hello_world.java'''After setting up, you need to restart QT Creator</pspan><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p></li></ol></li></ol> <span id="ubuntu-focal-system"></span>=== Ubuntu Focal system === <ol style="list-style-type: decimal;"><li><p>Ubuntu Focal is installed with Then make sure the gcc compilation tool chain GCC compiler used by QT Creator. If the defaultis Clang, which can directly compile C language programs in the Linux system of the development boardplease change it to GCC.</p><ol {| class="wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;">|-| <li><p>The version of a.gcc is as follows</pbig><p>orangepi@orangepi:~$ '''gcc --versionDebian12 please skip this step.'''</p><p>gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0</pbig>|}<p>Copyright (C) 2019 Free Software Foundation, Inc[[File:zero2w-img238.png]]</p><p>This is free software; see the source for copying conditions[[File:zero2w-img239. There is NOpng]]</p><p/li>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</pol></li><li><p>Write the '''hello_world.c''' program in C languageThen you can open a sample code</p><p>orangepi@orangepi[[File:~$ '''vim hello_worldzero2w-img240.c'''</p><p>#include <stdio.h></p><p>int main(void)</p><p>{</p><p>printf("Hello World!\n");</p><p>return 0;</p><p>}png]]</p></li><li><p>Then compile and run '''hello_worldAfter clicking on the sample code, the corresponding instruction document will automatically open. You can read the instructions carefully.c'''</p><p>orangepi@orangepi[[File:~$ '''gcc zero2w-o hello_world hello_worldimg241.c'''</p><p>orangepi@orangepi:~$ '''./hello_world'''png]]</p><p>Hello World!</p></li></ol></li><li><p>Ubuntu 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><p>orangepi@orangepi:~$ Then click '''python3Configure Project'''</p><p>Python 3.8.10 (default, Nov 14 2022, 12[[File:59:47)</p><p>[GCC 9zero2w-img242.4.0png]] on linux</p><p>Type "help", "copyright", "credits" or "license" for more information.</p><p>>>></p><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p></li><li><p>Write Then click the '''hello_world.py''' program green triangle in Python languagethe lower left corner to compile and run the sample code</p><p>orangepi@orangepi[[File:~$ '''vim hello_worldzero2w-img243.py'''</p><p>print('Hello World!')png]]</p></li><li><p>The result After waiting for a period of running '''hello_worldtime, the interface shown in the figure below will pop up, which means that QT can compile and run normally.py''' is as follows</p><p>orangepi@orangepi[[File:~$ '''python3 hello_worldzero2w-img244.py'''</p><p>Hello World!png]]</p></li></ol></li><li><p>Ubuntu Focal does not have Java compilation tools and running environment installed by default.References</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[https:~$ //wiki.qt.io/Install_Qt_5_on_Ubuntu '''sudo apt install -y openjdk-17-jdk'''<https:/p></li><li><p>After installation, you can check the Java versionwiki.qt.<io/p><p>orangepi@orangepi:~$ '''java --versionInstall_Qt_5_on_Ubuntu''']</p><p>openjdk 17.0.2 2022-01-18<[https:/p><p>OpenJDK Runtime Environment (build 17.0.2+8-Ubuntu-120.04)</p><p>OpenJDK 64-Bit Server VM (build 17.0download.2+8-Ubuntu-120qt.04, mixed mode, sharing)<io/p><archive/li><li><p>Write the Java version of qtcreator '''hello_worldhttps://download.java'''<qt.io/archive/p><p>orangepi@orangepi:~$ '''vim hello_world.javaqtcreator''']</p><p>public class hello_world</p><p>{</p><p>public static void main(String[] args)<https:/p><p>{</p><p>Systemdownload.outqt.println("Hello World!");</p><p>}<io/p><p>}<archive/p></li><li><p>Then compile and run qt '''hello_worldhttps://download.java'''<qt.io/p><p>orangepi@orangepi:~$ '''javac hello_world.java'''<archive/p><p>orangepi@orangepi:~$ '''java hello_worldqt''']</p><p>Hello World!</p></li></ol>|}
</li></ol>
<span id="ubunturos-jammyinstallation-systemmethod"></span> === Ubuntu Jammy system =ROS installation method ==
<ol stylespan id="listhow-styleto-type: decimal;"><li><p>Ubuntu Jammy 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="listinstall-styleros-type: lower-alpha;"><li><p>The version of a.gcc is as follows</p><p>orangepi@orangepi:~$ '''gcc 1-noetic-version'''</p><p>gcc (Ubuntu 11.3.0on-1ubuntu1~22ubuntu20.04.1) '''11.3.0'''</p><p">Copyright (C) 2021 Free Software Foundation, Inc.</pspan><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.c'''</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'''</p><p>orangepi@orangepi:~$ '''gcc -o hello_world hello_world.c'''</p><p>orangepi@orangepi:~$ '''./hello_world'''</p><p>Hello World!</p></li></ol></li><li><p>Ubuntu Jammy has Python3 installed by default</p><ol style="list-style-type: lower-alpha;"><li><p>The specific version of Python3 is as follows</p><p>orangepi@orangepi:~$ '''python3'''</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><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@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>Ubuntu Jammy does not install Java compilation tools and operating environment by default.</p><ol style="list-style-type: lower-alpha;"><li><p>You can use the following command = How to install openjdk-18</p><p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-18-jdk'''</p></li><li><p>After installation, you can check the Java version.</p><p>orangepi@orangepi:~$ '''java --version'''</p><p>openjdk 18.0.2-ea 2022-07-19</p><p>OpenJDK Runtime Environment (build 18.0.2-ea+9-Ubuntu-222ROS 1 Noetic on Ubuntu20.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 '''hello_world.java'''</p><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><p>orangepi@orangepi:~$ '''javac hello_world.java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p></li></ol></li></ol>===
::'''</div><ol start="5" span style="list-style-typecolor: decimal;#FF0000">The read operation timed out<li/span><p>Then choose to '''save the password''' and click '''OK'''</pbig><p>[[File|}{| class="wikitable" style="width:zero2w800px;" |-img257.png]]</p></li><li><p>Then select | orangepi@orangepi:~$ '''Always trust this host''' and click '''OKsource /opt/ros/noetic/setup.bash'''</p></li></ol>
updated cache in /home/orangepi/.ros/rosdep/sources.cache|}</divol>
<ol start="6" style="list-style-type: decimal;">
<li><p>Then select open a command line terminal window on the '''Always trust this hostdesktop''' , and click then use the '''OKtest_ros.sh'''script to start a small turtle routine to test whether ROS can be used normally.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''test_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</p></olli>
<div class="figure">
[[File:zero2w-img266img249.png]]
</div></ol><ol start="79" style="list-style-type: decimal;"><li>After the connection is successful<p>At this time, you can see press the directory structure of direction keys on the development board's Linux file system on keyboard to control the little turtle to move up, down, left, and right side of the filezilla software.</p><p>[[File:zero2w-img250.png]]</p></li></ol>
<div classspan id="figurehow-to-install-ros-2-galactic-on-ubuntu20.04"></span>
<ol style="list-style-type: decimal;"><li><p>The currently active version of ROS 2 is as follows, the recommended version is '''Galactic Geochelone'''</p><p>[[File:zero2w-img251.png]]</divp><ol startp>[[File:zero2w-img252.png]]</p>{| class="8wikitable" style="listwidth:800px;" |-| <p>[http://docs.ros.org/ '''http://docs.ros.org''']</p><p>'''http://docs.ros.org/en/galactic/Releases.html'''</p>|}</li><li><p>The link to the official installation documentation of ROS 2 '''Galactic Geochelone''' is as follows:</p>{| class="wikitable" style-type="width: decimal800px;"|-| <p>'''docs.ros.org/en/galactic/Installation.html'''</p><p>'''http://docs.ros.org/en/galactic/Installation/Ubuntu-Install-Debians.html'''</p>|}</li><li>Then select <p>In the path to be uploaded to official installation documentation of ROS 2 '''Galactic Geochelone''', Ubuntu Linux recommends using Ubuntu20.04, so please ensure that the system used by the development board on is the right side of '''<span style="color:#FF0000">Ubuntu20.04 desktop system</span>'''. There are several ways to install ROS 2. The following demonstrates how to install ROS 2 '''Galactic Geochelone''' through '''Debian packages'''.</p></li><li><p>Use the filezilla software, select the file '''install_ros.sh''' script to be uploaded on the Windows PC on the left side of install ros2</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''install_ros.sh ros2'''</p>|}</li><li><p>The '''install_ros.sh''' script will automatically run the filezilla software, right'''ros2 -click h''' command after installing ros2. If you can see the mousefollowing print, and then click it means that the upload option to start uploading the file to the development boardros2 installation is complete.</lip>{| class="wikitable" style="width:800px;" |-| <p>usage: ros2 [-h] Call `ros2 <command> -h` for more detailed usage. ...</olp>
<span id="instructions-for-using-thep>optional arguments:</p>:<p>-logoh, -on-help show this help message and-off-the-machine">exit</spanp>== Instructions for using the logo on and off the machine ==
<span id="howp>Commands:</p>:<p>action Various action related sub-tocommands</p>:<p>bag Various rosbag related sub-turncommands</p>:<p>component Various component related sub-oncommands</p>:<p>daemon Various daemon related sub-thecommands</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-powercommands</p>:<p>multicast Various multicast related sub-buttoncommands</p>:<p>node Various node related sub-incommands</p>:<p>param Various param related sub-linux5.4"commands</p>:<p>pkg Various package related sub-commands</spanp>== How :<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 turn on the power button in Linux5.4 ==`doctor`</p>
<ol style="list-style-type: decimal;">
<li><p>First run '''orangepi-config'''Use the install_ros. Ordinary users remember sh script to add '''sudoinstall_ros.sh''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-configinstall_ros.sh ros2'''</p></li><li><p>Then select '''System'''</p>|}<p>[[File:zero2w-img80.png]]</p></li><li><p>Then select The '''Hardwareinstall_ros.sh'''</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 script will automatically run the '''spaceros2 -h''' to select command after installing ros2. If you can see the dtbo configuration of following print, it means that the SPI you want to openros2 installation is complete.</p><p>[[File{| class="wikitable" style="width:zero2w800px;" |-img270.png]]</p></li><li><p>Then select '''<Save>''' to save</p>| <p>usage: ros2 [[File:zero2w-img83.pngh]]</p></li><li><p>Then select '''Call `ros2 <Backcommand>'''</p><p>[[File:zero2w-img84h` for more detailed usage. ..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="howp>ros2 is an extensible command-to-shut-down-and-restart-the-development-board">line tool for ROS 2.</spanp>== How to shut down and restart the development board ==
<span id="linux-sdkorangepip>optional arguments:</p>:<p>-buildh, -usage-instructions">help show this help message and exit</spanp>
<span id="compilationp>Commands:</p>:<p>action Various action related sub-commands</p>:<p>bag Various rosbag related sub-commands</p>:<p>component Various component related sub-systemcommands</p>:<p>daemon Various daemon related sub-requirements"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</spanp>== Compilation system requirements ==:<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 '''test_ros.sh''' script to testwhether ROS 2 is successfully installed. If you can see the following print, it means ROS 2 can run normally.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@testorangepi:~$ '''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;" |-| <p>orangepi@orangepi:~$ '''source /opt/ros/humble/setup.bash'''</p><p>orangepi@orangepi:~$ '''lsb_release ros2 run rviz2 rviz2'''</p><p>[[File:zero2w-img254.png]]</p>|}</li><li><p>Reference documentation</p>{| class="wikitable" style="width:800px;" |-| <p>'''http://docs.ros.org/en/humble/index.html'''</p><p>[http://docs.ros.org/en/galactic/Tutorials.html '''http://docs.ros.org/en/humble/Installation/Ubuntu-Install-aDebians.html''']</p>|}</li></ol>
<ol stylespan id="listtesting-styleof-some-programming-languages-supported-by-type: lowerlinux-alpha;system"><li>For the method of replacing Tsinghua Source, please refer to the instructions on this page.</li></olspan>
<ol startspan id="2" style="listdebian-stylebullseye-type: lower-alpha;system"><li>Note that the Ubuntu version needs to be switched to 22.04.</li></olspan>=== Debian Bullseye system ===
|-
| <big><p>'''branchUse the Ctrl+D shortcut key to exit python's interactive mode.'''</p></big>| }</li><li><p>Write the '''u-boot Versionhello_world.py'''program in Python language</p>{| '''linux Kernel version'''class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''currentvim hello_world.py'''</p>| '''u-boot v2018.05'<p>print('Hello World!')</p>| }</li><li><p>The result of running '''linux5hello_world.4py'''is as follows</p>{| class="wikitable" style="width:800px;"
|-
| '''next'''| <p>orangepi@orangepi:~$ '''u-boot v2021python3 hello_world.07py'''</p>| '''linux6.1'''<p>Hello World!</p>
|}
</li></ol>'''The branch mentioned here is </li><li><p>Debian Bullseye does not the same thing as the branch of orangepi-build source code, please don't get confused. This branch is mainly used to distinguish different kernel source code versions.''' '''We define the linux5.4 bsp kernel currently provided install Java compilation tools and operating environment by Allwinner as the current branchdefault. The latest linux6.1 LTS kernel is defined as the next branch.''' After downloading, the following files and folders will be included:</p>
<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:~$ '''build.shsudo apt install -y openjdk-17-jdk''': Compile startup script</p>|}</li><li><p>After installation, you can check the Java version.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''externaljava --version''': Contains configuration files needed to compile the image, specific scripts, and source code of some programs, etc.</p>|}</li><li><p>Write the Java version of '''LICENSEhello_world.java'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi: GPL 2 license file~$ '''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 '''READMEhello_world.mdjava'''</p>{| class="wikitable" style="width: orangepi800px;" |-build documentation| </p>orangepi@orangepi:~$ '''javac hello_world.java'''</lip><li><p>orangepi@orangepi:~$ '''scriptsjava hello_world''': Common script for compiling linux images</p><p>Hello World!</p>|}</li></ol></li></ol>
</li></ol>
</li></ol> https://github.com/orangepi-xunlong/linux-orangepi/tree/'''orange-pi-5.4-sun50iw9''' <ol start="2" style="list-style-type: lower-alpha;"><li>Linux6.1</li></ol> https://github.com/orangepi-xunlong/linux-orangepi/tree/'''orange-pi-6.1-sun50iw9''' <ol start="2" style="list-style-type: lower-alpha;"><li><p>The git warehouse where the u-boot source code is stored is as follows. Please note that the branch of the u-boot-orangepi warehouse is switched toDebian Bookworm has Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li>v2018<p>The specific version of Python is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3'''</p><p>Python 3.0511.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.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>'''Use the 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>Debian Bookworm does not install Java compilation tools and operating environment by default.</p><ol style="list-style-type: lower-alpha;"><li><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 '''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>'''build.sh''': Compile startup script</p></li><li><p>'''external''': Contains the configuration files needed to compile the image, scripts for specific functions, and the source code The version of some programsa. The rootfs compressed package cached during the image compilation process gcc is also stored in external.as follows</p></li><li><p>'''kernel'''{| class="wikitable" style="width: Store the source code of the linux kernel</p></li>800px;" |-| <li><p>orangepi@orangepi:~$ '''LICENSEgcc --version''': GPL 2 license file</p></li><li><p>'''READMEgcc (Ubuntu 9.4.md''': orangepi0-build documentation1ubuntu1~20.04.1) 9.4.0</p></li><li><p>'''output''': Store compiled u-bootCopyright (C) 2019 Free Software Foundation, linux and other deb packages, compilation logs, and compiled images and other filesInc.</p></li><li><p>'''scripts''': Common script This is free software; see the source for compiling linux imagescopying conditions. There is NO</p></li><li><p>'''toolchains''': Store cross-compilation tool chainwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>|}</li><li><p>Write the '''u-boothello_world.c''': Store the source code of u-bootprogram in C language</p></li><li>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''userpatchesvim hello_world.c''': Store the configuration files needed to compile the script</p></li></ol></lip>#include <stdio.h></olp>
</li>
<li><p>If you select the next branch, you will also be prompted to select the memory size, Then compile and you do not need to select the current branchrun '''hello_world.c'''</p>{| class="wikitable" style="width:800px;" |-| </lip>orangepi@orangepi:~$ '''gcc -o hello_world hello_world.c'''</olp> <blockquotep>a. If the development board you purchased has a memory size of 1.5GB, please select the first optionorangepi@orangepi:~$ '''./hello_world'''</p><p>Hello World!</p>b. If the development board you purchased has 1GB or 2GB or 4GB memory size, please choose the second option.|}</blockquoteli></ol>[[File:zero2w-img277.png]] <ol start="6" style="list-style-type: decimal;"/li><li><p>Then it will start to compile u-boot. Some of the information prompted when compiling the next branch is as follows:Ubuntu Focal has Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li>Version <p>The specific version of uPython3 is as follows</p>{| class="wikitable" style="width:800px;" |-boot source code| <p>orangepi@orangepi:~$ '''python3'''</p><p>Python 3.8.10 (default, 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>'''Use the 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 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, sharing)</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'''</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 start="8" style="list-style-type: decimal;"><li>When <p>Ubuntu Jammy is installed with the orangepi-bulid gcc compilation tool chain by default, which can directly compile C language programs in the Linux system compiles of the udevelopment board.</p><ol style="list-boot source code, it will first synchronize the ustyle-boot source code with the utype: lower-boot source code alpha;"><li><p>The version of the github servera. Therefore, if you want to modify the ugcc is as follows</p>{| class="wikitable" style="width:800px;" |-boot source code, you first need to turn off the download and update function of the source code. (| <p>orangepi@orangepi:~$ '''You need to completely compile ugcc --boot before you can turn off this function, otherwise it will prompt that the source code of uversion'''</p><p>gcc (Ubuntu 11.3.0-boot cannot be found1ubuntu1~22.04.1) '''11.3.0'''</p><p>Copyright (C)2021 Free Software Foundation, otherwise Inc.</p><p>This is free software; see the modifications will be restoredsource for copying conditions. The method There is as followsNO</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>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.c'''</lip><p>#include <stdio.h></olp>
<ol style="list-style-type: lower-alpha;">
<li>First upload <p>The specific version of Python3 is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3'''</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>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p></big>|}</li><li><p>Write the compiled deb package '''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 urunning '''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 Jammy does not install Java compilation tools and operating environment by default.</p><ol style="list-boot style-type: lower-alpha;"><li><p>You can use the following command to install openjdk-18</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-18-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><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 Linux system Java version of the development board'''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 startspan id="5" style="listhow-to-upload-files-styleusing-type: lowerscp-alpha;command"><li>After pressing the Enter key, a Warning will pop up first.</li></olspan>==== How to upload files using scp command ====
<span id="compile-the-linux-kernel"/div></spanli>== Compile <li><p>The method of connecting the linux kernel ==development board is as shown in the figure below</p></li>
</div></ol><ol start="25" style="list-style-type: decimal;"><li>Select <p>Then choose to '''Kernel packagesave the password''' and press Enterclick '''OK'''</p><p>[[File:zero2w-img257.png]]</p></li><li><p>Then select '''Always trust this host''' and click '''OK'''</p></olli>
<div class="figure">
[[File:zero2w-img281img258.png]]
</div></ol><ol start="37" style="list-style-type: decimal;"><li>Then you will be prompted whether you need to display After the kernel configuration interface. If connection is successful, you do not need to modify can see the kernel configuration, select directory structure of the first one. If you need to modify development board's Linux file system on the kernel configuration, select right side of the second onefilezilla software.</li></ol>
<ol startdiv class="5figure" style="list-style-type: decimal;"><li>Then select the branch type of the kernel source code</li></ol>
<ol startspan id="6" style="listmethod-to-upload-files-from-windows-pc-to-development-board-stylelinux-type: decimal;system"><li>If you choose to display the kernel configuration menu (the second option) in step 3), the kernel configuration interface opened through '''make 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></olspan>
<ol stylespan id="listhow-styleto-upload-files-using-type: lowerfilezilla-alpha;1"><li/span>If you do not need ==== How to modify the kernel configuration options, when running the build.sh script, pass '''KERNEL_CONFIGUREupload files using filezilla ====no''' to temporarily block the pop-up of the kernel configuration interface.</li></ol>
<ol startdiv class="3figure" style="list-style-type: lower-alpha;"><li>The default configuration file used by the kernel and the path where it is stored are as follows</li></ol>
[ o.k. ] Using kernel config file [ '''orangepi-build/external/config/kernel/linuxFile:zero2w-6img263.1-sun50iw9-next.config''' png]]
</div></li></ol><ol start="43" style="list-style-type: lower-alphadecimal;"><li>The path to interface after opening filezilla is as shown below. At this time, the remote site on the kernel-related deb package generated by compilationright is empty.</li></ol>
<ol startdiv class="6figure" style="list-style-type: lower-alpha;"><li>Compilation time</li></ol>
[ o.k[File:zero2w-img256. png] Runtime [ '''10 min''' ]
</div></ol><ol start="75" style="list-style-type: lower-alphadecimal;"><li>Finally, the compilation command Then choose to repeatedly compile '''save the last selected kernel will be displayed. Use the following command without selecting through the graphical interface, password''' and you can directly start compiling the kernel source code.click '''OK'''</li></ol>
<ol startdiv class="9figure" style="list-style-type: decimal;"><li>When the orangepi-bulid compilation system compiles the linux kernel source code, it will first synchronize the linux kernel source code with the linux kernel source code of the github server. Therefore, if you want to modify the linux kernel source code, you first need to turn off the update function of the source code ('''it needs to be completely compiled once This function can only be turned off after obtaining the Linux kernel source code, otherwise it will prompt that the source code of the Linux kernel cannot be found'''), otherwise the modifications will be restored. The method is as follows:</li></ol>
<ol startdiv class="10figure" style="list-style-type: decimal;"><li><p>If the kernel is modified, you can use the following method to update the kernel and kernel module of the development board Linux system</p><ol style="list-style-type: lower-alpha;"><li>Upload the compiled deb package of the Linux kernel to the Linux system of the development board</li></ol></li></ol>
<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 the '''bootlogo''' variable to '''false''' in '''/boot/orangepiEnv.txt''' to turn off the switch logo.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo dpkg vim /boot/orangepiEnv.txt'''</p><p>verbosity=1</p><p>'''<span style="color:#FF0000">bootlogo=false</span>'''</p>|}</li><li><p>Set the '''bootlogo''' variable to '''true''' in '''/boot/orangepiEnv.txt''' to enable the power on/off logo.</p>{| class="wikitable" style="width:800px;" |-i linux| <p>orangepi@orangepi:~$ '''sudo vim /boot/orangepiEnv.txt'''</p><p>verbosity=1</p><p>'''<span style="color:#FF0000">bootlogo=true</span>'''</p>|}</li><li><p>The location of the boot logo picture in the Linux system is</p>{| class="wikitable" style="width:800px;" |-| <p>'''/usr/share/plymouth/themes/orangepi/watermark.png'''</p>|}</li><li><p>After replacing the boot logo image, you need to run the following command to take effect</p>{| class="wikitable" style="width:800px;" |-next| <p>orangepi@orangepi:~$ '''sudo update-initramfs -sun50iw9_x.x.x_arm64.debu'''</p>|}</li></ol>
<ol startspan id="3" style="listhow-to-styleturn-type: loweron-alpha;"><li>Then restart the development board and check whether the kernel-related modifications have taken effectpower-button-in-linux5.</li4"></olspan>
<ol start="2" style="list-style-type: decimal;"><li>Select <p>First run '''Rootfs 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 all deb packagesthen use the ''' and press Enterspace''' 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>
<div classspan id="figurehow-to-shut-down-and-restart-the-development-board"></span>
<ol style="list-style-type: 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.</divp>{| class="wikitable" style="width:800px;" |-| <ol startp>orangepi@orangepi:~$ '''sudo poweroff'''</p>|}{| class="3wikitable" style="listbackground-color:#ffffdc;width:800px;" |-| <big><p>'''Note 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>{| class="wikitable" style="background-typecolor:#ffffdc;width: decimal800px;"|-| <big><p>'''Note 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>Then select <p>Use the model of '''reboot''' command to restart the Linux system in the development board</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo''' '''reboot'''</p>|}</li></ol>
The Linux SDK, '''orangepi-build''', only supports running on X64 computers with '''<ol start="5" span style="list-style-typecolor: decimal;#FF0000">Ubuntu 22.04<li/span>Then select ''' 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 type of rootfsRelease field does not display '''</lispan style="color:#FF0000">22.04</olspan>''', 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;" |-| [[Filehttps://repo.huaweicloud.com/ubuntu-releases/21.04/ubuntu-21.04-desktop-amd64.iso '''https:zero2w//mirrors.tuna.tsinghua.edu.cn/ubuntu-img290releases/22.png]04/ubuntu-22.04-desktop-amd64.iso''']|}
<ol style="list-style-type: lower-alpha;">
<li>Type For the method of rootfsreplacing Tsinghua Source, please refer to the instructions on this page.</li></ol></li></ol> [ o.k. ] local not found [ Creating new rootfs cache for '''bullseye''' ]
{| class="wikitable" style="width:800px;"
|-
|
[https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/ '''https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/''']
|}
</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>The storage path of Note that the compiled rootfs compressed packageUbuntu version needs to be switched to 22.04.</li></ol> [ o.k. ] Target directory [ '''orangepi-build/external/cache/rootfs''' ]
[[File:zero2w-img271.png]]
</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>The name contents of the rootfs compressed package generated by compilation'''/etc/apt/sources.list''' file that need to be replaced are:</li><{| class="wikitable" style="width:800px;" |-| test@test:~$ '''sudo mv /etc/apt/sources.list cat /etc/apt/ol>sources.list.bak'''
'''#''' 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'''|}</orangepiol><ol start="5" style="list-style-type: lower-build$ alpha;"><li>'''sudo <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.</build.shspan>'''</li></ol>
<ol startspan id="2" style="listobtain-the-source-code-of-stylelinux-type: decimal;sdk"><li>Select '''Full OS image for flashing''' and press Enter</li></olspan>
<div class="figure">
[[File:zero2w-img287img272.png|center|800px]]
</div>
<ol startspan id="10" style="listdownload-the-cross-compilation-styletool-type: decimal;chain"><li>Then the compilation of the linux image will begin. The general process of compilation is as follows</li></olspan>
|-
| '''Motherboard functionsgcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu'''| '''OPi OS Arch'''}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>linux6.1</li>{| class="wikitable" style="width:800px;"
|-
| '''HDMI videogcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu'''| '''OK'''}</ol>The cross-compilation tool chain used to compile the H618 u-boot source code is: <ol style="list-style-type: lower-alpha;"><li>v2018.05</li>{| class="wikitable" style="width:800px;"
|-
| '''HDMI Audiogcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabi'''| '''OK'''}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>v2021.07</li>{| class="wikitable" style="width:800px;"
|-
| '''Typegcc-arm-C USB211.0 x 2-2022.02-x86_64-aarch64-none-linux-gnu'''| '''OK'''}</ol><span id="orangepi-build-complete-directory-structure-description"></span> === orangepi-build complete directory structure description === <ol style="list-style-type: decimal;"><li><p>After downloading, the orangepi-build warehouse does not contain the source code of the linux kernel, u-boot and cross-compilation tool chain. The source code of the linux kernel and u-boot is stored in an independent git warehouse.</p><ol style="list-style-type: lower-alpha;"><li><p>The git warehouse where the linux kernel source code is stored is as follows. Please note that the branch of the linux-orangepi warehouse is switched to</p><ol style="list-style-type: none;"><li>a) Linux5.4</li>{| class="wikitable" style="width:800px;"
|-
| https://github.com/orangepi-xunlong/linux-orangepi/tree/'''TF Card Startuporange-pi-5.4-sun50iw9'''| '''OK'''}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>b) Linux6.1</li>{| class="wikitable" style="width:800px;"
|-
| https://github.com/orangepi-xunlong/linux-orangepi/tree/'''WIFIorange-pi-6.1-sun50iw9'''| '''OK'''}</ol></li></ol><ol start="2" style="list-style-type: lower-alpha;"><li><p>The git warehouse where the u-boot source code is stored is as follows. Please note that the branch of the u-boot-orangepi warehouse is switched to</p><ol style="list-style-type: lower-alpha;"><li>a) v2018.05</li>{| class="wikitable" style="width:800px;"
|-
| https://github.com/orangepi-xunlong/u-boot-orangepi/tree/'''Bluetoothv2018.05-h618'''| '''OK'''}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>b) v2021.07</li>{| class="wikitable" style="width:800px;"
|-
| https://github.com/orangepi-xunlong/u-boot-orangepi/tree/'''LED Lightv2021.07-sunxi'''| }</ol></li></ol></li></ol><ol start="2" style="list-style-type: decimal;"><li><p>When orangepi-build is run for the first time, it will download the cross-compilation tool chain, u-boot and linux kernel source code. After successfully compiling a linux image, the files and folders that can be seen in orangepi-build are:</p><ol style="list-style-type: lower-alpha;"><li><p>'''OKbuild.sh''': Compile startup script</p></li><li><p>'''external''': Contains the configuration files needed to compile the image, scripts for specific functions, and the source code of some programs. The rootfs compressed package cached during the image compilation process is also stored in external.</p></li><li><p>'''kernel''': Store the source code of the linux kernel</p></li><li><p>'''LICENSE''': GPL 2 license file</p></li><li><p>'''README.md''': orangepi-build documentation</p></li><li><p>'''output''': Store compiled u-boot, linux and other deb packages, compilation logs, and compiled images and other files</p></li><li><p>'''scripts''': Common script for compiling linux images</p></li><li><p>'''toolchains''': Store cross-compilation tool chain</p></li><li><p>'''u-boot''': Store the source code of u-boot</p></li><li><p>'''userpatches''': Store the configuration files needed to compile the script</p></li>{| class="wikitable" style="width:800px;"
|-
| test@test:~/orangepi-build$ '''40pin GPIOls'''| '''OKbuild.sh external kernel LICENSE output README.md scripts toolchains u-boot userpatches'''|}</ol></li></ol> <span id="compile-u-boot"></span> == Compile u-boot == # Run the build.sh script, remember to add sudo permissions {| class="wikitable" style="width:800px;"
|-
| '''40pin I2C'''| '''OK'''|-| '''40pin SPI'''| '''OK'''|test@test:~/orangepi-| '''40pin UART'''| '''OK'''|-| '''40pin PWM'''| '''OK'''|-| '''Temperature Sensor'''| '''OK'''|-| '''Hardware watchdog'''| '''OK'''|-| '''Mali GPU'''| '''NO'''|-| '''Video codec'''| build$ '''NOsudo ./build.sh'''
|}
<span iddiv class="orange-pi-os-arch-system-user-guide-instructionsfigure"></span>== Orange Pi OS Arch System User Guide Instructions ==
[[File:zero2w-img275.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>Then select the branch type of u-boot</p>
<ol style="list-style-type: lower-alpha;">
<li><p>After burning The current branch will compile the u-boot v2018.05 version code that needs to be used by the linux5.4 image.</p></li><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-img276.png]]</p></li></ol></li><li><p>If you select the systemnext branch, when you start it for will also be prompted to select the first time memory size, and enter you do not need to select the desktopcurrent 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></ol><ol start="6" style="list-style-type: decimal;"><li><p>Then it will see start to compile u-boot. Some of the information prompted when compiling the 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 [ '''v2021.07''' ]|}</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 [ '''aarch64-linux-gnu-gcc 11''' ]|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>Path to the user wizard program shown in compiled u-boot deb package</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Target directory [ '''orangepi-build/output/debs/u-boot''' ]|}</ol><ol start="4" style="list-style-type: lower-alpha;"><li>The package name of the figure belowcompiled u-boot deb package</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] File name [ '''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb''' ]|}</pol><ol start="5" style="list-style-type: lower-alpha;"><li>Compilation time</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Runtime [ '''1 min''' ]|}</ol><ol start="6" style="list-style-type: lower-alpha;"><div li>Repeat the command to compile u-boot. Use the following command without selecting through the graphical interface. You can start compiling u-boot directly.</li>{| class="figurewikitable" style="width:800px;" |-| [ o.k. ] Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=u-boot''' ]|}</ol></li></ol><ol start="7" style="list-style-type: decimal;"><li>View the compiled u-boot deb package</li>{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''ls output/debs/u-boot/'''
......|}</divol></liol start="9" style="list-style-type: decimal;"><li><p>Then select When debugging u-boot code, you can use the areafollowing method to update u-boot in the linux image for testing</p><div ol style="list-style-type: lower-alpha;"><li>First upload the compiled deb package of u-boot to the Linux system of the development board.</li>{| class="figurewikitable">style="width:800px;" |-| test@test:~/orangepi-build$ '''cd output/debs/u-boot'''
'''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb [mailto:root@192.168.1.xxx:/root root@192.168.1.xxx:/root]'''|}</divol><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:~$ '''sudo dpkg -i''' '''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb'''|}<li/ol><ol start="3" style="list-style-type: lower-alpha;"><pli>Then select run the keyboard modelnand-sata-install script</pli>{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''sudo nand-sata-install'''|}<div class/ol><ol start="4" style="figurelist-style-type: lower-alpha;"><li>Then select '''5 Install/Update the bootloader on SD/eMMC'''</li>
[[File:zero2w-img297img278.png]]</ol><ol start="5" style="list-style-type: lower-alpha;"><li>After pressing the Enter key, a Warning will pop up first.</li>
[[File:zero2w-img279.png]]</divol></liol start="6" style="list-style-type: lower-alpha;"><li><p>Then create a new username and set a passwordPress the Enter key again to start updating u-boot. After the update is completed, the following information will be displayed.</p><div class="figure"li>
[[File:zero2w-img298img280.png]]</ol><ol start="7" style="list-style-type: lower-alpha;"><li>Then you can restart the development board to test whether the u-boot modification has taken effect.</li></ol></li></ol><span id="compile-the-linux-kernel"></span>
<div class="figure">
[[File:zero2w-img301img281.png]]
</div></liol><liol start="3" style="list-style-type: decimal;"><pli>The Orange Pi Hello program Then you will automatically start after restartingbe prompted whether you need to display the kernel configuration interface. At this time, If you do not need to remove modify the check '''mark of Start on startup''' in kernel configuration, select the lower right corner, otherwise first one. If you need to manually close modify the kernel configuration, select the Orange Pi Hello program every time you start itsecond one.</p><div class="figure"li>
[[File:zero2w-img302img282.png]]</ol><ol start="4" style="list-style-type: decimal;"><li>Then select the model of the development board</li>
[[File:zero2w-img275.png]]</divol><pol start="5" style="list-style-type: decimal;">At this point, you can use <li>Then select the newly created username and password to log in to branch type of the OPi OS system through the serial port or ssh.</p>kernel source code</li></ol>
::b. The multiplexing functions such as I2C/SPI/UART/PWM in the 40-pin development board are turned off by default in next branch will compile the linux6.1 kernel's dts, and the corresponding DT overlays need to be manually turned on before they can be used.source code
|-
| [ o.k. ] Compiling current kernel [ '''Functions on the development board6.1.31''']|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>The version of the cross-compilation tool chain used</li>{| '''Corresponding DT overlays configuration'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] Compiler version [ '''40pin aarch64- i2c0linux-gnu-gcc 11''']| '''sun50i}</ol><ol start="3" style="list-h616style-pitype: lower-i2c0.dtbo'''alpha;"><li>The default configuration file used by the kernel and the path where it is stored are as follows</li>{| class="wikitable" style="width:800px;"
|-
| [ o.k. ] Using kernel config file [ '''40pin orangepi-build/external/config/kernel/linux- i2c16.1-sun50iw9-next.config''']| '''sun50i}</ol><ol start="4" style="list-style-h616type: lower-pialpha;"><li>The path to the kernel-i2c1.dtbo'''related deb package generated by compilation</li>{| class="wikitable" style="width:800px;"
|-
| [ o.k. ] Target directory [ '''40pin - i2c2output/debs/''']| '''sun50i}</ol><ol start="5" style="list-h616style-pitype: lower-i2c2.dtbo'''alpha;"><li>The package name of the kernel image deb package generated by compilation</li>{| class="wikitable" style="width:800px;"
|-
| [ o.k. ] File name [ '''40pin linux-image-next- uart2sun50iw9_x.x.x_arm64.deb''']| '''sun50i}</ol><ol start="6" style="list-h616style-pitype: lower-uart2.dtbo'''alpha;"><li>Compilation time</li>{| class="wikitable" style="width:800px;"
|-
| [ o.k. ] Runtime [ '''40pin - uart310 min''']| '''sun50i}</ol><ol start="7" style="list-h616style-pitype: lower-uart3alpha;"><li>Finally, the compilation command to repeatedly compile the last selected kernel will be displayed. Use the following command without selecting through the graphical interface, and you can directly start compiling the kernel source code.dtbo'''</li>{| class="wikitable" style="width:800px;"
|-
| [ o.k. ] Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=kernel KERNEL_CONFIGURE=no''' ]|}</ol></li></ol><ol start="8" style="list-style-type: decimal;"><li><p>View the kernel-related deb package generated by compilation</p><ol style="list-style-type: lower-alpha;"><li><p>'''linux-dtb-next-sun50iw9_x.x.x_arm64.deb''' Contains dtb files used by the kernel</p></li><li><p>'''40pin linux-headers-next- uart4sun50iw9_x.x.x_arm64.deb'''Contains kernel header files</p></li>| <li><p>'''sun50ilinux-h616image-pinext-uart4sun50iw9_x.x.x_arm64.dtbodeb'''Contains kernel images and kernel modules</p></li>{| class="wikitable" style="width:800px;"
|-
| '''40pin - uart5'''| '''sun50i-h616-ph-uart5.dtbo'''|-| '''40pin - pwm1'''| '''sun50i-h616-pi-pwm1.dtbo'''|-| '''40pin - pwm2'''| '''sun50i-h616-pi-pwm2.dtbo'''|test@test:~/orangepi-| build$ '''40pin ls output/debs/linux- pwm3'''| *'''sun50i-h616-pi-pwm3.dtbo'''|-| '''40pin - pwm4'''| '''sun50i-h616-pi-pwm4.dtbo'''|-| '''40pin - spi1 cs0'''| '''sun50i-h616-spi1-cs0-spidev.dtbo'''|-| '''40pin - spi1 cs1'''| '''sun50i-h616-spi1-cs1-spidev.dtbo'''|-| '''40pin - spi1 cs0 cs1'''| '''sun50i-h616-spi1-cs0-cs1-spidev.dtbo'''|-| '''设Set USB0 to Host mode'''| '''sun50i-h616-usb0-host.dtbo'''|-| '''Turn off the green LED light'''| '''sun50i-h616-zero2w-disable-led.dtbo'''|-| '''How to close the UART0 debugging serial port'''| '''sun50i-h616-disable-uart0.dtbo'''|}
IGNORE_UPDATES="'''FDTOVERLAYS <span style="color:#FF0000">yes</dtbs/allwinner/overlay/sun50i-h616-pi-i2c1.dtbo /dtbs/allwinner/overlay/sun50i-h616-ph-uart5.dtbospan>'''"|}</ol><ol start="610" style="list-style-type: decimal;"><li>After setting<p>If the kernel is modified, you need can use the following method to restart update the kernel and kernel module of the development board Linux system for </p><ol style="list-style-type: lower-alpha;"><li>Upload the compiled deb package of the configuration Linux kernel to take effect.the Linux system of the development board</li><{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''cd output/ol>debs'''
'''linux-image-next-sun50iw9_x.x.x_arm64.deb root@192.168.1.xxx:/root'''|}</ol><span idol start="2" style="howlist-tostyle-installtype: lower-softwarealpha;"><li>Install the deb package of the new linux kernel just uploaded.</spanli>{| class="wikitable" style= How to install software "width:800px;" |-| orangepi@orangepi:~$ '''sudo dpkg -i linux-image-next-sun50iw9_x.x.x_arm64.deb'''|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>Then restart the development board and check whether the kernel-related modifications have taken effect.</li>{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''sudo''' '''reboot'''|}</ol></li></ol><span id="compile-rootfs"></span>
<ol start= "2" style="list-style-type: decimal;"><li>Select '''Android 12 TV system usage instructionsRootfs and all deb packages''' =and press Enter</li>
<span iddiv class="supported-android-versionsfigure"></span>== Supported Android versions ==
<span id/div></ol><ol start="android3" style="list-12style-tv-function-adaptation-statustype: decimal;"><li>Then select the model of the development board</spanli>== Android 12 TV function adaptation status ==
|-
| [ o.k. ] local not found [ Creating new rootfs cache for '''HDMI videobullseye''']|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>The storage path of the compiled rootfs compressed package</li>{| '''OK'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] Target directory [ '''HDMI Audioorangepi-build/external/cache/rootfs''']|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>The name of the rootfs compressed package generated by compilation</li>{| '''OK'''class="wikitable" style="width:800px;"
|-
| '''Type-C USB2[ o.k.0 x 2'] File name [ ''| '''OK'''|bullseye-| '''TF card startup'''| '''OK'''|xfce-| '''WIFI'''| '''OK'''|-| '''Bluetooth'''| '''OK'''|-| '''USB Camera'''| '''OK'''|-| '''LED Light'''| '''OK'''|-| '''40pin GPIO'''| '''OK'''|-| '''40pin I2C'''| '''OK'''|-| '''40pin SPI1'''| '''OK'''|-| '''40pin UART'''| '''OK'''|-| '''40pin PWM'''| '''OK'''|-| '''Temperature Sensor'''| '''OK'''|-| '''Hardware watchdog'''| '''OK'''|-| '''Mali GPU'''| '''OK'''|-| '''Video codec'''| '''OKarm64.5250ec7002de9e81a41de169f1f89721.tar.lz4''']
|}
</ol>
</li></ol>
<ol start="10" style="list-style-type: decimal;">
<li><p>View the compiled rootfs compressed package</p>
<ol style="list-style-type: lower-alpha;">
<li>'''bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4''' It is a compressed package of rootfs. The meaning of each field in the name is</li>
:a) '''bullseye''' represents the type of Linux distribution of rootfs
:b) '''xfce''' indicates that the rootfs is the desktop version, and if it is cli, it indicates the server version.
:c) '''arm64''' represents the architecture type of rootfs
:d) '''25250ec7002de9e81a41de169f1f89721''' is the MD5 hash value generated by the package names of all software packages installed by rootfs. As long as the list of software packages installed by rootfs is not modified, this value will not change. The compilation script will use this MD5 hash value. Determine whether rootfs needs to be recompiled</ol><ol start="2" style="list-style-type: lower-alpha;"><li>'''bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4.list''' Lists the package names of all packages installed by rootfs</li>{| class="wikitable" style="width:800px;"
|-
| '''24pin Expansion board function'''| '''Android12 TV'''|test@test:~/orangepi-| build$ '''100M network portls external/cache/rootfs/'''| '''OK'''|bullseye-| '''100M Ethernet port light'''| '''OK'''|xfce-| '''USB2arm64.5250ec7002de9e81a41de169f1f89721.tar.0 HOST x 2'''lz4| '''OK'''|bullseye-| '''Infrared reception'''| '''OK'''|xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4.current| '''Headphone audio playback'''| '''OK'''|bullseye-| '''On/off button'''| '''OK'''|xfce-| '''LRADC''' '''Custom buttons x 2'''| '''OK, The default setting is the volume up and down keysarm64.5250ec7002de9e81a41de169f1f89721.tar.lz4.'''|-| '''TV-OUT'''| '''OK'''list
|}
</ol>
</li></ol>
<ol start="11" style="list-style-type: decimal;">
<li>If the required rootfs already exists under '''external/cache/rootfs''', then compiling the rootfs again will directly skip the compilation process and will not restart the compilation. When compiling the image, it will also go to '''external/cache/rootfs''' to check whether it already exists. There is a cached rootfs available. If it is available, use it directly. This can save a lot of download and compilation time.</li></ol>
<span id="compile-linux-image"></span>
== Compile linux image ==
::{| class="wikitable" style="width:800px;"
|-
|| '''green light'''| '''red light'''|-| '''u-boot startup phase'''| '''Off'''| '''on'''|test@test:~/orangepi-| '''Kernel boot to enter the system'''| '''on'''| build$ '''onsudo ./build.sh'''
|}
<span idol start="how2" style="list-tostyle-return-to-the-previous-interface-in-androidtype: decimal;"><li>Select '''Full OS image for flashing''' and press Enter</spanli>== How to return to the previous interface in Android ==
[[File:zero2w-img275.png]]</ol><span idol start="4" style="how-tolist-usestyle-adbtype: decimal;"><li><p>Then select the branch type of the kernel source code. Different versions of the kernel source code maintain different rootfs types.</spanp>== How to use ADB == <span idol style="uselist-networkstyle-connectiontype: lower-adb-debuggingalpha;"><li><p>In the current branch, you can see three options: debian11, ubuntu20.04, and ubuntu22.04.</p></spanli>=== Use network connection adb debugging ===<li><p>In the next branch, you can see three options: debian11, debian12, and ubuntu22.04.</p></li>
[service.adb.tcp[File:zero2w-img287.portpng]: [5555]
</div></ol></li></ol><ol start="28" 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 ('''serviceplease do not choose the Minimal version without special needs, because many things are not pre-installed by default.adb.tcp.portSome functions may not be available''' is not set, you can use the following command in the serial port to set the port number of the network adb)</li></ol>
</div></ol><ol start="39" style="list-style-type: decimal;"><li>Install adb tool on Ubuntu PCIf you are compiling a desktop version of the image, you also need to select the type of desktop environment. Currently, only XFCE is maintained, so please select an XFCE type desktop.</li></ol>
<ol style="list-style-type: lower-alpha;">
<li>HDMI The storage path of the compiled image</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Done building [ '''output/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;"><li>Compilation time</li>{| class="wikitable" style="width:800px;" |-| '''[ o.k. ] Runtime [ 19 min ]'''|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>Repeat the command to VGA convertercompile the image. Use the following command to start compiling the image directly without selecting it through the graphical interface.</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=image RELEASE=bullseye BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_CONFIGURE=yes''' ]|}</ol>
</li></ol>
<span id="instructions-for-using-the-orange-pi-os-arch-system"></span>
<ol startspan id="2" style="listorange-pi-os-arch-system-stylefunction-type: loweradaptation-alpha;status"><li>A VGA cable and a Mini HDMI male to HDMI female adapter</li></olspan>== Orange Pi OS Arch system function adaptation status ==
</div></li>
<li><p>Then select the keyboard model</p>
<div class="figure">
[[File:zero2w-img317img297.png]] </div><ol start="6" style="list-style-type: decimal;"><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></ol>
</div></li>
<li><p>Then create a new username and set a password</p>
<div class="figure">
[[File:zero2w-img318img298.png]]
</div><ol start="7" style="list-style-type: decimal;"/li><li>The display after successful WI-FI connection <p>Then make sure there is as shown belowno problem with the selection, and then click the install '''button'''</lip></oldiv class="figure">
[[File:zero2w-img319img299.png]]
<span id="how-to-use-wi-fi-hotspot"/div></spanli>== How <li><p>Then wait for the installation to use WI-FI hotspot =complete</p><div class="figure">
<ol startspan id="5" style="listhow-to-set-styledt-type: decimal;overlays"><li/span>Then open '''Hotspot Enable'''. You can also see the name and password of the generated hotspot in the picture below. Remember them and use them when connecting == How 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></ol>set DT overlays ==
'''FDTOVERLAYS /dtbs/allwinner/overlay/<span style="color:#FF0000">xxx.dtbo</span>''' #Configuration that needs to be added
|}
</ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then Open <p>The storage path of xxx.dtbo in the OPi OS Arch image is as follows. Please note that not all dtbo under this path can be used.</p>{| class="wikitable" style="width:800px;" |-| <p>'''Bluetooth Enable/boot/dtbs/allwinner/overlay/'''</p>|}</li><li><p>The DT overlays configuration that can be used by the development board is as follows</p></olli>
'''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="106" style="list-style-type: decimal;"><li>Pictures received by After setting, you need to restart the Bluetooth system of for the development board Android system can be viewed in configuration to take effect.</li>{| class="wikitable" style="width:800px;" |-| [orangepi@orangepi-pc ~]$ '''Received filessudo reboot'''.|}</liol><span id="how-to-install-software"></olspan>
<span id="androidhow-systemto-rootuse-descriptionadb"></span>== Android system ROOT description How to use ADB ==
{| class="wikitable" style="background-color:# Download from the ffffdc;width:800px;" |-| <big>'''official toolUsing network adb does not require a USB Typc C interface data cable to connect the computer and the development board. Instead, it communicates through the network, so first make sure that the development board''' on s wired or wireless network is connected, and then obtain the IP address of the development board data download page '''rootcheck.apkNext To be used.'''</big>|}
[[File:zero2w-img339service.adb.tcp.pngport]: [5555]|}
<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 "If '''How to use ADB'''"service.</p></li><li><p>Then use the adb command to install rootcheck.apk into the Android systemtcp. Of courseport''' is not set, you can also use a USB disk copy the following command in the serial port to install it.set the port number of the network adb</pli><{| class="wikitable" style="width:800px;" |-| apollo-p2:/li><# '''setprop service.adb.tcp.port 5555''' apollo-p2:/ol># '''stop adbd'''
apollo-p2:/ # '''start adbd'''|}</ol><ol start="3" style="list-style-type: decimal;"><li>Install adb tool on Ubuntu PC</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''adb install rootcheck.apksudo apt-get update'''
test@test:~$ '''sudo apt-get install -y adb'''
|}
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>After installation, you can see Then connect network adb on Ubuntu PC</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''adb connect 192.168.1.xxx:5555''' '''(Need to be modified to the startup icon IP address of the ROOT test tool on the Android desktop.development board)''' <p>* daemon not running; starting now at tcp:5037</lip> <p>* daemon started successfully</olp>
apollo-p2:/ #|}</ol><span id="how-to-use-miracastreceiver-to-cast-the-mobiledata-phone-screencable-to-theconnect-developmentadb-boarddebugging"></span>== How to use MiracastReceiver to cast the mobile phone screen to the development board ==
<span idol start="method-of-turning-on-and-off-the-machine-through-buttons-or-infrared2" style="list-remotestyle-controltype: decimal;"><li>Install adb tool on Ubuntu PC</spanli>{| class="wikitable" style= Method of turning on and off the machine through buttons or infrared remote control =="width:800px;" |-| test@test:~$ '''sudo apt-get update'''
<ol style="list-style-type: decimal;"><li><p>Enter first '''Settings'''</p><p>[[File:zero2w-img306.png]]</p></li><li><p>Then select '''Device Preferences'''</p><p>[[File:zero2w-img307.png]]</p></li><li><p>Then select '''Display & Sound'''</p><p>[[File:zero2w-img308.png]]</p></li><li><p>Then select '''Advanced display settings'''</p><p>[[File:zero2w-img309.png]]</p></li><li><p>Then select '''HDMI output mode'''</p><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-img349img312.png]]</p></li></ol>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note: The pin header on When 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 40pin Mini HDMI interface of the development board to display normally. So if there is a problem with the test, please check whether there is not soldered by defaulta problem with the HDMI to VGA converter, VGA cable and you need to solder it yourself before it can be usedmonitor.'''</big>|}</ol><span id="wi-fi-connection-method"></span>
# First open wiringOP APP on the desktopChoose first '''Settings'''
::[[File:zero2w-img351img306.png]]
<ol start="2" style="list-style-type: decimal;">
<li>Then click the select '''GPIO_TESTNetwork & Internet''' button to open the GPIO test interface</li></ol> [[File:zero2w-img352.png]]
[[File:zero2w-img314.png]]
</ol>
<ol start="3" style="list-style-type: decimal;">
<li>The GPIO test interface is as shown in the figure below. The two rows of '''CheckBox''' buttons Then turn on the left have a oneWI-to-one correspondence with the 40pin pins. When the '''CheckBox''' button is checked, the corresponding GPIO pin will be set to '''OUT''' mode and the pin level is set to high level; when unchecked, the GPIO pin level will be set to low level; when the GPIO is clicked When you click the '''GPIO READALL''' button, you can get information such as wPi number, GPIO mode, pin level, etc.; when you click the'''BLINK ALL GPIO''' button, all GPIO ports will cycle through outputting high and low levels. This function can be used to test all the 40pin pins. GPIO port.FI</li></ol>
[[File:zero2w-img353img315.png]]</ol><ol start="4" style="list-style-type: decimal;"><li>After turning on WI-FI, you can see the searched signals under '''Available networks'''.</li>
[[File:zero2w-img316.png]]</ol><ol start="45" style="list-style-type: decimal;"><li>Then click After selecting the '''GPIO READALL''' buttonWI-FI you want to connect to, and the output information is as password input interface shown below:will pop up.</li></ol>
<div class="figure">
[[File:zero2w-img354img317.png]]
</div></ol><ol start="56" style="list-style-type: decimal;"><li>There are a total of 28 GPIO ports available in Then use the 40-pin development board. The following takes pin 12 - corresponding keyboard to GPIO PI01 - enter the password corresponding to wPi serial number 6 the WI- as an example to demonstrate how to set the high FI, and low levels of then use the GPIO port. First mouse to click the '''CheckBox''' Enter button corresponding to pin 12. When on the button is selected, pin 12 will be set virtual keyboard to high level. After setting, you can use a multimeter start connecting to measure the value of the voltage of the pin. If it is '''3.3v''', it means the setting High level successWI-FI.</li></ol>
</div></ol>
<ol start="7" style="list-style-type: decimal;">
<li>Click the '''CheckBox''' button in the picture The display after successful WI-FI connection is as shown below again to uncheck it, and pin 12 will be set to 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 setting is successful.</li></ol>
[[File:zero2w-img357img319.png]]</ol><span id="how-to-use-wi-fi-hotspot"></span>
|-
| apollo-p2:/ # '''269cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_host'''| '''PI13'''| '''PWM3'''host_chose finished! | '''7'''apollo-p2:/ #|}| '''8'''</ol>| '''UART0_TX'''<ol start="2" style="list-style-type: lower-alpha;">| '''PH0'''<li>Run the following command to switch back to Device mode</li>{| '''224'''class="wikitable" style="width:800px;"
|-
|-
| apollo-p2:/ # '''226cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/otg_role''' usb_host| '''PH2'''}</ol><span id="how-to-use-usb-camera"></span> == How to use USB camera ==| '''UART5_TX'''| '''11'''# First insert the USB (UVC protocol) camera into the USB interface of the development board|# If the USB camera is recognized normally, the corresponding video device node will be generated under /dev| '''12'''::{| class="wikitable" style="text-alignwidth: left800px;"|| '''PI1'''| '''257'''
|-
| console:/ # '''227ls /dev/video0''' /dev/video0| '''PH3'''} <ol start="3" 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| '''UART5_RXHow to use ADB''']]".</p></li>| <li><p>Download the USB camera test APP from the '''13official tool'''on the development board information download page</p></li> |<div class="figure"> [[File:zero2w-img336.png]] </div><div class="figure"> [[File:zero2w-img337.png]]| '''14'''| '''GND'''</div></ol>| <ol start="5" style="textlist-style-aligntype: leftdecimal;"|><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="text-alignwidth: left800px;"|
|-
| test@test:~$ '''261adb install usbcamera.apk'''| '''PI5'''}</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> [[File:zero2w-img338.png]]</ol><ol start="7" style="list-style-type: decimal;">| '''UART2_TX'''<li>Then double-click to open the USB camera APP and you can see the output video of the USB camera.</li></ol>| '''15'''|<span id="android-system-root-description"></span>| '''16'''| '''PWM4'''== Android system ROOT description ==| '''PI14'''{| '''270'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|-
| test@test:~$ '''231adb 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.</li> [[File:zero2w-img340.png]]</ol><ol start="5" style="list-style-type: decimal;"><li>The display interface after opening the '''PH7ROOT test tool'''for the first time is as shown below</li>| '''SPI1_MOSI'''| [[File:zero2w-img341.png]]</ol><ol start="6" style="list-style-type: decimal;"><li>Then you can click '''19CHECK NOW'''to start checking the ROOT status 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.</li>|| '''20'''[[File:zero2w-img342.png]]| '''GND'''</ol>| style<span id="texthow-align: left;to-use-miracastreceiver-to-cast-the-mobile-phone-screen-to-the-development-board"|></span> == How to use MiracastReceiver to cast the mobile phone screen to the development board == | <ol style="textlist-alignstyle-type: leftdecimal;"|>|<li><p>First, please make sure that both the development board and the mobile phone are connected to the same WIFI hotspot. For the method of connecting the development board to WIFI, please refer to [[Orange Pi Zero 2W#WI-FI connection method| '''232the instructions in the WI-FI connection method.''']]</p></li>| <li><p>Then open the '''PH8MiracastReceiver'''application in the Android system of the development board</p><p>[[File:zero2w-img343.png]]</p></li>| <li><p>The interface after '''SPI1_MISOMiracastReceiver'''is opened is as follows</p><div class="figure"> [[File:zero2w-img344.png]]| </div></li><li><p>Then find the screen mirroring function in the phone settings. Here we take '''21Xiaomi 12S Pro mobile phone'''as an example. Please research other brands of mobile phones by yourself. As shown in the picture below, click the button in the red box to open the screen mirroring function of the phone.</p>|<p>[[File:zero2w-img345.png]]</p></li><li><p>After waiting for a period of time, you will be able to see the searched connectable devices on your mobile phone, and then we can select the device corresponding to the development board to connect.</p><p>[[File:zero2w-img346.png]]</p></li>| <li><p>Then the selection box shown in the figure below will pop up in the '''22MiracastReceiver'''| application interface of the development board. Here we can select '''UART2_RXAccept'''</p><p>[[File:zero2w-img347.png]]</p></li>| '''PI6'''<li><p>Then you can see the content of the mobile phone screen on the HDMI screen connected to the development board</p><p>[[File:zero2w-img348.png]]</p></li></ol> <span id="method-of-turning-on-and-off-the-machine-through-buttons-or-infrared-remote-control"></span> == Method of turning on and off the machine through buttons or infrared remote control == We can turn off or turn on the Android system of the development board through the power on/off button or infrared remote control. However, it should be noted that there is no power on/off button and infrared receiver on the main board of the development board, and it needs to be expanded through a 24pin expansion board. [[File:zero2w-img107.png]] The location of the power button on the 24pin expansion board is as shown in the figure below: [[File:zero2w-img269.png]] The location of the infrared remote control power button is as follows:| '''262'''|[[File:zero2w-img349.png]] | When shutting down, we need to press and hold the power button or the power button on the infrared remote control, and then the Android system will pop up the confirmation dialog box shown in the figure below, and then select '''230OK'''to shut down the Android system.| '''PH6'''| '''SPI1_CLK'''[[File:zero2w-img350.png]] | '''23'''After shutting down, press and hold the power button or the power button on the infrared remote control again to turn it on.|| '''24'''<span id="pin-interface-gpio-uart-spi-test"></span>| '''SPI1_CS0'''== 40pin interface GPIO, UART, SPI test ==| '''PH5'''{| '''229'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big>'''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.'''</big>|} <span id="pin-gpio-port-test-method"></span>=== 40pin GPIO port test method === # First open wiringOP APP on the desktop ::[[File:zero2w-img351.png]] <ol start="2" style="textlist-style-aligntype: leftdecimal;"|><li>Then click the '''GPIO_TEST''' button to open the GPIO test interface</li> [[File:zero2w-img352.png]]</ol>| <ol start="3" style="textlist-style-aligntype: leftdecimal;"|>| <li>The GPIO test interface is as shown in the figure below. The two rows of '''CheckBox''' buttons on the left have a one-to-one correspondence with the 40pin pins. When the '''CheckBox''' button is checked, the corresponding GPIO pin will be set to '''GNDOUT'''| mode and the pin level is set to high level; when unchecked, the GPIO pin level will be set to low level; when the GPIO is clicked When you click the '''25GPIO READALL'''|| button, you can get information such as wPi number, GPIO mode, pin level, etc.; when you click the'''26BLINK ALL GPIO'''button, all GPIO ports will cycle through outputting high and low levels. This function can be used to test all the 40pin pins. GPIO port.</li> [[File:zero2w-img353.png]]</ol><ol start="4" style="list-style-type: decimal;">| <li>Then click the '''SPI1_CS1GPIO READALL'''button, and the output information is as shown below:</li> | <div class="figure"> [[File:zero2w-img354.png]] </div></ol><ol start="5" style="list-style-type: decimal;"><li>There are 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 of the GPIO port. First click the '''PH9CheckBox'''| button corresponding to pin 12. When the button is selected, pin 12 will be set to high level. After setting, you can use a multimeter to measure the value of the voltage of the pin. If it is '''2333.3v''', it means the setting High level success.</li> [[File:zero2w-img355.png]]|</ol><ol start="6" style="list-style-type: decimal;">| <li>Then click the '''GPIO READALL''' button and you can see that the current pin 12 mode is '''266OUT'''and the pin level is high level.</li>| [[File:zero2w-img356.png]]</ol><ol start="7" style="list-style-type: decimal;"><li>Click the '''PI10CheckBox'''| button in the picture below again to uncheck it, and pin 12 will be set to low level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is '''TWI2-SDA0v''', it means the low level setting is successful.</li> [[File:zero2w-img357.png]]</ol>| <ol start="8" style="list-style-type: decimal;"><li>Then click the '''27GPIO READALL'''button and you can see that the current pin 12 mode is OUT and the pin level is low level.</li> [[File:zero2w-img358.png]]</ol><span id="pin-uart-test-method"></span> === 40pin UART test method === # As can be seen from the table below, the default uarts available in the Android12 TV system are uart2 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="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''28GPIO NO.'''| '''TWI2-SCLGPIO'''| '''PI9Function'''| '''265Pin'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-
| '''264'''
| '''PI8'''
| '''TWI1-SDA'''
| '''3'''
|-
| '''271263'''| '''PI15PI7'''| style="text'''TWI1-align: left;"|SCL'''| '''315'''|-| '''32269'''| '''PWM1PI13'''| '''PI11PWM3'''| '''2677'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''9'''
|-
| '''<span style="color:#FF0000">226</span>'''
| '''<span style="color:#FF0000">PH2</span>'''
| '''<span style="color:#FF0000">UART5_TX</span>'''
| '''<span style="color:#FF0000">11</span>'''
|-
| '''<span style="color:#FF0000">227</span>'''
| '''<span style="color:#FF0000">PH3</span>'''
| '''<span style="color:#FF0000">UART5_RX</span>'''
| '''<span style="color:#FF0000">13</span>'''
|-
| '''<span style="color:#FF0000">261</span>'''
| '''<span style="color:#FF0000">PI5</span>'''
| '''<span style="color:#FF0000">UART2_TX</span>'''
| '''<span style="color:#FF0000">15</span>'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''PC123.3V'''| '''7617'''|-| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''
|-
| '''272230'''| '''PI16PH6'''| style="text-align: left;"|| '''37'''|| '''38'''| style="text-align: left;"|| '''PI4SPI1_CLK'''| '''26023'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''3925'''|-| '''40266'''| '''PI10'''| '''TWI2-SDA'''| '''27'''|-| '''256'''| '''PI0'''
| style="text-align: left;"|
| '''PI329'''| '''259'''|} <ol start="2" style="list-style-type: decimal;"><li>The device node corresponding to uart2 is '''/dev/ttyAS2''', and the device node corresponding to uart5 is'''/dev/ttyAS5'''</li></ol> apollo-p2:/ # ls /dev/ttyAS* /dev/ttyAS0 /dev/ttyAS1 '''/dev/ttyAS2 /dev/ttyAS5''' <ol start="3" style="list-style-type: decimal;"><li>First open wiringOP APP on the desktop</li></ol> [[File:zero2w-img351.png]] <ol start="4" style="list-style-type: decimal;"><li>Then click the '''UART_TEST'''button to open the UART test interface</li></ol> [[File:zero2w-img359.png]] <ol start="5" style="list-style-type: decimal;"><li>The serial port test interface of wiringOP is as shown in the figure below</li></ol> [[File:zero2w-img360.png]] <ol start="6" style="list-style-type: decimal;"><li><p>Then select the '''/dev/ttyAS2''' or'''/dev/ttyAS5''' node in the selection box</p><p>[[File:zero2w-img361.png]]</p></li><li><p>Enter the baud rate you want to set in the edit box, and then click the '''OPEN''' button to open the uart node. After the opening is successful, the '''OPEN''' button becomes unselectable, and the '''CLOSE''' button and '''SEND''' button become selectable.</p></li></ol> [[File:zero2w-img362.png]] <ol start="8" style="list-style-type: decimal;"><li><p>Then use Dupont wire to short the rx and tx pins of uart</p></li><li><p>Then you can enter a paragraph of characters in the send edit box below and click the '''SEND''' button to start sending.</p></li></ol> [[File:zero2w-img363.png]] <ol start="10" style="list-style-type: decimal;"><li>If everything is normal, the received string will be displayed in the receiving box</li></ol> [[File:zero2w-img364.png]] <span id="pin-spi-test-method"></span>=== 40pin SPI test method === # 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 serial number271'''| '''PI15'''| style="text-align: left;"|| '''31'''|-| '''268'''| '''PI12'''| '''PWM2'''| '''33'''|-| '''258'''| '''PI2'''| style="text-align: left;"|| '''35'''|-| '''272'''| '''PI16'''| style="text-align: left;"|| '''GPIO37'''|-| style="text-align: left;"|| style="text-align: left;"|| '''FunctionGND'''| '''pin39'''|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''pinPin'''| '''Function'''| '''GPIO'''| '''GPIO serial numberNO.'''
|-
| '''2'''
| '''5V'''
| style="text-align: left;"|
|-
| '''4'''
| '''5V'''
| style="text-align: left;"|
|-
| '''6'''
| '''GND'''
| 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'''
| '''270'''
|-
| style="text-align: left;"|
| '''PH4'''
| '''228'''
|-
| '''20'''
| '''GND'''
| style="text-align: left;"|
|-
| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''<span style="color:#FF0000">22</span>'''| '''<span style="color:#FF0000">UART2_RX</span>'''| '''<span style="color:#FF0000">PI6</span>'''| '''<span style="color:#FF0000">262</span>'''
|-
| '''24'''
| '''SPI1_CS0'''
| '''229'''
|-
| '''26'''
| '''SPI1_CS1'''
| '''233'''
|-
| '''28'''
| '''TWI2-SCL'''
| '''265'''
|-
| '''30'''
| '''GND'''
| style="text-align: left;"|
|-
| '''32'''
| '''PWM1'''
| '''267'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
|-
| '''36'''
| style="text-align: left;"|
| '''PC12'''
| '''76'''
|}-| '''38'''<ol start="2" | style="list-styletext-typealign: decimalleft;">|<li>The device node corresponding to SPI1 CS0 is | '''/dev/spidev1.0PI4''', and the device node corresponding to SPI1 CS1 is | '''/dev/spidev1.1260'''</li></ol>|-| '''40'''apollo| style="text-p2align:/ # left;"|| '''ls /dev/spidev1.*PI3''' | '''/dev/spidev1.0 /dev/spidev1.1259'''|}</div>
<ol start="2" style="list-style-type: decimal;">
<li>The device node corresponding to uart2 is '''/dev/ttyAS2''', and the device node corresponding to uart5 is'''/dev/ttyAS5'''</li>
{| class="wikitable" style="width:800px;"
|-
|
<p>apollo-p2:/ # ls /dev/ttyAS*</p>
<p>/dev/ttyAS0 /dev/ttyAS1 '''<span style="color:#FF0000">/dev/ttyAS2 /dev/ttyAS5</span>'''</p>
|}
</ol>
<ol start="3" style="list-style-type: decimal;">
<li>Here is a demonstration to test the SPI1 interface through the '''w25qxx''' module. First, connect the w25qxx module to open wiringOP APP on the SPI1 interface.desktop</li></ol> '''It doesn't matter if there is no w25qxx module, because there is a SPIFlash on the development board connected to SPI0, and the configuration of SPI0 is also turned on by default in Android, so we can also directly use the onboard SPIFlash for testing.'''
[[File:zero2w-img351.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then click the '''UART_TEST'''button to open wiringOP APP on the desktopUART test interface</li></ol> [[File:zero2w-img351.png]]
[[File:zero2w-img359.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>Then click the '''SPI_TEST''' button to open the SPI The serial port test interfaceof wiringOP is as shown in the figure below</li></ol> [[File:zero2w-img365.png]]
[[File:zero2w-img360.png]]
</ol>
<ol start="6" style="list-style-type: decimal;">
<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'ttyAS2''. If the '''w25qxx''' module is connected to the 40pin spi1 cs0, then please selector'''/dev/spidev1.0ttyAS5''', if the w25qxx module is connected to node in the 40pin spi1 cs1, then please select '''/dev/spidev1.1'''selection box</p><div class="figure"p> [[File:zero2w-img366img361.png]] </divp></li><li><p>Then Enter the baud rate you want to set in the edit box, and then click the '''OPEN''' button to initialize open the SPIuart node. After the opening is successful, the '''OPEN''' button becomes unselectable, and the '''CLOSE''' button and '''SEND''' button become selectable.</p></li></ol> [[File:zero2w-img367.png]]
[[File:zero2w-img362.png]]
</ol>
<ol start="8" style="list-style-type: decimal;">
<li><p>Then fill in the bytes that need use Dupont wire to be sent, such as reading short the ID information rx and tx pins of uart</p></li><li><p>Then you can enter a paragraph of the onboard SPIFlash, filling characters in the address 0x9f in data[0], send edit box below and then click the '''TRANSFERSEND''' buttonto start sending.</lip></olli>
[[File:zero2w-img368img363.png]]</ol><ol start="10" style="list-style-type: decimal;"><li>If everything is normal, the received string will be displayed in the receiving box</li>
[[File:zero2w-img364.png]]</ol start><span id="9" style="listpin-spi-styletest-type: decimal;method"><li>Finally, the APP will display the read ID information of the onboard SPI Flash.</li></olspan>
<span iddiv style="pin-i2c-test-methoddisplay: flex;"></span>=== 40pin I2C test method === # As can be seen from the table below, the Android12 TV system has i2c1 and i2c2 turned on by default. ::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO serial numberNO.'''
| '''GPIO'''
| '''Function'''
| '''pin'''|| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO serial numberPin'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-
| '''264'''
| '''TWI1-SDA'''
| '''3'''
|-
| '''263'''
| '''TWI1-SCL'''
| '''5'''
|-
| '''269'''
| '''PWM3'''
| '''7'''
|-
| style="text-align: left;"|
| '''GND'''
| '''9'''
|-
| '''226'''
| '''UART5_TX'''
| '''11'''
|-
| '''227'''
| '''UART5_RX'''
| '''13'''
|-
| '''261'''
| '''UART2_TX'''
| '''15'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|-
| '''231'''
| '''SPI1_MOSI'''
| '''19'''
|-
| '''232'''
| '''SPI1_MISO'''
| '''21'''
|-
| '''230'''
| '''SPI1_CLK'''
| '''23'''
| style="text-align: left;"|
| '''GND'''
| '''25'''
|-
| '''266'''
| '''TWI2-SDA'''
| '''27'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|}{| '''36'''| class="wikitable" style="width:390px;margin-right: 20px;text-align: leftcenter;"|-| '''Pin'''| '''Function'''| '''PC12GPIO'''| '''76GPIO NO.'''
|-
| '''2722'''| '''PI165V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''4'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''6'''
| '''GND'''
| style="text-align: left;"|
| '''PI3'''| '''259'''|} <ol start="2" style="listtext-style-typealign: decimalleft;">|<li>The device node corresponding to i2c1 is '''/dev/i2c|-1''', and the device node corresponding to i2c2 is '''/dev/i2c-2'''</li></ol> apollo-p2:/ # '''ls /dev/i2c-*| ''' '''/dev/i2c-1 /dev/i2c-2''' /dev/i2c-5 <ol start="3" style="list-style-type: decimal;"><li>First open wiringOP APP on the desktop</li></ol> [[File:zero2w-img351.png]] <ol start="4" style="list-style-type: decimal;"><li>Then click the '''I2C_TEST''' button to open the i2c test interface</li></ol> [[File:zero2w-img370.png]] <ol start="5" style="list-style-type: decimal;"><li>The i2c test interface of wiringOP is shown in the figure below</li></ol> [[File:zero2w-img371.png]] <ol start="6" style="list-style-type: decimal;"><li>Then click the device node selection box in the upper left corner to select the i2c you want to test</li></ol> [[File:zero2w-img372.png]] <ol start="7" style="list-style-type: decimal;"><li>Then connect an i2c device to the 40pin i2c pin. Here we take the ds1307 rtc module as an example.</li></ol> [[File:zero2w-img178.png]] <ol start="8" style="list-style-type: decimal;"><li><p>The i2c address of the ds1307 rtc module is 0x68. After connecting the lines, we can use the '''i2cdetect -y 1''' or '''i2cdetect -y 2''' command on the serial port command line to check whether the i2c address of the ds1307 rtc module can be scanned. If you can see the address 0x68, it means that the ds1307 rtc module is wired correctly.</p><p>apollo-p2:/ # | '''i2cdetect -y 1UART0_TX'''</p><p>| '''OrPH0'''</p><p>apollo-p2:/ # '''i2cdetect -y 2'''</p><p>[[File:zero2w-img373.png]]</p></li><li><p>Then set the i2c address to 0x68 in wiringOP, and then click the '''OPEN''' button to open i2c</p><p>[[File:zero2w-img374.png]]</p></li><li><p>After clicking the '''OPEN''' button to open i2c, the display is as follows</p><p>[[File:zero2w-img375.png]]</p></li><li><p>Then we test writing a value to the register of the rtc module, for example, writing 0x55 to the 0x1c address</p><ol style="list-style-type: lower-alpha;"><li><p>We first set the address of the register to be written to 0x1c</p><p>[[File:zero2w-img376.png]]</p></li><li><p>Then set the value to be written to 0x55</p><p>[[File:zero2w-img377.png]]</p></li><li><p>Then click the '''WRITE BYTE''' button to perform the writing action</p><p>[[File:zero2w-img378.png]]</p></li></ol></li><li><p>Then click the | '''READ BYTE224''' button to read the value of the 0x1c register. If it displays 0x55, it means that the i2c read and write test has passed.</p><p>[[File:zero2w-img379.png]]</p></li></ol> <span id="pin-pwm-test"></span>=== 40pin PWM test === # As can be seen from the table below, the available pwm are pwm1, pwm2, pwm3 and pwm4. {| class="wikitable"
|-
| '''GPIO serial number10'''| '''GPIOUART0_RX'''| '''FunctionPH1'''| '''pin'''|| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO serial number225'''
|-
| '''12'''
| style="text-align: left;"|
| '''PI1'''
| '''257'''
|-
| '''14'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''16'''
| '''PWM4'''
| '''PI14'''
| '''270'''
|-
| '''18'''
| style="text-align: left;"|
| '''PH4'''
| '''228'''
|-
| '''26420'''| '''PI8'''| '''TWI1-SDA'''| '''3'''|| '''4'''| '''5VGND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26322'''| '''PI7UART2_RX'''| '''TWI1PI6'''| '''262'''|-| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''28'''| '''TWI2-SCL'''| '''5PI9'''|'''265'''|-| '''630'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26932'''| '''PI13PWM1'''| '''PWM3PI11'''| '''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'''|}</div> <ol start="2" style="list-style-type: decimal;"><li>The device node corresponding to SPI1 CS0 is '''/dev/spidev1.0''', and the device node corresponding to SPI1 CS1 is '''/dev/spidev1.1'''</li>{| class="wikitable" style="width:800px;"
|-
| apollo-p2:/ # '''227ls /dev/spidev1.*'''| '''PH3'''| '''UART5_RX<span style="color:#FF0000">/dev/spidev1.0 /dev/spidev1.1</span>'''| '''13'''}|</ol>| '''14'''<ol start="3" style="list-style-type: decimal;">| <li>Here is a demonstration to test the SPI1 interface through the '''GNDw25qxx'''module. First, connect the w25qxx module to the SPI1 interface.</li>{| styleclass="text-align: left;wikitable"|| style="textbackground-aligncolor: left#ffffdc;width:800px;"|
|-
| <big>'''261It doesn't matter if there is no w25qxx module, because there is a SPIFlash on the development board connected to SPI0, and the configuration of SPI0 is also turned on by default in Android, so we can also directly use the onboard SPIFlash for testing.'''</big>| }</ol><ol start="4" style="list-style-type: decimal;"><li>Then open wiringOP APP on the desktop</li> [[File:zero2w-img351.png]]</ol><ol start="5" style="list-style-type: decimal;"><li>Then click the '''SPI_TEST''' button to open the SPI test interface</li> [[File:zero2w-img365.png]]</ol><ol start="6" style="list-style-type: decimal;"><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'''PI5, if the w25qxx module is connected to the 40pin spi1 cs1, then please select '''/dev/spidev1.1'''</p><div class="figure"> [[File:zero2w-img366.png]] </div></li>| <li><p>Then click the '''UART2_TXOPEN'''button to initialize the SPI</p></li>| [[File:zero2w-img367.png]]</ol><ol start="8" style="list-style-type: decimal;"><li>Then fill in the bytes that need to be sent, such as reading the ID information of the onboard SPIFlash, filling in the address 0x9f in data[0], and then click the '''15TRANSFER'''button</li> [[File:zero2w-img368.png]]</ol><ol start="9" style="list-style-type: decimal;"><li>Finally, the APP will display the read ID information of the onboard SPI Flash.</li> [[File:zero2w-img369.png]]</ol><ol start="10" style="list-style-type: decimal;"><li>If the w25qxx module connected to 40pin SPI1 is read, the ID information of the onboard SPI Flash is also similar.</li></ol> <span id="pin-i2c-test-method"></span> === 40pin I2C test method === # As can be seen from the table below, the Android12 TV system has i2c1 and i2c2 turned on by default. <div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''16GPIO NO.'''| '''PWM4GPIO'''| '''PI14Function'''| '''270Pin'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''171'''|-| '''18<span style="color:#FF0000">264</span>'''| '''<span style="text-aligncolor: left;#FF0000"|>PI8</span>'''| '''PH4<span style="color:#FF0000">TWI1-SDA</span>'''| '''228<span style="color:#FF0000">3</span>'''
|-
| '''231<span style="color:#FF0000">263</span>'''| '''PH7<span style="color:#FF0000">PI7</span>'''| '''SPI1_MOSI<span style="color:#FF0000">TWI1-SCL</span>'''| '''19'''|| '''20'''| '''GND'''| style="text-align: left;"|| <span style="text-aligncolor: left;#FF0000"|>5</span>'''
|-
| '''269'''| '''PI13'''| '''PWM3'''| '''7'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''9'''|-| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-| '''261'''| '''PI5'''| '''UART2_TX'''| '''15'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''17'''|-| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''
| '''PH8'''
| '''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>'''| '''<span style="color:#FF0000">27'''|| '''28'''| '''TWI2-SCL'''| '''PI9'''| '''265</span>'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
| '''271'''
| '''PI15'''
| 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;"|
|-| '''PI36'''| '''259GND'''|} <ol startstyle="2text-align: left;" || style="listtext-style-typealign: decimalleft;">||-| '''8'''| '''UART0_TX'''| '''PH0'''| '''224'''|-| '''10'''| '''UART0_RX'''<li>First click the wiringOP icon to open wiringOP APP</li></ol>| '''PH1'''| '''225'''[[File:zero2w|-img351.png]]| '''12'''<ol start="3" | style="list-styletext-typealign: decimalleft;">|<li>Then click the | '''PWM_TESTPI1''' button on the main interface of wiringOP to enter the PWM test interface</li></ol>| '''257'''[[File:zero2w|-img380.png]]| '''14'''| '''GND'''<ol start| style="4text-align: left;" || style="listtext-style-typealign: decimalleft;">||-<li>The PWM test interface is as follows</li></ol>| '''16'''| '''PWM4'''<div class="figure">| '''PI14'''| '''270'''[[File:zero2w|-img381.png]]| '''18'''</div><ol start="5" | style="listtext-style-typealign: decimalleft;">|<li>Then set which PWM you want to use in the Channel. The default is PWM1. If you want to set it to PWM2, just enter 2 in the Channel. PWM3 and PWM4 and so on.</li></ol>| '''PH4'''| '''228'''[[File:zero2w|-img382.png]]| '''20'''| '''GND'''<ol start| style="6text-align: left;" || style="listtext-style-typealign: decimalleft;">||-| '''22'''| '''UART2_RX'''| '''PI6'''| '''262'''|-| '''24'''<li>Then you can set the PWM period. The default configuration is | '''50000nsSPI1_CS0'''. The converted PWM frequency is | '''20KHzPH5'''</li></ol>| '''229'''[[File:zero2w|-img383.png]]| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''<ol start="7" span style="list-style-typecolor: decimal;#FF0000">28<li/span>Then click the '''EXPORT| '''button to export PWM</lispan style="color:#FF0000">TWI2-SCL</olspan>''' [[File:zero2w-img384.png]] | '''<ol start="8" span style="list-style-typecolor: decimal;#FF0000">PI9<li/span>Then drag the progress bar below to change the PWM duty cycle, and then check '''Enable| ''' to output the PWM waveform.</lispan style="color:#FF0000">265</olspan>'''|-[[File:zero2w-img385.png]]| '''30'''| '''GND'''<ol start| style="9text-align: left;" || style="listtext-style-typealign: decimalleft;">||-| '''32'''| '''PWM1'''<li>Then use an oscilloscope to measure the corresponding pins in the 40pin development board and you can see the following waveform.</li></ol>| '''PI11'''| '''267'''[[File:zero2w|-img386.png]]| '''34'''| '''GND'''<span id| style="howtext-toalign: left;"|| style="text-compile-android-12-source-codealign: left;"></span>||-= | '''How to compile Android 12 source code36''' = <span id| style="downloadtext-the-source-code-of-android-12align: left;"></span>|| '''PC12'''| '''76'''== Download the source code of Android 12 ==|-| '''38'''<ol | style="listtext-style-typealign: decimalleft;">|| '''PI4'''| '''260'''|-<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>| '''40'''<ol | style="list-styletext-typealign: lower-alphaleft;">|| '''PI3'''| '''259'''<li>Google Cloud Drive</li></ol>|}</lidiv></ol> [[File:zero2w-img387.png]]
<ol start="2" style="list-style-type: decimal;">
<li>After downloading the compressed package of Android 12 source code, please check whether the MD5 checksum The device node corresponding to i2c1 is correct. If it is incorrect, please download the source code again. Here's how to check the MD5 checksum:<''/li><dev/ol> test@test:~$ i2c-1'''md5sum -c H618-Android12-Src.tar.gz.md5sum, and the device node corresponding to i2c2 is ''' H618/dev/i2c-Android12-Src.tar.gzaa: '''OK2'''</li>{| class="wikitable" style="width:800px;" H618|-Android12| apollo-Src.tar.gzabp2: / # '''OKls /dev/i2c-*''' ......
'''<span style="color:#FF0000">/dev/i2c-1 /dev/i2c-2</span>''' /dev/i2c-5
|}
</ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then you need to merge multiple compressed files into one, and then extract First open wiringOP APP on the Android source code. The command looks like this:desktop</li></ol> test@test:~$ '''cat H618-Android12-Src.tar.gza* > H618-Android12-Src.tar.gz''' test@test:~$ '''tar -xvf H618-Android12-Src.tar.gz'''
[[File:zero2w-img351.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then unzip click the compressed package of the files modified by Orange Pi Zero2w</li></ol> test@test:~$ '''tar zxf opizero2w_android12_patches.tar.gzI2C_TEST''' button to open the i2c test@test:~$ '''ls''' '''opizero2w_android12_patches''' opizero2w_android12_patches.tar.gzinterface</li>
[[File:zero2w-img370.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>Then copy The i2c test interface of wiringOP is shown in the files modified by Orange Pi Zero2w to the Android source codefigure below</li></ol>
[[File:zero2w-img372.png]]<span id/ol><ol start="compile-the7" style="list-sourcestyle-code-of-android-12type: decimal;"><li>Then connect an i2c device to the 40pin i2c pin. Here we take the ds1307 rtc module as an example.</spanli>== Compile the source code of Android 12 ==
[[File:zero2w-img178.png]]</ol><ol start="8" style="list-style-type: decimal;"><li><p>The i2c address of the ds1307 rtc module is 0x68. After connecting the lines, we can use the '''i2cdetect -y 1''' or '''Android12 is compiled i2cdetect -y 2''' command on an x86_64 computer with Ubuntu 22the serial port command line to check whether the i2c address of the ds1307 rtc module can be scanned.04 installedIf you can see the address 0x68, it means that the ds1307 rtc module is wired correctly. Other versions of Ubuntu system package dependencies may have some differences</p>{| class="wikitable" style="width:800px;" |-| <p>apollo-p2:/ # '''i2cdetect -y 1'''</p><p>'''Or'''</p><p>apollo-p2:/ # '''i2cdetect -y 2'''</p>|}<p>[[File:zero2w-img373. The image download png]]</p></li><li><p>Then set the i2c address of to 0x68 in wiringOP, and then click the Ubuntu 22'''OPEN''' button to open i2c</p><p>[[File:zero2w-img374.04 amd64 version png]]</p></li><li><p>After clicking the '''OPEN''' button to open i2c, the display is as follows</p><p>[[File:zero2w-img375.png]]</p></li><li><p>Then we test writing a value to the register of the rtc module, for example, writing 0x55 to the 0x1c address</p><ol style="list-style-type: lower-alpha;"><li><p>We first set the address of the register to be written to 0x1c</p><p>[[File:zero2w-img376.png]]</p></li><li><p>Then set the value to be written to 0x55</p><p>[[File:zero2w-img377.png]]</p></li><li><p>Then click the '''WRITE BYTE'''button to perform the writing action</p><p>[[File:zero2w-img378.png]]</p></li></ol></li><li><p>Then click the '''READ BYTE''' button to read the value of the 0x1c register. If it displays 0x55, it means that the i2c read and write test has passed.</p><p>[[File:zero2w-img379.png]]</p></li></ol>
# First install As can be seen from the software packages needed to compile Android12 source codetable below, the available pwm are pwm1, pwm2, pwm3 and pwm4.
[[File:zero2w-img385.png]]</ol><ol start="9" style="list-style-type: decimal;"><li>Then use an oscilloscope to measure the corresponding pins in the 40pin development board and you can see the following waveform.</li> [[File:zero2w-img386.png]]</ol><span id="how-to-compile-android-12-source-code"></span> = '''How to compile Android 12 source code''' = <span id="download-the-source-code-of-android-12"></span>== Download the source code of Android 12 == <ol style="list-style-type: decimal;"><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> [[File:zero2w-img387.png]]</ol></li></ol><ol start="2" style="list-style-type: decimal;"><li>After downloading the compressed package of Android 12 source code, please check whether the MD5 checksum is correct. If it is incorrect, please download the source code again. Here's how to check the MD5 checksum:</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''md5sum -c H618-Android12-Src.tar.gz.md5sum''' H618-Android12-Src.tar.gzaa: '''<span style="color:#FF0000">OK</span>''' H618-Android12-Src.tar.gzab: '''<span style="color:#FF0000">OK</span>''' ......|}</ol><ol start="3" style="list-style-type: decimal;"><li>Then you need to merge multiple compressed files into one, and then extract the Android source code. The command looks like this:</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''cat H618-Android12-Src.tar.gz<span style="color:#FF0000">a</span>* > H618-Android12-Src.tar.gz''' test@test:~$ '''tar -xvf H618-Android12-Src.tar.gz'''|}</ol><ol start="4" style="list-style-type: decimal;"><li>Then unzip the compressed package of the files modified by Orange Pi Zero2w</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''tar zxf opizero2w_android12_patches.tar.gz''' test@test:~$ '''ls''' '''opizero2w_android12_patches''' opizero2w_android12_patches.tar.gz|}</ol><ol start="5" style="list-style-type: decimal;"><li>Then copy the files modified by Orange Pi Zero2w to the Android source code</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''cp -rf opizero2w_android12_patches/* H618-Android12-Src/'''|}</ol><span id="compile-the-source-code-of-android-12"></span> == Compile the source code of Android 12 == {| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Android12 is compiled on an x86_64 computer with <span style="color:#FF0000">Ubuntu 22.04</span> installed. Other versions of Ubuntu system package dependencies may have some differences. The image download address of the Ubuntu 22.04 <span style="color:#FF0000">amd64</span> version is as follows:''' [https://repo.huaweicloud.com/ubuntu-releases/22.04/ubuntu-22.04.2-desktop-amd64.iso '''https://repo.huaweicloud.com/ubuntu-releases/22.04/ubuntu-22.04.2-desktop-amd64.iso'''] '''The x86_64 computer hardware configuration for compiling Android12 source code recommends a memory of 16GB or more, and a hard disk space of 200GB or more is recommended. The more CPU cores, the better.'''</big>|} # First install the software packages needed to compile Android12 source code ::{| class="wikitable" style="width:800px;" |-| test@test:~$ '''sudo apt-get update''' test@test:~$ '''sudo apt-get install -y git gnupg flex bison gperf build-essential \''' '''zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \''' '''lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev ccache \''' '''libgl1-mesa-dev libxml2-utils xsltproc unzip u-boot-tools python-is-python3 \''' '''libssl-dev libncurses5 clang gawk'''|} <ol start="2" style="list-style-type: decimal;"><li><p>Then compile the code in the longan folder, which mainly contains u-boot and linux kernel</p><ol style="list-style-type: lower-alpha;"><li>First run '''./build.sh config''' to set compilation options</li>{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''cd H618-Android12-Src/longan'''</p><p>test@test:~/H618-Android12-Src/longan$ '''./build.sh config'''</p> <p>Welcome to mkscript setup progress</p><p>All available platform:</p>:<p>0. android</p>:<p>1. linux</p><p>Choice [android]: '''<span style="color:#FF0000">0</span>'''</p><p>All available ic:</p>:<p>0. h618</p><p>Choice [h618]: '''<span style="color:#FF0000">0</span>'''</p><p>All available board:</p>:<p>0. ft</p>:<p>1. p1</p>:<p>2. p2</p>:<p>3. p7</p>:<p>4. p7l</p>:<p>5. perf1</p>:<p>6. perf2</p>:<p>7. perf3</p>:<p>8. qa</p><p>Choice [p2]: '''<span style="color:#FF0000">2</span>'''</p><p>All available flash:</p>:<p>0. default</p>:<p>1. nor</p><p>Choice [default]: '''<span style="color:#FF0000">0</span>'''</p><p>All available kern_ver:</p>:<p>0. linux-5.4</p><p>Choice [linux-5.4]: '''<span style="color:#FF0000">0</span>'''</p><p>All available arch:</p>:<p>0. arm</p>:<p>1. arm64</p><p>Choice [arm64]: '''<span style="color:#FF0000">1</span>'''</p><p>'''......'''</p><p>*** Default configuration is based on 'sun50iw9p1smp_h618_android_defconfig'</p><p>#</p><p># configuration written to .config</p><p>#</p><p>make[1]: Leaving directory '/home/test/H618-Android12-Src/longan/out/kernel/build'</p><p>make: Leaving directory '/home/test/H618-Android12-Src/longan/kernel/linux-5.4'</p><p>INFO: clean buildserver</p><p>INFO: prepare_buildserver</p>|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Then run the '''./build.sh''' script to start compilation.</li>{| class="wikitable" style="width:800px;" |-| test@test:~/H618-Android12-Src/longan$ '''./build.sh'''|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>After compilation is completed, you will see the following output</li>{| class="wikitable" style="width:800px;" |-| sun50iw9p1 compile Kernel successful INFO: Prepare toolchain ... '''......''' INFO: build kernel OK. INFO: build rootfs ... INFO: skip make rootfs for android INFO: ----------------------------------------
INFO: build lichee OK.
INFO: ----------------------------------------|}</ol></li></ol><ol start="3" style="list-style-type: decimal;"><li>Then use the following command to compile the Android source code and generate the final Android image</li></ol>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''cd H618-Android12-Src''' test@test:~/H618-Android12-Src$ '''source build/envsetup.sh''' test@test:~/H618-Android12-Src$ '''lunch apollo_p2-userdebug''' test@test:~/H618-Android12-Src$ '''make -j8''' test@test:~/H618-Android12-Src$ '''pack'''|}</ol><ol start="4" style="list-style-type: decimal;"><li><p>The storage path of the Android image generated by compilation is:</p>{| class="wikitable" style="width:800px;" |-| <p>'''longan/out/h618_android12_p2_uart0.img'''</p>|}</li></ol> <span id="appendix"></span> = '''Appendix''' = <span id="user-manual-update-history"></span>== User manual update history == {| class="wikitable" style="width:800px;text-align: center;"|-| '''Version'''| '''Date'''| '''Release Notes'''|-| v1.0| 2023-09-14| initial version|} <span id="image-update-history"></span>== Image update history == {| class="wikitable" style="width:800px;"|-| style="text-align: center;"| '''Date''' | style="text-align: center;"| '''Release Notes'''|-| 202 3style="text-align: center;"| 2023-09-14| orangepizero2w_1.0.0_debian_bullseye_server_linux5.4.125.7z orangepizero2w_1.0.0_ubuntu_focal_server_linux5.4.125.7z orangepizero2w_1.0.0_ubuntu_focal_desktop_xfce_linux5.4.125.7z orangepizero2w_1.0.0_debian_bullseye_desktop_xfce_linux5.4.125.7z orangepizero2w_1.0.0_ubuntu_jammy_server_linux6.1.31.7z orangepizero2w_1.0.0_debian_bookworm_server_linux6.1.31.7z orangepizero2w_1.0.0_debian_bullseye_server_linux6.1.31.7z orangepizero2w_1.0.0_ubuntu_jammy_desktop_xfce_linux6.1.31.7z orangepizero2w_1.0.0_debian_bookworm_desktop_xfce_linux6.1.31.7z orangepizero2w_1.0.0_debian_bullseye_desktop_xfce_linux6.1.31.7z OrangePi_Zero2w_Android12_v1.0.tar.gz
Opios-arch-aarch64-xfce-opizero2w-23.09-linux6.1.31.img.xz