Open main menu

Wiki-Orange Pi β

Changes

Orange Pi Zero 2W

30,632 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;"
# 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>'''| '''<span style="color:#FF0000">19</span>'''|-| '''20<span style="color:#FF0000">232</span>'''| '''GND<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;"|
|-| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''TWI0_SDA/UART2_RX'''| '''PI6'''| '''262'''|-| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| style="text-align: left;"|| 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'''
| 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'''| styleclass="text-align: left;wikitable"|| '''PI3'''| '''259'''|} <ol style="list-style-typewidth: decimal390px;"><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-stylemargin-typeright: lower-alpha20px;"><li><p>First run '''orangepitext-config'''. Ordinary users remember to add &gt; '''sudo''' permissions.</p><p>orangepi@orangepialign:~$ '''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 &gtcenter; 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 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'''
|}
 
[[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 FF''' 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 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 '''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></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序号'''
| '''GPIO'''
| '''Function'''
| '''pin'''
|
| '''pin'''
| '''Function'''
| '''GPIO NO.'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''1'''|| '''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'''
| '''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>i2c In Linux systems, spi1 is turned off by default in Linux systems and needs to be turned on manually to use before itcan be used. The opening steps are as follows: </p>
<ol style="list-style-type: lower-alpha;">
<li><p>First run '''orangepi-config'''. Ordinary users remember to add &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; corresponding i2c dtbo configuration in of the picture belowSPI you want to open.</p></li></ol></li></ol>
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''Multiplexing function in 40pindtbo configuration'''| '''Corresponding dtbo configurationillustrate'''
|-
| '''40pin spi1- i2c0cs0-cs1-spidev'''| '''pi-i2c0Open cs0 and cs1 of spi1 at the same time'''
|-
| '''40pin spi1- i2c1cs0-spidev'''| '''pi-i2c1Only open cs0 of spi1'''
|-
| '''40pin spi1- i2c2cs1-spidev'''| '''pi-i2c2Only open cs1 of spi1'''
|}
[[File:zero2w-img173img172.png]]</ol>
<ol start="5" style="list-style-type: lower-alpha;">
<li><p>Then select <span class="mark">'''&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>
</li></ol>
<ol start="2" style="list-style-type: decimal;">
<li><p>Then check whether there is a '''spidev1.x''' device node in the Linux system. If it exists, it means that the SPI1 configuration has taken effect.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''ls /dev/spidev1*'''</p>
<p>/dev/spidev1.0 /dev/spidev1.1</p>
|}
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|
<big><p>'''Note that only when you open spi1-cs0-cs1-spidev, you will see the device nodes of the two spi.'''</p></big>
|}
</li>
<li><p>Next, start the spi loopback test. Do not short-circuit the mosi and miso pins of SPI1 first. The output result of running spidev_test is as follows. You can see that the data of TX and RX are inconsistent.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo spidev_test -v -D /dev/spidev1.0'''</p>
<p>spi mode: 0x0</p>
<p>bits per word: 8</p>
<p>max speed: 500000 Hz (500 KHz)</p>
<p>TX | FF FF FF FF FF FF '''<span style="color:#FF0000">40 00 00 00 00 95</span>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p>
<p>RX | FF FF FF FF FF FF '''<span style="color:#FF0000">FF FF FF FF FF FF</span>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF | ............................….</p>
|}
</li>
<li><p>Then short-circuit the two pins of SPI1 mosi (pin 19 in the 40pin interface) and miso (pin 21 in the 40pin interface) and then run spidev_test. The output is as follows. You can see the sending and receiving The data is the same, indicating that the loopback test passed.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo spidev_test -v -D /dev/spidev1.0'''</p>
<p>spi mode: 0x0</p>
<p>bits per word: 8</p>
<p>max speed: 500000 Hz (500 KHz)</p>
<p>TX | FF FF FF FF FF FF '''<span style="color:#FF0000">40 00 00 00 00 95</span>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p>
<p>RX | FF FF FF FF FF FF '''<span style="color:#FF0000">40 00 00 00 00 95</span>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p>
|}
</li></ol>
<!-- --><ol start="3" stylespan id="list-style-type: decimal;"><li><p>After starting the Linux system, first confirm that there is an open i2c device node under /dev</p><p>orangepi@orangepi:~$ '''ls /dev/i2c-*'''</p><p>'''/dev/i2c-*'''</p><p>'''Sometimes the i2c device node and the i2c bus serial number do not correspond one to one. For example, the i2c device node of the i2c1 bus may be /dev/i2c-3.'''</p><p>'''The method to accurately confirm the device node under /dev corresponding to the i2c bus is: '''</p></li></ol> <!-- --><ol style="list-style-type: lower-alpha;"><li><p>'''First run the following command to check the corresponding relationship of i2c'''</p><p>orangepi@orangepizero2w:~$ '''ls /sys/devices/platform/soc*/*/i2c-* | grep &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/i2cpin-4:</p><p>/sys/devices/platform/soc/5002c00.i2c/i2c-5:</p><p>/sys/devices/platform/soc/6000000.hdmi/i2c-2:</p><p>/sys/devices/platform/soc/7081400.i2c/i2c-1:</p></li><li><p>'''In the above output'''</p></li></ol> <!-- --><ol style="list-style-type: lower-alpha;test"><li><p>5002000 is the register base address of the i2c0 bus, and i2c-0 shown behind it is its corresponding i2c device node</p></li><li><p>5002400 is the register base address of the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li><li><p>5002800 is the register base address of the i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p></li></olspan>
<!-- --><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 classI2C test ==="figure">
[[File:zero2w-img174.png]]# As can be seen from the table below, the i2c available for the 40pin interface are i2c0, i2c1 and i2c2
</div></li></ol> <span idstyle="pin-uart-testdisplay: flex;"></span>=== 40pin UART test === # As can be seen from the table below, the available uarts are uart2, uart3, uart4 and uart5. Please note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial port. ::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO NO.'''
| '''Function'''
| '''pin'''
|
| '''pin'''
| '''Function'''
| '''GPIO'''
| '''GPIO NO.'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-| '''2<span style="color:#FF0000">264</span>'''| '''5V<span style="color:#FF0000">PI8</span>'''| '''<span style="color:#FF0000">TWI1-SDA</span>'''| '''<span style="color:#FF0000">3</span>'''|-| '''<span style="color:#FF0000">263</span>'''| '''<span style="color:#FF0000">v</span>'''| '''<span style="color:#FF0000">TWI1-SCL</span>'''| '''<span style="color:#FF0000">5</span>'''|-| '''269'''| '''PI13'''| '''PWM3/UART4_TX'''| '''7'''|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''9'''
|-
| '''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'''| '''PH0'''| '''224'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''9'''|| '''10'''| '''UART0_RX'''| '''PH1'''| '''225'''|-| '''226'''| '''PH2'''
| '''UART5_TX'''
| '''11'''
|
| '''12'''
| style="text-align: left;"|
| '''PI1'''
| '''257'''
|-
| '''227'''
| '''UART5_RX'''
| '''13'''
|
| '''14'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''<span style="color:#FF0000">261</span>'''| '''<span style="color:#FF0000">PI5</span>'''| '''<span style="color:#FF0000">TWI0_SCL</span>/UART2_TX'''| '''<span style="color:#FF0000">15'''|| '''16'''| '''PWM4</UART4_RX'''| '''PI14'''| '''270span>'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|| '''18'''| style="text-align: left;"|| '''PH4'''| '''228'''|-| '''231'''
| '''PH7'''
| '''SPI1_MOSI'''
| '''19'''
|
| '''20'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''232'''
| '''SPI1_MISO'''
| '''21'''
|
| '''22'''
| '''TWI0_SDA/UART2_RX'''
| '''PI6'''
| '''262'''
|-
| '''230'''
| '''SPI1_CLK'''
| '''23'''
|
| '''24'''
| '''SPI1_CS0'''
| '''PH5'''
| '''229'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|
| '''26'''
| '''SPI1_CS1'''
| '''PH9'''
| '''233'''
|-
| '''<span style="color:#FF0000">266</span>'''| '''<span style="color:#FF0000">PI10</span>'''| '''<span style="color:#FF0000">TWI2-SDA</span>/UART3_RX'''| '''<span style="color:#FF0000">27'''|| '''28'''| '''TWI2-SCL</UART3_TX'''| '''PI9'''| '''265span>'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|
| '''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'''
|
| '''38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''pin'40''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''4'''| '''5V'''| style="text-align: left;"|
| style="text-align: left;"|
| '''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 40pin6'''| '''Corresponding dtbo configurationGND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - uart28'''| '''pi-uart2UART0_TX'''| '''PH0'''| '''224'''
|-
| '''40pin - uart310'''| '''pi-uart3UART0_RX'''| '''PH1'''| '''225'''
|-
| '''40pin 12'''| style="text- uart4align: left;"|| '''PI1'''| '''pi-uart4257'''
|-
| '''40pin - uart514'''| '''ph-uart5GND'''|} [[File:zero2w-img175.png]] <ol start="5" style="listtext-style-typealign: lower-alphaleft;">|<li><p>Then select '''&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="3" | style="list-style-type: decimal;"><li><p>After entering the Linux system, first confirm whether there is a uart5 device node under '''/dev'''</p><p>'''Note that the linux5.4 system is /dev/ttyASx.'''</p><p>orangepi@orangepi:~$ '''ls /dev/ttyS*'''</p><p>/dev/ttySx</p></li><li><p>Then start testing the uart interface. First use Dupont wire to shorttext-circuit the rx and tx pins of the uart interface to be tested.</p></li><li><p>Use the '''gpio''' command in wiringOP to test the loopback function of the serial port as shown below. If you can see the following print, it means the serial port communication is normal.</p><p>'''Note that the last x in the gpio serial /dev/ttySx command needs to be replaced with the serial number of the corresponding uart device node.'''</p><p>orangepi@orangepi:~$ '''gpio serial /dev/ttySx # linux-6.1 test command'''</p><p>orangepi@orangepialign:~$ '''gpio serial /dev/ttyASx # linux-5.4 test command'''</p><p>Out: 0: -&gt; 0</p><p>Out: 1: -&gt; 1</p><p>Out: 2: -&gt; 2</p><p>Out: 3: -&gtleft; 3^C</p></li></ol> <span id="pwm-test-method"></span>=== PWM test method === # As can be seen from the following table, the available pwm are pwm1, pwm2, pwm3 and pwm4. {| class="wikitable"
|-
| '''GPIO NO.16'''| '''GPIOPWM4/UART4_RX'''| '''FunctionPI14'''| '''Pin'''|| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.270'''
|-
| '''18'''
| style="text-align: left;"|
| style="text-align: left;"|| '''3.3V'''| '''1PH4'''|| '''2228'''| '''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'''|| '''620'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''269<span style="color:#FF0000">22</span>'''| '''PI13<span style="color:#FF0000">TWI0_SDA</span>/UART2_RX'''| '''PWM3<span style="color:#FF0000">PI6</UART4_TXspan>'''| '''7<span style="color:#FF0000">262</span>'''|-| '''24'''| '''8SPI1_CS0'''| '''UART0_TXPH5'''| '''PH0229'''| -| '''26''224'| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''<span style="color:#FF0000">28</span>'''| '''<span style="color:#FF0000">TWI2-SCL</span>/UART3_TX'''| '''<span style="color:#FF0000">PI9</span>'''| '''<span style="color:#FF0000">265</span>'''
|-
| '''30'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''9'''
|
| '''10'''
| '''UART0_RX'''
| '''PH1'''
| '''225'''
|-
| '''22632'''| '''PH2PWM1'''| '''UART5_TXPI11'''| '''11'''|| '''12'''| style="text-align: left;"|| '''PI1'''| '''257267'''
|-
| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|| '''1434'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26136'''| '''PI5'''| '''TWI0_SCL/UART2_TX'''style="text-align: left;"| '''15'''|| '''16'''| '''PWM4/UART4_RX'''| '''PI14PC12'''| '''27076'''
|-
| '''38'''
| style="text-align: left;"|
| style="text-align: left;"|| '''3.3V'''| '''17'''|| '''18'''| style="text-align: left;"|| '''PH4PI4'''| '''228260'''
|-
| '''23140'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|| '''20'''| '''GND'''| style="text-align: left;"|
| style="text-align: left;"|
| '''PI3'''
| '''259'''
|}
</div>
 
<ol start="2" style="list-style-type: decimal;">
<li><p>i2c is turned off by default in Linux systems and needs to be turned on manually to use it. The opening steps are as follows: </p>
<ol style="list-style-type: lower-alpha;">
<li><p>First run '''orangepi-config'''. Ordinary users remember to add '''sudo''' permissions.</p>
{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''232sudo orangepi-config'''</p>| }</li><li><p>Then select '''PH8System'''</p>| '''SPI1_MISO'''<p>[[File:zero2w-img80.png]]</p></li>| <li><p>Then select '''21Hardware'''</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 ''22'space''| '''TWI0_SDAto select the corresponding i2c configuration in the picture below.</p></UART2_RX'''li>| '''PI6'''{| '''262'''class="wikitable" style="width:800px;text-align: center;"
|-
| '''230Multiplexing function in 40pin'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229Corresponding dtbo configuration'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''GND40pin - i2c0'''| '''25'''|| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233pi-i2c0'''
|-
| '''266'''| '''PI10'''| '''TWI240pin -SDA/UART3_RX'''| '''27'''|| '''28i2c1'''| '''TWI2pi-SCL/UART3_TX'''| '''PI9'''| '''265i2c1'''
|-
| '''25640pin - i2c2'''| '''PI0pi-i2c2'''| } [[File:zero2w-img173.png]]</ol><ol start="5" style="textlist-alignstyle-type: leftlower-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 '''29&lt;Back&gt;'''</p>|<p>[[File:zero2w-img84.png]]</p></li>| <li><p>Then select '''30&lt;Reboot&gt;'''to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol>| '''GND'''</li></ol>| <ol start="3" style="textlist-style-aligntype: leftdecimal;"|><li><p>After starting the Linux system, first confirm that there is an open i2c device node under /dev</p>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| <p>orangepi@orangepi:~$ '''271ls /dev/i2c-*'''</p>| <p>'''PI15/dev/i2c-*'''</p>|}{| class="wikitable" style="textbackground-aligncolor: left#ffffdc;width:800px;"|| '''31'''|| '''32'''| '''PWM1'''| '''PI11'''| '''267'''
|-
| <big><p>'''268Sometimes 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>'''PI12The 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>'''PWM2First run the following command to check the corresponding relationship of i2c'''</p>| <p>orangepi@orangepizero2w:~$ '''33ls /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>|| '''34'''| <li><p>'''GNDIn the above output'''</p>| <ol style="textlist-alignstyle-type: leftnone;"><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="textlist-alignstyle-type: leftdecimal;"><li><p>Then start testing i2c, first install i2c-tools</p>{|class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''258sudo apt-get update'''</p>| <p>orangepi@orangepi:~$ '''PI2sudo apt-get install -y i2c-tools'''</p>| style="text-align: left;"|}| '''35'''</li>|<li><p>Then connect an i2c device to the i2c pin of the 40pin connector</p></li>| <li><p>Then use the '''36i2cdetect -y x'''x command. If the address of the connected i2c device can be detected, it means that i2c can be used normally.</p>{| class="wikitable" style="textbackground-aligncolor:#ffffdc;width: left800px;"|| '''PC12'''| '''76'''
|-
| '''272'''| '''PI16'''| style="text-align: left;"|| '''37'''|| ''<big><p>'38'''| style="textNote that x in the i2cdetect -align: left;"|| '''PI4'''| '''260'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''39'''|| '''40'''| style="text-align: left;"|| '''PI3y x command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p>| <p>'''259Different i2c device addresses are different. The 0x50 address in the picture below is just an example. Please refer to what you actually see.'''</p></big>
|}
<div class="figure">
<ol start="2" style="list-style-type: decimal;"><li><p>pwm is turned off by default in Linux systems and needs to be turned on manually to use it. The opening steps are as follows:</p><ol style="list-style-type: lower-alpha;"><li><p>First run '''orangepi-config'''. Ordinary users remember to add &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-img81img174.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; configuration corresponding to the pwm you want to open.</p><p>[[File:zero2w-img176.png]]</p></li><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</p><p>'''Please execute the following commands under the root user.'''</p><ol style="list-style-type: lower-alpha;"><li><p>Enter the following command on the command line to make pwm1 &gt; output a 50Hz square wave</p><p>root@orangepi:~# '''echo 1 &gt; /sys/class/pwm/pwmchip0/export'''</p><p>root@orangepi:~# '''echo 20000000 &gt; /sys/class/pwm/pwmchip0/pwm1/period'''</p><p>root@orangepi:~# '''echo 1000000 &gt; /sys/class/pwm/pwmchip0/pwm1/duty_cycle'''</p><p>root@orangepi:~# '''echo 1 &gt; /sys/class/pwm/pwmchip0/pwm1/enable'''</p></li><li><p>Enter the following command on the command line to make pwm2 &gt; output a 50Hz square wave</p></li></ol></li></ol>
root@orangepi:~# '''echo 2 &gt; </sysdiv></classli></pwm/pwmchip0/export'''ol>
root@orangepi:~# '''echo 20000000 &gt; <span id="pin-uart-test"></sys/class/pwm/pwmchip0/pwm2/period'''span>
root@orangepi:~# '''echo 1000000 &gt; /sys/class/pwm/pwmchip0/pwm2/duty_cycle'''=== 40pin UART test ===
root@orangepi:~# '''echo 1 &gt; /sys/class/pwm/pwmchip0/pwm2/enable'''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.
<ol startdiv style="display: flex;">::{| class="3wikitable" style="listwidth:390px;margin-styleright: 20px;text-typealign: lower-alphacenter;"><li>Enter the following command on the command line to make pwm3 output &gt; a 50Hz square wave</li></ol>|- root@orangepi:~# | '''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>| '''3.3V''' root@orangepi:~# | '''echo 4 &gt; /sys/class/pwm/pwmchip0/export1'''|-root@orangepi:~# | '''echo 20000000 &gt; /sys/class/pwm/pwmchip0/pwm4/period264'''| '''PI8'''root@orangepi:~# | '''echo 1000000 &gt; /sys/class/pwm/pwmchip0/pwm4/duty_cycleTWI1-SDA''' root@orangepi:~# | '''echo 1 &gt; /sys/class/pwm/pwmchip0/pwm4/enable3''' <div class="figure"> [[File:zero2w|-img177.png]]| '''263'''</div>| '''PI7'''<span id="how| '''TWI1-to-install-and-use-wiringop-python"></span>SCL'''| '''5'''== How to install and use wiringOP|-Python ==| '''269'''| '''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.PI13''' | '''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 programPWM3/UART4_TX''' | '''Also please note that all the following commands are operated under the root user.7'''|-<span id| style="howtext-to-install-wiringop-pythonalign: left;"></span>|=== How to install wiringOP-Python === <ol | style="listtext-style-typealign: decimalleft;">|<li><p>First install dependency packages</p><p>root@orangepi:~# | '''sudo apt-get updateGND'''</p><p>root@orangepi:~# | '''sudo apt-get -y install git swig python3-dev python3-setuptools9'''</p></li><li><p>Then use the following command to download the source code of wiringOP|-Python</p></li></ol> | '''Note that the following git clone--recursive command will automatically download the source code of wiringOP, because wiringOP-Python depends on wiringOP. Please make sure there are no errors during the download process due to network problems.226''' 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-PythonPH2''' root@orangepi:~# | '''git clone --recursive https://github.com/orangepi-xunlong/wiringOP-Python -b nextUART5_TX''' root@orangepi:~# | '''cd wiringOP-Python11'''|-root@orangepi:~/wiringOP-Python# | '''git submodule update --init --remote227''' <ol start="3" style="list-style-type: decimal;"><li><p>Then use the following command to compile wiringOP-Python and install it into the Linux system of the development board</p><p>root@orangepi:~# | '''cd wiringOP-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><p>root@orangepi:~# | '''python3GND'''</p></li><li><p>Then import the python module of wiringpi</p><p>&gt;&gt;&gt; | '''import wiringpi25'''</p><p>&gt;&gt;&gt; |-| '''from wiringpi import GPIO266'''</p></li><li><p>Then set the GPIO port to output mode, where the first parameter &gt; of the | '''pinModePI10'''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()TWI2-SDA/UART3_RX'''</p><p>0</p><p>&gt;&gt;&gt; | '''wiringpi.pinMode(2, GPIO.OUTPUT)27'''</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)256'''</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>&gt;&gt;&gt; | '''wiringpi.digitalWrite(2, GPIO.HIGH)PI0'''</p></li></ol></li>| style="text-align: left;"|<li><p>For wiringOP-Python to set the GPIO high and low levels in the python code, you can refer to the | '''blink.py29''' test program in the examples. The |-| '''blink.py271''' test program will set the voltage of all GPIO ports in the 40 Pin of the development board to continuously change high and low.</p><p>root@orangepi:~/wiringOP-Python# | '''cd examplesPI15'''</p><p>root@orangepi| style="text-align:~/wiringOP-Python/examples# left;"|| '''ls blink.py31'''</p><p>|-| '''blink.py268'''</p><p>root@orangepi:~/wiringOP-Python/examples| '''# python3 blink.pyPI12'''</p></li></ol> <span id="pin-spi-test-1"></span>=== 40pin SPI test === # As can be seen from the table below, the spi available for the 40pin interface is spi1, and there are two chip select pins cs0 and cs1 {| class="wikitable"|-| '''GPIO NO.PWM2'''| '''GPIO33'''|-| '''Function258'''| '''PinPI2'''| style="text-align: left;"|| '''Pin35'''|-| '''Function272'''| '''GPIOPI16'''| 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;"|
|-
| '''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'''
| '''PH1'''
| '''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'''
| '''267'''
|-
| '''268'''| '''PI12'''| '''PWM2'''| '''33'''|| '''34'''| '''GND'''
| style="text-align: left;"|
| 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 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>{| 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; dtbo configuration of the SPI serial port you want to open.</p></li></ol></li></ol>
{| class="wikitable"style="width:800px;text-align: center;"|-| '''Multiplexing function in 40pin'''| '''Corresponding dtbo configuration'''
|-
| '''dtbo configuration40pin - uart2'''| '''illustratepi-uart2'''
|-
| '''spi140pin -cs0-cs1-spidevuart3'''| '''Open cs0 and cs1 of spi1 at the same timepi-uart3'''
|-
| '''spi140pin -cs0-spidevuart4'''| '''Only open cs0 of spi1pi-uart4'''
|-
| '''spi140pin -cs1-spidevuart5'''| '''Only open cs1 of spi1ph-uart5'''
|}
[[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>Then check After entering the Linux system, first confirm whether there is a '''spidev1.x''' uart5 device node in the Linux system. If it exists, it means that the SPI1 configuration has taken effect.</p><p>orangepi@orangepi:~$ under '''ls /dev/spidev1*'''</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <p>/dev/spidev1.0 /dev/spidev1.1</pbig><p>'''Note that only when you open spi1-cs0-cs1-spidev, you will see the device nodes of the two spilinux5.4 system is /dev/ttyASx.'''</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 {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li>|-| <p>orangepi@orangepi:~$ '''--channells /dev/ttyS*''': Specify the channel number of SPI</p></li><li><p>'''--port''': Specify the port number of the SPI</p><dev/li>ttySx</olp>|}
</li>
<li><p>Without shorting Then start testing the mosi uart interface. First use Dupont wire to short-circuit the rx and miso tx pins of SPI1, the output result uart interface to be tested.</p></li><li><p>Use the '''gpio''' command in wiringOP to test the loopback function of running spidev_test.py is the serial port as followsshown below. You 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 data last x in the gpio serial /dev/ttySx command needs to be replaced with the serial number of TX and RX are inconsistentthe corresponding uart device node.'''</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>rootorangepi@orangepi:~/wiringOP-Python# $ '''cd examplesgpio serial /dev/ttySx # linux-6.1 test command'''</p><p>orangepi@orangepi:~$ '''gpio serial /li>dev/ttyASx # linux-5.4 test command'''</olp>
root@orangepi:~/wiringOP-Python/examples# '''python3 spidev_test.py \'''
'''<p>Out: 0: -&gt; 0</p><p>Out: 1: -channel &gt; 1 </p><p>Out: 2: -&gt; 2</p><p>Out: 3: -port 0'''&gt; 3^C</p>|}</li></ol>
spi mode: 0x0<span id="pwm-test-method"></span>
max speed: 500000 Hz (500 KHz)=== PWM test method ===
Opening device /dev/spidev1# As can be seen from the following table, the available pwm are pwm1, pwm2, pwm3 and pwm4.1
TX | FF FF FF FF FF FF '''40 00 00 00 00 95''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…| RX | FF FF FF FF FF FF '''FF FF FF FF FF FF''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF |.............….| <ol start="6" div style="list-style-typedisplay: decimalflex;"><li><p>Then use Dupont wire to short-circuit the txd (pin 19 in the 40pin interface) and rxd (pin 21 in the 40pin interface) of SPI1 and then run spidev_test.py. The output is as follows, you can see If the data sent and received are the same, it means that the SPI1 loopback test is normal.</p><p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p></li></ol> root@orangepi:~/wiringOP-Python/examples# '''python3 spidev_test.py \''' '''--channel 1 --port 0''' spi mode: 0x0 max speed: 500000 Hz (500 KHz) Opening device /dev/spidev1.1 TX {| FF FF FF FF FF FF '''40 00 00 00 00 95''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…| RX | FF FF FF FF FF FF '''40 00 00 00 00 95''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…| <span idclass="pin-i2c-test-1wikitable"></span>=== 40pin I2C test === # As can be seen from the table below, the i2c available for the 40pin interface are i2c0, i2c1 and i2c2 {| classstyle="wikitablewidth:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO NO.'''
| '''Function'''
| '''Pin'''
|| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| style="text-align: left;"|
| 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;"|
|-
| '''<span style="color:#FF0000">269</span>'''| '''<span style="color:#FF0000">PI13</span>'''| '''<span style="color:#FF0000">PWM3</span>/UART4_TX'''| '''<span style="color:#FF0000">7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224</span>'''
|-
| style="text-align: left;"|
| '''GND'''
| '''9'''
|
| '''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'''
|-
| '''231'''
| '''SPI1_MOSI'''
| '''19'''
|
| '''20'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''232'''
| '''SPI1_MISO'''
| '''21'''
|| '''22'''| '''TWI0_SDA/UART2_RX'''| '''PI6'''| '''262'''|-| '''230'''
| '''PH6'''
| '''SPI1_CLK'''
| '''23'''
|
| '''24'''
| '''SPI1_CS0'''
| '''PH5'''
| '''229'''
|-
| 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'''
|-
| '''<span style="color:#FF0000">268</span>'''| '''<span style="color:#FF0000">PI12</span>'''| '''<span style="color:#FF0000">PWM2</span>'''| '''33'''|| '''34'''| '''GND'''| <span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"|>33</span>'''
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|
| '''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 start{| class="2wikitable" style="listwidth:390px;margin-styleright: 20px;text-typealign: decimalcenter;"><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;">| '''Pin'''<li><p>First run | '''orangepi-configFunction'''| '''. Ordinary users remember to add &gt; GPIO'''sudo| ''' permissionsGPIO NO.</p>'''|-<p>orangepi@orangepi:~$ | '''sudo orangepi-config2'''</p></li><li><p>Then select | '''System5V'''</p><p>[[File| style="text-align: left;"|| style="text-align:zero2wleft;"||-img80.png]]</p></li><li><p>Then select | '''4'''| '''Hardware5V'''</p><p>[[File| style="text-align:zero2wleft;"|| style="text-align: left;"||-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 ''6'''| '''spaceGND''' to select the &gt| style="text-align: left; corresponding i2c configuration in the picture below.</p></li></ol></li></ol>"|{| classstyle="wikitabletext-align: left;"|
|-
| '''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 <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="3" style="list-style-type: decimal;"><li><p>After starting the Linux system, first confirm that there is an open i2c device node under <span class="mark">/dev</span></p><p>orangepi@orangepi:~$ '''ls /dev/i2c-*'''</p><p>'''/dev/i2c-*'''</p><p>'''Sometimes the i2c device node and the i2c bus serial number do not correspond one to one. For example, the i2c device node of the i2c1 bus may be /dev/i2c-3.'''</p><p>'''The method to accurately confirm the device node under /dev corresponding to the i2c bus is:'''</p></li></ol> <!-- --><ol start="3" style="list-style-type: lower-alpha;"><li><p>'''First run the following command to check the corresponding relationship of 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 start="4" style="listtext-style-typealign: lower-alphaleft;"><li><p>002000 is the register base address of the i2c0 bus, and i2c-0 shown behind it is its corresponding i2c device node</p></li><li><p>5002400 is the register base address of the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li><li><p>5002800 is the register base address of the i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p></li></ol> <!-- --><ol start="4" style="list-style-type: decimal;"><li><p>Then start testing i2c, first install i2c-tools</p><p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo''' '''apt-get install -y i2c-tools'''</p></li><li><p>Then connect an i2c device to the i2c pin of the 40pin connector. Here we take the DS1307 RTC module as an example.</p><p>[[File:zero2w-img178.png]]</p></li><li><p>Then use the '''i2cdetect -y x'''command. If the address of the connected i2c device can be detected, it means that the i2c device is connected correctly.</p><p>'''Note that x in the i2cdetect -y x command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p></li></ol> [[File:zero2w-img179.png]] <ol start="7" style="list-style-type: decimal;"><li><p>Then you can run the '''ds1307.py''' test program in '''examples''' to read the RTC time</p><p>'''Note that the x in i2c-x in the following command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p><p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p><p>root@orangepi:~/wiringOP-Python/examples# '''python3 ds1307.py --device \'''</p><p>'''&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.<span style="color:#FF0000">16</span>'''| '''GPIO<span style="color:#FF0000">PWM4</span>/UART4_RX'''| '''Function<span style="color:#FF0000">PI14</span>'''| '''Pin'''|| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.<span style="color:#FF0000">270</span>'''
|-
| '''18'''
| style="text-align: left;"|
| style="text-align: left;"|| '''3.3VPH4'''| '''1228'''|-| '''220'''| '''5VGND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26422'''| '''PI8TWI0_SDA/UART2_RX'''| '''TWI1PI6'''| '''262'''|-SDA| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''3229'''|-| '''426'''| '''5VSPI1_CS1'''| '''PH9'''| '''233'''| style="text-align: left;"|'''28'''| style="text'''TWI2-align: left;"SCL/UART3_TX'''|'''PI9'''| '''265'''
|-
| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|| '''630'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''269<span style="color:#FF0000">32</span>'''| '''PI13<span style="color:#FF0000">PWM1</span>'''| '''PWM3<span style="color:#FF0000">PI11</UART4_TXspan>'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224<span style="color:#FF0000">267</span>'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''9'''
|
| '''10'''
| '''UART0_RX'''
| '''PH1'''
| '''225'''
|-
| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''1236'''
| style="text-align: left;"|
| '''PI1PC12'''| '''25776'''
|-
| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|| '''14'''| '''GND38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| '''40'''
| style="text-align: left;"|
| '''PI3'''
| '''259'''
|}
</div>
 
<ol start="2" style="list-style-type: decimal;">
<li><p>pwm is turned off by default in Linux systems and needs to be turned on manually to use it. The opening steps are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First run '''orangepi-config'''. Ordinary users remember to add '''sudo''' permissions.</p>
{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''261sudo orangepi-config'''</p>| }</li><li><p>Then select '''PI5System'''</p><p>[[File:zero2w-img80.png]]</p></li>| <li><p>Then select '''TWI0_SCL/UART2_TXHardware'''</p><p>[[File:zero2w-img81.png]]</p></li>| <li><p>Then use the keyboard's arrow keys to locate the position shown in the figure below, and then use the '''15space'''to select the configuration corresponding to the pwm you want to open.</p>|<p>[[File:zero2w-img176.png]]</p></li>| <li><p>Then select '''16&lt;Save&gt;'''to save</p><p>[[File:zero2w-img83.png]]</p></li>| <li><p>Then select '''PWM4/UART4_RX&lt;Back&gt;'''</p><p>[[File:zero2w-img84.png]]</p></li>| <li><p>Then select '''PI14&lt;Reboot&gt;'''to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol></li><li><p>After restarting, you can start the PWM test</p>{| '''270'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| style="text-align: left;"|| style="text-align: left;"|| <big><p>'''3Please execute the following commands under the root user.3V'''</p></big>| '''17'''|| '''18'''}| <ol style="textlist-style-aligntype: leftlower-alpha;"|>| '''PH4'''<li><p>Enter the following command on the command line to make pwm1 output a 50Hz square wave</p>{| '''228'''class="wikitable" style="width:800px;"
|-
| <p>root@orangepi:~# '''231echo 1 &gt; /sys/class/pwm/pwmchip0/export'''</p>| <p>root@orangepi:~# '''PH7echo 20000000 &gt; /sys/class/pwm/pwmchip0/pwm1/period'''</p>| <p>root@orangepi:~# '''SPI1_MOSIecho 1000000 &gt; /sys/class/pwm/pwmchip0/pwm1/duty_cycle'''</p>| <p>root@orangepi:~# '''19echo 1 &gt; /sys/class/pwm/pwmchip0/pwm1/enable'''</p>|}| '''20'''</li>| '''GND'''<li><p>Enter the following command on the command line to make pwm2 output a 50Hz square wave</p></li>{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| root@orangepi:~# '''232echo 2 &gt; /sys/class/pwm/pwmchip0/export'''| root@orangepi:~# '''PH8echo 20000000 &gt; /sys/class/pwm/pwmchip0/pwm2/period'''| '''SPI1_MISO'''| root@orangepi:~# '''21echo 1000000 &gt; /sys/class/pwm/pwmchip0/pwm2/duty_cycle'''|| root@orangepi:~# '''22echo 1 &gt; /sys/class/pwm/pwmchip0/pwm2/enable'''| '''TWI0_SDA}</UART2_RX'''ol><ol start="3" style="list-style-type: lower-alpha;">| '''PI6'''<li>Enter the following command on the command line to make pwm3 output a 50Hz square wave</li>{| '''262'''class="wikitable" style="width:800px;"
|-
| root@orangepi:~# '''230echo 3 &gt; /sys/class/pwm/pwmchip0/export'''| root@orangepi:~# '''PH6echo 20000000 &gt; /sys/class/pwm/pwmchip0/pwm3/period'''| root@orangepi:~# '''SPI1_CLKecho 1000000 &gt; /sys/class/pwm/pwmchip0/pwm3/duty_cycle'''| root@orangepi:~# '''23echo 1 &gt; /sys/class/pwm/pwmchip0/pwm3/enable'''|}| '''24'''</ol>| '''SPI1_CS0'''<ol start="4" style="list-style-type: lower-alpha;">| '''PH5'''<li>Enter the following command on the command line to make pwm4 output a 50Hz square wave</li>{| '''229'''class="wikitable" style="width:800px;"
|-
| style="text-align: left;"|| style="text-alignroot@orangepi: left;"|| ~# '''GNDecho 4 &gt; /sys/class/pwm/pwmchip0/export'''| root@orangepi:~# '''25echo 20000000 &gt; /sys/class/pwm/pwmchip0/pwm4/period'''|| root@orangepi:~# '''26echo 1000000 &gt; /sys/class/pwm/pwmchip0/pwm4/duty_cycle'''| root@orangepi:~# '''SPI1_CS1echo 1 &gt; /sys/class/pwm/pwmchip0/pwm4/enable'''| '''PH9'''} <div class="figure"> [[File:zero2w-img177.png]] </div></ol></li></ol><span id="how-to-install-and-use-wiringop-python"></span> == How to install and use wiringOP-Python == {| '''233'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| '''266'''| ''<big>'PI10''Note: The pin header on the 40pin interface is not soldered by default, and you need to solder it yourself before it can be used.'| '''TWI2-SDA</UART3_RX'''| '''27'''big>|}{| '''28'''| '''TWI2class="wikitable" style="background-SCL/UART3_TX'''| '''PI9'''| '''265'''color:#ffffdc;width:800px;"
|-
| <big>'''wiringOP-Python is the Python language version of wiringOP library, used to operate the development board'256s GPIO, I2C, SPI, UART and other hardware resources in the Python program'''| '''PI0Also please note that all the following commands are operated under the root user.'''</big>| style} <span id="texthow-to-install-align: left;wiringop-python"|></span>| '''29'''=== How to install wiringOP-Python ===|| '''30'''| '''GND'''| <ol style="textlist-alignstyle-type: leftdecimal;"|><li><p>First install dependency packages</p>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| <p>root@orangepi:~# '''271sudo apt-get update'''</p>| <p>root@orangepi:~# '''PI15sudo apt-get -y install git swig python3-dev python3-setuptools'''</p>|}</li><li><p>Then use the following command to download the source code of wiringOP-Python</p></li>{| class="wikitable" style="textbackground-aligncolor:#ffffdc;width: left800px;"|| '''31'''|| '''32'''| '''PWM1'''| '''PI11'''| '''267'''
|-
| '''268'''| <big>'''PI12Note that the following git clone--recursive command will automatically download the source code of wiringOP, because wiringOP-Python depends on wiringOP. Please make sure there are no errors during the download process due to network problems.'''| '''PWM2'''| '''33'''|| '''34If there is a problem downloading the code from GitHub, you can directly use the wiringOP-Python source code that comes with the Linux image. The storage location is: /usr/src/wiringOP-Python'''</big>| '''GND'''}{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| root@orangepi:~# '''258git clone --recursive https://github.com/orangepi-xunlong/wiringOP-Python -b next'''| root@orangepi:~# '''PI2cd wiringOP-Python'''| style="textroot@orangepi:~/wiringOP-align: left;"|| Python# '''35git submodule update --init --remote'''|}| '''36'''</ol>| <ol start="3" style="textlist-style-aligntype: leftdecimal;"|>| '''PC12'''<li><p>Then use the following command to compile wiringOP-Python and install it into the Linux system of the development board</p>{| '''76'''class="wikitable" style="width:800px;"
|-
| <p>root@orangepi:~# '''272cd wiringOP-Python'''</p>| <p>root@orangepi:~/wiringOP-Python# '''PI16python3 generate-bindings.py &gt; bindings.i'''</p>| style="text<p>root@orangepi:~/wiringOP-align: left;"|| Python# '''37sudo python3 setup.py install'''</p>|}| </li><li><p>Then enter the following command. If helpful information is output, it means wiringOP-Python is successfully installed. Press the '''38q'''key to exit the help information interface.</p></li>{| class="wikitable" style="text-alignwidth: left800px;"|| '''PI4'''| '''260'''
|-
| style="text-alignroot@orangepi: left;"|| style="text~/wiringOP-align: left;"|| Python# '''GNDpython3 -c &quot;import wiringpi; help(wiringpi)&quot;'''| '''39'''|| '''40'''| style="text-alignHelp on module wiringpi: 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>NAME
{| class="wikitable"|-| '''Multiplexing function in 40pin'''| '''Corresponding dtbo configuration'''|-| '''40pin - uart2'''| '''pi-uart2'''|-| '''40pin - uart3'''| '''pi-uart3'''|-| '''40pin - uart4'''| '''pi-uart4'''|-| '''40pin - uart5'''| '''ph-uart5'''|}:wiringpi
[[File:zero2w-img175.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>DESCRIPTION
<!-- --><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><p>'''注意, linux5.4系统为/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>OutThis file was automatically generated by SWIG (http: 3: -&gt; 3^C</p></li><li><p>Finally, you can run the '''serialTestwww.py''' program in examples to test the loopback function of the serial portswig. If you can see the following print, it means that the serial port loopback test is normalorg).</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><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="hardware-watchdog-test"></span>== Hardware watchdog test ==: # Version 4.0.2
The watchdog_test program is pre-installed in the Linux system released by Orange Pi and can be tested directly.: #
The method : # Do not make changes to run the watchdog_test program is as follows:this file unless you know what you are doing--modify
: # the SWIG interface file instead.|}</ol><ol start="5" style="list-style-type: lower-alphadecimal;"><li><p>The second parameter 10 represents the counting time of the watchdog. If the dog steps to test whether wiringOP-Python is not fed within this time, installed successfully under the system will restart.python command line are as follows:</p></liol style="list-style-type: lower-alpha;"><li><p>We can feed First use the dog by pressing any key on python3 command to enter the keyboard (except ESC). After feeding the dog, the program will print a command line mode of &quotgt;keep alive&quot; to indicate that the dog feeding is successful.python3</pli><p>orangepi{| class="wikitable" style="width:800px;" |-| root@orangepi:~$ # '''sudo watchdog_test 10python3'''</p><p>open success|}</pol><p>options is 33152,identity is sunxiol start="2" style="list-style-type: lower-wdt</palpha;"><pli>put_usr return,if 0,success:0Then import the python module of wiringpi</pli><p>The old reset time is{| class="wikitable" style="width: 16800px;" |-| &gt;&gt;&gt; '''import wiringpi;'''|}</pol><p>return ENOTTY,if ol start="3" style="list-style-1,successtype:0</plower-alpha;"><pli>return ENOTTYFinally,if enter the following command to view the help information of &gt; wiringOP-1,success:0Python. Press the q key to exit the help information &gt; interface.</pli><p>put_user return,if 0,success{| class="wikitable" style="width:0</p>800px;" |-<p>put_usr return,if 0,success:0</p>| <p>keep alive</p>&gt;&gt;&gt; '''help(wiringpi)'''<p>keep alive</p><p>keep alive</p></li></ol>Help on module wiringpi:
<span id="check-the-chipid-of-h618-chip"></span>
== Check the chipid of H618 chip ==
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.NAME
orangepi@orangepi:~$ '''cat /sys/class/sunxi_info/sys_info | grep &quot;chipid&quot;'''wiringpi
sunxi_chipid : 338020004c0048080147478824681ed1
<span id="python-related-instructions"></span>== Python related instructions ==DESCRIPTION
<span id="how-to-compile-and-install-python-source-code"><: # This file was automatically generated by SWIG (http:/span>=== How to compile and install Python source code ===/www.swig.org).
'''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: # Version 4.'''0.2
'''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).''': #
<ol style="list-style-type: decimal;"><li><p>First install the dependency packages needed # Do not make changes 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 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 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 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, this file unless you can use the following command to check the version number of the Python know what 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 are doing--upgrade pip'''</p></li></ol>modify
<span id="how-to-replace-pip-source-in-python"></span>=== How to replace pip source in Python ===: # the SWIG interface file instead.
'''The default source used by Linux system pip is the official source of Python. However, accessing the official source of Python in China is very slow, and the installation of Python software packages often fails due to network reasons. So when using pip to install the Python library, please remember to change the pip source.'''
<ol style="list-style-type: decimal;"><li><p>First install '''python3-pip'''</p><p>orangepi@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 &gt; '''pip.conf''' configuration file, and set the pip source in it &gt; to Tsinghua source.</p><p>orangepi@orangepi:~$ '''mkdir -p ~/.pip'''</p><p>orangepi@orangepi:~$ '''cat &lt;&lt;EOF &gt; ~/.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><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>CLASSES
<span id="how-to-install-docker"></span>== How to install Docker ==:builtins.object
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.::GPIO
orangepi@orangepi:~$ '''enable_docker.sh''':I2C
You can use the following command to test docker. If '''hello-world''' can be run, docker can be used normally.::Serial
orangepi@orangepi:~$ '''docker run hello-world''':nes
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-worldclass GPIO(builtins.object)
256ab8fe8778: Pull complete| GPIO(pinmode=0)
Digest: sha256:7f0a9f93b4aa3022c3a4c147a449ef11e0941a1fd0bf4a8e6c9408b2600777c5|
Status: Downloaded newer image for hello-world:latest
'''Hello from Docker!'''&gt;&gt;&gt;|}</ol></li></ol><span id="pin-gpio-port-test-1"></span>
'''This message shows that your installation appears to be working correctly.'''=== 40pin GPIO port test ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Like wiringOP, wiringOP-Python can also determine which GPIO pin to operate by specifying the wPi number.Because there is no command to view the wPi number in wiringOP-Python, you can only view the board's wPi number and physics through the gpio command in wiringOP Correspondence of pins.'''</big>
When using the docker command, if you are prompted for '''permission denied''', please add the current user to the docker user group so that you can run the docker command without sudo. orangepi@orangepi[[File:~$ '''sudo usermod -aG docker $USER''' '''Note: You need to log out and log in again to the system to take effect. You can also restart the system.''' <span id="how-to-install-homezero2w-assistant"></span>== How to install Home Assistant == '''Note that this article will only provide methods for installing Home Assistant in Ubuntu or Debian systemsimg170. For detailed usage of Home Assistant, please refer to the official documentation or corresponding books.''' <span id="installation-via-docker"></span>png|center]]=== Installation via docker ===|}
<ol style="list-style-type: decimal;">
<li><p>First, please install docker and ensure that docker can run normallyThe following uses pin No. For  7 - corresponding to GPIO PI13 - corresponding to wPi serial number 2 - as an example to demonstrate how to set the installation steps high and low levels of docker, please refer to the instructions in the GPIO port.</p><p>[[\l|'''How to Install Docker'''File:zero2w-img171.png]] section.</p></li><li><p>Then you can search The steps for the docker image of Home Assistanttesting directly with commands are as follows:</p><p>orangepi@orangepiol style="list-style-type:~$ '''docker search homeassistant'''</p></lilower-alpha;"><li><p>Then use First set the following command GPIO port to download output mode, where the first parameter of the '''pinMode''' function is the Docker image serial number of Home Assistant the wPi corresponding to your local computer. The image size is about 1GBthe pin, and the download time will be relatively long. Please be patient and wait for second parameter is the download to completeGPIO mode.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepiroot@orangepi:~$ /wiringOP-Python# '''docker pull homeassistant/homepython3 -assistantc &quot;import wiringpi; \'''</p><p>Using default tag: latest'''from wiringpi import GPIO; wiringpi.wiringPiSetup() ; \'''</p><p>latest'''wiringpi.pinMode(<span style="color: Pulling from homeassistant#FF0000">2, GPIO.OUTPUT</home-assistantspan>) ; &quot;'''</p>|}</li><li><p>be307f383ecc: DownloadingThen 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>5fbc4c07ac88root@orangepi: Download complete~/wiringOP-Python# '''python3 -c &quot;import wiringpi; \'''</p><p>'''from wiringpi import GPIO; wiringpi...... wiringPiSetup(Omit some output);\'''</p><p>3cc6a1510c9f'''wiringpi.digitalWrite(2, <span style="color: Pull complete</p#FF0000"><p>7a4e4d5b979f: Pull completeGPIO.LOW</pspan><p>Digest: sha256:81d381f5008c082a37da97d8b08dd8b358dae7ecf49e62ce3ef1eeaefc4381bb)&quot;'''</p><p>Status: Downloaded newer image for homeassistant/home-assistant:latest</p>|}<p>docker.io/homeassistant/home-assistant:latest</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 following command to view pin. If it is 3.3v, it means the docker image setting of Home Assistant you just downloadedthe high level is successful.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepiroot@orangepi:~$ /wiringOP-Python# '''docker images homeassistant/homepython3 -assistantc &quot;import wiringpi; \'''</p><p>REPOSITORY TAG IMAGE ID CREATED SIZE'''from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\'''</p><p>homeassistant/home-assistant latest bfa0ab9e1cf5 2 months ago '''1wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.17GBHIGH</span>)&quot;'''</p>|}</li></ol></li><li><p>At this point you can run The steps for testing in the command line of python3 are as follows:</p><ol style="list-style-type: lower-alpha;"><li><p>First use the python3 command to enter the Home Assistant docker containercommand line mode of python3</p>{| class="wikitable" style="width:800px;" |-| <p>orangepiroot@orangepi:~$ # '''docker run -d \python3'''</p>|}</li><li><p>'''--name homeassistant \'''Then import the python module of wiringpi</p>{| class="wikitable" style="width:800px;" |-| <p>&gt;&gt;&gt; '''--privileged \import wiringpi'''</p><p>&gt;&gt;&gt; '''--restart=unless-stopped \from wiringpi import GPIO'''</p>|}</li><li><p>Then set the GPIO port to output mode, where the first parameter of the '''-e TZ=Asia/Shanghai \pinMode'''function is the serial number of the wPi corresponding to the pin, and the second parameter is the GPIO mode.</p>{| class="wikitable" style="width:800px;" |-| <p>&gt;&gt;&gt; '''-v /home/orangepi/home-assistant:/config \wiringpi.wiringPiSetup()'''</p><p>'''--network=host \'''0</p><p>&gt;&gt;&gt; '''homeassistantwiringpi.pinMode(<span style="color:#FF0000">2, GPIO.OUTPUT</home-assistant:latestspan>)'''</p>|}</li><li><p>Then enter【the IP address set the GPIO port to output a low level. After setting, you can use a multimeter to measure the voltage value of the development board: 8123】in pin. If it is 0v, it means the browser to see the Home Assistant interfacelow level is set successfully.</p>{| class="wikitable" style="width:800px;" |-| <p>&gt;&gt;&gt; '''It takes a while for wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.LOW</span>)'''</p>|}</li><li><p>Then set the Home Assistant container GPIO port to startoutput a high level. If the interface below does not display normallyAfter setting, please wait you can use a few seconds before refreshing itmultimeter to measure the voltage value of the pin. If the following interface it is not displayed normally after waiting for more than a minute3.3v, it means there is a problem with the Home Assistant installation. At this time, you need to check whether there setting of the high level is a problem with the previous installation and setting processsuccessful.'''</p><div {| class="figurewikitable" style="width:800px;">|-[[File| <p>&gt;&gt;&gt; '''wiringpi.digitalWrite(2, <span style="color:zero2w-img180#FF0000">GPIO.png]]HIGH</span>)'''</p>|}</divli></ol></li><li><p>Then enter your For wiringOP-Python to set the GPIO high and low levels in the python code, you can refer to the '''name, usernameblink.py''' and test program in the examples. The '''passwordblink.py''' test program will set the voltage of all GPIO ports in the 40 Pin of the development board to continuously change high and click '''Create Account'''low.</p><div {| class="figurewikitable" style="width:800px;"> [[File:zero2w|-img181.png]]| <p>root@orangepi:~/div>wiringOP-Python# '''cd examples'''</lip><lip>root@orangepi:~/wiringOP-Python/examples# '''ls blink.py'''</p><p>Then follow the interface prompts to set according to your own preferences, and then click Next'''blink.py'''</p><div class="figure"p[[Fileroot@orangepi:zero2w~/wiringOP-img182Python/examples'''# python3 blink.png]] py'''</divp>|}</li><li><p>Then click Next</p><div class="figure"ol>
[[File:zero2w<span id="pin-img183.png]]spi-test-1"></span>
</div></li><li><p>Then click Finish</p><div class="figure">== 40pin SPI test ===
[[File:zero2w-img184.png]]# 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></listyle="display: flex;"><li><p>The main interface finally displayed by Home Assistant is as shown below</p><p>[[File:zero2w-img185.png]]</p></li><li><p>Method to stop Home Assistant container</p><ol :{| class="wikitable" style="listwidth:390px;margin-styleright: 20px;text-typealign: lower-alphacenter;"><li><p>The command to view the docker container is as follows</p><p>orangepi@orangepi:~$ |-| '''docker ps -aGPIO NO.'''</p></li><li><p>The command to stop the Home Assistant container is as follows</p><p>orangepi@orangepi:~$ | '''docker stop homeassistantGPIO'''| '''Function'''</p></li><li><p>The command to delete the Home Assistant container is as follows</p><p>orangepi@orangepi:~$ | '''docker rm homeassistantPin'''</p></li></ol></li></ol> <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 packages3. For the configuration method, see the instructions in the section &quot;[[\l3V'''|How to Change the Pip Source of Python]]&quot;'''1'''|-<ol style="list-style-type: decimal;"><li><p>First install dependency packages</p><p>orangepi@orangepi:~$ | '''264'sudo apt-get update''| '</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y python3 python3-dev python3-venv \PI8'''</p><p>| '''python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf buildTWI1-essential \SDA'''</p><p>| '''libopenjp2-7 libtiff5 libturbojpeg0-dev tzdata3'''</p><p>|-| '''If it is debian12, please use the following command:263'''</p><p>orangepi@orangepi:~$ | '''sudo apt-get updatePI7'''</p><p>orangepi@orangepi:~$ | '''sudo apt-get install -y python3 python3TWI1-dev python3-venv \SCL'''</p><p>| '''python35'''|-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \| '''269'''</p><p>| '''PI13'''libopenjp2-7 libturbojpeg0-dev tzdata| '''<PWM3/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 methodUART4_TX''']] section.</p><p>| '''The default Python version of Debian Bullseye is Python3.9, so there is no need to compile and install it.7'''</p><p>|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'The default Python version of Ubuntu Jammy is Python3.10, so there is no need to compile and install it.''| '''9'''</p><p>|-| '''The default Python version of Debian Bookworm is Python3.11, so there is no need to compile and install it.226'''</p></li><li><p>Then create a Python virtual environment</p><p>| '''Debian Bookworm is python3.11, please remember to replace the corresponding command.PH2'''</p><p>orangepi@orangepi:~$ | '''sudo mkdir /srv/homeassistantUART5_TX'''</p><p>orangepi@orangepi:~$ | '''sudo chown orangepi:orangepi /srv/homeassistant11'''</p><p>orangepi@orangepi:~$ |-| '''cd /srv/homeassistant227'''</p><p>orangepi@orangepi:~$ | '''python3.9 -m venv .PH3'''</p><p>orangepi@orangepi:~$ | '''UART5_RX'''| '''source bin/activate13'''</p><p>(homeassistant) orangepi@orangepi:/srv/homeassistant$</p></li>|-<li><p>Then install the required Python packages</p>| '''261'''<p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ | '''PI5'''python3 -m pip install wheel| '''<TWI0_SCL/p></li><li><p>Then you can install Home Assistant Core</p>UART2_TX'''<p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ | '''pip3 install homeassistant15'''</p></li><li><p>Then enter the following command to run Home Assistant Core</p>|-<p>(homeassistant) orangepi@orangepi| style="text-align: left;"|| style="text-align:/srv/homeassistant$ left;"|| '''hass3.3V'''</p></li><li><p>Then enter【| '''17'''development board IP address: 8123|-| '''】 in the browser to see the Home Assistant interface</pspan style="color:#FF0000">231<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.| '''<span style="color:#FF0000">PH7</pspan>'''| '''<div classspan style="figurecolor:#FF0000"> [[File:zero2w-img180.png]] <SPI1_MOSI</div></li></olspan>''' | '''<span idstyle="opencv-installation-methodcolor:#FF0000">19</span>'''== OpenCV installation method ==|-| '''<span idstyle="use-apt-to-install-opencvcolor:#FF0000">232</span>'''=== Use apt to install OpenCV === <ol style| '''<span style="list-style-typecolor: decimal;#FF0000"><li><p>The installation command is as followsPH8</pspan><p>orangepi@orangepi:~$ '''sudo apt-get update| '''</pspan style="color:#FF0000">SPI1_MISO<p/span>orangepi@orangepi:~$ '''sudo apt-get install -y libopencv-dev python3-opencv| '''</pspan style="color:#FF0000">21</lispan>'''|-| '''<li><pspan style="color:#FF0000">Then use the following command to print the version number of OpenCV. The output is normal, indicating that the OpenCV installation is successful.230</pspan>'''| '''<ol span style="list-style-typecolor: lower-alpha;#FF0000"><li><p>The version of OpenCV in Ubuntu22.04 is as follows:PH6</p><pspan>orangepi@orangepi:~$ '''python3 -c &quot;import cv2; print(cv2.__version__)&quot;| '''</pspan style="color:#FF0000">SPI1_CLK<p/span>'''4.5.4| '''</pspan style="color:#FF0000">23</lispan>'''|-<li><p>The version of OpenCV in Ubuntu20.04 is as follows| style="text-align:</p>left;"|<p>orangepi@orangepi| style="text-align:~$ left;"|| '''python3 -c &quot;import cv2; print(cv2.__version__)&quot;GND'''</p><p>| '''4.2.025'''</p></li><li><p>The version of OpenCV in Debian11 is as follows:</p>|-<p>orangepi@orangepi:~$ | '''python3 -c &quot;import cv2; print(cv2.__version__)&quot;266'''</p><p>| '''PI10'''4.5.1| '''<TWI2-SDA/p></li>UART3_RX'''<li><p>The version of OpenCV in Debian12 is as follows:</p><p>orangepi@orangepi:~$ | '''python3 -c &quot;import cv2; print(cv2.__version__)&quot;27'''</p><p>|-| '''256''4.6.0'| '''PI0'''</p></li></ol></li></ol> <span id| style="settext-up-the-chinese-environment-and-install-the-chinese-input-methodalign: left;"></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.29'''|-<span id| '''271'''| '''PI15'''| style="debiantext-system-installation-methodalign: left;"></span>|=== Debian system installation method ===| '''31''' <ol style="list-style|-type: decimal;"><li><p>First set the default | '''locale268''' to Chinese</p><ol style="list-style-type: lower-alpha;"><li><p>Enter the following command to start configuring | '''localePI12'''</p><p>orangepi@orangepi:~$ | '''sudo dpkg-reconfigure localesPWM2'''</p></li><li><p>Then select | '''zh_CN.UTF-8 UTF-833''' 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 to | '''&lt;OK&gt;258''', and then return Car can be used)</p><p>[[File:zero2w-img186.png]]</p></li><li><p>Then set the default | '''PI2'locale''| style="text-align: left;"|| ' to '''zh_CN.UTF-835'''</p><p>[[File:zero2w|-img187.png]]</p></li><li><p>After exiting the interface, the | '''locale272''' setting will begin. &gt; The output displayed on the command line is as follows:</p><p>orangepi@orangepi:~$ | '''sudo dpkg-reconfigure localesPI16'''</p><p>Generating locales (this might take a while)...</p>| style="text-align: left;"|<p>en_US.UTF| '''37'''|-8... done</p><p>zh_CN.UTF| style="text-8... done</p>align: left;"|<p>Generation complete.</p></li></ol>| style="text-align: left;"|</li><li><p>Then open ''| '''Input MethodGND'''</p><p>[[File:zero2w-img188.png]]</p></li><li><p>Then select | '''OK39'''</p><p>[[File|}{| class="wikitable" style="width:390px;margin-right:zero2w20px;text-img189.png]]</p></li>align: center;"<li><p>Then select |-| '''YesPin'''</p><p>[[File:zero2w-img190.png]]</p></li><li><p>Then select | '''fcitxFunction'''</p><p>[[File:zero2w-img191.png]]</p></li>| '''GPIO'''<li><p>Then select | '''OKGPIO NO.'''</p><p>[[File:zero2w|-img192.png]]</p></li><li><p>| '''Then restart the Linux system to make the configuration take effect.2'''</p></li><li><p>Then open | '''Fcitx configuration5V'''</p><p>[[File| style="text-align:zero2wleft;"|| style="text-img193.png]]</p></li>align: left;"|<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 Pinyin4''' and click | '''OK5V'''</p><div class| style="figuretext-align: left;">|| style="text-align: left;"|[[File:zero2w|-img195.png]]| '''6'''</div></li><li><p>Then put | '''Google PinyinGND''' on top</p><p>[[File:zero2w| style="text-img196.png]]</p><p>[[Filealign:zero2wleft;"|| style="text-align: left;"||-img197.png]]</p></li><li><p>Then open the | '''Geany8''' editor to test the Chinese input method</p><p>[[File:zero2w-img198.png]]</p></li>| '''UART0_TX'''<li><p>The Chinese input method test is as follows</p>| '''PH0'''| '''224'''<p>[[File:zero2w|-img199.png]]</p></li><li><p>You can switch between Chinese and English input methods through the | '''Ctrl+Space10''' 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/localeUART0_RX''' to | '''zh_CN.UTF-8PH1'''</p><p>orangepi@orangepi:~$ | '''sudo vim /etc/default/locale225'''</p><p># File generated by update|-locale</p><p>LC_MESSAGES=| '''zh_CN.UTF-812'''</p><p>LANG| style='''zh_CN.UTF"text-8'''</p>align: left;"|<p>LANGUAGE=| '''zh_CN.UTF-8PI1'''</p></li><li><p>Then | '''restart the system257''' and you will see that the system is displayed in Chinese.</p><p>[[File:zero2w|-img200.png]]</p></li></ol>| '''14'''<span id| '''GND'''| style="installationtext-method-of-ubuntu-20.04-systemalign: left;"></span>|| style=== Installation method of Ubuntu 20.04 system ==="text-align: left;"| <ol style="list-style|-type: decimal;"><li><p>First open | '''Language Support16'''</p><p>[[File:zero2w-img201.png]]<| '''PWM4/p></li>UART4_RX'''<li><p>Then find the | '''Chinese (China)PI14''' option</p><p>[[File:zero2w| '''270'''|-img202.png]]</p></li><li><p>Then please use the left button of the mouse to select | '''Chinese (China)18''' and hold it down, then drag it up to the starting position. After dragging, the display will be as shown below:</p><p>[[File| style="text-align:zero2w-img203.png]]</p></li></ol>left;"|| '''PH4'''| '''Note that this step is not easy to drag, please be patient and try it a few times.228'''|-<ol start| '''20'''| '''GND'''| style="4text-align: left;" || style="list-styletext-typealign: decimalleft;">|<li><p>Then select |-| '''Apply System-Wide22''' 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 systemTWI0_SDA/UART2_RX''' system to | '''fcitxPI6'''</p><p>[[File:zero2w-img205.png]]</p></li><li><p>| '''Then restart the Linux system to make the configuration take effect262'''</p></li>|-| '''<lispan style="color:#FF0000">24<p/span>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</pspan style="color:#FF0000">SPI1_CS0<p/span>[[File'''| '''<span style="color:zero2w-img206.png]]</p#FF0000">PH5</lispan>'''| '''<li><p>Then you can see that the desktop is displayed in Chinese</p><p>[[Filespan style="color:zero2w-img207.png]]</p#FF0000">229</li><li><pspan>Then we can open '''Geany|-| ''' to test the Chinese input method. The opening method is as shown in the figure below</p><p>[[Filespan style="color:zero2w-img208.png]]</p#FF0000">26</lispan>'''| '''<lispan style="color:#FF0000">SPI1_CS1<p/span>After opening '''Geany| ''', the English input method is still the default. We can switch to the Chinese input method through the <span style="color:#FF0000">PH9</span>'''Ctrl+Space| ''' shortcut key, and then we can input Chinese.</pspan style="color:#FF0000">233<p/span>[[File:zero2w'''|-img209.png]]</p></li></ol>| '''28'''<span id="installation| '''TWI2-method-of-ubuntu-22.04-system"><SCL/span>UART3_TX'''| '''PI9'''| '''265'''|-| '''30'''| '''GND'''| style="text-align: left;"|| style== Installation method of Ubuntu 22.04 system ==="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 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></ol> '''Note that this step is not easy to drag, please be patient and try it a few times.''' <ol start="42" 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>'''Then restart the In Linux system to make the configuration take effect'''</p></li><li><p>After re-entering the system, please select '''Do not ask me again''' in the following interfacesystems, 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 spi1 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-img214.png]] </div></li><li><p>The interface after selection is as shown below, then click OK</p><p>[[File:zero2w-img215.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 turned off by default. We can switch to the Chinese input method through the '''Ctrl+Space''' shortcut key, and then we can enter Chinese.</p><p>[[File:zero2w-img216.png]]</p></li></ol> <span id="how-needs to-remotely-log-in-to-the-linux-system-desktop"></span>== How to remotely log in to the Linux system desktop == <span id="remote-login-using-nomachine"></span>=== Remote login using NoMachine === '''Please ensure that the Ubuntu or Debian system installed be turned 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 NoMachinemanually before it can be used. The document link is opening steps are as follows:''' '''https://knowledgebase.nomachine.com/DT10R00166''' '''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.''' '''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.''' <ol style="list-style-type: decimal;"><li><p>First download the installation package of the NoMachine software Linux '''arm64''' deb version, and then install it into the Linux system of the development board</p>
<ol style="list-style-type: lower-alpha;">
<li>Since H618 is an ARMv8 architecture SOC and the system we use is &gt; Ubuntu or Debian, we need <p>First run '''orangepi-config'''. Ordinary users remember to download the add '''NoMachine for ARM &gt; ARMv8 DEBsudo''' installation packagepermissions. The download link is as &gt</p>{| class="wikitable" style="width:800px; follows" |-| <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'''</olp><p>[[File:zero2w-img81.png]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown in the figure below, and then use the '''space''' to select the dtbo configuration of the SPI you want to open.</olp></li>
{| class="wikitable" style="width:800px;text-align: center;"|-| '''Note that this download link may change, please look for the Armv8/Arm64 version dtbo configuration'''| '''illustrate'''|-| '''spi1-cs0-cs1-spidev'''| '''Open cs0 and cs1 of spi1 at the deb package.same time'''|-[https://www.nomachine.com/download/download&id=112&s=ARM | '''spi1-cs0-spidev'''| '''https://downloads.nomachine.com/download/?id=118&amp;distro=ARMOnly open cs0 of spi1''']|-[[File:zero2w| '''spi1-cs1-img217.png]]spidev'''| '''Only open cs1 of spi1'''|}</ol><ol start="25" style="list-style-type: lower-alpha;"><li><p>In addition, you can also download the Then select '''NoMachine&lt;Save&gt;''' installation &gt; package from the official tool.to save</p><p>[[File:zero2w-img218img83.png]]</p></li><li><p>First enter the Then select '''remote login software-NoMachine&lt;Back&gt;''' folder</p><p>[[File:zero2w-img219img84.png]]</p></li><li><p>Then download select '''&lt;Reboot&gt;''' to restart the arm64 version of system to make the deb installation packageconfiguration take effect.</p><p>[[File:zero2w-img220img85.png]]</p></li></ol></li></ol><!-- --><ol start="3" style="list-style-type: decimal;"><li><p>Then upload the downloaded check whether there is a '''nomachine_xspidev1.x''' device node in the Linux system.x_x_arm64If it exists, it means that the SPI1 configuration has taken effect.deb</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ ''' to ls /dev/spidev1*'''</p><p>/dev/spidev1.0 /dev/spidev1.1</p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that only when you open spi1-cs0-cs1-spidev, you will see the &gt; Linux system device nodes of the development boardtwo spi.'''</p></big>|}</li><li><p>Then you can use the following command '''spidev_test.py''' program in examples to install test the SPI loopback function. The '''NoMachinespidev_test.py''' in program needs to specify the Linux &gtfollowing two parameters:</p><ol style="list-style-type: lower-alpha; system "><li><p>'''--channel''': Specify the channel number of the development boardSPI</p></li><li><p>orangepi@orangepi:~$ '''sudo dpkg -i nomachine_x.x.x_x_arm64_arm64.deb-port''': Specify the port number of the SPI</p></li></ol></li><li><p>Without shorting the mosi and miso pins of SPI1, the output result of running spidev_test.py is as follows. You can see that the data of TX and RX are inconsistent.</p>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p> root@orangepi:~/wiringOP-Python/examples# '''python3 spidev_test.py \''' '''--channel 1 --port 0'''
<!-- --><ol start="2" style="list-style-typespi mode: decimal;"><li>Then download the installation package of the Windows version of the NoMachine software. The download address is as follows</li></ol>0x0
'''Note that this download link may change.'''max speed: 500000 Hz (500 KHz)
'''https:Opening device /dev/downloadsspidev1.nomachine.com/download/?id=9'''1
[[FileTX | FF FF FF FF FF FF '''<span style="color:zero2w-img221#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 |.png]].....@.......…|
RX | FF FF FF FF FF FF '''<ol start="3" span style="list-style-typecolor: decimal;#FF0000">FF FF FF FF FF FF<li/span><p>Then install NoMachine in Windows. '''Please restart your computer after installationFF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF |............'''.….||}</p></li><li><p>Then open '''NoMachine''' in Window</pol><p>[[Fileol start="6" style="list-style-type:zero2w-img222.png]]</p></lidecimal;"><li><p>After NoMachine is started, it will automatically scan other devices with NoMachine installed on Then use Dupont wire to short-circuit the txd (pin 19 in the LAN. After entering 40pin interface) and rxd (pin 21 in the main 40pin interface ) of NoMachineSPI1 and then run spidev_test.py. The output is as follows, you can see that If the development board is already in data sent and received are the list of connectable devicessame, and then click on it means that the location shown in the red box in the picture below You can now log in to the Linux system desktop of the development boardSPI1 loopback test is normal.</p><p>[[File{| class="wikitable" style="width:zero2w800px;" |-img223.png]]| </p><root@orangepi:~/li><li><p>Then click wiringOP-Python# '''OKcd examples'''</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>
<span id="remote-login-usingroot@orangepi:~/wiringOP-vnc"><Python/span>=== Remote login using VNC ===examples# '''python3 spidev_test.py \'''
'''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.--channel 1 --port 0'''
'''There are many problems with VNC testing in Ubuntu20.04, please do not use this method.'''spi mode: 0x0
<ol style="list-style-typemax speed: decimal;"><li><p>First run the '''set_vnc.sh''' script to set up vnc, '''remember to add sudo permission'''s</p><p>orangepi@orangepi:~$ '''sudo set_vnc.sh'''</p><p>You will require a password to access your desktops.</p><p>Password: '''#Set the vnc password here, 8 characters'''</p><p>Verify: '''#Set the vnc password here, 8 characters'''</p><p>Would you like to enter a view-only password 500000 Hz (y/n500 KHz)? '''n'''</p><p>xauth: file /root/.Xauthority does not exist</p><p>New 'X' desktop is orangepi:1</p><p>Creating default startup script /root/.vnc/xstartup</p><p>Starting applications specified in /root/.vnc/xstartup</p><p>Log file is /root/.vnc/orangepi:1.log</p><p>Killing Xtightvnc process ID 3047</p><p>New 'X' desktop is orangepi:1</p><p>Starting applications specified in /root/.vnc/xstartup</p><p>Log file is /root/.vnc/orangepi:1.log</p></li><li><p>The steps to use MobaXterm software to connect to the development board Linux system desktop are as follows:</p><ol style="list-style-type: lower-alpha;"><li>First click Session, then select VNC, then fill in the IP &gt; address and port of the development board, and finally click &gt; OK to confirm.</li></ol></li></ol>
<div class="figure">Opening device /dev/spidev1.1
[[FileTX | FF FF FF FF FF FF '''<span style="color:zero2w-img227#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 |.png]].....@.......…|
RX | FF FF FF FF FF FF '''</div><ol start="2" span style="list-style-typecolor: lower-alpha;#FF0000"><li><p>Then enter the VNC password set earlier40 00 00 00 00 95</pspan>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…||}<p>[[File:zero2w-img228.png]]</pli></liol><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.</pspan id="pin-i2c-test-1"></li></olspan>
[[File:zero2w-img229.png]]=== 40pin I2C test ===
<span id="qt-installation-method"></span>== QT installation method ==# As can be seen from the table below, the i2c available for the 40pin interface are i2c0, i2c1 and i2c2
<ol div style="listdisplay: flex;">::{| class="wikitable" style="width:390px;margin-styleright: 20px;text-typealign: decimalcenter;"><li><p>Use the following script to install QT5 and QT Creator</p>|-<p>orangepi@orangepi:~$ | '''install_qtGPIO NO.sh'''</p></li><li><p>After installation, the QT version number will be automatically printed.</p>| '''GPIO'''<ol style| '''Function'''| '''Pin'''|-| style="listtext-align: left;"|| style="text-typealign: lower-alphaleft;">|<li><p>The qt version that comes with Ubuntu20.04 is | ''''5.123.83V'''</p><p>orangepi@orangepi:~$ | '''install_qt.sh1'''</p>|-| '''<pspan style="color:#FF0000">......264</pspan>'''<p>QMake version 3.1</p><p>Using Qt version | '''5.12.8''' in /usr/lib/aarch64-linux-gnu</pspan style="color:#FF0000">PI8</lispan>'''<li| '''<span style="color:#FF0000">TWI1-SDA<p/span>The QT version that comes with Ubuntu22.04 is '''5.15.3| '''</p>span style="color:#FF0000">3<p/span>orangepi@orangepi:~$ '''install_qt.sh|-| '''</pspan style="color:#FF0000">263<p>......</p/span>'''| '''<pspan style="color:#FF0000">QMake version 3.1v</pspan>'''<p>Using Qt version | '''5.15.3''' in /usr/lib/aarch64-linux-gnu</pspan style="color:#FF0000">TWI1-SCL</lispan>'''| '''<lispan style="color:#FF0000">5<p/span>The QT version that comes with Debian11 is '''5.15.2|-| '''</p><p>orangepi@orangepi:~$ 269'''install_qt.sh| '''PI13'''</p><p>......<| '''PWM3/p>UART4_TX'''<p>QMake version 3.1</p><p>Using Qt version | '''7''5.15.2''' in /usr/lib/aarch64|-linux| style="text-gnu</p></li>align: left;"|| style="text-align: left;"|<li><p>The QT version that comes with Debian12 is | '''5.15.8GND'''</p><p>orangepi@orangepi:~$ | '''9'''|-| '''install_qt.sh226'''</p><p>......</p>| '''PH2'''<p>QMake version 3.1</p><p>Using Qt version | '''UART5_TX'5.15.8''| ' in /usr/lib/aarch64-linux''11'''|-gnu</p></li></ol></li><li><p>Then you can see the QT Creator startup icon in | '''Applications227'''| '''PH3'''</p><p>[[File:zero2w-img230.png]]</p><p>You can also use the following command to open QT Creator</p><p>orangepi@orangepi:~$ | '''qtcreatorUART5_RX'''| '''13'''|-| '''</pspan style="color:#FF0000">261</lispan>'''| '''<li><pspan style="color:#FF0000">The interface after QT Creator is opened is as followsPI5</pspan>'''| '''<pspan style="color:#FF0000">[[File:zero2w-img231.png]]TWI0_SCL</pspan></li>UART2_TX'''| '''<lispan style="color:#FF0000"><p>The version of QT Creator is as follows15</pspan>'''|-<ol | style="listtext-align: left;"|| style="text-typealign: lower-alphaleft;">|<li><p>The default version of QT Creator in | '''Ubuntu203.043V''' is as &gt; follows</p><p>[[File:zero2w-img232.png]]</p></li>| '''17'''|-<li><p>The default version of QT Creator in | '''Ubuntu22.04231''' is as &gt; follows</p><p>[[File:zero2w-img233.png]]</p></li>| '''PH7'''| '''SPI1_MOSI'''<li><p>The default version of QT Creator in | '''Debian1119''' is as follows</p><p>[[File:zero2w|-img234.png]]</p></li><li><p>The default version of QT Creator in | '''232'''| '''Debian12PH8''' is as follows</p><p>[[File:zero2w| '''SPI1_MISO'''| '''21'''|-img235.png]]</p></li></ol></li><li><p>Then set up QT</p>| '''230'''<ol style="list-style-type: lower-alpha;"><li><p>First open | '''HelpPH6'''-&gt;| '''About Plugins...SPI1_CLK'''.</p><p>[[File:zero2w-img236.png]]</p></li><li><p>Then remove the check mark of | '''ClangCodeModel23'''</p><p>[[File|-| style="text-align:zero2wleft;"|| style="text-img237.png]]</p></li>align: left;"|<li><p>| '''After setting up, you need to restart QT CreatorGND'''</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.25'''</p>|-| '''<pspan style="color:#FF0000">[[File:zero2w-img238.png]]266</pspan>'''| '''<p>[[File:zero2w-img239.png]]span style="color:#FF0000">PI10</pspan>'''| '''</lispan style="color:#FF0000">TWI2-SDA</olspan></li>UART3_RX'''| '''<li><pspan style="color:#FF0000">Then you can open a sample code27</pspan>'''<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>| '''256'''| '''PI0'''<p>[[File| style="text-align:zero2w-img241.png]]</p></li>left;"|<li><p>Then click | '''Configure Project29'''</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>| '''271'''| '''PI15'''<p>[[File| style="text-align:zero2wleft;"|| '''31'''|-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>| '''268'''| '''PI12'''<p>[[File:zero2w-img244.png]]</p></li><li><p>References</p><p>[https://wiki.qt.io/Install_Qt_5_on_Ubuntu | '''PWM2'https://wiki.qt.io/Install_Qt_5_on_Ubuntu''| ']</p>''33'''|-<p>[https://download.qt.io/archive/qtcreator | '''https://download.qt.io/archive/qtcreator258''']</p><p>[https://download.qt.io/archive/qt | '''https://download.qt.io/archive/qtPI2''']</p></li></ol>| style="text-align: left;"|| '''35'''<span id="ros|-installation-method"></span>== ROS installation method ==| '''272'''| '''PI16'''<span id| style="howtext-to-install-ros-1-noetic-on-ubuntu20.04"></span>align: left;"|=== How to install ROS 1 Noetic on Ubuntu20.04 === # The currently active version of ROS 1 is as follows, the recommended version is | '''Noetic Ninjemys37''' [[File:zero2w|-img245.png]]| style="text-align: left;"|[[File| style="text-align:zero2w-img246.png]]left;"| [http://docs.ros.org/ | '''GND''http://docs.ros.org'''] | '''https://wiki.ros.org/Distributions39'''|}<ol start{| class="2wikitable" style="listwidth:390px;margin-styleright: 20px;text-typealign: decimalcenter;"><li><p>The link to the official installation documentation of ROS 1 |-| '''Noetic NinjemysPin''' is as follows:</p><p>[http://wiki.ros.org/noetic/Installation/Ubuntu | '''Function''http://wiki.ros.org/noetic/Installation/Ubuntu'| '''GPIO''']</p></li><li><p>In the official installation documentation of ROS | '''Noetic NinjemysGPIO NO.''', Ubuntu recommends using Ubuntu20.04, so please ensure that the system used by the development board is |-| '''Ubuntu20.04 desktop system2'''.</p><p>[http://wiki.ros.org/noetic/Installation | '''5V''http://wiki.ros.org/noetic/Installation''']</p><p>[[File| style="text-align:zero2w-img247.png]]</p></li>left;"|<li><p>Then use the script below to install ros1</p>| style="text-align: left;"|<p>orangepi@orangepi:~$ |-| '''install_ros.sh ros14'''</p></li><li><p>Before using the ROS tool, you first need to initialize rosdep. Then when compiling the source code, you can quickly install some system dependencies and some core components in ROS.</p></li></ol> | '''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.5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''The install_ros.sh script will try to modify /etc/hosts and automatically run the following commands. However, this method cannot guarantee that github can be accessed normally every time. If install_ros.sh prompts the following error after installing ros1, please find other ways to allow the linux system of the development board to access github normally, and then manually run the following Order.6''' | '''https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yamlGND'''| style="text-align: left;"|'''Hit https| style="text-align://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yamlleft;"||-| '''8''' | '''ERROR: error loading sources list:UART0_TX''' | '''The read operation timed outPH0''' orangepi@orangepi:~$ | ''''source /opt/ros/noetic/setup.bash224'''|-orangepi@orangepi:~$ | '''sudo rosdep init10''' Wrote /etc/ros/rosdep/sources.list.d/20-default.list Recommended: please run rosdep update orangepi@orangepi:~$ | '''rosdep updateUART0_RX'''| '''PH1'''reading in sources list data from /etc/ros/rosdep/sources.list.d| '''225'''|-Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx| '''12'''| style="text-homebrew.yamlalign: left;"|| '''PI1'''Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml| '''257'''|-Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml| '''14'''| '''GND'''Hit https| style="text-align://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yamlleft;"|| style="text-align: left;"||-Hit https://raw.githubusercontent.com| '''16'''| '''PWM4/ros/rosdistro/master/releases/fuerte.yamlUART4_RX'''| '''PI14'''Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index| '''270'''|-v4.yaml| '''18'''Skip end| style="text-of-life distro &quot;ardent&quotalign: left;"|| '''PH4'''Skip end-of-life distro &quot;bouncy&quot;| '''228'''|-Skip end-of-life distro &quot;crystal&quot;| '''20'''| '''GND'''Skip end| style="text-of-life distro &quot;dashing&quotalign: left;"| Skip end| style="text-of-life distro &quot;eloquent&quotalign: left;"| Add distro &quot;foxy&quot; Add distro &quot;galactic&quot; Skip end-of|-life distro &quot;groovy&quot;| '''<span style="color:#FF0000">22</span>'''Add distro &quot;humble&quot; Skip end-of-life distro &quot;hydro&quot| '''<span style="color:#FF0000">TWI0_SDA</span>/UART2_RX'''| '''<span style="color:#FF0000">PI6</span>'''| '''<span style="color:#FF0000">262</span>'''|-| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''<span style="color:#FF0000">28</span>'''| '''<span style="color:#FF0000">TWI2-SCL</span>/UART3_TX'''| '''<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>
Skip end<ol start="2" style="list-ofstyle-life distro &quot;indigo&quottype: 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>Skip end<ol style="list-ofstyle-life distro &quottype: lower-alpha;jade&quot"><li><p>First run '''orangepi-config'''. Ordinary users remember to add '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li><li><p>Then select '''System'''</p><p>[[File:zero2w-img80.png]]</p></li><li><p>Then select '''Hardware'''</p><p>[[File:zero2w-img81.png]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown in the picture below, and then use the '''space''' to select the corresponding i2c configuration in the picture below.</p></li>
Skip end{| class="wikitable" style="width:800px;text-align: center;"|-of| '''Multiplexing function in 40pin'''| '''Corresponding dtbo configuration'''|-life distro &quot;kinetic&quot;| '''40pin - i2c0'''| '''pi-i2c0'''|-| '''40pin - i2c1'''| '''pi-i2c1'''|-| '''40pin - i2c2'''| '''pi-i2c2'''|}
Skip end[[File:zero2w-ofimg173.png]]</ol><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-life distro img84.png]]</p></li><li><p>Then select <span class="mark">&quotlt;lunarReboot&quotgt;</span> to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol></li></ol><!-- --><ol start="3" style="list-style-type: decimal;"><li><p>After starting the Linux system, first confirm that there is an open i2c device node under <span class="mark">/dev</span></p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''ls /dev/i2c-*'''</p><p>'''/dev/i2c-*'''</p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''注意,这里说的Linux镜像具体指的是从Orange Pi资料下载页面下载的Debian或者Ubuntu这样的Linux发行版镜像。'''</big>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Sometimes the i2c device node and the i2c bus serial number do not correspond one to one. For example, the i2c device node of the i2c1 bus may be /dev/i2c-3.'''</p><p>'''The method to accurately confirm the device node under /dev corresponding to the i2c bus is: '''</p></big>
Add distro &quot;melodic&quot;
Add distro <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;noetici2c-[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>
Add distro &quot;rolling&quot;
updated cache in <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 start testing i2c, first install i2c-tools</homep>{| class="wikitable" style="width:800px;" |-| <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.rosHere we take the DS1307 RTC module as an example.</rosdepp><p>[[File:zero2w-img178.png]]</sourcesp></li><li><p>Then use the '''i2cdetect -y x'''command.cacheIf the address of the connected i2c device can be detected, it means that the i2c device is connected correctly.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''<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>'''</big>|}
[[File:zero2w-img179.png]]</li></ol><ol start="67" style="list-style-type: decimal;"><li><p>Then open a command line terminal window on you can run the '''desktopds1307.py''', and then use the test program in '''test_ros.shexamples''' script to start a small turtle routine read the RTC time</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that the x in i2c-x in the following command needs to test whether ROS can be used normallyreplaced with the serial number of the device node corresponding to the i2c bus.'''</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>orangepiroot@orangepi:~$ /wiringOP-Python# '''test_ros.shcd examples'''</p><p>root@orangepi:~/wiringOP-Python/examples# '''python3 ds1307.py --device \'''</lip><li><p>After running the '''test_ros.sh&quot;/dev/i2c-x&quot;''' script, a small turtle as shown in the picture below will pop up.</p><p>[[FileThu 2022-06-16 04:35:zero2w46</p><p>Thu 2022-06-img248.png]]16 04:35:47</p><p>Thu 2022-06-16 04:35:48</lip><lip>^C</p><p>Then please keep the terminal window you just opened at the topexit</p>|}</li></ol>
<div classspan id="figurepin-uart-test-1"></span>
[[File:zero2w-img249.png]]=== 40pin UART test ===
</div><ol start="9" style="list-style-type: decimal;"><li><p>At this time# As can be seen from the table below, press the direction keys on the keyboard to control the little turtle to move upavailable uarts are uart2, down, leftuart3, uart4 and rightuart5. Please note that uart0 is set as a debugging serial port by default.</p><p>[[File:zero2w-img250Please do not use uart0 as a normal serial port.png]]</p></li></ol>
<span iddiv style="how-to-install-ros-2-galactic-on-ubuntu20.04display: flex;"></span>::{| class="wikitable" style== How to install ROS 2 Galactic on Ubuntu20.04 === <ol style="list-style"width:390px;margin-right: 20px;text-typealign: decimalcenter;"><li><p>The currently active version of ROS 2 is as follows, the recommended version is |-| '''GPIO NO.'''| '''Galactic GeocheloneGPIO'''</p><p>[[File:zero2w-img251.png]]</p>| '''Function'''<p>[[File:zero2w-img252.png]]</p><p>[http://docs.ros.org/ | '''http://docs.ros.orgPin''']</p><p>|-| style="text-align: left;"|| style="text-align: left;"|| '''http://docs3.ros.org/en/galactic/Releases.html3V'''</p></li><li><p>The link to the official installation documentation of ROS 2 | '''Galactic Geochelone1''' is as follows:</p><p>|-| '''264'docs.ros.org/en/galactic/Installation.html''| '''PI8'''</p><p>| '''http://docs.ros.org/en/galactic/Installation/Ubuntu-InstallTWI1-Debians.htmlSDA'''</p></li><li><p>In the official installation documentation of ROS 2 | '''Galactic Geochelone3''', Ubuntu Linux recommends using Ubuntu20.04, so please ensure that the system used by the development board is the |-| '''Ubuntu20.04 desktop system263'''. There are several ways to install ROS 2. The following demonstrates how to install ROS 2 | '''Galactic GeochelonePI7''' through | '''Debian packagesTWI1-SCL'''.</p></li><li><p>Use the | '''install_ros.sh5''' script to install ros2</p><p>orangepi@orangepi:~$ |-| '''install_ros.sh ros2269'''</p></li><li><p>The | '''PI13'install_ros.sh''| ' script will automatically run the ''PWM3/UART4_TX'ros2 -h''| ' command after installing ros2. If you can see the following print, it means that the ros2 installation is complete.</p>''7'''|-<p>usage| style="text-align: ros2 [left;"|| style="text-h] Call `ros2 &lt;command&gtalign: left; -h` for more detailed usage. ...</p>"|<p>ros2 is an extensible command-line tool for ROS 2.</p>| '''GND'''<p>optional arguments:</p>| '''9'''<p>-h, -|-help show this help message and exit</p><p>Commands:</p>| '''226'''<p>action Various action related sub-commands</p>| '''PH2'''<p>bag Various rosbag related sub-commands</p>| '''UART5_TX'''<p>component Various component related sub-commands</p>| '''11'''<p>daemon Various daemon related sub|-commands</p><p>doctor Check ROS setup and other potential issues</p>| '''227'''<p>interface Show information about ROS interfaces</p>| '''PH3'''<p>launch Run a launch file</p>| '''UART5_RX'''<p>lifecycle Various lifecycle related sub-commands</p>| '''13'''<p>multicast Various multicast related sub|-commands</p><p>node Various node related sub-commands</p>| '''261'''<p>param Various param related sub-commands</p>| '''PI5'''<p>pkg Various package related sub-commands<| '''TWI0_SCL/p>UART2_TX'''<p>run Run a package specific executable</p>| '''15'''<p>security Various security related sub|-commands</p><p>service Various service related sub| style="text-commands</p>align: left;"|<p>topic Various topic related sub| style="text-commands</p>align: left;"|<p>wtf Use `wtf` as alias to `doctor`</p>| '''3.3V'''<p>Call `ros2 &lt;command&gt; | '''17'''|-h` for more detailed usage.</p></li><li><p>Then you can use the | '''test_ros.sh231''' 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.shPH7'''</p><p>[INFO] [1671174101.200091527] [talker]: Publishing: | '''SPI1_MOSI''Hello World: 1'</p><p>[INFO] [1671174101.235661048] [listener]: I heard: [Hello World: 1]</p><p>[INFO] [1671174102.199572327] [talker]: Publishing: | '''19''Hello World: 2'</p><p>[INFO] [1671174102.204196299] [listener]: I heard: [Hello World: 2]</p>|-<p>[INFO] [1671174103.199580322] [talker]: Publishing: | '''232''Hello World: 3'</p><p>[INFO] [1671174103.204019965] [listener]: I heard: [Hello World: 3]</p></li>| '''PH8'''<li><p>Run the following command to open rviz2</p>| '''SPI1_MISO'''<p>orangepi@orangepi:~$ | '''source /opt/ros/galactic/setup.bash21'''</p><p>orangepi@orangepi:~$ |-| '''ros2 run rviz2 rviz2230'''</p><p>[[File:zero2w-img253.png]]</p></li>| '''PH6'''| '''SPI1_CLK'''<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 | '''23'http://docs.ros.org/en/galactic/Tutorials.html''']</p></li></ol>|-<span id| style="howtext-toalign: left;"|| style="text-install-ros-2-humble-on-ubuntu22.04align: left;"></span>|=== How to install ROS 2 Humble on Ubuntu22.04 ===| '''GND'''| '''25'''<ol style="list-style|-type: decimal;"><li><p>Use the install_ros.sh script to | '''install_ros.sh266'''</p><p>orangepi@orangepi:~$ | '''install_ros.sh ros2PI10'''<| '''TWI2-SDA/p></li><li><p>The UART3_RX'''install_ros.sh| ''' script will automatically run the 27'''ros2 |-h| '''256'''| '''PI0''' command after installing ros2. If you can see the following print, it means that the ros2 installation is complete.</p><p>usage| style="text-align: ros2 [-h] Call `ros2 &ltleft;command&gt; -h` for more detailed usage. ...</p>"|| '''29'''<p>ros2 is an extensible command|-line tool for ROS 2.</p><p>optional arguments:</p>| '''271'''| '''PI15'''<p>| style="text-h, --help show this help message and exit</p>align: left;"|<p>Commands:</p>| '''31'''<p>action Various action related sub|-commands</p><p>bag Various rosbag related sub-commands</p>| '''268'''<p>component Various component related sub-commands</p>| '''PI12'''<p>daemon Various daemon related sub-commands</p>| '''PWM2'''<p>doctor Check ROS setup and other potential issues</p>| '''33'''<p>interface Show information about ROS interfaces</p>|-<p>launch Run a launch file</p>| '''258'''<p>lifecycle Various lifecycle related sub-commands</p>| '''PI2'''<p>multicast Various multicast related sub| style="text-commands</p>align: left;"|<p>node Various node related sub-commands</p>| '''35'''<p>param Various param related sub|-commands</p><p>pkg Various package related sub-commands</p>| '''272'''<p>run Run a package specific executable</p>| '''PI16'''<p>security Various security related sub| style="text-commands</p>align: left;"|<p>service Various service related sub| '''37'''|-commands</p><p>topic Various topic related sub| style="text-commands</p>align: left;"|<p>wtf Use `wtf` as alias to `doctor`</p><p>Call `ros2 &lt| style="text-align: left;command&gt; -h` for more detailed usage.</p></li>"|<li><p>Then you can use the | '''test_ros.shGND''' 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.sh39'''</p><p>[INFO] [1671174101.200091527] [talker]|}{| class="wikitable" style="width: Publishing390px;margin-right: 20px;text-align: center;"|-| '''Pin''Hello World: 1'</p><p>[INFO] [1671174101.235661048] [listener]: I heard: [Hello World: 1]</p>| '''Function'''<p>[INFO] [1671174102.199572327] [talker]: Publishing: | '''GPIO''Hello World: 2'</p><p>[INFO] [1671174102| '''GPIO NO.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:~$ 2'''source /opt/ros/humble/setup.bash'''</p><p>orangepi@orangepi:~$ | '''ros2 run rviz2 rviz25V'''</p><p>[[File| style="text-align:zero2w-img254.png]]</p></li>left;"|| style="text-align: left;"|<li><p>Reference documentation</p>|-<p>| '''http://docs.ros.org/en/humble/index.html4'''</p><p>[http://docs.ros.org/en/galactic/Tutorials.html | '''5V'''http://docs.ros.org/en/humble/Installation/Ubuntu| style="text-align: left;"|| style="text-Installalign: left;"||-Debians.html| '''6''']</p></li></ol>| '''GND'''<span id| style="howtext-to-install-kernel-header-filesalign: left;"></span>|| style== How to install kernel header files =="text-align: left;"||-| '''Debian11 system with Linux6.1 kernel will report GCC error when compiling kernel module. So if you want to compile the kernel module, please use Debian12 or Ubuntu22.04.8'''| '''UART0_TX'''<ol style="list-style-type: decimal;">| '''PH0'''<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/224'''|-| '''10'''</p><p>orangepi@orangepi:~$ | '''ls /opt/linux-headers*UART0_RX'''</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:~$ | '''PH1''sudo dpkg -i /opt/linux-headers*.deb'| '''225'''</p></li><li><p>After installation, you can see the folder where the kernel header file is located under |-| '''/usr/src12'''.</p><p>orangepi@orangepi:~$ | style="text-align: left;"|| '''ls /usr/srcPI1'''</p><p>linux-headers| '''257'''|-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/hello14'''. After entering this directory, then use the make command to compile.</p><p>orangepi@orangepi:~$ | '''cd /usr/src/hello/GND'''</p><p>orangepi@orangepi| style="text-align:/usr/src/hello$ left;"|| style="text-align: left;"||-| '''16'''sudo make| '''<PWM4/p>UART4_RX'''<p>make -C /lib/modules/5.4.125/build M=/usr/src/hello modules</p>| '''PI14'''<p>make[1]: Entering directory | '''270''/usr/src/linux-headers-5.4.125'</p><p>CC [M] /usr/src/hello/hello.o</p>|-<p>Building modules, stage 2.</p>| '''18'''<p>MODPOST 1 modules</p>| style="text-align: left;"|<p>CC [M] /usr/src/hello/hello.mod.o</p>| '''PH4'''<p>LD [M] /usr/src/hello/hello.ko</p>| '''228'''<p>make[1]: Leaving directory '/usr/src/linux|-headers-5.4.125'</p></li><li><p>After compilation, the | '''hello.ko20''' kernel module will be generated</p><p>orangepi@orangepi:/usr/src/hello$ | '''GND'''ls *.ko| style="text-align: left;"|| style="text-align: left;"||-| '''22'''</p><p>hello.ko</p></li><li><p>Use the | '''insmodTWI0_SDA/UART2_RX''' command to insert the | '''hello.koPI6''' kernel module into the kernel</p><p>orangepi@orangepi:/usr/src/hello$ | '''sudo insmod hello.ko262'''</p></li><li><p>Then use the |-| '''demsg24''' command to view the output of the | '''hello.koSPI1_CS0''' kernel module. If you can see the following output, it means that the | '''hello.koPH5''' kernel module is loaded correctly.</p><p>orangepi@orangepi:/usr/src/hello$ | '''dmesg | grep &quot;Hello&quot;229'''</p><p>[ 2871.893988] |-| ''''Hello Orange Pi -- init26'''</p></li><li><p>Use the | '''rmmodSPI1_CS1''' command to uninstall the | '''hello.koPH9''' kernel module</p><p>orangepi@orangepi:/usr/src/hello$ | '''233'''|-| '''sudo rmmod hello28'''</p><p>orangepi@orangepi:/usr/src| '''TWI2-SCL/hello$ UART3_TX'''dmesg | grep &quot;Hello&quot;'''</p>PI9'''| '''265'''<p>[ 2871.893988] Hello Orange Pi |-- init</p><p>[ 3173.800892] | '''Hello Orange Pi -- exit30'''| '''GND'''</p></li></ol>| style="text-align: left;"|<span id| style="testingtext-of-some-programming-languages-supported-by-linux-systemalign: left;"></span>|== Testing of some programming languages supported by Linux system ==|-| '''32'''<span id="debian-bullseye-system"></span>| '''PWM1'''| '''PI11'''=== Debian Bullseye system ===| '''267'''|-<ol | '''34'''| '''GND'''| style="listtext-align: left;"|| style="text-typealign: decimalleft;">|<li><p>Debian Bullseye is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.</p>|-| '''36'''<ol | style="list-styletext-typealign: lower-alphaleft;">|<li><p>The version of a.gcc is as follows</p>| '''PC12'''<p>orangepi@orangepi:~$ | '''gcc --version76'''</p><p>gcc (Debian 10.2.1|-| '''38'''| style="text-6) 10.2.1 20210110</p><p>Copyright (C) 2020 Free Software Foundation, Inc.</p><p>This is free softwarealign: left; see the source for copying conditions. There is NO</p>"|<p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p></li>| '''PI4'''<li><p>Write the | '''hello_world.c260''' program in C language</p><p>orangepi@orangepi:~$ |-| '''vim hello_world.c40'''</p><p>#include &lt;stdio.h&gt| style="text-align: left;"|| '''PI3'''| '''259'''|}</pdiv> <p>int main(void)</pol start="2" style="list-style-type: decimal;"><pli>{</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 Bullseye has Python3 installed by default</p><ol style="list-style-type: lower-alpha;"><li><p>The specific version of Python is as follows</p><p>orangepi@orangepi:~$ '''python3'''</p><p>'''Python 3.9.2''' (default, Feb 28 2021, 17:03:44)</p><p>[GCC 10.2.1 20210110] on linux</p><p>Type &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.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 style="list-style-type: lower-alpha;"><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><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.java'''</p><p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p><p>public static void main(String[] args)</p><p>{</p><p>System.out.println(&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="debian-bookworm-system"></span>=== Debian Bookworm system === <ol style="list-style-type: decimal;"><li><p>Debian Bookworm is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.</p><ol style="list-style-type: lower-alpha;"><li><p>The version of a.gcc is as follows</p><p>orangepi@orangepi:~$ '''gcc --version'''</p><p>gcc (Debian 12.2.0-14) 12.2.0</p><p>Copyright (C) 2022 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p></li><li><p>Write the '''hello_world.c''' program in C language</p><p>orangepi@orangepi:~$ '''vim hello_world.c'''</p><p>#include &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 default</p><ol style="list-style-type: lower-alpha;"><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.py'''</p><p>Hello World!</p></li></ol></li><li><p>Debian Bookworm does not install Java compilation tools and operating environment by defaultIn 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>You can use the following command First run '''orangepi-config'''. Ordinary users remember to install openjdk. The latest &gt; version in Debian Bookworm is openjdk-17</p><p>orangepi@orangepi:~$ add '''sudo apt install -y openjdk-17-jdk'''permissions.</p></li><li><p>After installation, you can check the Java version.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''java -sudo orangepi-versionconfig'''</p>|}</li><li><p>Write the Java version of Then select '''hello_world.javaSystem'''</p><p>orangepi@orangepi[[File:~$ '''vim hello_worldzero2w-img80.java'''</p><p>public class hello_world</p><p>{</p><p>public static void main(String[png]] args)</p><p>{</p><p>System.out.println(&quot;Hello World!&quot;);</p><p>}</p><p>}</p></li><li><p>Then compile and run select '''hello_world.javaHardware'''</p><p>orangepi@orangepi[[File:~$ '''javac hello_worldzero2w-img81.java'''png]]</p></li><li><p>orangepi@orangepi:~$ Then use the keyboard's arrow keys to locate the position shown in the picture below, and then use the '''java hello_worldspace'''</p><p>Hello World!to select the serial port you want to open.</p></li></ol></li></ol>
<span id{| class="ubuntuwikitable" style="width:800px;text-align: center;"|-| '''Multiplexing function in 40pin'''| '''Corresponding dtbo configuration'''|-| '''40pin - uart2'''| '''pi-uart2'''|-| '''40pin - uart3'''| '''pi-uart3'''|-| '''40pin -focaluart4'''| '''pi-system"></span>uart4'''|-| '''40pin - uart5'''| '''ph-uart5'''=== Ubuntu Focal system ===|}
<ol style="list[[File:zero2w-style-type: decimal;">img175.png]]<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.</pol><ol start="5" style="list-style-type: lower-alpha;"><li><p>The version of a.gcc is as follows</p><p>orangepi@orangepi:~$ Then select '''gcc --version&lt;Save&gt;'''to save</p><p>gcc (Ubuntu 9.4.0[[File:zero2w-1ubuntu1~20.04.1) 9.4img83.0png]]</p><p/li>Copyright (C) 2019 Free Software Foundation, Inc.</pli><p>This is free softwareThen select '''&lt;Back&gt; see the source for copying conditions. There is NO'''</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE[[File:zero2w-img84.png]]</p></li><li><p>Write the Then select '''hello_world.c&lt;Reboot&gt;''' program in C languageto restart the system to make the configuration take effect.</p><p>orangepi@orangepi[[File:~$ '''vim hello_worldzero2w-img85.c'''png]]</p><p/li>#include &lt;stdio.h&gt;</pol><p/li>int main(void)</pol><p>{</p!-- --><p>printf(&quotol start="3" style="list-style-type: decimal;Hello World!\n&quot;);</p"><pli>return 0;</p>After entering the Linux system, first confirm whether there is a uart5 device node under '''<pspan class="mark">}/dev</pspan>'''</lip>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <libig><p>Then compile and run '''hello_world注意, linux5.4系统为/dev/ttyASx.c'''</p><p/big>orangepi@orangepi|}{| class="wikitable" style="width:~$ '''gcc 800px;" |-o hello_world hello_world.c'''</p>| <p>orangepi@orangepi:~$ '''.ls /dev/hello_worldttyS*'''</p><p>Hello World!</p><dev/li>ttySx</olp>|}
</li>
<li><p>Ubuntu Focal has Python3 installed by default</p><ol style="listThen start testing the uart interface. First use Dupont wire to short-style-type: lower-alpha;"><li><p>The specific version circuit the rx and tx pins of 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 uart interface to exit python's interactive modebe tested.'''</p></li><li><p>Write Use the '''hello_world.pygpio''' program command in Python language</p><p>orangepi@orangepi:~$ '''vim hello_worldwiringOP to test the loopback function of the serial port as shown below.py'''</p><p>If you can see the following print('Hello World!')</p></li><li><p>The result of running '''hello_world.py''' , it means the serial port communication is as follows</p><p>orangepi@orangepi:~$ '''python3 hello_worldnormal.py'''</p><p>Hello World!</p></li></ol></li><li><p>Ubuntu Focal does not have Java compilation tools and running environment installed by default.</p><ol {| class="wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;"><li><p>You can use the following command to install openjdk|-17| </pbig><p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''<Note that the last x in the gpio serial /p><dev/li><li><p>After installation, you can check ttySx command needs to be replaced with the serial number of the Java versioncorresponding uart device node.</p><p>orangepi@orangepi:~$ '''java --version'''</p><p>openjdk 17.0.2 2022-01-18</pbig><p>OpenJDK Runtime Environment (build 17.0.2+8-Ubuntu-120.04)</p>|}{| class="wikitable" style="width:800px;" <p>OpenJDK 64|-Bit Server VM (build 17.0.2+8-Ubuntu-120.04, mixed mode, sharing)</p></li><li><p>Write the Java version of '''hello_world.java'''</p>| <p>orangepi@orangepi:~$ '''vim hello_world.java'''<gpio serial /p><p>public class hello_world<dev/p><p>{</p><p>public static void main(String[] args)</p><p>{</p><p>System.out.println(ttySx &nbsp;&nbsp;&nbsp;&quotnbsp;Hello World!&quotnbsp;)&nbsp;</p><p>}</p><p>}</p></li><li><p>Then compile and run '''hello_world# linux-6.java1 test command'''</p><p>orangepi@orangepi:~$ '''javac hello_worldgpio serial /dev/ttyASx &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # linux-5.java'''</p><p>orangepi@orangepi:~$ '''java hello_world4 test command'''</p><p>Hello World!</p></li></ol></li></ol>
<span id="ubuntu-jammy-system"></span>
=== Ubuntu Jammy system ===
<ol style="list-style-type: decimal;"><li><p>Ubuntu Jammy is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.</p><ol style="list-style-typeOut: 0: lower-alpha&gt;"><li><p>The version of a.gcc is as follows0</p><p>orangepi@orangepiOut: 1:~$ '''gcc --version'''</p><p>gcc (Ubuntu 11.3.0-1ubuntu1~22.04.&gt; 1) '''11.3.0'''</p><p>Copyright (C) 2021 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p></li><li><p>Write the '''hello_world.c''' program in C language</p><p>orangepi@orangepiOut: 2:~$ '''vim hello_world.c'''</p><p>#include &lt;stdio.h-&gt;2</p><p>int main(void)</p><p>{</p><p>printf(Out: 3: -&quot;Hello World!\n&quot;)gt;3^C</p><p>return 0;</p>|}<p>}</p></li><li><p>Then compile and Finally, you can run the '''hello_worldserialTest.cpy'''</p><p>orangepi@orangepi:~$ '''gcc -o hello_world hello_worldprogram in examples to test the loopback function of the serial port.c'''</p><p>orangepi@orangepi:~$ '''If you can see the following print, it means that the serial port loopback test is normal./hello_world'''</p><p>Hello World!</p></li></ol></li><li><p>Ubuntu Jammy has Python3 installed by default</p><ol {| class="wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;">|-| <libig><p>The specific version of Python3 is as follows</p><p>orangepi@orangepi:~$ '''python3'''<Note that the x in /p><p>Python 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0] on linux<dev/p><p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; ttySx or &quot;license&quot; for more information.</p><p>&gt;&gt;&gt;<dev/p><p>'''Use ttyASx in the Ctrl+D shortcut key command needs to exit python's interactive mode.'''</p></li><li><p>Write be replaced with 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 serial number of running '''hello_worldthe corresponding uart device node.py''' is as follows</p><p>orangepi@orangepi:~$ '''python3 hello_world.py'''</pbig><p>Hello World!</p></li></ol>|}</li><li><p>Ubuntu Jammy does not install Java compilation tools and operating environment by default.</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>You can use the following command to install openjdk|-18</p>| <p>orangepiroot@orangepi:~$ /wiringOP-Python# '''sudo apt install -y openjdk-18-jdkcd examples'''</p></li><li><p>After installation, you can check the Java version.</p><p>orangepiroot@orangepi:~$ '''java /wiringOP--versionPython/examples# '''</p><p>openjdk 18python3 serialTest.0.2py -ea 2022-07-19<device &quot;/p><p>OpenJDK Runtime Environment (build 18.0.2-ea+9-Ubuntu-222.04)<dev/p><p>OpenJDK 64-Bit Server VM (build 18ttySx&quot; # linux6.0.2-ea+9-Ubuntu-222.04, mixed mode, sharing)</p></li><li><p>Write the Java version of '''hello_world.java1 use'''</p><p>orangepiroot@orangepi:~$ /wiringOP-Python/examples# '''vim hello_worldpython3 serialTest.py --device &quot;/dev/ttyASx&quot; # linux5.java4 use'''</p><p>public class hello_world</p><p>{</p><p>public static void main(String[] args)Out: 0: -&gt; 0</p><p>{Out: 1: -&gt; 1</p><p>System.out.println(Out: 2: -&quot;Hello World!&quot;)gt;2</p><p>}Out: 3: -&gt; 3</p><p>}</p></li><li><p>Then compile and run '''hello_world.java'''</p><p>orangepi@orangepiOut: 4:~$ '''javac hello_world.java'''^C</p><p>orangepi@orangepi:~$ '''java hello_world'''exit</p><p>Hello World!</p></li></ol>|}
</li></ol>
<span id="methodhardware-ofwatchdog-uploading-files-to-the-development-board-linux-systemtest"></span>== Method of uploading files to the development board Linux system ==
<span id="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 =Hardware watchdog test ==
<span id="howThe watchdog_test program is pre-to-upload-files-using-scp-command"></span>installed in the Linux system released by Orange Pi and can be tested directly. ==== How The method to upload files using scp command ====run the watchdog_test program is as follows:
<ol style="list-style-type: decimal;">
<li><p>Use the scp command to upload files to the Linux system of the development board in Ubuntu PC. The specific command is as follows</p>
<ol style="list-style-type: lower-alpha;">
<li><p>'''file_path: '''Needs to be replaced with The second parameter 10 represents the path counting time of the file to &gt; be uploadedwatchdog. If the dog is not fed within this time, the system will restart.</p></li><li><p>'''orangepi: '''This is We can feed the dog by pressing any key on the keyboard (except ESC). After feeding the user name of dog, the development board's program will print a line &gtquot; Linux system. It can also be replaced with something else, keep alive&gtquot; such as rootto indicate that the dog feeding is successful.</p></li><li>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''192.168.xx.xx:sudo watchdog_test 10''' This is the IP address of the development &gt; board. Please modify it according to the actual situation.</p><p>open success</lip><lip>options is 33152,identity is sunxi-wdt</p><p>'''/home/orangepiput_usr return,if 0,success:''' The path in the development board Linux &gt; system can also be modified to other paths.0</p><p>test@testThe old reset time is:~$ '''scp file_path orangepi@192.168.xx.xx:/home/orangepi/'''16</p></lip>return ENOTTY,if -1,success:0</olp><p>return ENOTTY,if -1,success:0</lip><li><p>If you want to upload a folderput_user return,if 0, you need to add the -r parametersuccess:0</p><p>test@test:~$ '''scp -r dir_path orangepi@192.168.xx.xxput_usr return,if 0,success:0</home/orangepi/'''p></p>keep alive</lip><lip>keep alive</p><p>There are more usages of scp, please use the following command to view the man manualkeep alive</p>|}</li></ol>
test@test:~$ '''man scp'''<span id="check-the-chipid-of-h618-chip"></span>
<span id="how-to-upload-files-using-filezilla"></span>==== How to upload files using filezilla ==Check the chipid of H618 chip ==
<ol style="list-style-type: decimal;"><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 The command to open filezilla</p><p>test@test:~$ '''filezilla'''</p></li><li><p>The interface after opening filezilla view the H618 chip chipid is as shown belowfollows. At this timeThe chipid of each chip is different, the remote site on the right is emptyso you can use chipid to distinguish multiple development boards.</p><div class="figure">
[[File{| class="wikitable" style="width:zero2w800px;" |-img255.png]]| orangepi@orangepi:~$ '''cat /sys/class/sunxi_info/sys_info | grep &quot;chipid&quot;'''
</div></li>sunxi_chipid : 338020004c0048080147478824681ed1<li><p>The method of connecting the development board is as shown in the figure below</p></li></ol>|}
<div classspan id="figurepython-related-instructions"></span>
[[File:zero2w-img256.png]]== Python related instructions ==
</div><ol startspan id="5" style="listhow-to-stylecompile-type: decimal;"><li><p>Then choose to '''save the password''' and click '''OK'''</p><p>[[File:zero2w-img257.png]]</pinstall-python-source-code"></lispan><li><p>Then select '''Always trust this host''' === How to compile and click '''OK'''</p></li></ol>install Python source code ===
<div {| class="figurewikitable"style="background-color:#ffffdc;width: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.'''
[[File:zero2w-img258'''The following demonstration is to compile and install the latest version of Python 3.png]]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>|}
<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 \'''</divp><ol startp>'''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 of Python3.9 source code and unzip it</p>{| class="7wikitable" style="listwidth:800px;" |-| <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;" |-type| <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: decimal800px;"|-| <p>orangepi@orangepi:~$ '''make -j4'''</p><p>orangepi@orangepi:~$ '''sudo make altinstall'''</p>|}</li><li><p>After the connection is successfulinstallation, you can see use the directory structure following command to check the version number of the development boardPython you just installed.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ ''s Linux file system on the right side of the filezilla software'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>
<div classspan id="figurehow-to-replace-pip-source-in-python"></span>
[[File:zero2w-img259.png]]=== How to replace pip source in Python ===
</div><ol start{| class="8wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;">|-| <libig>Then select '''The default source used by Linux system pip is the path to be uploaded to the development board on the right side official source of the filezilla softwarePython. However, select accessing the file to be uploaded official source of Python in Ubuntu PC on China is very slow, and the left side installation of the filezilla Python software, right-click packages often fails due to network reasons. So when using pip to install the mousePython library, and then click the upload option please remember to start uploading change the file to the development boardpip source.'''</li></olbig>|}
<div ol style="list-style-type: decimal;"><li><p>First install '''python3-pip'''</p>{| class="figurewikitable"style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt-get update'''</p[[File<p>orangepi@orangepi:zero2w~$ '''sudo apt-img260.png]]get install -y python3-pip'''</p>|}</divli><li><p>How to permanently change the pip source under Linux</p><ol start="9" style="list-style-type: decimallower-alpha;"><li><p>After First create a new '''~/.pip''' directory, then add the upload is completed'''pip.conf''' configuration file, you can go to and set the corresponding path pip source in the development board Linux system it to view the uploaded fileTsinghua source.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''mkdir -p ~/.pip'''</p><p>orangepi@orangepi:~$ '''cat &lt;&lt;EOF &gt; ~/.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>The method of uploading a folder is Then use pip3 to install the same as Python library very quickly</p></li></ol></li><li><p>How to temporarily change the method of uploading pip source under Linux, where '''&lt;packagename&gt;''' needs to be replaced with a file, so I wonspecific package name</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''pip3 install &lt;packagename&gt; -i \'''</p><p>'''t go into details herehttps://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn'''</p>|}</li></ol>
<span id="methodhow-to-uploadinstall-files-from-windows-pc-to-development-board-linux-systemdocker"></span>=== Method to upload files from Windows PC to development board Linux system ===
<span id="how-to-upload-files-using-filezilla-1"></span>==== How to upload files using filezilla ==install Docker ==
# First download 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 installation file of docker service, and then you can start using the Windows version of docker command, and the filezilla softwaredocker service will be automatically started the next time you start the system. The download link is as follows
[https{| class="wikitable" style="width://filezilla800px;" |-project.org/download.php?type=client | orangepi@orangepi:~$ '''https://filezilla-projectenable_docker.org/download.php?type=clientsh''']|}
[[File:zero2wYou can use the following command to test docker. If '''hello-img261world''' can be run, docker can be used normally.png]]
<div {| class="figurewikitable">style="width:800px;" |-| orangepi@orangepi:~$ '''docker run hello-world'''
[[FileUnable to find image 'hello-world:zero2w-img262.png]]latest' locally
</div><ol start="2" style="list-style-typelatest: decimal;"><li><p>The downloaded installation package is as shown below, then double-click to install it directly<Pulling from library/p><p>'''FileZilla_Server_1.5.1_win64hello-setup.exe'''</p></li></ol>world
During the installation process, please select '''Decline''' on the following installation interface, and then select '''Next&gt;'''256ab8fe8778: Pull complete
<div class="figure">Digest: sha256:7f0a9f93b4aa3022c3a4c147a449ef11e0941a1fd0bf4a8e6c9408b2600777c5
[[FileStatus:zero2wDownloaded newer image for hello-img263.png]]world:latest
</div>
<ol start="3" style="list-style-type: decimal;">
<li>The interface after opening filezilla is as shown below. At this time, the remote site on the right is empty.</li></ol>
'''<div classspan style="figurecolor:#FF0000">Hello from Docker!</span>'''
[[File'''<span style="color:zero2w-img264#FF0000">This message shows that your installation appears to be working correctly.png]]</span>'''
</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 class="figure">When using the docker command, if you are prompted for '''permission denied''', please add the current user to the docker user group so that you can run the docker command without sudo.
[[File{| class="wikitable" style="width:zero2w800px;" |-img256.png]]| orangepi@orangepi:~$ '''sudo usermod -aG docker $USER'''|}
</div><ol start{| class="5wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;">|-| <libig>Then choose to '''save Note: You need to log out and log in again to the system to take effect. You can also restart the password''' and click '''OKsystem.'''</li></olbig>|}
<div classspan id="figurehow-to-install-home-assistant"></span>
[[File:zero2w-img265.png]]== How to install Home Assistant ==
</div><ol start{| class="6wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;">|-| <libig>Then select '''Always trust Note that this host''' and click '''OKarticle 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.'''</li></olbig>|}
<div class="figure"> [[File:zero2w-img266.png]] </div><ol start="7" style="list-style-type: decimal;"><li>After the connection is successful, you can see the directory structure of the development board's Linux file system on the right side of the filezilla software.</li></ol> <div class="figure"> [[File:zero2w-img267.png]] </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 of the filezilla software, select the file to be uploaded on the Windows PC on the left side of the filezilla software, right-click the mouse, and then click the upload option to start uploading the file to the development board.</li></ol> <div class="figure"> [[File:zero2w-img268.png]] </div><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't go into details here.</p></li></ol> <span id="instructions-for-using-the-logo-on-and-offinstallation-thevia-machinedocker"></span>== Instructions for using the logo on and off the machine = Installation via docker ===
<ol style="list-style-type: decimal;">
<li><p>The power on/off logo will only be displayed on First, please install docker and ensure that docker can run normally. For the desktop version installation steps of docker, please refer to the instructions in the system by default[[Orange Pi Zero 2W#How to install Docker|'''How to Install Docker''']] section.</p></li><li><p>Set Then you can search for the docker image of Home Assistant</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''bootlogodocker search homeassistant''' variable </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>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''falsedocker pull homeassistant/home-assistant''' in </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>'''/boot/orangepiEnv.txt..... (Omit some output)''' </p><p>3cc6a1510c9f: Pull complete</p><p>7a4e4d5b979f: Pull complete</p><p>Digest: sha256:81d381f5008c082a37da97d8b08dd8b358dae7ecf49e62ce3ef1eeaefc4381bb</p><p>Status: Downloaded newer image for homeassistant/home-assistant:latest</p><p>docker.io/homeassistant/home-assistant:latest</p>|}</li><li><p>Then you can use the following command to turn off view the switch logo.docker image of Home Assistant you just downloaded</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo vim docker images homeassistant/boot/orangepiEnv.txthome-assistant'''</p><p>verbosity=1REPOSITORY &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;&nbsp;&nbsp;&nbsp;&nbsp; TAG &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IMAGE &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ID &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CREATED &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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;&nbsp;&nbsp;&nbsp; '''bootlogo<span style=false"color:#FF0000">1.17GB</span>'''</p>|}</li><li><p>Set At this point you can run the Home Assistant docker container</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''bootlogodocker run -d \''' variable to </p>:<p>'''true--name homeassistant \''' in </p>:<p>'''/boot/orangepiEnv.txt--privileged \''' to enable the power on/off logo.</p>:<p>orangepi@orangepi:~$ '''sudo vim /boot/orangepiEnv.txt--restart=unless-stopped \'''</p>:<p>verbosity'''-e TZ=1Asia/Shanghai \'''</p>:<p>'''bootlogo=true-v /home/orangepi/home-assistant:/config \'''</p></li><li>:<p>The location of the boot logo picture in the Linux system is'''--network=host \'''</p>:<p>'''homeassistant/usr/share/plymouth/themes/orangepi/watermark.pnghome-assistant:latest'''</p>|}</li><li><p>After replacing Then enter【the IP address of the development board: 8123】in the boot logo image, you need browser to run see the following command to take effectHome Assistant interface</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>orangepi@orangepi:~$ '''sudo update-initramfs -uIt 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.'''</p></libig>|}</oldiv class="figure"[[File:zero2w-img180.png]]
<span id="how-to-turn-on-the-power-button-in-linux5.4"/div></li><li><p>Then enter your '''name, username''' and '''password''' and click '''Create Account'''</spanp><div class== How to turn on the power button in Linux5.4 =="figure">
There is no power on/off button on the main board of the development board[[File:zero2w-img181. We can expand it through a 24pin expansion board. The location of the power on/off button on the expansion board is as follows:png]]
[[File:zero2w-img269.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">
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[[File:zero2w-img182. The steps are as follows:png]]
<ol style="list-style-type: decimal;"><li><p>First run '''orangepi-config'''. Ordinary users remember to add '''sudo''' permissions.</p><p>orangepi@orangepi:~$ '''sudo orangepi-config'''</pdiv></li><li><p>Then select '''System'''click Next</p><p>[[File:zero2w-img80.png]]</p></li><li><p>Then select '''Hardware'''</p><p>[[File:zero2w-img81.png]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown in the picture below, and then use the '''space''' to select the dtbo configuration of the SPI you want to open.</p><p>[[File:zero2w-img270.png]]</p></li><li><p>Then select '''&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 configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></oldiv class="figure">
<span id="how[[File:zero2w-to-shut-down-and-restart-the-development-board"></span>== How to shut down and restart the development board ==img183.png]]
<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><p>orangepi@orangepi:~$ '''sudo poweroff'''</p><p>'''Note that after turning off the development board, you need to unplug and replug the power supply before it can be turned on.'''</pdiv></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.Then click Finish</p><p>[[File:zero2w-img269.png]]</p><p>'''Note that Linux 5.4 requires manual configuration of the power on/off button before it can be used. For the opening method, please refer to the method of opening the power button in Linux5.4.'''</p></li><li><p>Use the '''reboot''' command to restart the Linux system in the development board</p><p>orangepi@orangepi:~$ '''sudo''' '''reboot'''</p></li></oldiv class="figure">
<span id="linux[[File:zero2w-sdkorangepi-build-usage-instructions"></span>img184.png]]
</div></li><li><p>The main interface finally displayed by Home Assistant is as 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 command to view the docker container is as follows</p>{| class="wikitable" style= "width:800px;" |-| <p>orangepi@orangepi:~$ '''docker ps -a'''Linux SDK——orangepi</p>|}</li><li><p>The command to stop the Home Assistant container is as follows</p>{| class="wikitable" style="width:800px;" |-build usage instructions| <p>orangepi@orangepi:~$ '''docker stop homeassistant''' </p>|}</li><li><p>The command to delete the Home Assistant container is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''docker rm homeassistant'''</p>|}</li></ol></li></ol>
<span id="compilationinstallation-systemvia-requirementspython"></span>== Compilation system requirements ==
The Linux SDK, '''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 the Ubuntu version installed on the computer is as follows. If the Release field does not display '''22.04''', it means that the Ubuntu version currently used does not meet the requirements. Please change the system before performing the following operations.=== Installation via python ===
test@test{| class="wikitable" style="background-color:#ffffdc;width:~$ 800px;" |-| <big>'''lsb_release -Before installation, please change the source of pip to adomestic 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>|}
No LSB modules are available<ol style="list-style-type: decimal;"><li><p>First install dependency packages</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y python3 python3-dev python3-venv \'''</p><p>'''python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \'''</p><p>'''libopenjp2-7 libtiff5 libturbojpeg0-dev tzdata'''</p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''If it is debian12, please use the following command:'''</p></big><p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y python3 python3-dev python3-venv \'''</p><p>'''python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \'''</p><p>'''libopenjp2-7 libturbojpeg0-dev tzdata'''</p>|}</li><li><p>Then you need to compile and install Python3.9. For the method, please refer to the [[Orange Pi Zero 2W#Python related instructions|'''Python source code compilation and installation method''']] section.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''The default Python version of Debian Bullseye is Python3.9, so there is no need to compile and install it.'''</p><p>'''The default Python version of Ubuntu Jammy is Python3.10, so there is no need to compile and install it.'''</p><p>'''The default Python version of Debian Bookworm is Python3.11, so there is no need to compile and install it.'''</p></big>|}</li><li><p>Then create a Python virtual environment</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Debian Bookworm is python3.11, please remember to replace the corresponding command.'''</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo mkdir /srv/homeassistant'''</p><p>orangepi@orangepi:~$ '''sudo chown orangepi:orangepi /srv/homeassistant'''</p><p>orangepi@orangepi:~$ '''cd /srv/homeassistant'''</p><p>orangepi@orangepi:~$ '''python3.9 -m venv .'''</p><p>orangepi@orangepi:~$ '''source bin/activate'''</p><p>(homeassistant) orangepi@orangepi:/srv/homeassistant$</p>|}</li><li><p>Then install the required Python packages</p>{| class="wikitable" style="width:800px;" |-| <p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ '''python3 -m pip install wheel'''</p>|}</li><li><p>Then you can install Home Assistant Core</p>{| class="wikitable" style="width:800px;" |-| <p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ '''pip3 install homeassistant'''</p>|}</li><li><p>Then enter the following command to run Home Assistant Core</p>{| class="wikitable" style="width:800px;" |-| <p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ '''hass'''</p>|}</li><li><p>Then enter【'''development board IP address: 8123'''】 in the browser to see the Home Assistant interface</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''When you run the hass command for the first time, some libraries and dependency packages necessary for operation will be downloaded, installed and cached. This process may take several minutes. Note that you cannot see the Home Assistant interface in the browser at this time. Please wait for a while and then refresh it.'''</p></big>|}<div class="figure">
Distributor ID[[File: Ubuntuzero2w-img180.png]]
Description: Ubuntu 22.04 LTS</div></li></ol>
Release: '''22.04'''<span id="opencv-installation-method"></span>
Codename: '''jammy'''== OpenCV installation method ==
If the computer is installed with a Windows system and does not have Ubuntu 22.04 installed on it, you can consider using'''VirtualBox''' or '''VMware''' to install an Ubuntu 22.04 virtual machine in the Windows system. But please note, do not compile orangepi<span id="use-build on the WSL virtual machine, because orangepiapt-build has not been tested in the WSL virtual machine, so there is no guarantee that orangepito-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: [https://repo.huaweicloud.com/ubuntu-releases/21.04/ubuntu-21.04-desktop-amd64.iso '''https://mirrors.tuna.tsinghua.edu.cn/ubuntuinstall-releases/22.04opencv"></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 === Use apt 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:install OpenCV ===
<ol style="list-style-type: decimal;">
<li><p>The installation command is as follows</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo apt-get update'''</p>
<p>orangepi@orangepi:~$ '''sudo apt-get install -y libopencv-dev python3-opencv'''</p>
|}
</li>
<li><p>Then use the following command to print the version number of OpenCV. The output is normal, indicating that the OpenCV installation is successful.</p>
<ol style="list-style-type: lower-alpha;">
<li>For the method <p>The version of replacing Tsinghua Source, please refer to the instructions on this pageOpenCV 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>'''4.5.4'''</p>|}</li><li><p>The version of OpenCV in Ubuntu20.04 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 -c &quot;import cv2; print(cv2.__version__)&quot;'''</p><p>'''4.2.0'''</p>|}</li><li><p>The version of OpenCV in Debian11 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 -c &quot;import cv2; print(cv2.__version__)&quot;'''</p><p>'''4.5.1'''</p>|}</li><li><p>The version of OpenCV in Debian12 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 -c &quot;import cv2; print(cv2.__version__)&quot;'''</p><p>'''4.6.0'''</p>|}</li></ol></li></ol>
[https:<span id="set-up-the-chinese-environment-and-install-the-chinese-input-method"><//mirrors.tuna.tsinghua.edu.cn/help/ubuntu/ '''https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/''']span>
<ol start="2" style="list-style-type: lower-alpha;"><li>Note that Set up the Ubuntu version needs to be switched to 22.04.</li></ol>Chinese environment and install the Chinese input method ==
[[File{| class="wikitable" style="background-color:#ffffdc;width:zero2w800px;" |-img271| <big>'''Note, before installing the Chinese input method, please make sure that the Linux system used by the development board is a desktop version.png]]'''</big>|}
<ol startspan id="3" style="listdebian-stylesystem-type: lowerinstallation-alpha;method"><li>The contents of the '''/etc/apt/sources.list''' file that need to be replaced are:</li></olspan>=== Debian system installation method ===
test<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]]</p></li><li><p>After exiting the interface, the '''locale''' setting will begin. The output displayed on the command line is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@testorangepi:~$ '''sudo mv 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'''</etcp><p>[[File:zero2w-img192.png]]</aptp></sourcesli><li><p>'''<span style="color:#FF0000">Then restart the Linux system to make the configuration take effect.list cat </etcspan>'''</aptp></sourcesli><li><p>Then open '''Fcitx configuration'''</p><p>[[File:zero2w-img193.listpng]]</p></li><li><p>Then click the + sign as shown in the picture below</p><p>[[File:zero2w-img194.bakpng]]</p></li><li><p>Then search '''Google Pinyin'''and click '''OK'''</p><div class="figure">
test@test[[File:~$ '''sudo vim /etc/apt/sourceszero2w-img195.list'''png]]
# </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 source code image Chinese input method test is commented by 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 improve apt '''zh_CN.UTF-8'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo vim /etc/default/locale'''</p><p># File generated by update speed-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. You can uncomment it yourself if necessary</p><p>[[File:zero2w-img200.png]]</p></li></ol>
deb https://mirrors.tuna.tsinghua.edu<span id="installation-method-of-ubuntu-20.cn/ubuntu04-system"></ jammy main restricted universe multiversespan>
# deb-src https://mirrors=== Installation method of Ubuntu 20.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse04 system ===
deb https<ol style="list-style-type:decimal;"><li><p>First open '''Language Support'''</p><p>[[File:zero2w-img201.png]]</mirrorsp></li><li><p>Then find the '''Chinese (China)''' option</p><p>[[File:zero2w-img202.tunapng]]</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.tsinghuaAfter dragging, the display will be as shown below:</p><p>[[File:zero2w-img203.edupng]]</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.cn'''</ubuntubig>|}</ jammyol><ol start="4" style="list-updates main restricted universe multiversestyle-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>
# deb<span id="installation-src https://mirrorsmethod-of-ubuntu-22.tuna.tsinghua.edu.cn/ubuntu04-system"></ jammy-updates main restricted universe multiversespan>
deb https://mirrors=== Installation method of Ubuntu 22.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse04 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:# debffffdc;width:800px;" |-src https| <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>'''</mirrorsp></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.tuna</p><p>[[File:zero2w-img206.tsinghuapng]]</p></li><li><p>Then you can see that the desktop is displayed in Chinese</p><p>[[File:zero2w-img207.edupng]]</p></li><li><p>Then open the Fcitx5 configuration program</p><p>[[File:zero2w-img213.cnpng]]</ubuntup></ jammy-backports main restricted universe multiverseli><li><p>Then choose to use Pinyin input method</p><div class="figure">
deb https[[File://mirrorszero2w-img214.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiversepng]]
# deb</div></li><li><p>The interface after selection is as shown below, then click OK</p><p>[[File:zero2w-src httpsimg215.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></mirrorsli><li><p>After opening '''Geany''', the English input method is still the default.tunaWe can switch to the Chinese input method through the '''Ctrl+Space''' shortcut key, and then we can enter Chinese.tsinghua</p><p>[[File:zero2w-img216.edu.cnpng]]</p></ubuntuli></ jammy-security main restricted universe multiverseol>
# Pre<span id="how-release software source, not recommended to be enabled-remotely-log-in-to-the-linux-system-desktop"></span>
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse== How to remotely log in to the Linux system desktop ==
# deb<span id="remote-src https://mirrors.tuna.tsinghua.edu.cnlogin-using-nomachine"></ubuntu/ jammy-proposed main restricted universe multiversespan>=== Remote login using NoMachine ===
<ol start{| class="4wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;">|-| <libig>After '''Please ensure that the replacement, you need to update Ubuntu or Debian system installed on the package information and ensure that no errors are reported.development board is a </lispan style="color:#FF0000">desktop version</olspan>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:'''
test@test:~$ '''sudo apt-get update''' <ol start="5" style="list-style-typehttps: 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.'''</li></ol> <span id="obtain-the-source-code-of-linux-sdk"></span>== Obtain the source code of linux sdk == <span id="download-orangepi-build-from-github"></span>=== Download orangepi-build from github === Linux sdk refers to the orangepi-build set of codesknowledgebase. Orangepi-build is modified based on the armbian build compilation system. Multiple versions of Linux images can be compiled using orangepi-build. Use the following command to download the orangepi-build code: test@test:~$ '''sudo apt-get update''' test@test:~$ '''sudo apt-get install -y git''' test@test:~$ '''git clone https://githubnomachine.com/orangepi-xunlong/orangepi-build.git -b next''DT10R00166' '''Note that when using the H618 Soc development board, you need to download the source code of the next branch of orangepi-build. The above git clone command needs to specify the branch of the orangepi-build source code as next.''' <div class="figure"> [[File:zero2w-img272.png]] </divbig>'''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.''' The u-boot and linux kernel versions currently used by the H618 series development boards are as follows:|}{| 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'branchs official documentation.'''</big>| '''u-boot Version'''}{| '''linux Kernel version'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| '''current'''| '''u-boot v2018.05'''| '''linux5.4'''|-| '''next'''| '''u-boot v2021.07'''| <big>'''linux6Before 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.1'''</big>
|}
'''The branch mentioned here is not <ol style="list-style-type: decimal;"><li><p>First download the same thing as installation package of the branch of orangepi-build source code, please donNoMachine software Linux 't get confused. This branch is mainly used to distinguish different kernel source code versions.''<span style="color:#FF0000">arm64</span>' '''We define deb version, and then install it into 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.''' After downloading, Linux system of the following files and folders will be included:development board</p>
<ol style="list-style-type: lower-alpha;">
<li><p>Since H618 is an ARMv8 architecture SOC and the system we use is Ubuntu or Debian, we need to download the '''build.shNoMachine for ARM ARMv8 DEB'''installation package. The download link is as follows: Compile startup script</p></li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <li><pbig>'''external''': Contains configuration files needed to compile Note that this download link may change, please look for the image, specific scripts, and source code Armv8/Arm64 version of some programs, etcthe deb package.</p></li><li><p>'''LICENSE''': GPL 2 license file</p></libig><li><p>'''README.md'''|}{| class="wikitable" style="width: orangepi800px;" |-build documentation<| [https://www.nomachine.com/p><download/li><li><p>'''scriptsdownload&id=112&s=ARM '''https: Common script for compiling linux images</p></li><downloads.nomachine.com/download/ol>?id=118&amp;distro=ARM''']|}
test[[File:zero2w-img217.png]]</ol><ol start="2" style="list-style-type: lower-alpha;"><li><p>In addition, you can also download the '''NoMachine''' installation package from the official tool.</p><p>[[File:zero2w-img218.png]]</p><p>First enter the '''remote login software-NoMachine''' folder</p><p>[[File:zero2w-img219.png]]</p><p>Then download the arm64 version of the deb installation package</p><p>[[File:zero2w-img220.png]]</p></li><li><p>Then upload the downloaded '''nomachine_x.x.x_x_arm64.deb''' to the Linux system of the development board</p></li><li><p>Then use the following command to install '''NoMachine''' in the Linux system of the development board</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@testorangepi:~$ '''sudo dpkg -i nomachine_x.x.x_x_arm64_arm64.deb'''</orangepip>|}</li></ol></li></ol><ol start="2" style="list-style-type: decimal;"><li>Then download the installation package of the Windows version of the NoMachine software. The download address is as follows</li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note that this download link may change.'''</big>|}{| class="wikitable" style="width:800px;" |-build$ | '''lshttps://downloads.nomachine.com/download/?id=9'''|}
[[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.'''</p></li><li><p>Then open '''NoMachine'''buildin 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.sh external LICENSE README</p><p>[[File:zero2w-img223.md scriptspng]]</p></li><li><p>Then click '''OK'''</p><p>[[File:zero2w-img224.png]]</p></li><li><p>Then enter the username and password of the development board Linux system in the corresponding positions in the figure below, and then click OK to start logging in.</p><p>[[File:zero2w-img225.png]]</p></li><li><p>Then click OK in the next interface.</p></li><li><p>Finally you can see the desktop of the development board Linux system</p><p>[[File:zero2w-img226.png]]</p></li></ol>
'''If you downloaded the orangepi<span id="remote-build code from github, after downloading, you may find that orangepilogin-build does not contain the source code of uusing-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.'''vnc"></span>
<span id="download-the-cross-compilation-tool-chain"></span>=== Download the cross-compilation tool chain Remote login using VNC ===
When orangepi{| class="wikitable" style="background-build is run for the first time, it will automatically download the crosscolor:#ffffdc;width:800px;" |-compilation '''toolchain| <big>''' Before operating, please make sure that the Windwos computer and put it the development board are in the '''toolchains''' folder. Every time same LAN, and that you run orangepi-build's build.sh script, it will check whether can log in to the cross-compilation toolchain in toolchains exists. If If it does not exist, Ubuntu or Debian system of the download will be restarted. If it exists, it will be used directly without repeated downloadingdevelopment board through ssh normally.'''
'''<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;" |-img273| <p>orangepi@orangepi:~$ '''sudo set_vnc.sh'''</p><p>You will require a password to access your desktops.png]]</p>
</div>
The mirror URL of the cross-compilation tool chain in China is the open source software mirror site of Tsinghua University:
[https<p>Password:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '''<span style="color:#FF0000">#Set the vnc password here, 8 characters</span>'''</mirrors.tuna.tsinghua.edu.cnp><p>Verify: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '''<span style="color:#FF0000">#Set the vnc password here, 8 characters</span>'''</armbianp><p>Would you like to enter a view-releasesonly password (y/_toolchainn)? '''<span style="color:#FF0000">n</ span>'''https</p><p>xauth:file /root/mirrors.tuna.tsinghua.edu.cn/armbian-releases/_toolchainXauthority does not exist</''']p>
After toolchains is downloaded, it will contain multiple versions of cross-compilation t'''toolchain''':
test@test:~/orangepi-build$ <p>New 'X''ls toolchainsdesktop is orangepi:1</'''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-arm-11<p>Creating default startup script /root/.2-2022vnc/xstartup</p><p>Starting applications specified in /root/.02-x86_64-arm-none-linux-gnueabihf gcc-linaro-4vnc/xstartup</p><p>Log file is /root/.9vnc/orangepi:1.4-2017.01-x86_64_arm-linux-gnueabi gcc-linaro-aarch64-none-elf-4.8-2013.11_linuxlog</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-arm-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_linux<p>Killing Xtightvnc process ID 3047</p>
The cross-compilation tool chain used to compile the H618 Linux kernel source code is:
<ol style="list-style-typep>New 'X' desktop is orangepi: lower-alpha;"><li>linux5.4</li>1</olp>
'''gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu'''
<p>Starting applications specified in /root/.vnc/xstartup</p><p>Log file is /root/.vnc/orangepi:1.log</p>|}</li><li><p>The steps to use MobaXterm software to connect to the development board Linux system desktop are as follows:</p><ol start="2" style="list-style-type: lower-alpha;"><li>linux6First click Session, then select VNC, then fill in the IP address and port of the development board, and finally click OK to confirm.1</li></ol>
'''gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu'''<div class="figure">
The cross-compilation tool chain used to compile the H618 u-boot source code is[[File<ol style="list-style-type: lower-alpha;"><li>v2018.05</li></ol> '''gcc-linaro-7.4.1zero2w-2019img227.02-x86_64_arm-linux-gnueabi'''png]]
</div></ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>v2021<p>Then enter the VNC password set earlier</p><p>[[File:zero2w-img228.07png]]</p></li><li><p>After successful login, the interface is displayed as shown below, and then you can remotely operate the desktop of the development board Linux system.</olp></li>
'''gcc[[File:zero2w-arm-11.2-2022img229.02-x86_64-aarch64-nonepng]]</ol></li></ol><span id="qt-linuxinstallation-gnu'''method"></span>
<span id="orangepi-build-complete-directory-structure-description"></span>=== orangepi-build complete directory structure description =QT installation method ==
<ol style="list-style-type: decimal;">
<li><p>After downloading, Use the orangepi-build warehouse does not contain the source code of the linux kernel, u-boot following script to install QT5 and crossQT Creator</p>{| class="wikitable" style="width:800px;" |-compilation tool chain| <p>orangepi@orangepi:~$ '''install_qt. The source code of sh'''</p>|}</li><li><p>After installation, the linux kernel and u-boot is stored in an independent git warehouseQT version number will be automatically printed.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The git warehouse where the linux kernel source code qt version that comes with Ubuntu20.04 is stored is as follows'''5.12. Please note that the branch of the linux-orangepi warehouse is switched to8'''</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;">|-| <lip>Linux5orangepi@orangepi:~$ '''install_qt.4sh'''</lip><p>......</olp></lip>QMake version 3.1</olp></lip>Using Qt version '''<span style="color:#FF0000">5.12.8</olspanhttps:''' in /usr/github.comlib/orangepiaarch64-xunlong/linux-orangepignu</treep>|}</li><li><p>The QT version that comes with Ubuntu22.04 is '''orange-pi-5.4-sun50iw915.3'''</p> <ol start{| class="2wikitable" style="list-style-typewidth: lower-alpha800px;"|-| <p>orangepi@orangepi:~$ '''install_qt.sh'''</p><lip>Linux6.1.....</lip><p>QMake version 3.1</olphttps<p>Using Qt version '''<span style="color:#FF0000">5.15.3</span>''' in /usr/github.comlib/orangepiaarch64-xunlong/linux-orangepignu</treep>|}</li><li><p>The QT version that comes with Debian11 is '''orange-pi-65.15.1-sun50iw92'''</p> <ol start{| class="2wikitable" style="list-style-typewidth: lower-alpha800px;"|-| <p>orangepi@orangepi:~$ '''install_qt.sh'''</p><lip>......</p><p>The git warehouse where the u-boot source code is stored is as followsQMake version 3. Please note that the branch of the u-boot-orangepi warehouse is switched to1</p><ol p>Using Qt version '''<span style="list-style-typecolor: lower-alpha;#FF0000">5.15.2<li/span>v2018.05''' in /usr/lib/aarch64-linux-gnu</lip>|}</olli></li></olphttps://github.com/orangepi-xunlong/u-boot-orangepi/tree/The QT version that comes with Debian12 is '''v20185.05-h61815.8'''</p> <ol start{| class="2wikitable" style="list-style-typewidth: lower-alpha800px;"|-| <p>orangepi@orangepi:~$ '''install_qt.sh'''</p><lip>v2021.07.....</lip><p>QMake version 3.1</olphttps<p>Using Qt version '''<span style="color:#FF0000">5.15.8</span>''' in /github.comusr/orangepi-xunlonglib/uaarch64-bootlinux-orangepignu</p>|}</li></treeol></li><li><p>Then you can see the QT Creator startup icon in '''v2021.07-sunxiApplications'''</p><p>[[File:zero2w-img230.png]]</p><ol startp>You can also use the following command to open QT Creator</p>{| class="2wikitable" style="list-style-typewidth: decimal800px;"|-| <p>orangepi@orangepi:~$ '''qtcreator'''</p>|}</li><li><p>When orangepi-build The interface after QT Creator is opened is run for the first time, it will download the crossas follows</p><p>[[File:zero2w-compilation tool chain, u-boot and linux kernel source codeimg231. After successfully compiling a linux image, the files and folders that can be seen in orangepi-build are:png]]</p></li><li><p>The version of QT Creator is as follows</p><ol style="list-style-type: lower-alpha;"><li><p>The default version of QT Creator in '''buildUbuntu20.sh04'''is as follows</p><p>[[File: Compile startup scriptzero2w-img232.png]]</p></li><li><p>The default version of QT Creator in '''externalUbuntu22.04'''is as follows</p><p>[[File: 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 externalzero2w-img233.png]]</p></li><li><p>The default version of QT Creator in '''kernelDebian11'''is as follows</p><p>[[File: Store the source code of the linux kernelzero2w-img234.png]]</p></li><li><p>The default version of QT Creator in '''LICENSEDebian12'''is as follows</p><p>[[File: GPL 2 license filezero2w-img235.png]]</p></li></ol></li><li><p>Then set up QT</p><ol style="list-style-type: lower-alpha;"><li><p>First open '''READMEHelp'''-&gt;'''About Plugins...md'''.</p><p>[[File: orangepizero2w-build documentationimg236.png]]</p></li><li><p>Then remove the check mark of '''outputClangCodeModel'''</p><p>[[File: Store compiled uzero2w-boot, linux and other deb packages, compilation logs, and compiled images and other filesimg237.png]]</p></li><li><p>'''scripts<span style="color:#FF0000">After setting up, you need to restart QT Creator</span>''': Common script for compiling linux images</p></li><li><p>Then make sure the GCC compiler used by QT Creator. If the default is Clang, please change it to GCC.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''toolchainsDebian12 please skip this step.'''</p></big>|}<p>[[File:zero2w-img238.png]]</p><p>[[File:zero2w-img239.png]]</p></li></ol></li><li><p>Then you can open a sample code</p><p>[[File:zero2w-img240.png]]</p></li><li><p>After clicking on the sample code, the corresponding instruction document will automatically open. You can read the instructions carefully.</p><p>[[File: Store crosszero2w-compilation tool chainimg241.png]]</p></li><li><p>Then click '''u-bootConfigure Project'''</p><p>[[File: Store zero2w-img242.png]]</p></li><li><p>Then click the green triangle in the lower left corner to compile and run the source sample code </p><p>[[File:zero2w-img243.png]]</p></li><li><p>After waiting for a period of utime, the interface shown in the figure below will pop up, which means that QT can compile and run normally.</p><p>[[File:zero2w-bootimg244.png]]</p></li><li><p>References</p>{| class="wikitable" style="width:800px;" |-| <p>[https://wiki.qt.io/Install_Qt_5_on_Ubuntu '''userpatcheshttps://wiki.qt.io/Install_Qt_5_on_Ubuntu''']</p><p>[https://download.qt.io/archive/qtcreator '''https: Store the configuration files needed to compile the script//download.qt.io/archive/qtcreator''']</p><p>[https://download.qt.io/archive/qt '''https:/li>/download.qt.io/archive/qt''']</olp>|}
</li></ol>
test@test:~/orangepi-build$ '''ls''' '''build.sh external kernel LICENSE output README.md scripts toolchains u-boot userpatches''' <span id="compileros-uinstallation-bootmethod"></span>== Compile u-boot == # 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 '''U-boot package''' and press Enter</li></ol>ROS installation method ==
<div classspan id="figurehow-to-install-ros-1-noetic-on-ubuntu20.04"></span>=== How to install ROS 1 Noetic on Ubuntu20.04 ===
[[File:zero2w-img274.png]]# The currently active version of ROS 1 is as follows, the recommended version is '''Noetic Ninjemys'''
</div><ol start="3" style="list::[[File:zero2w-style-type: decimal;"><li>Then select the model of the development board</li></ol>img245.png]]
::[[File:zero2w-img275img246.png]]
::{| class="wikitable" style="width:800px;" |-| [http://docs.ros.org/ '''http://docs.ros.org'''] '''https://wiki.ros.org/Distributions'''|} <ol start="42" style="list-style-type: decimal;"><li><p>Then select The link to the branch type official installation documentation of u-bootROS 1 '''Noetic Ninjemys''' is as follows:</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li>|-| <p>The current branch will compile the u-boot v2018[http://wiki.ros.05 version code that needs to be used by the linux5org/noetic/Installation/Ubuntu '''http://wiki.4 imageros.org/noetic/Installation/Ubuntu''']</p>|}</li><li><p>The next branch will compile In the u-boot v2021official installation documentation of ROS '''Noetic Ninjemys''', Ubuntu recommends using Ubuntu20.07 version code 04, so please ensure that needs to be the system used by the linux6development 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.1 imageros.org/noetic/Installation''']</p><p>[[File:zero2w-img276img247.png]]</p>|}</li><li><p>Then use the script below to install ros1</olp>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''install_ros.sh ros1'''</p>|}
</li>
<li><p>If you select Before using the next branchROS tool, you will also be prompted first need to select initialize rosdep. Then when compiling the memory sizesource code, you can quickly install some system dependencies and you do not need to select the current branchsome core components in ROS.</p></li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''<span style="color:#FF0000">Note that when running the following command, you need to ensure that the development board can access github normally, otherwise an error will be reported due to network problems.</olspan>'''
<blockquote>a. If the development board you purchased has a memory size of 1.5GB, please select the first option.
b'''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 you purchased has 1GB or 2GB or 4GB memory sizeto access github normally, please choose and then manually run the second option.</blockquote>[[File:zero2w-img277following Order.png]]'''
<ol start="6" style="list-style-type: decimal;">
<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;">
<li>Version of u-boot source code</li></ol>
</li></ol>
[ o'''https://raw.kgithubusercontent. ] Compiling ucom/ros/rosdistro/master/rosdep/osx-boot [ '''v2021homebrew.07yaml''' ]
<ol start="2" style="list-style-type'''Hit https: lower-alpha;"><li>Version of the cross-compilation tool chain</li></ol>raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml'''
[ o.k. ] Compiler version [ '''aarch64-linux-gnu-gcc 11<span style="color:#FF0000">ERROR: error loading sources list:</span>''' ]
::'''<span style="color:#FF0000">The read operation timed out</span>'''<ol start/big>|}{| class="3wikitable" style="list-style-typewidth: lower-alpha800px;"><li>Path to the compiled u|-boot deb package<| orangepi@orangepi:~$ '''source /opt/ros/li><noetic/ol>setup.bash'''
[ o.k. ] Target directory [ orangepi@orangepi:~$ '''orangepi-build/output/debs/u-bootsudo rosdep init''' ]
<ol start="4" style="Wrote /etc/ros/rosdep/sources.list.d/20-style-type: lower-alpha;"><li>The package name of the compiled u-boot deb package</li></ol>default.list
[ o.k. ] File name [ '''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb''' ]Recommended: please run
<ol start="5" style="list-style-type: lower-alpha;">
<li>Compilation time</li></ol>
[ o.k. ] Runtime [ '''1 min''' ]::rosdep update
<ol start="6" style="list-style-typeorangepi@orangepi: lower-alpha;"><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></ol>~$ '''rosdep update'''
[ oreading in sources list data from /etc/ros/rosdep/sources.k. ] Repeat Build Options [ '''sudo ./buildlist.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=u-boot''' ]d
<ol start="7" style="list-style-typeHit https: decimal;"><li>View the compiled u-boot deb package</li></ol>raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml
test@testHit https:~/orangepi-build$ '''ls output/debsraw.githubusercontent.com/u-bootros/'''rosdistro/master/rosdep/base.yaml
'''linux-u-boot-next-orangepizero2w_xHit https://raw.xgithubusercontent.x_arm64com/ros/rosdistro/master/rosdep/python.deb'''yaml
<ol start="8" style="list-style-typeHit https: 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//raw. 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 codegithubusercontent. ('''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:<com/ros/rosdistro/master/li><rosdep/ol>ruby.yaml
<blockquote>Set the IGNORE_UPDATES variable in u'''userpatchesHit https:/config-default/raw.githubusercontent.conf''' to &quot;yes&quot;<com/ros/blockquote>test@test:~rosdistro/master/orangepi-build$ '''vim userpatchesreleases/config-defaultfuerte.conf'''yaml
Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index-v4....yaml
IGNORE_UPDATES=Skip end-of-life distro &quot;'''yes'''ardent&quot;
......Skip end-of-life distro &quot;bouncy&quot;
<ol start="9" style="listSkip end-styleof-type: decimallife distro &quot;"><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-alphacrystal&quot;"><li>First upload the compiled deb package of u-boot to the Linux system of the development board.</li></ol></li></ol>
test@test:~/orangepiSkip end-build$ '''cd output/debs/uof-boot'''life distro &quot;dashing&quot;
test@test:~/orangepi_build/output/debs/uSkip end-boot$ '''scp \'''of-life distro &quot;eloquent&quot;
'''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb [mailto:root@192.168.1.xxx:/root root@192.168.1.xxx:/root]'''Add distro &quot;foxy&quot;
<ol start="2" style="list-style-type: lower-alphaAdd distro &quot;galactic&quot;"><li>Install the new u-boot deb package just uploaded</li></ol>
orangepi@orangepi:~$ '''sudo dpkg Skip end-i''' '''linuxof-u-boot-next-orangepizero2w_x.x.x_arm64.deb'''life distro &quot;groovy&quot;
<ol start="3" style="list-style-type: lower-alphaAdd distro &quot;humble&quot;"><li>Then run the nand-sata-install script</li></ol>
orangepi@orangepi:~$ '''sudo nandSkip end-sataof-install'''life distro &quot;hydro&quot;
<ol start="4" style="listSkip end-styleof-type: lower-alphalife distro &quot;indigo&quot;"><li>Then select '''5 Install/Update the bootloader on SD/eMMC'''</li></ol>
[[File:zero2wSkip end-img278.png]]of-life distro &quot;jade&quot;
<ol start="5" style="listSkip end-styleof-type: lower-alphalife distro &quot;kinetic&quot;"><li>After pressing the Enter key, a Warning will pop up first.</li></ol>
[[File:zero2wSkip end-img279.png]]of-life distro &quot;lunar&quot;
<ol start="6" style="list-style-type: lower-alphaAdd distro &quot;melodic&quot;"><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]]Add distro &quot;noetic&quot;
<ol start="7" style="list-style-type: lower-alphaAdd distro &quot;rolling&quot;"><li>Then you can restart the development board to test whether the u-boot modification has taken effect.</li></ol>
updated cache in /home/orangepi/.ros/rosdep/sources.cache|}<span id/ol><ol start="compile6" style="list-thestyle-linux-kerneltype: decimal;"><li><p>Then open a command line terminal window on the '''desktop''', and then use the '''test_ros.sh''' script to start a small turtle routine to test whether ROS can be used normally.</spanp>{| class="wikitable" style= Compile "width:800px;" |-| <p>orangepi@orangepi:~$ '''test_ros.sh'''</p>|}</li><li><p>After running the linux kernel =='''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>
# Run the '''build.sh''' script, remember to add sudo permissions<div class="figure">
test@test[[File:~/orangepizero2w-build$ '''sudo img249./build.sh'''png]]
</div></ol><ol start="29" style="list-style-type: decimal;"><li>Select '''Kernel package''' <p>At this time, press the direction keys on the keyboard to control the little turtle to move up, down, left, and press Enterright.</p><p>[[File:zero2w-img250.png]]</p></li></ol>
<div classspan id="figurehow-to-install-ros-2-galactic-on-ubuntu20.04"></span>
[[File:zero2w-img281=== How to install ROS 2 Galactic on Ubuntu20.png]]04 ===
<ol style="list-style-type: decimal;"><li><p>The currently active version of ROS 2 is as follows, the recommended version is '''Galactic Geochelone'''</p><p>[[File:zero2w-img251.png]]</divp><ol startp>[[File:zero2w-img252.png]]</p>{| class="3wikitable" style="listwidth:800px;" |-| <p>[http://docs.ros.org/ '''http://docs.ros.org''']</p><p>'''http://docs.ros.org/en/galactic/Releases.html'''</p>|}</li><li><p>The link to the official installation documentation of ROS 2 '''Galactic Geochelone''' is as follows:</p>{| class="wikitable" style-type="width: decimal800px;"|-| <p>'''docs.ros.org/en/galactic/Installation.html'''</p><p>'''http://docs.ros.org/en/galactic/Installation/Ubuntu-Install-Debians.html'''</p>|}</li><li>Then you will be prompted whether you need <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 display install ROS 2 '''Galactic Geochelone''' through '''Debian packages'''.</p></li><li><p>Use the kernel configuration interface'''install_ros. If you do not need sh''' script to modify install ros2</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''install_ros.sh ros2'''</p>|}</li><li><p>The '''install_ros.sh''' script will automatically run the kernel configuration, select the first one'''ros2 -h''' command after installing ros2. If you need to modify can see the kernel configurationfollowing print, select it means that the second oneros2 installation is complete.</lip>{| class="wikitable" style="width:800px;" |-| <p>usage: ros2 [-h] Call `ros2 &lt;command&gt; -h` for more detailed usage. ...</olp>
[[File:zero2w-img282.png]]
<ol start="4" style="list-stylep>ros2 is an extensible command-type: decimal;"><li>Then select the model of the development board</li>line tool for ROS 2.</olp>
[[File:zero2w-img275.png]]
<ol start="5" style="list-style-typep>optional arguments: decimal;"</p>:<li>Then select the branch type of the kernel source code</lip>-h, --help show this help message and exit</olp>
<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<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</blockquotep>[[File:zero2w<p>node Various node related sub-img276.png]]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>
<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<p>Call `ros2 &lt;command&gt; -img283h` for more detailed usage.png]]</p>|}<ol style="list-style-type: lower-alpha;"/li><li>If <p>Then you do not need to modify the kernel configuration options, when running can use the build.sh script, pass '''KERNEL_CONFIGURE=notest_ros.sh''' script to temporarily block test whether ROS 2 is installed successfully. If you can see the pop-up of the kernel configuration interfacefollowing print, it means ROS 2 can run normally.</lip>{| class="wikitable" style="width:800px;" |-| </olptestorangepi@testorangepi:~/orangepi-build$ '''sudo ./buildtest_ros.sh KERNEL_CONFIGURE=no'''</p><ol start="2" style="list-style-typep>[INFO] [1671174101.200091527] [talker]: Publishing: 'Hello World: lower-alpha;"1'</p><lip>[INFO] [1671174101.235661048] [listener]: I heard: [Hello World: 1]</p><p>b[INFO] [1671174102. You can also set 199572327] [talker]: Publishing: 'Hello World: 2'</p><p>[INFO] [1671174102.204196299] [listener]: I heard: [Hello World: 2]</p><p>[INFO] [1671174103.199580322] [talker]: Publishing: 'KERNEL_CONFIGURE=noHello World: 3''' in the orangepi-build</userpatches/config-default.confconfiguration file to permanently disable this functionp><p>[INFO] [1671174103.204019965] [listener]: I heard: [Hello World: 3]</p>|}</li><li><p>If Run 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 command to the maximum size, and then rerun the build.sh script.open rviz2</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''source /opt/ros/ligalactic/setup.bash'''</p><p>orangepi@orangepi:~$ '''ros2 run rviz2 rviz2'''</olp>|}<p>[[File:zero2w-img284img253.png]] <ol start="7" style="list-style-type: decimal;"/p></li><li><p>Part For how to use ROS, please refer to the documentation of the information prompted when compiling the next branch kernel source code is explained as follows:ROS 2.</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;">|-| <lip>Version of the linux kernel source code<[http://docs.ros.org/en/galactic/Tutorials.html '''http://docs.ros.org/en/galactic/li>Tutorials.html''']</olp>|}
</li></ol>
[ o<span id="how-to-install-ros-2-humble-on-ubuntu22.k. ] Compiling current kernel [ '''6.1.31''' ]04"></span>
<ol start="== How to install ROS 2" styleHumble on Ubuntu22.04 ==="list-style-type: lower-alpha;"><li>The version of the cross-compilation tool chain used</li></ol>
[ o<ol style="list-style-type: decimal;"><li><p>Use the install_ros.ksh script to '''install_ros. ] Compiler version [ sh'''aarch64</p>{| class="wikitable" style="width:800px;" |-linux-gnu| <p>orangepi@orangepi:~$ '''install_ros.sh ros2'''</p>|}</li><li><p>The '''install_ros.sh''' script will automatically run the '''ros2 -gcc 11h''' 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>
<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<p>ros2 is an extensible command-line tool for ROS 2.k. ] Using kernel config file [ '''orangepi-build/external</config/kernel/linux-6.1-sun50iw9-next.config''' ]p>
<ol start="4" style="list-style-type: lower-alpha;">
<li>The path to the kernel-related deb package generated by compilation</li></ol>
[ o.k. ] Target directory [ '''output<p>optional arguments:</debsp>:<p>-h, --help show this help message and exit</''' ]p>
<ol start="5" style="list-style-type: lower-alpha;">
<li>The package name of the kernel image deb package generated by compilation</li></ol>
[ o.k. ] File name [ '''linux<p>Commands:</p>:<p>action Various action related sub-imagecommands</p>:<p>bag Various rosbag related sub-nextcommands</p>:<p>component Various component related sub-sun50iw9_x.x.x_arm64.deb''' ]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>
<ol start="6" style="list-style-type: lower-alpha;">
<li>Compilation time</li></ol>
[ o:<p>Call `ros2 &lt;command&gt; -h` for more detailed usage.k. ] Runtime [ </p>|}</li><li><p>Then you can use the '''10 mintest_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> <ol start{| class="7wikitable" style="list-style-typewidth: lower-alpha800px;"|-| <p>orangepi@orangepi:~$ '''test_ros.sh'''</p><lip>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[INFO] [1671174101.200091527] [talker]: Publishing: 'Hello World: 1'</lip><p>[INFO] [1671174101.235661048] [listener]: I heard: [Hello World: 1]</olp<p>[INFO] [ o.k1671174102. 199572327] Repeat Build Options [ talker]: Publishing: 'Hello World: 2''sudo </p><p>[INFO] [1671174102.204196299] [listener]: I heard: [Hello World: 2]</buildp><p>[INFO] [1671174103.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=kernel KERNEL_CONFIGURE=no'199580322] [talker]: Publishing: 'Hello World: 3' </p><p>[INFO] [1671174103.204019965] [listener]: I heard: [Hello World: 3]</p>|}<ol start="8" style="list-style-type: decimal;"/li><li><p>View Run the kernel-related deb package generated by compilationfollowing command to open rviz2</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li>|-| <p>orangepi@orangepi:~$ '''linux-dtb-next-sun50iw9_xsource /opt/ros/humble/setup.x.x_arm64.debbash''' Contains dtb files used by the kernel</p></li><li><p>orangepi@orangepi:~$ '''linux-headers-next-sun50iw9_x.x.x_arm64.debros2 run rviz2 rviz2''' Contains kernel header files</p><p>[[File:zero2w-img254.png]]</p>|}</li><li><p>Reference documentation</p>{| class="wikitable" style="width:800px;" |-| <p>'''linux-image-next-sun50iw9_xhttp://docs.xros.x_arm64org/en/humble/index.debhtml''' Contains kernel images and kernel modules</p><p>[http://docs.ros.org/en/galactic/Tutorials.html '''http://li>docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html''']</olp>|}
</li></ol>
test@test:~/orangepi<span id="how-to-install-kernel-header-build$ '''ls outputfiles"></debs/linux-*'''span>
output/debs/linux-dtb-next-sun50iw9_x.x.x_arm64.deb== How to install kernel header files ==
output/debs/linux{| class="wikitable" style="background-headerscolor:#ffffdc;width:800px;" |-next-sun50iw9_x| <big>'''Debian11 system with <span style="color:#FF0000">Linux6.1</span> kernel will report GCC error when compiling kernel module.xSo if you want to compile the kernel module, please use Debian12 or Ubuntu22.x_arm6404.deb'''</big>|}
output<ol style="list-style-type: decimal;"><li><p>The Linux image released by OPi comes with the deb package of the kernel header file by default, and the storage location is '''/opt/'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''ls /opt/linux-headers*'''</p><p>/debsopt/linux-imageheaders-nextxxx-sun50iw9_x.x.x_arm64.deb</p>|}<ol start/li><li><p>Use the following command to install the deb package of the kernel header file</p>{| class="9wikitable" style="list-style-typewidth: decimal800px;">|-| <lip>When the orangepi@orangepi:~$ '''sudo dpkg -bulid compilation system compiles the i /opt/linux kernel source code-headers*.deb'''</p>|}</li><li><p>After installation, it will first synchronize you can see the folder where the linux kernel source code with the header file is located under '''/usr/src'''.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''ls /usr/src'''</p><p>linux kernel source code of the github server-headers-x.x. Therefore, if x</p>|}</li><li><p>Then you want to modify can compile 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 hello kernel source code, otherwise it will prompt module that comes with the Linux image. The source code of the Linux kernel cannot be foundhello module is in '''/usr/src/hello'''). After entering this directory, otherwise then use the modifications will be restoredmake command to compile. The method is as follows:</li></olp>{| class="wikitable" style="width:800px;" |-| <blockquotep>Set the IGNORE_UPDATES variable in orangepi@orangepi:~$ '''userpatchescd /usr/src/hello/config-default.conf''' to &quot;yes&quot;</blockquotep>test<p>orangepi@testorangepi:~/orangepi-buildusr/src/hello$ '''vim userpatchessudo make'''</configp><p>make -defaultC /lib/modules/5.4.conf125/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</p>:<p>LD [M] /usr/src/hello/hello.ko</p><p>make[1]: Leaving directory '/usr/src/linux-headers-5.4.125'</p>|}</li>IGNORE_UPDATES=&quot;<li><p>After compilation, the '''yeshello.ko'''&quot;kernel module will be generated</p><ol start{| class="10wikitable" style="list-style-typewidth: decimal800px;"|-| <p>orangepi@orangepi:/usr/src/hello$ '''ls *.ko'''</p><p>hello.ko</p>|}</li><li><p>If Use the kernel is modified, you can use the following method '''insmod''' command to update insert the kernel and '''hello.ko''' kernel module of into the development board Linux systemkernel</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"|-| <p>orangepi@orangepi:/usr/src/hello$ '''sudo insmod hello.ko'''</p>|}</li>Upload <li><p>Then use the '''demsg''' command to view the compiled deb package output of the Linux '''hello.ko''' kernel to module. If you can see the Linux system of following output, it means that the development board'''hello.ko''' kernel module is loaded correctly.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:/usr/src/lihello$ '''dmesg | grep &quot;Hello&quot;'''</p><p>[ 2871.893988] '''Hello Orange Pi -- init'''</olp>|}</li><li><p>Use the '''rmmod''' command to uninstall the '''hello.ko''' kernel module</olp>{| class="wikitable" style="width:800px;" |-| test<p>orangepi@testorangepi:~/usr/src/hello$ '''sudo rmmod hello'''</p><p>orangepi@orangepi-build:/usr/src/hello$ '''cd outputdmesg | grep &quot;Hello&quot;'''</p><p>[ 2871.893988] Hello Orange Pi -- init</debsp><p>[ 3173.800892] '''Hello Orange Pi -- exit'''</p>|}</li></ol>
test@test:~/orangepi<span id="testing-of-some-programming-languages-supported-by-linux-build/outputsystem"></debs$ '''scp \'''span>
'''linux-image-next-sun50iw9_x.x.x_arm64.deb root@192.168.1.xxx:/root'''== Testing of some programming languages supported by Linux system ==
<ol startspan id="2" style="listdebian-stylebullseye-type: lower-alpha;system"><li>Install the deb package of the new linux kernel just uploaded.</li></olspan>=== Debian Bullseye system ===
orangepi@orangepi:~$ '''sudo dpkg <ol style="list-i linuxstyle-image-next-sun50iw9_xtype: decimal;"><li><p>Debian Bullseye is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.x.x_arm64.deb'''</p><ol start="3" style="list-style-type: lower-alpha;"><li>Then restart the development board and check whether the kernel-related modifications have taken effect.</lip>The version of a.gcc is as follows</olp>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudogcc --version'''</p><p>gcc (Debian 10.2.1-6) 10.2.1 20210110</p><p>Copyright (C) 2020 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>|}</li><li><p>Write the '''hello_world.c''' program in C language</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''rebootvim hello_world.c'''</p><p>#include &lt;stdio.h&gt;</p>
<span id="compile-rootfs"></span>
== Compile rootfs ==
# Run the build.sh script, remember to add sudo permissions<p>int main(void)</p><p>{</p>:<p>printf(&quot;Hello World!\n&quot;);</p>
test@test:~/orangepi-build$ '''sudo ./build.sh'''
<ol start="2" style="list-style-type: decimal;"><lip>Select '''Rootfs and all deb packages''' and press Enterreturn 0;</li></olp> <div class="figure"p[[File:zero2w-img285.png]] }</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><p>Then select the branch type of the kernel source code. Different versions of the kernel source code maintain different rootfs typescompile and run '''hello_world.c'''</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li>|-| <p>In the current branch, you can see three optionsorangepi@orangepi: debian11, ubuntu20.04, and ubuntu22.04~$ '''gcc -o hello_world hello_world.c'''</p></li><li><p>In the next branch, you can see three optionsorangepi@orangepi: debian11, debian12, and ubuntu22.04~$ '''./hello_world'''</p></lip>Hello World!</olp>|}
</li></ol>
 [[File:zero2w-img276.png]] <ol start="5" style="list-style-type: decimal;"><li>Then select the type of rootfs</li></ol> [[File:zero2w-img286.png]] <ol start="6" style="list-style-type: decimal;"><li><p>Then select the type of imageDebian Bullseye has Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The specific version of Python is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3'''</p><p>'''Python 3.9.2'''Image with console interface (serverdefault, Feb 28 2021, 17:03:44)</p><p>[GCC 10.2.1 20210110] 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>''' Represents Use the image of Ctrl+D shortcut key to exit python's interactive mode.'''</p></big>|}</li><li><p>Write the server version, which is relatively small '''hello_world.py''' program in sizePython 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 '''Image with desktop environmenthello_world.py''' Represents an image with a desktop, which is relatively large in sizeas follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 hello_world.py'''</p><p>Hello World!</p>|}</li></ol></li><li><p>Debian Bullseye does not install Java compilation tools and operating environment by default.</p><olstyle="list-style-type: lower-alpha;"><li><p>You can use the following command to install openjdk. The latest version in Debian Bullseye is openjdk-17</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''</p>|}</li><li><p>After installation, you can check the Java version.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''java --version'''</p>|}</li><li><p>Write the Java version of '''hello_world.java'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println(&quot;Hello World!&quot;);</p>:<p>}<div /p><p>}</p>|}</li><li><p>Then compile and run '''hello_world.java'''</p>{| class="figurewikitable" style="width:800px;"|-| <p>orangepi@orangepi:~$ '''javac hello_world.java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p>|}</li></ol></li></ol>
[[File:zero2w<span id="debian-img287.png]]bookworm-system"></span>
</div><ol start="7" style="list-style-type: decimal;"><li>If you are compiling the server version of the image, you can also choose to compile the Standard version or the Minimal version. The Minimal version will have much less pre-installed software than the Standard version ('''please do not choose the Minimal version without special needs, because many things are not pre-installed by default. Some functions may not be available''')</li></ol>= Debian Bookworm system ===
<div class="figure"> [[File:zero2w-img288.png]] </div><ol start="8" style="list-style-type: decimal;"><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.</li></olp[[File:zero2w-img289.png]] [[File:zero2w-img290.png]] You can then select additional packages that need to be Debian Bookworm is installed. Please press with the Enter key here to skip gcc compilation tool chain by default, which can directly. [[File:zero2w-img291.png]] <ol start="9" style="list-style-type: decimal;"><li><p>Then compile C language programs in the compilation Linux system of rootfs will startthe development board. Some of the information prompted during compilation are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li>Type <p>The version of rootfsa.gcc is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''gcc --version'''</p><p>gcc (Debian 12.2.0-14) 12.2.0</p><p>Copyright (C) 2022 Free Software Foundation, Inc.</p><p>This is free software; see the 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</olp>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.c'''</lip><p>#include &lt;stdio.h&gt;</olp>
[ o.k. ] local not found [ Creating new rootfs cache for '''bullseye''' ]
<ol start="2" style="list-style-type: lower-alpha;"p>int main(void)</p><lip>The storage path of the compiled rootfs compressed package{</lip>:<p>printf(&quot;Hello World!\n&quot;);</olp>
[ o.k. ] Target directory [ '''orangepi-build/external/cache/rootfs''' ]
:<ol start="3" style="list-style-type: lower-alphap>return 0;"</p><lip>The name of the rootfs compressed package generated by compilation}</lip>|}</olli[ o.k. ] File name [ <li><p>Then compile and run '''bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tarhello_world.lz4c''' ]</p> <ol start{| class="10wikitable" style="list-style-typewidth: decimal800px;"><li>|-| <p>View the compiled rootfs compressed packageorangepi@orangepi:~$ '''gcc -o hello_world hello_world.c'''</p><ol style="list-style-typep>orangepi@orangepi: lower-alpha;"><li>~$ '''bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4/hello_world''' It is a compressed package of rootfs. The meaning of each field in the name is</lip><p>Hello World!</olp>|}
</li></ol>
 <blockquote>a) '''bullseye''' represents the type of Linux distribution of rootfs b) '''xfce''' indicates that the rootfs is the desktop version, and if it is cli, it indicates the server version. c) '''arm64''' represents the architecture type of rootfs d) '''25250ec7002de9e81a41de169f1f89721''' is the MD5 hash value generated by the package names of all software packages installed by rootfs. As long as the list of software packages installed by rootfs is not modified, this value will not change. The compilation script will use this MD5 hash value. Determine whether rootfs needs to be recompiled</blockquote><ol start="2" style="list-style-type: lower-alpha;"><li>'''bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4.list''' Lists the package names of all packages installed by rootfs</li></ol> test@test:~/orangepi-build$ '''ls external/cache/rootfs/''' bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4 bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4.current bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4.list <ol start="11" style="list-style-type: decimal;"><li>If the required rootfs already exists under '''external/cache/rootfs''', then compiling the rootfs again will directly skip the compilation process and will not restart the compilation. When compiling the image, it will also go to '''external/cache/rootfs''' to check whether it already exists. There is a cached rootfs available. If it is available, use it directly. This can save a lot of download and compilation time.</li></ol> <span id="compile-linux-image"></span>== Compile linux image == # 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 '''Full OS image for flashing''' and press Enter</li></ol> <div class="figure"> [[File:zero2w-img292.png]] </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="4" 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.Debian Bookworm has Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li><p>In the current branch, you can see three optionsThe specific version of Python is as follows</p>{| class="wikitable" style="width: debian11, ubuntu20.04, and ubuntu22.04.800px;" |-| </p>orangepi@orangepi:~$ '''python3'''</lip><li><p>In the next branchPython 3.11.2 (main, Mar 13 2023, you can see three options12:18: debian11, debian12, and ubuntu2229) [GCC 12.042.0] on linux</p></lip>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</olp></lip>&gt;&gt;&gt;</olp>|}[[File:zero2w-img276.png]] <ol start{| class="5wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;"><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;">| <libig><p>If '''Use the development board you purchased has a memory size of 1.5GB, please select the first optionCtrl+D shortcut key to exit python's interactive mode.'''</p></libig><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 Write the type of rootfs'''hello_world.py''' program in Python language</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.py'''</lip><p>print('Hello World!')</olp>|}</li>[[File:zero2w-img286<li><p>The result of running '''hello_world.png]]py''' is as follows</p> <ol start{| class="7wikitable" 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 imageDebian Bookworm does not install Java compilation tools and operating environment by default.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>You can use the following command to install openjdk. The latest version in Debian Bookworm is openjdk-17</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''Image with console interface (server)sudo apt install -y openjdk-17-jdk''' Represents </p>|}</li><li><p>After installation, you can check the image of Java version.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''java --version'''</p>|}</li><li><p>Write the server Java version, which is relatively small in sizeof '''hello_world.java'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println(&quot;Hello World!&quot;);</p>:<p>}</p><p>}</p>|}</li><li><p>Then compile and run '''Image with desktop environmenthello_world.java'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''Represents an image with a desktop, which is relatively large in sizejavac hello_world.java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p>|}</li></ol>
</li></ol>
<div classspan id="figureubuntu-focal-system"></span>
[[File:zero2w-img287.png]]=== Ubuntu Focal system ===
</div><ol start="8" style="list-style-type: decimal;"><li>If you are compiling <p>Ubuntu Focal is installed with the server version of the imagegcc compilation tool chain by default, you which can also choose to directly compile C language programs in the Standard version or Linux system of the Minimal versiondevelopment board. </p><ol style="list-style-type: lower-alpha;"><li><p>The Minimal version will have much less preof a.gcc is as follows</p>{| class="wikitable" style="width:800px;" |-installed software than the Standard version (| <p>orangepi@orangepi:~$ '''please do not choose the Minimal gcc --version without special needs, because many things are not pre-installed by default. Some functions may not be available'''</p><p>gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1)9.4.0</lip><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 even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</olp>|}<div /li><li><p>Write the '''hello_world.c''' program in C language</p>{| class="figurewikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.c'''</p><p>#include &lt;stdio.h&gt;</p>
[[File:zero2w-img288.png]]
<p>int main(void)</divp><ol start="9" style="list-style-type: decimal;"p>{<li/p>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.:</lip>printf(&quot;Hello World!\n&quot;);</olp>
[[File:zero2w-img289.png]]
[[File:zero2w-img290.png]]<p>return 0;</p><p>}</p>You can then select additional packages that need to be installed. Please press the Enter key here to skip directly.|}</li>[[File:zero2w-img291<li><p>Then compile and run '''hello_world.png]]c'''</p> <ol start{| class="10wikitable" style="list-style-typewidth: decimal800px;">|-| <lip>Then the compilation of the linux image will beginorangepi@orangepi:~$ '''gcc -o hello_world hello_world. The general process of compilation is as followsc'''</lip></olpa. Initialize the compilation environment of Ubuntu PC and install the software packages required for the compilation process. b. Download the source code of u-boot and linux kernel (if already cached, only update the code) c. Compile u-boot source code and generate u-boot deb package d. Compile linux source code and generate linux-related deb packages e. Make the deb package of linux firmware f. Make the deb package of orangepi-config tool g@orangepi:~$ '''. Create a deb package with board-level support/hello_world'''</p><p>Hello World!</p>h. If you compile the desktop version image, you will also create a desktop-related deb package. i. Check whether rootfs has been cached. If not, re-create rootfs. If it has been cached, decompress it directly and use it. j. Install the deb package generated previously into rootfs 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. l. Then create the image file and format the partition. The default type is ext4. m. Then copy the configured rootfs to the mirror partition. n. Then update initramfs o. Finally, write the bin file of u-boot into the image through the dd command.|}</li></ol><ol start="11" style="list-style-type: decimal;"/li><li><p>After compiling the image, the following message will be displayedUbuntu Focal has Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The storage path specific version of the compiled imagePython3 is as follows</li></olp></li></ol> [ 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 start{| class="2" style="list-style-type: lower-alpha;"><li>Compilation time</li></ol> '''[ o.k. ] Runtime [ 19 min ]''' <ol start="3wikitable" style="list-style-typewidth: lower-alpha800px;"><li>Repeat the command to compile the image. Use the following command to start compiling the image directly without selecting it through the graphical interface.</li></ol> [ o.k. ] Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=image RELEASE=bullseye BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_CONFIGURE=yes''' ] <span id="instructions-for-using-the-orange-pi-os-arch-system"></span> = '''Instructions for using the Orange Pi OS Arch system''' = <span id="orange-pi-os-arch-system-function-adaptation-status"></span>== Orange Pi OS Arch system function adaptation status == {| class="wikitable"
|-
| <p>orangepi@orangepi:~$ '''Motherboard functionspython3'''</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>| '''OPi OS Arch'''}{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big><p>'''HDMI videoUse the Ctrl+D shortcut key to exit python's interactive mode.'''</p></big>| }</li><li><p>Write the '''OKhello_world.py'''program in Python language</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''vim hello_world.py''HDMI Audio'</p><p>print('Hello World!')</p>| }</li><li><p>The result of running '''OKhello_world.py'''is as follows</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''Type-C USB2python3 hello_world.0 x 2py'''</p><p>Hello World!</p>| '''OK'''}</li></ol></li><li><p>Ubuntu Focal does not have Java compilation tools and running environment installed by default.</p><ol style="list-style-type: lower-alpha;"><li><p>You can use the following command to install openjdk-17</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''TF Card Startupsudo apt install -y openjdk-17-jdk'''</p>|}</li><li><p>After installation, you can check the Java version.</p>{| '''OK'''class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''WIFIjava --version'''</p><p>openjdk 17.0.2 2022-01-18</p><p>OpenJDK Runtime Environment (build 17.0.2+8-Ubuntu-120.04)</p><p>OpenJDK 64-Bit Server VM (build 17.0.2+8-Ubuntu-120.04, mixed mode, sharing)</p>| }</li><li><p>Write the Java version of '''OKhello_world.java'''</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''Bluetoothvim 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 '''OKhello_world.java'''</p>{| class="wikitable" style="width:800px;"
|-
| '''LED Light'''| '''OK'''|-| '''40pin GPIO'''| <p>orangepi@orangepi:~$ '''OKjavac hello_world.java'''</p>|-| <p>orangepi@orangepi:~$ '''40pin I2Cjava hello_world'''</p>| '''OK'''|-| '''40pin SPI'''| '''OK'''|-| '''40pin UART'''| '''OK'''|-| '''40pin PWM'''| '''OK'''|-| '''Temperature Sensor'''| '''OK'''|-| '''Hardware watchdog'''| '''OK'''|-| '''Mali GPU'''| '''NO'''|-| '''Video codec'''| '''NO'''<p>Hello World!</p>
|}
</li></ol>
</li></ol>
 
<span id="ubuntu-jammy-system"></span>
 
=== Ubuntu Jammy system ===
<ol style="list-style-type: decimal;"><li><p>Ubuntu Jammy is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.</p><ol style="list-style-type: lower-alpha;"><li><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) '''24pin expansion board function11.3.0'''</p><p>Copyright (C) 2021 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>| }</li><li><p>Write the '''OPi OS Archhello_world.c'''program in C language</p>{| class="wikitable" style="width:800px;"
|-
| '''100M network port'''| <p>orangepi@orangepi:~$ '''OK'''|-| '''100M Ethernet port light'''| '''OKvim hello_world.c'''</p>|-| '''USB2<p>#include &lt;stdio.0 HOST x 2'''| '''OK'''|-| '''Infrared reception'''| '''OK'''|-| '''Headphone audio playback'''| '''OK'''|-| '''Onh&gt;</off button'''| '''OK'''|-| '''LRADC''' '''Custom buttons x 2'''| '''OK'''|-| '''TV-OUT'''| '''NO'''|}p>
<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 <p>int main(not even the root uservoid). This is different from Ubuntu and Debian systems.</p><p>{</p>:<p>printf(&quot;Hello World!\n&quot;);</p>
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). The setup steps of the user wizard are as follows:
:<p>return 0;</p>
<p>}</p>
|}
</li>
<li><p>Then compile and run '''hello_world.c'''</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''gcc -o hello_world hello_world.c'''</p>
<p>orangepi@orangepi:~$ '''./hello_world'''</p>
<p>Hello World!</p>
|}
</li></ol>
</li>
<li><p>Ubuntu Jammy has Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li><p>After burning the systemThe specific version of Python3 is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3'''</p><p>Python 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0] on linux</p><p>Type &quot;help&quot;, &quot;copyright&quot;, when you start it &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's interactive mode.'''</p></big>|}</li><li><p>Write the first time '''hello_world.py''' program in Python language</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.py'''</p><p>print('Hello World!')</p>|}</li><li><p>The result of running '''hello_world.py''' is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 hello_world.py'''</p><p>Hello World!</p>|}</li></ol></li><li><p>Ubuntu Jammy does not install Java compilation tools and enter operating environment by default.</p><ol style="list-style-type: lower-alpha;"><li><p>You can use the desktopfollowing command to install openjdk-18</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-18-jdk'''</p>|}</li><li><p>After installation, you will see can check the user wizard program shown in Java version.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''java --version'''</p><p>openjdk 18.0.2-ea 2022-07-19</p><p>OpenJDK Runtime Environment (build 18.0.2-ea+9-Ubuntu-222.04)</p><p>OpenJDK 64-Bit Server VM (build 18.0.2-ea+9-Ubuntu-222.04, mixed mode, sharing)</p>|}</li><li><p>Write the figure belowJava version of '''hello_world.java'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println(&quot;Hello World!&quot;);</p>:<p>}</p><p>}</p>|}</li><li><p>Then compile and run '''hello_world.java'''<div /p>{| class="figurewikitable" style="width:800px;"|-| <p>orangepi@orangepi:~$ '''javac hello_world.java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p>|}</li></ol></li></ol>
[[File:zero2w<span id="method-img293.png]]of-uploading-files-to-the-development-board-linux-system"></span>
</div></li><li><p>First you need == Method of uploading files to select the language you want</p><div classdevelopment board Linux system =="figure">
[[File:zero2w<span id="method-img294.png]]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="how-to-upload-files-using-scp-command"></span>==== How to upload files using scp command ====
<ol style="list-style-type: decimal;"><li><p>Use the scp command to upload files to the Linux system of the development board in Ubuntu PC. The specific command is as follows</p><ol style="list-style-type: lower-alpha;"><li><p>'''file_path: '''Needs to be replaced with the path of the file to be uploaded</divp></li><li><p>After selecting '''orangepi: '''This is the user name of the languagedevelopment 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 user wizard will immediately switch IP address of the development board. Please modify it according to the corresponding language interfaceactual 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/'''</p>|}</li></ol></li><li><p>If you want to upload a folder, as shown below in Chineseyou 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><div p>There are more usages of scp, please use the following command to view the man manual</p></li>{| class="figurewikitable"style="width:800px;" |-| test@test:~$ '''man scp'''|}</ol><span id="how-to-upload-files-using-filezilla"></span>
[[File:zero2w-img295.png]]==== How to upload files using filezilla ====
<ol style="list-style-type: decimal;"><li><p>First install filezilla in Ubuntu PC</divp>{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''sudo apt install -y filezilla'''</p>|}</li><li><p>Then select use the following command to open filezilla</p>{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''filezilla'''</p>|}</li><li><p>The interface after opening filezilla is as shown below. At this time, the remote site on the arearight is empty.</p>
<div class="figure">
[[File:zero2w-img296img255.png]]
</div></li>
<li><p>Then select The method of connecting the keyboard modeldevelopment board is as shown in the figure below</p></li> 
<div class="figure">
[[File:zero2w-img297img256.png]] </div></ol><ol start="5" style="list-style-type: decimal;"><li><p>Then choose to '''save the password''' and click '''OK'''</p><p>[[File:zero2w-img257.png]]</p></li><li><p>Then select '''Always trust this host''' and click '''OK'''</p></li>
</div></li>
<li><p>Then create a new username and set a password</p>
<div class="figure">
[[File:zero2w-img298img258.png]] </div></ol><ol start="7" style="list-style-type: decimal;"><li>After the connection is successful, you can see the directory structure of the development board's Linux file system on the right side of the filezilla software.</li>
</div></li>
<li><p>Then make sure there is no problem with the selection, and then click the install '''button'''</p>
<div class="figure">
[[File:zero2w-img299img259.png]] </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 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.</li>
</div></li>
<li><p>Then wait for the installation to complete</p>
<div class="figure">
[[File:zero2w-img300img260.png]]
</div></liol><ol start="9" style="list-style-type: decimal;"><li><p>After the installation upload is completecompleted, you need can go to click the '''Finish''' button corresponding path in the development board Linux system to restart view the systemuploaded file.</p></li><div class="figure"li><p>The method of uploading a folder is the same as the method of uploading a file, so I won't go into details here.</p></li></ol>
[[File:zero2w<span id="method-img301.png]]to-upload-files-from-windows-pc-to-development-board-linux-system"></span>
</div></li><li><p>The Orange Pi Hello program will automatically start after restarting. At this time, you need === Method to remove the check '''mark of Start on startup''' in the lower right corner, otherwise you need upload files from Windows PC to manually close the Orange Pi Hello program every time you start it.</p><div classdevelopment board Linux system ==="figure">
[[File:zero2w<span id="how-img302.png]]to-upload-files-using-filezilla-1"></span>==== How to upload files using filezilla ====
</div><p>At this point, you can use # First download the newly created username and password to log in to installation file of the OPi OS system through Windows version of the serial port or sshfilezilla software.</p></li></ol>The download link is as follows
<span id::{| class="how-to-set-dt-overlayswikitable" style="width:800px;"></span>== How to set DT overlays ==|-| The multiplexing functions such as I2C[https://filezilla-project.org/SPIdownload.php?type=client '''https:/UART/PWM in the 40filezilla-pin development board are turned off by default in the kernelproject.org/download.php?type=client's dts, and the corresponding DT overlays need to be manually turned on before they can be used.'']|}
The method to open DT overlays in OPi OS Arch system is as follows::[[File:zero2w-img261.png]]
# First open the '''/boot/extlinux/extlinux.conf''' configuration file<div class="figure">
::[orangepi@orangepi[File:zero2w-pc ~img262.png]]$ '''sudo vim /boot/extlinux/extlinux.conf'''
</div>
<ol start="2" style="list-style-type: decimal;">
<li>Then open the corresponding configuration by adding <p>The downloaded installation package is as shown below, then double-click to install it directly</p>{| class="wikitable" style="width:800px;" |-| <p>'''FDTOVERLAYSFileZilla_Server_1.5.1_win64-setup.exe''' </p>|}During the installation process, please select '''/dtbs/allwinner/overlay/xxx.dtboDecline''' in on the following installation interface, and then select '''/boot/extlinux/extlinux.confNext&gt;'''</li></ol>
'''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.'''<div class="figure">
[orangepi@orangepi[File:zero2w-pc ~img263.png]]$ '''sudo vim /boot/extlinux/extlinux.conf'''
LABEL Orange Pi</div></li></ol><ol start="3" style="list-style-type: decimal;"><li>The interface after opening filezilla is as shown below. At this time, the remote site on the right is empty.</li>
KERNEL /Image<div class="figure">
FDT /dtbs/allwinner/sun50i-h616-orangepi[[File:zero2w-zero2wimg264.dtbpng]]
'''FDTOVERLAYS </dtbsdiv></allwinnerol><ol start="4" style="list-style-type: decimal;"><li>The method of connecting the development board is as shown in the figure below:</overlay/xxx.dtbo''' #Configuration that needs to be addedli>
<ol startdiv class="3figure" style="list-style-type: decimal;"><li><p>The storage path of xxx.dtbo in the OPi OS Arch image is as follows. Please note that not all dtbo under this path can be used.</p><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>
{| class="wikitable"|-| '''Functions on the development board'''| '''Corresponding DT overlays configuration'''|-| '''40pin - i2c0'''| '''sun50i-h616-pi-i2c0.dtbo'''|-| '''40pin - i2c1'''| '''sun50i-h616-pi-i2c1.dtbo'''|-| '''40pin - i2c2'''| '''sun50i-h616-pi-i2c2.dtbo'''|-| '''40pin - uart2'''| '''sun50i-h616-pi-uart2.dtbo'''|-| '''40pin - uart3'''| '''sun50i-h616-pi-uart3.dtbo'''|-| '''40pin - uart4'''| '''sun50i-h616-pi-uart4.dtbo'''|-| '''40pin - uart5'''| '''sun50i-h616-ph-uart5.dtbo'''|-| '''40pin - pwm1'''| '''sun50i-h616-pi-pwm1.dtbo'''|-| '''40pin - pwm2'''| '''sun50i-h616-pi-pwm2.dtbo'''|-| '''40pin - pwm3'''| '''sun50i-h616-pi-pwm3.dtbo'''|-| '''40pin - pwm4'''| '''sun50i-h616-pi-pwm4.dtbo'''|-| '''40pin - spi1 cs0'''| '''sun50i-h616-spi1-cs0-spidev.dtbo'''|-| '''40pin - spi1 cs1'''| '''sun50i-h616-spi1-cs1-spidev.dtbo'''|-| '''40pin - spi1 cs0 cs1'''| '''sun50i-h616-spi1-cs0-cs1-spidev.dtbo'''|-| '''设Set USB0 to Host mode'''| '''sun50i-h616-usb0-host.dtbo'''|-| '''Turn off the green LED light'''| '''sun50i-h616-[[File:zero2w-disable-led.dtbo'''|-| '''How to close the UART0 debugging serial port'''| '''sun50i-h616-disable-uart0img256.dtbo'''|}png]]
</div></ol>
<ol start="5" style="list-style-type: decimal;">
<li>If you need Then choose to open multiple configurations at '''save the same time, just add the paths of multiple configurations directly after password''' and click '''FDTOVERLAYS.OK''' For example, the configuration of opening i2c1 and uart5 at the same time is as follows</li></ol>
<div class="figure"> [orangepi@orangepi[File:zero2w-pc ~img265.png]]$ '''sudo vim /boot/extlinux/extlinux.conf'''
LABEL Orange Pi</div></ol><ol start="6" style="list-style-type: decimal;"><li>Then select '''Always trust this host''' and click '''OK'''</li>
KERNEL /Image<div class="figure">
FDT /dtbs/allwinner/sun50i-h616-orangepi[[File:zero2w-zero2wimg266.dtbpng]]
'''FDTOVERLAYS </dtbsdiv></allwinner/overlay/sun50iol><ol start="7" style="list-h616style-pi-i2c1type: 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.dtbo /dtbs</allwinner/overlay/sun50i-h616-ph-uart5.dtbo'''li>
<ol startdiv class="6figure" style="list-style-type: decimal;"><li>After setting, you need to restart the system for the configuration to take effect.</li></ol>
[orangepi@orangepi[File:zero2w-pc ~img267.png]]$ '''sudo reboot'''
<span id/div></ol><ol start="how-to8" style="list-installstyle-softwaretype: decimal;"></spanli>== How Then select the path to be uploaded to the development board on the right side of the filezilla software, select the file to install be uploaded on the Windows PC on the left side of the filezilla software ==, right-click the mouse, and then click the upload option to start uploading the file to the development board.</li>
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.<div class="figure">
[orangepi@orangepi[File:zero2w-pc ~img268.png]]$ '''sudo pacman -Syy vim'''
<span id/div></ol><ol start="9" style="androidlist-12-tvstyle-type: decimal;"><li><p>After the upload is completed, you can go to the corresponding path in the development board Linux system-usage-instructions"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't go into details here.</p></li></spanol>
<span id= '''Android 12 TV system usage "instructions''' =-for-using-the-logo-on-and-off-the-machine"></span>
<span id="supported-android-versions"></span>== Supported Android versions 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>{| class="wikitable" style="width:800px;"
|-
| Android Version<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>{| Kernel versionclass="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''Android 12 TV Versionsudo vim /boot/orangepiEnv.txt'''</p><p>verbosity=1</p>| <p>'''linux5.4<span style="color:#FF0000">bootlogo=true</span>'''</p>
|}
</li><span id="android-12-tv-function-adaptation-status"li><p>The location of the boot logo picture in the Linux system is</spanp>== Android 12 TV function adaptation status == {| class="wikitable" style="width:800px;"
|-
| <p>'''Motherboard functions/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>{| '''Android12 TV'''class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''HDMI videosudo 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 '''orangepi-config'OK''. Ordinary users remember to add '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''HDMI Audiosudo orangepi-config'''</p>| }</li><li><p>Then select '''System'''</p><p>[[File:zero2w-img80.png]]</p></li><li><p>Then select '''Hardware'''</p><p>[[File:zero2w-img81.png]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown in the picture below, and then use the '''space''' to select the dtbo configuration of the SPI you want to open.</p><p>[[File:zero2w-img270.png]]</p></li><li><p>Then select '''&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;'OK''to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol> <span id="how-to-shut-down-and-restart-the-development-board"></span> == How to shut down and restart the development board == <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:~$ '''Type-C USB2.0 x 2sudo poweroff'''</p>|}{| '''OK'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big><p>'''TF card startupNote 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>'''WIFINote 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'''''Bluetooth'reboot'''</p>| }</li></ol> <span id="linux-sdkorangepi-build-usage-instructions"></span> = '''Linux SDK——orangepi-build usage instructions''' = <span id="compilation-system-requirements"></span>== Compilation system requirements == The Linux SDK, '''orangepi-build''OK', only supports running on X64 computers with '''<span style="color:#FF0000">Ubuntu 22.04</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 '''<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>''USB Camera' 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;"
|-
| [https://repo.huaweicloud.com/ubuntu-releases/21.04/ubuntu-21.04-desktop-amd64.iso '''LED Lighthttps://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/22.04/ubuntu-22.04-desktop-amd64.iso''']| '''OK'''} 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/ '''40pin GPIOhttps://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/''']| }</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Note that the Ubuntu version needs to be switched to 22.04.</li> [[File:zero2w-img271.png]]</ol><ol start="3" style="list-style-type: lower-alpha;"><li>The contents of the '''OK/etc/apt/sources.list'''file that need to be replaced are:</li>{| class="wikitable" style="width:800px;"
|-
| test@test:~$ '''sudo mv /etc/apt/sources.list cat /etc/apt/sources.list.bak''' test@test:~$ '''sudo vim /etc/apt/sources.list''' '''#''' The source code image is commented by default to improve apt update speed. You can uncomment it yourself if necessary. deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse '''40pin I2C#'''deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse '''#''' deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse '''#''' deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse '''#''' deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse  '''#''' Pre-release software source, not recommended to be enabled '''#''' deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse | '''OK#'''deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse|}</ol><ol start="4" style="list-style-type: lower-alpha;"><li>After the replacement, you need to update the package information and ensure that no errors are reported.</li>{| class="wikitable" style="width:800px;"
|-
| '''40pin SPI1'''| '''OK'''|-| 'test@test:~$ ''40pin UART'''| '''OK'''|sudo apt-| '''40pin PWM'''| '''OK'''|-| '''Temperature Sensor'''| '''OK'''|-| '''Hardware watchdog'''| '''OK'''|-| '''Mali GPU'''| '''OK'''|-| '''Video codec'''| '''OKget update'''
|}
</ol>
<ol start="5" style="list-style-type: lower-alpha;">
<li>'''<span style="color:#FF0000">In addition, since the source code of the kernel and Uboot are stored on GitHub, it is very important to ensure that the computer can download the code from GitHub normally when compiling the image.</span>'''</li></ol>
 
<span id="obtain-the-source-code-of-linux-sdk"></span>
 
== Obtain the source code of linux sdk ==
<span id="download-orangepi-build-from-github"></span>=== Download orangepi-build from github === Linux sdk refers to the orangepi-build set of codes. Orangepi-build is modified based on the armbian build compilation system. Multiple versions of Linux images can be compiled using orangepi-build. Use the following command to download the orangepi-build code: {| class="wikitable" style="width:800px;"
|-
| test@test:~$ '''24pin Expansion board functionsudo apt-get update'''| test@test:~$ '''sudo apt-get install -y git''' test@test:~$ '''Android12 TVgit clone https://github.com/orangepi-xunlong/orangepi-build.git -b next'''|}{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big>'''100M network portNote that when using the H618 Soc development board, you need to download the source code of the <span style="color:#FF0000">next</span> branch of orangepi-build. The above git clone command needs to specify the branch of the orangepi-build source code as next.'''</big> <div class="figure"> [[File:zero2w-img272.png| '''OK'''center|800px]] </div>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| '''100M Ethernet port light'''| <big>'''OK'''|When downloading the orangepi-| '''USB2build 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.0 HOST x 2'''| '''OK'''|The name and password are usually entered incorrectly in the address of the orangepi-| '''Infrared reception'''| '''OK'''|-| '''Headphone audio playback'''| '''OK'''|-| '''On/off button'''| '''OK'''|-| '''LRADC''' '''Custom buttons x 2'''| '''OKbuild warehouse behind git clone. Please carefully check whether there are any errors in the spelling of the command, The default setting is rather than thinking that we have forgotten to provide the volume up username and down keyspassword of the github account.'''|-| '''TV-OUT'''| '''OK'''</big>
|}
<span id="onboardThe u-led-light-display-instructions"></span>== Onboard LED light display instructions ==boot and linux kernel versions currently used by the H618 series development boards are as follows:
{| class="wikitable" style="width:800px;text-align: center;"
|-
|'''branch'''| '''green lightu-boot Version'''| '''red lightlinux Kernel version'''
|-
| '''u-boot startup phasecurrent'''| '''Offu-boot v2018.05'''| '''onlinux5.4'''
|-
| '''Kernel boot to enter the systemnext'''| '''onu-boot v2021.07'''| '''onlinux6.1'''
|}
<span id{| class="wikitable" style="howbackground-to-return-tocolor:#ffffdc;width:800px;" |-| <big>'''The branch mentioned here is not the same thing as thebranch of orangepi-previous-interface-in-android"></span>== How build source code, please don't get confused. This branch is mainly used to return to the previous interface in Android ==distinguish different kernel source code versions.'''
'''We generally use define the mouse and keyboard to control the Android system of the development boardlinux5. When entering certain interfaces and need to return to the previous interface or desktop, we can only return 4 bsp kernel currently provided by right-clicking Allwinner as the mouse, and current branch. The latest linux6.1 LTS kernel is defined as the keyboard cannot returnnext branch.'''</big>|}
If you have purchased After downloading, the infrared remote control (other remote controls do not work) following files 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. Shownfolders will be included:
[[File<ol style="list-style-type:zero2wlower-img303alpha;"><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.png]]md''': orangepi-build documentation</p></li><li><p>'''scripts''': Common script for compiling linux images</p></li></ol>{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''ls'''
<span id'''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="howbackground-color:#ffffdc;width:800px;" |-| <big>'''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 tocompile u-useboot 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-adb">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.'''</spanbig>== How to use ADB ==|}
<span id="usedownload-networkthe-connectioncross-adbcompilation-debuggingtool-chain"></span>=== Use network connection adb debugging ===
'''Using network adb does not require a USB Typc C interface data cable to connect === Download 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.'''cross-compilation tool chain ===
# Make sure When orangepi-build is run for the first time, it will automatically download the cross-compilation '''toolchain''' and put it in the '''servicetoolchains''' folder.adbEvery time you run orangepi-build's build.tcpsh script, it will check whether the cross-compilation toolchain in toolchains exists.port''' of If If it does not exist, the Android system is set to 5555 port numberdownload will be restarted. If it exists, it will be used directly without repeated downloading.
apollo-p2:/ # '''getprop | grep &quot;adb.tcp&quot;'''<div class="figure">
[service.adb.tcp[File:zero2w-img273.portpng]: [5555]
<ol start="2" style="list-style-type: decimal;"/div><li>If '''service.adb.tcp.port''' is not set, you can use The mirror URL of the following command cross-compilation tool chain in China is the serial port to set the port number open source software mirror site of the network adb</li></ol>Tsinghua University:
apollo{| class="wikitable" style="width:800px;" |-p2| [https:/ # /mirrors.tuna.tsinghua.edu.cn/armbian-releases/_toolchain/ '''setprop servicehttps://mirrors.tuna.adbtsinghua.tcpedu.port 5555'''<br cn/>apolloarmbian-p2:releases/_toolchain/ # '''stop adbd''']|}
apolloAfter toolchains is downloaded, it will contain multiple versions of cross-p2:/ # compilation '''start adbdtoolchain''':
<ol start{| class="3wikitable" style="list-style-typewidth: decimal800px;"><li>Install adb tool on Ubuntu PC<|-| test@test:~/li><orangepi-build$ '''ls toolchains/ol>'''
test@test:~$ '''sudo aptgcc-get update'''arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu
test@test:~$ '''sudo aptgcc-get install linaro-y adb'''4.9.4-2017.01-x86_64_aarch64-linux-gnu
<ol start="gcc-linaro-7.4" style="list.1-2019.02-x86_64_arm-stylelinux-type: decimal;"><li>Then connect network adb on Ubuntu PC</li></ol>gnueabi
test@test:~$ '''adb connect 192gcc-arm-11.1682-2022.1.xxx:5555''' '''(Need to be modified to the IP address of the development board)'''02-x86_64-arm-none-linux-gnueabihf
* daemon not running; starting now at tcp:5037gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabi
* daemon started successfullygcc-linaro-aarch64-none-elf-4.8-2013.11_linux
connected to 192gcc-arm-9.1682-2019.1.xxx:555512-x86_64-aarch64-none-linux-gnu
test@test:~$ '''adb devices'''gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf
List of devices attachedgcc-linaro-arm-linux-gnueabihf-4.8-2014.04_linux
192gcc-arm-9.1682-2019.1.xxx:5555 device12-x86_64-arm-none-linux-gnueabihf
<ol start="5" style="listgcc-stylelinaro-type: decimal;"><li>Then you can log in to the android system through adb shell on Ubuntu PC</li></ol>7.4.1-2019.02-x86_64_aarch64-linux-gnu
test@test:~$ '''adb shell'''gcc-linaro-arm-none-eabi-4.8-2014.04_linux|}
apolloThe cross-p2compilation tool chain used to compile the H618 Linux kernel source code is:/ #
<span idol style="uselist-datastyle-cabletype: lower-toalpha;"><li>linux5.4</li>{| class="wikitable" style="width:800px;" |-| '''gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu'''|}</ol><ol start="2" style="list-connectstyle-adbtype: lower-debuggingalpha;"><li>linux6.1</spanli>{| class="wikitable" style== Use data cable "width:800px;" |-| '''gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu'''|}</ol>The cross-compilation tool chain used to connect adb debugging ===compile the H618 u-boot source code is:
# 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)<ol style="list-style-type: lower-alpha;"><li>v2018.05</li>{| class="wikitable" style="width:800px;" |-| '''gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabi'''|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>v2021. In this case, the development board is powered by the computer07</li>{| class="wikitable" style="width:800px;" |-| ''s USB interface, so please ensure that the computer's USB interface can provide the most sufficient power to drive the development boardgcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu'''|}</ol><span id="orangepi-build-complete-directory-structure-description"></span>
[[File:zero2w-img304.png]] [[File:zero2w-img305.png]] <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="vieworangepi-how-to-set-hdmi-display-resolution"></span>=build complete directory structure description = View how to set HDMI display resolution ==
<ol style="list-style-type: decimal;">
<li><p>Enter first '''Settings'''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><p>[[Fileol style="list-style-type:zero2wlower-img306.png]]</p></lialpha;"><li><p>Then select '''Device Preferences'''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><p>[[Fileol style="list-style-type:zero2w-img307.png]]</p></linone;"><li><p>Then select '''Display &amp; Sound'''a) Linux5.4</pli><p>[[File{| class="wikitable" style="width:zero2w800px;" |-img308| https://github.png]]<com/orangepi-xunlong/linux-orangepi/p><tree/li><li><p>Then select '''Advanced display settingsorange-pi-5.4-sun50iw9'''|}</pol><p>[[Fileol start="2" style="list-style-type:zero2wlower-img309.png]]</p></lialpha;"><li><p>Then select '''HDMI output mode'''b) Linux6.1</pli><p>[[File{| class="wikitable" style="width:zero2w800px;" |-img310.png]]<| https:/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 resolutiongithub. 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.<com/p><p>[[File:zero2worangepi-img311.png]]<xunlong/p><linux-orangepi/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.<tree/p><p>[[File:zero2w'''orange-pi-img3126.png]]1-sun50iw9'''|}</pol></li></ol> <span idol start="hdmi-to-vga-display-test-12"></span>=== HDMI to VGA display test === <ol style="list-style-type: decimallower-alpha;"><li><p>First you need 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 prepare the following accessories</p>
<ol style="list-style-type: lower-alpha;">
<li>HDMI to VGA convertera) v2018.05</li>{| class="wikitable" style="width:800px;" |-| https://github.com/orangepi-xunlong/u-boot-orangepi/tree/'''v2018.05-h618'''|}</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/'''v2021.07-sunxi'''|}</ol></li></ol>
</li></ol>
 
[[File:zero2w-img144.png]]
 
<ol start="2" style="list-style-type: lower-alpha;">
<li>A VGA cable and a Mini HDMI male to HDMI female adapter</li></ol>
 
[[File:zero2w-img145.png]] [[File:zero2w-img146.png]]
 
<ol start="3" style="list-style-type: lower-alpha;">
<li>A monitor or TV that supports VGA interface</li></ol>
 
<!-- -->
<ol start="2" style="list-style-type: decimal;">
<li>HDMI <p>When orangepi-build is run for the first time, it will download the cross-compilation tool chain, u-boot and linux kernel source code. After successfully compiling a linux image, the files and folders that can be seen in orangepi-build are:</p><ol style="list-style-type: lower-alpha;"><li><p>'''build.sh''': Compile startup script</p></li><li><p>'''external''': Contains the configuration files needed to VGA display test 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 as followsalso stored in external.</p></li><li><p>'''kernel''': Store the source code of the linux kernel</p></li><li><p>'''LICENSE''': GPL 2 license file</p></li><li><p>'''README.md''': orangepi-build documentation</p></olli><li><p>'''output''': Store compiled u-boot, linux and other deb packages, compilation logs, and compiled images and other files</p></li><li><p>'''scripts''': Common script for compiling linux images</p></li><li><p>'''toolchains''': Store cross-compilation tool chain</p></li><li><p>'''u-boot''': Store the source code of u-boot</p></li><li><p>'''userpatches''': Store the configuration files needed to compile the script</p></li>[[File{| class="wikitable" style="width:zero2w800px;" |-img313| test@test:~/orangepi-build$ '''ls''' '''build.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.png]]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>
'''When using HDMI to VGA display, the development board and the Android system of the development board do not need to make any settings. You only need the 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.'''<span id="compile-u-boot"></span>
<span id="wi-fi-connection-method"></span>== WICompile u-FI connection method boot ==
# Choose first '''Settings'''Run the build.sh script, remember to add sudo permissions
[[File{| class="wikitable" style="width:zero2w800px;" |-img306| test@test:~/orangepi-build$ '''sudo ./build.png]]sh'''|}
<ol start="2" style="list-style-type: decimal;">
<li>Then select Select '''Network &amp; InternetU-boot package'''and press Enter</li> </oldiv class="figure">
[[File:zero2w-img314img274.png]]
</div></ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then turn on WI-FIselect the model of the development board</li></ol> [[File:zero2w-img315.png]]
[[File:zero2w-img275.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>After turning on WI<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-FI, you can see boot v2018.05 version code that needs to be used by the searched signals under '''Available networks'''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.</olp<p>[[File:zero2w-img316img276.png]]</p></li></ol></li><li><p>If you select the next branch, you will also be prompted to select the memory size, and you do not need to select the current branch.</p><ol start="5" style="list-style-type: decimallower-alpha;"><li>After selecting <p>If the WI-FI development board you want to connect topurchased has a memory size of 1.5GB, please select the password input interface shown below will pop upfirst option.</p></li><li><p>If the development board you purchased has 1GB or 2GB or 4GB memory size, please choose the second option.</olp> <div class="figure"p> [[File:zero2w-img317img277.png]]</p></li></ol> </divli></ol>
<ol start="6" style="list-style-type: decimal;">
<li><p>Then use the keyboard it will start to enter compile u-boot. Some of the password corresponding to information prompted when compiling the WInext branch is as follows:</p><ol style="list-style-type: lower-alpha;"><li>Version of u-boot source code</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Compiling u-boot [ '''v2021.07''' ]|}</ol><ol start="2" style="list-style-type: lower-FI, and then use alpha;"><li>Version of the mouse cross-compilation tool chain</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Compiler version [ '''aarch64-linux-gnu-gcc 11''' ]|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>Path to click the Enter button on the virtual keyboard to compiled u-boot deb package</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Target directory [ '''orangepi-build/output/debs/u-boot''' ]|}</ol><ol start connecting to ="4" style="list-style-type: lower-alpha;"><li>The package name of the WIcompiled u-FI.boot deb package</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] File name [ '''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb''' ]|}</ol><ol start="5" style="list-style-type: lower-alpha;"><div li>Compilation time</li>{| class="figurewikitable" style="width:800px;">|-| [o.k. ] Runtime [File'''1 min''' ]|}</ol><ol start="6" style="list-style-type: lower-alpha;"><li>Repeat the command to compile u-boot. Use the following command without selecting through the graphical interface. You can start compiling u-boot directly.</li>{| class="wikitable" style="width:zero2w800px;" |-img318| [ o.k.png]Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=u-boot''' ]|}</divol></li></ol>
<ol start="7" style="list-style-type: decimal;">
<li>The display after successful WIView the compiled u-FI connection is as shown belowboot deb package</li><{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''ls output/debs/u-boot/ol>'''
[[File'''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb'''|}</ol><ol start="8" style="list-style-type:zero2wdecimal;"><li>When the orangepi-bulid compilation system compiles the u-img319boot source code, it will first synchronize the u-boot source code with the u-boot source code of the github server.png]]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>
<span id="how-to-use-wi-fiSet the IGNORE_UPDATES variable in u'''userpatches/config-hotspot"></span>== How default.conf''' to use WI-FI hotspot ==&quot;yes&quot;
# First, please make sure that the Ethernet port is connected to the network cable and can access the Internet normally.{| class="wikitable" style="width:800px;" |-| # Then select test@test:~/orangepi-build$ '''Settingsvim userpatches/config-default.conf'''
[[File:zero2w-img306.png]].....
IGNORE_UPDATES=&quot;'''<ol start="3" span style="list-style-typecolor: decimal;#FF0000">yes<li/span>Then select '''Network &ampquot; Internet'''</li></ol>
[[File......|}</ol><ol start="9" style="list-style-type:zero2wdecimal;"><li><p>When debugging u-img314boot 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.png]]</li>{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''cd output/debs/u-boot'''
<ol start="4" style="listtest@test:~/orangepi_build/output/debs/u-style-type: decimal;"><li>Then select boot$ '''WIFI hotspotscp \'''</li></ol>
'''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb [[Filemailto:root@192.168.1.xxx:/root root@192.168.1.xxx:/root]'''|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Install the new u-boot deb package just uploaded</li>{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:zero2w~$ '''sudo dpkg -i''' '''linux-u-boot-img320next-orangepizero2w_x.x.x_arm64.png]]deb'''|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>Then run the nand-sata-install script</li>{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''sudo nand-sata-install'''|}</ol><ol start="4" style="list-style-type: lower-alpha;"><li>Then select '''5 Install/Update the bootloader on SD/eMMC'''</li>
[[File:zero2w-img278.png]]</ol><ol start="5" style="list-style-type: decimallower-alpha;"><li>Then open '''Hotspot Enable'''. You can also see After pressing 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 hotspotEnter key, you need to close Hotspot Enable a Warning will pop up first. Then you can modify it)</li></ol>
[[File:zero2w-img321img279.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="67" style="list-style-type: decimallower-alpha;"><li>At this time, Then you can take out your mobile phone. If everything is normal, you can find restart the WIFI hotspot with the same name ('''here AndroidAP_7132''') shown under the '''Hotspot name''' in development board to test whether the picture above in the WIu-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 aboveboot modification has taken effect.</li></ol></li></ol><span id="compile-the-linux-kernel"></span>
[[File:zero2w-img322.png]]== Compile the linux kernel ==
<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 # Run the '''WI-FI Hotspotbuild.sh''' of the development board can be used normally.</li></ol>script, remember to add sudo permissions
[[File:zero2w:{| class="wikitable" style="width:800px;" |-img323| test@test:~/orangepi-build$ '''sudo ./build.png]]sh'''|}
<span idol start="how-to-check-the-ip-address-of-the2" style="list-ethernetstyle-porttype: decimal;"><li>Select '''Kernel package''' and press Enter</spanli>== 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.<div class="figure">
[[File:zero2w-img107.png]] <ol start="2" style="list-style-type: decimal;"><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></ol> <span id="bluetooth-connection-method"></span>== Bluetooth connection method == # Choose first '''Settings''' [[File:zero2w-img306.png]] <ol start="2" style="list-style-type: decimal;"><li>Then select '''Bluetooth'''</li></ol> [[File:zero2w-img327img281.png]]
</div></ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then Open '''Bluetooth Enable'''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-img328.png]]
[[File:zero2w-img282.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then click '''Pair new device'''to start scanning for surrounding Bluetooth devicesselect the model of the development board</li></ol>
[[File:zero2w-img329img275.png]]</ol><ol start="5" style="list-style-type: decimal;"><li>Then select the branch type of the kernel source code</li>
<ol start="5" style="list-style-type: decimal;"><li>:a. The searched Bluetooth devices current branch will be displayed under '''Available devices'''</li></ol>compile the linux5.4 kernel source code
[[File:zero2w-img330:b. The next branch will compile the linux6.png]]1 kernel source code
::[[File:zero2w-img276.png]]
</ol>
<ol start="6" style="list-style-type: decimal;">
<li>Then click on the Bluetooth device If you want choose to connect to start pairing. When display the kernel configuration menu (the following interface pops upsecond option) in step 3), please use the mouse to select the kernel configuration interface opened through '''Pairmake menuconfig'''optionwill 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]]
[[File<ol style="list-style-type: lower-alpha;"><li>If you do not need to modify the kernel configuration options, when running the build.sh script, pass '''KERNEL_CONFIGURE=no''' to temporarily block the pop-up of the kernel configuration interface.</li>{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''sudo ./build.sh KERNEL_CONFIGURE=no'''|}</ol><ol start="2" style="list-style-type:zero2wlower-img331alpha;"><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>
[[File:zero2w-img284.png]]
</ol>
</ol>
<ol start="7" style="list-style-type: decimal;">
<li>What is tested here is <p>Part of the Bluetooth configuration process between information prompted when compiling the development board and next branch kernel source code is explained as follows:</p><ol style="list-style-type: lower-alpha;"><li>Version of the Android phonelinux kernel source code</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Compiling current kernel [ '''6. At this time, the following confirmation interface will pop up on the phone1. Click the pairing button on the phone to 31''' ]|}</ol><ol start ="2" style="list-style-type: lower-alpha;"><li>The version of the pairing processcross-compilation tool chain used</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Compiler version [ '''aarch64-linux-gnu-gcc 11''' ]|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>The default configuration file used by the kernel and the path where it is stored are as follows</olli>{| class="wikitable" style="width:800px;" |-| [o.k. ] Using kernel config file [File:zero2w'''orangepi-build/external/config/kernel/linux-6.1-sun50iw9-img332next.png]config''' ]|}</ol><ol start="84" style="list-style-type: decimallower-alpha;"><li>After pairing is completed, open The path to the kernel-related deb package generated by compilation</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Target directory [ '''Paired devicesoutput/debs/''' and you will see ]|}</ol><ol start="5" style="list-style-type: lower-alpha;"><li>The package name of the paired Bluetooth devices.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>[[File{| class="wikitable" style="width:zero2w800px;" |-img333| [ o.k.png]Runtime [ '''10 min''' ]|}</ol><ol start="97" style="list-style-type: decimallower-alpha;"><li>At this timeFinally, you can use the Bluetooth of your mobile phone to send a picture compilation command to repeatedly compile the development boardlast selected kernel will be displayed. After sending, you can see Use the following confirmation command without selecting through the graphical interface in the Android system of the development board, and then click you can directly start compiling the kernel source code.</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Repeat Build Options [ '''Acceptsudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=kernel KERNEL_CONFIGURE=no''' to ]|}</ol></li></ol><ol start receiving ="8" style="list-style-type: decimal;"><li><p>View the pictures sent 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 mobile phonekernel</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></olli>{| class="wikitable" style="width:800px;" |-| [[Filetest@test:zero2w~/orangepi-build$ '''ls output/debs/linux-img334.png]]*'''
<ol start="10" style="listoutput/debs/linux-dtb-stylenext-type: decimal;"><li>Pictures received by the Bluetooth system of the development board Android system can be viewed in '''Received files'''sun50iw9_x.</li></ol>x.x_arm64.deb
[[File:zero2woutput/debs/linux-img335headers-next-sun50iw9_x.x.x_arm64.png]]deb
<span id="howoutput/debs/linux-toimage-setnext-usb0-to-host-mode-1"sun50iw9_x.x.x_arm64.deb|}</ol></li></spanol><ol start="9" style= How "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 set USB0 modify the linux kernel source code, you first need to HOST mode ==turn off the update function of the source code ('''it needs to be completely compiled once This function can only be turned off after obtaining the Linux kernel source code, otherwise it will prompt that the source code of the Linux kernel cannot be found'''), otherwise the modifications will be restored. The method is as follows:</li>
As shown Set the IGNORE_UPDATES variable in the figure below, there are two Type'''userpatches/config-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 USB2default.0 HOST interfaces. The difference between USB0 and USB1 is that in addition to being set conf''' to HOST mode, USB0 can also be set to Device mode, while USB1 only has HOST mode.&quot;yes&quot;
[[File{| class="wikitable" style="width:zero2w800px;" |-img160.png]]| USB0 of the Android12 TV system released by Orange Pi is set to Device mode by test@test:~/orangepi-build$ '''vim userpatches/config-default, so when there is no need to use USB0 Device mode (ADB function needs to ensure that USB0 is in Device mode), it is recommended to use USB0 for power supply, so that USB1 can be directly used to connect USB devices If you want to use USB0 to connect USB devices, you need to set USB0 to HOST mode. The method is as follows:conf'''
IGNORE_UPDATES=&quot;'''<span style="color:#FF0000">yes</span>'''&quot;
|}
</ol>
<ol start="10" style="list-style-type: decimal;">
<li><p>If the kernel is modified, you can use the following method to update the kernel and kernel module of the development board Linux system</p>
<ol style="list-style-type: lower-alpha;">
<li>Run Upload the following command compiled deb package of the Linux kernel to set USB0 to HOST mode:the Linux system of the development board</li><{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''cd output/ol>debs'''
apollotest@test:~/orangepi-p2:build/output/ # debs$ '''cat /sys/devices/platform/soc@3000000/soc@3000000scp \:usbc0@0/usb_host''' host_chose finished! apollo-p2:/ #
'''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>Run Install the following command to switch back to Device modedeb 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: lower-alpha;"><li>Then restart the development board and check whether the kernel-related modifications have taken effect.</li>{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''sudo''' '''reboot'''|}</ol></li></ol><span id="compile-rootfs"></span>
apollo-p2:/ # '''cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_device'''== Compile rootfs ==
device_chose finished!# Run the build.sh script, remember to add sudo permissions
apollo::{| class="wikitable" style="width:800px;" |-p2| test@test:~/orangepi-build$ '''sudo ./ #build.sh'''|}
<ol start="32" style="list-style-type: lower-alphadecimal;"><li>The command to view the current mode of USB0 isSelect '''Rootfs and all deb packages''' and press Enter</li></ol>
apollo-p2:/ # '''cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/otg_role'''<div class="figure">
usb_host[[File:zero2w-img285.png]]
<span id/div></ol><ol start="3" style="how-tolist-usestyle-usb-cameratype: decimal;"><li>Then select the model of the development board</spanli>== How to use USB camera ==
# First insert [[File:zero2w-img275.png]]</ol><ol start="4" style="list-style-type: decimal;"><li><p>Then select the USB (UVC protocol) camera into branch type of the USB interface kernel source code. Different versions of the development boardkernel source code maintain different rootfs types.</p><ol style="list-style-type: lower-alpha;"># If <li><p>In the USB camera is recognized normallycurrent branch, you can see three options: debian11, ubuntu20.04, and ubuntu22.04.</p></li><li><p>In the corresponding video device node will be generated under next branch, you can see three options: debian11, debian12, and ubuntu22.04.</p></devli>
console[[File:zero2w-img276.png]]</ # '''ls ol></devli></video0'''ol><ol start="5" style="list-style-type: decimal;"><li>Then select the type of rootfs</li>
[[File:zero2w-img286.png]]</dev/video0ol><ol start="36" style="list-style-type: decimal;"><li><p>Then make sure that select 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 &quottype of image</p><ol style="list-style-type: lower-alpha;"><li><p>'''How to use ADBImage with console interface (server)'''&quot;Represents the image of the server version, which is relatively small in size.</p></li><li><p>Download the USB camera test APP from the '''official toolImage with desktop environment''' on the development board information download pageRepresents an image with a desktop, which is relatively large in size.</p></li></ol>
<div class="figure">
[[File:zero2w-img336.png]] </div><div class="figure"> [[File:zero2w-img337.png]] </div><ol start="5" style="list-style-type: decimal;"><li>Then use the adb command to install the USB camera test APP into the Android system. Of course, you can also use a USB disk copy to install it.</li></ol> test@test:~$ '''adb install usbcamera.apk''' <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></ol> [[File:zero2w-img338img287.png]]
</div></ol>
</li></ol>
<ol start="7" style="list-style-type: decimal;">
<li>Then double-click to open If you are compiling the server version of the USB camera APP and image, you can see also choose to compile the output video of Standard version or the USB cameraMinimal version.</li></ol> <span id="android-system-rootThe Minimal version will have much less pre-description"></span>== Android system ROOT description == '''The Android system released by Orange Pi has been ROOT and can be tested using installed software than the following method.Standard version (''' # Download from please do not choose the '''official tool''' on the development board data download page '''rootcheckMinimal version without special needs, because many things are not pre-installed by default.apkSome functions may not be available''')</li>
<div class="figure">
[[File:zero2w-img336img288.png]]
</div>
<div class/ol><ol start="figure8"style="list-style-type: decimal;"><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.</li>
[[File:zero2w-img339img289.png]]
</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 itimg290.</p></li></ol>png]]
test@test:~$ '''adb install rootcheckYou can then select additional packages that need to be installed. Please press the Enter key here to skip directly.apk'''
[[File:zero2w-img291.png]]</ol><ol start="49" style="list-style-type: decimal;"><li>After installation, you can see <p>Then the startup icon compilation of rootfs will start. Some of the ROOT test tool on 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 Android desktopcompiled 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> :a) '''bullseye''' represents the type of Linux distribution of rootfs :b) '''xfce''' indicates that the rootfs is the desktop version, and if it is cli, it indicates the server version.
[[File:zero2w-img340.png]]c) '''arm64''' represents the architecture type of rootfs
:d) '''25250ec7002de9e81a41de169f1f89721''' is the MD5 hash value generated by the package names of all software packages installed by rootfs. As long as the list of software packages installed by rootfs is not modified, this value will not change. The compilation script will use this MD5 hash value. Determine whether rootfs needs to be recompiled</ol><ol start="52" style="list-style-type: decimallower-alpha;"><li>The display interface after opening the '''ROOT test toolbullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4.list''' for Lists the first time is as shown belowpackage names of all packages installed by rootfs</li><{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''ls external/cache/rootfs/ol>'''
[[File:zero2wbullseye-img341xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.png]]lz4
<ol start="6" style="listbullseye-stylexfce-type: decimal;"><li>Then you can click '''CHECK NOW''' to start checking the ROOT status of the Android systemarm64. After the check is completed, the display is as follows5250ec7002de9e81a41de169f1f89721. You can see that the Android system has obtained ROOT permissionstar.</li></ol>lz4.current
[[Filebullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4.list|}</ol></li></ol><ol start="11" style="list-style-type:zero2w-img342decimal;"><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>
<span id="howcompile-tolinux-use-miracastreceiver-to-cast-the-mobile-phone-screen-to-the-development-boardimage"></span>== How to use MiracastReceiver to cast the mobile phone screen to the development board ==
<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.'''</p></li><li><p>Then open 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 follows</p><div class="figure">Compile linux image ==
[[File:zero2w-img344# Run the '''build.png]]sh''' script, remember to add sudo permissions
</div></li><li><p>Then find the screen mirroring function in the phone settings. Here we take '''Xiaomi 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>::{| class="wikitable" style="width:800px;" <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>[[Filetest@test:zero2w~/orangepi-img346.png]]</p></li><li><p>Then the selection box shown in the figure below will pop up in the build$ '''MiracastReceiver''' application interface of the development boardsudo ./build. Here we can select sh'''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 idol start="method2" style="list-ofstyle-turning-on-and-off-the-machine-through-buttons-or-infrared-remote-controltype: decimal;"><li>Select '''Full OS image for flashing''' and press Enter</spanli>== 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.<div class="figure">
[[File:zero2w-img107img292.png]]
The location </div></ol><ol start="3" style="list-style-type: decimal;"><li>Then select the model of the power button on the 24pin expansion development board is as shown in the figure below:</li>
[[File:zero2w-img269img275.png]]</ol><ol start="4" 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>
The location [[File:zero2w-img276.png]]</ol></li></ol><ol start="5" style="list-style-type: decimal;"><li><p>If you select the next branch, you will also be prompted to select the memory size, and you do not need to select the current branch.</p><ol style="list-style-type: lower-alpha;"><li><p>If the development board you purchased has a memory size of 1.5GB, please select the infrared remote control power button is as followsfirst 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-img349img286.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>
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 <div class="figure below, and then select '''OK''' to shut down the Android system.">
[[File:zero2w-img350img287.png]]
After shutting down</div></ol></li></ol><ol start="8" style="list-style-type: decimal;"><li>If you are compiling the server version of the image, press and hold you can also choose to compile the power button Standard version or the power button on Minimal version. The Minimal version will have much less pre-installed software than the infrared remote control again to turn it onStandard version ('''please do not choose the Minimal version without special needs, because many things are not pre-installed by default.Some functions may not be available''')</li>
<span iddiv class="pin-interface-gpio-uart-spi-testfigure"></span>== 40pin interface GPIO, UART, SPI test ==
'''Note[[File: The pin header on the 40pin interface is not soldered by default, and you need to solder it yourself before it can be usedzero2w-img288.'''png]]
<span id/div></ol><ol start="pin-gpio-port9" style="list-teststyle-methodtype: decimal;"><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.</spanli>=== 40pin GPIO port test method ===
# First open wiringOP APP on the desktop[[File:zero2w-img289.png]]
[[File:zero2w-img351img290.png]]
<ol start="2" style="list-style-type: decimal;"><li>Then click You can then select additional packages that need to be installed. Please press the '''GPIO_TEST''' button Enter key here to open the GPIO test interface</li></ol>skip directly.
[[File:zero2w-img352img291.png]]</ol><ol start="310" style="list-style-type: decimal;"><li>The GPIO test interface is as shown in Then the compilation of the figure belowlinux image will begin. The two rows general process of '''CheckBox''' buttons on the left have a one-to-one correspondence with the 40pin pins. When the '''CheckBox''' button compilation is checked, the corresponding GPIO pin will be set to '''OUT''' mode and the pin level is set to high level; when unchecked, the GPIO pin level will be set to low level; when the GPIO is clicked When you click the '''GPIO READALL''' button, you can get information such as wPi number, GPIO mode, pin level, etc.; when you click the'''BLINK ALL GPIO''' button, all GPIO ports will cycle through outputting high and low levels. This function can be used to test all the 40pin pins. GPIO port.follows</li></ol>
[[File:zero2w-img353:a. Initialize the compilation environment of Ubuntu PC and install the software packages required for the compilation process.png]]
<ol start="4" style="list-style-type: decimal;"><li>Then click :b. Download the '''GPIO READALL''' buttonsource code of u-boot and linux kernel (if already cached, and only update the output information is as shown below:</li></ol>code)
<div class="figure">::c. Compile u-boot source code and generate u-boot deb package
[[File:zero2w:d. Compile linux source code and generate linux-img354.png]]related deb packages
</div><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 '''CheckBox''' button corresponding to pin 12. When the button is selected, pin 12 will be set to high level:e. After setting, you can use a multimeter to measure Make the value deb package of the voltage of the pin. If it is '''3.3v''', it means the setting High level success.</li></ol>linux firmware
[[File:zero2w:f. Make the deb package of orangepi-img355.png]]config tool
<ol start="6" style="list::g. Create a deb package with board-style-type: decimal;"><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>support
[[File:zero2w:h. If you compile the desktop version image, you will also create a desktop-img356related deb package.png]]
<ol start="7" style="list-style-type: decimal;"><li>Click the '''CheckBox''' button in the picture below again to uncheck it, and pin 12 will be set to low level:i. Check whether rootfs has been cached. After settingIf not, you can use a multimeter to measure the voltage value of the pinre-create rootfs. If it is '''0v'''has been cached, decompress it directly and use it means the low level setting is successful.</li></ol>
[[File:zero2w-img357:j.png]]Install the deb package generated previously into rootfs
<ol start="8" style="list-style-type: decimal;"><li>Then click the '''GPIO READALL''' button :k. Make some specific settings for different development boards and you can see that the current pin 12 mode is OUT and the pin level is low leveldifferent types of images, such as pre-installing additional software packages, modifying system configurations, etc.</li></ol>
[[File:zero2w-img358:l. Then create the image file and format the partition. The default type is ext4.png]]
<span id="pin-uart-test-method"></span>=== 40pin UART test method ===::m. Then copy the configured rootfs to the mirror partition.
# 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::n.Then update initramfs
::o. Finally, write the bin file of u-boot into the image through the dd command.</ol><ol start="11" style="list-style-type: decimal;"><li><p>After compiling the image, the following message will be displayed</p><ol style="list-style-type: lower-alpha;"><li>The storage path of the compiled image</li>{| class="wikitable" style="width:800px;"
|-
| '''GPIO序号'''| [ o.k. ] Done building [ '''GPIOoutput/images/orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop/orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop.img''']| '''功能'''}| '''引脚'''|| '''引脚'''</ol>| '''功能'''<ol start="2" style="list-style-type: lower-alpha;">| '''GPIO'''<li>Compilation time</li>{| '''GPIO序号'''class="wikitable" style="width:800px;"
|-
| style="text-align: left;"|| style="text-align: left;"|| '''3[ o.k.3V] Runtime [ 19 min ]'''| '''1'''}|</ol>| '''2'''| '''5V'''| <ol start="3" style="textlist-style-aligntype: leftlower-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 interface.</li>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| [ o.k. ] Repeat Build Options [ '''264sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=image RELEASE=bullseye BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_CONFIGURE=yes''']| }</ol></li></ol><span id="instructions-for-using-the-orange-pi-os-arch-system"></span> = '''PI8Instructions for using the Orange Pi OS Arch system'''= | '''TWI1<span id="orange-pi-os-arch-system-function-adaptation-SDA'''status"></span>== Orange Pi OS Arch system function adaptation status == {| '''3'''class="wikitable" style="width:800px;text-align: center;"|-| '''4Motherboard functions'''| '''5VOPi OS Arch'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''263HDMI video'''| '''PI7OK'''| '''TWI1-SCL'''| '''5'''|| '''6'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''269HDMI Audio'''| '''PI13'''| '''PWM3'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224OK'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''9'''|| '''10'''| '''UART0_RX'''| '''PH1Type-C USB2.0 x 2'''| '''225OK'''
|-
| '''226TF Card Startup'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''12'''| style="text-align: left;"|| '''PI1'''| '''257OK'''
|-
| '''227WIFI'''| '''PH3OK'''| '''UART5_RX'''-| '''13Bluetooth'''|| '''14'OK''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''261LED Light'''| '''PI5'''| '''UART2_TX'''| '''15'''|| '''16'''| '''PWM4'''| '''PI14'''| '''270OK'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''17'''|| '''18'''| style="text-align: left;"|| '''PH440pin GPIO'''| '''228OK'''
|-
| '''23140pin I2C'''| '''PH7OK'''| '''SPI1_MOSI'''| '''19'''|| '''20'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''23240pin SPI'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''UART2_RX'''| '''PI6'''| '''262OK'''
|-
| '''23040pin UART'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229OK'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''25'''|| '''26'''| '''SPI1_CS1'''| '''PH940pin PWM'''| '''233OK'''
|-
| '''266Temperature Sensor'''| '''PI10'''| '''TWI2-SDA'''| '''27'''|| '''28'''| '''TWI2-SCL'''| '''PI9'''| '''265OK'''
|-
| '''256Hardware watchdog'''| '''PI0OK'''| style="text-align: left;"|| '''29'''|| '''30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''271Mali GPU'''| '''PI15'''| <span style="text-aligncolor: left;#FF0000"|| '''31'''|| '''32'''| '''PWM1'''| '''PI11'''| '''267>NO</span>'''
|-
| '''268Video codec'''| '''PI12'''| '''PWM2'''| '''33<span style="color:#FF0000">NO</span>'''|}| '''34'''| '''GND'''{| styleclass="text-align: left;wikitable"|| style="width:800px;text-align: leftcenter;"|
|-
| '''25824pin expansion board function'''| '''PI2OPi OS Arch'''| style="text-align: left;"| '''100M network port'''| '''OK'''|-| '''100M Ethernet port light'''| '''OK'''|-| '''USB2.0 HOST x 2'''| '''35OK'''|-| '''Infrared reception'''| '''36OK'''| style="text-align: left;"| '''Headphone audio playback'''|'''OK'''|-| '''PC12On/off button'''| '''76OK'''
|-
| '''272LRADC'''| '''PI16'''| style="text-align: left;"|| '''37'''|| '''38'''| style="text-align: left;"|| '''PI4Custom buttons x 2'''| '''260OK'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''GNDTV-OUT'''| '''39'''|| '''40'''| <span style="text-aligncolor: left;#FF0000"|| '''PI3'''| '''259>NO</span>'''
|}
<ol startspan id="2" style="listorange-pi-os-arch-system-user-styleguide-type: decimal;instructions"><li>The device node corresponding to uart2 is '''/dev/ttyAS2''', and the device node corresponding to uart5 is'''/dev/ttyAS5'''</li></olspan>
apollo-p2:/ # ls /dev/ttyAS*== Orange Pi OS Arch System User Guide Instructions ==
/dev/ttyAS0 /dev/ttyAS1 '''/dev/ttyAS2 /dev/ttyAS5'''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.
<ol start="3" style="list-style-typeWhen 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). The setup steps of the user wizard are as follows: decimal;"><li>First open wiringOP APP on the desktop</li></ol>
[[File<ol style="list-style-type:zero2wlower-img351alpha;"><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.png]]</p><div class="figure">
<ol start="4" style="list[[File:zero2w-style-type: decimal;"><li>Then click the '''UART_TEST'''button to open the UART test interface</li></ol>img293.png]]
</div></li><li><p>First you need to select the language you want</p><div class="figure"> [[File:zero2w-img359img294.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"> [[File:zero2w-img295.png]] </div></li><li><p>Then select the area</p><div class="figure">
<ol start="5" style="list[[File:zero2w-style-type: decimal;"><li>The serial port test interface of wiringOP is as shown in the figure below</li></ol>img296.png]]
[[File:zero2w-img360.png]]</div></li><li><p>Then select the keyboard model</p><div class="figure">
<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-img361img297.png]]</p></li><li><p>Enter the baud rate you want to set in the edit box, and then click the '''OPEN''' button to open the uart node. After the opening is successful, the '''OPEN''' button becomes unselectable, and the '''CLOSE''' button and '''SEND''' button become selectable.</p></li></ol>
[[File:zero2w-img362.png]]</div></li><li><p>Then create a new username and set a password</p><div class="figure">
<ol start="8" style="list[[File:zero2w-style-type: decimal;"><li><p>Then use Dupont wire to short the rx and tx pins of uart</p></li><li><p>Then you can enter a paragraph of characters in the send edit box below and click the '''SEND''' button to start sendingimg298.</p></li></ol>png]]
[[File:zero2w-img363.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">
<ol start="10" style="list[[File:zero2w-style-type: decimal;"><li>If everything is normal, the received string will be displayed in the receiving box</li></ol>img299.png]]
[[File:zero2w-img364.png]]</div></li><li><p>Then wait for the installation to complete</p><div class="figure">
<span id="pin[[File:zero2w-spi-test-method"></span>=== 40pin SPI test method ===img300.png]]
# As can be seen from </div></li><li><p>After the table belowinstallation is complete, you need to click the spi available for '''Finish''' button to restart the 40pin interface is spi1, and there are two chip select pins cs0 and cs1system.</p><div class="figure">
{| class="wikitable"|[[File:zero2w-img301.png]]| '''GPIO serial number'''| '''GPIO'''</div></li>| <li><p>The Orange Pi Hello program will automatically start after restarting. At this time, you need to remove the check '''Functionmark 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>| '''pin'''<div class="figure">|| '''pin'''[[File:zero2w-img302.png]]| '''Function'''| '''GPIO'''</div>| '''GPIO <p>At this point, you can use the newly created username and password to log in to the OPi OS system through the serial number'''port or ssh.</p></li></ol>|-| style<span id="texthow-align: left;to-set-dt-overlays"|></span>| style="text= How to set DT overlays == The multiplexing functions such as I2C/SPI/UART/PWM in the 40-align: left;"|| ''pin development board are turned off by default in the kernel'3s dts, and the corresponding DT overlays need to be manually turned on before they can be used.3V'''| '''1'''|The method to open DT overlays in OPi OS Arch system is as follows: | # First open the '''2/boot/extlinux/extlinux.conf'''configuration file| '''5V'''::{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| [orangepi@orangepi-pc ~]$ '''264sudo vim /boot/extlinux/extlinux.conf'''| '''PI8'''} | '''TWI1<ol start="2" style="list-style-SDA'''type: decimal;">| <li>Then open the corresponding configuration by adding '''3FDTOVERLAYS'''|| '''4/dtbs/allwinner/overlay/xxx.dtbo'''| in '''5V/boot/extlinux/extlinux.conf'''</li> {| styleclass="text-align: left;wikitable"|| style="textbackground-aligncolor: left#ffffdc;width:800px;"|
|-
| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|| <big>'''6Note that xxx.dtbo in FDTOVERLAYS /dtbs/allwinner/overlay/xxx.dtbo needs to be replaced with the specific dtbo configuration, please do not copy it.'''</big>| '''GND'''}{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| [orangepi@orangepi-pc ~]$ '''269sudo vim /boot/extlinux/extlinux.conf'''| '''PI13'''| '''PWM3'''LABEL Orange Pi KERNEL /Image FDT /dtbs/allwinner/sun50i-h616-orangepi-zero2w.dtb | '''7FDTOVERLAYS /dtbs/allwinner/overlay/<span style="color:#FF0000">xxx.dtbo</span>'''#Configuration that needs to be added|}| '''8'''</ol>| '''UART0_TX'''<ol start="3" style="list-style-type: decimal;">| '''PH0'''<li><p>The storage path of xxx.dtbo in the OPi OS Arch image is as follows. Please note that not all dtbo under this path can be used.</p>{| '''224'''class="wikitable" style="width:800px;"
|-
| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| <p>'''9/boot/dtbs/allwinner/overlay/'''</p>|}| '''10'''</li>| '''UART0_RX'''<li><p>The DT overlays configuration that can be used by the development board is as follows</p></li>| '''PH1'''{| '''225'''class="wikitable" style="width:800px;text-align: center;"
|-
| '''226Functions on the development board'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''12'''| style="text-align: left;"|| '''PI1'''| '''257Corresponding DT overlays configuration'''
|-
| '''22740pin - i2c0'''| '''PH3'''| '''UART5_RX'''| '''13'''|| '''14''sun50i-h616-pi-i2c0.dtbo'| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''26140pin - i2c1'''| '''PI5'''| '''UART2_TX'''| '''15'''|| '''16'''| '''PWM4'''| '''PI14'''| '''270sun50i-h616-pi-i2c1.dtbo'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''3.3V40pin - i2c2'''| '''17'''|| '''18'''| style="textsun50i-h616-pi-align: left;"|| '''PH4'''| '''228i2c2.dtbo'''
|-
| '''23140pin - uart2'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|| '''20''sun50i-h616-pi-uart2.dtbo'| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''23240pin - uart3'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''UART2_RX'''| '''PI6'''| '''262sun50i-h616-pi-uart3.dtbo'''
|-
| '''23040pin - uart4'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229sun50i-h616-pi-uart4.dtbo'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''GND40pin - uart5'''| '''25'''|| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233sun50i-h616-ph-uart5.dtbo'''
|-
| '''26640pin - pwm1'''| '''PI10'''| '''TWI2sun50i-h616-SDA'''| '''27'''|| '''28'''| '''TWI2pi-SCL'''| '''PI9'''| '''265pwm1.dtbo'''
|-
| '''25640pin - pwm2'''| '''PI0sun50i-h616-pi-pwm2.dtbo'''| style="text-align: left;"|'''40pin - pwm3'''| '''29sun50i-h616-pi-pwm3.dtbo'''|-| '''3040pin - pwm4'''| '''GNDsun50i-h616-pi-pwm4.dtbo'''| style="text-align: left;"|'''40pin - spi1 cs0'''| style="text'''sun50i-align: left;"h616-spi1-cs0-spidev.dtbo'''|-| '''40pin - spi1 cs1'''| '''sun50i-h616-spi1-cs1-spidev.dtbo'''|-| '''40pin - spi1 cs0 cs1'''| '''sun50i-h616-spi1-cs0-cs1-spidev.dtbo'''
|-
| '''271设Set USB0 to Host mode'''| '''PI15'''| style="textsun50i-h616-usb0-align: left;"|| '''31'''|| '''32'''| '''PWM1'''| '''PI11'''| '''267host.dtbo'''
|-
| '''268Turn off the green LED light'''| '''PI12'''| '''PWM2'''| '''33'''|| '''34''sun50i-h616-zero2w-disable-led.dtbo'| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''258How to close the UART0 debugging serial port'''| '''PI2'''| style="textsun50i-h616-align: left;"|| '''35'''|| '''36'''| style="textdisable-align: left;"|| '''PC12'''| '''76uart0.dtbo'''
|}
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>If you need to open multiple configurations at the same time, just add the paths of multiple configurations directly after '''FDTOVERLAYS.''' For example, the configuration of opening i2c1 and uart5 at the same time is as follows</li>
{| class="wikitable" style="width:800px;"
|-
|
[orangepi@orangepi-pc ~]$ '''sudo vim /boot/extlinux/extlinux.conf'''
<ol start="2" style="list-style-type: decimal;"><li>The device node corresponding to SPI1 CS0 is '''/dev/spidev1.0''', and the device node corresponding to SPI1 CS1 is '''/dev/spidev1.1'''</li></ol> apollo-p2:/ # '''ls /dev/spidev1.*'''LABEL Orange Pi
'''KERNEL /dev/spidev1.0 /dev/spidev1.1'''Image
<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.<FDT /li><dtbs/ol> '''It doesn't matter if there is no w25qxx module, because there is a SPIFlash on the development board connected to SPI0, and the configuration of SPI0 is also turned on by default in Android, so we can also directly use the onboard SPIFlash for testing.''' <ol start="4" style="list-style-type: decimal;"><li>Then open wiringOP APP on the desktop<allwinner/li></ol> [[File:zero2wsun50i-img351.png]] <ol start="5" style="listh616-styleorangepi-type: decimal;"><li>Then click the '''SPI_TEST''' button to open the SPI test interface</li></ol> [[File:zero2w-img365.png]]dtb
'''FDTOVERLAYS <span style="color:#FF0000">/dtbs/allwinner/overlay/sun50i-h616-pi-i2c1.dtbo /dtbs/allwinner/overlay/sun50i-h616-ph-uart5.dtbo</span>'''
|}
</ol>
<ol start="6" style="list-style-type: decimal;">
<li><p>Then select the spi device node in the upper left corner. If After setting, you test need to restart the onboard SPIFlash directly, just keep system for the default '''/dev/spidev0configuration to take effect.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 li>{| class="wikitable" style="width:800px;" |-| [orangepi@orangepi-pc ~]$ '''/dev/spidev1.1sudo reboot'''|}</pol><div classspan id="figurehow-to-install-software"></span>
[[File:zero2w-img366.png]]== How to install software ==
</div></li><li><p>Then click You can use the '''OPEN''' button pacman package management tool to initialize install software that is not available in OPi OS. For example, the SPI</p></li></ol>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.
{| class="wikitable" style="width:800px;" |-| [[File:zero2worangepi@orangepi-img367.png]pc ~]$ '''sudo pacman -Syy vim'''|}
<ol startspan id="8" style="listandroid-12-tv-system-styleusage-type: decimal;instructions"><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></olspan>
[[File:zero2w-img368.png]]= '''Android 12 TV system usage instructions''' =
<ol startspan id="9" style="listsupported-styleandroid-type: decimal;versions"><li>Finally, the APP will display the read ID information of the onboard SPI Flash.</li></olspan>== Supported Android versions ==
[[File{| class="wikitable" style="width:zero2w800px;text-img369align: center;"|-| Android Version| Kernel version|-| '''Android 12 TV Version'''| '''linux5.png]]4'''|}
<ol startspan id="10" style="listandroid-12-tv-function-styleadaptation-type: decimal;status"><li>If the w25qxx module connected to 40pin SPI1 is read, the ID information of the onboard SPI Flash is also similar.</li></olspan>== Android 12 TV function adaptation status ==
<span id{| class="wikitable" style="pinwidth:800px;text-i2c-test-methodalign: center;"></span>=== 40pin I2C test method ===|-| '''Motherboard functions'''# As can be seen from the table below, the | '''Android12 TV system has i2c1 and i2c2 turned on by default.'''|-| '''HDMI video'''{| class="wikitable"'''OK'''
|-
| '''GPIO serial numberHDMI Audio'''| '''GPIO'''| '''Function'''| '''pin'''|| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO serial numberOK'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''3Type-C USB2.3V'''| '''1'''|| '''0 x 2'''| '''5VOK'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''264TF card startup'''| '''PI8OK'''| '''TWI1-SDA'''| '''3'''|| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''263WIFI'''| '''PI7OK'''| '''TWI1-SCL'''| '''5'''|| '''6'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''269Bluetooth'''| '''PI13'''| '''PWM3'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224OK'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''GNDUSB Camera'''| '''9OK'''|-| '''10'''| '''UART0_RX'''| '''PH1LED Light'''| '''225OK'''
|-
| '''22640pin GPIO'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''12'''| style="text-align: left;"|| '''PI1'''| '''257OK'''
|-
| '''22740pin I2C'''| '''PH3OK'''| '''UART5_RX'''| '''13'''|| '''14'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''26140pin SPI1'''| '''PI5'''| '''UART2_TX'''| '''15'''|| '''16'''| '''PWM4'''| '''PI14'''| '''270OK'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''17'''|| '''18'''| style="text-align: left;"|| '''PH440pin UART'''| '''228OK'''
|-
| '''23140pin PWM'''| '''PH7OK'''| '''SPI1_MOSI'''| '''19'''|| '''20'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''232Temperature Sensor'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''UART2_RX'''| '''PI6'''| '''262OK'''
|-
| '''230Hardware watchdog'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229OK'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''25'''|| '''26'''| '''SPI1_CS1'''| '''PH9Mali GPU'''| '''233OK'''
|-
| '''266Video codec'''| '''PI10OK'''| '''TWI2-SDA'''}| '''27'''|| '''28'''{| '''TWI2class="wikitable" style="width:800px;text-SCL'''| '''PI9'''| '''265'''align: center;"
|-
| '''25624pin Expansion board function'''| '''PI0Android12 TV'''| style="text-align: left;"|| '''29'''|| '''30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''271100M network port'''| '''PI15OK'''| style="text-align: left;"|'''100M Ethernet port light'''| '''31OK'''|-| '''32USB2.0 HOST x 2'''| '''PWM1OK'''|-| '''PI11Infrared reception'''| '''267OK'''
|-
| '''268Headphone audio playback'''| '''PI12OK'''| '''PWM2'''| '''33'''|| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''258On/off button'''| '''PI2'''| style="text-align: left;"|| '''35'''|| '''36'''| style="text-align: left;"|| '''PC12'''| '''76OK'''
|-
| '''272LRADC'''| '''PI16'''| style="text-align: left;"|| '''37'''|| '''38'''| style="text-align: left;"|| '''PI4Custom buttons x 2'''| '''260OK, The default setting is the volume up and down keys.'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''39'''|| '''40'''| style="textTV-align: left;"|| '''PI3OUT'''| '''259OK'''
|}
<ol startspan id="2onboard-led-light-display-instructions"></span>== Onboard LED light display instructions == {| class="wikitable" style="listwidth:800px;text-style-typealign: decimalcenter;"><li>The device node corresponding to i2c1 is |-|| '''green light'''| '''red light'''|-| '''u-boot startup phase'''| '''Off'''| '''on'''/dev/i2c|-1| ''', and Kernel boot to enter the device node corresponding to i2c2 is system'''| '''on'''| '''/dev/i2c-2on'''</li></ol>|}
apollo<span id="how-p2:to-return-to-the-previous-interface-in-android"></ # '''ls /dev/i2c-*'''span>== How to return to the previous interface in Android ==
'''/dev/i2cWe 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-1 /dev/i2c-2''' /dev/i2c-5clicking the mouse, and the keyboard cannot return.
<ol start="3" style="list-style-type: decimal;"><li>First open wiringOP APP 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 desktop</li></ol>remote control to return to the previous menu. The location of the return key is as shown below. Shown:
[[File:zero2w-img351img303.png]]
<ol startspan id="4" style="listhow-to-styleuse-type: decimal;adb"><li/span>Then click the '''I2C_TEST''' button == How to open the i2c test interface</li></ol>use ADB ==
[[File:zero2w<span id="use-img370.png]]network-connection-adb-debugging"></span>=== Use network connection adb debugging ===
<ol start{| class="5wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;">|-| <libig>The i2c test '''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 wiringOP is shown in the figure belowdevelopment board. Next To be used.'''</li></olbig>|}
[[File:zero2w-img371# Make sure the '''service.png]]adb.tcp.port''' of the Android system is set to 5555 port number
<ol start::{| class="6wikitable" style="list-style-typewidth: decimal800px;"><li>Then click the device node selection box in the upper left corner to select the i2c you want to test<|-| apollo-p2:/li></ol># '''getprop | grep &quot;adb.tcp&quot;'''
[[File:zero2w-img372service.adb.tcp.pngport]: [5555]|}
<ol start="72" style="list-style-type: decimal;"><li>Then connect an i2c device If '''service.adb.tcp.port''' is not set, you can use the following command in the serial port to set the 40pin i2c pin. Here we take port number of the ds1307 rtc module as an example.network adb</li><{| class="wikitable" style="width:800px;" |-| apollo-p2:/ol># '''setprop service.adb.tcp.port 5555'''
[[Fileapollo-p2:/ # '''stop adbd''' apollo-p2:/ # '''start adbd'''|}</ol><ol start="3" style="list-style-type: decimal;"><li>Install adb tool on Ubuntu PC</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''sudo apt-get update''' test@test:~$ '''sudo apt-get install -y adb'''|}</ol><ol start="4" style="list-style-type:zero2wdecimal;"><li>Then connect network adb on Ubuntu PC</li>{| class="wikitable" style="width:800px;" |-img178| test@test:~$ '''adb connect 192.png]]168.1.xxx:5555''' '''(Need to be modified to the IP address of the development board)''' <p>* daemon not running; starting now at tcp:5037</p> <p>* daemon started successfully</p> connected to 192.168.1.xxx:5555
<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-img379.png]]</p></li></ol>
<span id="pin-pwm-test"></span>=== 40pin PWM @test ===:~$ '''adb devices'''
# As can be seen from the table below, the available pwm are pwm1, pwm2, pwm3 and pwm4.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'''}| '''Function'''</ol>| '''pin'''<span id="use-data-cable-to-connect-adb-debugging"></span>|| '''pin'''=== Use data cable to connect adb debugging ===| '''Function'''| '''GPIO'# 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.| '''GPIO serial number'''|::[[File:zero2w-img304.png]] [[File:zero2w-img305.png]] | style<ol start="text-align: left;2"|| style="textlist-alignstyle-type: leftdecimal;"|>| '''3.3V'''<li>Install adb tool on Ubuntu PC</li>{| '''1'''|| '''2'''| '''5V'''| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| test@test:~$ '''264sudo apt-get update'''| '''PI8'''| test@test:~$ '''TWI1sudo apt-get install -SDAy adb'''| '''3'''}|</ol>| '''4'''| '''5V'''| <ol start="3" style="textlist-style-aligntype: leftdecimal;"|><li>Check whether the ADB device is recognized</li>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| test@test:~$ '''263adb devices'''| '''PI7'''| '''TWI1-SCL'''List of devices attached| '''5'''|4c00146473c28651dd0 device| '''6'''}| '''GND'''</ol>| <ol start="4" style="textlist-style-aligntype: leftdecimal;"|><li>Then you can log in to the android system through adb shell on Ubuntu PC</li>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| test@test:~$ '''269adb shell''' apollo-p2:/ $| }</ol><span id="view-how-to-set-hdmi-display-resolution"></span> == View how to set HDMI display resolution == <ol style="list-style-type: decimal;"><li><p>Enter first '''PI13Settings'''</p><p>[[File:zero2w-img306.png]]</p></li>| <li><p>Then select '''PWM3Device Preferences'''</p>| <p>[[File:zero2w-img307.png]]</p></li><li><p>Then select '''7Display &amp; Sound'''</p>|<p>[[File:zero2w-img308.png]]</p></li>| <li><p>Then select '''8Advanced display settings'''</p><p>[[File:zero2w-img309.png]]</p></li>| <li><p>Then select '''UART0_TXHDMI output mode'''</p><p>[[File:zero2w-img310.png]]</p></li><li><p>Then you can see the list of resolutions supported by the monitor. At this time, clicking the corresponding option will switch to the corresponding resolution. Please note that different monitors may support different resolutions. If you connect it to a TV, you will generally see more resolution options than the picture below.</p><p>[[File:zero2w-img311.png]]</p></li><li><p>The HDMI output of the development board supports 4K display. When connected to a 4K TV, you can see the 4K resolution option.</p><p>[[File:zero2w-img312.png]]</p></li></ol> <span id="hdmi-to-vga-display-test-1"></span>=== HDMI to VGA display test === <ol style="list-style-type: decimal;"><li><p>First you need to prepare the following accessories</p><ol style="list-style-type: lower-alpha;"><li>HDMI to VGA converter</li> [[File:zero2w-img144.png]]</ol><ol start="2" style="list-style-type: lower-alpha;"><li>A VGA cable and a Mini HDMI male to HDMI female adapter</li> [[File:zero2w-img145.png]] [[File:zero2w-img146.png]]</ol><ol start="3" style="list-style-type: lower-alpha;"><li>A monitor or TV that supports VGA interface</li></ol></li></ol> <ol start="2" style="list-style-type: decimal;"><li>HDMI to VGA display test is as follows</li> [[File:zero2w-img313.png]]| '''PH0'''{| '''224'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| style<big>'''When using HDMI to VGA display, the development board and the Android system of the development board do not need to make any settings. You only need the 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="textwi-align: left;fi-connection-method"|></span> | style="text= WI-align: left;"|FI connection method == | # Choose first '''GNDSettings'''| '''9'''|::[[File:zero2w-img306.png]]| '''10'''| '''UART0_RX'''<ol start="2" style="list-style-type: decimal;">| <li>Then select '''PH1Network &amp; Internet'''</li>| '''225'''|[[File:zero2w-img314.png]]| '''226'''</ol>| '''PH2'''<ol start="3" style="list-style-type: decimal;">| '''UART5_TX'''<li>Then turn on WI-FI</li>| '''11'''|[[File:zero2w-img315.png]]| '''12'''</ol>| <ol start="4" style="textlist-alignstyle-type: 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-style-aligntype: leftdecimal;"|><li>Then use the keyboard to enter the password corresponding to the WI-FI, and then use the mouse to click the Enter button on the virtual keyboard to start connecting to the WI-FI.</li> <div class="figure"> [[File:zero2w-img318.png]] </div></ol>| <ol start="7" style="textlist-style-aligntype: leftdecimal;"|><li>The display after successful WI-FI connection is as shown below</li> [[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-alignthe-ip-address-of-the-ethernet-port"></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. ::[[File: left;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> | '''21'''<span id="bluetooth-connection-method"></span>|| '''22'''== Bluetooth connection method ==| '''UART2_RX'''| # Choose first '''PI6Settings'''| '''262'''|::[[File:zero2w-img306.png]]| '''230'''| '''PH6'''<ol start="2" style="list-style-type: decimal;">| <li>Then select '''SPI1_CLKBluetooth'''</li>| '''23'''|[[File:zero2w-img327.png]]| '''24'''</ol>| '''SPI1_CS0'''<ol start="3" style="list-style-type: decimal;">| <li>Then Open '''PH5Bluetooth Enable'''</li>| '''229'''|[[File:zero2w-img328.png]]| style</ol><ol start="text-align: left;4"|| style="textlist-alignstyle-type: leftdecimal;"|>| <li>Then click '''GNDPair new device'''to start scanning for surrounding Bluetooth devices</li> [[File:zero2w-img329.png]]| '''25'''</ol>|<ol start="5" style="list-style-type: decimal;">| <li>The searched Bluetooth devices will be displayed under '''26Available devices'''</li>| '''SPI1_CS1'''| '''PH9'''[[File:zero2w-img330.png]]| '''233'''</ol>|<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 '''266Pair'''option</li> [[File:zero2w-img331.png]]| '''PI10'''</ol>| '''TWI2<ol start="7" style="list-style-SDA'''type: decimal;"><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>| '''27'''|[[File:zero2w-img332.png]]| '''28'''</ol>| '''TWI2<ol start="8" style="list-style-SCL'''type: decimal;">| <li>After pairing is completed, open '''PI9Paired devices'''and you will see the paired Bluetooth devices.</li> [[File:zero2w-img333.png]]| '''265'''</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 '''256Accept'''to start receiving the pictures sent by the mobile phone.</li> | '''PI0'''[[File:zero2w-img334.png]]</ol>| <ol start="10" style="textlist-style-aligntype: leftdecimal;"|>| <li>Pictures received by the Bluetooth system of the development board Android system can be viewed in '''29Received 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 .|| '''30'''If you want to use USB0 to connect USB devices, you need to set USB0 to HOST mode. The method is as follows:| '''GND'''| <ol style="textlist-alignstyle-type: leftlower-alpha;"|><li>Run the following command to set USB0 to HOST mode:</li>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| apollo-p2:/ # '''271cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_host''' host_chose finished! apollo-p2:/ #| '''PI15'''}</ol>| <ol start="2" style="textlist-alignstyle-type: leftlower-alpha;"|>| '''31'''<li>Run the following command to switch back to Device mode</li>{|| '''32'''| '''PWM1'''| '''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-align: left;"|| '''PC12'''| '''76'''|-| '''272'''| '''PI16'''| style="text-align: left;"|| '''37'''|| '''38'''| style="text-align: left;"|| '''PI4'''| '''260'''|-| style="text-align: left;"|| style="textapollo-alignp2: left;"|| '''GND'''| / # '''39'''|| '''40'''| style="text-aligncat /sys/devices/platform/soc@3000000/soc@3000000\: left;"|| usbc0@0/usb_device'''PI3'''| '''259'''|}
<ol start="2" style="list-style-type: decimal;"><li>First click the wiringOP icon to open wiringOP APP</li></ol>device_chose finished!
[[Fileapollo-p2:zero2w/ #|}</ol><ol start="3" style="list-img351.png]]style-type: lower-alpha;"><li>The command to view the current mode of USB0 is</li>{| class="wikitable" style="width:800px;" |-| apollo-p2:/ # '''cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/otg_role'''
usb_host|}</ol start><span id="3" style="listhow-to-use-styleusb-type: decimal;camera"><li>Then click the '''PWM_TEST''' button on the main interface of wiringOP to enter the PWM test interface</li></olspan>
[[File:zero2w-img380.png]]== How to use USB camera ==
# First insert the USB (UVC protocol) camera into the USB interface of the development board# If the USB camera is recognized normally, the corresponding video device node will be generated under /dev ::{| class="wikitable" style="width:800px;" |-| console:/ # '''ls /dev/video0''' /dev/video0|} <ol start="43" style="list-style-type: decimal;"><li>The PWM test interface <p>Then make sure that the adb connection between the Ubuntu PC and the development board is as followsnormal. 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>Download the USB camera test APP from the '''official tool''' on the development board information download page</p></olli>
<div class="figure">
[[File:zero2w-img381img336.png]]
</div>
<ol startdiv class="5figure" 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></ol>
[[File:zero2w-img382img337.png]]
</div></ol>
<ol start="5" style="list-style-type: decimal;">
<li>Then use the adb command to install the USB camera test APP into the Android system. Of course, you can also use a USB disk copy to install it.</li>
{| class="wikitable" style="width:800px;"
|-
|
test@test:~$ '''adb install usbcamera.apk'''
|}
</ol>
<ol start="6" style="list-style-type: decimal;">
<li>Then After installation, you can set see the PWM period. The default configuration is '''50000ns'''startup icon of the USB camera on the Android desktop. The converted PWM frequency is '''20KHz'''</li></ol> [[File:zero2w-img383.png]]
[[File:zero2w-img338.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 '''EXPORT'''button to export PWMUSB camera.</li></ol>
[[File:zero2w<span id="android-img384.png]]system-root-description"></span>
<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></ol>Android system ROOT description ==
[[File{| class="wikitable" style="background-color:#ffffdc;width:zero2w800px;" |-img385| <big>'''The Android system released by Orange Pi has been ROOT and can be tested using the following method.png]]'''</big>|}
<ol start="9" style="list-style-type: decimal;"><li>Then use an oscilloscope to measure # Download from the corresponding pins in '''official tool''' on the 40pin development board and you can see the following waveformdata download page '''rootcheck.</li></ol>apk'''
[[File:zero2w-img386.png]]<div class="figure">
<span id="how::[[File:zero2w-to-compile-android-12-source-code"></span>img336.png]]
</div><div class= '''How to compile Android 12 source code''' ="figure">
<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></ol></li></ol> [[File:zero2w-img387img339.png]]
</div>
<ol start="2" style="list-style-type: decimal;">
<li>After downloading <p>Then make sure that the adb connection between the compressed package of Android 12 source code, please check whether Ubuntu PC and the MD5 checksum development board is correctnormal. If it is incorrectFor how to use adb, please download refer to the source code againinstructions in the section &quot;[[Orange Pi Zero 2W#How to use ADB|'''How to use ADB''']]&quot;. Here's how </p></li><li><p>Then use the adb command to check install rootcheck.apk into the MD5 checksumAndroid system. Of course, you can also use a USB disk copy to install it.</p></li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''adb install rootcheck.apk'''|}</ol><ol start="4" style="list-style-type: decimal;"><li>After installation, you can see the startup icon of the ROOT test tool on the Android desktop.</olli>
test@test[[File:zero2w-img340.png]]</ol><ol start="5" style="list-style-type:~$ decimal;"><li>The display interface after opening the '''md5sum -c H618-Android12-Src.tar.gz.md5sumROOT test tool'''for the first time is as shown below</li>
H618[[File:zero2w-img341.png]]</ol><ol start="6" style="list-Android12style-Src.tar.gzaatype: decimal;"><li>Then you can click '''OKCHECK 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>
H618[[File:zero2w-Android12img342.png]]</ol><span id="how-Src.tar.gzab: '''OK'''to-use-miracastreceiver-to-cast-the-mobile-phone-screen-to-the-development-board"></span>
......== How to use MiracastReceiver to cast the mobile phone screen to the development board ==
<ol start="3" style="list-style-type: decimal;"><li>Then you need <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 merge multiple compressed files into oneWIFI, and then extract please refer to [[Orange Pi Zero 2W#WI-FI connection method|'''the instructions in the WI-FI connection method.''']]</p></li><li><p>Then open the '''MiracastReceiver'''application in the Android source codesystem of the development board</p><p>[[File:zero2w-img343. The command looks like this:png]]</p></li><li><p>The interface after '''MiracastReceiver''' is opened is as follows</olp><div class="figure">
test@test[[File:~$ '''cat H618zero2w-Android12-Src.tar.gza* &gt; H618-Android12-Src.tarimg344.gz'''png]]
test@test:~$ </div></li><li><p>Then find the screen mirroring function in the phone settings. Here we take '''Xiaomi 12S Pro mobile phone'''tar 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-xvf H618img345.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-Android12-Srcimg346.tarpng]]</p></li><li><p>Then the selection box shown in the figure below will pop up in the '''MiracastReceiver''' application interface of the development board.gzHere 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>
<ol startspan id="4" style="listmethod-of-turning-on-and-off-the-machine-through-buttons-or-infrared-styleremote-type: decimal;control"><li>Then unzip the compressed package of the files modified by Orange Pi Zero2w</li></olspan>
test@test:~$ '''tar zxf opizero2w_android12_patches.tar.gz'''== Method of turning on and off the machine through buttons or infrared remote control ==
test@test:~$ '''ls'''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.
'''opizero2w_android12_patches''' opizero2w_android12_patches[[File:zero2w-img107.tar.gzpng]]
<ol start="5" style="list-style-type: decimal;"><li>Then copy The location of the power button on the files modified by Orange Pi Zero2w to 24pin expansion board is as shown in the Android source code</li></ol>figure below:
test@test[[File:~$ '''cp zero2w-rf opizero2w_android12_patches/* H618-Android12-Src/'''img269.png]]
<span id="compile-the-source-code-The location of-android-12"></span>== Compile the source code of Android 12 ==infrared remote control power button is as follows:
'''Android12 is compiled on an x86_64 computer with Ubuntu 22[[File:zero2w-img349.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:'''png]]
[https://repo.huaweicloud.com/ubuntu-releases/22.04/ubuntu-22.04.2-desktop-amd64.iso 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 '''https://repo.huaweicloud.com/ubuntu-releases/22.04/ubuntu-22.04.2-desktop-amd64.isoOK''']to shut down the Android system.
'''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[[File:zero2w-img350. The more CPU cores, the better.'''png]]
# First install After shutting down, press and hold the software packages needed power button or the power button on the infrared remote control again to compile Android12 source codeturn it on.
<span id="pin-interface-gpio-uart-spi-test@"></span>== 40pin interface GPIO, UART, SPI test:~$ '''sudo apt-get update'''==
test@test{| class="wikitable" style="background-color:#ffffdc;width:~$ 800px;" |-| <big>'''sudo apt-get install -y git gnupg flex bison gperf build-essential \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>|}
'''zip curl zlib1g<span id="pin-dev gccgpio-multilib g++port-multilib libc6test-dev-i386 \'''method"></span>=== 40pin GPIO port test method ===
'''lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev ccache \'''# First open wiringOP APP on the desktop
'''libgl1::[[File:zero2w-mesa-dev libxml2-utils xsltproc unzip u-boot-tools python-is-python3 \'''img351.png]]
<ol start="2" style="list-style-type: decimal;"><li>Then click the '''libssl-dev libncurses5 clang gawkGPIO_TEST'''button to open the GPIO test interface</li>
[[File:zero2w-img352.png]]</ol><ol start="23" style="list-style-type: decimal;"><li><p>Then compile The GPIO test interface is as shown in the figure below. The two rows of '''CheckBox''' buttons on the left have a one-to-one correspondence with the code in 40pin pins. When the longan folder'''CheckBox''' button is checked, which mainly contains u-boot the corresponding GPIO pin will be set to '''OUT''' mode and linux kernel</p><ol style="list-style-type: lower-alphathe pin level is set to high level; when unchecked, the GPIO pin level will be set to low level;"><li>First run when the GPIO is clicked When you click the '''GPIO READALL'''button, you can get information such as wPi number, GPIO mode, pin level, etc./build.sh config; when you click the'''BLINK ALL GPIO''' button, all GPIO ports will cycle through outputting high and low levels. This function can be used to set compilation optionstest all the 40pin pins. GPIO port.</li></ol></li></ol>
test@test[[File:~$ zero2w-img353.png]]</ol><ol start="4" style="list-style-type: decimal;"><li>Then click the '''cd H618-Android12-Src/longanGPIO READALL'''button, and the output information is as shown below:</li>
test@test:~/H618-Android12-Src/longan$ '''./build.sh config'''<div class="figure">
Welcome to mkscript setup progress[[File:zero2w-img354.png]]
All </div></ol><ol start="5" style="list-style-type: decimal;"><li>There are a total of 28 GPIO ports available platform: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 '''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>
0[[File:zero2w-img355. androidpng]]</ol><ol start="6" style="list-style-type: decimal;"><li>Then click the '''GPIO READALL''' button and you can see that the current pin 12 mode is '''OUT''' and the pin level is high level.</li>
1[[File:zero2w-img356. linuxpng]]</ol><ol start="7" style="list-style-type: decimal;"><li>Click the '''CheckBox''' button in the picture below again to uncheck it, and pin 12 will be set to low level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is '''0v''', it means the low level setting is successful.</li>
Choice [android[File:zero2w-img357.png]]</ol><ol start="8" style="list-style-type: decimal;"><li>Then click the '''0GPIO READALL'''button and you can see that the current pin 12 mode is OUT and the pin level is low level.</li>
All available ic[[File:zero2w-img358.png]]</ol><span id="pin-uart-test-method"></span>
0. h618=== 40pin UART test method ===
Choice [h618]: '''0'''# 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.
All available board<div style="display:flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-0| '''GPIO NO. ft'''| '''GPIO'''| '''Function'''| '''Pin'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''1. p1'''|-2. p2| '''264'''| '''PI8'''| '''TWI1-SDA'''| '''3. p7'''|-4. p7l| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5. perf1'''|-| '''269'''6. perf2| '''PI13'''| '''PWM3'''| '''7. perf3'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''9'''|-8. qa| '''<span style="color:#FF0000">226</span>'''| '''<span style="color:#FF0000">PH2</span>'''Choice [p2]| '''<span style="color: #FF0000">UART5_TX</span>'''| '''2<span style="color:#FF0000">11</span>'''|-All available flash| '''<span style="color:#FF0000">227</span>'''| '''<span style="color:#FF0000">PH3</span>'''0. default| '''<span style="color:#FF0000">UART5_RX</span>'''| '''<span style="color:#FF0000">13</span>'''|-1. nor| '''<span style="color:#FF0000">261</span>'''| '''<span style="color:#FF0000">PI5</span>'''Choice [default]| '''<span style="color: #FF0000">UART2_TX</span>'''0| '''<span style="color:#FF0000">15</span>'''|-All available kern_ver| style="text-align:left;"|| style="text-align: left;"|0| '''3. linux3V'''| '''17'''|-| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|-| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|-5.4| style="text-align: left;"|Choice [linux| style="text-5.4]align: left;"|| '''0GND'''| '''25'''All available arch:|-| '''266'''| '''PI10'''| '''TWI2-SDA'''0. arm| '''27'''|-1. arm64| '''256'''| '''PI0'''Choice [arm64]| style="text-align: left;"|| '''129'''|-| '''271'''| '''......PI15'''| style="text-align: left;"|*** Default configuration is based on | '''31''sun50iw9p1smp_h618_android_defconfig'|-#| '''268'''| '''PI12'''# configuration written to .config| '''PWM2'''| '''33'''#|-| '''258'''make[1]| '''PI2'''| style="text-align: Leaving directory left;"|| '''35'/home/test/H618''|-Android12| '''272'''| '''PI16'''| style="text-Src/longan/out/kernel/buildalign: left;"|| '''37'''|-make| style="text-align: Leaving directory left;"|| style="text-align: left;"|| '''GND'''| '''39''/home/test/H618'|}{| class="wikitable" style="width:390px;margin-Android12right: 20px;text-Src/longan/kernel/linuxalign: center;"|-5| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''4'''| '''5V'''INFO| style="text-align: left;"|| style="text-align: clean buildserverleft;"||-| '''6'''| '''GND'''| style="text-align: left;"|INFO| style="text-align: prepare_buildserverleft;"||-<ol start| '''8'''| '''UART0_TX'''| '''PH0'''| '''224'''|-| '''10'''| '''UART0_RX'''| '''PH1'''| '''225'''|-| '''12'''| style="2text-align: left;" || '''PI1'''| '''257'''|-| '''14'''| '''GND'''| style="listtext-align: left;"|| style="text-typealign: lowerleft;"||-alpha| '''16'''| '''PWM4'''| '''PI14'''| '''270'''|-| '''18'''| style="text-align: left;"|| '''PH4'''| '''228'''|-| '''20'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''<span style="color:#FF0000">22</span>'''| '''<lispan style="color:#FF0000">UART2_RX</span>Then run the '''.| '''<span style="color:#FF0000">PI6</build.shspan>'''| ''' script to start compilation.</lispan style="color:#FF0000">262</olspan>'''|-| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''28'''| '''TWI2-SCL'''| '''PI9'''| '''265'''|-| '''30'''test@test| '''GND'''| style="text-align:~/H618left;"|| style="text-Android12align: left;"||-Src/longan$ | '''32'''| '''PWM1'''| '''PI11'''| '''267'''|-| '''./build.sh34'''| '''GND'''<ol start| style="3text-align: left;" || style="listtext-align: left;"||-| '''36'''| style="text-typealign: lower-alphaleft;">|<li>After compilation is completed, you will see the following output</li></ol>| '''PC12'''| '''76'''sun50iw9p1 compile Kernel successful|-| '''38'''INFO| style="text-align: Prepare toolchain ...left;"|| '''PI4'''| '''......260'''|-| '''40'''INFO| style="text-align: build kernel OK.left;"|| '''PI3'''INFO: build rootfs ...| '''259'''|}INFO: skip make rootfs for android</div>
INFO: --------------<ol start="2" style="list-style-type: decimal;"><li>The device node corresponding to uart2 is '''/dev/ttyAS2''', and the device node corresponding to uart5 is'''/dev/ttyAS5'''</li>{| class="wikitable" style="width:800px;" |-| <p>apollo-p2:/ # ls /dev/ttyAS*</p><p>/dev/ttyAS0 &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> [[File:zero2w-img351.png]]</ol><ol start="4" style="list-style-type: decimal;"><li>Then click the '''UART_TEST'''button to open the UART test interface</li> [[File:zero2w-img359.png]]</ol><ol start="5" style="list-style-type: 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="8" style="list-style-type: decimal;"><li><p>Then use Dupont wire to short the rx and tx pins of uart</p></li><li><p>Then you can enter a paragraph of characters in the send edit box below and click the '''SEND''' button to start sending.</p></li> [[File:zero2w-img363.png]]</ol><ol start="10" style="list-style-type: decimal;"><li>If everything is normal, the received string will be displayed in the receiving box</li> [[File:zero2w-img364.png]]</ol><span id="pin-spi-test-method"></span>
INFO: build lichee OK.=== 40pin SPI test method ===
INFO# As can be seen from the table below, the spi available for the 40pin interface is spi1, and there are two chip select pins cs0 and cs1 <div style="display: flex;">::{| class="wikitable" style="width: 390px;margin-right: 20px;text-align: center;"|-| '''GPIO NO.'''| '''GPIO'''| '''Function'''| '''Pin'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''1'''|-| '''264'''| '''PI8'''| '''TWI1--------------------------------SDA'''| '''3'''|-| '''263'''<ol start="3" style="list| '''PI7'''| '''TWI1-styleSCL'''| '''5'''|-type: decimal;"><li>Then use the following command to compile the Android source code and generate the final Android image</li></ol>| '''269'''| '''PI13''' test@test:~$ | '''cd H618-Android12-SrcPWM3''' test@test| '''7'''|-| style="text-align:~/H618left;"|| style="text-Android12-Src$ align: left;"|| '''source build/envsetup.shGND'''| '''9'''test@test:~/H618-Android12-Src$ |-| '''lunch apollo_p2-userdebug226'''| '''PH2'''test@test:~/H618-Android12-Src$ | '''make -j8UART5_TX''' test@test:~/H618| '''11'''|-Android12-Src$ | '''227'''| '''packPH3'''| '''UART5_RX'''<ol start="4" style="list| '''13'''|-| '''261'''| '''PI5'''| '''UART2_TX'''| '''15'''|-| style="text-typealign: decimalleft;">|<li><p>The storage path of the Android image generated by compilation is| style="text-align:</p>left;"|<p>| '''longan/out/h618_android12_p2_uart03.img3V'''| '''17'''</p></li></ol>|-<span id="appendix"></span>| '''231'''| '''PH7'''= | '''AppendixSPI1_MOSI''' = <span id="user| '''19'''|-manual-update-history"></span>| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|-| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|-| style="text-align: left;"|| style= User manual update history ="text-align: left;"|| '''GND'''| '''25'''|-| '''266'''| '''PI10'''| '''TWI2-SDA'''| '''27'''|-| '''256'''| '''PI0'''| style="text-align: left;"|| '''29'''|-| '''271'''| '''PI15'''| style="text-align: left;"|| '''31'''|-| '''268'''| '''PI12'''| '''PWM2'''| '''33'''|-| '''258'''| '''PI2'''| style="text-align: left;"|| '''35'''|}{| 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'''|-| '''28'''| '''TWI2-SCL'''| '''PI9'''| '''265'''|-| '''30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''32'''| '''PWM1'''| '''PI11'''| '''267'''|-| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''36'''| style="text-align: left;"|| '''PC12'''| '''76'''|}</div> <ol start="2" style="list-style-type: decimal;"><li>The device node corresponding to SPI1 CS0 is '''/dev/spidev1.0''', and the device node corresponding to SPI1 CS1 is '''/dev/spidev1.1'''</li>{| class="wikitable" style="width:800px;" |-| apollo-p2:/ # '''ls /dev/spidev1.*''' '''<span style="color:#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"> [[File:zero2w-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> === 40pin I2C test method === # As can be seen from the table below, the Android12 TV system has i2c1 and i2c2 turned on by default. <div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''GPIO NO.'''| '''GPIO'''| '''Function'''| '''Pin'''|-| 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">PI7</span>'''| '''<span style="color:#FF0000">TWI1-SCL</span>'''| '''<span style="color:#FF0000">5</span>'''|-| '''269'''| '''PI13'''| '''PWM3'''| '''7'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''9'''|-| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-| '''261'''| '''PI5'''| '''UART2_TX'''| '''15'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''17'''|-| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|-| '''230'''| '''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