Changes

Jump to: navigation, search

Orange Pi Zero 2W

31,143 bytes added, 20:33, 27 September 2023
Download orangepi-build from github
<div class="figure">
[[File:zero2w-img3.png|800px]]
</div>
<div class="figure">
[[File:zero2w-img4.png|800px]]
</div>
<div class="figure">
[[File:zero2w-img5.png|800px]]
</div>
<span id="orange-pi-zero-2w-24pin-expansion-board-interface-details"></span>
 
== Orange Pi Zero 2w 24pin expansion board interface details ==
<div class="figure">
[[File:zero2w-img6.png|800px]]
</div>
[[File:zero2w-img7.png|800px]]
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
<p>[[File:zero2w-img171.png]]</p></li>
<li><p>First, you need to set the GPIO port to input mode, and the third parameter needs to be the serial number of the wPi corresponding to the input pin.</p>
{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP# '''gpio mode <span style="color:#FF0000">2 </span> in'''</p>|}</li>
<li><p>After setting to input mode, execute the following command to set the GPIO port to pull-up mode.</p>
{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP# '''gpio mode <span style="color:#FF0000">2 </span> up'''</p>|}</li>
<li><p>Then enter the following command to read the level of the GPIO port. If the level is 1, it means that the pull-up mode is set successfully.</p>
{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP# '''gpio read <span style="color:#FF0000">2</span>'''</p><p>'''<span style="color:#FF0000">1</span>'''</p>|}</li>
<li><p>Then execute the following command to set the GPIO port to pull-down mode</p>
{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP# '''gpio mode <span style="color:#FF0000">2 </span> down'''</p>|}</li>
<li><p>Then enter the following command to read the level of the GPIO port. If the level is 0, it means that the pull-down mode is set successfully.</p>
{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP# '''gpio read <span style="color:#FF0000">2</span>'''</p><p>'''<span style="color:#FF0000">0</span>'''</p>|}</li></ol>
<span id="pin-spi-test"></span>
 
=== 40pin SPI test ===
# As can be seen from the table below, the spi available for the 40pin interface is spi1, and there are two chip select pins cs0 and cs1
<div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO序号GPIO NO.'''
| '''GPIO'''
| '''Function'''
| '''pin'''
|
| '''pin'''
| '''Function'''
| '''GPIO'''
| '''GPIO序号'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|
| '''2'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''264'''
| '''TWI1-SDA'''
| '''3'''
|
| '''4'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''263'''
| '''TWI1-SCL'''
| '''5'''
|
| '''6'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''269'''
| '''PWM3/UART4_TX'''
| '''7'''
|
| '''8'''
| '''UART0_TX'''
| '''PH0'''
| '''224'''
|-
| style="text-align: left;"|
| '''GND'''
| '''9'''
|
| '''10'''
| '''UART0_RX'''
| '''PH1'''
| '''225'''
|-
| '''226'''
| '''UART5_TX'''
| '''11'''
|
| '''12'''
| style="text-align: left;"|
| '''PI1'''
| '''257'''
|-
| '''227'''
| '''UART5_RX'''
| '''13'''
|
| '''14'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''261'''
| '''TWI0_SCL/UART2_TX'''
| '''15'''
|
| '''16'''
| '''PWM4/UART4_RX'''
| '''PI14'''
| '''270'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|
| '''18'''
| style="text-align: left;"|
| '''PH4'''
| '''228'''
|-
| '''<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'''
|
| '''26'''
| '''SPI1_CS1'''
| '''PH9'''
| '''233'''
|-
| '''266'''
| '''TWI2-SDA/UART3_RX'''
| '''27'''
|
| '''28'''
| '''TWI2-SCL/UART3_TX'''
| '''PI9'''
| '''265'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|
| '''30'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|
| '''32'''
| '''PWM1'''
| '''PI11'''
| '''267'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-
| '''258'''
| '''PI2'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''PC12'''
| '''76'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|
| '''40'''
| style="text-align: left;"|
| '''PI3'''
| '''259'''
|}
 <ol style{| class="list-style-type: decimal;wikitable"><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="listwidth:390px;margin-styleright: 20px;text-typealign: lower-alphacenter;"><li><p>First run '''orangepi|-config'''. Ordinary users remember to add &gt; | '''sudopin''' permissions.</p><p>orangepi@orangepi:~$ | '''sudo orangepi-configFunction'''</p></li><li><p>Then select | '''SystemGPIO'''</p><p>[[File:zero2w-img80.png]]</p></li><li><p>Then select | '''Hardware'''</p><p>[[File:zero2w-img81GPIO NO.png]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown &gt; in the figure below, and then use the '''space''' to select the &gt; dtbo configuration of the SPI you want to open.</p></li></ol></li></ol> {| class="wikitable"
|-
| '''dtbo configuration2'''| '''illustrate5V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''spi1-cs0-cs1-spidev4'''| '''Open cs0 and cs1 of spi1 at the same time5V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''spi1-cs0-spidev6'''| '''Only open cs0 of spi1GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''spi1-cs1-spidev'''| '''Only open cs1 of spi1'''|} [[File:zero2w-img172.png]] <ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select '''&lt;Save&gt;''' to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''&lt;Back&gt;'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''&lt;Reboot&gt;'''to restart the system to make the &gt; configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol> <!-- --><ol start="2" style="list-style-type: decimal;"><li><p>Then check whether there is a '''spidev1.x''' device node in the Linux system. If it exists, it means that the SPI1 configuration has taken effect.</p><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>Next, start the spi loopback test. Do not short-circuit the mosi and miso pins of SPI1 first. The output result of running spidev_test is as follows. You can see that the data of TX and RX are inconsistent.</p><p>orangepi@orangepi:~$ '''sudo spidev_test -v -D /dev/spidev1.0'''</p><p>spi mode: 0x0</p><p>bits per word: 8</p><p>max speed: 500000 Hz (500 KHz)</p><p>TX | FF FF FF FF FF FF '''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 | ......@.…▒..................▒.</p><p>RX | FF FF FF FF FF FF '''FF FF FF FF FF FFUART0_TX''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF | ............................….</p></li><li><p>Then short-circuit the two pins of SPI1 mosi (pin 19 in the 40pin interface) and miso (pin 21 in the 40pin interface) and then run spidev_test. The output is as follows. You can see the sending and receiving The data is the same, indicating that the loopback test passed.</p><p>orangepi@orangepi:~$ '''sudo spidev_test -v -D /dev/spidev1.0'''</p><p>spi mode: 0x0</p><p>bits per word: 8</p><p>max speed: 500000 Hz (500 KHz)</p><p>TX | FF FF FF FF FF FF '''40 00 00 00 00 95PH0''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p><p>RX | FF FF FF FF FF FF '''40 00 00 00 00 95224''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p></li></ol> <span id="pin-i2c-test"></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序号10'''| '''GPIOUART0_RX'''| '''FunctionPH1'''| '''pin'''|| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.225'''
|-
| '''12'''
| style="text-align: left;"|
| '''PI1'''
| '''257'''
|-
| '''14'''
| '''GND'''
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|
| '''2'''
| '''5V'''
| style="text-align: left;"|
|-
| '''16'''
| '''PWM4/UART4_RX'''
| '''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'''| '''PI7TWI0_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-SCL/UART3_TX'''| '''5PI9'''|'''265'''|-| '''630'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26932'''| '''PI13PWM1'''| '''PWM3/UART4_TXPI11'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224267'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''9'''
|
| '''10'''
| '''UART0_RX'''
| '''PH1'''
| '''225'''
|-
| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''1236'''
| style="text-align: left;"|
| '''PI1PC12'''| '''25776'''
|-
| '''22738'''| '''PH3'''style="text-align: left;"|| '''UART5_RXPI4'''| '''13260'''|-| '''1440'''| '''GND'''| style="text-align: left;"|
| style="text-align: left;"|
| '''PI3'''
| '''259'''
|}
</div>
 
<ol 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:~$ '''261sudo orangepi-config'''</p>| }</li><li><p>Then select '''PI5System'''</p>| '''TWI0_SCL<p>[[File:zero2w-img80.png]]</p></UART2_TX'''li>| <li><p>Then select '''15Hardware'''</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 ''16'space''| '''PWM4to select the dtbo configuration of the SPI you want to open.</p></UART4_RX'''li>| '''PI14'''{| '''270'''class="wikitable" style="width:800px;text-align: center;"
|-
| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''17'''|| '''18'''| style="text-align: left;"|| '''PH4dtbo configuration'''| '''228illustrate'''
|-
| '''231'''| '''PH7spi1-cs0-cs1-spidev'''| '''SPI1_MOSIOpen cs0 and cs1 of spi1 at the same time'''| '''19'''|| '''20'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''232spi1-cs0-spidev'''| '''PH8Only open cs0 of spi1'''|-| '''SPI1_MISOspi1-cs1-spidev'''| '''21Only open cs1 of spi1'''|} [[File:zero2w-img172.png]]</ol><ol start="5" style="list-style-type: lower-alpha;">| <li><p>Then select '''22&lt;Save&gt;'''to save</p><p>[[File:zero2w-img83.png]]</p></li>| <li><p>Then select '''TWI0_SDA/UART2_RX&lt;Back&gt;'''</p><p>[[File:zero2w-img84.png]]</p></li>| <li><p>Then select '''PI6&lt;Reboot&gt;'''to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol></li></ol><ol start="2" style="list-style-type: decimal;">| <li><p>Then check whether there is a '''262spidev1.x'''device node in the Linux system. If it exists, it means that the SPI1 configuration has taken effect.</p>{| class="wikitable" style="width:800px;"
|-
| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| <p>orangepi@orangepi:~$ '''24ls /dev/spidev1*'''</p>| '''SPI1_CS0'''<p>/dev/spidev1.0 /dev/spidev1.1</p>| '''PH5'''}{| '''229'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| style="text-align: left;"|| style="text-align: left;"|| <big><p>'''GNDNote that only when you open spi1-cs0-cs1-spidev, you will see the device nodes of the two spi.'''</p></big>| '''25'''}|</li>| '''26'''<li><p>Next, start the spi loopback test. Do not short-circuit the mosi and miso pins of SPI1 first. The output result of running spidev_test is as follows. You can see that the data of TX and RX are inconsistent.</p>{| '''SPI1_CS1'''| '''PH9'''| '''233'''class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''266sudo spidev_test -v -D /dev/spidev1.0'''</p><p>spi mode: 0x0</p><p>bits per word: 8</p><p>max speed: 500000 Hz (500 KHz)</p><p>TX | FF FF FF FF FF FF '''PI10<span style="color:#FF0000">40 00 00 00 00 95</span>'''FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p><p>RX | FF FF FF FF FF FF '''TWI2<span style="color:#FF0000">FF FF FF FF FF FF</span>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF | ............................….</p>|}</li><li><p>Then short-SDAcircuit the two pins of SPI1 mosi (pin 19 in the 40pin interface) and miso (pin 21 in the 40pin interface) and then run spidev_test. The output is as follows. You can see the sending and receiving The data is the same, indicating that the loopback test passed.</UART3_RXp>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo spidev_test -v -D /dev/spidev1.0'''</p><p>spi mode: 0x0</p><p>bits per word: 8</p><p>max speed: 500000 Hz (500 KHz)</p><p>TX | FF FF FF FF FF FF '''27<span style="color:#FF0000">40 00 00 00 00 95</span>'''FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p><p>RX | FF FF FF FF FF FF '''<span style="color:#FF0000">40 00 00 00 00 95</span>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p>|}</li></ol> <span id="pin-i2c-test"></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;"|-| '''28GPIO NO.'''| '''TWI2-SCL/UART3_TXGPIO'''| '''PI9Function'''| '''265pin'''
|-
| '''256'''
| '''PI0'''
| style="text-align: left;"|
| '''29'''
|
| '''30'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-
| '''<span style="color:#FF0000">264</span>'''
| '''<span style="color:#FF0000">PI8</span>'''
| '''<span style="color:#FF0000">TWI1-SDA</span>'''
| '''<span style="color:#FF0000">3</span>'''
|-
| '''<span style="color:#FF0000">263</span>'''
| '''<span style="color:#FF0000">v</span>'''
| '''<span style="color:#FF0000">TWI1-SCL</span>'''
| '''<span style="color:#FF0000">5</span>'''
|-
| '''271269'''| '''PI15'''| style="text-align: left;"|| '''31'''|| '''32'''| '''PWM1PI13'''| '''PI11PWM3/UART4_TX'''| '''2677'''
|-
| '''268'''
| '''PI12'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''9'''
|-
| '''226'''
| '''PH2'''
| '''UART5_TX'''
| '''11'''
|-
| '''227'''
| '''PH3'''
| '''UART5_RX'''
| '''13'''
|-
| '''<span style="color:#FF0000">261</span>'''
| '''<span style="color:#FF0000">PI5</span>'''
| '''<span style="color:#FF0000">TWI0_SCL</span>/UART2_TX'''
| '''<span style="color:#FF0000">15</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'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''PC12'''
| '''76'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|-| style="text-align: left;"|| style="text-align: left;"|| '''38GND'''| '''39'''|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| '''4'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''6'''
| '''GND'''
| '''39'''
|
| '''40'''
| style="text-align: left;"|
| '''PI3'''| '''259'''|} <ol start="2" style="list-styletext-typealign: decimalleft;"><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 &gt; '''sudo''' permissions.</p><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 &gt; in the picture below, and then use the '''space''' to select the &gt; corresponding i2c configuration in the picture below.</p></li></ol></li></ol> {| class="wikitable"
|-
| '''Multiplexing function in 40pin8'''| '''Corresponding dtbo configurationUART0_TX'''| '''PH0'''| '''224'''
|-
| '''40pin - i2c010'''| '''pi-i2c0UART0_RX'''| '''PH1'''| '''225'''
|-
| '''40pin 12'''| style="text- i2c1align: left;"|| '''PI1'''| '''pi-i2c1257'''
|-
| '''40pin - i2c214'''| '''pi-i2c2GND'''|} [[File:zero2w-img173.png]] <ol start="5" style="listtext-style-typealign: lower-alphaleft;"><li><p>Then select <span class="mark">&lt;Save&gt;</span> to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''&lt;Back&gt;'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''&lt;Reboot&gt;''' to restart the system to make the &gt; 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 /dev</p><p>orangepi@orangepi:~$ '''ls /dev/i2c-*'''</p>|<p>'''/dev/i2c-*'''</p><p>'''Sometimes the i2c device node and the i2c bus serial number do not correspond one to one. For example, the i2c device node of the i2c1 bus may be /dev/i2c-3.'''</p><p>'''The method to accurately confirm the device node under /dev corresponding to the i2c bus is: '''</p></li></ol> <!-- --><ol style="list-style-type: lower-alpha;"><li><p>'''First run the following command to check the corresponding relationship of i2c'''</p><p>orangepi@orangepizero2w:~$ '''ls /sys/devices/platform/soc*/*/i2c-* | grep &quot;i2c-[0-9]&quot;'''</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 output'''</p></li></ol> <!-- --><ol style="list-styletext-typealign: lower-alphaleft;"><li><p>5002000 is the register base address of the i2c0 bus, and i2c-0 shown behind it is its corresponding i2c device node</p></li><li><p>5002400 is the register base address of the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li><li><p>5002800 is the register base address of the i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p></li></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</p></li><li><p>Then use the '''i2cdetect -y x''' x command. If the address of the connected i2c device can be detected, it means that i2c can be used normally.</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><p>'''Different i2c device addresses are different. The 0x50 address in the picture below is just an example. Please refer to what you actually see.'''</p><div class="figure"> [[File:zero2w-img174.png]] </div></li></ol> <span id="pin-uart-test"></span>=== 40pin UART test === # As can be seen from the table below, the available uarts are uart2, uart3, uart4 and uart5. Please note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial port. {| 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;"|| '''3.3VPH4'''| '''1228'''|-| '''220'''| '''5VGND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''264<span style="color:#FF0000">22</span>'''| '''PI8<span style="color:#FF0000">TWI0_SDA</span>/UART2_RX'''| '''TWI1<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-SDASCL</span>/UART3_TX'''| '''3<span style="color:#FF0000">PI9</span>'''|'''<span style="color:#FF0000">265</span>'''|-| '''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;"|
| '''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="text-align: leftmark">&lt;Save&gt;"|</span> to save</p>| '''3<p>[[File:zero2w-img83.3V'''png]]</p></li>| <li><p>Then select '''17&lt;Back&gt;'''</p>|<p>[[File:zero2w-img84.png]]</p></li>| <li><p>Then select '''18&lt;Reboot&gt;'''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="textlist-style-aligntype: leftdecimal;"|>| '''PH4'''<li><p>After starting the Linux system, first confirm that there is an open i2c device node under /dev</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;"|
|-
| <big><p>'''232Sometimes 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>'''PH8The 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_MISOFirst run the following command to check the corresponding relationship of i2c'''</p>| <p>orangepi@orangepizero2w:~$ '''21ls /sys/devices/platform/soc*/*/i2c-* | grep &quot;i2c-[0-9]&quot;'''</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>'''22In the above output'''</p><ol style="list-style-type: none;"><li><p>a) 5002000 is the register base address of the i2c0 bus, and i2c-0 shown behind it is its corresponding i2c device node</p></li><li><p>b) 5002400 is the register base address of the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li><li><p>c) 5002800 is the register base address of the i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p></li></ol></li></ol>|}</li></ol><ol start="4" style="list-style-type: decimal;"><li><p>Then start testing i2c, first install i2c-tools</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''TWI0_SDA/UART2_RXsudo apt-get update'''</p>| <p>orangepi@orangepi:~$ '''PI6sudo apt-get install -y i2c-tools'''</p>| }</li><li><p>Then connect an i2c device to the i2c pin of the 40pin connector</p></li><li><p>Then use the '''262i2cdetect -y x'''x command. If the address of the connected i2c device can be detected, it means that i2c can be used normally.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''230Note that x in the i2cdetect -y x command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p>| <p>'''PH6Different i2c device addresses are different. The 0x50 address in the picture below is just an example. Please refer to what you actually see.'''</p></big>| '''SPI1_CLK'''}<div class="figure"> [[File:zero2w-img174.png]] </div></li></ol> <span id="pin-uart-test"></span> === 40pin UART test === # As can be seen from the table below, the available uarts are uart2, uart3, uart4 and uart5. Please note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial port. <div style="display: flex;">::{| '''23'''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'''
|-
| '''266264'''| '''PI10PI8'''| '''TWI2TWI1-SDA/UART3_RX'''| '''27'''|| '''28'''| '''TWI2-SCL/UART3_TX'''| '''PI9'''| '''2653'''
|-
| '''256263'''| '''PI0PI7'''| '''TWI1-SCL'''| '''5'''|-| '''269'''| '''PI13'''| '''PWM3/UART4_TX'''| '''7'''|-| style="text-align: left;"|
| style="text-align: left;"|
| '''29'''
|
| '''30'''
| '''GND'''
| style="text'''9'''|-align: left;"|'''226'''| style="text-align: left;"'''PH2'''| '''UART5_TX'''|'''11'''
|-
| '''271227'''| '''PI15'''| style="text-align: left;"|| '''31'''|| '''32'''| '''PWM1PH3'''| '''PI11UART5_RX'''| '''26713'''
|-
| '''268261'''| '''PI12PI5'''| '''PWM2TWI0_SCL/UART2_TX'''| '''3315'''|| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''258'''
| '''PI2'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''PC123.3V'''| '''7617'''
|-
| '''272231'''| '''PI16PH7'''| '''SPI1_MOSI'''| '''19'''| style="text-align: left;"|'''232'''| '''37PH8'''|'''SPI1_MISO'''| '''3821'''| style="text-align: left;"| '''230'''|'''PH6'''| '''PI4SPI1_CLK'''| '''26023'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''3925'''|| '''40'''| style="text-align: left;"|| '''PI3'''| '''259'''|} <ol start="2" style="list-style-type: decimal;"><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><ol style="list-style-type: lower-alpha;"><li><p>First run '''orangepi-config'''. Ordinary users remember to add &gt; '''sudo''' permissions.</p><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 &gt; in the picture below, and then use the '''space''' to select the &gt; serial port you want to open.</p></li></ol></li></ol> {| class="wikitable"
|-
| '''Multiplexing function in 40pin266'''| '''Corresponding dtbo configurationPI10'''| '''TWI2-SDA/UART3_RX'''| '''27'''
|-
| '''40pin - uart2256'''| '''piPI0'''| style="text-uart2align: left;"|| '''29'''
|-
| '''40pin - uart3271'''| '''piPI15'''| style="text-uart3align: left;"|| '''31'''
|-
| '''40pin - uart4268'''| '''pi-uart4PI12'''| '''PWM2'''| '''33'''
|-
| '''40pin 258'''| '''PI2'''| style="text-align: left;"|| '''35'''|- uart5| '''272'''| '''PI16'''| style="text-align: left;"|| '''ph37'''|-| style="text-align: left;"|| style="text-uart5align: left;"|| '''GND'''| '''39'''
|}
 [[File:zero2w-img175.png]] <ol start{| class="5wikitable" style="list-style-typewidth: lower-alpha390px;"><li><p>Then select '''&lt;Save&gt;''' to save</p><p>[[File:zero2wmargin-img83.png]]</p></li><li><p>Then select '''&lt;Back&gt;'''</p><p>[[Fileright:zero2w-img84.png]]</p></li><li><p>Then select '''&lt;Reboot&gt20px;''' to restart the system to make the &gt; configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol> <!-- --><ol start="3" style="listtext-style-typealign: decimalcenter;"><li><p>After entering the Linux system, first confirm whether there is a uart5 device node under '''/dev'''</p><p>'''Note that the linux5.4 system is /dev/ttyASx.'''</p><p>orangepi@orangepi:~$ '''ls /dev/ttyS*'''</p><p>/dev/ttySx</p></li><li><p>Then start testing the uart interface. First use Dupont wire to short-circuit the rx and tx pins of the uart interface to be tested.</p></li><li><p>Use the '''gpio''' command in wiringOP to test the loopback function of the serial port as shown below. If you can see the following print, it means the serial port communication is normal.</p><p>'''Note that the last x in the gpio serial /dev/ttySx command needs to be replaced with the serial number of the corresponding uart device node.'''</p><p>orangepi@orangepi:~$ '''gpio serial /dev/ttySx # linux-6.1 test command'''</p><p>orangepi@orangepi:~$ '''gpio serial /dev/ttyASx # linux-5.4 test command'''</p><p>Out: 0: -&gt; 0</p><p>Out: 1: -&gt; 1</p><p>Out: 2: -&gt; 2</p><p>Out: 3: -&gt; 3^C</p></li></ol> <span id="pwm-test-method"></span>=== PWM test method === # As can be seen from the following table, the available pwm are pwm1, pwm2, pwm3 and pwm4. {| class="wikitable"
|-
| '''GPIO NO.'''| '''GPIO'''| '''Function'''| '''Pin'''|| '''Pinpin'''
| '''Function'''
| '''GPIO'''
| '''GPIO NO.'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|
| '''2'''
| '''5V'''
| style="text-align: left;"|
|-
| '''264'''
| '''PI8'''
| '''TWI1-SDA'''
| '''3'''
|
| '''4'''
| '''5V'''
| style="text-align: left;"|
|-
| '''263'''
| '''PI7'''
| '''TWI1-SCL'''
| '''5'''
|
| '''6'''
| '''GND'''
| style="text-align: left;"|
|-
| '''269'''
| '''PI13'''
| '''PWM3/UART4_TX'''
| '''7'''
|
| '''8'''
| '''UART0_TX'''
| '''224'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''9'''
|
| '''10'''
| '''UART0_RX'''
| '''225'''
|-
| '''226'''
| '''PH2'''
| '''UART5_TX'''
| '''11'''
|
| '''12'''
| style="text-align: left;"|
| '''257'''
|-
| '''227'''
| '''PH3'''
| '''UART5_RX'''
| '''13'''
|
| '''14'''
| '''GND'''
| style="text-align: left;"|
|-
| '''261'''
| '''PI5'''
| '''TWI0_SCL/UART2_TX'''
| '''15'''
|
| '''16'''
| '''PWM4/UART4_RX'''
| '''270'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|
| '''18'''
| style="text-align: left;"|
| '''228'''
|-
| '''231'''
| '''PH7'''
| '''SPI1_MOSI'''
| '''19'''
|
| '''20'''
| '''GND'''
| style="text-align: left;"|
|-
| '''232'''
| '''PH8'''
| '''SPI1_MISO'''
| '''21'''
|
| '''22'''
| '''TWI0_SDA/UART2_RX'''
| '''262'''
|-
| '''230'''
| '''PH6'''
| '''SPI1_CLK'''
| '''23'''
|
| '''24'''
| '''SPI1_CS0'''
| '''229'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''25'''
|
| '''26'''
| '''SPI1_CS1'''
| '''233'''
|-
| '''266'''
| '''PI10'''
| '''TWI2-SDA/UART3_RX'''
| '''27'''
|
| '''28'''
| '''TWI2-SCL/UART3_TX'''
| '''265'''
|-
| '''256'''
| '''PI0'''
| style="text-align: left;"|
| '''29'''
|
| '''30'''
| '''GND'''
| style="text-align: left;"|
|-
| '''271'''| '''PI15'''| style="text-align: left;"|| '''31'''|| '''32'''| '''PWM1'''
| '''PI11'''
| '''267'''
|-
| '''268'''
| '''PI12'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
|-
| '''258'''
| '''PI2'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''76'''
|-
| '''272'''
| '''PI16'''
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''260'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''39'''
|
| '''40'''
| style="text-align: left;"|
| '''259'''
|}
</div>
<ol start="2" style="list-style-type: decimal;">
<li><p>pwm In Linux systems, uart is turned off by default in Linux systems and needs to be turned on manually to use before itcan be used. The opening steps are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First run '''orangepi-config'''. Ordinary users remember to add &gt; '''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 &gt; in the figure picture below, and then use the '''space''' to select the &gt; configuration corresponding to the pwm serial port you want to open.</p><p/li{| class="wikitable" style="width:800px;text-align: center;"|-| '''Multiplexing function in 40pin'''| '''Corresponding dtbo configuration'''|-| '''40pin - uart2'''| '''pi-uart2'''|-| '''40pin - uart3'''| '''pi-uart3'''|-| '''40pin - uart4'''| '''pi-uart4'''|-| '''40pin - uart5'''| '''ph-uart5'''|} [[File:zero2w-img176img175.png]]</pol></liol start="5" style="list-style-type: lower-alpha;">
<li><p>Then select '''&lt;Save&gt;''' to save</p>
<p>[[File:zero2w-img83.png]]</p></li>
<li><p>Then select '''&lt;Back&gt;'''</p>
<p>[[File:zero2w-img84.png]]</p></li>
<li><p>Then select '''&lt;Reboot&gt;''' to restart the system to make the &gt; configuration take effect.</p>
<p>[[File:zero2w-img85.png]]</p></li></ol>
</li><li><p>After restarting, you can start the PWM test</pol><p>'''Please execute the following commands under the root user.'''</p!-- --><ol start="3" style="list-style-type: lower-alphadecimal;"><li><p>Enter After entering the following command on the command line to make pwm1 &gt; output Linux system, first confirm whether there is a 50Hz square waveuart5 device node under '''/dev'''</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>root@orangepi:~# '''echo 1 &gt; Note that the linux5.4 system is /sysdev/class/pwm/pwmchip0/exportttyASx.'''</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>rootorangepi@orangepi:~# $ '''echo 20000000 &gt; ls /sysdev/class/pwm/pwmchip0/pwm1/periodttyS*'''</p><p>root@orangepi:~# '''echo 1000000 &gt; /sysdev/classttySx</pwmp>|}</pwmchip0li><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.</pwm1p></duty_cycleli><li><p>Use the '''gpio''' command in wiringOP to test the loopback function of the serial port as shown below. If you can see the following print, it means the serial port communication is normal.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>root@orangepi:~# '''echo 1 &gt; Note that the last x in the gpio serial /sysdev/class/pwm/pwmchip0/pwm1/enablettySx command needs to be replaced with the serial number of the corresponding uart device node.'''</p></libig><li>|}{| class="wikitable" style="width:800px;" |-| <p>Enter the following orangepi@orangepi:~$ '''gpio serial /dev/ttySx # linux-6.1 test command on the command line to make pwm2 &gt; output a 50Hz square wave'''</p></lip><orangepi@orangepi:~$ '''gpio serial /ol><dev/li>ttyASx # linux-5.4 test command'''</olp>
root@orangepi:~# '''echo 2 &gt; /sys/class/pwm/pwmchip0/export'''
root@orangepi<p>Out:~# '''echo 20000000 0: -&gt; 0</sysp><p>Out: 1: -&gt; 1</classp><p>Out: 2: -&gt; 2</pwmp><p>Out: 3: -&gt; 3^C</pwmchip0p>|}</pwm2li></period'''ol>
root@orangepi:~# '''echo 1000000 &gt; /sys/class/<span id="pwm-test-method"></pwmchip0/pwm2/duty_cycle'''span>
root@orangepi:~# '''echo 1 &gt; /sys/class/pwm/pwmchip0/pwm2/enable'''=== PWM test method ===
<ol start="3" style="list-style-type: lower-alpha;"><li>Enter # As can be seen from the following command on table, the command line to make available pwm are pwm1, pwm2, pwm3 output &gt; a 50Hz square wave</li></ol>and pwm4.
root@orangepi<div style="display: flex;">::{| class="wikitable" style="width:~# 390px;margin-right: 20px;text-align: center;"|-| '''echo 3 &gt; /sys/class/pwm/pwmchip0/exportGPIO NO.''' root@orangepi:~# | '''echo 20000000 &gt; /sys/class/pwm/pwmchip0/pwm3/periodGPIO''' root@orangepi:~# | '''echo 1000000 &gt; /sys/class/pwm/pwmchip0/pwm3/duty_cycleFunction''' root@orangepi:~# | '''echo 1 &gt; /sys/class/pwm/pwmchip0/pwm3/enablePin'''|-<ol start| style="4text-align: left;" || style="listtext-style-typealign: lower-alphaleft;">|<li>Enter the following command on the command line to make pwm4 output &gt; a 50Hz square wave</li></ol> root@orangepi:~# | '''echo 4 &gt; /sys/class/pwm/pwmchip0/export3.3V''' root@orangepi:~# | '''echo 20000000 &gt; /sys/class/pwm/pwmchip0/pwm4/period1'''|-root@orangepi:~# | '''echo 1000000 &gt; /sys/class/pwm/pwmchip0/pwm4/duty_cycle264''' root@orangepi:~# | '''echo 1 &gt; /sys/class/pwm/pwmchip0/pwm4/enablePI8''' <div class="figure"> [[File:zero2w| '''TWI1-img177.png]]SDA'''| '''3'''</div><span id="how-to-install-and-use-wiringop|-python"></span> == How to install and use wiringOP-Python ==| '''263'''| '''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.PI7''' | '''wiringOPTWI1-Python is the Python language version of wiringOP library, used to operate the development board's GPIO, I2C, SPI, UART and other hardware resources in the Python programSCL''' | '''Also please note that all the following commands are operated under the root user.5'''|-| '''<span idstyle="how-to-install-wiringop-pythoncolor:#FF0000">269</span>'''=== How to install wiringOP-Python === | '''<ol span style="list-style-typecolor: decimal;#FF0000"><li><p>First install dependency packagesPI13</pspan><p>root@orangepi:~# '''sudo apt-get update| '''</pspan style="color:#FF0000">PWM3<p/span>root@orangepi:~# /UART4_TX'''sudo apt-get -y install git swig python3-dev python3-setuptools| '''</pspan style="color:#FF0000">7</lispan>'''|-<li><p>Then use the following command to download the source code of wiringOP| style="text-Python</p></li></ol>align: left;"|| style="text-align: left;"|| '''Note that the following git clone--recursive command will automatically download the source code of wiringOP, because wiringOP-Python depends on wiringOP. Please make sure there are no errors during the download process due to network problems.GND'''| '''9'''If there is a problem downloading the code from GitHub, you can directly use the wiringOP|-Python source code that comes with the Linux image. The storage location is: | '''/usr/src/wiringOP-Python226''' root@orangepi:~# | '''git clone --recursive https://github.com/orangepi-xunlong/wiringOP-Python -b nextPH2''' root@orangepi:~# | '''cd wiringOP-PythonUART5_TX''' root@orangepi:~/wiringOP-Python# | '''git submodule update --init --remote11''' <ol start="3" style="list|-style-type: decimal;"><li><p>Then use the following command to compile wiringOP-Python and install it into the Linux system of the development board</p>| '''227'''<p>root@orangepi:~# | '''cd wiringOP-PythonPH3'''</p><p>root@orangepi:~/wiringOP-Python# | '''python3 generate-bindings.py &gt; bindings.iUART5_RX'''</p><p>root@orangepi:~/wiringOP-Python# | '''sudo python3 setup.py install13'''</p></li><li><p>Then enter the following command. If helpful information is output, it means wiringOP|-Python is successfully installed. Press the | '''q261''' key to exit the help information interface.</p></li></ol> root@orangepi:~/wiringOP-Python# | '''python3 -c &quot;import wiringpi; help(wiringpi)&quot;PI5''' Help on module wiringpi: NAME wiringpi DESCRIPTION # This file was automatically generated by SWIG (http:| '''TWI0_SCL//www.swig.org).UART2_TX'''| '''15'''# Version 4.0.2 # # Do not make changes to this file unless you know what you are doing|--modify # the SWIG interface file instead. <ol start="5" | style="listtext-style-typealign: decimalleft;">|<li><p>The steps to test whether wiringOP-Python is installed successfully under the python command line are as follows:</p><ol | style="listtext-style-typealign: lower-alphaleft;">|<li>First use the python3 command to enter the command line mode of &gt; python3</li></ol></li></ol> root@orangepi:~# | '''python33.3V''' <ol start="2" style="list-style-type: lower-alpha;"><li>Then import the python module of wiringpi</li></ol> &gt;&gt;&gt; | '''import wiringpi;17''' <ol start="3" style="list|-style-type: lower-alpha;"><li>Finally, enter the following command to view the help information of &gt; wiringOP-Python. Press the q key to exit the help information &gt; interface.</li></ol> &gt;&gt;&gt; | '''help(wiringpi)231''' Help on module wiringpi: NAME wiringpi DESCRIPTION # This file was automatically generated by SWIG (http://www.swig.org). # Version 4.0.2 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. CLASSES builtins.object GPIO I2C Serial nes class GPIO(builtins.object) | GPIO(pinmode=0) | &gt;&gt;&gt; <span id="pin-gpio-port-test-1"></span>=== 40pin GPIO port test === '''Like wiringOP, wiringOP-Python can also determine which GPIO pin to operate by specifying the wPi number. Because there is no command to view the wPi number in wiringOP-Python, you can only view the board's wPi number and physics through the gpio command in wiringOP Correspondence of pins.PH7''' [[File:zero2w-img170.png]] <ol style="list-style-type: decimal;"><li><p>The following uses pin No. 7 - corresponding to GPIO PI13 - corresponding to wPi serial number 2 - as an example to demonstrate how to set the high and low levels of the GPIO port.</p><p>[[File:zero2w-img171.png]]</p></li><li><p>The steps for testing directly with commands are as follows:</p><ol style="list-style-type: lower-alpha;"><li><p>First set the GPIO port to output mode, where the first &gt; parameter of the | '''pinModeSPI1_MOSI''' function is the serial number of &gt; the wPi corresponding to the pin, and the second parameter is &gt; the GPIO mode.</p><p>root@orangepi:~/wiringOP-Python# | '''python3 -c &quot;import wiringpi; \19'''</p><p>|-| '''from wiringpi import GPIO; wiringpi.wiringPiSetup() ; \232'''</p><p>| '''wiringpi.pinMode(2, GPIO.OUTPUT) ; &quot;PH8'''</p></li><li><p>Then set the GPIO port to output a low level. After setting, you &gt; can use a multimeter to measure the voltage value of the pin. &gt; If it is 0v, it means the low level is set successfully.</p><p>root@orangepi:~/wiringOP-Python# | '''python3 -c &quot;import wiringpi; \SPI1_MISO'''</p><p>| '''from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\21'''</p><p>|-| '''wiringpi.digitalWrite(2, GPIO.LOW)&quot;230'''</p></li><li><p>Then set the GPIO port to output a high level. After setting, &gt; you can use a multimeter to measure the voltage value of the &gt; pin. If it is 3.3v, it means the setting of the high level is &gt; successful.</p><p>root@orangepi:~/wiringOP-Python# | '''python3 -c &quot;import wiringpi; \PH6'''</p><p>| '''from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\SPI1_CLK'''</p><p>| '''wiringpi.digitalWrite(2, GPIO.HIGH)&quot;23'''</p></li></ol></li>|-<li><p>The steps for testing in the command line of python3 are as follows| style="text-align:</p>left;"|<ol | style="listtext-style-typealign: lower-alphaleft;">|<li><p>First use the python3 command to enter the command line mode of &gt; python3</p>| '''GND'''<p>root@orangepi:~# | '''python325'''</p></li><li><p>Then import the python module of wiringpi</p>|-<p>&gt;&gt;&gt; | '''import wiringpi266'''</p><p>&gt;&gt;&gt; | '''from wiringpi import GPIOPI10'''</p></li><li><p>Then set the GPIO port to output mode, where the first parameter &gt; of the | '''pinModeTWI2-SDA/UART3_RX'''function is the serial number of the wPi &gt; corresponding to the pin, and the second parameter is the GPIO &gt; mode.</p><p>&gt;&gt;&gt; | '''wiringpi.wiringPiSetup()27'''</p><p>0</p>|-<p>&gt;&gt;&gt; | '''wiringpi.pinMode(2, GPIO.OUTPUT)256'''</p></li><li><p>Then set the GPIO port to output a low level. After setting, you &gt; can use a multimeter to measure the voltage value of the pin. &gt; If it is 0v, it means the low level is set successfully.</p><p>&gt;&gt;&gt; | '''wiringpi.digitalWrite(2, GPIO.LOW)PI0'''</p></li><li><p>Then set the GPIO port to output a high level. After setting, &gt| style="text-align: left; you can use a multimeter to measure the voltage value of the &gt; pin. If it is 3.3v, it means the setting of the high level is &gt; successful.</p>"|<p>&gt;&gt;&gt; | '''wiringpi.digitalWrite(2, GPIO.HIGH)29'''</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.py271''' test program in the examples. The | '''blink.pyPI15''' test program will set the voltage of all GPIO ports in the 40 Pin of the development board to continuously change high and low.</p><p>root@orangepi| style="text-align:~/wiringOP-Python# left;"|| '''cd examples31'''</p><p>root@orangepi:~/wiringOP|-Python/examples# '''ls blink.py| '''</pspan style="color:#FF0000">268<p/span>'''blink.py| '''</pspan style="color:#FF0000">PI12<p/span>root@orangepi:~/wiringOP-Python/examples'''# python3 blink.py| '''</pspan style="color:#FF0000">PWM2</li></olspan>''' | '''<span idstyle="pin-spi-test-1color:#FF0000">33</span>=== 40pin SPI test === # As can be seen from the table below, the spi available for the 40pin interface is spi1, and there are two chip select pins cs0 and cs1 {| class="wikitable"'''|-| '''GPIO NO.258'''| '''GPIOPI2'''| '''Function'''style="text-align: left;"|| '''Pin35'''|-| '''Pin272'''| '''FunctionPI16'''| '''GPIO'''style="text-align: left;"|| '''GPIO NO.37'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3VGND'''| '''39'''|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''Pin'''| '''Function'''| '''GPIO'''| '''1GPIO NO.'''|-| '''2'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''264'''
| '''PI8'''
| '''TWI1-SDA'''
| '''3'''
|
| '''4'''
| '''5V'''
| style="text-align: left;"|
|-
| '''263'''
| '''PI7'''
| '''TWI1-SCL'''
| '''5'''
|
| '''6'''
| '''GND'''
| style="text-align: left;"|
|-
| '''269'''| '''PI13'''| '''PWM3/UART4_TX'''| '''7'''|| '''8'''
| '''UART0_TX'''
| '''PH0'''
| '''224'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''9'''
|
| '''10'''
| '''UART0_RX'''
| '''225'''
|-
| '''226'''
| '''PH2'''
| '''UART5_TX'''
| '''11'''
|
| '''12'''
| style="text-align: left;"|
| '''257'''
|-
| '''227'''
| '''PH3'''
| '''UART5_RX'''
| '''13'''
|
| '''14'''
| '''GND'''
| style="text-align: left;"|
|-
| '''261'''| '''PI5'''| '''TWI0_SCL<span style="color:#FF0000">16</UART2_TX'''| '''15'''|| '''16span>'''| '''<span style="color:#FF0000">PWM4</span>/UART4_RX'''| '''<span style="color:#FF0000">PI14</span>'''| '''<span style="color:#FF0000">270</span>'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|
| '''18'''
| style="text-align: left;"|
| '''228'''
|-
| '''231'''
| '''PH7'''
| '''SPI1_MOSI'''
| '''19'''
|
| '''20'''
| '''GND'''
| style="text-align: left;"|
|-
| '''232'''
| '''PH8'''
| '''SPI1_MISO'''
| '''21'''
|
| '''22'''
| '''TWI0_SDA/UART2_RX'''
| '''262'''
|-
| '''230'''
| '''PH6'''
| '''SPI1_CLK'''
| '''23'''
|
| '''24'''
| '''SPI1_CS0'''
| '''229'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''25'''
|
| '''26'''
| '''SPI1_CS1'''
| '''233'''
|-
| '''266'''
| '''PI10'''
| '''TWI2-SDA/UART3_RX'''
| '''27'''
|
| '''28'''
| '''TWI2-SCL/UART3_TX'''
| '''265'''
|-
| '''256'''| '''PI0'''| style="text-align: left;"|| '''29'''|| '''30'''| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''271'''| '''PI15'''| <span style="text-aligncolor: left;#FF0000"|| '''31'''|| '''>32</span>'''| '''<span style="color:#FF0000">PWM1</span>'''| '''<span style="color:#FF0000">PI11</span>'''| '''<span style="color:#FF0000">267</span>'''
|-
| '''268'''
| '''PI12'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
|-
| '''258'''
| '''PI2'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''76'''
|-
| '''272'''
| '''PI16'''
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''260'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''39'''
|
| '''40'''
| style="text-align: left;"|
| '''259'''
|}
</div>
<ol start="2" style="list-style-type: decimal;">
<li><p>In Linux systems, spi1 pwm is turned off by default in Linux systems and needs to be turned on manually before to use 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 &gt; '''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 &gt; in the figure below, and then use the '''space''' to select the &gt; dtbo configuration of corresponding to the SPI pwm you want to open.</p></lip>[[File:zero2w-img176.png]]</olp></li></ol> {| class="wikitable"|-| '''dtbo configuration'''| '''illustrate'''|-| '''spi1-cs0-cs1-spidev'''| '''Open cs0 and cs1 of spi1 at the same time'''|-| '''spi1-cs0-spidev'''| '''Only open cs0 of spi1'''|-| '''spi1-cs1-spidev'''| '''Only open cs1 of spi1'''|} <ol start="5" style="list-style-type: lower-alpha;">
<li><p>Then select '''&lt;Save&gt;''' to save</p>
<p>[[File:zero2w-img83.png]]</p></li>
<li><p>Then select '''&lt;Back&gt;'''</p>
<p>[[File:zero2w-img84.png]]</p></li>
<li><p>Then select '''&lt;Reboot&gt;''' to restart the system to make the &gt; configuration take effect.</p>
<p>[[File:zero2w-img85.png]]</p></li></ol>
</li><!-- --li><ol p>After restarting, you can startthe PWM test</p>{| class="3wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;"><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</pbig><p>'''Note that only when you open spi1-cs0-cs1-spidev, you will see Please execute the device nodes of following commands under the two spiroot user.'''</p></libig><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>Enter the following command on the command line to make pwm1 output a 50Hz square wave</p>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~# '''--channelecho 1 &gt; /sys/class/pwm/pwmchip0/export''': Specify the channel number of SPI</p><p>root@orangepi:~# '''echo 20000000 &gt; /lisys/class/pwm/pwmchip0/pwm1/period'''</p><li><p>root@orangepi:~# '''--portecho 1000000 &gt; /sys/class/pwm/pwmchip0/pwm1/duty_cycle''': Specify the port number of the SPI</p><p>root@orangepi:~# '''echo 1 &gt; /sys/class/pwm/li>pwmchip0/pwm1/enable'''</olp>|}
</li>
<li><p>Without shorting Enter the mosi and miso pins of SPI1, following command on the command line to make pwm2 output result of running spidev_test.py is as follows. You can see that the data of TX and RX are inconsistent.a 50Hz square wave</p><p/li>{| class="wikitable" style="width:800px;" |-| root@orangepi:~/wiringOP-Python# '''cd examplesecho 2 &gt; /sys/class/pwm/pwmchip0/export'''</p></li></ol>
root@orangepi:~/wiringOP-Python/examples# '''python3 spidev_test.py \echo 20000000 &gt; /sys/class/pwm/pwmchip0/pwm2/period'''
root@orangepi:~# '''--channel 1 --port 0echo 1000000 &gt; /sys/class/pwm/pwmchip0/pwm2/duty_cycle'''
spi moderoot@orangepi: 0x0~# '''echo 1 &gt; /sys/class/pwm/pwmchip0/pwm2/enable'''|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>Enter the following command on the command line to make pwm3 output a 50Hz square wave</li>{| class="wikitable" style="width:800px;" |-| root@orangepi:~# '''echo 3 &gt; /sys/class/pwm/pwmchip0/export'''
max speedroot@orangepi: 500000 Hz (500 KHz)~# '''echo 20000000 &gt; /sys/class/pwm/pwmchip0/pwm3/period'''
Opening device root@orangepi:~# '''echo 1000000 &gt; /devsys/spidev1.1class/pwm/pwmchip0/pwm3/duty_cycle'''
TX | FF FF FF FF FF FF root@orangepi:~# '''40 00 00 00 00 95echo 1 &gt; /sys/class/pwm/pwmchip0/pwm3/enable''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |}</ol><ol start="4" style="list-style-type: lower-alpha;"><li>Enter the following command on the command line to make pwm4 output a 50Hz square wave</li>{| class="wikitable" style="width:800px;" |......-| root@.......…|orangepi:~# '''echo 4 &gt; /sys/class/pwm/pwmchip0/export'''
RX | FF FF FF FF FF FF root@orangepi:~# '''FF FF FF FF FF FFecho 20000000 &gt; /sys/class/pwm/pwmchip0/pwm4/period''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF |.............….|
<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><p>root@orangepi:~/wiringOP-Python# '''cd examplesecho 1000000 &gt; /sys/class/pwm/pwmchip0/pwm4/duty_cycle'''</p></li></ol>
root@orangepi:~/wiringOP-Python/examples# '''python3 spidev_test.py \echo 1 &gt; /sys/class/pwm/pwmchip0/pwm4/enable'''|}
'''--channel 1 --port 0'''<div class="figure">
spi mode[[File: 0x0zero2w-img177.png]]
max speed: 500000 Hz (500 KHz)</div></ol></li></ol><span id="how-to-install-and-use-wiringop-python"></span>
Opening device /dev/spidev1.1== How to install and use wiringOP-Python ==
TX {| FF FF FF FF FF FF class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''40 00 00 00 00 95Note: The pin header on the 40pin interface is not soldered by default, and you need to solder it yourself before it can be used.''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D </big>|......@.......…}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-|<big>'''wiringOP-Python is the Python language version of wiringOP library, used to operate the development board's GPIO, I2C, SPI, UART and other hardware resources in the Python program'''
RX | FF FF FF FF FF FF '''40 00 00 00 00 95Also please note that all the following commands are operated under the root user.''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…</big>|}
<span id="pinhow-i2cto-testinstall-1wiringop-python"></span>=== 40pin I2C test How to install wiringOP-Python ===
# As can be seen from the table below, the i2c available for the 40pin interface are i2c0, i2c1 and i2c2<ol style="list-style-type: decimal;"><li><p>First install dependency packages</p>{| class="wikitable" style="width:800px;"
|-
| '''GPIO NO.'''| '''GPIO'''| <p>root@orangepi:~# '''Functionsudo apt-get update'''</p>| <p>root@orangepi:~# '''Pinsudo apt-get -y install git swig python3-dev python3-setuptools'''</p>|}| '''Pin'''| '''Function'''</li>| '''GPIO'''<li><p>Then use the following command to download the source code of wiringOP-Python</p></li>{| '''GPIO NO.'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| style="text-align: left;"|| style="text-align: left;"|| <big>'''3Note that the following git clone--recursive command will automatically download the source code of wiringOP, because wiringOP-Python depends on wiringOP. Please make sure there are no errors during the download process due to network problems.3V'''| '''1'''|| '''2If there is a problem downloading the code from GitHub, you can directly use the wiringOP-Python source code that comes with the Linux image. The storage location is: /usr/src/wiringOP-Python'''</big>| '''5V'''}{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| root@orangepi:~# '''264git clone --recursive https://github.com/orangepi-xunlong/wiringOP-Python -b next'''| '''PI8'''| root@orangepi:~# '''TWI1cd wiringOP-SDAPython'''| root@orangepi:~/wiringOP-Python# '''3git submodule update --init --remote'''|}| '''4'''| '''5V'''</ol>| <ol start="3" style="textlist-alignstyle-type: leftdecimal;"|><li><p>Then use the following command to compile wiringOP-Python and install it into the Linux system of the development board</p>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| '''263'''| <p>root@orangepi:~# '''PI7cd wiringOP-Python'''</p>| <p>root@orangepi:~/wiringOP-Python# '''TWI1python3 generate-SCLbindings.py &gt; bindings.i'''</p>| <p>root@orangepi:~/wiringOP-Python# '''5sudo python3 setup.py install'''</p>|}| '''6'''</li>| <li><p>Then enter the following command. If helpful information is output, it means wiringOP-Python is successfully installed. Press the '''GNDq'''key to exit the help information interface.</p></li>{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| root@orangepi:~/wiringOP-Python# '''269python3 -c &quot;import wiringpi; help(wiringpi)&quot;'''| '''PI13'''| '''PWM3Help on module wiringpi:  NAME :wiringpi  DESCRIPTION : # This file was automatically generated by SWIG (http://UART4_TX'''www.swig.org). : # Version 4.0.2 : # : # Do not make changes to this file unless you know what you are doing--modify : # the SWIG interface file instead.| '''7'''}</ol>|<ol start="5" style="list-style-type: decimal;">| '''8'''<li><p>The steps to test whether wiringOP-Python is installed successfully under the python command line are as follows:</p>| '''UART0_TX'''<ol style="list-style-type: lower-alpha;">| '''PH0'''<li>First use the python3 command to enter the command line mode of &gt; python3</li>{| '''224'''class="wikitable" style="width:800px;"
|-
| root@orangepi:~# '''python3'''|}</ol><ol start="2" style="textlist-alignstyle-type: leftlower-alpha;"|><li>Then import the python module of wiringpi</li>{| class="wikitable" style="text-alignwidth: left800px;"|| '''GND'''| '''9'''|| '''10'''| '''UART0_RX'''| '''PH1'''| '''225'''
|-
| '''226'''| &gt;&gt;&gt; '''PH2'''| '''UART5_TXimport wiringpi;'''| '''11'''}|</ol>| '''12'''| <ol start="3" style="textlist-alignstyle-type: leftlower-alpha;"|>| '''PI1'''<li>Finally, enter the following command to view the help information of &gt; wiringOP-Python. Press the q key to exit the help information &gt; interface.</li>{| '''257'''class="wikitable" style="width:800px;"
|-
| &gt;&gt;&gt; '''227help(wiringpi)'''| '''PH3'''| '''UART5_RX'''Help on module wiringpi:  NAME :wiringpi  DESCRIPTION : # This file was automatically generated by SWIG (http://www.swig.org). | '''13''': # Version 4.0.2|| '''14''': #| '''GND'''| style="text: # Do not make changes to this file unless you know what you are doing--alignmodify : left;"|# the SWIG interface file instead.  CLASSES | style="text-align: left;"|builtins.object |-::GPIO| '''261'''| '''PI5'''::I2C| '''TWI0_SCL/UART2_TX'''| '''15'''::Serial|| '''16'''::nes| '''PWM4/UART4_RX'''| '''PI14'''| '''270''':class GPIO(builtins.object)|-:| styleGPIO(pinmode="text-align0) : left|  &gt;&gt;&gt;"|}</ol>| style</li></ol><span id="textpin-gpio-port-test-align: left;1"|| '''3.3V'''></span>| '''17'''|=== 40pin GPIO port test ===| '''18'''{| class="wikitable" style="textbackground-aligncolor: left#ffffdc;width:800px;"|| '''PH4'''| '''228'''
|-
| <big>'''231Like 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| '''PH7'''center]]| '''SPI1_MOSI'''} <ol style="list-style-type: decimal;"><li><p>The following uses pin No. 7 - corresponding to GPIO PI13 - corresponding to wPi serial number 2 - as an example to demonstrate how to set the high and low levels of the GPIO port.</p>| '''19'''<p>[[File:zero2w-img171.png]]</p></li>|<li><p>The steps for testing directly with commands are as follows:</p>| '''20'''<ol style="list-style-type: lower-alpha;">| <li><p>First set the GPIO port to output mode, where the first parameter of the '''GNDpinMode'''function is the serial number of the wPi corresponding to the pin, and the second parameter is the GPIO mode.</p>{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| '''232'''| <p>root@orangepi:~/wiringOP-Python# '''PH8python3 -c &quot;import wiringpi; \'''</p>| <p>'''SPI1_MISOfrom wiringpi import GPIO; wiringpi.wiringPiSetup() ; \'''</p>| <p>'''21wiringpi.pinMode(<span style="color:#FF0000">2, GPIO.OUTPUT</span>) ; &quot;'''</p>|}| '''22'''</li>| '''TWI0_SDA<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.</UART2_RX'''p>{| '''PI6'''| '''262'''class="wikitable" style="width:800px;"
|-
| '''230'''| <p>root@orangepi:~/wiringOP-Python# '''PH6python3 -c &quot;import wiringpi; \'''</p>| <p>'''SPI1_CLKfrom wiringpi import GPIO; wiringpi.wiringPiSetup() ;\'''</p>| <p>'''23wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.LOW</span>)&quot;'''</p>|}| '''24'''</li>| '''SPI1_CS0'''| '''PH5'''<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>{| '''229'''class="wikitable" style="width:800px;"
|-
| style="text-align<p>root@orangepi: left;"|| style="text~/wiringOP-align: left;"|| Python# '''GNDpython3 -c &quot;import wiringpi; \'''</p>| <p>'''25from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\'''</p>|| <p>'''26wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.HIGH</span>)&quot;'''</p>| '''SPI1_CS1'''}</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;">| '''PH9'''<li><p>First use the python3 command to enter the command line mode of python3</p>{| '''233'''class="wikitable" style="width:800px;"
|-
| '''266'''| <p>root@orangepi:~# '''PI10python3'''| '''TWI2-SDA</UART3_RX'''p>| '''27'''}|| '''28'''</li>| '''TWI2-SCL<li><p>Then import the python module of wiringpi</UART3_TX'''| '''PI9'''p>{| '''265'''class="wikitable" style="width:800px;"
|-
| '''256'''| <p>&gt;&gt;&gt; '''PI0import wiringpi'''</p>| style="text-align: left<p>&gt;&gt;&gt;"|| '''29from wiringpi import GPIO'''</p>|}| '''30'''</li>| <li><p>Then set the GPIO port to output mode, where the first parameter of the '''GNDpinMode'''function is the serial number of the wPi corresponding to the pin, and the second parameter is the GPIO mode.</p>{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| <p>&gt;&gt;&gt; '''wiringpi.wiringPiSetup()'''</p><p>0</p><p>&gt;&gt;&gt; '''271wiringpi.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>&gt;&gt;&gt; '''PI15wiringpi.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>&gt;&gt;&gt; '''wiringpi.digitalWrite(2, <span style="textcolor:#FF0000">GPIO.HIGH</span>)'''</p>|}</li></ol></li><li><p>For wiringOP-alignPython 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: left800px;"|-| <p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p><p>root@orangepi:~/wiringOP-Python/examples# '''ls blink.py'''</p><p>'''31blink.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;"|-| '''32GPIO NO.'''| '''PWM1GPIO'''| '''PI11Function'''| '''267Pin'''
|-
| '''268'''
| '''PI12'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-
| '''258264'''| '''PI2PI8'''| '''TWI1-SDA'''| '''3'''|-| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''| style="text-align: left;"|'''269'''| '''35PI13'''|'''PWM3/UART4_TX'''| '''367'''|-| style="text-align: left;"|
| style="text-align: left;"|
| '''PC12GND'''| '''769'''|-| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-| '''261'''| '''PI5'''| '''TWI0_SCL/UART2_TX'''| '''15'''
|-
| '''272'''
| '''PI16'''
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''PI43.3V'''| '''26017'''|-| '''<span style="color:#FF0000">231</span>'''| '''<span style="color:#FF0000">PH7</span>'''| '''<span style="color:#FF0000">SPI1_MOSI</span>'''| '''<span style="color:#FF0000">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</span>'''|-| '''<span style="color:#FF0000">230</span>'''| '''<span style="color:#FF0000">PH6</span>'''| '''<span style="color:#FF0000">SPI1_CLK</span>'''| '''<span style="color:#FF0000">23</span>'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''3925'''|-| '''40266'''| '''PI10'''| '''TWI2-SDA/UART3_RX'''| '''27'''|-| '''256'''| '''PI0'''
| style="text-align: left;"|
| '''PI329'''| '''259'''-|} <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'271''. Ordinary users remember to add &gt; '''sudo''' permissions.</p><p>orangepi@orangepi:~$ | '''sudo orangepi-configPI15'''</p></li><li><p>Then select '''System'''</p><p>[[File:zero2w| style="text-img80.png]]</p></li><li><p>Then select '''Hardware'''</p><p>[[Filealign:zero2w-img81.png]]</p></li>left;"|<li><p>Then use the keyboard's arrow keys to locate the position shown &gt; in the picture below, and then use the | '''space31''' to select the &gt; corresponding i2c configuration in the picture below.</p></li></ol></li></ol> {| class="wikitable"
|-
| '''Multiplexing function in 40pin268'''| '''Corresponding dtbo configurationPI12'''| '''PWM2'''| '''33'''
|-
| '''40pin - i2c0258'''| '''piPI2'''| style="text-i2c0align: left;"|| '''35'''
|-
| '''40pin - i2c1272'''| '''piPI16'''| style="text-i2c1align: left;"|| '''37'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''40pin - i2c2GND'''| '''pi-i2c239'''
|}
 [[File:zero2w-img173.png]] <ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select <span {| class="mark">&lt;Save&gt;</span> to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select <span class="mark">&lt;Back&gt;</span></p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select <span class="mark">&lt;Reboot&gt;</span> to restart the system to make the &gt; configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol> <!-- --><ol start="3wikitable" style="list-style-typewidth: decimal390px;"><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/i2cmargin-*'''</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 isright:'''</p></li></ol> <!-- --><ol start="3" style="list-style-type: lower-alpha20px;"><li><p>'''First run the following command to check the corresponding relationship of i2c'''</p><p>orangepi@orangepizero2w:~$ '''ls /sys/devices/platform/soc*/*/i2ctext-* | grep &quot;i2c-[0-9]&quot;'''</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 output'''</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-typealign: decimalcenter;"><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>'''&quot;/dev/i2c-x&quot;'''</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.'''| '''GPIOPin'''| '''Function'''| '''PinGPIO'''|| '''PinGPIO NO.'''| '''Function'''-| '''GPIO2'''| '''GPIO NO.5V'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''-| '''1'''|| '''24'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''264'''| '''PI8'''| '''TWI1-SDA'''| '''3'''|| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|| '''6'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''269'''
| '''PI13'''
| '''PWM3/UART4_TX'''
| '''7'''
|
| '''8'''
| '''UART0_TX'''
| '''224'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''9'''
|
| '''10'''
| '''UART0_RX'''
| '''225'''
|-
| '''226'''
| '''PH2'''
| '''UART5_TX'''
| '''11'''
|
| '''12'''
| style="text-align: left;"|
| '''257'''
|-
| '''227'''
| '''PH3'''
| '''UART5_RX'''
| '''13'''
|
| '''14'''
| '''GND'''
| style="text-align: left;"|
|-
| '''261'''
| '''PI5'''
| '''TWI0_SCL/UART2_TX'''
| '''15'''
|
| '''16'''
| '''PWM4/UART4_RX'''
| '''270'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|
| '''18'''
| style="text-align: left;"|
| '''228'''
|-
| '''231'''
| '''PH7'''
| '''SPI1_MOSI'''
| '''19'''
|
| '''20'''
| '''GND'''
| style="text-align: left;"|
|-
| '''232'''
| '''PH8'''
| '''SPI1_MISO'''
| '''21'''
|
| '''22'''
| '''TWI0_SDA/UART2_RX'''
| '''262'''
|-
| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''<span style="color:#FF0000">24</span>'''| '''<span style="color:#FF0000">SPI1_CS0</span>'''| '''<span style="color:#FF0000">PH5</span>'''| '''229'''|-| <span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"|| '''GND'''| '''25>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>'''|-| '''266'''| '''PI10'''| '''TWI2-SDA/UART3_RX'''| '''27'''|| '''28'''| '''TWI2-SCL/UART3_TX'''
| '''PI9'''
| '''265'''
|-
| '''256'''
| '''PI0'''
| style="text-align: left;"|
| '''29'''
|
| '''30'''
| '''GND'''
| style="text-align: left;"|
|-
| '''271'''
| '''PI15'''
| style="text-align: left;"|
| '''31'''
|
| '''32'''
| '''PWM1'''
| '''267'''
|-
| '''268'''
| '''PI12'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
|-
| '''258'''
| '''PI2'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''76'''
|-
| '''272'''
| '''PI16'''
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''260'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''39'''
|
| '''40'''
| style="text-align: left;"|
| '''259'''
|}
</div>
<ol start="2" style="list-style-type: decimal;">
<li><p>In Linux systems, uart 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 &gt; '''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 &gt; in the picture figure below, and then use the '''space''' to select the &gt; serial port dtbo configuration of the SPI you want to open.</p></li></ol></li></ol>
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''Multiplexing function in 40pindtbo configuration'''| '''Corresponding dtbo configurationillustrate'''
|-
| '''40pin spi1- uart2cs0-cs1-spidev'''| '''pi-uart2Open cs0 and cs1 of spi1 at the same time'''
|-
| '''40pin spi1- uart3cs0-spidev'''| '''pi-uart3Only open cs0 of spi1'''
|-
| '''40pin spi1- uart4'''| '''pics1-uart4spidev'''|-| '''40pin - uart5'''| '''ph-uart5Only open cs1 of spi1'''
|}
 [[File:zero2w-img175.png]]</ol>
<ol start="5" style="list-style-type: lower-alpha;">
<li><p>Then select '''&lt;Save&gt;''' to save</p>
<li><p>Then select '''&lt;Back&gt;'''</p>
<p>[[File:zero2w-img84.png]]</p></li>
<li><p>Then select '''&lt;Reboot&gt;''' to restart the system to make the &gt; configuration take effect.</p>
<p>[[File:zero2w-img85.png]]</p></li></ol>
</li></ol>
<!-- -->
<ol start="3" style="list-style-type: decimal;">
<li><p>After entering the Linux system, first confirm Then check whether there is a uart5 device node under '''<span class="mark">/dev</span>spidev1.x'''</p><p>'''注意device node in the Linux system. If it exists, linux5.4系统为/dev/ttyASxit means that the SPI1 configuration has taken effect.'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''ls /dev/ttySspidev1*'''</p><p>/dev/ttySxspidev1.0 /dev/spidev1.1</p></li>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <libig><p>Then start testing the uart interface. First use Dupont wire to short'''Note that only when you open spi1-cs0-cs1-circuit spidev, you will see the rx and tx pins device nodes of the uart interface to be testedtwo spi.'''</p></big>|}</li><li><p>Use Then you can use the '''gpiospidev_test.py''' command program in wiringOP examples to test the SPI loopback function of the serial port as shown below. If you can see the following print, it means the serial port communication is normalThe '''spidev_test.</p><p>py'''Note that the last x in the gpio serial /dev/ttySx command program needs to be replaced with specify the serial number of the corresponding uart device node.'''following two parameters:</p><p>orangepi@orangepiol style="list-style-type:~$ '''gpio serial /dev/ttySx # linuxlower-6.1 test command'''alpha;"></pli><p>orangepi@orangepi:~$ '''gpio serial /dev/ttyASx # linux-5.4 test command-channel''': Specify the channel number of SPI</p><p>Out: 0: -&gt; 0</pli><pli>Out: 1: -&gt; 1</p><p>Out'''--port''': 2: -&gt; 2Specify the port number of the SPI</p><p/li>Out: 3: -&gt; 3^C</pol></li><li><p>FinallyWithout shorting the mosi and miso pins of SPI1, you can run the '''serialTestoutput result of running spidev_test.py''' program in examples to test the loopback function of the serial portis as follows. If you You can see the following print, it means that the serial port loopback test is normaldata of TX and RX are inconsistent.</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.'''</p>{| class="wikitable" style="width:800px;" |-|
<p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p>
<p>root@orangepi:~/wiringOP-Python/examples# '''python3 serialTest.py --device &quot;/dev/ttySx&quot; # linux6.1 use'''</p>
<p>root@orangepi:~/wiringOP-Python/examples# '''python3 serialTest.py --device &quot;/dev/ttyASx&quot; # linux5.4 use'''</p>
<p>Out: 0: -&gt; 0</p>
<p>Out: 1: -&gt; 1</p>
<p>Out: 2: -&gt; 2</p>
<p>Out: 3: -&gt; 3</p>
<p>Out: 4:^C</p>
<p>exit</p></li></ol>
<span id="hardwareroot@orangepi:~/wiringOP-Python/examples# '''python3 spidev_test.py \''' '''-watchdog-test"></span>channel 1 --port 0''' spi mode: 0x0 == Hardware watchdog test ==max speed: 500000 Hz (500 KHz)
The watchdog_test program is pre-installed in the Linux system released by Orange Pi and can be tested directlyOpening device /dev/spidev1.1
The method to run the watchdog_test program is as followsTX | 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 '''<ol span style="list-style-typecolor: lower-alpha;#FF0000">FF FF FF FF FF FF<li/span><p>The second parameter 10 represents the counting time of the watchdog''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF |............. If the dog is not fed within this time, the system will restart.||}</pli></liol><ol start="6" style="list-style-type: decimal;"><li><p>We can feed Then use Dupont wire to short-circuit the dog by pressing any key on txd (pin 19 in the keyboard 40pin interface) and rxd (except ESCpin 21 in the 40pin interface)of SPI1 and then run spidev_test. After feeding py. The output is as follows, you can see If the data sent and received are the dogsame, the program will print a line &quot;keep alive&quot; to indicate it means that the dog feeding SPI1 loopback test is successfulnormal.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepiroot@orangepi:~$ /wiringOP-Python# '''sudo watchdog_test 10cd examples'''</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>
<span id="check-the-chipid-of-h618root@orangepi:~/wiringOP-chip"><Python/span>== Check the chipid of H618 chip ==examples# '''python3 spidev_test.py \'''
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.'''--channel 1 --port 0'''
orangepi@orangepispi mode:~$ '''cat /sys/class/sunxi_info/sys_info | grep &quot;chipid&quot;'''0x0
sunxi_chipid max speed: 338020004c0048080147478824681ed1500000 Hz (500 KHz)
<span id="python-related-instructions"><Opening device /span>== Python related instructions ==dev/spidev1.1
TX | FF FF FF FF FF FF '''<span idstyle="how-to-compile-and-install-python-source-codecolor:#FF0000">40 00 00 00 00 95</span>=== How to compile and install Python source code ===''' 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 '''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.<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>
'''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).'''=== 40pin I2C test ===
<ol style="list-style-type: decimal;"><li><p>First install # As can be seen from the dependency packages needed to compile Python</p><p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y build-essential zlib1g-dev \'''</p><p>'''libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev \'''</p><p>'''libreadline-dev libffi-dev curl libbz2-dev'''</p></li><li><p>Then download table below, the latest version of Python3.9 source code and unzip it</p><p>orangepi@orangepi:~$ '''wget \'''</p><p>[https://www.python.org/ftp/python/3.9.10/Python-3.9.10.tgz '''https://www.python.org/ftp/python/3.9.10/Python-3.9.10.tgz''']</p><p>orangepi@orangepi:~$ '''tar xvf Python-3.9.10.tgz'''</p></li><li><p>Then run i2c available for the configuration command</p><p>orangepi@orangepi:~$ '''cd Python-3.9.10'''</p><p>orangepi@orangepi:~$ '''./configure --enable-optimizations'''</p></li><li><p>Then compile 40pin interface are i2c0, i2c1 and install Python3.9. The compilation time takes about half an hour.</p><p>orangepi@orangepi:~$ '''make -j4'''</p><p>orangepi@orangepi:~$ '''sudo make altinstall'''</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 --version'''</p><p>'''Python 3.9.10'''</p></li><li><p>Then update pip</p><p>orangepi@orangepi:~$ '''/usr/local/bin/python3.9 -m pip install --upgrade pip'''</p></li></ol>i2c2
<span iddiv style="how-to-replace-pip-source-in-pythondisplay: flex;"></span>::{| class="wikitable" style== How to replace pip source in Python ==="width:390px;margin-right: 20px;text-align: center;"|-| '''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 sourceGPIO NO.''' <ol style="list-style-type: decimal;"><li><p>First install | '''python3-pipGPIO'''</p><p>orangepi@orangepi:~$ | '''sudo apt-get updateFunction'''</p><p>orangepi@orangepi:~$ | '''sudo apt-get install -y python3-pipPin'''</p></li><li><p>How to permanently change the pip source under Linux</p><ol |-| style="listtext-align: left;"|| style="text-typealign: lower-alphaleft;">|<li><p>First create a new | '''~/3.pip3V''' directory, then add the &gt; | '''pip.conf1''' configuration file, and set the pip source in it &gt; to Tsinghua source.</p><p>orangepi@orangepi:~$ '''mkdir |-p ~/.pip| '''</pspan style="color:#FF0000">264<p/span>orangepi@orangepi:~$ '''cat &lt;&lt;EOF &gt; ~/.pip/pip.conf| '''</pspan style="color:#FF0000">PI8<p/span>'''[global]| '''</pspan style="color:#FF0000">TWI1-SDA<p/span>'''timeout = 6000| '''</pspan style="color:#FF0000">3<p/span>'''index|-url = https://pypi.tuna.tsinghua.edu.cn/simple| '''</p>span style="color:#FF0000">263<p/span>'''trusted-host = pypi.tuna.tsinghua.edu.cn| '''</pspan style="color:#FF0000">v<p/span>'''EOF| '''</pspan style="color:#FF0000">TWI1-SCL</lispan>'''| '''<lispan style="color:#FF0000"><p>Then use pip3 to install the Python library very quickly5</p></li></olspan>'''</li>|-<li><p>How to temporarily change the pip source under Linux, where | '''&lt;packagename&gt;269''' needs to be replaced with a specific package name</p><p>orangepi@orangepi:~$ | '''pip3 install &lt;packagename&gt; -i \PI13'''</p><p>| '''https://pypi.tuna.tsinghua.edu.cnPWM3/simple --trusted-host pypi.tuna.tsinghua.edu.cnUART4_TX'''</p></li></ol> <span id| '''7'''|-| style="howtext-to-install-dockeralign: left;"></span>|| style== How to install Docker == The Linux image provided by Orange Pi has Docker pre"text-installed, but the Docker service is not turned on by default. Use the align: left;"|| '''enable_docker.shGND''' script to enable the docker service, and then you can start using the docker command, and the docker service will be automatically started the next time you start the system. orangepi@orangepi:~$ | '''enable_docker.sh9'''|-You can use the following command to test docker. If | '''hello-world226''' can be run, docker can be used normally. orangepi@orangepi:~$ | '''docker run hello-worldPH2''' Unable to find image | '''UART5_TX''hello-world:latest' locally latest: Pulling from library/hello-world 256ab8fe8778: Pull complete Digest: sha256:7f0a9f93b4aa3022c3a4c147a449ef11e0941a1fd0bf4a8e6c9408b2600777c5 Status: Downloaded newer image for hello-world:latest | '''Hello from Docker!11'''|-| '''This message shows that your installation appears to be working correctly.227''' | '''.….PH3''' When using the docker command, if you are prompted for | '''permission deniedUART5_RX''', please add the current user to the docker user group so that you can run the docker command without sudo. orangepi@orangepi:~$ | '''sudo usermod -aG docker $USER13'''|-| '''Note: You need to log out and log in again to the system to take effect. You can also restart the system.''' <span idstyle="how-to-install-home-assistantcolor:#FF0000">261</span>== How to install Home Assistant == '''Note that this article will only provide methods for installing Home Assistant in Ubuntu or Debian systems. For detailed usage of Home Assistant, please refer to the official documentation or corresponding books.| ''' <span idstyle="installation-via-dockercolor:#FF0000">PI5</span>'''=== Installation via docker === | '''<ol span style="list-style-typecolor: decimal;#FF0000">TWI0_SCL<li/span><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|/UART2_TX'''How to Install Docker| ''']] section.</pspan style="color:#FF0000">15</lispan>'''<li><p>Then you can search for the docker image of Home Assistant</p>|-| style="text-align: left;"|<p>orangepi@orangepi| style="text-align:~$ left;"|| '''docker search homeassistant3.3V'''</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-assistant17'''</p><p>Using default tag: latest</p>|-<p>latest: Pulling from homeassistant/home-assistant</p>| '''231'''<p>be307f383ecc: Downloading</p><p>5fbc4c07ac88: Download complete</p><p>| '''...... (Omit some output)PH7'''</p><p>3cc6a1510c9f: Pull complete</p>| '''SPI1_MOSI'''<p>7a4e4d5b979f: Pull complete</p>| '''19'''<p>Digest: sha256:81d381f5008c082a37da97d8b08dd8b358dae7ecf49e62ce3ef1eeaefc4381bb</p><p>Status: Downloaded newer image for homeassistant/home|-assistant:latest</p><p>docker.io/homeassistant/home-assistant:latest</p></li>| '''232'''<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-assistantPH8'''</p><p>REPOSITORY TAG IMAGE ID CREATED SIZE</p>| '''SPI1_MISO'''<p>homeassistant/home-assistant latest bfa0ab9e1cf5 2 months ago | '''1.17GB21'''</p></li><li><p>At this point you can run the Home Assistant docker container</p><p>orangepi@orangepi:~$ |-| '''docker run -d \230'''</p><p>| '''--name homeassistant \PH6'''</p><p>| '''--privileged \SPI1_CLK'''</p><p>| '''23'''|-| style="text-restartalign: left;"|| style=unless"text-stopped \align: left;"|| '''GND'''</p><p>| '''25'''|-e TZ=Asia/Shanghai \| '''</pspan style="color:#FF0000">266<p/span>'''-v /home/orangepi/home-assistant:/config \'| '''</pspan style="color:#FF0000">PI10<p/span>'''--network=host \| '''</pspan style="color:#FF0000">TWI2-SDA<p/span>/UART3_RX'''homeassistant/home-assistant:latest| '''</pspan style="color:#FF0000">27</li><li><p>Then enter【the IP address of the development board: 8123】in the browser to see the Home Assistant interface</p><pspan>'''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.|-| '''256'''| '''PI0'''</p><div class| style="figure"> [[Filetext-align:zero2w-img180.png]]left;"| </div></li><li><p>Then enter your | '''name, username29''' and |-| '''password271''' and click | '''Create AccountPI15'''</p><div class| style="figuretext-align: left;">|| '''31'''[[File:zero2w|-img181.png]]| '''268'''</div></li><li><p>Then follow the interface prompts to set according to your own preferences, and then click Next</p>| '''PI12'''<div class="figure">| '''PWM2'''| '''33'''[[File:zero2w|-img182.png]]| '''258'''</div></li>| '''PI2'''<li><p>Then click Next</p><div class| style="figuretext-align: left;">| [[File:zero2w| '''35'''|-img183.png]]| '''272'''</div></li>| '''PI16'''<li><p>Then click Finish</p><div class| style="figuretext-align: left;">|| '''37'''[[File:zero2w|-img184.png]]| style="text-align: left;"|</div></li><li><p>The main interface finally displayed by Home Assistant is as shown below</p><p>[[File| style="text-align:zero2w-img185.png]]</p></li>left;"|<li><p>Method to stop Home Assistant container</p>| '''GND'''<ol style="list-| '''39'''|}{| class="wikitable" style="width:390px;margin-typeright: lower20px;text-alphaalign: center;"><li><p>The command to view the docker container is as follows</p>|-<p>orangepi@orangepi:~$ | '''docker ps -aPin'''</p></li><li><p>The command to stop the Home Assistant container is as follows</p>| '''Function'''<p>orangepi@orangepi:~$ | '''docker stop homeassistantGPIO'''</p></li><li><p>The command to delete the Home Assistant container is as follows</p><p>orangepi@orangepi:~$ | '''docker rm homeassistantGPIO NO.'''</p></li></ol></li></ol>|-| '''2'''| '''5V'''<span id| style="installationtext-via-pythonalign: left;"></span>|| style=== Installation via python ==="text-align: left;"||-| '''Before installation, please change the source of pip to a domestic source to speed up the installation of Python packages. For the configuration method, see the instructions in the section &quot;[[\l|How to Change the Pip Source of Python]]&quot;4''' <ol | '''5V'''| style="listtext-align: left;"|| style="text-typealign: decimalleft;">|<li><p>First install dependency packages</p>|-<p>orangepi@orangepi:~$ | '''sudo apt-get update6'''</p><p>orangepi@orangepi:~$ | '''sudo apt-get install -y python3 python3-dev python3-venv \GND'''</p><p>'''python3| style="text-pip libffi-dev libssl-dev libjpeg-dev zlib1galign: left;"|| style="text-dev autoconf buildalign: left;"||-essential \| '''8'''</p><p>| '''libopenjp2-7 libtiff5 libturbojpeg0-dev tzdataUART0_TX'''</p><p>| '''If it is debian12, please use the following command:PH0'''</p><p>orangepi@orangepi:~$ | '''sudo apt-get update224'''</p><p>orangepi@orangepi:~$ |-| '''sudo apt-get install -y python3 python3-dev python3-venv \10'''</p><p>| '''python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \UART0_RX'''</p><p>| '''libopenjp2-7 libturbojpeg0-dev tzdataPH1'''</p></li><li><p>Then you need to compile and install Python3.9. For the method, please refer to the [[\l|'''Python source code compilation and installation method225''']] section.</p><p>|-| '''The default Python version of Debian Bullseye is Python3.9, so there is no need to compile and install it.12'''</p><p>| style="text-align: left;"|| '''PI1'The default Python version of Ubuntu Jammy is Python3.10, so there is no need to compile and install it.''| '''257'''</p><p>|-| '''The default Python version of Debian Bookworm is Python3.11, so there is no need to compile and install it.14'''</p></li><li><p>Then create a Python virtual environment</p><p>| '''Debian Bookworm is python3.11, please remember to replace the corresponding command.GND'''</p><p>orangepi@orangepi| style="text-align:~$ '''sudo mkdir /srv/homeassistantleft;"|| style="text-align: left;"||-| '''16'''</p><p>orangepi@orangepi:~$ | '''sudo chown orangepi:orangepi PWM4/srv/homeassistantUART4_RX'''</p><p>orangepi@orangepi:~$ | '''cd /srv/homeassistantPI14'''</p><p>orangepi@orangepi:~$ | '''python3.9 -m venv .270'''</p><p>orangepi@orangepi:~$ |-| '''source bin/activate18'''</p><p>(homeassistant) orangepi@orangepi| style="text-align:/srv/homeassistant$</p></li>left;"|<li><p>Then install the required Python packages</p>| '''PH4'''<p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ | '''228'''python3 |-m pip install wheel| '''20'''</p></li><li><p>Then you can install Home Assistant Core</p><p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ | '''pip3 install homeassistantGND'''</p></li><li><p>Then enter the following command to run Home Assistant Core</p>| style="text-align: left;"|<p>(homeassistant) orangepi@orangepi| style="text-align:/srv/homeassistant$ '''hassleft;"||-| '''</pspan style="color:#FF0000">22</lispan>'''| '''<lispan style="color:#FF0000">TWI0_SDA<p/span>Then enter【/UART2_RX'''development board IP address: 8123| '''】 in the browser to see the Home Assistant interface</pspan style="color:#FF0000">PI6<p/span>'''When you run the hass command for the first time, some libraries and dependency packages necessary for operation will be downloaded, installed and cached. This process may take several minutes. Note that you cannot see the Home Assistant interface in the browser at this time. Please wait for a while and then refresh it.| '''</p><div classspan style="figurecolor:#FF0000"> [[File:zero2w-img180.png]] 262</div></li></olspan>'''|-| '''24'''| '''SPI1_CS0'''<span id="opencv-installation-method"></span>| '''PH5'''== OpenCV installation method ==| '''229'''|-<span id="use-apt-to-install-opencv"></span>=== Use apt to install OpenCV ===| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''<ol span style="list-style-typecolor: decimal;#FF0000">28<li/span>'''| '''<pspan style="color:#FF0000">The installation command is as followsTWI2-SCL</pspan><p>orangepi@orangepi:~$ /UART3_TX'''sudo apt-get update| '''</pspan style="color:#FF0000">PI9<p/span>orangepi@orangepi:~$ '''sudo apt-get install -y libopencv-dev python3-opencv| '''</pspan style="color:#FF0000">265</lispan>'''<li><p>Then use the following command to print the version number of OpenCV. The output is normal, indicating that the OpenCV installation is successful.</p>|-| '''30'''| '''GND'''<ol | style="listtext-align: left;"|| style="text-typealign: lower-alphaleft;">|<li><p>The version of OpenCV in Ubuntu22.04 is as follows:</p>|-<p>orangepi@orangepi:~$ | '''python3 -c &quot;import cv2; print(cv2.__version__)&quot;32'''</p><p>| '''PWM1''4.5.4'| '''PI11'''</p></li><li><p>The version of OpenCV in Ubuntu20.04 is as follows:</p><p>orangepi@orangepi:~$ | '''python3 267'''|-c &quot;import cv2; print(cv2.__version__)&quot;| '''34'''</p><p>| '''4.2.0GND'''</p></li><li><p>The version of OpenCV in Debian11 is as follows| style="text-align:</p>left;"|<p>orangepi@orangepi| style="text-align:~$ left;"||-| '''python3 36'''| style="text-c &quot;import cv2; print(cv2.__version__)&quotalign: left;"|| '''PC12'''</p><p>| '''4.5.176'''</p></li><li><p>The version of OpenCV in Debian12 is as follows:</p>|-<p>orangepi@orangepi:~$ | '''python3 -c &quot;import cv2; print(cv2.__version__)&quot;38'''</p><p>| style="text-align: left;"|| '''4.6.0PI4'''</p></li></ol>| '''260'''|-| '''40'''| style="text-align: left;"|| '''PI3'''| '''259'''|}</li></oldiv>
<span idol start="set-up-the-chinese-environment-and-install-the-chinese-input-method2"></span>== Set up the Chinese environment and install the Chinese input method == '''Note, before installing the Chinese input method, please make sure that the Linux system used by the development board is a desktop version.''' <span id="debian-system-installation-method"></span>=== Debian system installation method === <ol style="list-style-type: decimal;"><li><p>First set the i2c is turned off by default '''locale''' in Linux systems and needs to Chinesebe turned on manually to use it. The opening steps are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>Enter the following command to start configuring '''localeFirst run '''</p><p>orangepi@orangepi:~$ '''sudo dpkg-reconfigure locales'''</p></li><li><p>Then select config'''zh_CN.UTF-8 UTF-8''' in the pop-up interface (use &gt; the up and down keys on the keyboard to move up and down, use &gt; the space bar to select, and finally use the Tab key to move &gt; the cursor Ordinary users remember to add '''&lt;OK&gt;sudo''', and then return Car can be used)permissions.</p><p>[[File{| class="wikitable" style="width:zero2w-img186.png]]</p></li>800px;" <li><p>Then set the default '''locale''' to '''zh_CN.UTF|-8'''</p><p>[[File:zero2w-img187.png]]</p></li><li><p>After exiting the interface, the '''locale''' setting will begin. &gt; The output displayed on the command line is as follows:</p>| <p>orangepi@orangepi:~$ '''sudo dpkgorangepi-reconfigure localesconfig'''</p><p>Generating locales (this might take a while)...</p><p>en_US.UTF-8... done</p><p>zh_CN.UTF-8... done</p><p>Generation complete.</p></li></ol>|}
</li>
<li><p>Then open '''Input Method'''</p><p>[[File:zero2w-img188.png]]</p></li><li><p>Then select '''OKSystem'''</p><p>[[File:zero2w-img189img80.png]]</p></li><li><p>Then select '''YesHardware'''</p><p>[[File:zero2w-img190img81.png]]</p></li><li><p>Then select 'use the keyboard's arrow keys to locate the position shown in the picture below, and then use the 'fcitx'''</p><p>[[File:zero2w-img191.png]]</p></li><li><p>Then select '''OK'''</p><p>[[File:zero2w-img192.png]]</p></li><li><p>space'''Then restart the Linux system to make select the corresponding i2c configuration take effect.'''</p></li><li><p>Then open '''Fcitx configuration'''</p><p>[[File:zero2w-img193.png]]</p></li><li><p>Then click the + sign as shown in the picture below</p><p>[[File:zero2w-img194.png]]</p></li><li><p>Then search '''Google Pinyin''' and click '''OK'''</p><div class="figure">
[[File{| class="wikitable" style="width:zero2w800px;text-img195.png]]align: center;"|-| '''Multiplexing function in 40pin'''| '''Corresponding dtbo configuration'''|-| '''40pin - i2c0'''| '''pi-i2c0'''|-| '''40pin - i2c1'''| '''pi-i2c1'''|-| '''40pin - i2c2'''| '''pi-i2c2'''|}
[[File:zero2w-img173.png]]</divol></liol start="5" style="list-style-type: lower-alpha;"><li><p>Then put '''Google Pinyin''' on topselect </pspan class="mark">&lt;Save&gt;<p/span>[[File:zero2w-img196.png]]to save</p><p>[[File:zero2w-img197img83.png]]</p></li><li><p>Then open the '''Geany''' editor to test the Chinese input methodselect <span class="mark">&lt;Back&gt;</span></p><p>[[File:zero2w-img198img84.png]]</p></li><li><p>The Chinese input method test is as followsThen select <span class="mark">&lt;Reboot&gt;</span> to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img199img85.png]]</p></li></ol></li><p/ol>You can switch between Chinese and English input methods through the '''Ctrl+Space''' shortcut key</p!-- --></liol start="3" style="list-style-type: decimal;"><li><p>If you need After starting the entire Linux system to be displayed in Chinese, you can set all variables in '''first confirm that there is an open i2c device node under <span class="mark">/etcdev</default/locale''' to '''zh_CN.UTF-8'''span></p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo vim ls /etcdev/default/localei2c-*'''</p><p># File generated by update-locale</p><p>LC_MESSAGES='''zh_CN.UTF/dev/i2c-8*'''</p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <pbig>LANG='''zh_CN.UTF-8注意,这里说的Linux镜像具体指的是从Orange Pi资料下载页面下载的Debian或者Ubuntu这样的Linux发行版镜像。'''</pbig>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>LANGUAGE='''zh_CNSometimes the i2c device node and the i2c bus serial number do not correspond one to one.UTFFor example, the i2c device node of the i2c1 bus may be /dev/i2c-83.'''</p></li><li><p>Then '''restart The method to accurately confirm the device node under /dev corresponding to the systemi2c bus is: ''' and you will see that the system is displayed in Chinese.</p><p>[[File:zero2w-img200.png]]</p></li></olbig>
<span id="installation-method-of-ubuntu-20.04-system"></span>
=== Installation method of Ubuntu 20.04 system ===
<ol style="list-style-type: decimallower-alpha;"><li><p>First open '''Language SupportFirst run the following command to check the corresponding relationship of i2c'''</p><p>orangepi@orangepizero2w:~$ '''ls /sys/devices/platform/soc*/*/i2c-* | grep &quot;i2c-[[File:zero2w0-img201.png]9]&quot;'''</p><p>/sys/devices/platform/soc/5002000.i2c/i2c-0:</lip><li><p>Then find the '''Chinese (China)''' option/sys/devices/platform/soc/5002400.i2c/i2c-3:</p><p>[[File/sys/devices/platform/soc/5002800.i2c/i2c-4:zero2w-img202.png]]</p><p>/sys/devices/platform/lisoc/5002c00.i2c/i2c-5:</p><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/sys/devices/platform/soc/6000000. After dragging, the display will be as shown belowhdmi/i2c-2:</p><p>[[File/sys/devices/platform/soc/7081400.i2c/i2c-1:zero2w-img203.png]]</p></li></ol>
'''Note that this step is not easy to drag, please be patient and try it a few times.'''
<li><p>'''In the above output'''</p>
<ol style="list-style-type: none;">
<li><p>a) 5002000 is the register base address of the i2c0 bus, and i2c-0 shown behind it is its corresponding i2c device node</p></li>
<li><p>b) 5002400 is the register base address of the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li>
<li><p>c) 5002800 is the register base address of the i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p></li></ol>
</li></ol>
|}
</li></ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>Then select '''Apply Systemstart testing i2c, first install i2c-Wide''' to apply the Chinese settings to the entire systemtools</p><p>[[File{| class="wikitable" style="width:zero2w800px;" |-img204.png]]</p></li><li>| <p>Then set the orangepi@orangepi:~$ '''Keyboard input method system''' system to '''fcitxsudo apt-get update'''</p><p>[[Fileorangepi@orangepi:zero2w-img205.png]]</p></li><li><p>~$ '''Then restart the Linux system to make the configuration take effectsudo'''</p></li><li><p>After re-entering the system, please select '''Do not ask me againapt-get install -y i2c-tools''' in the following interface, and then please decide according to your own preferences whether the standard folder should also be updated to Chinese</p><p>[[File:zero2w-img206.png]]</p>|}</li><li><p>Then you can see that connect an i2c device to the i2c pin of the 40pin connector. Here we take the desktop is displayed in ChineseDS1307 RTC module as an example.</p><p>[[File:zero2w-img207img178.png]]</p></li><li><p>Then we can open use the '''Geanyi2cdetect -y x''' to test command. If the address of the connected i2c device can be detected, it means that the Chinese input methodi2c device is connected correctly. The opening method is as shown in the figure below</p><p>[[File{| class="wikitable" style="background-color:#ffffdc;width:zero2w800px;" |-img208.png]]</p></li>| <libig>'''<p>After opening '''Geany''', Note that x in the i2cdetect -y x command needs to be replaced with the English input method is still serial number of the default. We can switch device node corresponding to the Chinese input method through the i2c bus.'''Ctrl+Space</p>''' shortcut key, and then we can input Chinese.</pbig><p>[[File:zero2w-img209.png]]</p></li></ol>|}
[[File:zero2w-img179.png]]<span id/li></ol><ol start="7" style="installationlist-methodstyle-oftype: decimal;"><li><p>Then you can run the '''ds1307.py''' test program in '''examples''' to read the RTC time</p>{| class="wikitable" style="background-ubuntucolor:#ffffdc;width:800px;" |-22| <big><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.04-system"'''</p></spanbig>|}{| class="wikitable" style== Installation method of Ubuntu 22"width:800px;" |-| <p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p><p>root@orangepi:~/wiringOP-Python/examples# '''python3 ds1307.py --device \'''</p><p>'''&quot;/dev/i2c-x&quot;'''</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 system ===:35:48</p><p>^C</p><p>exit</p>|}</li></ol>
<ol stylespan id="listpin-styleuart-type: decimal;test-1"><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-img210.png]]</p></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-img211.png]]</p></li></olspan>
'''Note that this step is not easy to drag, please be patient and try it a few times.'''=== 40pin UART test ===
<ol start="4" style="list-style-type: decimal;"># 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. <lidiv style="display: flex;"><p>Then select '::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''Apply System-WideGPIO NO.''' to apply the Chinese settings to the entire system</p><p>[[File:zero2w-img212.png]]</p></li>| '''GPIO'''<li><p>| '''Then restart the Linux system to make the configuration take effectFunction'''</p></li><li><p>After re-entering the system, please select ''| '''Do not ask me againPin''' in the following interface, and then please decide whether the standard folder should also be updated to Chinese according to your own preferences.</p><p>[[File:zero2w|-img206.png]]</p></li><li><p>Then you can see that the desktop is displayed in Chinese</p>| style="text-align: left;"|<p>[[File| style="text-align:zero2w-img207.png]]</p></li>left;"|<li><p>Then open the Fcitx5 configuration program</p><p>[[File:zero2w-img213| '''3.png]]</p></li>3V'''<li><p>Then choose to use Pinyin input method</p><div class="figure">| '''1''' [[File:zero2w|-img214.png]]| '''264'''</div></li><li><p>The interface after selection is as shown below, then click OK</p>| '''PI8'''<p>[[File:zero2w| '''TWI1-img215.png]]</p></li>SDA'''<li><p>Then we can open | '''Geany3''' to test the Chinese input method. The opening method is as shown in the figure below</p><p>[[File:zero2w|-img208.png]]</p></li><li><p>After opening | '''Geany263''', the English input method is still the default. We can switch to the Chinese input method through the | '''Ctrl+SpacePI7''' shortcut key, and then we can enter Chinese.</p><p>[[File:zero2w| '''TWI1-img216.png]]</p></li></ol>SCL'''| '''5'''<span id="how|-to-remotely-log-in-to-the-linux-system-desktop"></span>== How to remotely log in to the Linux system desktop ==| '''269'''| '''PI13'''| '''PWM3/UART4_TX'''| '''7'''|-<span id| style="remotetext-login-using-nomachinealign: left;"></span>|| style=== Remote login using NoMachine ==="text-align: left;"|| '''Please ensure that the Ubuntu or Debian system installed on the development board is a desktop version of the system. In addition, NoMachine also provides detailed usage documentation. It is strongly recommended to read this document thoroughly to become familiar with the use of NoMachine. The document link is as follows:GND''' | ''''https://knowledgebase.nomachine.com/DT10R001669'''|-| '''NoMachine supports Windows, Mac, Linux, iOS and Android platforms, so we can remotely log in and control the Orange Pi development board through NoMachine on a variety of devices. The following demonstrates how to remotely log in to the Linux system desktop of the Orange Pi development board through NoMachine in Windows. For installation methods on other platforms, please refer to NoMachine226'''| '''s official documentation.PH2''' | '''UART5_TX'Before operating, please make sure that the Windwos computer and the development board are in the same LAN, and that you can log in to the Ubuntu or Debian system of the development board through ssh normally.''| '''11'''|-<ol style="list-style-type: decimal;">| '''227'''<li><p>First download the installation package of the NoMachine software Linux | '''arm64PH3''' deb version, and then install it into the Linux system of the development board</p><ol style="list-style| '''UART5_RX'''| '''13'''|-type: lower-alpha;"><li>Since H618 is an ARMv8 architecture SOC and the system we use is &gt; Ubuntu or Debian, we need to download the | '''261'NoMachine for ARM &gt; ARMv8 DEB''| '''PI5''' installation package. The download link is as &gt; follows:</li></ol></li></ol> | '''Note that this download link may change, please look for the Armv8TWI0_SCL/Arm64 version of the deb package.UART2_TX''' [https://www.nomachine.com/download/download&id=112&s=ARM | ''''https://downloads.nomachine.com/download/?id=118&amp;distro=ARM15'''] [[File:zero2w|-img217.png]] <ol start="2" | style="listtext-align: left;"|| style="text-typealign: lower-alphaleft;">|<li><p>In addition, you can also download the | '''NoMachine3.3V''' installation &gt; package from the official tool.</p><p>[[File:zero2w| '''17'''|-img218.png]]</p><p>First enter the | '''231'''| '''remote login software-NoMachinePH7''' folder</p><p>[[File:zero2w-img219.png]]</p>| '''SPI1_MOSI'''<p>Then download the arm64 version of the deb installation package</p>| '''19'''<p>[[File:zero2w|-img220.png]]</p></li><li><p>Then upload the downloaded | '''232'nomachine_x.x.x_x_arm64.deb''' to the &gt; Linux system of the development board</p></li><li><p>Then use the following command to install | '''NoMachinePH8'''| '''SPI1_MISO''' in the Linux &gt; system of the development board</p><p>orangepi@orangepi:~$ | '''sudo dpkg -i nomachine_x.x.x_x_arm64_arm64.deb21'''</p></li></ol>|-<!-- --><ol start="2" style="list-style-type: decimal;"><li>Then download the installation package of the Windows version of the NoMachine software. The download address is as follows</li></ol>| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''Note that this download link may change.23'''|-| style="text-align: left;"|| style="text-align: left;"|| ''''https://downloads.nomachine.com/download/?id=9GND'''| '''25'''[[File:zero2w-img221.png]] <ol start="3" style="list-style|-type: decimal;"><li><p>Then install NoMachine in Windows. | '''Please restart your computer after installation.266'''<| '''PI10'''| '''TWI2-SDA/p></li>UART3_RX'''<li><p>Then open | '''NoMachine27''' in Window</p><p>[[File:zero2w|-img222.png]]</p></li><li><p>After NoMachine is started, it will automatically scan other devices with NoMachine installed on the LAN. After entering the main interface of NoMachine, you can see that the development board is already in the list of connectable devices, and then click on the location shown in the red box in the picture below You can now log in to the Linux system desktop of the development board.</p>| '''256'''| '''PI0'''<p>[[File| style="text-align:zero2w-img223.png]]</p></li><li><p>Then click left;"|| '''OK29'''</p><p>[[File:zero2w|-img224.png]]</p></li><li><p>Then enter the username and password of the development board Linux system in the corresponding positions in the figure below, and then click OK to start logging in.</p>| '''271'''| '''PI15'''<p>[[File| style="text-align:zero2w-img225.png]]</p></li>left;"|| '''31'''<li><p>Then click OK in the next interface.</p></li>|-<li><p>Finally you can see the desktop of the development board Linux system</p>| '''268'''| '''PI12'''<p>[[File:zero2w-img226.png]]</p></li></ol>| '''PWM2'''| '''33'''<span id="remote-login-using|-vnc"></span>=== Remote login using VNC === | '''258'''Before operating, please make sure that the Windwos computer and the development board are in the same LAN, and that you can log in to the Ubuntu or Debian system of the development board through ssh normally.| ''' PI2'''There are many problems with VNC testing in Ubuntu20.04, please do not use this method.''' <ol style| style="listtext-style-typealign: decimalleft;">|<li><p>First run the | '''set_vnc.sh35''' script to set up vnc, |-| '''remember to add sudo permission272'''s</p><p>orangepi@orangepi:~$ '| '''sudo set_vnc.shPI16'''</p><p>You will require a password to access your desktops.</p>| style="text-align: left;"|<p>Password: | '''#Set the vnc password here, 8 characters37'''</p><p>Verify|-| style="text-align: left;"|| style="text-align: left;"|| '''#Set the vnc password here, 8 charactersGND'''</p><p>Would you like to enter a view-only password (y/n)? | '''n39'''</p><p>xauth|}{| class="wikitable" style="width: file /root/.Xauthority does not exist</p><p>New 390px;margin-right: 20px;text-align: center;"|-| '''Pin''X' desktop is orangepi:1</p><p>Creating default startup script /root/.vnc/xstartup</p>| '''Function'''| '''GPIO'''<p>Starting applications specified in /root/| '''GPIO NO.vnc/xstartup</p>'''<p>Log file is /root/.vnc/orangepi:1.log</p>|-<p>Killing Xtightvnc process ID 3047</p>| '''2'''<p>New | '''X5V' desktop is orangepi''| style="text-align:1</p>left;"|<p>Starting applications specified in /root/.vnc/xstartup</p>| style="text-align: left;"|<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>| '''4'''| '''5V'''<ol | style="listtext-align: left;"|| style="text-typealign: lower-alphaleft;">||-<li>First click Session, then select VNC, then fill in the IP &gt| '''6'''| '''GND'''| style="text-align: left; address and port of the development board, and finally click &gt; OK to confirm.</li></ol>"|</li></ol> <div class| style="figuretext-align: left;">| [[File:zero2w|-img227.png]]| '''8'''</div><ol start="2" style="list-style-type: lower-alpha;">| '''UART0_TX'''<li><p>Then enter the VNC password set earlier</p>| '''PH0'''| '''224'''<p>[[File:zero2w|-img228.png]]</p></li><li><p>After successful login, the interface is displayed as shown below, &gt; and then you can remotely operate the desktop of the development &gt; board Linux system.</p></li></ol>| '''10'''| '''UART0_RX'''| '''PH1'''| '''225'''[[File:zero2w|-img229.png]] <span id="qt-installation-method"></span>== QT installation method ==| '''12'''<ol | style="list-styletext-typealign: decimalleft;">|<li><p>Use the following script to install QT5 and QT Creator</p>| '''PI1'''<p>orangepi@orangepi:~$ | '''install_qt.sh257'''</p></li><li><p>After installation, the QT version number will be automatically printed.</p>|-| '''14'''| '''GND'''<ol | style="listtext-align: left;"|| style="text-typealign: lower-alphaleft;">||-<li><p>The qt version that comes with Ubuntu20.04 is | '''16'''5.12.8| '''<PWM4/p>UART4_RX'''<p>orangepi@orangepi:~$ | '''install_qt.shPI14'''</p><p>......</p>| '''270'''<p>QMake version 3.1</p>|-<p>Using Qt version | '''5.12.818''' in /usr/lib/aarch64| style="text-linux-gnu</p></li>align: left;"|<li><p>The QT version that comes with Ubuntu22.04 is | '''5.15.3PH4'''</p><p>orangepi@orangepi:~$ | '''install_qt.sh228'''</p><p>......</p>|-<p>QMake version 3.1</p>| '''20'''<p>Using Qt version | '''5.15.3GND''' in /usr/lib/aarch64| style="text-linuxalign: left;"|| style="text-align: left;"||-gnu</p></li><li><p>The QT version that comes with Debian11 is | '''5.15.222'''</p><p>orangepi@orangepi:~$ | '''install_qt.shTWI0_SDA/UART2_RX'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version | '''PI6''5.15.2'| '''262''' in /usr/lib/aarch64|-linux-gnu</p></li><li><p>The QT version that comes with Debian12 is | '''24'5.15.8''| '''SPI1_CS0'''</p><p>orangepi@orangepi:~$ | '''install_qt.shPH5'''</p><p>......</p>| '''229'''<p>QMake version 3.1</p>|-<p>Using Qt version | '''26'''| '5.15.8''SPI1_CS1''' in /usr/lib/aarch64-linux-gnu</p></li></ol></li>| '''PH9'''<li><p>Then you can see the QT Creator startup icon in | '''Applications233'''</p><p>[[File:zero2w|-img230.png]]</p><p>You can also use the following command to open QT Creator</p><p>orangepi@orangepi:~$ | '''28'''qtcreator| '''<TWI2-SCL/p></li>UART3_TX'''<li><p>The interface after QT Creator is opened is as follows</p>| '''PI9'''| '''265'''<p>[[File:zero2w|-img231.png]]</p></li><li><p>The version of QT Creator is as follows</p>| '''30'''| '''GND'''<ol | style="listtext-style-typealign: lowerleft;"|| style="text-alphaalign: left;">||-<li><p>The default version of QT Creator in | '''Ubuntu20.0432''' is as &gt; follows</p><p>[[File:zero2w-img232.png]]</p></li>| '''PWM1'''<li><p>The default version of QT Creator in | '''Ubuntu22.04PI11''' is as &gt; follows</p><p>[[File:zero2w| '''267'''|-img233.png]]</p></li><li><p>The default version of QT Creator in | '''Debian1134''' is as follows</p><p>[[File:zero2w-img234.png]]</p></li><li><p>The default version of QT Creator in '''Debian12''| '''GND''' is as follows</p><p>[[File| style="text-align:zero2w-img235.png]]</p></li></ol></li>left;"|<li><p>Then set up QT</p><ol | style="listtext-style-typealign: lower-alphaleft;">||-<li><p>First open | '''Help36'''| style="text-&gtalign: left;"|| '''About Plugins...PC12'''.</p><p>[[File:zero2w-img236.png]]</p></li>| '''76'''|-<li><p>Then remove the check mark of | '''ClangCodeModel38'''</p><p>[[File| style="text-align:zero2w-img237.png]]</p></li>left;"|| '''PI4'''<li><p>| '''After setting up, you need to restart QT Creator260'''</p></li><li><p>Then make sure the GCC compiler used by QT Creator. If the &gt; default is Clang, please change it to GCC.</p>|-<p>| '''Debian12 please skip this step.40'''</p><p>[[File:zero2w| style="text-img238.png]]</p><p>[[Filealign:zero2w-img239.png]]</p></li></ol></li><li><p>Then you can open a sample code</p><p>[[File:zero2w-img240.png]]</p></li><li><p>After clicking on the sample code, the corresponding instruction document will automatically open. You can read the instructions carefully.</p><p>[[File:zero2w-img241.png]]</p></li><li><p>Then click '''Configure Project'''</p><p>[[File:zero2w-img242.png]]</p></li><li><p>Then click the green triangle in the lower left corner to compile and run the sample code</p><p>[[File:zero2w-img243.png]]</p></li><li><p>After waiting for a period of time, the interface shown in the figure below will pop up, which means that QT can compile and run normally.</p><p>[[File:zero2w-img244.png]]</p></li><li><p>References</p><p>[https://wiki.qt.io/Install_Qt_5_on_Ubuntu '''https://wiki.qt.io/Install_Qt_5_on_Ubuntu''']</p><p>[https://download.qt.io/archive/qtcreator '''https://download.qt.io/archive/qtcreator''']</p><p>[https://download.qt.io/archive/qt '''https://download.qt.io/archive/qt''']</p></li></ol> <span id="ros-installation-method"></span>== ROS installation method == <span id="how-to-install-ros-1-noetic-on-ubuntu20.04left;"></span>=== How to install ROS 1 Noetic on Ubuntu20.04 ===|# The currently active version of ROS 1 is as follows, the recommended version is | '''Noetic NinjemysPI3''' [[File:zero2w-img245.png]] [[File:zero2w-img246.png]] [http://docs.ros.org/ | '''http://docs.ros.org259''']|}'''https:<//wiki.ros.org/Distributions'''div>
<ol start="2" style="list-style-type: decimal;">
<li><p>In Linux systems, uart is turned off by default and needs to be turned on manually before it can be used. The link to the official installation documentation of ROS 1 '''Noetic Ninjemys''' is opening steps are as follows::</p><p>[httpol style="list-style-type://wiki.ros.org/noetic/Installation/Ubuntu '''http://wiki.ros.org/noetic/Installation/Ubuntu''']</p></lilower-alpha;"><li><p>In the official installation documentation of ROS First run '''Noetic Ninjemysorangepi-config''', Ubuntu recommends using Ubuntu20.04, so please ensure that the system used by the development board is Ordinary users remember to add '''Ubuntu20.04 desktop systemsudo'''permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>[httporangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</wiki.ros.org/noetic/Installation li><li><p>Then select '''http://wiki.ros.org/noetic/InstallationSystem''']</p><p>[[File:zero2w-img247img80.png]]</p></li><li><p>Then use the script below to install ros1select '''Hardware'''</p><p>orangepi@orangepi[[File:~$ '''install_roszero2w-img81.sh ros1'''png]]</p></li><li><p>Before using Then use the ROS toolkeyboard's arrow keys to locate the position shown in the picture below, you first need and then use the '''space''' to initialize rosdep. Then when compiling select the source code, serial port you can quickly install some system dependencies and some core components in ROSwant to open.</p></li></ol>
{| class="wikitable" style="width:800px;text-align: center;"|-| '''Multiplexing function in 40pin'''| '''Corresponding dtbo configuration'''|-| '''40pin - uart2'''| '''pi-uart2'''|-| '''40pin - uart3'''| '''Note that when running the following command, you need to ensure that the development board can access github normally, otherwise an error will be reported due to network problems.pi-uart3'''|-| '''40pin - uart4'''| '''The install_ros.sh script will try to modify /etc/hosts and automatically run the following commands. However, this method cannot guarantee that github can be accessed normally every time. If install_ros.sh prompts the following error after installing ros1, please find other ways to allow the linux system of the development board to access github normally, and then manually run the following Order.pi-uart4'''|-| '''40pin - uart5'''| '''ph-uart5'''|}
[[File:zero2w-img175.png]]</ol><ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select '''https&lt;Save&gt;''' to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''&lt;Back&gt;'''</rawp><p>[[File:zero2w-img84.githubusercontentpng]]</p></li><li><p>Then select '''&lt;Reboot&gt;''' to restart the system to make the configuration take effect.com</rosp><p>[[File:zero2w-img85.png]]</rosdistrop></masterli></rosdepol></osxli></ol><!-homebrew- --><ol start="3" style="list-style-type: decimal;"><li><p>After entering the Linux system, first confirm whether there is a uart5 device node under '''<span class="mark">/dev</span>'''</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''注意, linux5.4系统为/dev/ttyASx.yaml'''</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''ls /dev/ttyS*'''</p><p>/dev/ttySx</p>|}</li><li><p>Then start testing the uart interface. First use Dupont wire to short-circuit the rx and tx pins of the uart interface to be tested.</p></li><li><p>Use the '''gpio''' command in wiringOP to 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>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that the last x in the gpio serial /dev/ttySx command needs to be replaced with the serial number of the corresponding uart device node.'''</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''gpio serial /dev/ttySx &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # linux-6.1 test command'''</p><p>orangepi@orangepi:~$ '''gpio serial /dev/ttyASx &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # linux-5.4 test command'''</p>
'''Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml'''
<p>Out: 0: -&gt; 0</p><p>Out: 1: -&gt; 1</p><p>Out: 2: -&gt; 2</p><p>Out: 3: -&gt; 3^C</p>|}</li><li><p>Finally, you can run the '''ERROR: error loading sources list:serialTest.py'''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>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''The read operation timed outNote 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.'''</p></big>|}{| class="wikitable" style="width:800px;" |-| orangepi<p>root@orangepi:~$ /wiringOP-Python# '''source /opt/ros/noetic/setup.bashcd examples'''</p> orangepi<p>root@orangepi:~$ /wiringOP-Python/examples# '''sudo rosdep initpython3 serialTest.py --device &quot;/dev/ttySx&quot; # linux6.1 use'''</p> Wrote <p>root@orangepi:~/etcwiringOP-Python/rosexamples# '''python3 serialTest.py --device &quot;/rosdepdev/sourcesttyASx&quot; # linux5.list.d4 use'''</20-default.listp>
Recommended: please run
rosdep update<p>Out: 0: -&gt; 0</p><p>Out: 1: -&gt; 1</p><p>Out: 2: -&gt; 2</p><p>Out: 3: -&gt; 3</p><p>Out: 4:^C</p><p>exit</p>|}</li></ol>
orangepi@orangepi:~$ '''rosdep update'''<span id="hardware-watchdog-test"></span>
reading in sources list data from /etc/ros/rosdep/sources.list.d== Hardware watchdog test ==
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osxThe watchdog_test program is pre-homebrewinstalled in the Linux system released by Orange Pi and can be tested directly.yaml
Hit httpsThe method to run the watchdog_test program is as follows://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
Hit https<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></rawli><li><p>We can feed the dog by pressing any key on the keyboard (except ESC).githubusercontentAfter feeding the dog, the program will print a line &quot;keep alive&quot; to indicate that the dog feeding is successful.com</rosp>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo watchdog_test 10'''</rosdistrop><p>open success</masterp><p>options is 33152,identity is sunxi-wdt</rosdepp><p>put_usr return,if 0,success:0</python.yamlp><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>
Hit https:<span id="check-the-chipid-of-h618-chip"><//raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yamlspan>
Hit https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml== Check the chipid of H618 chip ==
Query rosdistro index https://rawThe command to view the H618 chip chipid is as follows.githubusercontentThe chipid of each chip is different, so you can use chipid to distinguish multiple development boards.com/ros/rosdistro/master/index-v4.yaml
Skip end-of{| class="wikitable" style="width:800px;" |-life distro | orangepi@orangepi:~$ '''cat /sys/class/sunxi_info/sys_info | grep &quot;ardentchipid&quot;'''
Skip end-of-life distro &quot;bouncy&quot;sunxi_chipid : 338020004c0048080147478824681ed1|}
Skip end<span id="python-ofrelated-life distro &quot;crystal&quot;instructions"></span>
Skip end-of-life distro &quot;dashing&quot;== Python related instructions ==
Skip end<span id="how-ofto-life distro &quot;eloquent&quot;compile-and-install-python-source-code"></span>=== How to compile and install Python source code ===
Add distro &quot{| class="wikitable" style="background-color:#ffffdc;foxy&quotwidth:800px;" |-| <big>'''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.'''
Add distro &quot;galactic&quot;'''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).'''</big>|}
Skip end<ol style="list-style-type: decimal;"><li><p>First install the dependency packages needed to compile Python</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y build-essential zlib1g-dev \'''</p><p>'''libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev \'''</p><p>'''libreadline-dev libffi-dev curl libbz2-dev'''</p>|}</li><li><p>Then download the latest version ofPython3.9 source code and unzip it</p>{| class="wikitable" style="width:800px;" |-life distro &quot| <p>orangepi@orangepi:~$ '''wget \'''</p><p>'''https://www.python.org/ftp/python/3.9.10/Python-3.9.10.tgz'''</p><p>orangepi@orangepi:~$ '''tar xvf Python-3.9.10.tgz'''</p>|}</li><li><p>Then run the configuration command</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''cd Python-3.9.10'''</p><p>orangepi@orangepi:~$ '''./configure --enable-optimizations'''</p>|}</li><li><p>Then compile and install Python3.9. The compilation time takes about half an hour.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''make -j4'''</p><p>orangepi@orangepi:~$ '''sudo make altinstall'''</p>|}</li><li><p>After installation, you can use the following command to check the version number of the Python you just installed.</p>{| class="wikitable" style="width:800px;groovy&quot" |-| <p>orangepi@orangepi:~$ '''python3.9 --version'''</p><p>'''Python 3.9.10'''</p>|}</li><li><p>Then update pip</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''/usr/local/bin/python3.9 -m pip install --upgrade pip'''</p>|}</li></ol>
Add distro &quot;humble&quot;<span id="how-to-replace-pip-source-in-python"></span>
Skip end-of-life distro &quot;hydro&quot;=== How to replace pip source in Python ===
Skip end{| class="wikitable" style="background-of-life distro &quotcolor:#ffffdc;indigo&quotwidth:800px;" |-| <big>'''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.'''</big>|}
Skip end<ol style="list-ofstyle-life distro type: decimal;"><li><p>First install '''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-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 '''~/.pip''' directory, then add the '''pip.conf''' configuration file, and set the pip source in it to Tsinghua source.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''mkdir -p ~/.pip'''</p><p>orangepi@orangepi:~$ '''cat &lt;&quotlt;jadeEOF &quotgt;~/.pip/pip.conf'''</p><p>'''[global]'''</p><p>'''timeout = 6000'''</p><p>'''index-url = https://pypi.tuna.tsinghua.edu.cn/simple'''</p><p>'''trusted-host = pypi.tuna.tsinghua.edu.cn'''</p><p>'''EOF'''</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 '''&lt;packagename&gt;''' needs to be replaced with a specific package name</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''pip3 install &lt;packagename&gt; -i \'''</p><p>'''https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn'''</p>|}</li></ol>
Skip end<span id="how-ofto-life distro &quot;kinetic&quot;install-docker"></span>
Skip end-of-life distro &quot;lunar&quot;== How to install Docker ==
Add distro &quot;melodic&quot;The Linux image provided by Orange Pi has Docker pre-installed, but the Docker service is not turned on by default. Use the '''enable_docker.sh''' script to enable the docker service, and then you can start using the docker command, and the docker service will be automatically started the next time you start the system.
Add distro &quot;noetic&quot{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''enable_docker.sh'''|}
Add distro &quot;rolling&quot;You can use the following command to test docker. If '''hello-world''' can be run, docker can be used normally.
updated cache in /home/{| class="wikitable" style="width:800px;" |-| orangepi/.ros/rosdep/sources.cache@orangepi:~$ '''docker run hello-world'''
<ol start="6" style="list-styleUnable to find image 'hello-typeworld: decimal;"><li><p>Then open a command line terminal window on the '''desktop''', and then use the '''test_ros.sh''latest' script to start a small turtle routine to test whether ROS can be used normally.</p><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></li></ol>locally
<div class="figure">latest: Pulling from library/hello-world
[[File256ab8fe8778:zero2w-img249.png]]Pull complete
</div><ol start="9" style="list-style-typeDigest: decimal;"><li><p>At this time, press the direction keys on the keyboard to control the little turtle to move up, down, left, and right.</p><p>[[Filesha256:zero2w-img250.png]]</p></li></ol>7f0a9f93b4aa3022c3a4c147a449ef11e0941a1fd0bf4a8e6c9408b2600777c5
<span id="howStatus: Downloaded newer image for hello-to-install-ros-2-galactic-on-ubuntu20.04"></span>=== How to install ROS 2 Galactic on Ubuntu20.04 ===world:latest
<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]]</p>
<p>[[File:zero2w-img252.png]]</p>
<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>
<p>'''docs.ros.org/en/galactic/Installation.html'''</p>
<p>'''http://docs.ros.org/en/galactic/Installation/Ubuntu-Install-Debians.html'''</p></li>
<li><p>In the 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 is the '''Ubuntu20.04 desktop system'''. 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 '''install_ros.sh''' script to install ros2</p>
<p>orangepi@orangepi:~$ '''install_ros.sh ros2'''</p></li>
<li><p>The '''install_ros.sh''' script will automatically run the '''ros2 -h''' command after installing ros2. If you can see the following print, it means that the ros2 installation is complete.</p>
<p>usage: ros2 [-h] Call `ros2 &lt;command&gt; -h` for more detailed usage. ...</p>
<p>ros2 is an extensible command-line tool for ROS 2.</p>
<p>optional arguments:</p>
<p>-h, --help show this help message and exit</p>
<p>Commands:</p>
<p>action Various action related sub-commands</p>
<p>bag Various rosbag related sub-commands</p>
<p>component Various component related sub-commands</p>
<p>daemon Various daemon related sub-commands</p>
<p>doctor Check ROS setup and other potential issues</p>
<p>interface Show information about ROS interfaces</p>
<p>launch Run a launch file</p>
<p>lifecycle Various lifecycle related sub-commands</p>
<p>multicast Various multicast related sub-commands</p>
<p>node Various node related sub-commands</p>
<p>param Various param related sub-commands</p>
<p>pkg Various package related sub-commands</p>
<p>run Run a package specific executable</p>
<p>security Various security related sub-commands</p>
<p>service Various service related sub-commands</p>
<p>topic Various topic related sub-commands</p>
<p>wtf Use `wtf` as alias to `doctor`</p>
<p>Call `ros2 &lt;command&gt; -h` for more detailed usage.</p></li>
<li><p>Then you can use the '''test_ros.sh''' script to test whether ROS 2 is installed successfully. If you can see the following print, it means ROS 2 can run normally.</p>
<p>orangepi@orangepi:~$ '''test_ros.sh'''</p>
<p>[INFO] [1671174101.200091527] [talker]: Publishing: 'Hello World: 1'</p>
<p>[INFO] [1671174101.235661048] [listener]: I heard: [Hello World: 1]</p>
<p>[INFO] [1671174102.199572327] [talker]: Publishing: 'Hello World: 2'</p>
<p>[INFO] [1671174102.204196299] [listener]: I heard: [Hello World: 2]</p>
<p>[INFO] [1671174103.199580322] [talker]: Publishing: 'Hello World: 3'</p>
<p>[INFO] [1671174103.204019965] [listener]: I heard: [Hello World: 3]</p></li>
<li><p>Run the following command to open rviz2</p>
<p>orangepi@orangepi:~$ '''source /opt/ros/galactic/setup.bash'''</p>
<p>orangepi@orangepi:~$ '''ros2 run rviz2 rviz2'''</p>
<p>[[File:zero2w-img253.png]]</p></li>
<li><p>For how to use ROS, please refer to the documentation of ROS 2.</p>
<p>[http://docs.ros.org/en/galactic/Tutorials.html '''http://docs.ros.org/en/galactic/Tutorials.html''']</p></li></ol>
'''<span idstyle="how-to-install-ros-2-humble-on-ubuntu22.04color:#FF0000">Hello from Docker!</span>=== How to install ROS 2 Humble on Ubuntu22.04 ==='''
'''<ol span style="list-style-typecolor: decimal;#FF0000"><li><p>Use the install_ros.sh script to '''install_ros.sh'''</p><p>orangepi@orangepi:~$ '''install_ros.sh ros2'''</p></li><li><p>The '''install_ros.sh''' script will automatically run the '''ros2 -h''' command after installing ros2. If you can see the following print, it means This message shows that the ros2 your installation is complete.</p><p>usage: ros2 [-h] Call `ros2 &lt;command&gt; -h` for more detailed usage. ...</p><p>ros2 is an extensible command-line tool for ROS 2.</p><p>optional arguments:</p><p>-h, --help show this help message and exit</p><p>Commands:</p><p>action Various action related sub-commands</p><p>bag Various rosbag related sub-commands</p><p>component Various component related sub-commands</p><p>daemon Various daemon related sub-commands</p><p>doctor Check ROS setup and other potential issues</p><p>interface Show information about ROS interfaces</p><p>launch Run a launch file</p><p>lifecycle Various lifecycle related sub-commands</p><p>multicast Various multicast related sub-commands</p><p>node Various node related sub-commands</p><p>param Various param related sub-commands</p><p>pkg Various package related sub-commands</p><p>run Run a package specific executable</p><p>security Various security related sub-commands</p><p>service Various service related sub-commands</p><p>topic Various topic related sub-commands</p><p>wtf Use `wtf` as alias appears to `doctor`</p><p>Call `ros2 &lt;command&gt; -h` for more detailed usagebe working correctly.</p></li><li><pspan>Then you can use the '''test_ros.sh''' script to test whether ROS 2 is successfully installed. If you can see the following print, it means ROS 2 can run normally.</p><p>orangepi@orangepi:~$ '''test_ros.sh'''</p><p>[INFO] [1671174101.200091527] [talker]: Publishing: '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><p>orangepi@orangepi:~$ '''source /opt/ros/humble/setup.bash'''</p><p>orangepi@orangepi:~$ '''ros2 run rviz2 rviz2'''</p><p>[[File:zero2w-img254.png]]</p></li><li><p>Reference documentation</p><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-Debians.html''']</p></li></ol>
<span id="how-to-install-kernel-header-files"></span>'''.….'''== How to install kernel header files ==|}
When using the docker command, if you are prompted for '''Debian11 system with Linux6.1 kernel will report GCC error when compiling kernel module. So if permission denied''', please add the current user to the docker user group so that you want to compile can run the kernel module, please use Debian12 or Ubuntu22docker command without sudo.04.'''
<ol {| class="wikitable" style="list-style-typewidth: decimal800px;"><li><p>The Linux image released by OPi comes with the deb package of the kernel header file by default, and the storage location is '''/opt/'''</p><p>orangepi@orangepi:~$ '''ls /opt/linux|-headers*'''</p><p>/opt/linux-headers-xxx-sun50iw9_x.x.x_arm64.deb</p></li><li><p>Use the following command to install the deb package of the kernel header file</p>| <p>orangepi@orangepi:~$ '''sudo dpkg usermod -i /opt/linux-headers*.debaG docker $USER'''</p></li><li><p>After installation, you can see the folder where the kernel header file is located under '''/usr/src'''.</p>|}<p>orangepi@orangepi:~$ '''ls /usr/src'''</p><p>linux{| class="wikitable" style="background-headers-x.x.x</p></li><li><p>Then you can compile the source code of the hello kernel module that comes with the Linux image. The source code of the hello module is in '''/usr/src/hello'''. After entering this directory, then use the make command to compile.</p><p>orangepi@orangepicolor:~$ '''cd /usr/src/hello/'''</p><p>orangepi@orangepi#ffffdc;width:/usr/src/hello$ '''sudo make'''</p>800px;" <p>make |-C /lib/modules/5.4.125/build M=/usr/src/hello modules</p><p>make[1]: Entering directory '/usr/src/linux-headers-5.4.125'</p><p>CC [M] /usr/src/hello/hello.o</p><p>Building modules, stage 2.</p>| <p>MODPOST 1 modules</p><p>CC [M] /usr/src/hello/hello.mod.o</pbig><p>LD [M] /usr/src/hello/hello.ko</p><p>make[1]: Leaving directory '/usr/src/linux-headers-5.4.125'</p></li><li><p>After compilation, the '''hello.ko''' kernel module will be generated</p><p>orangepi@orangepiNote:/usr/src/hello$ '''ls *.ko'''</p><p>hello.ko</p></li><li><p>Use the '''insmod''' command You need to log out and log in again to insert the '''hello.ko''' kernel module into the kernel</p><p>orangepi@orangepi:/usr/src/hello$ '''sudo insmod hello.ko'''</p></li><li><p>Then use the '''demsg''' command system to view the output of the '''hellotake effect.ko''' kernel module. If you You can see also restart the following output, it means that the '''hellosystem.ko''' kernel module is loaded correctly.</pbig><p>orangepi@orangepi:/usr/src/hello$ '''dmesg | grep &quot;Hello&quot;'''</p>} <p>[ 2871.893988] '''Hello Orange Pi -span id="how- init'''</p></li><li><p>Use the '''rmmod''' command to uninstall the '''hello.ko''' kernel module</p><p>orangepi@orangepi:/usr/src/hello$ '''sudo rmmod hello'''</p><p>orangepi@orangepi:/usr/src/hello$ '''dmesg | grep &quot;Hello&quot;'''</p><p>[ 2871.893988] Hello Orange Pi -install- init</p><p>[ 3173.800892] '''Hello Orange Pi home-- exit'''</passistant"></li></olspan== How to install Home Assistant ==
<span id{| class="wikitable" style="testingbackground-ofcolor:#ffffdc;width:800px;" |-some-programming-languages-supported-by-linux-system"| <big>'''Note that this article will only provide methods for installing Home Assistant in Ubuntu or Debian systems. For detailed usage of Home Assistant, please refer to the official documentation or corresponding books.'''</spanbig>== Testing of some programming languages supported by Linux system ==|}
<span id="debianinstallation-bullseyevia-systemdocker"></span>=== Debian Bullseye system Installation via docker ===
<ol style="list-style-type: decimal;">
<li><p>Debian Bullseye is installed with the gcc compilation tool chain by defaultFirst, which please install docker and ensure that docker can directly compile C language programs in run normally. For the Linux system installation steps of docker, please refer to the instructions in the development board.</p><ol style="list-style-type: lower-alpha;"><li><p>The version of a.gcc is as follows</p><p>orangepi@orangepi:~$ [[Orange Pi Zero 2W#How to install Docker|'''gcc --versionHow to Install Docker'''</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]] section.</p></li><li><p>Write Then you can search for the '''hello_world.c''' program in C languagedocker image of Home Assistant</p><p>orangepi@orangepi{| class="wikitable" style="width:~$ '''vim hello_world.c'''</p><p>#include &lt800px;stdio.h&gt;</p>" <p>int main(void)</p><p>{</p><p>printf(&quot;Hello World!\n&quot;);</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.cdocker search homeassistant'''</p><p>orangepi@orangepi:~$ '''./hello_world'''</p><p>Hello World!</p></li></ol>|}
</li>
<li><p>Debian Bullseye has Python3 installed by defaultThen 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><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>The specific version of Python is as follows</p>|-| <p>orangepi@orangepi:~$ '''python3docker 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>'''Python 3.9.2.... (Omit some output)''' (default, Feb 28 2021, 17</p><p>3cc6a1510c9f: Pull complete</p><p>7a4e4d5b979f: Pull complete</p><p>Digest: sha256:81d381f5008c082a37da97d8b08dd8b358dae7ecf49e62ce3ef1eeaefc4381bb</p><p>Status:03Downloaded newer image for homeassistant/home-assistant:44)latest</p><p>[GCC 10docker.2.1 20210110] on linuxio/homeassistant/home-assistant:latest</p>|}</li><li><p>Then you can use the following command to view the docker image of Home Assistant you just downloaded</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''docker images homeassistant/home-assistant'''</p><p>Type REPOSITORY &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quotnbsp;help&quotnbsp;&nbsp;&nbsp; TAG &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IMAGE &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ID &nbsp;&nbsp;&nbsp;&nbsp;, &quotnbsp;copyrightCREATED &quotnbsp;, &quotnbsp;credits&quotnbsp; or &quotnbsp;license&quotnbsp; for more information.SIZE</p><p>homeassistant/home-assistant &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; latest &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bfa0ab9e1cf5 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2 months ago &nbsp;&nbsp;&gtnbsp;&gtnbsp;&gtnbsp;'''</pspan style="color:#FF0000">1.17GB<p/span>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p>|}</li><li><p>Write At this point you can run the '''hello_world.py''' program in Python languageHome Assistant docker container</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.pydocker run -d \'''</p>:<p>print('Hello World!')'--name homeassistant \'''</p>:<p>'''--privileged \'''</lip>:<p>'''--restart=unless-stopped \'''<li/p>:<p>The result of running '''hello_world.py-e TZ=Asia/Shanghai \''' is as follows</p>:<p>orangepi@orangepi:~$ '''python3 hello_world.py-v /home/orangepi/home-assistant:/config \'''</p>:<p>Hello World!'''--network=host \'''</p>:<p>'''homeassistant/li>home-assistant:latest'''</olp>|}
</li>
<li><p>Debian Bullseye does not install Java compilation tools and operating environment by default.Then enter【the IP address of the development board: 8123】in the browser to see the Home Assistant interface</p><ol {| class="wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;"><li><p>You can use the following command to install openjdk. The latest &gt; version in Debian Bullseye is openjdk|-17</p><p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''</p></li>| <libig><p>After installation, you can check the Java version.</p><p>orangepi@orangepi:~$ '''java --version'''</p></li><li><p>Write It takes a while for the Java version of '''hello_worldHome Assistant container to start.java'''</p><p>orangepi@orangepi:~$ '''vim hello_worldIf the interface below does not display normally, please wait a few seconds before refreshing it.java'''</p><p>public class hello_world</p><p>{</p><p>public static void main(String[] args)</p><p>{</p><p>SystemIf 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.out.println(&quot;Hello World!&quot;);</p><p>}</p><p>}</p></li><li><p>Then compile At this time, you need to check whether there is a problem with the previous installation and run '''hello_worldsetting process.java'''</p><p>orangepi@orangepi:~$ '''javac hello_world.java'''</pbig><p>orangepi@orangepi:~$ '''java hello_world'''</p>|}<p>Hello World!</p></li></ol></li></oldiv class="figure">
<span id="debian[[File:zero2w-bookworm-system"></span>=== Debian Bookworm system ===img180.png]]
<ol style/div></li><li><p>Then enter your '''name, username''' and '''password''' and click '''Create Account'''</p><div class="listfigure"> [[File:zero2w-styleimg181.png]] </div></li><li><p>Then follow the interface prompts to set according to your own preferences, and then click Next</p><div class="figure"> [[File:zero2w-typeimg182.png]] </div></li><li><p>Then click Next</p><div class="figure"> [[File: decimal;zero2w-img183.png]] </div></li><li><p>Then click Finish</p><div class="figure"> [[File:zero2w-img184.png]] </div></li><li><p>Debian Bookworm The main interface finally displayed by Home Assistant is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development boardas shown below</p><p>[[File:zero2w-img185.png]]</p></li><li><p>Method to stop Home Assistant container</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The version of a.gcc command to view the docker container is as follows</p><p>orangepi@orangepi{| class="wikitable" style="width:~$ '''gcc --version'''</p>800px;" <p>gcc (Debian 12.2.0|-14) 12.2.0</p><p>Copyright (C) 2022 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p></li><li><p>Write the '''hello_world.c''' program in C language</p>| <p>orangepi@orangepi:~$ '''vim hello_world.cdocker ps -a'''</p><p>#include &lt;stdio.h&gt;</p><p>int main(void)</p><p>{</p><p>printf(&quot;Hello World!\n&quot;);</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 Bookworm has Python3 installed by defaultThe command to stop the Home Assistant container is as follows</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>The specific version of Python is as follows</p><p>orangepi@orangepi:~$ '''python3'''</p><p>Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux</p><p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</p><p>&gt;&gt;&gt;</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.pydocker stop homeassistant'''</p><p>Hello World!</p></li></ol>|}
</li>
<li><p>Debian Bookworm does not install Java compilation tools and operating environment by default.The command to delete the Home Assistant container is as follows</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>You can use the following command to install openjdk. The latest &gt; version in Debian Bookworm is openjdk|-17</p><p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''</p></li><li><p>After installation, you can check the Java version.</p>| <p>orangepi@orangepi:~$ '''java --version'''</p></li><li><p>Write the Java version of '''hello_world.javadocker rm homeassistant'''</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(&quot;Hello World!&quot;);</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>
<span id="ubuntuinstallation-focalvia-systempython"></span> === Ubuntu Focal system Installation via python === {| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Before installation, please change the source of pip to a domestic source to speed up the installation of Python packages. For the configuration method, see the instructions in the section &quot;[[Orange Pi Zero 2W#How to replace pip source in Python|How to Change the Pip Source of Python]]&quot;'''</big>|}
<ol style="list-style-type: decimal;">
<li><p>Ubuntu Focal 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.First install dependency packages</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 -sudo apt-versionget update'''</p><p>gcc (Ubuntu 9.4.0orangepi@orangepi:~$ '''sudo apt-1ubuntu1~20.04.1) 9.4.0</p><p>Copyright (C) 2019 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NOget install -y python3 python3-dev python3-venv \'''</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p></li><li><p>Write the '''hello_world.cpython3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \''' program in C language</p><p>orangepi@orangepi:~$ '''vim hello_world.clibopenjp2-7 libtiff5 libturbojpeg0-dev tzdata'''</p><p>#include &lt;stdio.h&gt;</p><p>int main(void)</p>|}<p>{</p><p>printf(&quot| class="wikitable" style="background-color:#ffffdc;Hello World!\n&quotwidth:800px;);</p>" <p>return 0;</p>|-<p>}</p></li>| <libig><p>Then compile and run '''hello_world.cIf it is debian12, please use the following command:'''</p></big><p>orangepi@orangepi:~$ '''gcc sudo apt-o hello_world hello_world.cget update'''</p><p>orangepi@orangepi:~$ '''./hello_worldsudo apt-get install -y python3 python3-dev python3-venv \'''</p><p>Hello World!'''python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \'''</p></lip>'''libopenjp2-7 libturbojpeg0-dev tzdata'''</olp>|}
</li>
<li><p>Ubuntu Focal has Then you need to compile and install Python3 installed by default.9. For the method, please refer to the [[Orange Pi Zero 2W#Python related instructions|'''Python source code compilation and installation method''']] section.</p><ol {| class="wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;">|-| <libig><p>'''The specific default Python version of Debian Bullseye is Python3 is as follows</p><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 &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</p><p>&gt;&gt;&gt;</p><p>'''Use the Ctrl+D shortcut key so there is no need to exit python's interactive modecompile and install it.'''</p></li><li><p>Write the '''hello_worldThe default Python version of Ubuntu Jammy is Python3.10, so there is no need to compile and install it.py''' program in Python language</p><p>orangepi@orangepi:~$ '''vim hello_world.py'''</p><p>print('Hello World!')</p></li><li><p>The result default Python version of running '''hello_worldDebian Bookworm is Python3.py''' 11, so there is as follows</p><p>orangepi@orangepi:~$ '''python3 hello_worldno need to compile and install it.py'''</p><p>Hello World!</p></li></olbig>|}
</li>
<li><p>Ubuntu Focal does not have Java compilation tools and running Then create a Python virtual environment installed by default.</p><ol {| class="wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;"><li><p>You can use the following command to install openjdk|-17</p><p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''</p></li>| <libig><p>After installation, you can check the Java version.</p><p>orangepi@orangepi:~$ '''java --version'''</p><p>openjdk 17Debian Bookworm is python3.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.0411, mixed mode, sharing)</p></li><li><p>Write please remember to replace the Java version of '''hello_worldcorresponding command.java'''</p><p>orangepi@orangepi:~$ '''vim hello_world.java'''</pbig><p>public class hello_world</p>|}<p>{</p><p>public static void main(String[] args)</p><p>{</p><p>System.out.println(&quot;Hello World!&quot;);</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> <span id| class="ubuntu-jammy-systemwikitable"></span>=== Ubuntu Jammy system === <ol style="list-style-typewidth: decimal800px;"><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="list-style-type: lower|-alpha;"><li><p>The version of a.gcc is as follows</p>| <p>orangepi@orangepi:~$ '''gcc --versionsudo mkdir /srv/homeassistant'''</p><p>gcc (Ubuntu 11.3.0-1ubuntu1orangepi@orangepi:~22.04.1) $ '''11.3.0'''<sudo chown orangepi:orangepi /p><p>Copyright (C) 2021 Free Software Foundation, Inc.<srv/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 'homeassistant''hello_world.c''' program in C language</p><p>orangepi@orangepi:~$ '''vim hello_world.c'''</p><p>#include &lt;stdio.h&gt;<cd /p><p>int main(void)<srv/p><p>{</p><p>printf(&quot;Hello World!\n&quot;);</p><p>return 0;</p><p>}</p></li><li><p>Then compile and run '''hello_world.chomeassistant'''</p><p>orangepi@orangepi:~$ '''gcc python3.9 -o hello_world hello_worldm venv .c'''</p><p>orangepi@orangepi:~$ '''.source bin/hello_worldactivate'''</p><p>Hello World!<(homeassistant) orangepi@orangepi:/p><srv/li>homeassistant$</olp>|}
</li>
<li><p>Ubuntu Jammy has Python3 installed by defaultThen install the required Python packages</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>The specific version of Python3 is as follows</p>|-| <p>(homeassistant) orangepi@orangepi:~/srv/homeassistant$ '''python3-m pip install wheel'''</p><p>Python 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0] on linux</p><p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</p><p>&gt;&gt;&gt;</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 languageThen you can install Home Assistant Core</p>{| class="wikitable" style="width:800px;" |-| <p>(homeassistant) orangepi@orangepi:~/srv/homeassistant$ '''vim hello_world.pypip3 install homeassistant'''</p><p>print('Hello World!')</p>|}</li><li><p>The result of running '''hello_world.py''' is as followsThen enter the following command to run Home Assistant Core</p>{| class="wikitable" style="width:800px;" |-| <p>(homeassistant) orangepi@orangepi:~/srv/homeassistant$ '''python3 hello_world.pyhass'''</p><p>Hello World!</p></li></ol>|}
</li>
<li><p>Ubuntu Jammy does not install Java compilation tools and operating environment by default.Then enter【'''development board IP address: 8123'''】 in the browser to see the Home Assistant interface</p><ol {| class="wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;"><li><p>You can use the following command to install openjdk|-18| </pbig><p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-18-jdk'''</p></li><li><p>After installation, When you can check run the Java versionhass command for the first time, some libraries and dependency packages necessary for operation will be downloaded, installed and cached.</p><p>orangepi@orangepi:~$ '''java --version'''</p><p>openjdk 18This process may take several minutes.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 Note that you cannot see the Home Assistant interface in the Java version of '''hello_worldbrowser at this time.java'''</p><p>orangepi@orangepi:~$ '''vim hello_worldPlease wait for a while and then refresh it.java'''</p><p>public class hello_world</p><p>{</p><p>public static void main(String[] args)</p><p>{</p><p>System.out.println(&quot;Hello World!&quot;);</pbig><p>|}</p><p>}</p></lidiv class="figure"><li><p>Then compile and run '''hello_world.java'''</p><p>orangepi@orangepi[[File:~$ '''javac hello_worldzero2w-img180.java'''</p>png]]<p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</pdiv></li></ol></li></ol>
<span id="methodopencv-ofinstallation-uploading-files-to-the-development-board-linux-systemmethod"></span>== Method of uploading files to the development board Linux system ==
<span id="= OpenCV installation method-to-upload-files-to-the-development-board-linux-system-in-ubuntu-pc"></span>=== Method to upload files to the development board Linux system in Ubuntu PC ===
<span id="howuse-apt-to-upload-files-using-scpinstall-commandopencv"></span>==== How Use apt to upload files using scp command =install OpenCV ===
<ol style="list-style-type: decimal;">
<li><p>Use The installation command is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y libopencv-dev python3-opencv'''</p>|}</li><li><p>Then use the scp following command to upload files to print the Linux system version number of the development board in Ubuntu PCOpenCV. The specific command output is normal, indicating that the OpenCV installation is as followssuccessful.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The version of OpenCV in Ubuntu22.04 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 -c &quot;import cv2; print(cv2.__version__)&quot;'''</p><p>'''file_path: 4.5.4'''Needs to be replaced with the path of the file to &gt; be uploaded</p>|}</li><li><p>'''The version of OpenCV in Ubuntu20.04 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi: ~$ '''This is the user name of the development board's python3 -c &gtquot;import cv2; Linux systemprint(cv2. It can also be replaced with something else, __version__)&gtquot; such as root.'''</p></li><li><p>'''1924.1682.xx.xx:0''' This is the IP address of the development &gt; board. Please modify it according to the actual situation.</p>|}</li><li><p>'''/home/orangepi:''' The path version of OpenCV in the development board Linux &gt; system can also be modified to other paths.Debian11 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>testorangepi@testorangepi:~$ '''scp file_path orangepi@192python3 -c &quot;import cv2; print(cv2.168.xx.xx:/home/orangepi/__version__)&quot;'''</p></lip>'''4.5.1'''</olp>|}
</li>
<li><p>If you want to upload a folder, you need to add the -r parameterThe version of OpenCV in Debian12 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>testorangepi@testorangepi:~$ '''scp python3 -r dir_path orangepi@192c &quot;import cv2; print(cv2.168.xx.xx:/home/orangepi/__version__)&quot;'''</p><p>'''4.6.0'''</lip>|}</li><p>There are more usages of scp, please use the following command to view the man manual</pol></li></ol>
test@test:~$ '''man scp'''<span id="set-up-the-chinese-environment-and-install-the-chinese-input-method"></span>
<span id="how-to-upload-files-using-filezilla"></span>==== How to upload files using filezilla ==Set up the Chinese environment and install the Chinese input method ==
<ol {| class="wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;"><li><p>First install filezilla in Ubuntu PC</p><p>test@test:~$ '''sudo apt install |-y filezilla'''</p></li><li><p>Then use the following command to open filezilla</p>| <pbig>test@test:~$ '''filezilla'''</p></li><li><p>The interface after opening filezilla is as shown below. At this timeNote, before installing the Chinese input method, please make sure that the remote site on Linux system used by the right development board is emptya desktop version.'''</pbig><div class="figure">|}
[[File:zero2w<span id="debian-img255.png]]system-installation-method"></span>=== Debian system installation method ===
<ol style="list-style-type: decimal;"><li><p>First set the default '''locale''' to Chinese</p><ol style="list-style-type: lower-alpha;"><li><p>Enter the following command to start configuring '''locale'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo dpkg-reconfigure locales'''</p>|}</li><li><p>Then select '''zh_CN.UTF-8 UTF-8''' in the pop-up interface (use the up and down keys on the keyboard to move up and down, use the space bar to select, and finally use the Tab key to move the cursor to '''&lt;OK&gt;''', and then return Car can be used)</p><p>[[File:zero2w-img186.png]]</p></li><li><p>Then set the default '''locale''' to '''zh_CN.UTF-8'''</p><p>[[File:zero2w-img187.png]]</divp></li><li><p>After exiting the interface, the '''locale''' setting will begin. The method of connecting output displayed on the development board command line is as shown in the figure belowfollows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo dpkg-reconfigure locales'''</p><p>Generating locales (this might take a while)...</p>:<p>en_US.UTF-8... done</p>:<p>zh_CN.UTF-8... done</p><p>Generation complete.</p>|}</li></ol></li><li><p>Then open '''Input Method'''</p><p>[[File:zero2w-img188.png]]</p></li><li><p>Then select '''OK'''</p><p>[[File:zero2w-img189.png]]</p></li><li><p>Then select '''Yes'''</p><p>[[File:zero2w-img190.png]]</p></li><li><p>Then select '''fcitx'''</p><p>[[File:zero2w-img191.png]]</p></li><li><p>Then select '''OK'''</p><p>[[File:zero2w-img192.png]]</p></li><div classli><p>'''<span style="figurecolor:#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-img256img193.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><ol start="5" style="list-style-type: decimal;"><li><p>Then choose to '''save the password''' and click '''OK'''</p><p>[[File:zero2w-img257img195.png]]</p></li><li><p>Then select '''Always trust this host''' and click '''OK'''</p></li></ol>
</div ></li><li><p>Then put '''Google Pinyin''' on 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><p>[[File:zero2w-img199.png]]</p></li><li><p>You can switch between Chinese and English input methods through the '''Ctrl+Space''' shortcut key</p></li><li><p>If you need the entire system to be displayed in Chinese, you can set all variables in '''/etc/default/locale''' to '''zh_CN.UTF-8'''</p>{| class="figurewikitable"style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo vim /etc/default/locale'''</p><p># File generated by update-locale</p><p>LC_MESSAGES='''<span style="color:#FF0000">zh_CN.UTF-8</span>'''</p><p>LANG='''<span style="color:#FF0000">zh_CN.UTF-8</span>'''</p><p>LANGUAGE='''<span style="color:#FF0000">zh_CN.UTF-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.</p><p>[[File:zero2w-img200.png]]</p></li></ol>
[[File:zero2w<span id="installation-img258method-of-ubuntu-20.png]]04-system"></span>
</div><ol start="7" style="list-style-type: decimal;"><li>After the connection is successful, you can see the directory structure = Installation method of the development board's Linux file Ubuntu 20.04 system on the right side of the filezilla software.</li></ol>===
<div ol style="list-style-type: decimal;"><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-img202.png]]</p></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>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note that this step is not easy to drag, please be patient and try it a few times.'''</big>|}</ol><ol start="4" style="list-style-type: decimal;"><li><p>Then select '''Apply System-Wide''' to apply the Chinese settings to the entire system</p><p>[[File:zero2w-img204.png]]</p></li><li><p>Then set the '''Keyboard input method system''' system to '''fcitx'''</p><p>[[File:zero2w-img205.png]]</p></li><li><p>'''<span style="color:#FF0000">Then restart the Linux system to make the configuration take effect</span>'''</p></li><li><p>After re-entering the system, please select '''Do not ask me again''' in the following interface, and then please decide according to your own preferences whether the standard folder should also be updated to Chinese</p><p>[[File:zero2w-img206.png]]</p></li><li><p>Then you can see that the desktop is displayed in Chinese</p><p>[[File:zero2w-img207.png]]</p></li><li><p>Then we can open '''Geany''' to test the Chinese input method. The opening method is as shown in the figure"below</p><p>[[File:zero2w-img208.png]]</p></li><li><p>After opening '''Geany''', the English input method is still the default. We can switch to the Chinese input method through the '''Ctrl+Space''' shortcut key, and then we can input Chinese.</p><p>[[File:zero2w-img209.png]]</p></li></ol>
[[File:zero2w<span id="installation-img259method-of-ubuntu-22.png]]04-system"></span>
</div><ol start="8" style="list-style-type: decimal;"><li>Then select the path to be uploaded to the development board on the right side = Installation method of the filezilla software, select the file to be uploaded in Ubuntu PC on the left side of the filezilla software, right-click the mouse, and then click the upload option to start uploading the file to the development board22.</li></ol>04 system ===
<ol style="list-style-type: decimal;">
<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-img210.png]]</p></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-img211.png]]</p></li>
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|
<big>'''Note that this step is not easy to drag, please be patient and try it a few times.'''</big>
|}
</ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>Then select '''Apply System-Wide''' to apply the Chinese settings to the entire system</p>
<p>[[File:zero2w-img212.png]]</p></li>
<li><p>'''<span style="color:#FF0000">Then restart the Linux system to make the configuration take effect</span>'''</p></li>
<li><p>After re-entering the system, please select '''Do not ask me again''' in the following interface, and then please decide whether the standard folder should also be updated to Chinese according to your own preferences.</p>
<p>[[File:zero2w-img206.png]]</p></li>
<li><p>Then you can see that the desktop is displayed in Chinese</p>
<p>[[File:zero2w-img207.png]]</p></li>
<li><p>Then open the Fcitx5 configuration program</p>
<p>[[File:zero2w-img213.png]]</p></li>
<li><p>Then choose to use Pinyin input method</p>
<div class="figure">
[[File:zero2w-img260img214.png]]
</div></li><ol start="9" style="listli><p>The interface after selection is as shown below, then click OK</p><p>[[File:zero2w-style-type: decimal;"img215.png]]</p></li><li><p>After the upload is completed, you Then we can go open '''Geany''' to test the corresponding path Chinese input method. The opening method is as shown in the development board Linux system to view the uploaded filefigure below</p><p>[[File:zero2w-img208.png]]</p></li><li><p>The After opening '''Geany''', the English input method of uploading a folder is still the same as default. We can switch to the Chinese input method of uploading a filethrough the '''Ctrl+Space''' shortcut key, so I won't go into details hereand then we can enter Chinese.</p></lip>[[File:zero2w-img216.png]]</olp> <span id="method-to-upload-files-from-windows-pc-to-development-board-linux-system"/li></spanol>=== Method to upload files from Windows PC to development board Linux system ===
<span id="how-to-uploadremotely-fileslog-usingin-filezillato-1the-linux-system-desktop"></span>==== How to upload files using filezilla ====
# First download == How to remotely log in to the installation file of the Windows version of the filezilla software. The download link is as followsLinux system desktop ==
[https://filezilla<span id="remote-login-using-project.orgnomachine"></download.php?typespan>=== Remote login using NoMachine ==client '''https://filezilla-project.org/download.php?type=client''']
[[File{| class="wikitable" style="background-color:zero2w#ffffdc;width:800px;" |-img261| <big>'''Please ensure that the Ubuntu or Debian system installed on the development board is a <span style="color:#FF0000">desktop version</span> of the system. In addition, NoMachine also provides detailed usage documentation.png]]It is strongly recommended to read this document thoroughly to become familiar with the use of NoMachine. The document link is as follows:'''
'''https://knowledgebase.nomachine.com/DT10R00166'''<div /big>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''NoMachine supports Windows, Mac, Linux, iOS and Android platforms, so we can remotely log in and control the Orange Pi development board through NoMachine on a variety of devices. The following demonstrates how to remotely log in to the Linux system desktop of the Orange Pi development board through NoMachine in Windows. For installation methods on other platforms, please refer to NoMachine's official documentation.'''</big>|}{| class="figurewikitable"style="background-color:#ffffdc;width:800px;" |-| <big>'''Before operating, please make sure that the Windwos computer and the development board are in the same LAN, and that you can log in to the Ubuntu or Debian system of the development board through ssh normally.'''</big>|}
<ol style="list-style-type: decimal;"><li><p>First download the installation package of the NoMachine software Linux '''<span style="color:#FF0000">arm64</span>''' deb version, and then install it into the Linux system of the development board</p><ol style="list-style-type: lower-alpha;"><li>Since H618 is an ARMv8 architecture SOC and the system we use is Ubuntu or Debian, we need to download the '''NoMachine for ARM ARMv8 DEB''' installation package. The download link is as follows:</li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note that this download link may change, please look for the Armv8/Arm64 version of the deb package.'''</big>|}{| class="wikitable" style="width:800px;" |-| [[Filehttps://www.nomachine.com/download/download&id=112&s=ARM '''https:zero2w-img262//downloads.nomachine.png]com/download/?id=118&amp;distro=ARM''']|}
[[File:zero2w-img217.png]]</divol><ol start="2" style="list-style-type: lower-alpha;"><li><p>In addition, you can also download the '''NoMachine''' installation package from the official tool.</p><p>[[File:zero2w-img218.png]]</p><p>First enter the '''remote login software-NoMachine''' folder</p><p>[[File:zero2w-img219.png]]</p><p>Then download the arm64 version of the deb installation package</p><p>[[File:zero2w-img220.png]]</p></li><li><p>Then upload the downloaded '''nomachine_x.x.x_x_arm64.deb''' to the Linux system of the development board</p></li><li><p>Then use the following command to install '''NoMachine''' in the Linux system of the development board</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo dpkg -i nomachine_x.x.x_x_arm64_arm64.deb'''</p>|}</li></ol></li></ol>
<ol start="2" style="list-style-type: decimal;">
<li><p>The downloaded Then download the installation package of the Windows version of the NoMachine software. The download address is as shown below, then double-click to install it directlyfollows</pli>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <pbig>'''FileZilla_Server_1Note that this download link may change.5.1_win64-setup.exe'''</pbig><|}{| class="wikitable" style="width:800px;" |-| '''https://downloads.nomachine.com/li><download/ol>?id=9'''|}
During the [[File:zero2w-img221.png]]</ol><ol start="3" style="list-style-type: decimal;"><li><p>Then install NoMachine in Windows. '''Please restart your computer after installation process, please select .'''</p></li><li><p>Then open '''DeclineNoMachine''' in Window</p><p>[[File:zero2w-img222.png]]</p></li><li><p>After NoMachine is started, it will automatically scan other devices with NoMachine installed on the following installation LAN. After entering the main interfaceof NoMachine, you can see that the development board is already in the list of connectable devices, and then select click on the location shown in the red box in the picture below You can now log in to the Linux system desktop of the development board.</p><p>[[File:zero2w-img223.png]]</p></li><li><p>Then click '''Next&gt;OK'''</p><p>[[File:zero2w-img224.png]]</p></li><li><p>Then enter the username and password of the development board Linux system in the corresponding positions in the figure below, and then click OK to start logging in.</p><p>[[File:zero2w-img225.png]]</p></li><li><p>Then click OK in the next interface.</p></li><li><p>Finally you can see the desktop of the development board Linux system</p><p>[[File:zero2w-img226.png]]</p></li></ol>
<div classspan id="figureremote-login-using-vnc"></span>
[[File:zero2w-img263.png]]=== Remote login using VNC ===
</div><ol start{| class="3wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;">|-| <libig>The interface after opening filezilla is as shown below. At this time'''Before operating, please make sure that the Windwos computer and the development board are in the same LAN, and that you can log in to the remote site on Ubuntu or Debian system of the right is emptydevelopment board through ssh normally.</li></ol>'''
'''<div classspan style="figurecolor:#FF0000">There are many problems with VNC testing in Ubuntu20.04, please do not use this method.</span>'''</big>|}
[[File<ol style="list-style-type: decimal;"><li><p>First run the '''set_vnc.sh''' script to set up vnc, '''remember to add sudo permission'''s</p>{| class="wikitable" style="width:zero2w800px;" |-img264| <p>orangepi@orangepi:~$ '''sudo set_vnc.sh'''</p><p>You will require a password to access your desktops.png]]</p>
</div>
<ol start="4" style="list-style-type: decimal;">
<li>The method of connecting the development board is as shown in the figure below:</li></ol>
<div classp>Password: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '''<span style="figurecolor:#FF0000">#Set the vnc password here, 8 characters</span>'''</p><p>Verify: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '''<span style="color:#FF0000">#Set the vnc password here, 8 characters</span>'''</p><p>Would you like to enter a view-only password (y/n)? '''<span style="color:#FF0000">n</span>'''</p><p>xauth: file /root/.Xauthority does not exist</p>
[[File:zero2w-img256.png]]
</div><ol start="5" style="list-style-type: decimal;"><lip>Then choose to New 'X''save the password''' and click '''OK'''</li>desktop is orangepi:1</olp>
<div class="figure">
[[File<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:zero2w-img2651.png]]log</p>
</div>
<ol start="6" style="list-style-type: decimal;">
<li>Then select '''Always trust this host''' and click '''OK'''</li></ol>
<div class="figure"p>Killing Xtightvnc process ID 3047</p>
[[File:zero2w-img266.png]]
</divp><ol start="7" style="list-style-typeNew 'X' desktop is orangepi: decimal;"><li>After the connection is successful, you can see the directory structure of the development board's Linux file system on the right side of the filezilla software.</li>1</olp>
<div class="figure">
[[File<p>Starting applications specified in /root/.vnc/xstartup</p><p>Log file is /root/.vnc/orangepi:zero2w-img2671.png]]log</p>|}</divli><li><p>The steps to use MobaXterm software to connect to the development board Linux system desktop are as follows:</p><ol start="8" style="list-style-type: decimallower-alpha;"><li>Then First click Session, then select VNC, then fill in the path to be uploaded to IP address and port of the development board on the right side of the filezilla software, select the file to be uploaded on the Windows PC on the left side of the filezilla software, right-click the mouse, and then finally click the upload option OK to start uploading the file to the development boardconfirm.</li></ol>
<div class="figure">
[[File:zero2w-img268img227.png]]
</div></ol><ol start="92" style="list-style-type: decimallower-alpha;"><li><p>After Then enter the upload is completed, you can go to the corresponding path in the development board Linux system to view the uploaded fileVNC password set earlier</p><p>[[File:zero2w-img228.png]]</p></li><li><p>The method of uploading a folder After successful login, the interface is the same displayed as shown below, and then you can remotely operate the method desktop of uploading a file, so I won't go into details herethe development board Linux system.</p></li></ol>
[[File:zero2w-img229.png]]</ol></li></ol><span id="instructionsqt-forinstallation-using-the-logo-on-and-off-the-machinemethod"></span>== Instructions for using the logo on and off the machine ==
<ol style="list-style-type: decimal;"><li><p>The power on/off logo will only be displayed on the desktop version of the system by default.</p></li><li><p>Set the '''bootlogo''' variable to '''false''' in '''/boot/orangepiEnv.txt''' to turn off the switch logo.</p><p>orangepi@orangepi:~$ '''sudo vim /boot/orangepiEnv.txt'''</p><p>verbosity=1</p><p>'''bootlogoQT installation method =false'''</p></li><li><p>Set the '''bootlogo''' variable to '''true''' in '''/boot/orangepiEnv.txt''' to enable the power on/off logo.</p><p>orangepi@orangepi:~$ '''sudo vim /boot/orangepiEnv.txt'''</p><p>verbosity=1</p><p>'''bootlogo=true'''</p></li><li><p>The location of the boot logo picture in the Linux system is</p><p>'''/usr/share/plymouth/themes/orangepi/watermark.png'''</p></li><li><p>After replacing the boot logo image, you need to run the following command to take effect</p><p>orangepi@orangepi:~$ '''sudo update-initramfs -u'''</p></li></ol> <span id="how-to-turn-on-the-power-button-in-linux5.4"></span>== How to turn on the power button in Linux5.4 == There is no power on/off button on the main board of the development board. We can expand it through a 24pin expansion board. The location of the power on/off button on the expansion board is as follows: [[File:zero2w-img269.png]] The power on/off button of the Linux 6.1 image is turned on by default, but the power on/off button of the Linux 5.4 kernel image is turned off by default and needs to be turned on manually for normal use. The steps are as follows:
<ol style="list-style-type: decimal;">
<li><p>First run Use the following script to install QT5 and QT Creator</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''install_qt.sh'''</p>|}</li><li><p>After installation, the QT version number will be automatically printed.</p><ol style="list-style-type: lower-alpha;"><li><p>The qt version that comes with Ubuntu20.04 is '''5.12.8'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''install_qt.sh'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version '''<span style="color:#FF0000">5.12.8</span>''' in /usr/lib/aarch64-linux-configgnu</p>|}</li><li><p>The QT version that comes with Ubuntu22.04 is '''5. Ordinary users remember to add 15.3'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''install_qt.sh'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version '''<span style="color:#FF0000">5.15.3</span>'''sudoin /usr/lib/aarch64-linux-gnu</p>|}</li><li><p>The QT version that comes with Debian11 is ''' permissions5.15.2'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo install_qt.sh'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version '''<span style="color:#FF0000">5.15.2</span>''' in /usr/lib/aarch64-linux-gnu</p>|}</li><li><p>The QT version that comes with Debian12 is '''5.15.8'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi-config:~$ '''install_qt.sh'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version '''<span style="color:#FF0000">5.15.8</span>'''in /usr/lib/aarch64-linux-gnu</p>|}</li></ol></li><li><p>Then select you can see the QT Creator startup icon in '''SystemApplications'''</p><p>[[File:zero2w-img80img230.png]]</p><p>You can also use the following command to open QT Creator</lip><li>{| class="wikitable" style="width:800px;" |-| <p>Then select orangepi@orangepi:~$ '''Hardwareqtcreator'''</p>|}</li><li><p>The interface after QT Creator is opened is as follows</p><p>[[File:zero2w-img81img231.png]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown The version of QT Creator is as follows</p><ol style="list-style-type: lower-alpha;"><li><p>The default version of QT Creator in the picture below, and then use the '''spaceUbuntu20.04''' to select the dtbo configuration of the SPI you want to open.is as follows</p><p>[[File:zero2w-img270img232.png]]</p></li><li><p>Then select The default version of QT Creator in '''&lt;Save&gt;Ubuntu22.04''' to saveis as follows</p><p>[[File:zero2w-img83img233.png]]</p></li><li><p>Then select The default version of QT Creator in '''&lt;Back&gt;Debian11'''is as follows</p><p>[[File:zero2w-img84img234.png]]</p></li><li><p>Then select The default version of QT Creator in '''&lt;Reboot&gt;Debian12''' to restart the system to make the configuration take effect.is as follows</p><p>[[File:zero2w-img85img235.png]]</p></li></ol></li><span id="how-to-shut-down-and-restart-the-development-board"li><p>Then set up QT</spanp>== How to shut down and restart the development board == <ol style="list-style-type: decimallower-alpha;"><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 First open '''Help'''-&gt;'''poweroffAbout Plugins...''' command to shut down the Linux system of the development board before powering off, and then unplug the power supply.</p><p>orangepi@orangepi[[File:~$ zero2w-img236.png]]</p></li><li><p>Then remove the check mark of '''sudo poweroffClangCodeModel'''</p><p>[[File:zero2w-img237.png]]</p></li><li><p>'''Note that after turning off the development board<span style="color:#FF0000">After setting up, you need to unplug and replug the power supply before it can be turned on.restart QT Creator</span>'''</p></li><li><p>In addition to using Then make sure the GCC compiler used by QT Creator. If the poweroff command default is Clang, please change it to shut down, you can also use the power onGCC.</off button on the expansion board to shut downp>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Debian12 please skip this step.'''</p></big>|}<p>[[File:zero2w-img269img238.png]]</p><p>'''Note that Linux 5[[File:zero2w-img239.4 requires manual configuration of the power onpng]]</p></li></ol></off button before it li><li><p>Then you can be usedopen a sample code</p><p>[[File:zero2w-img240. For png]]</p></li><li><p>After clicking on the opening methodsample code, please refer to the method of opening corresponding instruction document will automatically open. You can read the power button in Linux5instructions carefully.4</p><p>[[File:zero2w-img241.'''png]]</p></li><li><p>Use the Then click '''rebootConfigure Project''' command to restart the Linux system in the development board</p><p>orangepi@orangepi[[File:~$ '''sudo''' '''reboot'''zero2w-img242.png]]</p></li><li><p>Then click the green triangle in the lower left corner to compile and run the sample code</olp> <span id="linuxp>[[File:zero2w-sdkorangepi-build-usage-instructions"img243.png]]</p></spanli= '''Linux SDK——orangepi-build usage instructions''' = <span id="compilation-system-requirements"li></spanp>== Compilation system requirements == The Linux SDKAfter waiting for a period of time, '''orangepi-build''', only supports running on X64 computers with '''Ubuntu 22.04''' 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 interface shown in the Ubuntu version installed on the computer is as follows. If the Release field does not display '''22.04'''figure below will pop up, it which means that the Ubuntu version currently used does not meet the requirements. Please change the system before performing the following operationsQT can compile and run normally.</p> test@test<p>[[File:~$ '''lsb_release zero2w-a''' No LSB modules are availableimg244.png]]</p></li><li><p>References</p>Distributor ID{| class="wikitable" style="width: Ubuntu800px;" |-| Description<p>[https: Ubuntu 22//wiki.04 LTS Release: qt.io/Install_Qt_5_on_Ubuntu '''22https://wiki.04qt.io/Install_Qt_5_on_Ubuntu''']</p> Codename<p>[https: //download.qt.io/archive/qtcreator '''jammyhttps://download.qt.io/archive/qtcreator''']</p> If the computer is installed with a Windows system and does not have Ubuntu 22<p>[https://download.qt.04 installed on it, you can consider usingio/archive/qt '''VirtualBoxhttps://download.qt.io/archive/qt''' or '''VMware''' to install an Ubuntu 22.04 virtual machine in the Windows system. But please note, do not compile orangepi-build on the WSL virtual machine, because orangepi-build has not been tested in the WSL virtual machine, so there is no guarantee that orangepi-build can be used normally in WSL. In addition, please do not compile the Linux system on the development board. Use orangepi-build. The installation image download address of Ubuntu 22.04 amd64 version is:]</p>|}</li></ol>
[https://repo.huaweicloud.com/ubuntu-releases/21.04/ubuntu-21.04<span id="ros-desktopinstallation-amd64.iso '''https:method"><//mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/22.04/ubuntu-22.04-desktop-amd64.iso''']span>
After installing Ubuntu 22.04 on your computer or virtual machine, please first set the software source of Ubuntu 22.04 to Tsinghua source (or other domestic sources that you think is fast), otherwise it is easy to make errors due to network reasons when installing the software later. The steps to replace Tsinghua Source are as follows:== ROS installation method ==
<ol stylespan id="listhow-styleto-install-ros-1-type: lowernoetic-alpha;on-ubuntu20.04"><li/span>For the method of replacing Tsinghua Source, please refer === How to the instructions install ROS 1 Noetic on this pageUbuntu20.</li></ol>04 ===
[https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/ # The currently active version of ROS 1 is as follows, the recommended version is '''https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/Noetic Ninjemys''']
<ol start="2" style="list-style-type: lower:[[File:zero2w-alpha;"><li>Note that the Ubuntu version needs to be switched to 22.04img245.</li></ol>png]]
::[[File:zero2w-img271img246.png]]
<ol start::{| class="3wikitable" style="list-style-typewidth: lower-alpha800px;"><li>The contents of the |-| [http://docs.ros.org/ '''http:/etc/apt/sourcesdocs.ros.listorg''' file that need to be replaced are:</li></ol>]
test@test:~$ '''sudo mv https:/etc/apt/sourceswiki.ros.list cat /etc/aptorg/sources.list.bakDistributions'''|}
test<ol start="2" style="list-style-type: decimal;"><li><p>The link to the official installation documentation of ROS 1 '''Noetic Ninjemys''' is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>[http://wiki.ros.org/noetic/Installation/Ubuntu '''http://wiki.ros.org/noetic/Installation/Ubuntu''']</p>|}</li><li><p>In the official installation documentation of ROS '''Noetic Ninjemys''', Ubuntu recommends using Ubuntu20.04, so please ensure that the system used by the development board is '''<span style="color:#FF0000">Ubuntu20.04 desktop system</span>'''.</p>{| class="wikitable" style="width:800px;" |-| <p>[http://wiki.ros.org/noetic/Installation '''http://wiki.ros.org/noetic/Installation''']</p><p>[[File:zero2w-img247.png]]</p>|}</li><li><p>Then use the script below to install ros1</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@testorangepi:~$ '''sudo vim install_ros.sh ros1'''</etcp>|}</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.</aptp></sourcesli>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''<span style="color:#FF0000">Note that when running the following command, you need to ensure that the development board can access github normally, otherwise an error will be reported due to network problems.list</span>'''
# The source code image is commented by default to improve apt update speed. You can uncomment it yourself if necessary.
deb https:'''The install_ros.sh script will try to modify /etc/mirrorshosts and automatically run the following commands.tunaHowever, this method cannot guarantee that github can be accessed normally every time.tsinghuaIf install_ros.edush prompts the following error after installing ros1, please find other ways to allow the linux system of the development board to access github normally, and then manually run the following Order.cn/ubuntu/ jammy main restricted universe multiverse'''
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb '''https://mirrorsraw.tunagithubusercontent.tsinghua.edu.cncom/ros/rosdistro/master/ubunturosdep/ jammyosx-updates main restricted universe multiversehomebrew.yaml'''
# deb-src '''Hit https://mirrorsraw.tunagithubusercontent.tsinghua.edu.cncom/ros/rosdistro/master/ubunturosdep/ jammy-updates main restricted universe multiversebase.yaml'''
deb https'''<span style="color:#FF0000">ERROR: error loading sources list:<//mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiversespan>'''
::'''<span style="color:# debFF0000">The read operation timed out</span>'''</big>|}{| class="wikitable" style="width:800px;" |-src https| orangepi@orangepi:~$ '''source /opt/mirrors.tuna.tsinghua.edu.cnros/ubuntunoetic/ jammy-backports main restricted universe multiversesetup.bash'''
deb httpsorangepi@orangepi://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse~$ '''sudo rosdep init'''
# deb-src https:Wrote /etc/ros/rosdep/mirrorssources.tunalist.tsinghua.edu.cnd/ubuntu/ jammy20-security main restricted universe multiversedefault.list
# Pre-release software source, not recommended to be enabledRecommended: please run
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse:rosdep update
<ol start="4" style="list-style-typeorangepi@orangepi: lower-alpha;"><li>After the replacement, you need to ~$ '''rosdep update the package information and ensure that no errors are reported.</li></ol>'''
test@test:~$ '''sudo apt-get update'''reading in sources list data from /etc/ros/rosdep/sources.list.d
<ol start="5" style="list-style-typeHit https: lower-alpha;"><li>'''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//raw.githubusercontent.'''<com/li><ros/ol>rosdistro/master/rosdep/osx-homebrew.yaml
<span id="obtain-the-source-code-of-linux-sdk"><Hit https:/span>== Obtain the source code of linux sdk ==/raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
<span id="download-orangepi-build-from-github"><Hit https:/span>=== Download orangepi-build from github ===/raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
Linux sdk refers to the orangepi-build set of codesHit https://raw. Orangepi-build is modified based on the armbian build compilation systemgithubusercontent. Multiple versions of Linux images can be compiled using orangepi-buildcom/ros/rosdistro/master/rosdep/ruby. Use the following command to download the orangepi-build code:yaml
test@testHit https:~$ '''sudo apt-get update'''//raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml
test@testQuery rosdistro index https:~$ '''sudo apt//raw.githubusercontent.com/ros/rosdistro/master/index-get install v4.yaml Skip end-y git'''of-life distro &quot;ardent&quot; Skip end-of-life distro &quot;bouncy&quot;
test@test:~$ '''git clone https://github.com/orangepiSkip end-xunlong/orangepiof-build.git -b next'''life distro &quot;crystal&quot;
'''Note that when using the H618 Soc development board, you need to download the source code of the next branch of orangepiSkip end-build. The above git clone command needs to specify the branch of the orangepi-build source code as next.'''life distro &quot;dashing&quot;
<div class="figure">Skip end-of-life distro &quot;eloquent&quot;
[[File:zero2w-img272.png]]Add distro &quot;foxy&quot;
</div>'''When downloading the orangepi-build code through the git clone command, you do not need to enter the user name and password of the github account (the same is true for downloading other codes in this manual). If after entering the git clone command, Ubuntu PC prompts you to enter the user name of the github account. The name and password are usually entered incorrectly in the address of the orangepi-build warehouse behind git clone. Please carefully check whether there are any errors in the spelling of the command, rather than thinking that we have forgotten to provide the username and password of the github account.'''Add distro &quot;galactic&quot;
The uSkip end-boot and linux kernel versions currently used by the H618 series development boards are as follows:of-life distro &quot;groovy&quot;
{| class="wikitable"|-| '''branch'''| '''u-boot Version'''| '''linux Kernel version'''|-| '''current'''| '''u-boot v2018.05'''| '''linux5.4'''|-| '''next'''| '''u-boot v2021.07'''| '''linux6.1'''|}Add distro &quot;humble&quot;
'''The branch mentioned here is not the same thing as the branch Skip end-of orangepi-build source code, please don't get confused. This branch is mainly used to distinguish different kernel source code versions.'''life distro &quot;hydro&quot;
'''We define the linux5.4 bsp kernel currently provided by Allwinner as the current branch. The latest linux6.1 LTS kernel is defined as the next branch.'''Skip end-of-life distro &quot;indigo&quot;
After downloading, the following files and folders will be included:Skip end-of-life distro &quot;jade&quot;
<ol style="listSkip end-styleof-type: lower-alphalife distro &quot;kinetic&quot;"><li><p>'''build.sh''': Compile startup script</p></li><li><p>'''external''': Contains configuration files needed to compile the image, specific scripts, and source code of some programs, etc.</p></li><li><p>'''LICENSE''': GPL 2 license file</p></li><li><p>'''README.md''': orangepi-build documentation</p></li><li><p>'''scripts''': Common script for compiling linux images</p></li></ol>
test@test:~/orangepiSkip end-build$ '''ls'''of-life distro &quot;lunar&quot;
'''build.sh external LICENSE README.md scripts'''Add distro &quot;melodic&quot;
'''If you downloaded the orangepi-build code from github, after downloading, you may find that orangepi-build does not contain the source code of u-boot and linux kernel, and there is no cross-compilation tool required to compile u-boot and linux kernel. chain, this is normal, because these things are stored in other separate github repositories or some servers (their addresses will be detailed below). Orangepi-build will specify the addresses of u-boot, Linux kernel and cross-compilation tool chain in the script and configuration file. When running orangepi-build, when it finds that these things are not available locally, it will automatically download them from the corresponding places.'''Add distro &quot;noetic&quot;
<span id="download-the-cross-compilation-tool-chain"></span>=== Download the cross-compilation tool chain ===Add distro &quot;rolling&quot;
When updated cache in /home/orangepi/.ros/rosdep/sources.cache|}</ol><ol start="6" style="list-build is run for style-type: decimal;"><li><p>Then open a command line terminal window on the first time, it will automatically download the cross-compilation '''toolchaindesktop''' , and put it in then use the '''toolchainstest_ros.sh''' folderscript to start a small turtle routine to test whether ROS can be used normally. Every time you run </p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi-build:~$ '''test_ros.sh'''</p>|}</li><li><p>After running the '''s buildtest_ros.sh ''' script, it will check whether the cross-compilation toolchain a small turtle as shown in toolchains exists. If If it does not exist, the download picture below will be restartedpop up. If it exists, it will be used directly without repeated downloading</p><p>[[File:zero2w-img248.png]]</p></li><li><p>Then please keep the terminal window you just opened at the top</p></li>
<div class="figure">
[[File:zero2w-img273img249.png]]
</div></ol>The mirror URL of <ol start="9" style="list-style-type: decimal;"><li><p>At this time, press the direction keys on the cross-compilation tool chain in China is keyboard to control the open source software mirror site of Tsinghua Universitylittle turtle to move up, down, left, and right.</p><p>[[File:zero2w-img250.png]]</p></li></ol>
[https://mirrors.tuna.tsinghua.edu.cn/armbian<span id="how-to-install-ros-2-galactic-on-releases/_toolchain/ '''https://mirrorsubuntu20.tuna.tsinghua.edu.cn/armbian-releases/_toolchain04"></''']span>
After toolchains is downloaded, it will contain multiple versions of cross-compilation t'''toolchain''':=== How to install ROS 2 Galactic on Ubuntu20.04 ===
test<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]]</p><p>[[File:zero2w-img252.png]]</p>{| class="wikitable" style="width: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="width:800px;" |-| <p>'''docs.ros.org/en/galactic/Installation.html'''</p><p>'''http://docs.ros.org/en/galactic/Installation/Ubuntu-Install-Debians.html'''</p>|}</li><li><p>In the 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 is the '''<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 '''install_ros.sh''' script to install ros2</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@testorangepi:~/orangepi-build$ '''ls toolchainsinstall_ros.sh ros2'''</p>|}</li><li><p>The '''install_ros.sh''' script will automatically run the '''ros2 -h'''command after installing ros2. If you can see the following print, it means that the ros2 installation is complete.</p>{| class="wikitable" style="width:800px;" |-| <p>usage: ros2 [-h] Call `ros2 &lt;command&gt; -h` for more detailed usage. ...</p>
gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu gcc-linaro-4.9.4-2017.01-x86_64_aarch64-linux-gnu gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabi
gcc<p>ros2 is an extensible command-arm-11.line tool for ROS 2-2022.02-x86_64-arm-none-linux-gnueabihf gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabi gcc-linaro-aarch64-none-elf-4.8-2013.11_linux</p>
gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf gcc-linaro-arm-linux-gnueabihf-4.8-2014.04_linux
gcc<p>optional arguments:</p>:<p>-armh, -9.2-2019.12-x86_64-arm-none-linux-gnueabihf gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu gcc-linaro-arm-none-eabi-4.8-2014.04_linuxhelp show this help message and exit</p>
The cross-compilation tool chain used to compile the H618 Linux kernel source code is:
<ol style="listp>Commands:</p>:<p>action Various action related sub-commands</p>:<p>bag Various rosbag related sub-commands</p>:<p>component Various component related sub-commands</p>:<p>daemon Various daemon related sub-commands</p>:<p>doctor Check ROS setup and other potential issues</p>:<p>interface Show information about ROS interfaces</p>:<p>launch Run a launch file</p>:<p>lifecycle Various lifecycle related sub-stylecommands</p>:<p>multicast Various multicast related sub-typecommands</p>: lower<p>node Various node related sub-alpha;"commands</p>:<lip>linux5.4param Various param related sub-commands</lip>:<p>pkg Various package related sub-commands</p>:<p>run Run a package specific executable</p>:<p>security Various security related sub-commands</p>:<p>service Various service related sub-commands</p>:<p>topic Various topic related sub-commands</p>:<p>wtf Use `wtf` as alias to `doctor`</olp>
'''gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu'''
:<ol startp>Call `ros2 &lt;command&gt; -h` for more detailed usage.</p>|}</li><li><p>Then you can use the '''test_ros.sh''' script to test whether ROS 2 is installed successfully. If you can see the following print, it means ROS 2 can run normally.</p>{| class="2wikitable" style="list-style-typewidth: lower-alpha800px;"|-| <p>orangepi@orangepi:~$ '''test_ros.sh'''</p><lip>linux6[INFO] [1671174101.200091527] [talker]: Publishing: 'Hello World: 1'</lip><p>[INFO] [1671174101.235661048] [listener]: I heard: [Hello World: 1]</olp<p>[INFO] [1671174102.199572327] [talker]: Publishing: 'Hello World: 2''gcc-arm-11</p><p>[INFO] [1671174102.204196299] [listener]: I heard: [Hello World: 2-2022]</p><p>[INFO] [1671174103.02-x86_64-aarch64-none-linux-gnu'199580322] [talker]: Publishing: 'Hello World: 3'</p><p>[INFO] [1671174103.204019965] [listener]: I heard: [Hello World: 3]</p>The cross-compilation tool chain used to compile the H618 u-boot source code is:|}</li><ol li><p>Run the following command to open rviz2</p>{| class="wikitable" style="list-style-typewidth: lower-alpha800px;"|-| <p>orangepi@orangepi:~$ '''source /opt/ros/galactic/setup.bash'''</p><p>orangepi@orangepi:~$ '''ros2 run rviz2 rviz2'''</p>|}<lip>v2018[[File:zero2w-img253.05png]]</p></li><li><p>For how to use ROS, please refer to the documentation of ROS 2.</olp>{| class="wikitable" style="width:800px;" |-| <p>[http://docs.ros.org/en/galactic/Tutorials.html '''gcc-linaro-7http://docs.4ros.1-2019org/en/galactic/Tutorials.02-x86_64_arm-linux-gnueabihtml''']</p>|}</li></ol>
<ol startspan id="how-to-install-ros-2" style="list-stylehumble-type: loweron-alpha;ubuntu22.04"><li>v2021.07</li></olspan>
'''gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu''' <span id="orangepi-build-complete-directory-structure-description"></span>=== orangepi-build complete directory structure description How to install ROS 2 Humble on Ubuntu22.04 ===
<ol style="list-style-type: decimal;">
<li><p>After downloading, the orangepi-build warehouse does not contain Use the source code of the linux kernel, u-boot and cross-compilation tool chaininstall_ros. The source code of the linux kernel and u-boot is stored in an independent git warehousesh script to '''install_ros.sh'''</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"|-| <p>orangepi@orangepi:~$ '''install_ros.sh ros2'''</p>|}</li><li><p>The git warehouse where '''install_ros.sh''' script will automatically run the linux kernel source code is stored is as follows'''ros2 -h''' command after installing ros2. Please note If you can see the following print, it means that the branch of the linux-orangepi warehouse ros2 installation is switched tocomplete.</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li>Linux5.4</li></ol>|-</li></ol>| </lip>usage: ros2 [-h] Call `ros2 &lt;command&gt; -h` for more detailed usage. ...</olp>
https://github.com/orangepi-xunlong/linux-orangepi/tree/'''orange-pi-5.4-sun50iw9'''
<ol start="p>ros2 is an extensible command-line tool for ROS 2" style="list-style-type: lower-alpha;"><li>Linux6.1</li></olp>
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 tooptional arguments:</p>:<ol style="listp>-styleh, -type: lower-alpha;"><li>v2018.05help show this help message and exit</li></ol></li></olp>
https://github.com/orangepi-xunlong/u-boot-orangepi/tree/'''v2018.05-h618'''
<ol start="2" style="listp>Commands:</p>:<p>action Various action related sub-commands</p>:<p>bag Various rosbag related sub-commands</p>:<p>component Various component related sub-commands</p>:<p>daemon Various daemon related sub-commands</p>:<p>doctor Check ROS setup and other potential issues</p>:<p>interface Show information about ROS interfaces</p>:<p>launch Run a launch file</p>:<p>lifecycle Various lifecycle related sub-stylecommands</p>:<p>multicast Various multicast related sub-typecommands</p>: lower<p>node Various node related sub-alpha;"commands</p>:<lip>v2021.07param Various param related sub-commands</lip>:<p>pkg Various package related sub-commands</p>:<p>run Run a package specific executable</p>:<p>security Various security related sub-commands</p>:<p>service Various service related sub-commands</p>:<p>topic Various topic related sub-commands</p>:<p>wtf Use `wtf` as alias to `doctor`</olp>
https://github.com/orangepi-xunlong/u-boot-orangepi/tree/'''v2021.07-sunxi'''
:<ol start="2" style="listp>Call `ros2 &lt;command&gt; -style-type: decimal;"h` for more detailed usage.</p>|}</li><li><p>When orangepi-build Then you can use the '''test_ros.sh''' script to test whether ROS 2 is run for successfully installed. If you can see the first timefollowing print, it will download the cross-compilation tool chain, u-boot and linux kernel source codemeans ROS 2 can run normally. After successfully compiling a linux image, the files and folders that can be seen in orangepi-build are:</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li>|-| <p>orangepi@orangepi:~$ '''buildtest_ros.sh''': Compile startup script</p></li><li><p>[INFO] [1671174101.200091527] [talker]: Publishing: 'Hello World: 1''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><p>[INFO] [1671174101.235661048] [listener]: I heard: [Hello World: 1]</lip><li><p>[INFO] [1671174102.199572327] [talker]: Publishing: 'Hello World: 2''kernel''': Store the source code of the linux kernel</p><p>[INFO] [1671174102.204196299] [listener]: I heard: [Hello World: 2]</lip><li><p>[INFO] [1671174103.199580322] [talker]: Publishing: 'Hello World: 3''LICENSE''': GPL 2 license file</p></li><li><p>'''README[INFO] [1671174103.md'''204019965] [listener]: I heard: [Hello World: orangepi-build documentation3]</p>|}</li><li><p>Run the following command to open rviz2</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''outputsource /opt/ros/humble/setup.bash''': Store compiled u-boot, linux and other deb packages, compilation logs, and compiled images and other files</p></li><li><p>orangepi@orangepi:~$ '''scriptsros2 run rviz2 rviz2''': Common script for compiling linux images</p></li><li><p>'''toolchains'''[[File: Store crosszero2w-compilation tool chainimg254.png]]</p>|}</li><li><p>Reference documentation</p>{| class="wikitable" style="width:800px;" |-| <p>'''u-boothttp://docs.ros.org/en/humble/index.html''': Store the source code of u-boot</p></li><li><p>[http://docs.ros.org/en/galactic/Tutorials.html '''userpatcheshttp://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html''': Store the configuration files needed to compile the script]</p></li></ol>|}
</li></ol>
test@test:~<span id="how-to-install-kernel-header-files"></orangepi-build$ '''ls'''span>
'''build.sh external == How to install kernel LICENSE output README.md scripts toolchains u-boot userpatches'''header files ==
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Debian11 system with <span idstyle="compile-u-bootcolor:#FF0000">Linux6.1</span> kernel will report GCC error when compiling kernel module. So if you want to compile the kernel module, please use Debian12 or Ubuntu22.04.'''</big>== Compile u-boot ==|}
# Run <ol style="list-style-type: decimal;"><li><p>The Linux image released by OPi comes with the build.sh scriptdeb package of the kernel header file by default, remember to add sudo permissionsand the storage location is '''/opt/'''</p>{| class="wikitable" style="width:800px;" |-| test<p>orangepi@testorangepi:~/orangepi-build$ '''sudo .ls /opt/build.shlinux-headers*'''</p><p>/opt/linux-headers-xxx-sun50iw9_x.x.x_arm64.deb</p>|}</li><li><p>Use the following command to install the deb package of the kernel header file<ol start/p>{| class="2wikitable" style="list-style-typewidth: decimal800px;">|-| <lip>Select orangepi@orangepi:~$ '''Usudo dpkg -boot packagei /opt/linux-headers*.deb''' and press Enter</p>|}</li><li><p>After installation, you can see the folder where the kernel header file is located under '''/usr/src'''.</olp<div {| class="figurewikitable">style="width:800px;" |-| [[File<p>orangepi@orangepi:zero2w~$ '''ls /usr/src'''</p><p>linux-img274headers-x.png]]x.x</p>|}</divli><ol startli><p>Then you can compile the source code of the hello kernel module that comes with the Linux image. The source code of the hello module is in '''/usr/src/hello'''. After entering this directory, then use the make command to compile.</p>{| class="3wikitable" style="list-style-typewidth: decimal800px;"|-| <p>orangepi@orangepi:~$ '''cd /usr/src/hello/'''</p><lip>Then select the model of the development boardorangepi@orangepi:/usr/src/hello$ '''sudo make'''</lip><p>make -C /lib/modules/5.4.125/build M=/usr/src/hello modules</olp<p>make[[File1]:zero2wEntering directory '/usr/src/linux-img275headers-5.png4.125'</p>:<p>CC [M]/usr/src/hello/hello.o</p>:<p>Building modules, stage 2.</p>:<p>MODPOST 1 modules</p>:<p>CC [M]/usr/src/hello/hello.mod.o</p>:<p>LD [M] /usr/src/hello/hello.ko</p><ol start="4" style="listp>make[1]: Leaving directory '/usr/src/linux-styleheaders-type: decimal;"5.4.125'</p>|}</li><li><p>Then select After compilation, the branch type of u-boot'''hello.ko''' kernel module will be generated</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"|-| <p>orangepi@orangepi:/usr/src/hello$ '''ls *.ko'''</p><p>hello.ko</p>|}</li><li><p>The current branch will compile Use the u-boot v2018.05 version code that needs '''insmod''' command to be used by insert the linux5'''hello.4 imageko''' kernel module into the kernel</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:/usr/src/hello$ '''sudo insmod hello.ko'''</p>|}</li><li><p>The next branch will compile Then use the '''demsg''' command to view the output of the u-boot v2021'''hello.ko''' kernel module.07 version code If you can see the following output, it means that needs to be used by the linux6'''hello.1 imageko''' kernel module is loaded correctly.</p>{| class="wikitable" style="width:800px;" |-| <p>[[Fileorangepi@orangepi:zero2w-img276.png]]/usr/src/hello$ '''dmesg | grep &quot;Hello&quot;'''</p></lip>[ 2871.893988] '''Hello Orange Pi -- init'''</olp>|}
</li>
<li><p>If you select Use the next branch, you will also be prompted '''rmmod''' command to select uninstall the memory size, and you do not need to select the current branch'''hello.ko''' kernel module</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:/usr/src/hello$ '''sudo rmmod hello'''</p><p>orangepi@orangepi:/usr/src/hello$ '''dmesg | grep &quot;Hello&quot;'''</p><p>[ 2871.893988] Hello Orange Pi -- init</p><p>[ 3173.800892] '''Hello Orange Pi -- exit'''</p>|}</li></ol>
<blockquotespan id="testing-of-some-programming-languages-supported-by-linux-system"></span>a. If the development board you purchased has a memory size of 1.5GB, please select the first option.
b. If the development board you purchased has 1GB or 2GB or 4GB memory size, please choose the second option.</blockquote>[[File:zero2w-img277.png]]== Testing of some programming languages supported by Linux system ==
<ol startspan id="6debian-bullseye-system" ></span>=== Debian Bullseye system === <ol style="list-style-type: decimal;"><li><p>Then it will start to Debian Bullseye is installed with the gcc compilation tool chain by default, which can directly compile u-boot. Some C language programs in the Linux system of the information prompted when compiling the next branch is as follows:development board.</p>
<ol style="list-style-type: lower-alpha;">
<li>Version <p>The version of ua.gcc is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''gcc --version'''</p><p>gcc (Debian 10.2.1-boot 6) 10.2.1 20210110</p><p>Copyright (C) 2020 Free Software Foundation, Inc.</p><p>This is free software; see the source codefor 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</olp>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.c'''</lip><p>#include &lt;stdio.h&gt;</olp>
[ o.k. ] Compiling u-boot [ '''v2021.07''' ]
<ol start="2" style="list-style-type: lower-alpha;"p>int main(void)</p><lip>Version of the cross-compilation tool chain{</lip>:<p>printf(&quot;Hello World!\n&quot;);</olp>
[ o.k. ] Compiler version [ '''aarch64-linux-gnu-gcc 11''' ]
:<p>return 0;</p><p>}</p>|}<ol start/li><li><p>Then compile and run '''hello_world.c'''</p>{| class="3wikitable" style="list-style-typewidth: lower-alpha800px;">|-| <lip>Path to the compiled uorangepi@orangepi:~$ '''gcc -boot deb packageo hello_world hello_world.c'''</lip></olp[ oorangepi@orangepi:~$ '''.k. ] Target directory [ /hello_world'''orangepi-build</p><p>Hello World!</outputp>|}</debsli></u-boot''' ]ol></li><li><p>Debian Bullseye has Python3 installed by default</p><ol start="4" style="list-style-type: lower-alpha;"><li><p>The package name specific version of the compiled uPython is as follows</p>{| class="wikitable" style="width:800px;" |-boot deb package| <p>orangepi@orangepi:~$ '''python3'''</lip><p>'''Python 3.9.2''' (default, Feb 28 2021, 17:03:44)</olp<p>[ oGCC 10.k2. 1 20210110] File name [ on linux</p><p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</p><p>&gt;&gt;&gt;</p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Use the Ctrl+D shortcut key to exit python'linux-u-boot-next-orangepizero2w_xs interactive mode.x.x_arm64.deb''' ]</p></big>|}</li><ol startli><p>Write the '''hello_world.py''' program in Python language</p>{| class="5wikitable" style="list-style-typewidth: lower-alpha800px;"|-| <p>orangepi@orangepi:~$ '''vim hello_world.py'''</p><p>print('Hello World!')</p>|}</li>Compilation time</li><p>The result of running '''hello_world.py''' is as follows</olp>{| class="wikitable" style="width:800px;" |-[ o.k. ] Runtime [ | <p>orangepi@orangepi:~$ '''1 minpython3 hello_world.py''' ]</p><p>Hello World!</p>|}</li></ol></li><li><p>Debian Bullseye does not install Java compilation tools and operating environment by default.</p><ol start="6" style="list-style-type: lower-alpha;"><li>Repeat <p>You can use the following command to compile u-bootinstall openjdk. Use the following command without selecting through the graphical interface. You can start compiling uThe latest version in Debian Bullseye is openjdk-boot directly.17</lip>{| class="wikitable" style="width:800px;" |-| </olp[ o.k. ] Repeat Build Options [ orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''</p>|}</li><li><p>After installation, you can check the Java version.</build.sh BOARDp>{| class=orangepizero2w BRANCH"wikitable" style=next BUILD_OPT=u"width:800px;" |-| <p>orangepi@orangepi:~$ '''java --bootversion''' ]</p>|}<ol start/li><li><p>Write the Java version of '''hello_world.java'''</p>{| class="7wikitable" style="listwidth:800px;" |-style-type| <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>:: decimal<p>System.out.println(&quot;"Hello World!&quot;);</p>:<p>}</p><p>}</p>|}</li>View the compiled u-boot deb package</li><p>Then compile and run '''hello_world.java'''</olp>{| class="wikitable" style="width:800px;" |-test| <p>orangepi@testorangepi:~$ '''javac hello_world.java'''</p><p>orangepi-build@orangepi:~$ '''ls outputjava hello_world'''</p><p>Hello World!</p>|}</debsli></u-bootol></li></'''ol>
'''linux<span id="debian-ubookworm-boot-next-orangepizero2w_x.x.x_arm64.deb'''system"></span>
<ol start="8" style="list-style-type: decimal;"><li>When the orangepi-bulid compilation = Debian Bookworm system compiles the u-boot source code, it will first synchronize the u-boot source code with the u-boot source code of the github server. Therefore, if you want to modify the u-boot source code, you first need to turn off the download and update function of the source code. ('''You need to completely compile u-boot before you can turn off this function, otherwise it will prompt that the source code of u-boot cannot be found'''), otherwise the modifications will be restored. The method is as follows:</li></ol>===
<blockquoteol style="list-style-type: decimal;"><li><p>Set Debian Bookworm is installed with the IGNORE_UPDATES variable gcc compilation tool chain by default, which can directly compile C language programs in uthe Linux system of the development board.</p><ol style="list-style-type: lower-alpha;"><li><p>The version of a.gcc is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''userpatches/configgcc --default.confversion''' to &quot</p><p>gcc (Debian 12.2.0-14) 12.2.0</p><p>Copyright (C) 2022 Free Software Foundation, Inc.</p><p>This is free software;yes&quotsee the source for copying conditions. There is NO</p><p>warranty;not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>|}</blockquoteli>test<li><p>Write the '''hello_world.c''' program in C language</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@testorangepi:~/orangepi-build$ '''vim userpatches/config-defaulthello_world.confc'''</p><p>#include &lt;stdio.h&gt;</p>
......
IGNORE_UPDATES=<p>int main(void)</p><p>{</p>:<p>printf(&quot;'''yes'''Hello World!\n&quot;);</p>
......
:<p>return 0;<ol start/p><p>}</p>|}</li><li><p>Then compile and run '''hello_world.c'''</p>{| class="9wikitable" style="listwidth:800px;" |-style| <p>orangepi@orangepi:~$ '''gcc -typeo hello_world hello_world.c'''</p><p>orangepi@orangepi: decimal;"~$ '''./hello_world'''</p><p>Hello World!</p>|}</li></ol></li><li><p>When debugging u-boot code, you can use the following method to update u-boot in the linux image for testingDebian Bookworm has Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li>First upload the compiled deb package <p>The specific version of uPython is as follows</p>{| class="wikitable" style="width:800px;" |-boot to the Linux system of the development board| <p>orangepi@orangepi:~$ '''python3'''</p><p>Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux</lip><p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</olp></lip>&gt;&gt;&gt;</olp>|}test@test{| class="wikitable" style="background-color:#ffffdc;width:~/orangepi800px;" |-build$ | <big><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''cd output</debsp></u-bootbig>|}</li><li><p>Write the '''hello_world.py'''program in Python language</p>{| class="wikitable" style="width:800px;" |-| test<p>orangepi@testorangepi:~/orangepi_build/output/debs/u-boot$ '''scp \vim hello_world.py'''</p><p>print('Hello World!')</p>|}</li><li><p>The result of running '''linux-u-boot-next-orangepizero2w_xhello_world.x.x_arm64.deb [mailtopy''' is as follows</p>{| class="wikitable" style="width:root800px;" |-| <p>orangepi@192.168.1.xxxorangepi:/root root@192.168~$ '''python3 hello_world.1.xxx:/root]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 start="2" style="list-style-type: lower-alpha;"><li>Install <p>You can use the new ufollowing command to install openjdk. The latest version in Debian Bookworm is openjdk-boot deb package just uploaded17</lip>{| class="wikitable" style="width:800px;" |-| </olp> orangepi@orangepi:~$ '''sudo dpkg apt install -i''' '''linux-uy openjdk-boot17-next-orangepizero2w_x.x.x_arm64.debjdk'''</p>|}<ol start/li><li><p>After installation, you can check the Java version.</p>{| class="3wikitable" style="list-style-typewidth: lower-alpha800px;">|-| <lip>Then run the nandorangepi@orangepi:~$ '''java -sata-install scriptversion'''</p>|}</li><li><p>Write the Java version of '''hello_world.java'''</olp>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo nand-sata-installvim 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(&quot;Hello World!&quot;);</p>:<p>}<ol start/p><p>}</p>|}</li><li><p>Then compile and run '''hello_world.java'''</p>{| class="4wikitable" style="list-style-typewidth: lower-alpha800px;"|-| <p>orangepi@orangepi:~$ '''javac hello_world.java'''</p><lip>Then select orangepi@orangepi:~$ '''5 Install/Update the bootloader on SD/eMMCjava hello_world'''</p><p>Hello World!</p>|}</li></ol> [[File:zero2w-img278.png]]</li></ol>
<ol startspan id="5" style="listubuntu-stylefocal-type: lower-alpha;system"><li>After pressing the Enter key, a Warning will pop up first.</li></olspan>
[[File:zero2w-img279.png]] <ol start="6" style="list-style-type: lower-alpha;"><li>Press the Enter key again to start updating u-boot. After the update is completed, the following information will be displayed.</li></ol> [[File:zero2w-img280.png]] <ol start="7" styleUbuntu Focal system ="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> <span id="compile-the-linux-kernel"></span>== Compile the linux kernel == # Run the '''build.sh''' script, remember to add sudo permissions test@test:~/orangepi-build$ '''sudo ./build.sh''' <ol start="2" style="list-style-type: decimal;"><li>Select '''Kernel package''' and press Enter</li></ol> <div class="figure"> [[File:zero2w-img281.png]] </div><ol start="3" style="list-style-type: decimal;"><li>Then you will be prompted whether you need to display the kernel configuration interface. If you do not need to modify the kernel configuration, select the first one. If you need to modify the kernel configuration, select the second one.</li></ol> [[File:zero2w-img282.png]] <ol start="4" style="list-style-type: decimal;"><li>Then select the model of the development board</li></ol> [[File:zero2w-img275.png]] <ol start="5" style="list-style-type: decimal;"><li>Then select the branch type of the kernel source code</li></ol> <blockquote>a. The current branch will compile the linux5.4 kernel source code b. The next branch will compile the linux6.1 kernel source code</blockquote>[[File:zero2w-img276.png]] <ol start="6" style="list-style-type: decimal;"><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></ol> [[File:zero2w-img283.png]]
<ol style="list-style-type: decimal;">
<li><p>Ubuntu Focal is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.</p>
<ol style="list-style-type: lower-alpha;">
<li>If you do <p>The version of a.gcc is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''gcc --version'''</p><p>gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0</p><p>Copyright (C) 2019 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not need to modify even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>|}</li><li><p>Write the kernel configuration options, when running the build'''hello_world.sh script, pass c'''KERNEL_CONFIGUREprogram in C language</p>{| class=no"wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ ''' to temporarily block the pop-up of the kernel configuration interfacevim hello_world.c'''</lip><p>#include &lt;stdio.h&gt;</olp>
test@test:~/orangepi-build$ '''sudo ./build.sh KERNEL_CONFIGURE=no'''
<ol start="2" style="list-style-type: lower-alpha;"><li><p>b. You can also set '''KERNEL_CONFIGURE=no''' in the orangepi-build/userpatches/config-default.confconfiguration file to permanently disable this function.int main(void)</p></li><li><p>If the following error is prompted when compiling the kernel, it is because the Ubuntu PC terminal interface is too small, causing the make menuconfig interface to be unable to be displayed. Please increase the Ubuntu PC terminal to the maximum size, and then rerun the build.sh script.{</p>:</lip>printf(&quot;Hello World!\n&quot;);</olp>
[[File:zero2w-img284.png]]
:<p>return 0;<ol start/p><p>}</p>|}</li><li><p>Then compile and run '''hello_world.c'''</p>{| class="7wikitable" style="listwidth:800px;" |-style| <p>orangepi@orangepi:~$ '''gcc -typeo hello_world hello_world.c'''</p><p>orangepi@orangepi: decimal;"~$ '''./hello_world'''</p><p>Hello World!</p>|}</li></ol></li><li><p>Part of the information prompted when compiling the next branch kernel source code is explained as follows:Ubuntu Focal has Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li>Version <p>The specific version of Python3 is as follows</p>{| class="wikitable" style="width:800px;" |-| <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 &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</p><p>&gt;&gt;&gt;</p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Use the linux kernel source codeCtrl+D shortcut key to exit python's interactive mode.'''</p></big>|}</li><li><p>Write the '''hello_world.py''' program in Python language</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.py'''</p><p>print('Hello World!')</p>|}</li><li><p>The result of running '''hello_world.py''' is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 hello_world.py'''</p><p>Hello World!</olp>|}
</li></ol>
 [ o.k. ] Compiling current kernel [ '''6.1.31''' ] <ol start="2" style="list-style-type: lower-alpha;"><li>The version of the cross-compilation tool chain used</li></ol> [ o.k. ] Compiler version [ '''aarch64-linux-gnu-gcc 11''' ] <ol start="3" 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/linux-6.1-sun50iw9-next.config''' ] <ol start="4" style="list-style-type: lower-alpha;"p><li>The path to the kernel-related deb package generated by Ubuntu Focal does not have Java compilation</li></ol> [ o.k. ] Target directory [ '''output/debs/''' ] <ol start="5" style="list-style-type: lower-alpha;"><li>The package name of the kernel image deb package generated tools and running environment installed by compilation</li></ol> [ o.k. ] File name [ '''linux-image-next-sun50iw9_x.x.x_arm64.deb''' ] <ol start="6" style="list-style-type: lower-alpha;"><li>Compilation time</li></ol> [ o.k. ] Runtime [ '''10 min''' ] <ol start="7" style="list-style-type: lower-alpha;"><li>Finally, the compilation command to repeatedly compile the last selected kernel will be displayeddefault. Use the following command without selecting through the graphical interface, and you can directly start compiling the kernel source code.</li></ol> [ o.k. ] Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=kernel KERNEL_CONFIGURE=no''' ] <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>You can use the following command to install openjdk-17</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''linuxsudo apt install -dtby openjdk-next17-sun50iw9_x.x.x_arm64.debjdk''' Contains dtb files used by the kernel</p>|}</li><li><p>After installation, you can check the Java version.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''linuxjava --headersversion'''</p><p>openjdk 17.0.2 2022-next01-sun50iw9_x18</p><p>OpenJDK Runtime Environment (build 17.x0.x_arm642+8-Ubuntu-120.04)</p><p>OpenJDK 64-Bit Server VM (build 17.0.2+8-Ubuntu-120.deb04, mixed mode, sharing)</p>|}</li><li><p>Write the Java version of '''hello_world.java''' Contains kernel header files</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(&quot;Hello World!&quot;);</p>:<p>}</p><p>}</p>|}</li><li><p>Then compile and run '''hello_world.java''linux'</p>{| class="wikitable" style="width:800px;" |-image-next-sun50iw9_x| <p>orangepi@orangepi:~$ '''javac hello_world.x.x_arm64.debjava'''</p><p>orangepi@orangepi:~$ '''java hello_world''' Contains kernel images and kernel modules</p><p>Hello World!</p>|}</li></ol>
</li></ol>
test@test:~/orangepi<span id="ubuntu-jammy-build$ '''ls output/debssystem"></linux-*'''span>
output/debs/linux-dtb-next-sun50iw9_x.x.x_arm64.deb=== Ubuntu Jammy system ===
output/debs/linux-headers-next-sun50iw9_x.x.x_arm64.deb output/debs/linux-image-next-sun50iw9_x.x.x_arm64.deb <ol start="9" 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:</lip></ol> <blockquote>Set Ubuntu Jammy is installed with the IGNORE_UPDATES variable in '''userpatches/config-gcc compilation tool chain by default.conf''' to &quot;yes&quot;</blockquote>test@test:~/orangepi-build$ '''vim userpatches/config-default.conf''' IGNORE_UPDATES=&quot;'''yes'''&quot; <ol start="10" style="list-style-type: decimal;"><li><p>If the kernel is modified, you which can use directly compile C language programs in the following method to update the kernel and kernel module Linux system 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 <p>The version of a.gcc is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''gcc --version'''</p><p>gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) '''11.3.0'''</p><p>Copyright (C) 2021 Free Software Foundation, Inc.</p><p>This is free software; see the development boardsource for copying conditions. There is NO</lip><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</olp>|}</li><li><p>Write the '''hello_world.c''' program in C language</olp>{| class="wikitable" style="width:800px;" |-| test<p>orangepi@testorangepi:~/orangepi-build$ '''cd output/debsvim hello_world.c'''</p><p>#include &lt;stdio.h&gt;</p>
test@test:~/orangepi-build/output/debs$ '''scp \'''
'''linux-image-next-sun50iw9_x.x.x_arm64.deb root@192.168.1.xxx<p>int main(void)</p><p>{</p>:<p>printf(&quot;Hello World!\n&quot;);</root'''p>
<ol start="2" style="list-style-type: lower-alpha;">
<li>Install the deb package of the new linux kernel just uploaded.</li></ol>
orangepi@orangepi:~$ '''sudo dpkg -i linux-image-next-sun50iw9_x.x.x_arm64.deb''' <ol start="3" style="list-style-type: lower-alphap>return 0;"</p><lip>Then restart the development board and check whether the kernel-related modifications have taken effect.}</lip>|}</olliorangepi@orangepi:~$ <li><p>Then compile and run '''sudo''' '''reboothello_world.c''' <span id="compile-rootfs"></spanp>{| class="wikitable" style= Compile rootfs =="width:800px;" |-# Run the build.sh script, remember to add sudo permissions|  test<p>orangepi@testorangepi:~/orangepi-build$ '''sudo gcc -o hello_world hello_world./build.shc''' <ol start="2" style="list-style-type: decimal;"/p><lip>Select orangepi@orangepi:~$ '''Rootfs and all deb packages./hello_world''' and press Enter</li></olp> <div class="figure"p[[File:zero2w-img285.png]] Hello World!</divp><ol start="3" style="list-style-type: decimal;">|}<li>Then select the model of the development board</li></ol> [[File:zero2w-img275.png]] <ol start="4" style="list-style-type: decimal;"/li><li><p>Then select the branch type of the kernel source code. Different versions of the kernel source code maintain different rootfs types.Ubuntu Jammy has Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li><p>In the current branchThe 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, you can see three options11:10: debian1138) [GCC 11.3.0] on linux</p><p>Type &quot;help&quot;, ubuntu20.04&quot;copyright&quot;, and ubuntu22.04&quot;credits&quot; or &quot;license&quot; for more information.</p><p>&gt;&gt;&gt;</lip>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <libig><p>In '''Use the next branch, you can see three options: debian11, debian12, and ubuntu22.04Ctrl+D shortcut key to exit python's interactive mode.'''</p></libig>|}</olli></li><p>Write the '''hello_world.py''' program in Python language</olp[[File:zero2w-img276.png]] <ol start{| class="5wikitable" style="list-style-typewidth: decimal800px;"|-| <p>orangepi@orangepi:~$ '''vim hello_world.py'''</p><lip>Then select the type of rootfsprint('Hello World!')</lip>|}</olli[[File:zero2w-img286<li><p>The result of running '''hello_world.png]]py''' is as follows</p> <ol start{| class="6wikitable" style="list-style-typewidth: decimal800px;"|-| <p>orangepi@orangepi:~$ '''python3 hello_world.py'''</p><p>Hello World!</p>|}</li></ol></li><li><p>Then select the type of imageUbuntu 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 to install openjdk-18</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''Image with console interface (server)sudo apt install -y openjdk-18-jdk''' Represents the image of the server version, which is relatively small in size.</p>|}</li><li><p>After installation, you can check the Java version.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''Image with desktop environmentjava --version''' Represents an image with a desktop, which is relatively large in size.</p></lip>openjdk 18.0.2-ea 2022-07-19</olp></lip>OpenJDK Runtime Environment (build 18.0.2-ea+9-Ubuntu-222.04)</olp> <div class="figure"p[[File:zero2wOpenJDK 64-Bit Server VM (build 18.0.2-ea+9-Ubuntu-img287222.png]]04, mixed mode, sharing)</p>|}</divli><ol startli><p>Write the Java version of '''hello_world.java'''</p>{| class="7wikitable" style="list-style-typewidth: decimal800px;">|-| <lip>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 (orangepi@orangepi:~$ '''please do not choose the Minimal version without special needs, because many things are not pre-installed by defaultvim hello_world. Some functions may not be availablejava''')</lip><p>public class hello_world</olp><p>{</p>:<div class="figure"p>public static void main(String[] args)</p>:<p>{</p>[[File:zero2w-img288:<p>System.out.png]]println(&quot;Hello World!&quot;);</p>:<p>}</p><p>}</p>|}</divli><ol startli><p>Then compile and run '''hello_world.java'''</p>{| class="8wikitable" style="list-style-typewidth: decimal800px;"|-| <p>orangepi@orangepi:~$ '''javac hello_world.java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p>|}</li>If 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.</ol></li></ol>
[[File:zero2w<span id="method-img289.png]]of-uploading-files-to-the-development-board-linux-system"></span>
[[File:zero2w-img290.png]]== Method of uploading files to the development board Linux system ==
You can then select additional packages that need <span id="method-to be installed. Please press -upload-files-to-the Enter key here -development-board-linux-system-in-ubuntu-pc"></span>=== Method to skip directly.upload files to the development board Linux system in Ubuntu PC ===
[[File:zero2w<span id="how-img291.png]]to-upload-files-using-scp-command"></span>==== How to upload files using scp command ====
<ol start="9" style="list-style-type: decimal;"><li><p>Then Use the scp command to upload files to the compilation Linux system of rootfs will startthe development board in Ubuntu PC. Some of the information prompted during compilation are The specific command is as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li>Type <p>'''file_path: '''Needs to be replaced with the path of the file to be uploaded</p></li><li><p>'''orangepi: '''This is the user name of the development board's Linux system. It can also be replaced with something else, such as root.</p></li><li><p>'''192.168.xx.xx:''' This is the IP address of rootfsthe development board. Please modify it according to the actual situation.</p></li><li><p>'''/home/orangepi:''' The path in the development board Linux system can also be modified to other paths.</p>{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''scp file_path orangepi@192.168.xx.xx:/home/orangepi/'''</olp>|}
</li></ol>
</li>
<li><p>If you want to upload a folder, you need to add the -r parameter</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''scp <span style="color:#FF0000">-r</span> dir_path orangepi@192.168.xx.xx:/home/orangepi/'''</p>
|}
</li>
<li><p>There are more usages of scp, please use the following command to view the man manual</p></li>
{| class="wikitable" style="width:800px;"
|-
|
test@test:~$ '''man scp'''
|}
</ol>
<span id="how-to-upload-files-using-filezilla"></span>
[ o.k. ] local not found [ Creating new rootfs cache for '''bullseye''' ]==== How to upload files using filezilla ====
<ol start="2" style="list-style-type: lower-alphadecimal;"><li>The storage path of the compiled rootfs compressed package</lip>First install filezilla in Ubuntu PC</olp>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Target directory [ <p>test@test:~$ '''orangepisudo apt install -buildy filezilla'''</externalp>|}</cacheli><li><p>Then use the following command to open filezilla</rootfsp>{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''filezilla'' ]'</p>|}</li><li><p>The interface after opening filezilla is as shown below. At this time, the remote site on the right is empty.</p><div class="figure">
<ol start="3" style="list-style-type[[File: lowerzero2w-alpha;"><li>The name of the rootfs compressed package generated by compilation</li></ol>img255.png]]
[ o.k. ] File name [ '''bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4''' ]</div></li><li><p>The method of connecting the development board is as shown in the figure below</p></li>
<ol startdiv class="10figure" 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></ol></li></ol>
<blockquote>a) '''bullseye''' represents the type of Linux distribution of rootfs[[File:zero2w-img256.png]]
b) </div></ol><ol start="5" style="list-style-type: decimal;"><li><p>Then choose to '''xfcesave the password''' indicates that the rootfs is the desktop version, and if it is cli, it indicates the server versionclick '''OK'''</p><p>[[File:zero2w-img257.png]]</p></li><li><p>Then select '''Always trust this host''' and click '''OK'''</p></li>
c) '''arm64''' represents the architecture type of rootfs<div class="figure">
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</blockquote><ol start="2" style="list-style-type[[File: lower-alpha;"><li>'''bullseyezero2w-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4img258.list''' Lists the package names of all packages installed by rootfs</li></ol>png]]
test@test:~</div></orangepiol><ol start="7" style="list-style-build$ type: decimal;"><li>After the connection is successful, you can see the directory structure of the development board'''ls externals Linux file system on the right side of the filezilla software.</cache/rootfs/'''li>
bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4<div class="figure">
bullseye[[File:zero2w-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4img259.currentpng]]
bullseye</div></ol><ol start="8" style="list-xfcestyle-arm64.5250ec7002de9e81a41de169f1f89721.tartype: decimal;"><li>Then select the path to be uploaded to the development board on the right side of the filezilla software, select the file to be uploaded in Ubuntu PC on the left side of the filezilla software, right-click the mouse, and then click the upload option to start uploading the file to the development board.lz4.list</li>
<ol startdiv class="11figure" 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[[File:zero2w-linux-image"></span>== Compile linux image ==img260.png]]
# Run </div></ol><ol start="9" style="list-style-type: decimal;"><li><p>After the upload is completed, you can go to the corresponding path in the development board Linux system to view the uploaded file.</p></li><li><p>The method of uploading a folder is the same as the method of uploading a file, so I won'''buildt go into details here.sh''' script, remember to add sudo permissions</p></li></ol>
test@test:~/orangepi<span id="method-to-upload-files-from-windows-pc-to-development-board-linux-build$ '''sudo .system"></build.sh'''span>
<ol start="2" style="list-style-type: decimal;"><li>Select '''Full OS image for flashing''' and press Enter</li></ol>= Method to upload files from Windows PC to development board Linux system ===
<div classspan id="figurehow-to-upload-files-using-filezilla-1"></span>==== How to upload files using filezilla ====
[[File:zero2w-img292# First download the installation file of the Windows version of the filezilla software.png]]The download link is as follows
</div><ol start="3" style="list-style-type: decimal;"><li>Then select the model of the development board</li></ol> [[File:zero2w-img275.png]] <ol start{| class="4wikitable" style="list-style-typewidth: decimal800px;"><li><p>Then select the branch type of the kernel source code. Different versions of the kernel source code maintain different rootfs types.</p>|-<ol style="list-style-type: lower-alpha;">| <li><p>In the current branch, you can see three options[https: debian11, ubuntu20.04, and ubuntu22.04.</p></li><li><p>In the next branch, you can see three options: debian11, debian12, and ubuntu22.04filezilla-project.<org/p></li></ol></li></ol> [[File:zero2w-img276download.png]] <ol start="5" style="list-style-php?type: decimal;"><li><p>If you select the next branch, you will also be prompted to select the memory size, and you do not need to select the current branch.</p><ol style="list-style-typeclient '''https: 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 optionfilezilla-project.<org/p><p>[[File:zero2w-img277download.png]php?type=client''']</p></li></ol></li><li><p>Then select the type of rootfs</p></li></ol> [[File:zero2w-img286.png]]|}
<ol start="7" style="list-style-type: decimal;"><li><p>Then select the type of image</p><ol style="list-style-type: lower[[File:zero2w-alpha;"><li><p>'''Image with console interface (server)''' Represents the image of the server version, which is relatively small in size.</p></li><li><p>'''Image with desktop environment'''Represents an image with a desktop, which is relatively large in sizeimg261.</p></li></ol></li></ol>png]]
<div class="figure">
::[[File:zero2w-img287img262.png]]
</div>
<ol start="82" style="list-style-type: decimal;"><li>If you are compiling the server version of the image<p>The downloaded installation package is as shown below, you can also choose then double-click to compile the Standard version or the Minimal version. The Minimal version will have much less preinstall it directly</p>{| class="wikitable" style="width:800px;" |-installed software than the Standard version (| <p>'''please do not choose the Minimal version without special needs, because many things are not preFileZilla_Server_1.5.1_win64-installed by defaultsetup. Some functions may not be availableexe''')</li></olp>|}During the installation process, please select '''Decline''' on the following installation interface, and then select '''Next&gt;'''
<div class="figure">
[[File:zero2w-img288img263.png]]
</div>
</li></ol><ol start="93" style="list-style-type: decimal;"><li>If you are compiling a desktop version of The interface after opening filezilla is as shown below. At this time, the image, you also need to select remote site on the type of desktop environment. Currently, only XFCE right is maintained, so please select an XFCE type desktopempty.</li></ol>
[[File:zero2w-img289.png]]<div class="figure">
[[File:zero2w-img290img264.png]]
You can then select additional packages that need to be installed. Please press </div></ol><ol start="4" style="list-style-type: decimal;"><li>The method of connecting the Enter key here to skip directly.development board is as shown in the figure below:</li>
[[File:zero2w-img291.png]]<div class="figure">
<ol start="10" style="list[[File:zero2w-style-type: decimal;"><li>Then the compilation of the linux image will beginimg256. The general process of compilation is as follows</li></ol>png]]
a. Initialize </div></ol><ol start="5" style="list-style-type: decimal;"><li>Then choose to '''save the compilation environment of Ubuntu PC password''' and install the software packages required for the compilation process.click '''OK'''</li>
b. Download the source code of u-boot and linux kernel (if already cached, only update the code)<div class="figure">
c[[File:zero2w-img265. Compile u-boot source code and generate u-boot deb packagepng]]
d. Compile linux source code </div></ol><ol start="6" style="list-style-type: decimal;"><li>Then select '''Always trust this host''' and generate linux-related deb packagesclick '''OK'''</li>
e. Make the deb package of linux firmware<div class="figure">
f[[File:zero2w-img266. Make the deb package of orangepi-config toolpng]]
g</div></ol><ol start="7" style="list-style-type: decimal;"><li>After the connection is successful, you can see the directory structure of the development board's Linux file system on the right side of the filezilla software. Create a deb package with board-level support</li>
h. If you compile the desktop version image, you will also create a desktop-related deb package.<div class="figure">
i. Check whether rootfs has been cached. If not, re[[File:zero2w-create rootfs. If it has been cached, decompress it directly and use itimg267.png]]
j</div></ol><ol start="8" style="list-style-type: decimal;"><li>Then select the path to be uploaded to the development board on the right side of the filezilla software, select the file to be uploaded on the Windows PC on the left side of the filezilla software, right-click the mouse, and then click the upload option to start uploading the file to the development board. Install the deb package generated previously into rootfs</li>
k. Make some specific settings for different development boards and different types of images, such as pre-installing additional software packages, modifying system configurations, etc.<div class="figure">
l. Then create the image file and format the partition. The default type is ext4[[File:zero2w-img268.png]]
m</div></ol><ol start="9" style="list-style-type: decimal;"><li><p>After the upload is completed, you can go to the corresponding path in the development board Linux system to view the uploaded file. Then copy </p></li><li><p>The method of uploading a folder is the configured rootfs to same as the mirror partitionmethod of uploading a file, so I won't go into details here.</p></li></ol>
n. Then update initramfs<span id="instructions-for-using-the-logo-on-and-off-the-machine"></span>
o. Finally, write == Instructions for using the bin file of u-boot into logo on and off the image through the dd command.machine ==
<ol start="11" style="list-style-type: decimal;"><li><p>After compiling the image, the following message The power on/off logo will only be displayedon the desktop version of the system by default.</p></li><ol li><p>Set the '''bootlogo''' variable to '''false''' in '''/boot/orangepiEnv.txt''' to turn off the switch logo.</p>{| class="wikitable" style="listwidth:800px;" |-| <p>orangepi@orangepi:~$ '''sudo 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;" |-type| <p>orangepi@orangepi:~$ '''sudo vim /boot/orangepiEnv.txt'''</p><p>verbosity=1</p><p>'''<span style="color: lower-alpha;#FF0000">bootlogo=true</span>'''</p>|}</li><li><p>The storage path location of the compiled 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</lip>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo update-initramfs -u'''</olp>|}
</li></ol>
[ o<span id="how-to-turn-on-the-power-button-in-linux5.k. ] Done building [ '''output/images/orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop4"></orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop.img''' ]span>
<ol start="2" style="list-style-type: lower-alpha;"><li>Compilation time</li></ol>How to turn on the power button in Linux5.4 ==
'''[ oThere is no power on/off button on the main board of the development board.kWe can expand it through a 24pin expansion board. ] Runtime [ 19 min ]'''The location of the power on/off button on the expansion board is as follows:
<ol start="3" style="list-style-type[[File: lowerzero2w-alpha;"><li>Repeat the command to compile the image. Use the following command to start compiling the image directly without selecting it through the graphical interfaceimg269.</li></ol>png]]
[ o.k. ] Repeat Build Options [ '''sudo The power on/off button of the Linux 6.1 image is turned on by default, but the power on/buildoff button of the Linux 5.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=4 kernel image RELEASE=bullseye BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_CONFIGURE=yes''' ]is turned off by default and needs to be turned on manually for normal use. The steps are as follows:
<span idol style="instructionslist-forstyle-usingtype: decimal;"><li><p>First run '''orangepi-theconfig'''. Ordinary users remember to add '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-orangeconfig'''</p>|}</li><li><p>Then select '''System'''</p><p>[[File:zero2w-piimg80.png]]</p></li><li><p>Then select '''Hardware'''</p><p>[[File:zero2w-osimg81.png]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown in the picture below, and then use the '''space''' to select the dtbo configuration of the SPI you want to open.</p><p>[[File:zero2w-archimg270.png]]</p></li><li><p>Then select '''&lt;Save&gt;''' to save</p><p>[[File:zero2w-system"img83.png]]</p></li><li><p>Then select '''&lt;Back&gt;'''</spanp><p>[[File:zero2w-img84.png]]</p></li>= <li><p>Then select '''Instructions for using the Orange Pi OS Arch system&lt;Reboot&gt;''' to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol> <span id="how-to-shut-down-and-restart-the-development-board"></span>
<span id="orange-pi-os-arch-system-function-adaptation-status"></span>== Orange Pi OS Arch system function adaptation status How to shut down and restart the development board ==
<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.</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''Motherboard functionssudo poweroff'''</p>| '''OPi OS Arch'''}{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big><p>'''HDMI videoNote that after turning off the development board, you need to unplug and replug the power supply before it can be turned on.'''</p></big>|}</li><li><p>In addition to using the poweroff command to shut down, you can also use the power on/off button on the expansion board to shut down.</p><p>[[File:zero2w-img269.png]]</p>{| '''OK'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big><p>'''HDMI AudioNote that Linux 5.4 requires manual configuration of the power on/off button before it can be used. For the opening method, please refer to [[Orange Pi Zero 2W#How to turn on the power button in Linux5.4|the method of opening the power button in Linux5.4]].'''</p></big>| }</li><li><p>Use the '''OKreboot'''command to restart the Linux system in the development board</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''sudo''' '''Typereboot'''</p>|}</li></ol> <span id="linux-C USB2sdkorangepi-build-usage-instructions"></span> = '''Linux SDK——orangepi-build usage instructions''' = <span id="compilation-system-requirements"></span>== Compilation system requirements == The Linux SDK, '''orangepi-build''', only supports running on X64 computers with '''<span style="color:#FF0000">Ubuntu 22.0 x 204</span>'''| installed. Therefore, before downloading orangepi-build, please first ensure that the Ubuntu version installed on your computer is Ubuntu 22.04. The command to check the Ubuntu version installed on the computer is as follows. If the Release field does not display '''OK<span style="color:#FF0000">22.04</span>''', it means that the Ubuntu version currently used does not meet the requirements. Please change the system before performing the following operations. {| class="wikitable" style="width:800px;"
|-
| test@test:~$ '''lsb_release -a''' No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04 LTS Release: '''<span style="color:#FF0000">22.04</span>''TF Card Startup' Codename: '''jammy'''| } If the computer is installed with a Windows system and does not have Ubuntu 22.04 installed on it, you can consider using'''OKVirtualBox'''or '''VMware''' to install an Ubuntu 22.04 virtual machine in the Windows system. But please note, do not compile orangepi-build on the WSL virtual machine, because orangepi-build has not been tested in the WSL virtual machine, so there is no guarantee that orangepi-build can be used normally in WSL. In addition, please do not compile the Linux system on the development board. Use orangepi-build. The installation image download address of Ubuntu 22.04 amd64 version is: {| class="wikitable" style="width:800px;"
|-
| '''WIFI'''| '''OK'''|-| '''Bluetooth'''| '''OK'''|[https://repo.huaweicloud.com/ubuntu-| '''LED Light'''| '''OK'''|releases/21.04/ubuntu-| '''40pin GPIO'''| '''OK'''|-| '''40pin I2C'''| '''OK'''|-| '''40pin SPI'''| '''OK'''|21.04-| '''40pin UART'''| '''OK'''|desktop-| '''40pin PWM'''| amd64.iso '''OK'''|https://mirrors.tuna.tsinghua.edu.cn/ubuntu-| '''Temperature Sensor'''| '''OK'''|releases/22.04/ubuntu-| '''Hardware watchdog'''| '''OK'''|22.04-| '''Mali GPU'''| '''NO'''|desktop-| '''Video codec'''| '''NOamd64.iso''']
|}
After installing Ubuntu 22.04 on your computer or virtual machine, please first set the software source of Ubuntu 22.04 to Tsinghua source (or other domestic sources that you think is fast), otherwise it is easy to make errors due to network reasons when installing the software later. The steps to replace Tsinghua Source are as follows: <ol style="list-style-type: lower-alpha;"><li>For the method of replacing Tsinghua Source, please refer to the instructions on this page.</li> {| class="wikitable" style="width:800px;"
|-
| [https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/ '''24pin expansion board functionhttps://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/''']| '''OPi OS Arch'''}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Note that the Ubuntu version needs to be switched to 22.04.</li> [[File:zero2w-img271.png]]</ol>|<ol start="3" style="list-style-type: lower-alpha;">| <li>The contents of the '''100M network port/etc/apt/sources.list'''file that need to be replaced are:</li>{| '''OK'''class="wikitable" style="width:800px;"
|-
| '''100M Ethernet port light'''| test@test:~$ '''OK'''|-| '''USB2sudo mv /etc/apt/sources.0 HOST x 2'''| '''OK'''|-| '''Infrared reception'''| '''OK'''|-| '''Headphone audio playback'''| '''OK'''|-| '''Onlist cat /etc/apt/off button'''| '''OK'''|-| 'sources.list.bak''LRADC''' '''Custom buttons x 2'''| '''OK'''|-| '''TV-OUT'''| '''NO'''|}
<span id="orange-pi-os-arch-system-user-guide-instructions"><test@test:~$ '''sudo vim /span>== Orange Pi OS Arch System User Guide Instructions ==etc/apt/sources.list'''
First of all, please note that the OPi OS Arch system does not have a '''#''' The source code image is commented by default orangepi user and password, so you cannot directly log in remotely through the serial port and ssh after the system is started after burning (not even the root user)to improve apt update speed. This is different from Ubuntu and Debian systemsYou can uncomment it yourself if necessary.
When the OPi OS Arch system is started for the first time, you need to connect an HDMI display and then initialize the system settings through the user wizard (including creating a new user name and setting a password)deb https://mirrors. The setup steps of the user wizard are as follows:tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
<ol style="list'''#''' deb-style-typesrc https: lower-alpha;"><li><p>After burning the system, when you start it for the first time and enter the desktop, you will see the user wizard program shown in the figure below//mirrors.tuna.tsinghua.edu.<cn/ubuntu/p><div class="figure">jammy main restricted universe multiverse
[[Filedeb https:zero2w//mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-img293.png]]updates main restricted universe multiverse
<'''#''' deb-src https:/div></li><li><p>First you need to select the language you want<mirrors.tuna.tsinghua.edu.cn/p><div class="figure">ubuntu/ jammy-updates main restricted universe multiverse
[[Filedeb https:zero2w//mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-img294.png]]backports main restricted universe multiverse
<'''#''' deb-src https:/div></li><li><p>After selecting the language, the user wizard will immediately switch to the corresponding language interface, as shown below in Chinese<mirrors.tuna.tsinghua.edu.cn/p><div class="figure">ubuntu/ jammy-backports main restricted universe multiverse
[[Filedeb https:zero2w//mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-img295.png]]security main restricted universe multiverse
<'''#''' deb-src https:/div></li><li><p>Then select the area<mirrors.tuna.tsinghua.edu.cn/p><div class="figure">ubuntu/ jammy-security main restricted universe multiverse
[[File:zero2w-img296.png]]
</div></li><li><p>Then select the keyboard model</p><div class="figure">'''#''' Pre-release software source, not recommended to be enabled
[[File'''#''' deb https:zero2w//mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-img297.png]]proposed main restricted universe multiverse
'''#''' deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse|}</divol></liol 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.<p/li>Then create a new username and set a password{| class="wikitable" style="width:800px;" |-| test@test:~$ '''sudo apt-get update'''|}</pol><ol start="5" style="list-style-type: lower-alpha;"><div classli>'''<span style="figurecolor:#FF0000">In addition, since the source code of the kernel and Uboot are stored on GitHub, it is very important to ensure that the computer can download the code from GitHub normally when compiling the image.</span>'''</li></ol>
[[File:zero2w<span id="obtain-img298.png]]the-source-code-of-linux-sdk"></span>
</div></li><li><p>Then make sure there is no problem with == Obtain the selection, and then click the install '''button'''</p><div classsource code of linux sdk =="figure">
[[File:zero2w<span id="download-img299.png]]orangepi-build-from-github"></span>=== Download orangepi-build from github ===
</div></li><li><p>Then wait for Linux sdk refers to the orangepi-build set of codes. Orangepi-build is modified based on the armbian build compilation system. Multiple versions of Linux images can be compiled using orangepi-build. Use the installation following command to complete</p><div class="figure">download the orangepi-build code:
[[File{| class="wikitable" style="width:zero2w800px;" |-img300.png]]| test@test:~$ '''sudo apt-get update'''
</div></li><li><p>After the installation is complete, you need to click the test@test:~$ '''Finishsudo apt-get install -y git''' button to restart the system.</p><div class="figure">
[[Filetest@test:zero2w~$ '''git clone https://github.com/orangepi-xunlong/orangepi-build.git -b next'''|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note that when using the H618 Soc development board, you need to download the source code of the <span style="color:#FF0000">next</span> branch of orangepi-build. The above git clone command needs to specify the branch of the orangepi-img301build source code as next.png]]'''</big>
</div></li>
<li><p>The Orange Pi Hello program will automatically start after restarting. At this time, you need to remove the check '''mark of Start on startup''' in the lower right corner, otherwise you need to manually close the Orange Pi Hello program every time you start it.</p>
<div class="figure">
[[File:zero2w-img302img272.png|center|800px]]
</div>
|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <pbig>At '''When downloading the orangepi-build code through the git clone command, you do not need to enter the user name and password of the github account (the same is true for downloading other codes in this pointmanual). If after entering the git clone command, Ubuntu PC prompts you can use to enter the user name of the newly created username github account. The name and password to log are usually entered incorrectly in the address of the orangepi-build warehouse behind git clone. Please carefully check whether there are any errors in the spelling of the command, rather than thinking that we have forgotten to provide the OPi OS system through username and password of the serial port or sshgithub account.'''</p></li></olbig>|}
<span id="howThe u-to-set-dt-overlays"></span>== How to set DT overlays ==boot and linux kernel versions currently used by the H618 series development boards are as follows:
The multiplexing functions such as I2C/SPI/UART/PWM in the 40{| class="wikitable" style="width:800px;text-pin development board are turned off by default in the kernelalign: center;"|-| '''branch'''| '''u-boot Version'''| '''linux Kernel version'''|-| '''current'''| '''u-boot v2018.05'''| '''s dts, and the corresponding DT overlays need to be manually turned on before they can be usedlinux5.4'''|-| '''next'''| '''u-boot v2021.07'''| '''linux6.1'''|}
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''The method to open DT overlays in OPi OS Arch system branch mentioned here is not the same thing as follows:the branch of orangepi-build source code, please don't get confused. This branch is mainly used to distinguish different kernel source code versions.'''
# First open the '''/boot/extlinux/extlinuxWe define the linux5.4 bsp kernel currently provided by Allwinner as the current branch. The latest linux6.1 LTS kernel is defined as the next branch.conf''' configuration file</big>|}
[orangepi@orangepi-pc ~]$ '''sudo vim /boot/extlinux/extlinux.conf'''After downloading, the following files and folders will be included:
<ol start="2" style="list-style-type: decimallower-alpha;"><li>Then open the corresponding configuration by adding <p>'''build.sh'''FDTOVERLAYS: Compile startup script</p></li><li><p>''' external''': Contains configuration files needed to compile the image, specific scripts, and source code of some programs, etc.</dtbsp></allwinnerli><li><p>'''LICENSE''': GPL 2 license file</overlayp></xxx.dtboli><li><p>''' in README.md''': orangepi-build documentation</bootp></extlinux/extlinux.confli><li><p>'''scripts''': Common script for compiling linux images</p></li></ol>{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''ls'''
'''Note build.sh &nbsp;&nbsp;&nbsp;&nbsp; external &nbsp;&nbsp;&nbsp;&nbsp; LICENSE &nbsp;&nbsp;&nbsp;&nbsp; README.md &nbsp;&nbsp;&nbsp;&nbsp; scripts'''|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''If you downloaded the orangepi-build code from github, after downloading, you may find that xxxorangepi-build does not contain the source code of u-boot and linux kernel, and there is no cross-compilation tool required to compile u-boot and linux kernel.dtbo chain, this is normal, because these things are stored in FDTOVERLAYS /dtbs/allwinner/overlay/xxxother separate github repositories or some servers (their addresses will be detailed below).dtbo needs to be replaced with Orangepi-build will specify the addresses of u-boot, Linux kernel and cross-compilation tool chain in the specific dtbo script and configurationfile. When running orangepi-build, please do when it finds that these things are not copy available locally, itwill automatically download them from the corresponding places.'''</big>|}
[orangepi@orangepi<span id="download-pc ~]$ '''sudo vim /boot/extlinuxthe-cross-compilation-tool-chain"></extlinux.conf'''span>
LABEL Orange Pi=== Download the cross-compilation tool chain ===
KERNEL /ImageWhen orangepi-build is run for the first time, it will automatically download the cross-compilation '''toolchain''' and put it in the '''toolchains''' folder. Every time you run orangepi-build's build.sh script, it will check whether the cross-compilation toolchain in toolchains exists. If If it does not exist, the download will be restarted. If it exists, it will be used directly without repeated downloading.
FDT /dtbs/allwinner/sun50i-h616-orangepi-zero2w.dtb<div class="figure">
'''FDTOVERLAYS /dtbs/allwinner/overlay/xxx[[File:zero2w-img273.dtbo''' #Configuration that needs to be addedpng]]
<ol start="3" style="list-style-type: decimal;"/div><li><p>The storage path mirror URL of xxx.dtbo the cross-compilation tool chain in the OPi OS Arch image China is as follows. Please note that not all dtbo under this path can be used.</p><p>'''/boot/dtbs/allwinner/overlay/'''</p></li><li><p>The DT overlays configuration that can be used by the development board is as follows</p></li></ol>open source software mirror site of Tsinghua University:
{| class="wikitable" style="width:800px;"
|-
| [https://mirrors.tuna.tsinghua.edu.cn/armbian-releases/_toolchain/ '''Functions on the development boardhttps://mirrors.tuna.tsinghua.edu.cn/armbian-releases/_toolchain/''']| } After toolchains is downloaded, it will contain multiple versions of cross-compilation '''Corresponding DT overlays configurationtoolchain''': {| class="wikitable" style="width:800px;"
|-
| '''40pin test@test:~/orangepi- i2c0build$ '''| '''sun50i-h616-pi-i2c0.dtbols toolchains/'''|-| '''40pin - i2c1'''| '''sun50igcc-h616arm-pi11.2-i2c12022.dtbo'''|02-| '''40pin - i2c2'''| '''sun50ix86_64-h616aarch64-pinone-i2c2.dtbo'''|linux-gnu | '''40pin - uart2'''| '''sun50igcc-h616linaro-pi4.9.4-uart22017.dtbo'''|-| '''40pin - uart3'''| '''sun50i01-h616x86_64_aarch64-pi-uart3.dtbo'''|linux-gnu | '''40pin - uart4'''| '''sun50igcc-h616linaro-pi7.4.1-uart42019.dtbo'''|-| '''40pin - uart5'''| '''sun50i02-h616x86_64_arm-phlinux-uart5.dtbo'''gnueabi|-| '''40pin gcc- pwm1'''| '''sun50iarm-h616-pi11.2-pwm12022.dtbo'''|-| '''40pin 02- pwm2'''| '''sun50ix86_64-h616arm-pinone-pwm2.dtbo'''|linux-gnueabihf | '''40pin - pwm3'''| '''sun50igcc-h616linaro-pi4.9.4-pwm32017.dtbo'''|-| '''40pin - pwm4'''| '''sun50i01-h616x86_64_arm-pilinux-pwm4.dtbo'''gnueabi |-| '''40pin gcc- spi1 cs0'''| '''sun50ilinaro-h616aarch64-spi1none-cs0elf-spidev4.dtbo'''|-| '''40pin - spi1 cs1'''| '''sun50i8-h616-spi1-cs1-spidev2013.dtbo'''|-11_linux| '''40pin - spi1 cs0 cs1'''| '''sun50igcc-h616arm-spi1-cs0-cs1-spidev9.dtbo'''|-| '''设Set USB0 to Host mode'''| '''sun50i2-h616-usb0-host2019.dtbo'''|-| '''Turn off the green LED light'''| '''sun50i12-h616-zero2w-disable-led.dtbo'''|x86_64-| '''How to close the UART0 debugging serial port'''| '''sun50iaarch64-h616none-disablelinux-uart0.dtbo'''|}gnu
<ol start="gcc-linaro-5" style="list.5.0-style2017.10-x86_64_arm-linux-type: decimal;"><li>If you need to open multiple configurations at the same time, just add the paths of multiple configurations directly after '''FDTOVERLAYS.''' For example, the configuration of opening i2c1 and uart5 at the same time is as follows</li></ol>gnueabihf
[orangepi@orangepigcc-pc ~]$ '''sudo vim /boot/extlinux/extlinuxlinaro-arm-linux-gnueabihf-4.8-2014.conf'''04_linux
LABEL Orange Pigcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf
KERNEL /Imagegcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu
FDT /dtbs/allwinner/sun50igcc-h616linaro-orangepiarm-zero2wnone-eabi-4.8-2014.dtb04_linux|}
'''FDTOVERLAYS /dtbs/allwinner/overlay/sun50iThe cross-h616-pi-i2c1.dtbo /dtbs/allwinner/overlay/sun50i-h616-ph-uart5.dtbo'''compilation tool chain used to compile the H618 Linux kernel source code is:
<ol start="6" style="list-style-type: decimallower-alpha;"><li>After setting, you need to restart the system for the configuration to take effectlinux5.4</li></ol>{| class="wikitable" style="width:800px;" [orangepi@orangepi|-pc ~]$ | '''sudo rebootgcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu'''|}</ol><span idol start="2" style="howlist-tostyle-installtype: lower-softwarealpha;"><li>linux6.1</spanli>{| class="wikitable" style= How "width:800px;" |-| '''gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu'''|}</ol>The cross-compilation tool chain used to install software ==compile the H618 u-boot source code is:
You can use the pacman package management tool to install software that is not available in OPi OS. For example, the command to install the vim editor is as follows. If you want to install other software, you only need to replace vim with the package name of the software you want to install. [orangepi@orangepi-pc ~]$ '''sudo pacman -Syy vim''' <span idol style="androidlist-12style-tvtype: lower-system-usage-instructionsalpha;"></span> = '''Android 12 TV system usage instructions''' = <span id="supported-android-versions"li>v2018.05</spanli>== Supported Android versions == {| class="wikitable" style="width:800px;"
|-
| Android Version'''gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabi'''|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>v2021.07</li>{| Kernel versionclass="wikitable" style="width:800px;"
|-
| '''Android 12 TV Version'''| '''linux5gcc-arm-11.2-2022.402-x86_64-aarch64-none-linux-gnu'''
|}
</ol>
<span id="orangepi-build-complete-directory-structure-description"></span>
<span id="android-12== orangepi-tv-function-adaptation-status"></span>=build complete directory structure description = Android 12 TV function adaptation status ==
<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/'''Motherboard functionsorange-pi-5.4-sun50iw9'''| '''Android12 TV'''}</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/'''HDMI videoorange-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/'''HDMI Audiov2018.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/'''Typev2021.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-C USB2alpha;"><li><p>'''build.0 x 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 2license 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>'''OKuserpatches''': Store the configuration files needed to compile the script</p></li>{| class="wikitable" style="width:800px;"
|-
| test@test:~/orangepi-build$ '''TF card startupls'''| '''OKbuild.sh &nbsp;&nbsp;&nbsp;&nbsp; external &nbsp;&nbsp;&nbsp;&nbsp; kernel &nbsp;&nbsp;&nbsp;&nbsp; LICENSE &nbsp;&nbsp;&nbsp;&nbsp; output &nbsp;&nbsp;&nbsp;&nbsp; README.md &nbsp;&nbsp;&nbsp;&nbsp; scripts &nbsp;&nbsp;&nbsp;&nbsp; toolchains &nbsp;&nbsp;&nbsp;&nbsp; u-boot &nbsp;&nbsp;&nbsp;&nbsp; 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;"
|-
| test@test:~/orangepi-build$ '''WIFIsudo ./build.sh'''| } <ol start="2" style="list-style-type: decimal;"><li>Select '''OKU-boot package'''and press Enter</li> <div class="figure"> [[File:zero2w-img274.png]] </div></ol><ol start="3" style="list-style-type: decimal;"><li>Then select the model of the development board</li> [[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>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 next branch, you will also be prompted to select the memory size, and you do not need to select the current branch.</p><ol style="list-style-type: lower-alpha;">| '''Bluetooth'''<li><p>If the development board you purchased has a memory size of 1.5GB, please select the first option.</p></li>| '''OK'''<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>| '''USB Camera'''</li></ol><ol start="6" style="list-style-type: decimal;">| '''OK'''<li><p>Then it will 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;">| '''LED Light'''<li>Version of u-boot source code</li>{| '''OK'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] Compiling u-boot [ '''40pin GPIOv2021.07''']|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Version of the cross-compilation tool chain</li>{| '''OK'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] Compiler version [ '''40pin I2Caarch64-linux-gnu-gcc 11''']|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>Path to the compiled u-boot deb package</li>{| '''OK'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] Target directory [ '''40pin SPI1orangepi-build/output/debs/u-boot''']|}</ol><ol start="4" style="list-style-type: lower-alpha;"><li>The package name of the compiled u-boot deb package</li>{| '''OK'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] File name [ '''40pin UARTlinux-u-boot-next-orangepizero2w_x.x.x_arm64.deb''']|}</ol><ol start="5" style="list-style-type: lower-alpha;"><li>Compilation time</li>{| '''OK'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] Runtime [ '''40pin PWM1 min''']| '''OK'''}</ol>|<ol start="6" style="list-style-type: lower-alpha;">| '''Temperature Sensor'''<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>{| '''OK'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] Repeat Build Options [ '''Hardware watchdogsudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=u-boot''']| '''OK'''}</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;"
|-
| '''Mali GPU'''| test@test:~/orangepi-build$ '''OKls output/debs/u-boot/'''|-| '''Video codec'''| '''OKlinux-u-boot-next-orangepizero2w_x.x.x_arm64.deb'''
|}
</ol>
<ol start="8" style="list-style-type: decimal;">
<li>When the orangepi-bulid compilation system compiles the u-boot source code, it will first synchronize the u-boot source code with the u-boot source code of the github server. Therefore, if you want to modify the u-boot source code, you first need to turn off the download and update function of the source code. ('''You need to completely compile u-boot before you can turn off this function, otherwise it will prompt that the source code of u-boot cannot be found'''), otherwise the modifications will be restored. The method is as follows:</li>
 
Set the IGNORE_UPDATES variable in u'''userpatches/config-default.conf''' to &quot;yes&quot;
{| class="wikitable" style="width:800px;"
|-
| test@test:~/orangepi-build$ '''24pin Expansion board functionvim userpatches/config-default.conf'''| ...... IGNORE_UPDATES=&quot;'''Android12 TV<span style="color:#FF0000">yes</span>'''&quot; ......|}</ol><ol start="9" style="list-style-type: decimal;"><li><p>When debugging u-boot code, you can use the following method to update u-boot in the linux image for testing</p><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="wikitable" style="width:800px;"
|-
| test@test:~/orangepi-build$ '''cd output/debs/u-boot''' test@test:~/orangepi_build/output/debs/u-boot$ '''100M network portscp \'''| '''OKlinux-u-boot-next-orangepizero2w_x.x.x_arm64.deb [mailto:root@192.168.1.xxx:/root root@192.168.1.xxx:/root]'''|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Install the new u-boot deb package just uploaded</li>{| class="wikitable" style="width:800px;"
|-
| orangepi@orangepi:~$ '''100M Ethernet port lightsudo dpkg -i'''| '''OKlinux-u-boot-next-orangepizero2w_x.x.x_arm64.deb'''|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>Then run the nand-sata-install script</li>{| class="wikitable" style="width:800px;"
|-
| '''USB2.0 HOST x 2'''| '''OK'''|-| '''Infrared reception'''| ''orangepi@orangepi:~$ 'OK'''|sudo nand-| '''Headphone audio playback'''| '''OK'''|sata-| '''On/off button'''| '''OK'''|-| '''LRADC''' '''Custom buttons x 2'''| '''OK, The default setting is the volume up and down keys.'''|-| '''TV-OUT'''| '''OKinstall'''
|}
</ol>
<ol start="4" style="list-style-type: lower-alpha;">
<li>Then select '''5 Install/Update the bootloader on SD/eMMC'''</li>
 
[[File:zero2w-img278.png]]
</ol>
<ol start="5" style="list-style-type: lower-alpha;">
<li>After pressing the Enter key, a Warning will pop up first.</li>
 
[[File:zero2w-img279.png]]
</ol>
<ol start="6" style="list-style-type: lower-alpha;">
<li>Press the Enter key again to start updating u-boot. After the update is completed, the following information will be displayed.</li>
[[File:zero2w-img280.png]]</ol><ol start="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="onboardcompile-ledthe-lightlinux-display-instructionskernel"></span> == Onboard LED light display instructions Compile the linux kernel == # Run the '''build.sh''' script, remember to add sudo permissions
::{| 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 '''Kernel package''' and press Enter</spanli>== How to return to the previous interface in Android ==
We generally use the mouse and keyboard to control the Android system of the development board. When entering certain interfaces and need to return to the previous interface or desktop, we can only return by right-clicking the mouse, and the keyboard cannot return.<div class="figure">
If you have purchased the infrared remote control (other remote controls do not work) and a 24pin expansion board that come with the development board, after connecting the 24pin expansion board to the development board, you can also use the return key on the remote control to return to the previous menu. The location of the return key is as shown below. Shown: [[File:zero2w-img303img281.png]] <span id="how-to-use-adb"></span>== How to use ADB == <span id="use-network-connection-adb-debugging"></span>=== Use network connection adb debugging === '''Using 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's wired or wireless network is connected, and then obtain the IP address of the development board. Next To be used.''' # Make sure the '''service.adb.tcp.port''' of the Android system is set to 5555 port number apollo-p2:/ # '''getprop | grep &quot;adb.tcp&quot;''' [service.adb.tcp.port]: [5555] <ol start="2" style="list-style-type: decimal;"><li>If '''service.adb.tcp.port''' is not set, you can use the following command in the serial port to set the port number of the network adb</li></ol> apollo-p2:/ # '''setprop service.adb.tcp.port 5555'''<br />apollo-p2:/ # '''stop adbd''' apollo-p2:/ # '''start adbd'''
</div></ol>
<ol start="3" style="list-style-type: decimal;">
<li>Install adb tool on Ubuntu PCThen you will be prompted whether you need to display the kernel configuration interface. If you do not need to modify the kernel configuration, select the first one. If you need to modify the kernel configuration, select the second one.</li></ol> test@test:~$ '''sudo apt-get update''' test@test:~$ '''sudo apt-get install -y adb'''
[[File:zero2w-img282.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then connect network adb on Ubuntu PC</li></ol> test@test:~$ '''adb connect 192.168.1.xxx:5555''' '''(Need to be modified to select the IP address model of the development board)''' * daemon not running; starting now at tcp:5037 * daemon started successfully connected to 192.168.1.xxx:5555 test@test:~$ '''adb devices''' List of devices attached 192.168.1.xxx:5555 device</li>
[[File:zero2w-img275.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>Then you can log in to select the android system through adb shell on Ubuntu PCbranch type of the kernel source code</li></ol>
test@test:~$ '''adb shell''':a. The current branch will compile the linux5.4 kernel source code
apollo-p2:/ #:b. The next branch will compile the linux6.1 kernel source code
::[[File:zero2w-img276.png]]<span id/ol><ol start="use-data-cable-to-connect6" style="list-adbstyle-debuggingtype: decimal;"><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.</spanli>=== Use data cable to connect adb debugging ===
# Prepare a USB Type C interface data cable, plug one end of the USB interface into the USB interface of the computer, and plug one end of the USB Type C interface into the USB0 interface of the development board (see the description of the picture on the right below for the location of USB0). In this case, the development board is powered by the computer's USB interface, so please ensure that the computer's USB interface can provide the most sufficient power to drive the development board[[File:zero2w-img283.png]]
[[File<ol style="list-style-type:zero2wlower-img304alpha;"><li>If you do not need to modify the kernel configuration options, when running the build.png]] [[Filesh script, pass '''KERNEL_CONFIGURE=no''' to temporarily block the pop-up of the kernel configuration interface.</li>{| class="wikitable" style="width:800px;" |-| test@test:zero2w~/orangepi-img305build$ '''sudo ./build.sh KERNEL_CONFIGURE=no'''|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li><p>b. You can also set '''KERNEL_CONFIGURE=no''' in the orangepi-build/userpatches/config-default.confconfiguration file to permanently disable this function.</p></li><li><p>If the following error is prompted when compiling the kernel, it is because the Ubuntu PC terminal interface is too small, causing the make menuconfig interface to be unable to be displayed. Please increase the Ubuntu PC terminal to the maximum size, and then rerun the build.sh script.png]]</p></li>
<ol start="2" style="list-style-type: decimal;"><li>Install adb tool on Ubuntu PC</li></ol> test@test:~$ '''sudo apt-get update''' test@test:~$ '''sudo apt-get install -y adb''' <ol start="3" style="list-style-type: decimal;"><li>Check whether the ADB device is recognized</li></ol> test@test:~$ '''adb devices''' List of devices attached 4c00146473c28651dd0 device <ol start="4" style="list-style-type: decimal;"><li>Then you can log in to the android system through adb shell on Ubuntu PC</li></ol> test@test:~$ '''adb shell''' apollo-p2:/ $ <span id="view-how-to-set-hdmi-display-resolution"></span>== View how to set HDMI display resolution == <ol style="list-style-type: decimal;"><li><p>Enter first '''Settings'''</p><p>[[File:zero2w-img306img284.png]]</p></li><li><p>Then select '''Device Preferences'''</pol><p>[[File:zero2w-img307.png]]</p></li><li><p>Then select '''Display &amp; 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.</pol><p>[[File:zero2w-img312.png]]</p></li></ol> <span idstart="hdmi-to-vga-display-test-17"></span>=== HDMI to VGA display test === <ol style="list-style-type: decimal;"><li><p>First you need to prepare Part of the information prompted when compiling the following accessoriesnext branch kernel source code is explained as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li>HDMI to VGA converterVersion of the linux kernel source code</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-| [o.k. ] Compiling current kernel [File:zero2w-img144'''6.1.png]31''' ]|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>A VGA cable and a Mini HDMI male to HDMI female adapterThe version of the cross-compilation tool chain used</li></ol>{| class="wikitable" style="width:800px;" |-| [[File:zero2w-img145o.k.png]] Compiler version [[File:zero2w'''aarch64-linux-gnu-img146.png]gcc 11''' ]|}</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>A monitor or TV that supports VGA 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 [ '''orangepi-build/external/config/kernel/linux-6.1-sun50iw9-next.config''' ]|}</ol><ol start="4" style="list-style-type: lower-alpha;"><li>The path to the kernel-related deb package generated by compilation</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Target directory [ '''output/debs/''' ]|}</ol><ol start="5" style="list-style-type: lower-alpha;"><li>The package name of the kernel image deb package generated by compilation</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] File name [ '''linux-image-next-sun50iw9_x.x.x_arm64.deb''' ]|}</ol><ol start="6" style="list-style-type: lower-alpha;"><li>Compilation time</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Runtime [ '''10 min''' ]|}</ol><ol start="7" style="list-style-type: lower-alpha;"><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.</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>'''linux-headers-next-sun50iw9_x.x.x_arm64.deb''' Contains kernel header files</p></li><li><p>'''linux-image-next-sun50iw9_x.x.x_arm64.deb''' Contains kernel images and kernel modules</p></li>{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''ls output/debs/linux-*'''
<!-output/debs/linux- dtb-next-><ol start="2" style="list-style-type: decimal;"><li>HDMI to VGA display test is as follows</li></ol>sun50iw9_x.x.x_arm64.deb
[[File:zero2woutput/debs/linux-img313headers-next-sun50iw9_x.x.x_arm64.png]]deb
'''output/debs/linux-image-next-sun50iw9_x.x.x_arm64.deb|}</ol></li></ol><ol start="9" style="list-style-type: decimal;"><li>When using HDMI to VGA displaythe orangepi-bulid compilation system compiles the linux kernel source code, it will first synchronize the development board and linux kernel source code with the Android system linux kernel source code of the development board do not github server. Therefore, if you want to modify the linux kernel source code, you first need to make any settings. You only need turn off the Mini HDMI interface update function of the development board source code ('''it needs to display normally. So if there is a problem with be completely compiled once This function can only be turned off after obtaining the testLinux kernel source code, please check whether there is a problem with otherwise it will prompt that the source code of the HDMI to VGA converter, VGA cable and monitor.Linux kernel cannot be found'''), otherwise the modifications will be restored. The method is as follows:</li>
<span id="wi-fi-connection-method"><Set the IGNORE_UPDATES variable in '''userpatches/span>== WIconfig-FI connection method ==default.conf''' to &quot;yes&quot;
# Choose first {| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''Settingsvim userpatches/config-default.conf'''
[[FileIGNORE_UPDATES=&quot;'''<span style="color:zero2w-img306.png]]#FF0000">yes</span>'''&quot;|}</ol><ol start="210" style="list-style-type: decimal;"><li>Then select '''Network &amp<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; Internet'''"></li>Upload the compiled deb package of the Linux kernel to the Linux system of the development board</olli>{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''cd output/debs'''
[[Filetest@test:zero2w~/orangepi-img314.png]]build/output/debs$ '''scp \'''
'''linux-image-next-sun50iw9_x.x.x_arm64.deb root@192.168.1.xxx:/root'''|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Install the deb package of the new linux kernel just uploaded.</li>{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''sudo dpkg -i linux-image-next-sun50iw9_x.x.x_arm64.deb'''|}</ol><ol start="3" style="list-style-type: decimallower-alpha;"><li>Then turn on WIrestart the development board and check whether the kernel-FIrelated modifications have taken effect.</li>{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''sudo''' '''reboot'''|}</ol></li></ol><span id="compile-rootfs"></span>
[[File:zero2w-img315.png]]== Compile rootfs ==
<ol start="4" style="list-style-type: decimal;"><li>After turning on WI-FI, you can see # Run the searched signals under '''Available networks'''build.</li></ol>sh script, remember to add sudo permissions
[[File:zero2w:{| class="wikitable" style="width:800px;" |-img316| test@test:~/orangepi-build$ '''sudo ./build.png]]sh'''|}
<ol start="52" style="list-style-type: decimal;"><li>After selecting the WI-FI you want to connect to, the password input interface shown below will pop up.Select '''Rootfs and all deb packages''' and press Enter</li></ol>
<div class="figure">
[[File:zero2w-img317img285.png]]
</div></ol><ol start="63" 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 select the virtual keyboard to start connecting to model of the WI-FI.development board</li></ol>
[[File:zero2w-img275.png]]<div class/ol><ol start="figure4" style="list-style-type: decimal;"><li><p>Then select the branch type of the kernel source code. Different versions of the kernel source code maintain different rootfs types.</p><ol style="list-style-type: lower-alpha;"><li><p>In the current branch, you can see three options: debian11, ubuntu20.04, and ubuntu22.04.</p></li><li><p>In the next branch, you can see three options: debian11, debian12, and ubuntu22.04.</p></li>
[[File:zero2w-img318img276.png]]</ol></li></ol><ol start="5" style="list-style-type: decimal;"><li>Then select the type of rootfs</li>
[[File:zero2w-img286.png]]</divol><ol start="76" style="list-style-type: decimal;"><li>The display after successful WI<p>Then select the type of image</p><ol style="list-FI connection style-type: lower-alpha;"><li><p>'''Image with console interface (server)''' Represents the image of the server version, which is as shown belowrelatively small in size.</p></li><li><p>'''Image with desktop environment''' Represents an image with a desktop, which is relatively large in size.</olp></li>
[[File:zero2w-img319.png]]<div class="figure">
<span id="how[[File:zero2w-to-use-wi-fi-hotspot"></span>== How to use WI-FI hotspot ==img287.png]]
# First</div></ol></li></ol><ol start="7" style="list-style-type: decimal;"><li>If you are compiling the server version of the image, please make sure that the Ethernet port is connected you can also choose to compile the network cable and can access Standard version or the Internet normallyMinimal version.# Then select The Minimal version will have much less pre-installed software than the Standard version ('''Settingsplease do not choose the Minimal version without special needs, because many things are not pre-installed by default. Some functions may not be available''')</li>
[[File:zero2w-img306.png]]<div class="figure">
<ol start="3" style="list[[File:zero2w-style-type: decimal;"><li>Then select '''Network &amp; Internet'''</li></ol>img288.png]]
[[File</div></ol><ol start="8" style="list-style-type:zero2w-img314decimal;"><li>If 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.png]]</li>
<ol start="4" style="list[[File:zero2w-style-type: decimal;"><li>Then select '''WIFI hotspot'''</li></ol>img289.png]]
[[File:zero2w-img320img290.png]]
<ol start="5" style="list-style-type: decimal;"><li>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 to the hotspot (if you then select additional packages that need to modify be installed. Please press the name and password of the hotspot, you need Enter key here to close Hotspot Enable firstskip directly. Then you can modify it)</li></ol>
[[File:zero2w-img321img291.png]]</ol><ol start="9" style="list-style-type: decimal;"><li><p>Then the compilation of rootfs will start. Some of the information prompted during compilation are as follows:</p><ol style="list-style-type: lower-alpha;"><li>Type of rootfs</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] local not found [ Creating new rootfs cache for '''bullseye''' ]|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>The storage path of the compiled rootfs compressed package</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Target directory [ '''orangepi-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>{| class="wikitable" style="width:800px;" |-| [ o.k. ] File name [ '''bullseye-xfce-arm64.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>
<ol start="6" style="list-style-type: decimal;"><li>At this time, you can take out your mobile phone. If everything is normal, you can find the WIFI hotspot with the same name ('''here AndroidAP_7132'''a) shown under the '''Hotspot namebullseye''' in represents the picture above in the WI-FI list searched by the mobile phone. Then you can click AndroidAP_7132 to connect to the hotspot. The password can be seen under the '''Hotspot password''' in the picture above.</li></ol>type of Linux distribution of rootfs
[[File:zero2w-img322b) '''xfce''' indicates that the rootfs is the desktop version, and if it is cli, it indicates the server version.png]]
<ol start="7" style="list-style-type: decimal;"><li>After the connection is successful, it will be displayed as shown below (the interface will be different on different mobile phones, the specific interface is subject to the one displayed on your mobile phonec). At this time, you can open a web page on your mobile phone to see if you can access the Internet. If the web page can be opened normally, it means that the '''WI-FI Hotspotarm64''' represents the architecture type of the development board can be used normally.</li></ol>rootfs
[[File:zero2wd) '''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-img323xfce-arm64.png]]5250ec7002de9e81a41de169f1f89721.tar.lz4.list''' Lists the package names of all packages installed by rootfs</li>{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''ls external/cache/rootfs/'''
<span id="howbullseye-toxfce-check-the-ip-address-of-the-ethernet-port"></span>== How to check the IP address of the Ethernet port ==arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4
# There is no wired network interface on the main board of the development boardbullseye-xfce-arm64. We can expand the 100M Ethernet through a 24pin expansion board5250ec7002de9e81a41de169f1f89721.tar.lz4.current
[[Filebullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4.list|}</ol></li></ol><ol start="11" style="list-style-type:zero2w-img107decimal;"><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.png]]</li></ol>
<ol startspan id="2" style="listcompile-stylelinux-type: decimal;image"><li><p>Then make sure the network port of the expansion board is connected to the router or switch</p></li><li><p>Then open '''Settings'''</p><p>[[File:zero2w-img324.png]]</p></li><li><p>Then select '''Network &amp; Internet'''</p><p>[[File:zero2w-img325.png]]</p></li><li><p>Then you can see the IP address of the development board's wired network port at the location shown in the picture below.</p><p>[[File:zero2w-img326.png]]</p></li></olspan>
<span id="bluetooth-connection-method"></span>== Bluetooth connection method Compile linux image ==
# Choose first Run the '''Settingsbuild.sh'''script, remember to add sudo permissions
[[File:zero2w:{| class="wikitable" style="width:800px;" |-img306| test@test:~/orangepi-build$ '''sudo ./build.png]]sh'''|}
<ol start="2" style="list-style-type: decimal;">
<li>Then select Select '''BluetoothFull OS image for flashing'''and press Enter</li> </oldiv class="figure">
[[File:zero2w-img327img292.png]]
</div></ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then Open '''Bluetooth Enable'''select the model of the development board</li></ol> [[File:zero2w-img328.png]]
[[File:zero2w-img275.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>Then click '''Pair new device'''to start scanning for surrounding Bluetooth devicesselect the branch type of the kernel source code. Different versions of the kernel source code maintain different rootfs types.</p><ol style="list-style-type: lower-alpha;"><li><p>In the current branch, you can see three options: debian11, ubuntu20.04, and ubuntu22.04.</olp></li[[File<li><p>In the next branch, you can see three options:zero2w-img329debian11, debian12, and ubuntu22.04.png]]</p></li>
[[File:zero2w-img276.png]]
</ol>
</li></ol>
<ol start="5" style="list-style-type: decimal;">
<li>The searched Bluetooth devices <p>If you select the next branch, you will also be displayed under '''Available devices'''prompted to select the memory size, and you do not need to select the current branch.</p><ol style="list-style-type: lower-alpha;"><li><p>If the development board you purchased has a memory size of 1.5GB, please select the first option.</p></li><li><p>If the development board you purchased has 1GB or 2GB or 4GB memory size, please choose the second option.</p><p>[[File:zero2w-img277.png]]</p></li></ol></li><li><p>Then select the type of rootfs</p></li>
[[File:zero2w-img330img286.png]]</ol><ol start="7" style="list-style-type: decimal;"><li><p>Then select the type of image</p><ol style="list-style-type: lower-alpha;"><li><p>'''Image with console interface (server)''' Represents the image of the server version, which is relatively small in size.</p></li><li><p>'''Image with desktop environment'''Represents an image with a desktop, which is relatively large in size.</p></li>
<ol startdiv class="6figure" style="list-style-type: decimal;"><li>Then click on the Bluetooth device you want to connect to start pairing. When the following interface pops up, please use the mouse to select the '''Pair'''option</li></ol>
[[File:zero2w-img331img287.png]]
</div></ol></li></ol><ol start="78" style="list-style-type: decimal;"><li>What is tested here is the Bluetooth configuration process between If you are compiling the development board and server version of the Android phone. At this timeimage, you can also choose to compile the following confirmation interface will pop up on Standard version or the phoneMinimal version. Click The Minimal version will have much less pre-installed software than the pairing button on Standard version ('''please do not choose the phone to start the pairing processMinimal version without special needs, because many things are not pre-installed by default.Some functions may not be available''')</li></ol>
[[File:zero2w-img332.png]]<div class="figure">
<ol start="8" style="list-style-type: decimal;"><li>After pairing is completed, open '''Paired devices''' and you will see the paired Bluetooth devices.</li></ol> [[File:zero2w-img333img288.png]]
</div></ol>
<ol start="9" style="list-style-type: decimal;">
<li>At this time, If you can use the Bluetooth are compiling a desktop version of your mobile phone to send a picture to the development board. After sendingimage, you can see also need to select the following confirmation interface in the Android system type of the development boarddesktop environment. Currently, only XFCE is maintained, and then click '''Accept''' to start receiving the pictures sent by the mobile phoneso please select an XFCE type desktop.</li></ol>
[[File:zero2w-img334img289.png]]
<ol start="10" style="list[[File:zero2w-style-type: decimal;"><li>Pictures received by the Bluetooth system of the development board Android system can be viewed in '''Received files'''img290.</li></ol>png]]
[[File:zero2w-img335You can then select additional packages that need to be installed. Please press the Enter key here to skip directly.png]]
[[File:zero2w-img291.png]]</ol><span idol start="how-to-set-usb0-to-host10" style="list-modestyle-1type: decimal;"><li>Then the compilation of the linux image will begin. The general process of compilation is as follows</spanli>== How to set USB0 to HOST mode ==
As shown in ::a. Initialize the figure below, there are two Type-C interfaces on the motherboard compilation environment of Ubuntu PC and install the development board: USB0 and USB1. Both of these interfaces can be used to power software packages required for the development board, and they can also be used as USB2.0 HOST interfaces. The difference between USB0 and USB1 is that in addition to being set to HOST mode, USB0 can also be set to Device mode, while USB1 only has HOST modecompilation process.
[[File:zero2w:b. Download the source code of u-img160.png]]boot and linux kernel (if already cached, only update the code)
USB0 of the Android12 TV system released by Orange Pi is set to Device mode by default, so when there is no need to use USB0 Device mode (ADB function needs to ensure that USB0 is in Device mode), it is recommended to use USB0 for power supply, so that USB1 can be directly used to connect USB devices ::c.Compile u-boot source code and generate u-boot deb package
If you want to use USB0 to connect USB devices, you need to set USB0 to HOST mode::d. The method is as follows:Compile linux source code and generate linux-related deb packages
<ol style="list-style-type: lower-alpha;"><li>Run :e. Make the following command to set USB0 to HOST mode:</li></ol>deb package of linux firmware
apollo-p2:/ # '''cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_host'''f. Make the deb package of orangepi-config tool
host_chose finished!::g. Create a deb package with board-level support
apollo::h. If you compile the desktop version image, you will also create a desktop-p2:/ #related deb package.
<ol start="2" style="list-style-type: lower:i. Check whether rootfs has been cached. If not, re-alpha;"><li>Run the following command to switch back to Device mode</li></ol>create rootfs. If it has been cached, decompress it directly and use it.
apollo-p2:/ # '''cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_device'''j. Install the deb package generated previously into rootfs
device_chose finished!::k. Make some specific settings for different development boards and different types of images, such as pre-installing additional software packages, modifying system configurations, etc.
apollo-p2:/ #:l. Then create the image file and format the partition. The default type is ext4.
<ol start="3" style="list-style-type: lower-alpha;"><li>The command :m. Then copy the configured rootfs to view the current mode of USB0 is</li></ol>mirror partition.
apollo-p2:/ # '''cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/otg_role'''n. Then update initramfs
usb_host::o. Finally, write the bin file of u-boot into the image through the dd command.</ol><span idol start="11" style="howlist-style-totype: decimal;"><li><p>After compiling the image, the following message will be displayed</p><ol style="list-usestyle-usbtype: lower-cameraalpha;"><li>The storage path of the compiled image</spanli>{| class="wikitable" style= How to use USB camera "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># First insert {| class="wikitable" style="width:800px;" |-| '''[ o.k. ] Runtime [ 19 min ]'''|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>Repeat the USB (UVC protocol) camera into command to compile the USB interface of image. Use the development board# If following command to start compiling the USB camera is recognized normally, image directly without selecting it through the corresponding video device node will be generated under graphical interface.</devli>{| class="wikitable" style="width:800px;" |-| console:/ # [ o.k. ] Repeat Build Options [ '''ls sudo ./dev/video0build.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>
/dev/video0= '''Instructions for using the Orange Pi OS Arch system''' =
<ol startspan id="3" style="listorange-pi-os-arch-system-function-styleadaptation-type: decimal;status"><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 &quot;'''How to use ADB'''&quot;.</p></lispan><li><p>Download the USB camera test APP from the '''official tool''' on the development board information download page</p></li></ol>== Orange Pi OS Arch system function adaptation status ==
<div {| class="figurewikitable" style=">width:800px;text-align: center;"|-| '''Motherboard functions'''| '''OPi OS Arch'''|-| '''HDMI video'''| '''OK'''|-| '''HDMI Audio'''| '''OK'''|-[[File:zero2w| '''Type-img336C USB2.png]]0 x 2'''| '''OK'''|-| '''TF Card Startup'''| '''OK'''|-| '''WIFI'''| '''OK'''</div>|-| '''Bluetooth'''| '''OK'''|-| '''LED Light'''| '''OK'''|-<div class="figure">| '''40pin GPIO'''| '''OK'''[[File:zero2w|-img337.png]]| '''40pin I2C'''</div>| '''OK'''<ol start="5" style="list|-style| '''40pin SPI'''| '''OK'''|-type: decimal;"><li>Then use the adb command to install the USB camera test APP into the Android system. Of course, you can also use a USB disk copy to install it.</li></ol>| '''40pin UART'''| '''OK'''|-test@test:~$ | '''adb install usbcamera.apk40pin PWM'''| '''OK'''<ol start="6" style="list|-style| '''Temperature Sensor'''| '''OK'''|-type: decimal;"><li>After installation, you can see the startup icon of the USB camera on the Android desktop.</li></ol>| '''Hardware watchdog'''| '''OK'''[[File:zero2w|-img338.png]]| '''Mali GPU'''| '''<ol start="7" span style="list-style-typecolor: decimal;#FF0000">NO<li/span>Then double'''|-click to open the USB camera APP and you can see the output video of the USB camera.</li></ol>| '''Video codec'''| '''<span idstyle="android-system-root-descriptioncolor:#FF0000">NO</span>'''== Android system ROOT description ==|}
{| class="wikitable" style="width:800px;text-align: center;"|-| '''The Android system released by Orange Pi has been ROOT and can be tested using the following method24pin expansion board function'''| '''OPi OS Arch'''|-| '''100M network port'''| '''OK'''|-| '''100M Ethernet port light'''| '''OK'''|-| '''USB2.0 HOST x 2'''| '''OK'''|-| '''Infrared reception'''| '''OK'''|-| '''Headphone audio playback'''| '''OK'''|-| '''On/off button'''| '''OK'''|-| '''LRADC''' '''Custom buttons x 2'''| '''OK'''|-| '''TV-OUT'''| '''<span style="color:#FF0000">NO</span>'''|}
# Download <span id="orange-pi-os-arch-system-user-guide-instructions"></span> == Orange Pi OS Arch System User Guide Instructions == First of all, please note that the OPi OS Arch system does not have a default orangepi user and password, so you cannot directly log in remotely through the serial port and ssh after the system is started after burning (not even the root user). This is different from Ubuntu and Debian systems. When the OPi OS Arch system is started for the first time, you need to connect an HDMI display and then initialize the '''official tool''' on system settings through the development board data download page '''rootcheckuser wizard (including creating a new user name and setting a password).apk'''The setup steps of the user wizard are as follows:
<ol style="list-style-type: lower-alpha;">
<li><p>After burning the system, when you start it for the first time and enter the desktop, you will see the user wizard program shown in the figure below.</p>
<div class="figure">
[[File:zero2w-img336img293.png]]
</div></li><li><p>First you need to select the language you want</p>
<div class="figure">
[[File:zero2w-img339img294.png]] </div></li><li><p>After selecting the language, the user wizard will immediately switch to the corresponding language interface, as shown below in Chinese</p><div class="figure">
</div><ol start="2" style="list-style[[File:zero2w-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 &quot;'''How to use ADB'''&quot;.</p></li><li><p>Then use the adb command to install rootcheck.apk into the Android system. Of course, you can also use a USB disk copy to install itimg295.</p></li></ol>png]]
test@test:~$ '''adb install rootcheck.apk'''</div></li><li><p>Then select the area</p><div class="figure">
<ol start="4" style="list[[File:zero2w-style-type: decimal;"><li>After installation, you can see the startup icon of the ROOT test tool on the Android desktopimg296.</li></ol>png]]
[[File:zero2w-img340.png]]</div></li><li><p>Then select the keyboard model</p><div class="figure">
<ol start="5" style="list[[File:zero2w-style-type: decimal;"><li>The display interface after opening the '''ROOT test tool''' for the first time is as shown below</li></ol>img297.png]]
[[File:zero2w-img341.png]]</div></li><li><p>Then create a new username and set a password</p><div class="figure">
<ol start="6" style="list[[File:zero2w-style-type: decimal;"><li>Then you can click '''CHECK 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 permissionsimg298.</li></ol>png]]
[[File:zero2w-img342.png]]</div></li><li><p>Then make sure there is no problem with the selection, and then click the install '''button'''</p><div class="figure">
<span id="how[[File:zero2w-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 ==img299.png]]
<ol style="list-style-type: decimal;"><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 '''the instructions in the WI-FI connection method.'''</pdiv></li><li><p>Then open wait for the '''MiracastReceiver'''application in the Android system of the development board</p><p>[[File:zero2w-img343.png]]</p></li><li><p>The interface after '''MiracastReceiver''' is opened is as followsinstallation to complete</p>
<div class="figure">
[[File:zero2w-img344img300.png]]
</div></li>
<li><p>Then find After the screen mirroring function in installation is complete, you need to click the phone settings. Here we take '''Xiaomi 12S Pro mobile phoneFinish''' 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 restart the phone.</p><p>[[File:zero2w-img345system.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 div class="figure below will pop up in the '''MiracastReceiver''' application interface of the development board. Here we can select '''Accept'''</p><p>[[File:zero2w-img347.png]]</p></li><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[[File:zero2w-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 ==img301.png]]
We can turn off or turn on the Android system of the development board through the power on</div></off button or infrared remote controlli><li><p>The Orange Pi Hello program will automatically start after restarting. HoweverAt this time, it should be noted that there is no power on/off button and infrared receiver on you need to remove the main board check '''mark of Start on startup''' in the development boardlower right corner, and otherwise you need to manually close the Orange Pi Hello program every time you start it needs to be expanded through a 24pin expansion board.</p><div class="figure">
[[File:zero2w-img107img302.png]]
The location of </div><p>At this point, you can use the power button on newly created username and password to log in to the 24pin expansion board is as shown in OPi OS system through the figure below:serial port or ssh.</p></li></ol>
[[File:zero2w<span id="how-img269.png]]to-set-dt-overlays"></span>== How to set DT overlays ==
The location of multiplexing functions such as I2C/SPI/UART/PWM in the 40-pin development board are turned off by default in the kernel's dts, and the infrared remote control power button is as follows:corresponding DT overlays need to be manually turned on before they can be used.
[[FileThe method to open DT overlays in OPi OS Arch system is as follows:zero2w-img349.png]]
When shutting down, we need to press and hold # First open 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 '''OK/boot/extlinux/extlinux.conf''' to shut down the Android system.configuration file
::{| class="wikitable" style="width:800px;" |-| [[File:zero2worangepi@orangepi-img350pc ~]$ '''sudo vim /boot/extlinux/extlinux.png]]conf'''|}
After shutting down, press and hold <ol start="2" style="list-style-type: decimal;"><li>Then open the power button or the power button on the infrared remote control again to turn it oncorresponding configuration by adding '''FDTOVERLAYS''' '''/dtbs/allwinner/overlay/xxx.dtbo''' in '''/boot/extlinux/extlinux.conf'''</li>
<span id{| class="wikitable" style="pinbackground-interfacecolor:#ffffdc;width:800px;" |-gpio-uart-spi-test"| <big>'''Note that xxx.dtbo in FDTOVERLAYS /dtbs/allwinner/overlay/xxx.dtbo needs to be replaced with the specific dtbo configuration, please do not copy it.'''</spanbig>|}{| class="wikitable" style= 40pin interface GPIO, UART, SPI test =="width:800px;" |-| [orangepi@orangepi-pc ~]$ '''sudo vim /boot/extlinux/extlinux.conf'''
'''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.'''LABEL Orange Pi
<span id="pin-gpio-port-test-method"><KERNEL /span>=== 40pin GPIO port test method ===Image
# First open wiringOP APP on the desktop [[File:zero2wFDT /dtbs/allwinner/sun50i-img351.png]] <ol start="2" style="listh616-styleorangepi-type: decimal;"><li>Then click the '''GPIO_TEST''' button to open the GPIO test interface</li></ol> [[File:zero2w-img352.png]]dtb
'''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><p>The GPIO test interface is as shown in the figure below. The two rows storage path of '''CheckBox''' buttons on the left have a one-to-one correspondence with the 40pin pinsxxx. When the '''CheckBox''' button is checked, the corresponding GPIO pin will be set to '''OUT''' mode and dtbo in the pin level OPi OS Arch image is set to high level; when unchecked, the GPIO pin level will as follows. Please note that not all dtbo under this path can 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, etcused.</p>{| class="wikitable" style="width:800px; when you click the" |-| <p>'''BLINK ALL GPIO/boot/dtbs/allwinner/overlay/''' button, all GPIO ports will cycle through outputting high and low levels. This function </p>|}</li><li><p>The DT overlays configuration that can be used to test all by the 40pin pins. GPIO port.development board is as follows</lip></olli>
[[File:zero2w-img353.png]] <ol start="4" style="list-style-type: decimal;"><li>Then click the '''GPIO READALL''' button, and the output information is as shown below:</li></ol> <div {| class="figure"> [[File:zero2w-img354.png]] </div><ol start="5wikitable" style="list-style-typewidth: decimal800px;"><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 text- 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 '''CheckBox''' 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 '''3.3v''', it means the setting High level success.</li></ol> [[Filealign:zero2w-img355.png]] <ol start="6" style="list-style-type: decimalcenter;"><li>Then click the '''GPIO READALL''' button and you can see that the current pin 12 mode is '''OUT''' and the pin level is high level.</li></ol> [[File:zero2w|-img356.png]] <ol start="7" style="list-style-type: decimal;"><li>Click the '''CheckBox| ''' button in Functions on 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 development board'''0v''', it means the low level setting is successful.</li></ol> [[File:zero2w-img357.png]] <ol start="8" style="list-style-type: decimal;"><li>Then click the | '''GPIO READALLCorresponding DT overlays configuration''' button and you can see that the current pin 12 mode is OUT and the pin level is low level.</li></ol> [[File:zero2w-img358.png]] <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. {| class="wikitable"
|-
| '''GPIO序号40pin - i2c0'''| '''GPIO'''| '''功能'''| '''引脚'''|| '''引脚'''| '''功能'''| '''GPIO'''| '''GPIO序号sun50i-h616-pi-i2c0.dtbo'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''3.3V40pin - i2c1'''| '''1'''|| '''2'''| ''sun50i-h616-pi-i2c1.dtbo'5V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''26440pin - i2c2'''| '''PI8'''| '''TWI1sun50i-h616-pi-SDAi2c2.dtbo'''| '''3'''|| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''26340pin - uart2'''| '''PI7'''| '''TWI1sun50i-h616-pi-SCLuart2.dtbo'''| '''5'''|| '''6'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''26940pin - uart3'''| '''PI13'''| '''PWM3'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224sun50i-h616-pi-uart3.dtbo'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''GND40pin - uart4'''| '''9'''|| '''10'''| '''UART0_RX'''| '''PH1'''| '''225sun50i-h616-pi-uart4.dtbo'''
|-
| '''22640pin - uart5'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''12'''| style="textsun50i-h616-ph-align: left;"|| '''PI1'''| '''257uart5.dtbo'''
|-
| '''22740pin - pwm1'''| '''PH3'''| '''UART5_RX'''| '''13'''|| '''14''sun50i-h616-pi-pwm1.dtbo'| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''26140pin - pwm2'''| '''PI5'''| '''UART2_TX'''| '''15'''|| '''16'''| '''PWM4'''| '''PI14'''| '''270sun50i-h616-pi-pwm2.dtbo'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''3.3V40pin - pwm3'''| '''17sun50i-h616-pi-pwm3.dtbo'''|-| '''18'''| style="text40pin -align: left;"|| '''PH4pwm4'''| '''228sun50i-h616-pi-pwm4.dtbo'''
|-
| '''23140pin - spi1 cs0'''| '''PH7'''| '''SPI1_MOSI'''| '''19sun50i-h616-spi1-cs0-spidev.dtbo'''|| '''20'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''23240pin - spi1 cs1'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''UART2_RX'''| '''PI6'''| '''262sun50i-h616-spi1-cs1-spidev.dtbo'''
|-
| '''23040pin - spi1 cs0 cs1'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229sun50i-h616-spi1-cs0-cs1-spidev.dtbo'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''GND设Set USB0 to Host mode'''| '''25'''|| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233sun50i-h616-usb0-host.dtbo'''
|-
| '''266Turn off the green LED light'''| '''PI10'''| '''TWI2sun50i-h616-zero2w-SDA'''| '''27'''|| '''28'''| '''TWI2disable-SCL'''| '''PI9'''| '''265led.dtbo'''
|-
| '''256How to close the UART0 debugging serial port'''| '''PI0sun50i-h616-disable-uart0.dtbo'''| }</ol><ol start="5" style="textlist-style-aligntype: leftdecimal;"|>| <li>If you need to open multiple configurations at the same time, just add the paths of multiple configurations directly after '''29FDTOVERLAYS.'''For example, the configuration of opening i2c1 and uart5 at the same time is as follows</li>{|| '''30'''| '''GND'''| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| [orangepi@orangepi-pc ~]$ '''271sudo vim /boot/extlinux/extlinux.conf'''| LABEL Orange Pi KERNEL /Image FDT /dtbs/allwinner/sun50i-h616-orangepi-zero2w.dtb '''PI15FDTOVERLAYS <span style="color:#FF0000">/dtbs/allwinner/overlay/sun50i-h616-pi-i2c1.dtbo /dtbs/allwinner/overlay/sun50i-h616-ph-uart5.dtbo</span>'''| }</ol><ol start="6" style="textlist-style-aligntype: leftdecimal;"|>| '''31'''<li>After setting, you need to restart the system for the configuration to take effect.</li>{|| '''32'''| '''PWM1'''| '''PI11'''| '''267'''class="wikitable" style="width:800px;"
|-
| [orangepi@orangepi-pc ~]$ '''268sudo reboot'''| '''PI12'''}</ol><span id="how-to-install-software"></span>| '''PWM2'''| '''33'''== How to install software ==|| '''34'''You can use the pacman package management tool to install software that is not available in OPi OS. For example, the command to install the vim editor is as follows. If you want to install other software, you only need to replace vim with the package name of the software you want to install.| '''GND'''{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| '''258'''| '''PI2'''| style="text-align: left;"|| '''35'''|| '''36'''| style="text-align: left;"|| '''PC12'''| '''76'''|-| '''272'''| '''PI16'''| style="text-align: left;"|| '''37'''|| '''38'''| style="text[orangepi@orangepi-align: left;"|| 'pc ~]$ ''PI4'''| '''260'''|-| style="text-align: left;"|| style="textsudo pacman -align: left;"|| '''GND'''| '''39'''|| '''40'''| style="text-align: left;"|| '''PI3'''| '''259Syy vim'''
|}
<ol startspan id="2" style="listandroid-12-tv-system-styleusage-type: decimal;instructions"><li>The device node corresponding to uart2 is '''/dev/ttyAS2''', and the device node corresponding to uart5 is'''/dev/ttyAS5'''</li></olspan>
apollo-p2:/ # ls /dev/ttyAS*= '''Android 12 TV system usage instructions''' =
<span id="supported-android-versions"></dev/ttyAS0 /dev/ttyAS1 '''/dev/ttyAS2 /dev/ttyAS5'''span>== Supported Android versions ==
<ol start{| class="3wikitable" style="list-stylewidth:800px;text-typealign: decimalcenter;"><li>First open wiringOP APP on the desktop</li></ol>|-| Android Version| Kernel version|-| '''Android 12 TV Version'''| '''linux5.4'''|}
[[File:zero2w<span id="android-img351.png]]12-tv-function-adaptation-status"></span>== Android 12 TV function adaptation status ==
<ol start{| class="4wikitable" style="list-style-typewidth: decimal800px;"><li>Then click the '''UART_TEST'''button to open the UART test interface</li></ol> [[File:zero2wtext-img359.png]] <ol start="5" style="list-style-typealign: decimalcenter;"><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/ttyAS2Motherboard functions''' or| '''/dev/ttyAS5Android12 TV''' 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 | '''OPENHDMI video''' button to open the uart node. After the opening is successful, the | '''OPENOK''' button becomes unselectable, and the |-| '''CLOSEHDMI Audio''' button and | '''SENDOK''' button become selectable.</p></li></ol>|-[[File:zero2w| '''Type-img362C USB2.png]]0 x 2''' <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 | '''SENDOK''' 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 numberTF card startup'''| '''GPIO'''| '''Function'''| '''pin'''|| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO serial numberOK'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''1'''|| '''2WIFI'''| '''5VOK'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''264Bluetooth'''| '''PI8OK'''| '''TWI1-SDA'''| '''3'''|| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''263USB Camera'''| '''PI7OK'''| '''TWI1-SCL'''| '''5'''|| '''6'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''269LED Light'''| '''PI13'''| '''PWM3'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224OK'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''9'''|| '''10'''| '''UART0_RX'''| '''PH140pin GPIO'''| '''225OK'''
|-
| '''22640pin I2C'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''12'''| style="text-align: left;"|| '''PI1'''| '''257OK'''
|-
| '''22740pin SPI1'''| '''PH3OK'''| '''UART5_RX'''| '''13'''|| '''14'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''26140pin UART'''| '''PI5'''| '''UART2_TX'''| '''15'''|| '''16'''| '''PWM4'''| '''PI14'''| '''270OK'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''3.3V40pin PWM'''| '''17OK'''|| '''18'''| style="text-align: left;"|| '''PH4Temperature Sensor'''| '''228OK'''
|-
| '''231Hardware watchdog'''| '''PH7OK'''| '''SPI1_MOSI'''| '''19'''|| '''20'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''232Mali GPU'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''UART2_RX'''| '''PI6'''| '''262OK'''
|-
| '''230Video codec'''| '''PH6OK'''| '''SPI1_CLK'''}| '''23'''|{| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''class="wikitable" style="width:800px;text-align: center;"
|-
| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''25'''|| '''26'''| '''SPI1_CS1'''| '''PH924pin Expansion board function'''| '''233Android12 TV'''
|-
| '''266100M network port'''| '''PI10OK'''|-| '''TWI2-SDA100M Ethernet port light'''| '''27OK'''|-| '''28USB2.0 HOST x 2'''| '''TWI2-SCLOK'''|-| '''PI9Infrared reception'''| '''265OK'''
|-
| '''256Headphone audio playback'''| '''PI0OK'''| style="text-align: left;"|| '''29'''|| '''30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''271On/off button'''| '''PI15'''| style="text-align: left;"|| '''31'''|| '''32'''| '''PWM1'''| '''PI11'''| '''267OK'''
|-
| '''268LRADC'''| '''PI12'''| '''PWM2'''| '''33Custom buttons x 2'''|| '''34OK, The default setting is the volume up and down keys.'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''258'''| '''PI2'''| style="textTV-align: left;"|| '''35'''|| '''36'''| style="text-align: left;"|| '''PC12OUT'''| '''76OK'''
|}
<ol startspan id="2" style="listonboard-led-light-styledisplay-type: decimal;instructions"><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></olspan>== Onboard LED light display instructions ==
apollo{| class="wikitable" style="width:800px;text-p2align:/ # center;"|-|| '''green light'''| '''red light'''|-| '''u-boot startup phase'''| '''Off'''| '''on'''|-| '''Kernel boot to enter the system'''| '''on'''| '''ls /dev/spidev1.*on'''|}
'''<span id="how-to-return-to-the-previous-interface-in-android"></dev/spidev1.0 /dev/spidev1.1'''span>== How to return to the previous interface in Android ==
<ol start="3" style="list-style-type: decimal;"><li>Here is a demonstration We generally use the mouse and keyboard to test control the SPI1 interface through Android system of the '''w25qxx''' moduledevelopment board. FirstWhen entering certain interfaces and need to return to the previous interface or desktop, connect we can only return by right-clicking the w25qxx module to mouse, and the SPI1 interfacekeyboard cannot return.</li></ol>
'''It doesn't matter if there is no w25qxx module, because there is If you have purchased the infrared remote control (other remote controls do not work) and a SPIFlash on 24pin expansion board that come with the development board connected , after connecting the 24pin expansion board to SPI0, and the configuration of SPI0 is also turned on by default in Androiddevelopment board, so we you can also directly use the onboard SPIFlash for testingreturn key on the remote control to return to the previous menu. The location of the return key is as shown below.'''Shown:
<ol start="4" style="list[[File:zero2w-style-type: decimal;"><li>Then open wiringOP APP on the desktop</li></ol>img303.png]]
[[File:zero2w<span id="how-img351.png]]to-use-adb"></span>== How to use ADB ==
<ol startspan id="5" style="listuse-network-connection-styleadb-type: decimal;debugging"><li>Then click the '''SPI_TEST''' button to open the SPI test interface</li></olspan>=== Use network connection adb debugging ===
[[File{| class="wikitable" style="background-color:#ffffdc;width:zero2w800px;" |-img365| <big>'''Using 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's wired or wireless network is connected, and then obtain the IP address of the development board. Next To be used.png]]'''</big>|}
<ol start="6" style="list-style-type: decimal;"><li><p>Then select # Make sure the spi device node in the upper left corner. If you test the onboard SPIFlash directly, just keep the default '''/dev/spidev0service.0'''adb. If the '''w25qxx''' module is connected to the 40pin spi1 cs0, then please select'''/dev/spidev1tcp.0port''', if of the w25qxx module Android system is connected set to the 40pin spi1 cs1, then please select '''/dev/spidev1.1'''</p><div class="figure">5555 port number
[[File:zero2w:{| class="wikitable" style="width:800px;" |-| apollo-img366p2:/ # '''getprop | grep &quot;adb.png]]tcp&quot;'''
</div></li>[service.adb.tcp.port]: [5555]<li><p>Then click the '''OPEN''' button to initialize the SPI</p></li></ol>|}
[[File<ol start="2" style="list-style-type: decimal;"><li>If '''service.adb.tcp.port''' is not set, you can use the following command in the serial port to set the port number of the network adb</li>{| class="wikitable" style="width:zero2w800px;" |-img367| apollo-p2:/ # '''setprop service.adb.tcp.png]]port 5555'''
<ol start="8" style="listapollo-style-typep2: 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 / # '''TRANSFERstop adbd''' button</li></ol>
[[Fileapollo-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:zero2w~$ '''sudo apt-img368.png]]get update'''
test@test:~$ '''sudo apt-get install -y adb'''|}</ol><ol start="94" style="list-style-type: decimal;"><li>Finally, the APP will display 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 read ID information IP address of the onboard SPI Flash.development board)''' <p>* daemon not running; starting now at tcp:5037</lip> <p>* daemon started successfully</olp>
[[Fileconnected to 192.168.1.xxx:zero2w-img369.png]]5555
<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 ===:~$ '''adb devices'''
# As can be seen from the table below, the Android12 TV system has i2c1 and i2c2 turned on by default.List of devices attached
192.168.1.xxx:5555 device|}</ol><ol start="5" style="list-style-type: decimal;"><li>Then you can log in to the android system through adb shell on Ubuntu PC</li>{| class="wikitable" style="width:800px;"
|-
| test@test:~$ '''GPIO serial numberadb shell''' apollo-p2:/ #| '''GPIO'''}</ol><span id="use-data-cable-to-connect-adb-debugging"></span> === Use data cable to connect adb debugging === | '''Function'# Prepare a USB Type C interface data cable, plug one end of the USB interface into the USB interface of the computer, and plug one end of the USB Type C interface into the USB0 interface of the development board (see the description of the picture on the right below for the location of USB0). In this case, the development board is powered by the computer's USB interface, so please ensure that the computer's USB interface can provide the most sufficient power to drive the development board.| '''pin'''|::[[File:zero2w-img304.png]] [[File:zero2w-img305.png]]| '''pin'''| '''Function'''<ol start="2" style="list-style-type: decimal;">| '''GPIO'''<li>Install adb tool on Ubuntu PC</li>{| '''GPIO serial number'''class="wikitable" style="width:800px;"
|-
| style="text-align: left;"|| style="text-aligntest@test: left;"|| ~$ '''3.3Vsudo apt-get update'''| test@test:~$ '''1sudo apt-get install -y adb'''|}| '''2'''| '''5V'''</ol>| <ol start="3" style="textlist-alignstyle-type: leftdecimal;"|><li>Check whether the ADB device is recognized</li>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| test@test:~$ '''264adb devices'''| '''PI8'''| '''TWI1-SDA'''List of devices attached| '''3'''|4c00146473c28651dd0 device| '''4'''}| '''5V'''</ol>| <ol start="4" style="textlist-alignstyle-type: leftdecimal;"|><li>Then you can log in to the android system through adb shell on Ubuntu PC</li>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| test@test:~$ '''263adb shell''' apollo-p2:/ $| }</ol><span id="view-how-to-set-hdmi-display-resolution"></span> == View how to set HDMI display resolution == <ol style="list-style-type: decimal;"><li><p>Enter first '''PI7Settings'''</p><p>[[File:zero2w-img306.png]]</p></li>| <li><p>Then select '''TWI1-SCLDevice Preferences'''</p><p>[[File:zero2w-img307.png]]</p></li>| <li><p>Then select '''5Display &amp; Sound'''</p>|<p>[[File:zero2w-img308.png]]</p></li>| <li><p>Then select '''6Advanced display settings'''</p><p>[[File:zero2w-img309.png]]</p></li>| <li><p>Then select '''GNDHDMI 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-img312.png]]</p></li></ol> <span id="hdmi-to-vga-display-test-1"></span>=== HDMI to VGA display test === <ol style="textlist-style-aligntype: leftdecimal;"|><li><p>First you need to prepare the following accessories</p>| <ol style="textlist-style-aligntype: leftlower-alpha;"|>|-<li>HDMI to VGA converter</li>| '''269'''| '''PI13'''[[File:zero2w-img144.png]]| '''PWM3'''</ol>| '''7'''<ol start="2" style="list-style-type: lower-alpha;">|<li>A VGA cable and a Mini HDMI male to HDMI female adapter</li>| '''8'''| '''UART0_TX'''[[File:zero2w-img145.png]] [[File:zero2w-img146.png]]| '''PH0'''</ol>| '''224'''|-| <ol start="3" style="textlist-style-aligntype: leftlower-alpha;"|><li>A monitor or TV that supports VGA interface</li></ol></li></ol> | <ol start="2" style="textlist-style-aligntype: leftdecimal;"|>| '''GND'''<li>HDMI to VGA display test is as follows</li>| '''9'''|[[File:zero2w-img313.png]]| '''10'''{| '''UART0_RX'''| '''PH1'''| '''225'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big>'''226When using HDMI to VGA display, the development board and the Android system of the development board do not need to make any settings. You only need the Mini HDMI interface of the development board to display normally. So if there is a problem with the test, please check whether there is a problem with the HDMI to VGA converter, VGA cable and monitor.'''</big>| }</ol><span id="wi-fi-connection-method"></span> == WI-FI connection method == # Choose first '''PH2Settings'''| ::[[File:zero2w-img306.png]] <ol start="2" style="list-style-type: decimal;"><li>Then select '''UART5_TXNetwork &amp; Internet'''</li> [[File:zero2w-img314.png]]</ol><ol start="3" style="list-style-type: decimal;"><li>Then turn on WI-FI</li>| '''11'''|[[File:zero2w-img315.png]]| '''12'''</ol>| <ol start="4" style="textlist-style-aligntype: leftdecimal;"|>| <li>After turning on WI-FI, you can see the searched signals under '''PI1Available networks'''.</li> [[File:zero2w-img316.png]]| '''257'''</ol>|<ol start="5" style="list-style-type: decimal;">| '''227'''<li>After selecting the WI-FI you want to connect to, the password input interface shown below will pop up.</li>| '''PH3'''| '''UART5_RX'''<div class="figure">| '''13'''|[[File:zero2w-img317.png]]| '''14'''| '''GND'''</div></ol>| <ol start="6" style="textlist-alignstyle-type: leftdecimal;"|><li>Then use the keyboard to enter the password corresponding to the WI-FI, and then use the mouse to click the Enter button on the virtual keyboard to start connecting to the WI-FI.</li> <div class="figure"> [[File:zero2w-img318.png]] </div></ol>| <ol start="7" style="textlist-alignstyle-type: leftdecimal;"|><li>The display after successful WI-FI connection is as shown below</li> [[File:zero2w-img319.png]]</ol><span id="how-to-use-wi-fi-hotspot"></span> |== How to use WI-FI hotspot ==| '''261'''| '''PI5'''# First, please make sure that the Ethernet port is connected to the network cable and can access the Internet normally.| # Then select '''UART2_TXSettings'''| '''15'''|::[[File:zero2w-img306.png]]| '''16'''| '''PWM4'''<ol start="3" style="list-style-type: decimal;">| <li>Then select '''PI14Network &amp; Internet'''</li>| '''270'''|[[File:zero2w-img314.png]]</ol>| style<ol start="text-align: left;4"|| style="textlist-style-aligntype: leftdecimal;"|>| <li>Then select '''3.3VWIFI hotspot'''</li>| '''17'''|[[File:zero2w-img320.png]]| '''18'''</ol>| <ol start="5" style="textlist-style-aligntype: leftdecimal;"|>| <li>Then open '''PH4Hotspot Enable'''. You can also see the name and password of the generated hotspot in the picture below. Remember them and use them when connecting to the hotspot (if you need to modify the name and password of the hotspot, you need to close Hotspot Enable first. Then you can modify it)</li> [[File:zero2w-img321.png]]| '''228'''</ol>|<ol start="6" style="list-style-type: decimal;">| <li>At this time, you can take out your mobile phone. If everything is normal, you can find the WIFI hotspot with the same name ('''231here AndroidAP_7132'''| ) shown under the '''PH7Hotspot name'''| in the picture above in the WI-FI list searched by the mobile phone. Then you can click AndroidAP_7132 to connect to the hotspot. The password can be seen under the '''SPI1_MOSIHotspot password'''in the picture above.</li> | [[File:zero2w-img322.png]]</ol><ol start="7" style="list-style-type: decimal;"><li>After the connection is successful, it will be displayed as shown below (the interface will be different on different mobile phones, the specific interface is subject to the one displayed on your mobile phone). At this time, you can open a web page on your mobile phone to see if you can access the Internet. If the web page can be opened normally, it means that the '''19WI-FI Hotspot'''of the development board can be used normally.</li>|| '''20'''[[File:zero2w-img323.png]]| '''GND'''</ol>| style<span id="texthow-to-check-the-ip-address-of-the-ethernet-alignport"></span> == How to check the IP address of the Ethernet port == # There is no wired network interface on the main board of the development board. We can expand the 100M Ethernet through a 24pin expansion board. : left;:[[File:zero2w-img107.png]] <ol start="2"|| style="textlist-alignstyle-type: leftdecimal;"|>|-<li><p>Then make sure the network port of the expansion board is connected to the router or switch</p></li>| <li><p>Then open '''232Settings'''</p>| <p>[[File:zero2w-img324.png]]</p></li><li><p>Then select '''PH8Network &amp; Internet'''</p>| '''SPI1_MISO''<p>[[File:zero2w-img325.png]]</p></li><li><p>Then you can see the IP address of the development board's wired network port at the location shown in the picture below.</p><p>[[File:zero2w-img326.png]]</p></li></ol> <span id="bluetooth-connection-method"></span> == Bluetooth connection method == | # Choose first '''21Settings'''|| ::[[File:zero2w-img306.png]] <ol start="2" style="list-style-type: decimal;"><li>Then select '''22Bluetooth'''</li> [[File:zero2w-img327.png]]</ol><ol start="3" style="list-style-type: decimal;">| <li>Then Open '''UART2_RXBluetooth Enable'''</li>| [[File:zero2w-img328.png]]</ol><ol start="4" style="list-style-type: decimal;"><li>Then click '''PI6Pair new device'''to start scanning for surrounding Bluetooth devices</li>| '''262'''|[[File:zero2w-img329.png]]| '''230'''</ol>| '''PH6'''<ol start="5" style="list-style-type: decimal;">| <li>The searched Bluetooth devices will be displayed under '''SPI1_CLKAvailable devices'''</li>| '''23'''|[[File:zero2w-img330.png]]| '''24'''</ol>| '''SPI1_CS0'''<ol start="6" style="list-style-type: decimal;">| <li>Then click on the Bluetooth device you want to connect to start pairing. When the following interface pops up, please use the mouse to select the '''PH5Pair'''option</li>| '''229'''|[[File:zero2w-img331.png]]</ol>| <ol start="7" style="textlist-alignstyle-type: leftdecimal;"|><li>What is tested here is the Bluetooth configuration process between the development board and the Android phone. At this time, the following confirmation interface will pop up on the phone. Click the pairing button on the phone to start the pairing process.</li> [[File:zero2w-img332.png]]</ol>| <ol start="8" style="textlist-style-aligntype: leftdecimal;"|>| <li>After pairing is completed, open '''GNDPaired devices'''and you will see the paired Bluetooth devices.</li> [[File:zero2w-img333.png]]| </ol><ol start="9" style="list-style-type: decimal;"><li>At this time, you can use the Bluetooth of your mobile phone to send a picture to the development board. After sending, you can see the following confirmation interface in the Android system of the development board, and then click '''25Accept'''to start receiving the pictures sent by the mobile phone.</li> [[File:zero2w-img334.png]]|</ol><ol start="10" style="list-style-type: decimal;">| <li>Pictures received by the Bluetooth system of the development board Android system can be viewed in '''26Received files'''.</li> [[File:zero2w-img335.png]]</ol><span id="how-to-set-usb0-to-host-mode-1"></span> == How to set USB0 to HOST mode == As shown in the figure below, there are two Type-C interfaces on the motherboard of the development board: USB0 and USB1. Both of these interfaces can be used to power the development board, and they can also be used as USB2.0 HOST interfaces. The difference between USB0 and USB1 is that in addition to being set to HOST mode, USB0 can also be set to Device mode, while USB1 only has HOST mode. [[File:zero2w-img160.png]] USB0 of the Android12 TV system released by Orange Pi is set to Device mode by default, so when there is no need to use USB0 Device mode (ADB function needs to ensure that USB0 is in Device mode), it is recommended to use USB0 for power supply, so that USB1 can be directly used to connect USB devices .| '''SPI1_CS1'''| '''PH9'''If you want to use USB0 to connect USB devices, you need to set USB0 to HOST mode. The method is as follows: <ol style="list-style-type: lower-alpha;"><li>Run the following command to set USB0 to HOST mode:</li>{| '''233'''class="wikitable" style="width:800px;"
|-
| apollo-p2:/ # '''266cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_host'''| '''PI10'''| '''TWI2host_chose finished! apollo-SDA'''p2:/ #| '''27'''}|</ol>| '''28'''| '''TWI2<ol start="2" style="list-style-type: lower-SCL'''alpha;">| '''PI9'''<li>Run the following command to switch back to Device mode</li>{| '''265'''class="wikitable" style="width:800px;"
|-
| apollo-p2:/ # '''256cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_device'''| '''PI0'''| style="textdevice_chose finished! apollo-alignp2: left;"|/ #| '''29'''}|</ol>| '''30'''| '''GND'''| <ol start="3" style="textlist-alignstyle-type: leftlower-alpha;"|><li>The command to view the current mode of USB0 is</li>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| apollo-p2:/ # '''271cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/otg_role''' usb_host| '''PI15'''}</ol>| style<span id="texthow-to-use-usb-align: left;camera"|></span> | '''31'''== How to use USB camera ==|| '''32'''# First insert the USB (UVC protocol) camera into the USB interface of the development board| '''PWM1'''# If the USB camera is recognized normally, the corresponding video device node will be generated under /dev| '''PI11'''::{| '''267'''class="wikitable" style="width:800px;"
|-
| '''268'''| '''PI12'''| '''PWM2'''| '''33'''|| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''258'''| '''PI2'''| style="text-align: left;"|| '''35'''|| '''36'''| style="text-alignconsole: left;"|| / # '''PC12ls /dev/video0'''| '''76'''|-| '''272'''| '''PI16'''| style="text-align: left;"|| '''37'''|| '''38'''| style="text-align: left;"|| '''PI4'''| '''260'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''39'''|| '''40'''| style="text-align: left;"|| '''PI3'''| '''259'''/dev/video0
|}
<ol start="23" style="list-style-type: decimal;"><li>The device node corresponding <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 &quot;[[Orange Pi Zero 2W#How to i2c1 is use ADB|'''/dev/i2c-1How to use ADB''', and ]]&quot;.</p></li><li><p>Download the USB camera test APP from the device node corresponding to i2c2 is '''/dev/i2c-2official tool'''on the development board information download page</lip></olli>
apollo-p2:/ # '''ls /dev/i2c-*'''<div class="figure">
'''/dev/i2c[[File:zero2w-1 /dev/i2c-2''' /dev/i2c-5img336.png]]
<ol start="3" style/div><div class="list-style-type: decimal;figure"><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-img370img337.png]]
</div></ol>
<ol start="5" style="list-style-type: decimal;">
<li>The i2c Then use the adb command to install the USB camera test interface of wiringOP is shown in APP into the figure belowAndroid system. Of course, you can also use a USB disk copy to install it.</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''adb install usbcamera.apk'''|}</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-img371img338.png]]</ol><ol start="7" style="list-style-type: decimal;"><li>Then double-click to open the USB camera APP and you can see the output video of the USB camera.</li></ol> <span id="android-system-root-description"></span>
<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>Android system ROOT description ==
[[File{| class="wikitable" style="background-color:#ffffdc;width:zero2w800px;" |-img372| <big>'''The Android system released by Orange Pi has been ROOT and can be tested using the following method.png]]'''</big>|}
<ol start="7" style="list-style-type: decimal;"><li>Then connect an i2c device to # Download from the 40pin i2c pin. Here we take '''official tool''' on the ds1307 rtc module as an exampledevelopment board data download page '''rootcheck.</li></ol>apk'''
[[File:zero2w-img178.png]]<div class="figure">
<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 1'''</p><p>'''Or'''</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 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-img379img336.png]]</p></li></ol>
<span id/div><div class="pin-pwm-testfigure"></span>=== 40pin PWM test ===
# As can be seen from the table below, the available pwm are pwm1, pwm2, pwm3 and pwm4::[[File:zero2w-img339.png]]
</div><ol start="2" style="list-style-type: decimal;"><li><p>Then make sure that the adb connection between the Ubuntu PC and the development board is normal. For how to use adb, please refer to the instructions in the section &quot;[[Orange Pi Zero 2W#How to use ADB|'''How to use ADB''']]&quot;.</p></li><li><p>Then use the adb command to install rootcheck.apk into the Android system. Of course, you can also use a USB disk copy to install it.</p></li>{| class="wikitable" style="width:800px;"
|-
| '''GPIO serial number'''| test@test:~$ '''GPIOadb install rootcheck.apk'''| '''Function'''}| '''pin'''</ol>|<ol start="4" style="list-style-type: decimal;">| '''pin'''| '''Function'''<li>After installation, you can see the startup icon of the ROOT test tool on the Android desktop.</li>| '''GPIO'''| '''GPIO serial number'''[[File:zero2w-img340.png]]|-</ol>| style<ol start="text-align: left;5"|| style="textlist-style-aligntype: leftdecimal;"|| '''3.3V'''>| <li>The display interface after opening the '''1ROOT test tool'''for the first time is as shown below</li>|| '''2'''[[File:zero2w-img341.png]]| '''5V'''</ol>| style<ol start="text-align: left;6"|| style="textlist-style-aligntype: leftdecimal;"||->| <li>Then you can click '''264CHECK 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>| '''PI8'''| '''TWI1[[File:zero2w-SDA'''img342.png]]</ol>| '''3'''<span id="how-to-use-miracastreceiver-to-cast-the-mobile-phone-screen-to-the-development-board"></span>|| '''4'''== How to use MiracastReceiver to cast the mobile phone screen to the development board ==| '''5V'''| <ol style="textlist-align: left;"|| style="text-aligntype: 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| '''263the instructions in the WI-FI connection method.''']]</p></li>| <li><p>Then open the '''PI7MiracastReceiver'''application in the Android system of the development board</p><p>[[File:zero2w-img343.png]]</p></li>| <li><p>The interface after '''TWI1-SCLMiracastReceiver'''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 '''5Xiaomi 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 '''6MiracastReceiver'''| application interface of the development board. Here we can select '''GNDAccept'''</p>| style<p>[[File:zero2w-img347.png]]</p></li><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="textmethod-of-turning-on-and-off-the-align: left;machine-through-buttons-or-infrared-remote-control"|></span> | style="text= 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-alignimg269.png]] The location of the infrared remote control power button is as follows: left;"||[[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 '''269OK'''to shut down the Android system. | '''PI13'''[[File:zero2w-img350.png]]| '''PWM3'''| '''7'''After shutting down, press and hold the power button or the power button on the infrared remote control again to turn it on.|| '''8'''<span id="pin-interface-gpio-uart-spi-test"></span>| '''UART0_TX'''== 40pin interface GPIO, UART, SPI test ==| '''PH0'''{| '''224'''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 '''GNDCheckBox'''| buttons on the left have a one-to-one correspondence with the 40pin pins. When the '''9CheckBox'''|| button is checked, the corresponding GPIO pin will be set to '''10OUT'''| 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 '''UART0_RXGPIO READALL'''| button, you can get information such as wPi number, GPIO mode, pin level, etc.; when you click the'''PH1BLINK 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 '''225GPIO 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 '''226CheckBox'''| 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 '''PH23.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 '''UART5_TXGPIO READALL'''| button and you can see that the current pin 12 mode is '''11OUT'''and the pin level is high level.</li> [[File:zero2w-img356.png]]</ol>|<ol start="7" style="list-style-type: decimal;">| <li>Click the '''CheckBox'''button in the picture below again to uncheck it, and pin 12will 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> [[File:zero2w-img357.png]]</ol>| <ol start="8" style="textlist-style-aligntype: leftdecimal;"|>| <li>Then click the '''PI1GPIO 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;">::{| '''257'''class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''227GPIO NO.'''| '''PH3GPIO'''| '''UART5_RXFunction'''| '''13'''|| '''14'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''261'''| '''PI5'''| '''UART2_TX'''| '''15'''|| '''16'''| '''PWM4'''| '''PI14'''| '''270Pin'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''171'''|-| '''18264'''| '''PI8'''| '''TWI1-SDA'''| '''3'''|-| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|-| '''269'''| '''PI13'''| '''PWM3'''| '''7'''|-| 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;"|
| '''PH43.3V'''| '''22817'''
|-
| '''231'''
| '''SPI1_MOSI'''
| '''19'''
|
| '''20'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''232'''
| '''SPI1_MISO'''
| '''21'''
|
| '''22'''
| '''UART2_RX'''
| '''PI6'''
| '''262'''
|-
| '''230'''
| '''SPI1_CLK'''
| '''23'''
|
| '''24'''
| '''SPI1_CS0'''
| '''PH5'''
| '''229'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|
| '''26'''
| '''SPI1_CS1'''
| '''PH9'''
| '''233'''
|-
| '''266'''
| '''TWI2-SDA'''
| '''27'''
|
| '''28'''
| '''TWI2-SCL'''
| '''PI9'''
| '''265'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|
| '''30'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|
| '''32'''
| '''PWM1'''
| '''PI11'''
| '''267'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''PC12'''
| '''76'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|-| style="text-align: left;"|| style="text-align: left;"|| '''38GND'''| '''39'''|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| '''4'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''6'''
| '''GND'''
| '''39'''
|
| '''40'''
| style="text-align: left;"|
| style="text-align: left;"||-| '''8'''PI3| '''UART0_TX'''| '''PH0'''| '''224'''|-| '''10'''| '''UART0_RX'''| '''PH1'''| '''259225'''|}-| '''12'''<ol start| style="2text-align: left;" || '''PI1'''| '''257'''|-| '''14'''| '''GND'''| style="listtext-align: left;"|| style="text-typealign: decimalleft;">||-| '''16'''| '''PWM4'''<li>First click the wiringOP icon to open wiringOP APP</li></ol>| '''PI14'''| '''270'''[[File:zero2w|-img351.png]]| '''18'''<ol start="3" | style="listtext-style-typealign: decimalleft;">|<li>Then click the | '''PWM_TESTPH4''' button on the main interface of wiringOP to enter the PWM test interface</li></ol>| '''228'''[[File:zero2w|-img380.png]]| '''20'''<ol start| '''GND'''| style="4text-align: left;" || style="list-styletext-typealign: decimalleft;">||-| '''<lispan style="color:#FF0000">The PWM test interface is as follows22</li></olspan>''' | '''<div classspan style="figurecolor:#FF0000"> [[File:zero2w-img381.png]] UART2_RX</divspan>'''| '''<ol start="5" span style="list-style-typecolor: decimal;#FF0000"><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.PI6</li></olspan>''' [[File:zero2w-img382.png]] | '''<ol start="6" span style="list-style-typecolor: decimal;#FF0000">262<li/span>Then you can set the PWM period. The default configuration is '''50000ns|-| '''24'''| '''SPI1_CS0''. The converted PWM frequency is '| ''20KHz'PH5'''</li></ol>| '''229'''[[File:zero2w|-img383.png]]| '''26'''<ol start="7" style="list| '''SPI1_CS1'''| '''PH9'''| '''233'''|-style| '''28'''| '''TWI2-type: decimal;">SCL'''<li>Then click the | '''EXPORTPI9'''button to export PWM</li></ol>| '''265'''[[File:zero2w|-img384.png]]| '''30'''<ol start| '''GND'''| style="8text-align: left;" || style="list-styletext-typealign: decimalleft;">||-| '''32'''| '''PWM1'''<li>Then drag the progress bar below to change the PWM duty cycle, and then check | '''EnablePI11''' to output the PWM waveform.</li></ol>| '''267'''[[File:zero2w|-img385.png]]| '''34'''| '''GND'''<ol start="9" | style="list-styletext-typealign: decimalleft;">|<li>Then use an oscilloscope to measure the corresponding pins in the 40pin development board and you can see the following waveform.</li></ol> [[File:zero2w-img386.png]] <span id| style="howtext-to-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>|== Download the source code of Android 12 ==| '''PC12'''| '''76'''<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>| '''38'''<ol | style="listtext-style-typealign: lower-alphaleft;">|<li>Google Cloud Drive</li></ol>| '''PI4'''</li></ol>| '''260''' [[File:zero2w|-img387.png]]| '''40'''<ol start="2" | style="list-styletext-typealign: decimalleft;">|| '''PI3'''<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| '''259'''s how to check the MD5 checksum:|}</li></oldiv>
test@test<ol start="2" style="list-style-type:~$ decimal;"><li>The device node corresponding to uart2 is '''/dev/ttyAS2''md5sum ', and the device node corresponding to uart5 is'''/dev/ttyAS5'''</li>{| class="wikitable" style="width:800px;" |-c H618| <p>apollo-Android12-Src.tar.gz.md5sump2:/ # ls /dev/ttyAS*</p><p>/dev/ttyAS0 &nbsp;&nbsp;&nbsp;&nbsp; /dev/ttyAS1 &nbsp;&nbsp;&nbsp;&nbsp; '''<span style="color:#FF0000">/dev/ttyAS2 &nbsp;&nbsp;&nbsp;&nbsp; /dev/ttyAS5</span>'''</p>|}</ol><ol start="3" style="list-style-type: decimal;"><li>First open wiringOP APP on the desktop</li>
H618[[File:zero2w-Android12img351.png]]</ol><ol start="4" style="list-Src.tar.gzaastyle-type: decimal;"><li>Then click the '''OKUART_TEST'''button to open the UART test interface</li>
H618[[File:zero2w-Android12img359.png]]</ol><ol start="5" style="list-Src.tar.gzabstyle-type: '''OK'''decimal;"><li>The serial port test interface of wiringOP is as shown in the figure below</li>
[[File:zero2w-img360.png]]</ol><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>
[[File:zero2w-img362.png]]</ol><ol start="38" 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 need to merge multiple compressed files into one, can enter a paragraph of characters in the send edit box below and then extract click the Android source code'''SEND''' button to start sending. The command looks like this:</lip></olli>
test@test[[File:~$ '''cat H618zero2w-Android12-Src.tarimg363.gza* &gt; H618png]]</ol><ol start="10" style="list-Android12style-Src.tar.gz'''type: decimal;"><li>If everything is normal, the received string will be displayed in the receiving box</li>
test@test[[File:~$ '''tar zero2w-xvf H618img364.png]]</ol><span id="pin-Android12spi-Src.tar.gz'''test-method"></span>
<ol start="4" style="list-style-type: decimal;"><li>Then unzip the compressed package of the files modified by Orange Pi Zero2w</li></ol>= 40pin SPI test method ===
test@test:~$ '''tar zxf opizero2w_android12_patches.tar.gz'''# 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
test@test<div style="display: flex;">::{| class="wikitable" style="width:~$ 390px;margin-right: 20px;text-align: center;"|-| '''GPIO NO.'''| '''lsGPIO'''| '''Function'''| '''opizero2w_android12_patchesPin''' opizero2w_android12_patches.tar.gz|-<ol start| style="5text-align: left;" || style="list-styletext-typealign: decimalleft;">|| '''3.3V'''| '''1'''|-<li>Then copy the files modified by Orange Pi Zero2w to the Android source code</li></ol>| '''264'''| '''PI8'''test@test:~$ | '''cp TWI1-rf opizero2w_android12_patches/* H618SDA'''| '''3'''|-| '''263'''| '''PI7'''| '''TWI1-Android12SCL'''| '''5'''|-Src/| '''269'''| '''PI13'''| '''PWM3'''| '''7'''|-<span id| style="compiletext-thealign: left;"|| style="text-sourcealign: left;"|| '''GND'''| '''9'''|-code| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|-of| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-android-12"></span>== Compile the source code of Android 12 ==| '''261'''| '''PI5'''| '''Android12 is compiled on an x86_64 computer with Ubuntu 22.04 installed. Other versions of Ubuntu system package dependencies may have some differences. The image download address of the Ubuntu 22.04 amd64 version is as follows:UART2_TX'''| '''15'''[https://repo.huaweicloud.com/ubuntu|-releases/22.04/ubuntu| style="text-22.04.2align: left;"|| style="text-desktop-amd64align: left;"|| '''3.iso 3V'''| '''17'''https://repo.huaweicloud.com/ubuntu|-releases/22.04/ubuntu-22.04.2-desktop-amd64.iso| '''231''']| '''PH7'''| '''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.SPI1_MOSI'''| '''19'''# First install the software packages needed to compile Android12 source code|-| '''232'''test@test:~$ | '''sudo apt-get updatePH8'''| '''SPI1_MISO'''test@test:~$ | '''21'''sudo apt|-get install -y git gnupg flex bison gperf build-essential \| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''zip curl zlib1g23'''|-dev gcc| style="text-multilib g++align: left;"|| style="text-multilib libc6align: left;"|| '''GND'''| '''25'''|-dev-i386 \| '''266'''| '''PI10'''| '''lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1TWI2-dev ccache \SDA''' | '''libgl1-mesa-dev libxml2-utils xsltproc unzip u-boot-tools python-is-python3 \27'''|-| '''libssl-dev libncurses5 clang gawk256'''| '''PI0'''<ol start="2" | style="listtext-style-typealign: decimalleft;">|| '''29'''<li><p>Then compile the code in the longan folder, which mainly contains u|-boot and linux kernel</p><ol | '''271'''| '''PI15'''| style="list-styletext-typealign: lower-alphaleft;">|<li>First run | '''./build.sh config31''' to set compilation options</li></ol></li></ol>|-| '''268'''| '''PI12'''test@test:~$ | '''cd H618-Android12-Src/longanPWM2'''| '''33'''test@test:~/H618|-Android12-Src/longan$ | '''258'''| '''./build.sh configPI2'''| style="text-align: left;"|Welcome to mkscript setup progress| '''35'''|}All available platform{| class="wikitable" style="width:390px;margin-right:20px;text-align: center;"|-| '''Pin'''0. android| '''Function'''| '''GPIO'''1| '''GPIO NO. linux'''|-Choice [android]: | '''02'''| '''5V'''All available ic| style="text-align:left;"|| style="text-align: left;"|0. h618|-| '''4'''Choice [h618]: | '''05V'''| style="text-align: left;"|All available board| style="text-align:left;"||-| '''6'''0. ft| '''GND'''| style="text-align: left;"|1. p1| style="text-align: left;"||-2. p2| '''8'''| '''UART0_TX'''| '''PH0'''3. p7| '''224'''|-4. p7l| '''10'''| '''UART0_RX'''5. perf1| '''PH1'''| '''225'''6. perf2|-| '''12'''7. perf3| style="text-align: left;"|| '''PI1'''8. qa| '''257'''|-Choice [p2]: | '''214'''| '''GND'''All available flash| style="text-align:left;"|| style="text-align: left;"|0. default|-| '''16'''1. nor| '''PWM4'''| '''PI14'''Choice [default]: | '''0270'''|-All available kern_ver| '''18'''| style="text-align:left;"|| '''PH4'''| '''228'''0. linux|-5.4| '''20'''Choice [linux-5.4]: | '''0GND'''| style="text-align: left;"|All available arch| style="text-align:left;"||-0. arm| '''22'''| '''UART2_RX'''1. arm64| '''PI6'''Choice [arm64]: | '''1262'''|-| '''......24'''| '''SPI1_CS0'''*** Default configuration is based on | '''PH5''sun50iw9p1smp_h618_android_defconfig'| '''229'''#|-| '''26'''# configuration written to .config| '''SPI1_CS1'''| '''PH9'''#| '''233'''|-make[1]: Leaving directory | '''28''/home/test/H618-Android12-Src/longan/out/kernel/buildmake: Leaving directory | '''/home/test/H618TWI2-Android12-Src/longan/kernel/linux-5.4SCL'''| '''PI9'''INFO: clean buildserver| '''265'''|-INFO: prepare_buildserver| '''30'''| '''GND'''<ol start| style="2text-align: left;" || style="listtext-style-typealign: lower-alphaleft;">||-| '''32'''| '''PWM1'''<li>Then run the | '''./build.shPI11''' script to start compilation.</li></ol>| '''267'''test@test:~/H618|-Android12-Src/longan$ | '''./build.sh34'''| '''GND'''<ol start| style="3text-align: left;" || style="list-styletext-typealign: lower-alphaleft;">|<li>After compilation is completed, you will see the following output</li></ol>|-| '''36'''sun50iw9p1 compile Kernel successful INFO| style="text-align: Prepare toolchain ...left;"|| '''PC12'''| '''......76'''|}</div>
INFO<ol start="2" style="list-style-type: build kernel OKdecimal;"><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:/ # '''ls /dev/spidev1.*'''
INFO'''<span style="color: build rootfs #FF0000">/dev/spidev1.0 &nbsp;&nbsp;&nbsp;&nbsp; /dev/spidev1.1</span>'''|}</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 the SPI1 interface.</li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''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.'''</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''', if the w25qxx module is connected to the 40pin spi1 cs1, then please select '''/dev/spidev1.1'''</p><div class="figure">INFO[[File: skip make rootfs for androidzero2w-img366.png]] </div></li><li><p>Then click the '''OPEN''' 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 '''TRANSFER''' 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>
INFO: ----------------------------------------=== 40pin I2C test method ===
INFO: build lichee OK# As can be seen from the table below, the Android12 TV system has i2c1 and i2c2 turned on by default.
INFO<div style="display: flex;">::{| class="wikitable" style="width: 390px;margin-right: 20px;text-align: center;"|-| '''GPIO NO.'''| '''GPIO'''| '''Function'''| '''Pin'''|-| style="text-align: left;"|| style="text-----------------------------------align: left;"|| '''3.3V'''<ol start="3" | '''1'''|-| '''<span style="list-style-typecolor: decimal;#FF0000">264</span>'''| '''<lispan style="color:#FF0000">Then use the following command to compile the Android source code and generate the final Android imagePI8</lispan></ol> test@test:~$ '''cd H618-Android12-Src| ''' test@test<span style="color:~#FF0000">TWI1-SDA</H618-Android12-Src$ span>'''source build/envsetup.sh| ''' test@test<span style="color:~#FF0000">3</H618-Android12-Src$ span>'''lunch apollo_p2|-userdebug| ''' test@test<span style="color:~#FF0000">263</H618-Android12-Src$ span>'''| ''make -j8''' test@test<span style="color:~#FF0000">PI7</H618-Android12-Src$ span>'''pack| ''' <ol startspan style="4color:#FF0000" >TWI1-SCL</span>'''| '''<span style="list-style-typecolor: decimal;#FF0000">5<li><p>The storage path of the Android image generated by compilation is:</p/span>'''|-<p>| '''longan/out/h618_android12_p2_uart0.img269'''</p></li></ol>| '''PI13'''<span id="appendix"></span>| '''PWM3'''= | '''Appendix7''' =|-<span id| style="usertext-manual-update-historyalign: left;"></span>|| 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== User manual update history =="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>'''| '''<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'''| '''PI16'''| style="text-align: left;"|| '''37'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''39'''|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''6'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''8'''| '''UART0_TX'''| '''PH0'''| '''224'''|-| '''10'''| '''UART0_RX'''| '''PH1'''| '''225'''|-| '''12'''| style="text-align: left;"|| '''PI1'''| '''257'''|-| '''14'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''16'''| '''PWM4'''| '''PI14'''| '''270'''|-| '''18'''| style="text-align: left;"|| '''PH4'''| '''228'''|-| '''20'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''22'''| '''UART2_RX'''| '''PI6'''| '''262'''|-| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''<span style="color:#FF0000">28</span>'''| '''<span style="color:#FF0000">TWI2-SCL</span>'''| '''<span style="color:#FF0000">PI9</span>'''| '''<span style="color:#FF0000">265</span>'''|-| '''30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''32'''| '''PWM1'''| '''PI11'''| '''267'''|-| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''36'''| style="text-align: left;"|| '''PC12'''| '''76'''|-| '''38'''| style="text-align: left;"|| '''PI4'''| '''260'''|-| '''40'''| style="text-align: left;"|| '''PI3'''| '''259'''|}</div> <ol start="2" style="list-style-type: decimal;"><li>The device node corresponding to i2c1 is '''/dev/i2c-1''', and the device node corresponding to i2c2 is '''/dev/i2c-2'''</li>{| class="wikitable" style="width:800px;" |-| apollo-p2:/ # '''ls /dev/i2c-*''' '''<span style="color:#FF0000">/dev/i2c-1 &nbsp;&nbsp;&nbsp;&nbsp; /dev/i2c-2</span>''' &nbsp;&nbsp;&nbsp;&nbsp; /dev/i2c-5|}</ol><ol start="3" style="list-style-type: decimal;"><li>First open wiringOP APP on the desktop</li> [[File:zero2w-img351.png]]</ol><ol start="4" style="list-style-type: decimal;"><li>Then click the '''I2C_TEST''' button to open the i2c test interface</li> [[File:zero2w-img370.png]]</ol><ol start="5" style="list-style-type: decimal;"><li>The i2c test interface of wiringOP is shown in the figure below</li> [[File:zero2w-img371.png]]</ol><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> [[File:zero2w-img372.png]]</ol><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> [[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 '''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>{| 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.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 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> <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. <div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''GPIO NO.'''| '''GPIO'''| '''Function'''| '''Pin'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''1'''|-| '''264'''| '''PI8'''| '''TWI1-SDA'''| '''3'''|-| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|-| '''<span style="color:#FF0000">269</span>'''| '''<span style="color:#FF0000">PI13</span>'''| '''<span style="color:#FF0000">PWM3</span>'''| '''<span style="color:#FF0000">7</span>'''|-| 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'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''25'''|-| '''266'''| '''PI10'''| '''TWI2-SDA'''| '''27'''|-| '''256'''| '''PI0'''| style="text-align: left;"|| '''29'''|-| '''271'''| '''PI15'''| style="text-align: left;"|| '''31'''|-| '''<span style="color:#FF0000">268</span>'''| '''<span style="color:#FF0000">PI12</span>'''| '''<span style="color:#FF0000">PWM2</span>'''| '''<span style="color:#FF0000">33</span>'''|-| '''258'''| '''PI2'''| style="text-align: left;"|| '''35'''|-| '''272'''| '''PI16'''| style="text-align: left;"|| '''37'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''39'''|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''6'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''8'''| '''UART0_TX'''| '''PH0'''| '''224'''|-| '''10'''| '''UART0_RX'''| '''PH1'''| '''225'''|-| '''12'''| style="text-align: left;"|| '''PI1'''| '''257'''|-| '''14'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''<span style="color:#FF0000">16</span>'''| '''<span style="color:#FF0000">PWM4</span>'''| '''<span style="color:#FF0000">PI14</span>'''| '''<span style="color:#FF0000">270</span>'''|-| '''18'''| style="text-align: left;"|| '''PH4'''| '''228'''|-| '''20'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''22'''| '''UART2_RX'''| '''PI6'''| '''262'''|-| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''28'''| '''TWI2-SCL'''| '''PI9'''| '''265'''|-| '''30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''<span style="color:#FF0000">32</span>'''| '''<span style="color:#FF0000">PWM1</span>'''| '''<span style="color:#FF0000">PI11</span>'''| '''<span style="color:#FF0000">267</span>'''|-| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''36'''| style="text-align: left;"|| '''PC12'''| '''76'''|-| '''38'''| style="text-align: left;"|| '''PI4'''| '''260'''|-| '''40'''| style="text-align: left;"|| '''PI3'''| '''259'''|}</div> <ol start="2" style="list-style-type: decimal;"><li>First click the wiringOP icon to open wiringOP APP</li> [[File:zero2w-img351.png]]</ol><ol start="3" style="list-style-type: decimal;"><li>Then click the '''PWM_TEST''' button on the main interface of wiringOP to enter the PWM test interface</li> [[File:zero2w-img380.png]]</ol><ol start="4" style="list-style-type: decimal;"><li>The PWM test interface is as follows</li> <div class="figure"> [[File:zero2w-img381.png]] </div></ol><ol start="5" style="list-style-type: decimal;"><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> [[File:zero2w-img382.png]]</ol><ol start="6" style="list-style-type: decimal;"><li>Then you can set the PWM period. The default configuration is '''50000ns'''. The converted PWM frequency is '''20KHz'''</li> [[File:zero2w-img383.png]]</ol><ol start="7" style="list-style-type: decimal;"><li>Then click the '''EXPORT'''button to export PWM</li> [[File:zero2w-img384.png]]</ol><ol start="8" style="list-style-type: decimal;"><li>Then drag the progress bar below to change the PWM duty cycle, and then check '''Enable''' to output the PWM waveform.</li> [[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>* &gt; 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>{| 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'''|-| style="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
{| class="wikitable"
|-
| '''Version'''
| '''Date'''
| '''Release Notes'''
|-
| v1.0
| 2023-09-14
| initial version
|}
 
<span id="image-update-history"></span>
== Image update history ==
 
{| class="wikitable"
|-
| '''Date'''
 
| '''Release Notes'''
|-
| 202 3-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

Navigation menu