8,367
edits
Changes
→Download orangepi-build from github
<div class="figure">
[[File:zero2w-img3.png|800px]]
</div>
<div class="figure">
[[File:zero2w-img4.png|800px]]
</div>
<div class="figure">
[[File:zero2w-img5.png|800px]]
</div>
<span id="orange-pi-zero-2w-24pin-expansion-board-interface-details"></span>
== Orange Pi Zero 2w 24pin expansion board interface details ==
<div class="figure">
[[File:zero2w-img6.png|800px]]
</div>
[[File:zero2w-img7.png|800px]]
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
# As can be seen from the table below, the spi available for the 40pin interface is spi1, and there are two chip select pins cs0 and cs1
<div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO序号GPIO NO.'''
| '''GPIO'''
| '''Function'''
| '''pin'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-
| '''264'''
| '''TWI1-SDA'''
| '''3'''
|-
| '''263'''
| '''TWI1-SCL'''
| '''5'''
|-
| '''269'''
| '''PWM3/UART4_TX'''
| '''7'''
|-
| style="text-align: left;"|
| '''GND'''
| '''9'''
|-
| '''226'''
| '''UART5_TX'''
| '''11'''
|-
| '''227'''
| '''UART5_RX'''
| '''13'''
|-
| '''261'''
| '''TWI0_SCL/UART2_TX'''
| '''15'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|-
| '''<span style="color:#FF0000">231</span>'''| '''<span style="color:#FF0000">PH7</span>'''| '''<span style="color:#FF0000">SPI1_MOSI</span>'''| '''<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;"|
| '''25'''
|-
| '''266'''
| '''TWI2-SDA/UART3_RX'''
| '''27'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|}{| '''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 > '''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 >center; in the figure below, and then use the '''space''' to select the > 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'''
|-
| '''pin'''
| '''Function'''
| '''GPIO NO.'''
|-
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''4'''
| '''5V'''
| style="text-align: left;"|
|-
| '''6'''
| '''GND'''
| style="text-align: left;"|
|-
| '''8'''
| '''UART0_TX'''
| '''224'''
|-
| '''10'''
| '''UART0_RX'''
| '''225'''
|-
| '''12'''
| style="text-align: left;"|
| '''257'''
|-
| '''14'''
| '''GND'''
| style="text-align: left;"|
|-
| '''16'''
| '''PWM4/UART4_RX'''
| '''270'''
|-
| '''18'''
| style="text-align: left;"|
| '''228'''
|-
| '''20'''
| '''GND'''
| style="text-align: left;"|
|-
| '''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'''
|-
| '''30'''
| '''GND'''
| style="text-align: left;"|
|-
| '''32'''
| '''PWM1'''
| '''267'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
|-
| '''36'''
| style="text-align: left;"|
| '''76'''
|-
| '''38'''
| style="text-align: left;"|
| '''260'''
|-
| '''40'''
| style="text-align: left;"|
| '''259'''
|}
</div>
<ol start="2" style="list-style-type: decimal;"><li><p>i2c In Linux systems, spi1 is turned off by default in Linux systems and needs to be turned on manually to use before itcan be used. The opening steps are as follows: </p>
<ol style="list-style-type: lower-alpha;">
<li><p>First run '''orangepi-config'''. Ordinary users remember to add > '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li><li><p>Then select '''System'''</p><p>[[File:zero2w-img80.png]]</p></li>
<li><p>Then select '''Hardware'''</p>
<p>[[File:zero2w-img81.png]]</p></li>
<li><p>Then use the keyboard's arrow keys to locate the position shown > in the picture figure below, and then use the '''space''' to select the > corresponding i2c dtbo configuration in of the picture belowSPI you want to open.</p></li></ol></li></ol>
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''Multiplexing function in 40pindtbo configuration'''| '''Corresponding dtbo configurationillustrate'''
|-
| '''40pin spi1- i2c0cs0-cs1-spidev'''| '''pi-i2c0Open cs0 and cs1 of spi1 at the same time'''
|-
| '''40pin spi1- i2c1cs0-spidev'''| '''pi-i2c1Only open cs0 of spi1'''
|-
| '''40pin spi1- i2c2cs1-spidev'''| '''pi-i2c2Only open cs1 of spi1'''
|}
[[File:zero2w-img173img172.png]]</ol>
<ol start="5" style="list-style-type: lower-alpha;">
<li><p>Then select <span class="mark">'''<Save></span> ''' to save</p>
<p>[[File:zero2w-img83.png]]</p></li>
<li><p>Then select '''<Back>'''</p>
<p>[[File:zero2w-img84.png]]</p></li>
<li><p>Then select '''<Reboot>''' to restart the system to make the > configuration take effect.</p>
<p>[[File:zero2w-img85.png]]</p></li></ol>
</li></ol>
<ol start="2" style="list-style-type: decimal;">
<li><p>Then check whether there is a '''spidev1.x''' device node in the Linux system. If it exists, it means that the SPI1 configuration has taken effect.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''ls /dev/spidev1*'''</p>
<p>/dev/spidev1.0 /dev/spidev1.1</p>
|}
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|
<big><p>'''Note that only when you open spi1-cs0-cs1-spidev, you will see the device nodes of the two spi.'''</p></big>
|}
</li>
<li><p>Next, start the spi loopback test. Do not short-circuit the mosi and miso pins of SPI1 first. The output result of running spidev_test is as follows. You can see that the data of TX and RX are inconsistent.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo spidev_test -v -D /dev/spidev1.0'''</p>
<p>spi mode: 0x0</p>
<p>bits per word: 8</p>
<p>max speed: 500000 Hz (500 KHz)</p>
<p>TX | FF FF FF FF FF FF '''<span style="color:#FF0000">40 00 00 00 00 95</span>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p>
<p>RX | FF FF FF FF FF FF '''<span style="color:#FF0000">FF FF FF FF FF FF</span>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF | ............................….</p>
|}
</li>
<li><p>Then short-circuit the two pins of SPI1 mosi (pin 19 in the 40pin interface) and miso (pin 21 in the 40pin interface) and then run spidev_test. The output is as follows. You can see the sending and receiving The data is the same, indicating that the loopback test passed.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo spidev_test -v -D /dev/spidev1.0'''</p>
<p>spi mode: 0x0</p>
<p>bits per word: 8</p>
<p>max speed: 500000 Hz (500 KHz)</p>
<p>TX | FF FF FF FF FF FF '''<span style="color:#FF0000">40 00 00 00 00 95</span>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p>
<p>RX | FF FF FF FF FF FF '''<span style="color:#FF0000">40 00 00 00 00 95</span>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p>
|}
</li></ol>
<!-- --><ol start="3" stylespan id="list-style-type: decimal;"><li><p>After starting the Linux system, first confirm that there is an open i2c device node under /dev</p><p>orangepi@orangepi:~$ '''ls /dev/i2c-*'''</p><p>'''/dev/i2c-*'''</p><p>'''Sometimes the i2c device node and the i2c bus serial number do not correspond one to one. For example, the i2c device node of the i2c1 bus may be /dev/i2c-3.'''</p><p>'''The method to accurately confirm the device node under /dev corresponding to the i2c bus is: '''</p></li></ol> <!-- --><ol style="list-style-type: lower-alpha;"><li><p>'''First run the following command to check the corresponding relationship of i2c'''</p><p>orangepi@orangepizero2w:~$ '''ls /sys/devices/platform/soc*/*/i2c-* | grep "i2c-[0-9]"'''</p><p>/sys/devices/platform/soc/5002000.i2c/i2c-0:</p><p>/sys/devices/platform/soc/5002400.i2c/i2c-3:</p><p>/sys/devices/platform/soc/5002800.i2c/i2cpin-4:</p><p>/sys/devices/platform/soc/5002c00.i2c/i2c-5:</p><p>/sys/devices/platform/soc/6000000.hdmi/i2c-2:</p><p>/sys/devices/platform/soc/7081400.i2c/i2c-1:</p></li><li><p>'''In the above output'''</p></li></ol> <!-- --><ol style="list-style-type: lower-alpha;test"><li><p>5002000 is the register base address of the i2c0 bus, and i2c-0 shown behind it is its corresponding i2c device node</p></li><li><p>5002400 is the register base address of the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li><li><p>5002800 is the register base address of the i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p></li></olspan>
</div></li></ol> <span idstyle="pin-uart-testdisplay: flex;"></span>=== 40pin UART test === # As can be seen from the table below, the available uarts are uart2, uart3, uart4 and uart5. Please note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial port. ::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO NO.'''
| '''Function'''
| '''pin'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-| '''2<span style="color:#FF0000">264</span>'''| '''5V<span style="color:#FF0000">PI8</span>'''| '''<span style="color:#FF0000">TWI1-SDA</span>'''| '''<span style="color:#FF0000">3</span>'''|-| '''<span style="color:#FF0000">263</span>'''| '''<span style="color:#FF0000">v</span>'''| '''<span style="color:#FF0000">TWI1-SCL</span>'''| '''<span style="color:#FF0000">5</span>'''|-| '''269'''| '''PI13'''| '''PWM3/UART4_TX'''| '''7'''|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''9'''
|-
| '''UART5_TX'''
| '''11'''
|-
| '''227'''
| '''UART5_RX'''
| '''13'''
|-
| '''<span style="color:#FF0000">261</span>'''| '''<span style="color:#FF0000">PI5</span>'''| '''<span style="color:#FF0000">TWI0_SCL</span>/UART2_TX'''| '''<span style="color:#FF0000">15'''|| '''16'''| '''PWM4</UART4_RX'''| '''PI14'''| '''270span>'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
| '''PH7'''
| '''SPI1_MOSI'''
| '''19'''
|-
| '''232'''
| '''SPI1_MISO'''
| '''21'''
|-
| '''230'''
| '''SPI1_CLK'''
| '''23'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|-
| '''<span style="color:#FF0000">266</span>'''| '''<span style="color:#FF0000">PI10</span>'''| '''<span style="color:#FF0000">TWI2-SDA</span>/UART3_RX'''| '''<span style="color:#FF0000">27'''|| '''28'''| '''TWI2-SCL</UART3_TX'''| '''PI9'''| '''265span>'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''pin'40''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''4'''| '''5V'''| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''Multiplexing function in 40pin6'''| '''Corresponding dtbo configurationGND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - uart28'''| '''pi-uart2UART0_TX'''| '''PH0'''| '''224'''
|-
| '''40pin - uart310'''| '''pi-uart3UART0_RX'''| '''PH1'''| '''225'''
|-
| '''40pin 12'''| style="text- uart4align: left;"|| '''PI1'''| '''pi-uart4257'''
|-
| '''40pin - uart514'''| '''ph-uart5GND'''|} [[File:zero2w-img175.png]] <ol start="5" style="listtext-style-typealign: lower-alphaleft;">|<li><p>Then select '''<Save>''' to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''<Back>'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''<Reboot>''' to restart the system to make the > configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol> <!-- --><ol start="3" | style="list-style-type: decimal;"><li><p>After entering the Linux system, first confirm whether there is a uart5 device node under '''/dev'''</p><p>'''Note that the linux5.4 system is /dev/ttyASx.'''</p><p>orangepi@orangepi:~$ '''ls /dev/ttyS*'''</p><p>/dev/ttySx</p></li><li><p>Then start testing the uart interface. First use Dupont wire to shorttext-circuit the rx and tx pins of the uart interface to be tested.</p></li><li><p>Use the '''gpio''' command in wiringOP to test the loopback function of the serial port as shown below. If you can see the following print, it means the serial port communication is normal.</p><p>'''Note that the last x in the gpio serial /dev/ttySx command needs to be replaced with the serial number of the corresponding uart device node.'''</p><p>orangepi@orangepi:~$ '''gpio serial /dev/ttySx # linux-6.1 test command'''</p><p>orangepi@orangepialign:~$ '''gpio serial /dev/ttyASx # linux-5.4 test command'''</p><p>Out: 0: -> 0</p><p>Out: 1: -> 1</p><p>Out: 2: -> 2</p><p>Out: 3: ->left; 3^C</p></li></ol> <span id="pwm-test-method"></span>=== PWM test method === # As can be seen from the following table, the available pwm are pwm1, pwm2, pwm3 and pwm4. {| class="wikitable"
|-
| '''GPIO NO.16'''| '''GPIOPWM4/UART4_RX'''| '''FunctionPI14'''| '''Pin'''|| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.270'''
|-
| '''18'''
| style="text-align: left;"|
|-
| '''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;"|
|-
| '''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;"|
|-
| '''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'''
|-
|-
| '''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"><Save></span> to save</p><p>[[File:zero2w-img83.png]]</p></li>| <li><p>Then select '''29<Back>'''</p>|<p>[[File:zero2w-img84.png]]</p></li>| <li><p>Then select '''30<Reboot>'''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 "i2c-[0-9]"'''</p><p>/sys/devices/platform/soc/5002000.i2c/i2c-0:</p><p>/sys/devices/platform/soc/5002400.i2c/i2c-3:</p><p>/sys/devices/platform/soc/5002800.i2c/i2c-4:</p><p>/sys/devices/platform/soc/5002c00.i2c/i2c-5:</p><p>/sys/devices/platform/soc/6000000.hdmi/i2c-2:</p><p>/sys/devices/platform/soc/7081400.i2c/i2c-1:</p></li>|| '''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 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 > a 50Hz square wave</li></ol>|- root@orangepi:~# | '''echo 3 > /sys/class/pwm/pwmchip0/exportGPIO NO.''' root@orangepi:~# | '''echo 20000000 > /sys/class/pwm/pwmchip0/pwm3/periodGPIO''' root@orangepi:~# | '''echo 1000000 > /sys/class/pwm/pwmchip0/pwm3/duty_cycleFunction''' root@orangepi:~# | '''echo 1 > /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 > a 50Hz square wave</li></ol>| '''3.3V''' root@orangepi:~# | '''echo 4 > /sys/class/pwm/pwmchip0/export1'''|-root@orangepi:~# | '''echo 20000000 > /sys/class/pwm/pwmchip0/pwm4/period264'''| '''PI8'''root@orangepi:~# | '''echo 1000000 > /sys/class/pwm/pwmchip0/pwm4/duty_cycleTWI1-SDA''' root@orangepi:~# | '''echo 1 > /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 > 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 "import wiringpi; help(wiringpi)"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 > 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> >>> | '''import wiringpi;17''' <ol start="3" style="list-style|-type: lower-alpha;"><li>Finally, enter the following command to view the help information of > wiringOP-Python. Press the q key to exit the help information > interface.</li></ol> >>> | '''help(wiringpi)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) | >>> <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 > parameter of the | '''pinModeSPI1_MOSI''' function is the serial number of > the wPi corresponding to the pin, and the second parameter is > the GPIO mode.</p><p>root@orangepi:~/wiringOP-Python# | '''python3 -c "import wiringpi; \19'''</p><p>|-| '''from wiringpi import GPIO; wiringpi.wiringPiSetup() ; \232'''</p><p>| '''wiringpi.pinMode(2, GPIO.OUTPUT) ; "PH8'''</p></li><li><p>Then set the GPIO port to output a low level. After setting, you > can use a multimeter to measure the voltage value of the pin. > If it is 0v, it means the low level is set successfully.</p><p>root@orangepi:~/wiringOP-Python# | '''python3 -c "import wiringpi; \SPI1_MISO'''</p><p>| '''from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\21'''</p><p>|-| '''wiringpi.digitalWrite(2, GPIO.LOW)"230'''</p></li><li><p>Then set the GPIO port to output a high level. After setting, > you can use a multimeter to measure the voltage value of the > pin. If it is 3.3v, it means the setting of the high level is > successful.</p><p>root@orangepi:~/wiringOP-Python# | '''python3 -c "import wiringpi; \PH6'''</p><p>| '''from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\SPI1_CLK'''</p><p>| '''wiringpi.digitalWrite(2, GPIO.HIGH)"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 > python3</p><p>root@orangepi:~# | '''python3GND'''</p></li><li><p>Then import the python module of wiringpi</p><p>>>> | '''import wiringpi25'''</p><p>>>> |-| '''from wiringpi import GPIO266'''</p></li><li><p>Then set the GPIO port to output mode, where the first parameter > of the | '''pinModePI10'''function is the serial number of the wPi > corresponding to the pin, and the second parameter is the GPIO > mode.</p><p>>>> | '''wiringpi.wiringPiSetup()TWI2-SDA/UART3_RX'''</p><p>0</p><p>>>> | '''wiringpi.pinMode(2, GPIO.OUTPUT)27'''</p></li><li><p>Then set the GPIO port to output a low level. After setting, you > can use a multimeter to measure the voltage value of the pin. > If it is 0v, it means the low level is set successfully.</p>|-<p>>>> | '''wiringpi.digitalWrite(2, GPIO.LOW)256'''</p></li><li><p>Then set the GPIO port to output a high level. After setting, > you can use a multimeter to measure the voltage value of the > pin. If it is 3.3v, it means the setting of the high level is > successful.</p><p>>>> | '''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;"|
|-
| '''4'''
| '''5V'''
| style="text-align: left;"|
|-
| '''6'''
| '''GND'''
| style="text-align: left;"|
|-
| '''8'''
| '''UART0_TX'''
| '''224'''
|-
| '''UART0_RX'''
| '''PH1'''
| '''225'''
|-
| '''12'''
| style="text-align: left;"|
| '''257'''
|-
| '''14'''
| '''GND'''
| style="text-align: left;"|
|-
| '''16'''
| '''PWM4/UART4_RX'''
| '''270'''
|-
| '''18'''
| style="text-align: left;"|
| '''228'''
|-
| '''20'''
| '''GND'''
| style="text-align: left;"|
|-
| '''22'''
| '''TWI0_SDA/UART2_RX'''
| '''262'''
|-
| '''24'''
| '''SPI1_CS0'''
| '''229'''
|-
| '''26'''
| '''SPI1_CS1'''
| '''233'''
|-
| '''28'''
| '''TWI2-SCL/UART3_TX'''
| '''265'''
|-
| '''30'''
| '''GND'''
| style="text-align: left;"|
|-
| '''32'''
| '''PWM1'''
| '''267'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''36'''
| style="text-align: left;"|
| '''76'''
|-
| '''38'''
| style="text-align: left;"|
| '''260'''
|-
| '''40'''
| style="text-align: left;"|
| '''259'''
|}
</div>
<ol start="2" style="list-style-type: decimal;">
<li><p>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 > '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li>
<li><p>Then select '''System'''</p>
<p>[[File:zero2w-img80.png]]</p></li>
<li><p>Then select '''Hardware'''</p>
<p>[[File:zero2w-img81.png]]</p></li>
<li><p>Then use the keyboard's arrow keys to locate the position shown > in the figure picture below, and then use the '''space''' to select the > 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 '''<Save>''' to save</p>
<li><p>Then select '''<Back>'''</p>
<p>[[File:zero2w-img84.png]]</p></li>
<li><p>Then select '''<Reboot>''' to restart the system to make the > configuration take effect.</p>
<p>[[File:zero2w-img85.png]]</p></li></ol>
</li></ol>
<!-- -->
<ol start="3" style="list-style-type: decimal;">
<li><p>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>
|-
| '''GPIO NO.'''
| '''Function'''
| '''Pin'''
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-
| '''264'''
| '''TWI1-SDA'''
| '''3'''
|-
| '''263'''
| '''TWI1-SCL'''
| '''5'''
|-
| '''<span style="color:#FF0000">269</span>'''| '''<span style="color:#FF0000">PI13</span>'''| '''<span style="color:#FF0000">PWM3</span>/UART4_TX'''| '''<span style="color:#FF0000">7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224</span>'''
|-
| style="text-align: left;"|
| '''GND'''
| '''9'''
|-
| '''226'''
| '''UART5_TX'''
| '''11'''
|-
| '''227'''
| '''UART5_RX'''
| '''13'''
|-
| '''261'''
| '''TWI0_SCL/UART2_TX'''
| '''15'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|-
| '''231'''
| '''SPI1_MOSI'''
| '''19'''
|-
| '''232'''
| '''SPI1_MISO'''
| '''21'''
| '''PH6'''
| '''SPI1_CLK'''
| '''23'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|-
| '''266'''
| '''TWI2-SDA/UART3_RX'''
| '''27'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|-
| '''<span style="color:#FF0000">268</span>'''| '''<span style="color:#FF0000">PI12</span>'''| '''<span style="color:#FF0000">PWM2</span>'''| '''33'''|| '''34'''| '''GND'''| <span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"|>33</span>'''
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|}
|-
| '''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"><Save></span> to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select <span class="mark"><Back></span></p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select <span class="mark"><Reboot></span> to restart the system to make the > configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol> <!-- -->|<ol start="3" style="list-style-type: decimal;"><li><p>After starting the Linux system, first confirm that there is an open i2c device node under <span class="mark">/dev</span></p><p>orangepi@orangepi:~$ '''ls /dev/i2c-*'''</p><p>'''/dev/i2c-*'''</p><p>'''Sometimes the i2c device node and the i2c bus serial number do not correspond one to one. For example, the i2c device node of the i2c1 bus may be /dev/i2c-3.'''</p><p>'''The method to accurately confirm the device node under /dev corresponding to the i2c bus is:'''</p></li></ol> <!-- --><ol start="3" style="list-style-type: lower-alpha;"><li><p>'''First run the following command to check the corresponding relationship of i2c'''</p><p>orangepi@orangepizero2w:~$ '''ls /sys/devices/platform/soc*/*/i2c-* | grep "i2c-[0-9]"'''</p><p>/sys/devices/platform/soc/5002000.i2c/i2c-0:</p><p>/sys/devices/platform/soc/5002400.i2c/i2c-3:</p><p>/sys/devices/platform/soc/5002800.i2c/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>'''"/dev/i2c-x"'''</p><p>Thu 2022-06-16 04:35:46</p><p>Thu 2022-06-16 04:35:47</p><p>Thu 2022-06-16 04:35:48</p><p>^C</p><p>exit</p></li></ol> <span id="pin-uart-test-1"></span>=== 40pin UART test === # As can be seen from the table below, the available uarts are uart2, uart3, uart4 and uart5. Please note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial port. {| class="wikitable"
|-
| '''GPIO NO.<span style="color:#FF0000">16</span>'''| '''GPIO<span style="color:#FF0000">PWM4</span>/UART4_RX'''| '''Function<span style="color:#FF0000">PI14</span>'''| '''Pin'''|| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.<span style="color:#FF0000">270</span>'''
|-
| '''18'''
| style="text-align: left;"|
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26422'''| '''PI8TWI0_SDA/UART2_RX'''| '''TWI1PI6'''| '''262'''|-SDA| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''3229'''|-| '''426'''| '''5VSPI1_CS1'''| '''PH9'''| '''233'''| style="text-align: left;"|'''28'''| style="text'''TWI2-align: left;"SCL/UART3_TX'''|'''PI9'''| '''265'''
|-
| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|| '''630'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''269<span style="color:#FF0000">32</span>'''| '''PI13<span style="color:#FF0000">PWM1</span>'''| '''PWM3<span style="color:#FF0000">PI11</UART4_TXspan>'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224<span style="color:#FF0000">267</span>'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''1236'''
| style="text-align: left;"|
| '''PI1PC12'''| '''25776'''
|-
| '''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<Save>'''to save</p><p>[[File:zero2w-img83.png]]</p></li>| <li><p>Then select '''PWM4/UART4_RX<Back>'''</p><p>[[File:zero2w-img84.png]]</p></li>| <li><p>Then select '''PI14<Reboot>'''to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol></li><li><p>After restarting, you can start the PWM test</p>{| '''270'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|-
| <p>root@orangepi:~# '''231echo 1 > /sys/class/pwm/pwmchip0/export'''</p>| <p>root@orangepi:~# '''PH7echo 20000000 > /sys/class/pwm/pwmchip0/pwm1/period'''</p>| <p>root@orangepi:~# '''SPI1_MOSIecho 1000000 > /sys/class/pwm/pwmchip0/pwm1/duty_cycle'''</p>| <p>root@orangepi:~# '''19echo 1 > /sys/class/pwm/pwmchip0/pwm1/enable'''</p>|}| '''20'''</li>| '''GND'''<li><p>Enter the following command on the command line to make pwm2 output a 50Hz square wave</p></li>{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| root@orangepi:~# '''232echo 2 > /sys/class/pwm/pwmchip0/export'''| root@orangepi:~# '''PH8echo 20000000 > /sys/class/pwm/pwmchip0/pwm2/period'''| '''SPI1_MISO'''| root@orangepi:~# '''21echo 1000000 > /sys/class/pwm/pwmchip0/pwm2/duty_cycle'''|| root@orangepi:~# '''22echo 1 > /sys/class/pwm/pwmchip0/pwm2/enable'''| '''TWI0_SDA}</UART2_RX'''ol><ol start="3" style="list-style-type: lower-alpha;">| '''PI6'''<li>Enter the following command on the command line to make pwm3 output a 50Hz square wave</li>{| '''262'''class="wikitable" style="width:800px;"
|-
| root@orangepi:~# '''230echo 3 > /sys/class/pwm/pwmchip0/export'''| root@orangepi:~# '''PH6echo 20000000 > /sys/class/pwm/pwmchip0/pwm3/period'''| root@orangepi:~# '''SPI1_CLKecho 1000000 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle'''| root@orangepi:~# '''23echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable'''|}| '''24'''</ol>| '''SPI1_CS0'''<ol start="4" style="list-style-type: lower-alpha;">| '''PH5'''<li>Enter the following command on the command line to make pwm4 output a 50Hz square wave</li>{| '''229'''class="wikitable" style="width:800px;"
|-
|-
| '''266'''| ''<big>'PI10''Note: The pin header on the 40pin interface is not soldered by default, and you need to solder it yourself before it can be used.'| '''TWI2-SDA</UART3_RX'''| '''27'''big>|}{| '''28'''| '''TWI2class="wikitable" style="background-SCL/UART3_TX'''| '''PI9'''| '''265'''color:#ffffdc;width:800px;"
|-
| <big>'''wiringOP-Python is the Python language version of wiringOP library, used to operate the development board'256s GPIO, I2C, SPI, UART and other hardware resources in the Python program'''| '''PI0Also please note that all the following commands are operated under the root user.'''</big>| style} <span id="texthow-to-install-align: left;wiringop-python"|></span>| '''29'''=== How to install wiringOP-Python ===|| '''30'''| '''GND'''| <ol style="textlist-alignstyle-type: leftdecimal;"|><li><p>First install dependency packages</p>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| <p>root@orangepi:~# '''271sudo apt-get update'''</p>| <p>root@orangepi:~# '''PI15sudo apt-get -y install git swig python3-dev python3-setuptools'''</p>|}</li><li><p>Then use the following command to download the source code of wiringOP-Python</p></li>{| class="wikitable" style="textbackground-aligncolor:#ffffdc;width: left800px;"|| '''31'''|| '''32'''| '''PWM1'''| '''PI11'''| '''267'''
|-
| '''268'''| <big>'''PI12Note that the following git clone--recursive command will automatically download the source code of wiringOP, because wiringOP-Python depends on wiringOP. Please make sure there are no errors during the download process due to network problems.'''| '''PWM2'''| '''33'''|| '''34If there is a problem downloading the code from GitHub, you can directly use the wiringOP-Python source code that comes with the Linux image. The storage location is: /usr/src/wiringOP-Python'''</big>| '''GND'''}{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| root@orangepi:~# '''258git clone --recursive https://github.com/orangepi-xunlong/wiringOP-Python -b next'''| root@orangepi:~# '''PI2cd wiringOP-Python'''| style="textroot@orangepi:~/wiringOP-align: left;"|| Python# '''35git submodule update --init --remote'''|}| '''36'''</ol>| <ol start="3" style="textlist-style-aligntype: leftdecimal;"|>| '''PC12'''<li><p>Then use the following command to compile wiringOP-Python and install it into the Linux system of the development board</p>{| '''76'''class="wikitable" style="width:800px;"
|-
| <p>root@orangepi:~# '''272cd wiringOP-Python'''</p>| <p>root@orangepi:~/wiringOP-Python# '''PI16python3 generate-bindings.py > bindings.i'''</p>| style="text<p>root@orangepi:~/wiringOP-align: left;"|| Python# '''37sudo python3 setup.py install'''</p>|}| </li><li><p>Then enter the following command. If helpful information is output, it means wiringOP-Python is successfully installed. Press the '''38q'''key to exit the help information interface.</p></li>{| class="wikitable" style="text-alignwidth: left800px;"|| '''PI4'''| '''260'''
|-
| style="text-alignroot@orangepi: left;"|| style="text~/wiringOP-align: left;"|| Python# '''GNDpython3 -c "import wiringpi; help(wiringpi)"'''| '''39'''|| '''40'''| style="text-alignHelp on module wiringpi: left;"|| '''PI3'''| '''259'''|}
: # 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 "gt;keep alive" 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;" |-| >>> '''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 > wiringOP-1,success:0Python. Press the q key to exit the help information > 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>>>> '''help(wiringpi)'''<p>keep alive</p><p>keep alive</p></li></ol>Help on module wiringpi:
{| 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>
<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 "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>) ; "'''</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 "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)"'''</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 "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>)"'''</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>>>> '''--privileged \import wiringpi'''</p><p>>>> '''--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>>>> '''-v /home/orangepi/home-assistant:/config \wiringpi.wiringPiSetup()'''</p><p>'''--network=host \'''0</p><p>>>> '''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>>>> '''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>>>> '''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>
</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 "[[\l3V'''|How to Change the Pip Source of Python]]"'''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 "import cv2; print(cv2.__version__)"| '''</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 "import cv2; print(cv2.__version__)"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 "import cv2; print(cv2.__version__)"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 "import cv2; print(cv2.__version__)"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 > the up and down keys on the keyboard to move up and down, use > the space bar to select, and finally use the Tab key to move > the cursor to | '''<OK>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. > 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: lower-alpha;">
<li>Since H618 is an ARMv8 architecture SOC and the system we use is > Ubuntu or Debian, we need <p>First run '''orangepi-config'''. Ordinary users remember to download the add '''NoMachine for ARM > ARMv8 DEBsudo''' installation packagepermissions. The download link is as ></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&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<Save>''' installation > 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<Back>''' folder</p><p>[[File:zero2w-img219img84.png]]</p></li><li><p>Then download select '''<Reboot>''' 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 > 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 >following 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'''
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>
'''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'''
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, > and then you can remotely operate the desktop of the development > board Linux system.</pspan id="pin-i2c-test-1"></li></olspan>
<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 > follows</p><p>[[File:zero2w-img232.png]]</p></li>| '''17'''|-<li><p>The default version of QT Creator in | '''Ubuntu22.04231''' is as > 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'''->| '''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 > 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 "ardent"align: left;"|| '''PH4'''Skip end-of-life distro "bouncy"| '''228'''|-Skip end-of-life distro "crystal"| '''20'''| '''GND'''Skip end| style="text-of-life distro "dashing"align: left;"| Skip end| style="text-of-life distro "eloquent"align: left;"| Add distro "foxy" Add distro "galactic" Skip end-of|-life distro "groovy"| '''<span style="color:#FF0000">22</span>'''Add distro "humble" Skip end-of-life distro "hydro"| '''<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>
[[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"/dev/i2c-x"''' 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>
<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 <command>align: 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 <command> | '''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 <left;command> -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 <| style="text-align: left;command> -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 "Hello"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 "Hello"'''</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 <stdio.h>| style="text-align: left;"|| '''PI3'''| '''259'''|}</pdiv> <p>int main(void)</pol start="2" style="list-style-type: decimal;"><pli>{</p><p>printf("Hello World!\n");</p><p>return 0;</p><p>}</p></li><li><p>Then compile and run '''hello_world.c'''</p><p>orangepi@orangepi:~$ '''gcc -o hello_world hello_world.c'''</p><p>orangepi@orangepi:~$ '''./hello_world'''</p><p>Hello World!</p></li></ol></li><li><p>Debian Bullseye has Python3 installed by 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 "help", "copyright", "credits" or "license" for more information.</p><p>>>></p><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p></li><li><p>Write the '''hello_world.py''' program in Python language</p><p>orangepi@orangepi:~$ '''vim hello_world.py'''</p><p>print('Hello World!')</p></li><li><p>The result of running '''hello_world.py''' is as follows</p><p>orangepi@orangepi:~$ '''python3 hello_world.py'''</p><p>Hello World!</p></li></ol></li><li><p>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 > 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("Hello World!");</p><p>}</p><p>}</p></li><li><p>Then compile and run '''hello_world.java'''</p><p>orangepi@orangepi:~$ '''javac hello_world.java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p></li></ol></li></ol> <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 <stdio.h></p><p>int main(void)</p><p>{</p><p>printf("Hello World!\n");</p><p>return 0;</p><p>}</p></li><li><p>Then compile and run '''hello_world.c'''</p><p>orangepi@orangepi:~$ '''gcc -o hello_world hello_world.c'''</p><p>orangepi@orangepi:~$ '''./hello_world'''</p><p>Hello World!</p></li></ol></li><li><p>Debian 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 "help", "copyright", "credits" or "license" for more information.</p><p>>>></p><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p></li><li><p>Write the '''hello_world.py''' program in Python language</p><p>orangepi@orangepi:~$ '''vim hello_world.py'''</p><p>print('Hello World!')</p></li><li><p>The result of running '''hello_world.py''' is as follows</p><p>orangepi@orangepi:~$ '''python3 hello_world.py'''</p><p>Hello World!</p></li></ol></li><li><p>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 > 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("Hello World!");</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>
</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 "help", "copyright", "credits" or "license" for more information.</p><p>>>></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;Hello World!"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 # linux-5.java'''</p><p>orangepi@orangepi:~$ '''java hello_world4 test command'''</p><p>Hello World!</p></li></ol></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 ==
<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 > 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 >quot; Linux system. It can also be replaced with something else, keep alive>quot; 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 > 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 > 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>
<div classspan id="figurepython-related-instructions"></span>
</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 ===
<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>
<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 <<EOF > ~/.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 '''<packagename>''' needs to be replaced with a file, so I wonspecific package name</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''pip3 install <packagename> -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 ===
'''<div classspan style="figurecolor:#FF0000">Hello from Docker!</span>'''
<div classspan id="figurehow-to-install-home-assistant"></span>
<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 TAG IMAGE ID CREATED SIZE</p><p>homeassistant/home-assistant latest bfa0ab9e1cf5 2 months ago '''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">
</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 ==
<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 "import cv2; print(cv2.__version__)"'''</p><p>'''4.5.4'''</p>|}</li><li><p>The version of OpenCV in Ubuntu20.04 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 -c "import cv2; print(cv2.__version__)"'''</p><p>'''4.2.0'''</p>|}</li><li><p>The version of OpenCV in Debian11 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 -c "import cv2; print(cv2.__version__)"'''</p><p>'''4.5.1'''</p>|}</li><li><p>The version of OpenCV in Debian12 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 -c "import cv2; print(cv2.__version__)"'''</p><p>'''4.6.0'''</p>|}</li></ol></li></ol>
<ol startspan id="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 ===
<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">
|-
| <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>
|}
<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&distro=ARM''']|}
[[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>
'''<div classspan style="figurecolor:#FF0000">There are many problems with VNC testing in Ubuntu20.04, please do not use this method.</span>'''</big>|}
<ol style="list-style-typep>New 'X' desktop is orangepi: lower-alpha;"><li>linux5.4</li>1</olp>
<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>
</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>
<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</olspan> https:''' 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</olp> https<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></olp> https://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</olp> https<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'''->'''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>
<div classspan id="figurehow-to-install-ros-1-noetic-on-ubuntu20.04"></span>=== How to install ROS 1 Noetic on Ubuntu20.04 ===
::[[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>'''
::'''<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'''
Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index-v4....yaml
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>
</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>
<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 <command> -h` for more detailed usage. ...</olp>
<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>
<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>
</li></ol>
</li></ol>
<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 ===
</li></ol>
<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 "help", "copyright", "credits" or "license" for more information.</p><p>>>></p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>''' Represents Use the image 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("Hello World!");</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>
<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 <stdio.h></olp>
<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("Hello World!\n");</olp>
:<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>
<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 "help", "copyright", "credits" or "license" for more information.</olp></lip>>>></olp>|}[[File:zero2w-img276.png]] <ol start{| class="5wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;"><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("Hello World!");</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>
<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("Hello World!\n");</olp>
<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 "help", "copyright", "credits" or "license" for more information.</p><p>>>></p>| '''OPi OS Arch'''}{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big><p>'''HDMI videoUse the Ctrl+D shortcut key to exit python's interactive mode.'''</p></big>| }</li><li><p>Write the '''OKhello_world.py'''program in Python language</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''vim hello_world.py''HDMI Audio'</p><p>print('Hello World!')</p>| }</li><li><p>The result of running '''OKhello_world.py'''is as follows</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''Type-C USB2python3 hello_world.0 x 2py'''</p><p>Hello World!</p>| '''OK'''}</li></ol></li><li><p>Ubuntu 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("Hello World!");</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 <stdio.0 HOST x 2'''| '''OK'''|-| '''Infrared reception'''| '''OK'''|-| '''Headphone audio playback'''| '''OK'''|-| '''Onh></off button'''| '''OK'''|-| '''LRADC''' '''Custom buttons x 2'''| '''OK'''|-| '''TV-OUT'''| '''NO'''|}p>
:<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 "help", "copyright", when you start it "credits" or "license" for more information.</p><p>>>></p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p></big>|}</li><li><p>Write the 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("Hello World!");</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>
<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>
<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 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 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 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>
::[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>'''</li></ol>
[orangepi@orangepi[File:zero2w-pc ~img263.png]]$ '''sudo vim /boot/extlinux/extlinux.conf'''
<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>
</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'''
<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>
[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>
<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 '''<Save>''' to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''<Back>'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''<Reboot>'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>
|}
{| 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'''
|}
'''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>|}
<span id="usedownload-networkthe-connectioncross-adbcompilation-debuggingtool-chain"></span>=== Use network connection adb debugging ===
[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:
<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:
<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 & 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>
<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 external kernel LICENSE output README.png]]md scripts toolchains u-boot userpatches'''|}</ol></li></ol>
# Choose first '''Settings'''Run the build.sh script, remember to add sudo permissions
<ol start="2" style="list-style-type: decimal;">
<li>Then select Select '''Network & 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>'''
IGNORE_UPDATES="'''<ol start="3" span style="list-style-typecolor: decimal;#FF0000">yes<li/span>Then select '''Network &quot; Internet'''</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>
<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 ==
[[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 & 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>
::[[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: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]]*'''
IGNORE_UPDATES="'''<span style="color:#FF0000">yes</span>'''"
|}
</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'''
'''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>
<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>
<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 ==
[[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 "type of image</p><ol style="list-style-type: lower-alpha;"><li><p>'''How to use ADBImage with console interface (server)'''"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]]
[[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.
: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>'''
<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 ==
<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 ==
[[File:zero2w-img107img292.png]]
[[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>
[[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>
[[File:zero2w-img350img287.png]]
<span iddiv class="pin-interface-gpio-uart-spi-testfigure"></span>== 40pin interface GPIO, UART, SPI test ==
<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 ===
[[File:zero2w-img351img290.png]]
[[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>
::o. Finally, write the bin file of u-boot into the image through the dd command.</ol><ol start="11" style="list-style-type: decimal;"><li><p>After compiling the image, the following message will be displayed</p><ol style="list-style-type: lower-alpha;"><li>The storage path of the compiled image</li>{| class="wikitable" style="width:800px;"
|-
| '''GPIO序号'''| [ o.k. ] Done building [ '''GPIOoutput/images/orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop/orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop.img''']| '''功能'''}| '''引脚'''|| '''引脚'''</ol>| '''功能'''<ol start="2" style="list-style-type: lower-alpha;">| '''GPIO'''<li>Compilation time</li>{| '''GPIO序号'''class="wikitable" style="width:800px;"
|-
|-
| [ o.k. ] Repeat Build Options [ '''264sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=image RELEASE=bullseye BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_CONFIGURE=yes''']| }</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'''
|-
|-
| '''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'''
|-
|-
| '''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'''
|-
|-
| '''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'''
|-
|}
<ol startspan id="2" style="listorange-pi-os-arch-system-user-styleguide-type: decimal;instructions"><li>The device node corresponding to uart2 is '''/dev/ttyAS2''', and the device node corresponding to uart5 is'''/dev/ttyAS5'''</li></olspan>
</div></li><li><p>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">
|-
| [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;"|
|-
|-
| [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'''
|-
|-
| '''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'''
|-
|-
| '''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'''
'''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>
{| 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>
<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 ==
<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 ==
|-
| '''GPIO serial numberHDMI Audio'''| '''GPIO'''| '''Function'''| '''pin'''|| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO serial numberOK'''
|-
|-
| '''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'''
|-
|-
| '''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'''
|-
|-
| '''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'''
|-
|-
| '''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.'''
|-
|}
<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>|}
[[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-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'''
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 & 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 & 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 & 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 & 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;"
|-
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>
# 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 "[[Orange Pi Zero 2W#How to use ADB|'''How to use ADB''']]".</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>
</div><div class= '''How to compile Android 12 source code''' ="figure">
</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 "[[Orange Pi Zero 2W#How to use ADB|'''How to use ADB''']]". 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>
<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">
<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>
<span id="pin-interface-gpio-uart-spi-test@"></span>== 40pin interface GPIO, UART, SPI test:~$ '''sudo apt-get update'''==
<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>
Opios-arch-aarch64-xfce-opizero2w-23.09-linux6.1.31.img.xz