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;"
=== How to check the temperature in linux6.1 system ===
{| class="wikitable" style="width:800px;"
|-
|
orangepi@orangepi:~$ '''sensors'''
Adapter: Virtual device
temp1: +'''<span style="color:#FF0000">47.4°C</span>''' (crit = +110.0°C)
gpu_thermal-virtual-0
Adapter: Virtual device
temp1: +'''<span style="color:#FF0000">48.7°C</span>''' (crit = +110.0°C)
ddr_thermal-virtual-0
Adapter: Virtual device
temp1: +'''<span style="color:#FF0000">47.8°C</span>''' (crit = +110.0°C)
ve_thermal-virtual-0
Adapter: Virtual device
temp1: +'''<span style="color:#FF0000">47.2°C</span>''' (crit = +110.0°C)|}
<span id="pin-interface-pin-description"></span>
== 40 Pin Interface pin description ==
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note: The pin header on the 40pin interface is not soldered by default, and you need to solder it yourself before it can be used.'''</big>|}
<ol style="list-style-type: decimal;">
</div></li>
<li><p>The functions of the 40 Pin interface pins on the development board are as shown in the table below</p></li></ol>
<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'''
| '''PH7'''
| '''SPI1_MOSI'''
| '''19'''
|-
| '''232'''
| '''SPI1_MISO'''
| '''21'''
|-
| '''230'''
| '''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'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|}
| '''Function'''
| '''GPIO'''
| '''GPIO序号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'''
|-
| '''24'''
| '''SPI1_CS0'''
| '''229'''
|-
| '''SPI1_CS1'''
| '''PH9'''
| '''233'''
|-
| '''28'''
| '''TWI2-SCL/UART3_TX'''
| '''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>
<ol start="3" style="list-style-type: decimal;">
<li>There are a total of 28 GPIO ports in the 40pin interface. The high-level voltage of all GPIO ports is '''<span style="color:#FF0000">3.3v</span>'''</li></ol>
<span id="how-to-install-wiringop"></span>
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| '''dtbo configuration'''| '''illustrate<big>'''|Note that wiringOP is already pre-| '''spi1-cs0installed in the linux image released by Orange Pi. Unless the wiringOP code is updated, there is no need to re-cs1-spidev'''| '''Open cs0 download, compile and cs1 of spi1 at the same timeinstall, you can just use it directly.'''|-| '''spi1-cs0-spidev'''| '''Only open cs0 The storage path of spi1'''|-| '''spi1the compiled wiringOP deb package in orangepi-cs1-spidev'''| 'build is: ''Only open cs1 of spi1'''|}
<ol style="list-style-type: decimal;"><li><p>Download the code of wiringOP</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt update'''</p><p>orangepi@orangepi:~$ '''sudo apt install -y git'''</p><p>orangepi@orangepi:~$ '''git clone https://github.com/orangepi-xunlong/wiringOP.git -b next'''</p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| '''GPIO序号'''| <big><p>'''GPIONote that the source code needs to download the code of wiringOP next branch. Please don'''| '''Functiont miss the -b next parameter.'''</p>| <p>'''pinIf there is a problem downloading the code from GitHub, you can directly use the wiringOP source code that comes with the Linux image. The storage location is: /usr/src/wiringOP.'''</p></big>|}| '''pin'''| '''Function'''</li>| '''GPIO'''<li><p>Compile and install wiringOP</p>{| '''GPIO NO.'''class="wikitable" style="width:800px;"
|-
|-
| '''264'''| <p>root@orangepi:~/wiringOP# '''PI8'''| '''TWI1-SDA'''| '''3gpio mode <span style="color:#FF0000">2</span> out'''</p>|}| '''4'''</li>| '''5V'''<li><p>Then set the GPIO port to output a low level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 0v, it means the low level is set successfully.</p>{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| '''263'''| <p>root@orangepi:~/wiringOP# '''PI7'''| '''TWI1-SCL'''| '''5gpio write 2 <span style="color:#FF0000">0</span>'''</p>|}| '''6'''</li>| '''GND'''<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>{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| <p>root@orangepi:~/wiringOP# '''269gpio write 2 <span style="color:#FF0000">1</span>'''</p>| '''PI13'''}</li><li><p>The setting method for other pins is similar. You only need to modify the serial number of wPi to the serial number corresponding to the pin.</p></li></ol> | '''PWM3<span id="how-to-set-the-pull-down-resistor-of-40-pin-gpio-port"></UART4_TX'''span> === How to set the pull-down resistor of 40 Pin GPIO port ===| '''7'''|<ol style="list-style-type: decimal;">| '''8'''<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 pull-up and pull-down resistors of the GPIO port.</p>| '''UART0_TX'''<p>[[File:zero2w-img171.png]]</p></li>| '''PH0'''<li><p>First, you need to set the GPIO port to input mode, and the third parameter needs to be the serial number of the wPi corresponding to the input pin.</p>{| '''224'''class="wikitable" style="width:800px;"
|-
| style="text-align<p>root@orangepi: left;"|| ~/wiringOP# '''gpio mode <span style="text-aligncolor: left;#FF0000"|| '''GND>2</span> in'''</p>| '''9'''}|</li>| '''10'''<li><p>After setting to input mode, execute the following command to set the GPIO port to pull-up mode.</p>{| '''UART0_RX'''| '''PH1'''| '''225'''class="wikitable" style="width:800px;"
|-
| '''226'''| <p>root@orangepi:~/wiringOP# '''PH2gpio mode <span style="color:#FF0000">2</span> up'''</p>| '''UART5_TX'''}| '''11'''</li>|| '''12'''<li><p>Then enter the following command to read the level of the GPIO port. If the level is 1, it means that the pull-up mode is set successfully.</p>{| class="wikitable" style="text-alignwidth: left800px;"|| '''PI1'''| '''257'''
|-
| '''227'''| <p>root@orangepi:~/wiringOP# '''PH3gpio read <span style="color:#FF0000">2</span>'''</p>| <p>'''UART5_RX<span style="color:#FF0000">1</span>'''</p>| '''13'''}|</li>| '''14'''<li><p>Then execute the following command to set the GPIO port to pull-down mode</p>{| '''GND'''| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| <p>root@orangepi:~/wiringOP# '''261gpio mode <span style="color:#FF0000">2</span> down'''</p>| }</li><li><p>Then enter the following command to read the level of the GPIO port. If the level is 0, it means that the pull-down mode is set successfully.</p>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP# '''PI5gpio read <span style="color:#FF0000">2</span>'''</p>| <p>'''TWI0_SCL<span style="color:#FF0000">0</UART2_TXspan>'''</p>| '''15'''}</li></ol> <span id="pin-spi-test"></span> === 40pin SPI test === # As can be seen from the table below, the spi available for the 40pin interface is spi1, and there are two chip select pins cs0 and cs1 <div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''16GPIO NO.'''| '''PWM4/UART4_RXGPIO'''| '''PI14Function'''| '''270pin'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''171'''|-| '''264'''| '''18PI8'''| style="text'''TWI1-align: left;"SDA'''|'''3'''|-| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|-| '''269'''| '''PI13'''| '''PH4PWM3/UART4_TX'''| '''2287'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''9'''
|-
| '''232226'''| '''PH2'''| '''UART5_TX'''| '''11'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-| '''261'''| '''PI5'''| '''TWI0_SCL/UART2_TX'''| '''15'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''17'''|-| '''<span style="color:#FF0000">231</span>'''| '''PH8<span style="color:#FF0000">PH7</span>'''| '''SPI1_MISO<span style="color:#FF0000">SPI1_MOSI</span>'''| '''21<span style="color:#FF0000">19</span>'''|-| '''22<span style="color:#FF0000">232</span>'''| '''TWI0_SDA<span style="color:#FF0000">PH8</UART2_RXspan>'''| '''PI6<span style="color:#FF0000">SPI1_MISO</span>'''| '''262<span style="color:#FF0000">21</span>'''
|-
| '''<span style="color:#FF0000">230</span>'''| '''<span style="color:#FF0000">PH6</span>'''| '''<span style="color:#FF0000">SPI1_CLK</span>'''| '''<span style="color:#FF0000">23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229</span>'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|-
| '''266'''
| '''TWI2-SDA/UART3_RX'''
| '''27'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''40pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''Multiplexing function in 40pin4'''| '''Corresponding dtbo configuration5V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - i2c06'''| '''pi-i2c0GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - i2c18'''| '''pi-i2c1UART0_TX'''| '''PH0'''| '''224'''
|-
| '''40pin - i2c210'''| '''pi-i2c2UART0_RX'''|} [[File:zero2w-img173.png]] <ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select <span class="mark"><Save></span> to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''<Back>PH1'''</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 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/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 output225'''</p></li></ol> <!-- --><ol style="list-style-type: lower-alpha;"><li><p>5002000 is the register base address of the i2c0 bus, and i2c-0 shown behind it is its corresponding i2c device node</p></li><li><p>5002400 is the register base address of the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li><li><p>5002800 is the register base address of the i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p></li></ol> <!-- --><ol start="4" style="list-style-type: decimal;"><li><p>Then start testing i2c, first install i2c-tools</p><p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y i2c-tools'''</p></li><li><p>Then connect an i2c device to the i2c pin of the 40pin connector</p></li><li><p>Then use the '''i2cdetect -y x''' x command. If the address of the connected i2c device can be detected, it means that i2c can be used normally.</p><p>'''Note that x in the i2cdetect -y x command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p><p>'''Different i2c device addresses are different. The 0x50 address in the picture below is just an example. Please refer to what you actually see.'''</p><div class="figure"> [[File:zero2w-img174.png]] </div></li></ol> <span id="pin-uart-test"></span>=== 40pin UART test === # As can be seen from the table below, the available uarts are uart2, uart3, uart4 and uart5. Please note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial port. {| class="wikitable"
|-
| '''GPIO NO.12'''| '''GPIO'''| '''Function'''style="text-align: left;"| '''pin'''|| '''pin'''| '''Function'''| '''GPIOPI1'''| '''GPIO NO.257'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26416'''| '''PI8PWM4/UART4_RX'''| '''TWI1PI14'''| '''270'''|-SDA| '''18'''| style="text-align: left;"|| '''3PH4'''|'''228'''|-| '''420'''| '''5VGND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26322'''| '''PI7TWI0_SDA/UART2_RX'''| '''TWI1PI6'''| '''262'''|-| '''<span style="color:#FF0000">24</span>'''| '''<span style="color:#FF0000">SPI1_CS0</span>'''| '''<span style="color:#FF0000">PH5</span>'''| '''<span style="color:#FF0000">229</span>'''|-| '''<span style="color:#FF0000">26</span>'''| '''<span style="color:#FF0000">SPI1_CS1</span>'''| '''<span style="color:#FF0000">PH9</span>'''| '''<span style="color:#FF0000">233</span>'''|-| '''28'''| '''TWI2-SCL/UART3_TX'''| '''5PI9'''|'''265'''|-| '''630'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26932'''| '''PI13PWM1'''| '''PWM3/UART4_TXPI11'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224267'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''22636'''| '''PH2'''style="text-align: left;"|| '''UART5_TXPC12'''| '''1176'''|-| '''1238'''
| style="text-align: left;"|
| '''PI1PI4'''| '''257260'''
|-
| '''22740'''| '''PH3'''| '''UART5_RX'''| '''13'''|| '''14'''| '''GND'''| style="text-align: left;"|
| style="text-align: left;"|
| '''PI3'''
| '''259'''
|}
</div>
<ol style="list-style-type: decimal;">
<li><p>In Linux systems, spi1 is turned off by default and needs to be turned on manually before it can be used. The opening steps are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First run '''orangepi-config'''. Ordinary users remember to add '''sudo''' permissions.</p>
{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''261sudo orangepi-config'''</p>| }</li><li><p>Then select '''PI5System'''</p>| '''TWI0_SCL<p>[[File:zero2w-img80.png]]</p></UART2_TX'''li>| <li><p>Then select '''15Hardware'''</p>|<p>[[File:zero2w-img81.png]]</p></li>| <li><p>Then use the keyboard's arrow keys to locate the position shown in the figure below, and then use the ''16'space''| '''PWM4to select the dtbo configuration of the SPI you want to open.</p></UART4_RX'''li>| '''PI14'''{| '''270'''class="wikitable" style="width:800px;text-align: center;"
|-
|-
| '''231'''| '''PH7spi1-cs0-cs1-spidev'''| '''SPI1_MOSIOpen cs0 and cs1 of spi1 at the same time'''| '''19'''|| '''20'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''232spi1-cs0-spidev'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''TWI0_SDA/UART2_RX'''| '''PI6'''| '''262Only open cs0 of spi1'''
|-
| '''230spi1-cs1-spidev'''| '''PH6Only open cs1 of spi1'''| } [[File:zero2w-img172.png]]</ol><ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select '''SPI1_CLK<Save>'''to save</p>| <p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''23<Back>'''</p>|<p>[[File:zero2w-img84.png]]</p></li>| <li><p>Then select '''24<Reboot>'''to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol></li></ol>| '''SPI1_CS0'''<ol start="2" style="list-style-type: decimal;">| <li><p>Then check whether there is a '''PH5spidev1.x'''device node in the Linux system. If it exists, it means that the SPI1 configuration has taken effect.</p>{| '''229'''class="wikitable" style="width:800px;"
|-
|-
| <big><p>'''266Note 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:~$ '''PI10sudo 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 '''TWI2-SDA<span style="color:#FF0000">40 00 00 00 00 95</UART3_RXspan>'''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 '''27<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:~$ '''28sudo 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 '''TWI2<span style="color:#FF0000">40 00 00 00 00 95</span>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p>|}</li></ol> <span id="pin-i2c-SCLtest"></UART3_TXspan> === 40pin I2C test === # As can be seen from the table below, the i2c available for the 40pin interface are i2c0, i2c1 and i2c2 <div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''GPIO NO.'''| '''GPIO'''| '''PI9Function'''| '''265pin'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-
| '''<span style="color:#FF0000">264</span>'''
| '''<span style="color:#FF0000">PI8</span>'''
| '''<span style="color:#FF0000">TWI1-SDA</span>'''
| '''<span style="color:#FF0000">3</span>'''
|-
| '''<span style="color:#FF0000">263</span>'''
| '''<span style="color:#FF0000">v</span>'''
| '''<span style="color:#FF0000">TWI1-SCL</span>'''
| '''<span style="color:#FF0000">5</span>'''
|-
| '''269'''
| '''PI13'''
| '''PWM3/UART4_TX'''
| '''7'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''31GND'''| '''9'''|-| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-| '''<span style="color:#FF0000">261</span>'''| '''<span style="color:#FF0000">PI5</span>'''| '''<span style="color:#FF0000">TWI0_SCL</span>/UART2_TX'''| '''<span style="color:#FF0000">15</span>'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''17'''|-| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|-| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''25'''|-| '''<span style="color:#FF0000">266</span>'''| '''<span style="color:#FF0000">PI10</span>'''| '''<span style="color:#FF0000">TWI2-SDA</span>/UART3_RX'''| '''<span style="color:#FF0000">27</span>'''|-| '''256'''| '''PI0'''| style="text-align: left;"|| '''3229'''|-| '''PWM1271'''| '''PI11PI15'''| style="text-align: left;"|| '''26731'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|-| style="text-align: left;"|| style="text-align: left;"|| '''38GND'''| '''39'''|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''4'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''6'''
| '''GND'''
| style="text-align: left;"|
| '''PI3'''| '''259'''|} <ol start="2" style="list-styletext-typealign: decimalleft;"><li><p>In Linux systems, uart is turned off by default and needs to be turned on manually before it can be used. The opening steps are as follows:</p><ol style="list-style-type: lower-alpha;"><li><p>First run '''orangepi-config'''. Ordinary users remember to add > '''sudo''' permissions.</p><p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p></li><li><p>Then select '''System'''</p><p>[[File:zero2w-img80.png]]</p></li><li><p>Then select '''Hardware'''</p><p>[[File:zero2w-img81.png]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown > in the picture below, and then use the '''space''' to select the > serial port you want to open.</p></li></ol></li></ol> {| class="wikitable"
|-
| '''Multiplexing function in 40pin8'''| '''Corresponding dtbo configurationUART0_TX'''| '''PH0'''| '''224'''
|-
| '''40pin - uart210'''| '''pi-uart2UART0_RX'''| '''PH1'''| '''225'''
|-
| '''40pin 12'''| style="text- uart3align: left;"|| '''PI1'''| '''pi-uart3257'''
|-
| '''40pin - uart414'''| '''pi-uart4GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - uart516'''| '''ph-uart5'''|} [[File:zero2w-img175.png]] <ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select '''<Save>''' to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''<Back>'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''<Reboot>''' to restart the system to make the > configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol> <!-- --><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 short-circuit the rx and tx pins of the uart interface to be tested.</p></li><li><p>Use the '''gpio''' command in wiringOP to test the loopback function of the serial port as shown below. If you can see the following print, it means the serial port communication is normal.</p><p>'''Note that the last x in the gpio serial /dev/ttySx command needs to be replaced with the serial number of the corresponding uart device node.'''</p><p>orangepi@orangepi:~$ '''gpio serial /dev/ttySx # linux-6.1 test command'''</p><p>orangepi@orangepi:~$ '''gpio serial /devPWM4/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: -> 3^C</p></li></ol> <span id="pwm-test-method"></span>=== PWM test method === # As can be seen from the following table, the available pwm are pwm1, pwm2, pwm3 and pwm4. {| class="wikitable"|-| '''GPIO NO.'''| '''GPIO'''| '''Function'''| '''Pin'''|| '''Pin'''| '''FunctionUART4_RX'''| '''GPIOPI14'''| '''GPIO NO.270'''
|-
| '''18'''
| style="text-align: left;"|
|-
| '''26420'''| '''PI8'''| '''TWI1-SDA'''| '''3'''|| '''4'''| '''5VGND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''263<span style="color:#FF0000">22</span>'''| '''PI7<span style="color:#FF0000">TWI0_SDA</span>/UART2_RX'''| '''TWI1<span style="color:#FF0000">PI6</span>'''| '''<span style="color:#FF0000">262</span>'''|-| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''<span style="color:#FF0000">28</span>'''| '''<span style="color:#FF0000">TWI2-SCL</span>/UART3_TX'''| '''5<span style="color:#FF0000">PI9</span>'''|'''<span style="color:#FF0000">265</span>'''|-| '''630'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26932'''| '''PI13PWM1'''| '''PWM3/UART4_TXPI11'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224267'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''1236'''
| style="text-align: left;"|
| '''PI1PC12'''| '''25776'''
|-
| '''22738'''| '''PH3'''| '''UART5_RX'''| '''13'''|| '''14'''| '''GND'''| style="text-align: left;"|
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| '''26140'''| '''PI5'''| '''TWI0_SCL/UART2_TX'''| '''15'''|| '''16'''| '''PWM4/UART4_RX'''| '''PI14'''| '''270'''|-
| style="text-align: left;"|
|-
| <p>orangepi@orangepi:~$ '''231sudo orangepi-config'''</p>| }</li><li><p>Then select '''PH7System'''</p>| '''SPI1_MOSI'''<p>[[File:zero2w-img80.png]]</p></li>| <li><p>Then select '''19Hardware'''</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 '''20space'''to select the corresponding i2c configuration in the picture below.</p></li>| '''GND'''{| styleclass="text-align: left;wikitable"|| style="width:800px;text-align: leftcenter;"|
|-
| '''232Multiplexing function in 40pin'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''TWI0_SDA/UART2_RX'''| '''PI6'''| '''262Corresponding dtbo configuration'''
|-
| '''23040pin - i2c0'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229pi-i2c0'''
|-
|-
| '''26640pin - i2c2'''| '''PI10pi-i2c2'''| '''TWI2} [[File:zero2w-img173.png]]</ol><ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select <span class="mark"><Save></span> to save</p><p>[[File:zero2w-SDAimg83.png]]</p></UART3_RX'''li>| <li><p>Then select '''27<Back>'''</p>|<p>[[File:zero2w-img84.png]]</p></li>| <li><p>Then select '''28<Reboot>'''to restart the system to make the configuration take effect.</p>| '''TWI2<p>[[File:zero2w-SCLimg85.png]]</p></li></ol></UART3_TX'''li></ol><ol start="3" style="list-style-type: decimal;">| '''PI9'''<li><p>After starting the Linux system, first confirm that there is an open i2c device node under /dev</p>{| '''265'''class="wikitable" style="width:800px;"
|-
| '''256'''| ''<p>orangepi@orangepi:~$ 'PI0'''| style="textls /dev/i2c-align: left;"|| *'''29'''|</p>| <p>'''30/dev/i2c-*'''</p>| '''GND'''}{| styleclass="text-align: left;wikitable"|| style="textbackground-aligncolor: left#ffffdc;width:800px;"|
|-
| <big><p>'''Sometimes the i2c device node and the i2c bus serial number do not correspond one to one. For example, the i2c device node of the i2c1 bus may be /dev/i2c-3.'''</p><p>'''The method to accurately confirm the device node under /dev corresponding to the i2c bus is: '''</p></big> <ol style="list-style-type: lower-alpha;"><li><p>'''271First 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>'''PI15In the above output'''</p><ol style="list-style-type: none;"><li><p>a) 5002000 is the register base address of the i2c0 bus, and i2c-0 shown behind it is its corresponding i2c device node</p></li><li><p>b) 5002400 is the register base address of the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li><li><p>c) 5002800 is the register base address of the i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p></li></ol></li></ol>|}</li></ol><ol start="4" style="list-style-type: decimal;"><li><p>Then start testing i2c, first install i2c-tools</p>{| class="wikitable" style="textwidth:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y i2c-tools'''</p>|}</li><li><p>Then connect an i2c device to the i2c pin of the 40pin connector</p></li><li><p>Then use the '''i2cdetect -y x''' x command. If the address of the connected i2c device can be detected, it means that i2c can be used normally.</p>{| class="wikitable" style="background-aligncolor:#ffffdc;width: left800px;"|-| <big><p>'''Note that x in the i2cdetect -y x command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p><p>'''31Different i2c device addresses are different. The 0x50 address in the picture below is just an example. Please refer to what you actually see.'''</p></big>|}<div class="figure"> [[File:zero2w-img174.png]] </div></li></ol> <span id="pin-uart-test"></span> === 40pin UART test === # As can be seen from the table below, the available uarts are uart2, uart3, uart4 and uart5. Please note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial port. <div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''32GPIO NO.'''| '''PWM1GPIO'''| '''PI11Function'''| '''267pin'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-
| '''264'''
| '''PI8'''
| '''TWI1-SDA'''
| '''3'''
|-
| '''263'''
| '''PI7'''
| '''TWI1-SCL'''
| '''5'''
|-
| '''269'''
| '''PI13'''
| '''PWM3/UART4_TX'''
| '''7'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''PC12GND'''| '''769'''|-| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-| '''261'''| '''PI5'''| '''TWI0_SCL/UART2_TX'''| '''15'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''PI43.3V'''| '''26017'''|-| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|-| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''25'''|-| '''266'''| '''PI10'''| '''TWI2-SDA/UART3_RX'''| '''27'''|-| '''256'''| '''PI0'''| style="text-align: left;"|| '''29'''|-| '''271'''| '''PI15'''| style="text-align: left;"|| '''31'''|-| '''268'''| '''PI12'''| '''PWM2'''| '''33'''|-| '''258'''| '''PI2'''| style="text-align: left;"|| '''35'''|-| '''272'''| '''PI16'''| style="text-align: left;"|| '''37'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''4'''| '''405V'''
| style="text-align: left;"|
| style="text-align: left;"||-| '''PI36'''| '''259GND'''|} <ol start="2" style="listtext-style-typealign: decimalleft;">|<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="listtext-style-typealign: lower-alphaleft;">||-<li><p>First run | '''8'''| '''UART0_TX'''| '''PH0'''| '''224'''orangepi|-config| '''. Ordinary users remember to add > 10'''| '''sudoUART0_RX''' permissions.</p><p>orangepi@orangepi:~$ | '''sudo orangepi-configPH1'''</p></li><li><p>Then select | '''System225'''</p><p>[[File:zero2w|-img80.png]]</p></li><li><p>Then select | '''Hardware12'''</p><p>[[File| style="text-align:zero2wleft;"|| '''PI1'''| '''257'''|-img81.png]]</p></li><li><p>Then use the keyboard| '''14'''s arrow keys to locate the position shown > in the figure below, and then use the | '''spaceGND''' to select the >| style="text-align: left; configuration corresponding to the pwm you want to open.</p>"|<p>[[File| style="text-align:zero2wleft;"||-img176.png]]<| '''16'''| '''PWM4/p></li>UART4_RX'''| '''PI14'''<li><p>Then select | '''<Save>270''' to save</p><p>[[File:zero2w|-img83.png]]</p></li><li><p>Then select | '''<Back>18'''</p><p>[[File| style="text-align:zero2w-img84.png]]</p></li>left;"|| '''PH4'''<li><p>Then select | '''<Reboot>228''' to restart the system to make the > configuration take effect.</p><p>[[File:zero2w|-img85.png]]</p></li></ol></li>| '''20'''<li><p>After restarting, you can start the PWM test</p><p>| '''Please execute the following commands under the root user.GND'''</p><ol | style="listtext-align: left;"|| style="text-typealign: lower-alphaleft;">||-| '''22'''<li><p>Enter the following command on the command line to make pwm1 > output a 50Hz square wave<| '''TWI0_SDA/p>UART2_RX'''| '''PI6'''<p>root@orangepi:~# | '''262'''|-| '''echo 1 > /sys/class/pwm/pwmchip0/export24'''</p><p>root@orangepi:~# | '''echo 20000000 > /sys/class/pwm/pwmchip0/pwm1/periodSPI1_CS0'''</p><p>root@orangepi:~# | '''echo 1000000 > /sys/class/pwm/pwmchip0/pwm1/duty_cyclePH5'''</p><p>root@orangepi:~# | '''echo 1 > /sys/class/pwm/pwmchip0/pwm1/enable229'''</p></li><li><p>Enter the following command on the command line to make pwm2 > output a 50Hz square wave</p></li></ol>|-</li></ol>| '''26'''| '''SPI1_CS1'''root@orangepi:~# | '''echo 2 > /sys/class/pwm/pwmchip0/exportPH9'''| '''233'''root@orangepi:~# |-| '''28'''| '''echo 20000000 > /sys/class/pwmTWI2-SCL/pwmchip0/pwm2/periodUART3_TX'''| '''PI9'''root@orangepi:~# | '''echo 1000000 > /sys/class/pwm/pwmchip0/pwm2/duty_cycle265'''|-root@orangepi:~# | '''echo 1 > /sys/class/pwm/pwmchip0/pwm2/enable30'''| '''GND'''<ol start| style="3text-align: left;" || style="list-styletext-typealign: lower-alphaleft;">|<li>Enter the following command on the command line to make pwm3 output > a 50Hz square wave</li></ol>|-| '''32'''root@orangepi:~# | '''echo 3 > /sys/class/pwm/pwmchip0/exportPWM1'''| '''PI11'''root@orangepi:~# | '''echo 20000000 > /sys/class/pwm/pwmchip0/pwm3/period267'''|-root@orangepi:~# | '''34'''| '''echo 1000000 > /sys/class/pwm/pwmchip0/pwm3/duty_cycleGND'''| style="text-align: left;"|root@orangepi| style="text-align:~# left;"||-| '''36''echo 1 >'| style="text-align: left; /sys/class/pwm/pwmchip0/pwm3/enable"|| '''PC12'''| '''76'''|-<ol start| '''38'''| style="4text-align: left;" || '''PI4'''| '''260'''|-| '''40'''| style="listtext-style-typealign: lower-alphaleft;">|| '''PI3'''| '''259'''|}<li>Enter the following command on the command line to make pwm4 output > a 50Hz square wave</li></oldiv>
</li></ol>
<ol startdiv style="display: flex;">::{| class="3wikitable" style="listwidth:390px;margin-styleright: 20px;text-typealign: lower-alphacenter;"><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)GPIO NO.''' 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)'''Function'''| >>> <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.Pin''' [[File:zero2w|-img170.png]] <ol | style="list-styletext-typealign: decimalleft;">|<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-styletext-typealign: lower-alphaleft;">|<li><p>First set the GPIO port to output mode, where the first > parameter of the | '''pinMode3.3V''' 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; \1'''</p><p>|-| '''from wiringpi import GPIO; wiringpi.wiringPiSetup() ; \264'''</p><p>| '''wiringpi.pinMode(2, GPIO.OUTPUT) ; "PI8'''</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 TWI1-c "import wiringpi; \SDA'''</p><p>| '''from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\3'''</p><p>|-| '''wiringpi.digitalWrite(2, GPIO.LOW)"263'''</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; \PI7'''</p><p>| '''from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\TWI1-SCL'''</p><p>| '''wiringpi.digitalWrite(2, GPIO.HIGH)"5'''</p></li></ol></li>|-| '''<li><p>The steps for testing in the command line of python3 are as follows:</p><ol span style="list-style-typecolor: lower-alpha;#FF0000"><li><p>First use the python3 command to enter the command line mode of > python3269</p><pspan>root@orangepi:~# '''python3| '''</pspan style="color:#FF0000">PI13</li><li><p>Then import the python module of wiringpi</p><pspan>>>> '''import wiringpi| '''</pspan style="color:#FF0000">PWM3<p/span>>>> /UART4_TX'''from wiringpi import GPIO| '''</pspan style="color:#FF0000">7</lispan><li><p>Then set the GPIO port to output mode, where the first parameter > of the '''pinMode'''function is the serial number of the wPi >|-| style="text-align: left; corresponding to the pin, and the second parameter is the GPIO >"|| style="text-align: left; mode.</p>"|<p>>>> | '''wiringpi.wiringPiSetup()GND'''</p><p>0</p><p>>>> | '''wiringpi.pinMode(2, GPIO.OUTPUT)9'''</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)226'''</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)PH2'''</p></li></ol></li><li><p>For wiringOP-Python to set the GPIO high and low levels in the python code, you can refer to the | '''blink.pyUART5_TX''' test program in the examples. The | '''blink.py11''' 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 examples227'''</p><p>root@orangepi:~/wiringOP-Python/examples# | '''ls blink.pyPH3'''</p><p>| '''blink.pyUART5_RX'''</p><p>root@orangepi:~/wiringOP-Python/examples| '''# python3 blink.py13'''</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.261'''| '''GPIOPI5'''| '''FunctionTWI0_SCL/UART2_TX'''| '''Pin'''|| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.15'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''117'''|| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''264231'''| '''PI8PH7'''| '''TWI1SPI1_MOSI'''| '''19'''|-SDA| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''321'''|-| '''4230'''| '''5VPH6'''| '''SPI1_CLK'''| '''23'''|-| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''25'''
|-
| '''266'''
| '''PI10'''
| '''TWI2-SDA/UART3_RX'''
| '''27'''
|-
| '''256'''
| '''PI0'''
| style="text-align: left;"|
| '''29'''
|-
| '''263271'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|| '''6'''| '''GNDPI15'''
| style="text-align: left;"|
| '''31'''
|-
| '''<span style="color:#FF0000">268</span>'''
| '''<span style="color:#FF0000">PI12</span>'''
| '''<span style="color:#FF0000">PWM2</span>'''
| '''<span style="color:#FF0000">33</span>'''
|-
| '''258'''
| '''PI2'''
| style="text-align: left;"|
| '''35'''
|-
| '''269272'''| '''PI13PI16'''| '''PWM3/UART4_TX'''| '''7'''|style="text-align: left;"| '''8'''| '''UART0_TX'''| '''PH0'''| '''22437'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''939'''|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''6'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''8'''| '''UART0_TX'''| '''PH0'''| '''224'''|-| '''10'''| '''UART0_RX'''| '''PH1'''| '''225'''
|-
| '''12'''
| style="text-align: left;"|
| '''257'''
|-
| '''14'''
| '''GND'''
| style="text-align: left;"|
|-
| '''261'''| '''PI5'''| '''TWI0_SCL<span style="color:#FF0000">16</UART2_TX'''| '''15'''|| '''16span>'''| '''<span style="color:#FF0000">PWM4</span>/UART4_RX'''| '''<span style="color:#FF0000">PI14</span>'''| '''<span style="color:#FF0000">270</span>'''
|-
| '''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;"|
|-
| '''271'''| '''PI15'''| <span style="text-aligncolor: left;#FF0000"|| '''31'''|| '''>32</span>'''| '''<span style="color:#FF0000">PWM1</span>'''| '''<span style="color:#FF0000">PI11</span>'''| '''<span style="color:#FF0000">267</span>'''
|-
| '''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>In Linux systems, spi1 pwm is turned off by default in Linux systems and needs to be turned on manually before to use it can be used. The opening steps are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First run '''orangepi-config'''. Ordinary users remember to add > '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li>
<li><p>Then select '''System'''</p>
<p>[[File:zero2w-img80.png]]</p></li>
<li><p>Then select '''Hardware'''</p>
<p>[[File:zero2w-img81.png]]</p></li>
<li><p>Then use the keyboard's arrow keys to locate the position shown > in the figure below, and then use the '''space''' to select the > dtbo configuration of corresponding to the SPI pwm you want to open.</p></lip>[[File:zero2w-img176.png]]</olp></li></ol> {| class="wikitable"|-| '''dtbo configuration'''| '''illustrate'''|-| '''spi1-cs0-cs1-spidev'''| '''Open cs0 and cs1 of spi1 at the same time'''|-| '''spi1-cs0-spidev'''| '''Only open cs0 of spi1'''|-| '''spi1-cs1-spidev'''| '''Only open cs1 of spi1'''|} <ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select '''<Save>''' to save</p>
<p>[[File:zero2w-img83.png]]</p></li>
<li><p>Then select '''<Back>'''</p>
<p>[[File:zero2w-img84.png]]</p></li>
<li><p>Then select '''<Reboot>''' to restart the system to make the > configuration take effect.</p>
<p>[[File:zero2w-img85.png]]</p></li></ol>
</li><!-- --li><ol p>After restarting, you can startthe PWM test</p>{| class="3wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;"><li><p>Then check whether there is a '''spidev1.x''' device node in the Linux system. If it exists, it means that the SPI1 configuration has taken effect.</p>|-<p>orangepi@orangepi:~$ '''ls /dev/spidev1*'''</p>| <p>/dev/spidev1.0 /dev/spidev1.1</pbig><p>'''Note that only when you open spi1-cs0-cs1-spidev, you will see Please execute the device nodes of following commands under the two spiroot user.'''</p></libig><li><p>Then you can use the '''spidev_test.py''' program in examples to test the SPI loopback function. The '''spidev_test.py''' program needs to specify the following two parameters:</p>|}
<ol style="list-style-type: lower-alpha;">
<li><p>Enter the following command on the command line to make pwm1 output a 50Hz square wave</p>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~# '''--channelecho 1 > /sys/class/pwm/pwmchip0/export''': Specify the channel number of SPI</p><p>root@orangepi:~# '''echo 20000000 > /lisys/class/pwm/pwmchip0/pwm1/period'''</p><li><p>root@orangepi:~# '''--portecho 1000000 > /sys/class/pwm/pwmchip0/pwm1/duty_cycle''': Specify the port number of the SPI</p><p>root@orangepi:~# '''echo 1 > /sys/class/pwm/li>pwmchip0/pwm1/enable'''</olp>|}
</li>
<li><p>Without shorting Enter the mosi and miso pins of SPI1, following command on the command line to make pwm2 output result of running spidev_test.py is as follows. You can see that the data of TX and RX are inconsistent.a 50Hz square wave</p><p/li>{| class="wikitable" style="width:800px;" |-| root@orangepi:~/wiringOP-Python# '''cd examplesecho 2 > /sys/class/pwm/pwmchip0/export'''</p></li></ol>
root@orangepi:~/wiringOP-Python/examples# '''python3 spidev_test.py \echo 20000000 > /sys/class/pwm/pwmchip0/pwm2/period'''
root@orangepi:~# '''--channel 1 --port 0echo 1000000 > /sys/class/pwm/pwmchip0/pwm2/duty_cycle'''
root@orangepi:~/wiringOP-Python/examples# '''python3 spidev_test.py \echo 1000000 > /sys/class/pwm/pwmchip0/pwm4/duty_cycle'''
root@orangepi:~# '''--channel echo 1 --port 0> /sys/class/pwm/pwmchip0/pwm4/enable'''|}
<ol style="list-style-type: decimal;"><li><p>First install dependency packages</p>{| class="wikitable" style="width:800px;"
|-
| '''GPIO NO.'''| '''GPIO'''| <p>root@orangepi:~# '''Functionsudo apt-get update'''</p>| <p>root@orangepi:~# '''Pinsudo apt-get -y install git swig python3-dev python3-setuptools'''</p>|}| '''Pin'''| '''Function'''</li>| '''GPIO'''<li><p>Then use the following command to download the source code of wiringOP-Python</p></li>{| '''GPIO NO.'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|-
| root@orangepi:~# '''264git clone --recursive https://github.com/orangepi-xunlong/wiringOP-Python -b next'''| '''PI8'''| root@orangepi:~# '''TWI1cd wiringOP-SDAPython'''| root@orangepi:~/wiringOP-Python# '''3git submodule update --init --remote'''|}| '''4'''| '''5V'''</ol>| <ol start="3" style="textlist-alignstyle-type: leftdecimal;"|><li><p>Then use the following command to compile wiringOP-Python and install it into the Linux system of the development board</p>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| '''263'''| <p>root@orangepi:~# '''PI7cd wiringOP-Python'''</p>| <p>root@orangepi:~/wiringOP-Python# '''TWI1python3 generate-SCLbindings.py > bindings.i'''</p>| <p>root@orangepi:~/wiringOP-Python# '''5sudo python3 setup.py install'''</p>|}| '''6'''</li>| <li><p>Then enter the following command. If helpful information is output, it means wiringOP-Python is successfully installed. Press the '''GNDq'''key to exit the help information interface.</p></li>{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| root@orangepi:~/wiringOP-Python# '''269python3 -c "import wiringpi; help(wiringpi)"'''| '''PI13'''| '''PWM3Help on module wiringpi: NAME :wiringpi DESCRIPTION : # This file was automatically generated by SWIG (http://UART4_TX'''www.swig.org). : # Version 4.0.2 | '''7''': #|| '''8''': # Do not make changes to this file unless you know what you are doing--modify| '''UART0_TX'''| '''PH0''': # the SWIG interface file instead.| '''224'''}|-</ol>| <ol start="5" style="textlist-style-aligntype: leftdecimal;"|><li><p>The steps to test whether wiringOP-Python is installed successfully under the python command line are as follows:</p>| <ol style="textlist-alignstyle-type: leftlower-alpha;"|>| '''GND'''<li>First use the python3 command to enter the command line mode of > python3</li>{| '''9'''|| '''10'''| '''UART0_RX'''| '''PH1'''| '''225'''class="wikitable" style="width:800px;"
|-
| '''226'''| root@orangepi:~# '''PH2python3'''| '''UART5_TX'''}| '''11'''</ol>|| '''12'''| <ol start="2" style="textlist-style-aligntype: leftlower-alpha;"|>| '''PI1'''<li>Then import the python module of wiringpi</li>{| '''257'''class="wikitable" style="width:800px;"
|-
| '''227'''| >>> '''PH3'''| '''UART5_RXimport wiringpi;'''| '''13'''}|</ol>| '''14'''| '''GND'''| <ol start="3" style="textlist-style-aligntype: leftlower-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>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| >>> '''261help(wiringpi)'''| '''PI5'''| '''TWI0_SCLHelp on module wiringpi: NAME :wiringpi DESCRIPTION : # This file was automatically generated by SWIG (http://UART2_TX'''www.swig.org). : # Version 4.0.2 : # : # Do not make changes to this file unless you know what you are doing--modify : # the SWIG interface file instead. CLASSES :builtins.object ::GPIO ::I2C ::Serial ::nes :class GPIO(builtins.object) :| '''15'''GPIO(pinmode=0) :| >>>| '''16'''}</ol></li></ol>| '''PWM4<span id="pin-gpio-port-test-1"></UART4_RX'''span> === 40pin GPIO port test ===| '''PI14'''{| '''270'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| style="text<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-alignPython, you can only view the board's wPi number and physics through the gpio command in wiringOP Correspondence of pins.'''</big> [[File: left;"zero2w-img170.png|center]]| } <ol style="textlist-alignstyle-type: leftdecimal;"|>| '''3<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.3V'''</p>| '''17'''<p>[[File:zero2w-img171.png]]</p></li>|| '''18'''<li><p>The steps for testing directly with commands are as follows:</p>| <ol style="textlist-alignstyle-type: leftlower-alpha;"|>| <li><p>First set the GPIO port to output mode, where the first parameter of the '''PH4pinMode'''function is the serial number of the wPi corresponding to the pin, and the second parameter is the GPIO mode.</p>{| '''228'''class="wikitable" style="width:800px;"
|-
| '''231'''| <p>root@orangepi:~/wiringOP-Python# '''PH7python3 -c "import wiringpi; \'''</p>| <p>'''SPI1_MOSIfrom wiringpi import GPIO; wiringpi.wiringPiSetup() ; \'''</p>| <p>'''19wiringpi.pinMode(<span style="color:#FF0000">2, GPIO.OUTPUT</span>) ; "'''</p>|}| '''20'''</li>| '''GND'''<li><p>Then set the GPIO port to output a low level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 0v, it means the low level is set successfully.</p>{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| '''232'''| <p>root@orangepi:~/wiringOP-Python# '''PH8python3 -c "import wiringpi; \'''</p>| <p>'''SPI1_MISOfrom wiringpi import GPIO; wiringpi.wiringPiSetup() ;\'''</p>| <p>'''21wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.LOW</span>)"'''</p>|}| '''22'''</li>| '''TWI0_SDA<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.</UART2_RX'''p>{| '''PI6'''| '''262'''class="wikitable" style="width:800px;"
|-
| <p>root@orangepi:~/wiringOP-Python# '''230python3 -c "import wiringpi; \'''</p>| <p>'''PH6from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\'''</p>| <p>'''SPI1_CLKwiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.HIGH</span>)"'''</p>| '''23'''}</li></ol>|</li>| '''24'''<li><p>The steps for testing in the command line of python3 are as follows:</p>| '''SPI1_CS0'''<ol style="list-style-type: lower-alpha;">| '''PH5'''<li><p>First use the python3 command to enter the command line mode of python3</p>{| '''229'''class="wikitable" style="width:800px;"
|-
|-
| '''266'''| '''PI10<p>>>> '''| import wiringpi'''TWI2-SDA</UART3_RX'''p>| <p>>>> '''27from wiringpi import GPIO'''</p>|}| '''28'''| '''TWI2-SCL</UART3_TX'''li>| <li><p>Then set the GPIO port to output mode, where the first parameter of the '''PI9pinMode'''function is the serial number of the wPi corresponding to the pin, and the second parameter is the GPIO mode.</p>{| '''265'''class="wikitable" style="width:800px;"
|-
| <p>>>> '''256wiringpi.wiringPiSetup()'''</p>| <p>0</p><p>>>> '''PI0'''| wiringpi.pinMode(<span style="text-aligncolor: left;#FF0000"|| '''29>2, GPIO.OUTPUT</span>)'''</p>|}| '''30'''</li>| '''GND'''<li><p>Then set the GPIO port to output a low level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 0v, it means the low level is set successfully.</p>{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| '''271'''| '<p>>>> ''PI15'''| wiringpi.digitalWrite(2, <span style="text-aligncolor: left;#FF0000"|| '''31>GPIO.LOW</span>)'''</p>|}| '''32'''</li>| '''PWM1'''<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>{| '''PI11'''| '''267'''class="wikitable" style="width:800px;"
|-
| <p>>>> '''268wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.HIGH</span>)'''</p>| }</li></ol></li><li><p>For wiringOP-Python to set the GPIO high and low levels in the python code, you can refer to the '''PI12blink.py'''test program in the examples. The '''blink.py''' test program will set the voltage of all GPIO ports in the 40 Pin of the development board to continuously change high and low.</p>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP-Python# '''PWM2cd examples'''</p>| <p>root@orangepi:~/wiringOP-Python/examples# '''33ls blink.py'''</p>|| <p>'''34blink.py'''</p>| <p>root@orangepi:~/wiringOP-Python/examples'''GND# python3 blink.py'''</p>| }</li></ol> <span id="pin-spi-test-1"></span> === 40pin SPI test === # As can be seen from the table below, the spi available for the 40pin interface is spi1, and there are two chip select pins cs0 and cs1 <div style="text-aligndisplay: leftflex;"|>::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: leftcenter;"|-| '''GPIO NO.'''| '''GPIO'''| '''Function'''| '''Pin'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''PC123.3V'''| '''761'''|-| '''264'''| '''PI8'''| '''TWI1-SDA'''| '''3'''|-| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|-| '''269'''| '''PI13'''| '''PWM3/UART4_TX'''| '''7'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''PI4GND'''| '''2609'''|-| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-| '''261'''| '''PI5'''| '''TWI0_SCL/UART2_TX'''| '''15'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND3.3V'''| '''3917'''|-| '''40<span style="color:#FF0000">231</span>'''| '''<span style="color:#FF0000">PH7</span>'''| '''<span style="color:#FF0000">SPI1_MOSI</span>'''| '''<span style="color:#FF0000">19</span>'''|-| '''<span style="color:#FF0000">232</span>'''| '''<span style="color:#FF0000">PH8</span>'''| '''<span style="color:#FF0000">SPI1_MISO</span>'''| '''<span style="color:#FF0000">21</span>'''|-| '''<span style="color:#FF0000">230</span>'''| '''<span style="color:#FF0000">PH6</span>'''| '''<span style="color:#FF0000">SPI1_CLK</span>'''| '''<span style="color:#FF0000">23</span>'''|-
| style="text-align: left;"|
| style="text-align: left;"|| '''PI3GND'''| '''25925'''|} <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>| '''266'''<ol style="list-style-type: lower-alpha;">| '''PI10'''<li><p>First run | '''orangepiTWI2-configSDA/UART3_RX'''. Ordinary users remember to add > | '''sudo27''' permissions.</p><p>orangepi@orangepi:~$ |-| '''sudo orangepi-config256'''</p></li><li><p>Then select | '''SystemPI0'''</p><p>[[File| style="text-align:zero2w-img80.png]]</p></li>left;"|<li><p>Then select | '''Hardware29'''</p><p>[[File:zero2w|-img81.png]]</p></li><li><p>Then use the keyboard| '''271''s arrow keys to locate the position shown > in the picture below, and then use the '| '''spacePI15''' to select the > corresponding i2c configuration in the picture below.</p></li></ol></li></ol> {| classstyle="wikitabletext-align: left;"|| '''31'''
|-
| '''Multiplexing function in 40pin268'''| '''Corresponding dtbo configurationPI12'''| '''PWM2'''| '''33'''
|-
| '''40pin - i2c0258'''| '''piPI2'''| style="text-i2c0align: left;"|| '''35'''
|-
| '''40pin - i2c1272'''| '''piPI16'''| style="text-i2c1align: left;"|| '''37'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''40pin - i2c2GND'''| '''pi-i2c239'''
|}
| '''GPIO NO.'''
|-
| '''2'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''| '''1'''|| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''264'''| '''PI8'''| '''TWI1-SDA'''| '''3'''|
| '''4'''
| '''5V'''
| style="text-align: left;"|
|-
| '''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>In Linux systems, uart spi1 is turned off by default and needs to be turned on manually before it can be used. The opening steps are as follows:: </p>
<ol style="list-style-type: lower-alpha;">
<li><p>First run '''orangepi-config'''. Ordinary users remember to add > '''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 > serial port dtbo configuration of the SPI you want to open.</p></li></ol></li></ol>
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''Multiplexing function in 40pindtbo configuration'''| '''Corresponding dtbo configurationillustrate'''
|-
| '''40pin spi1- uart2cs0-cs1-spidev'''| '''pi-uart2Open cs0 and cs1 of spi1 at the same time'''
|-
| '''40pin spi1- uart3cs0-spidev'''| '''pi-uart3Only open cs0 of spi1'''
|-
| '''40pin spi1- uart4'''| '''pics1-uart4spidev'''|-| '''40pin - uart5'''| '''ph-uart5Only open cs1 of spi1'''
|}
<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>After entering the Linux system, first confirm Then check whether there is a uart5 device node under '''<span class="mark">/dev</span>spidev1.x'''</p><p>'''注意device node in the Linux system. If it exists, linux5.4系统为/dev/ttyASxit means that the SPI1 configuration has taken effect.'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''ls /dev/ttySspidev1*'''</p><p>/dev/ttySxspidev1.0 /dev/spidev1.1</p></li>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <libig><p>Then start testing the uart interface. First use Dupont wire to short'''Note that only when you open spi1-cs0-cs1-circuit spidev, you will see the rx and tx pins device nodes of the uart interface to be testedtwo spi.'''</p></big>|}</li><li><p>Use Then you can use the '''gpiospidev_test.py''' command program in wiringOP examples to test the SPI loopback function of the serial port as shown below. If you can see the following print, it means the serial port communication is normalThe '''spidev_test.</p><p>py'''Note that the last x in the gpio serial /dev/ttySx command program needs to be replaced with specify the serial number of the corresponding uart device node.'''following two parameters:</p><p>orangepi@orangepiol style="list-style-type:~$ '''gpio serial /dev/ttySx # linuxlower-6.1 test command'''alpha;"></pli><p>orangepi@orangepi:~$ '''gpio serial /dev/ttyASx # linux-5.4 test command-channel''': Specify the channel number of SPI</p><p>Out: 0: -> 0</pli><pli>Out: 1: -> 1</p><p>Out'''--port''': 2: -> 2Specify the port number of the SPI</p><p/li>Out: 3: -> 3^C</pol></li><li><p>FinallyWithout shorting the mosi and miso pins of SPI1, you can run the '''serialTestoutput result of running spidev_test.py''' program in examples to test the loopback function of the serial portis as follows. If you You can see the following print, it means that the serial port loopback test is normaldata of TX and RX are inconsistent.</p><p>'''Note that the x in /dev/ttySx or /dev/ttyASx in the command needs to be replaced with the serial number of the corresponding uart device node.'''</p>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p><p>root@orangepi:~/wiringOP-Python/examples# '''python3 serialTest.py --device "/dev/ttySx" # linux6.1 use'''</p><p>root@orangepi:~/wiringOP-Python/examples# '''python3 serialTestspidev_test.py --device "/dev/ttyASx" # linux5.4 use\'''</p><p>Out: 0: -> 0</p><p>Out: 1: -> 1</p><p>Out: 2: -> 2</p><p>Out: 3: -> 3</p><p>Out: 4:^C</p><p>exit</p></li></ol>
TX | FF FF FF FF FF FF '''<span idstyle="check-the-chipid-of-h618-chipcolor:#FF0000">40 00 00 00 00 95</span>== Check the chipid of H618 chip ==''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…|
TX | FF FF FF FF FF FF '''The following demonstration is to compile and install the latest version of Python 3<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 |......@.....9. If you want to compile and install other versions of Python, the method is the same (you need to download the source code corresponding to the Python you want to install).'''…|
RX | FF FF FF FF FF FF '''<ol span style="list-style-typecolor: decimal;#FF0000"><li><p>First install the dependency packages needed to compile Python</p><p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y build-essential zlib1g-dev \'''</p><p>'''libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev \'''40 00 00 00 00 95</p><pspan>'''libreadline-dev libffi-dev curl libbz2-dev'''</p></li><li><p>Then download the latest version of Python3.9 source code and unzip it</p><p>orangepi@orangepi:~$ '''wget \'''</p><p>[https://www.pythonFF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |.org/ftp/python/3.9.10/Python-3.9.10.tgz '''https://www.python.org/ftp/python/3.9.10/Python-3.9.10.tgz''']</p><p>orangepi@orangepi:~$ '''tar xvf Python-3.9.10.tgz'''</p></li><li><p>Then run the configuration command</p><p>orangepi@orangepi:~$ '''cd Python-3.9.10'''</p><p>orangepi@orangepi:~$ '''./configure --enable-optimizations'''</p></li><li><p>Then compile and install Python3.9. The compilation time takes about half an hour.</p><p>orangepi@orangepi:~$ '''make -j4'''</p><p>orangepi@orangepi:~$ '''sudo make altinstall'''</p></li><li><p>After installation, you can use the following command to check the version number of the Python you just installed.</p>…|<p>orangepi@orangepi:~$ '''python3.9 --version'''</p>|}<p>'''Python 3.9.10'''</p></li><li><p>Then update pip</pol><p>orangepi@orangepi:~$ '''/usr/local/bin/python3.9 span id="pin-m pip install i2c-test-upgrade pip'''</p1"></li></olspan>
<ol div style="list-style-typedisplay: decimalflex;"><li><p>First install '''python3::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-pip'''</p><p>orangepi@orangepi:~$ | '''sudo apt-get updateGPIO NO.'''</p><p>orangepi@orangepi:~$ | '''GPIO'sudo apt-get install -y python3-pip''| '''Function'''| '''Pin'''</p></li><li><p>How to permanently change the pip source under Linux</p>|-<ol | style="listtext-style-typealign: lowerleft;"|| style="text-alphaalign: left;">|<li><p>First create a new | '''~/3.pip3V''' directory, then add the > | '''pip.conf1''' configuration file, and set the pip source in it > to Tsinghua source.</p><p>orangepi@orangepi:~$ '''mkdir -p ~/.pip|-| '''</pspan style="color:#FF0000">264<p/span>orangepi@orangepi:~$ '''cat <<EOF > ~/.pip/pip.conf| '''</pspan style="color:#FF0000">PI8<p/span>'''[global]| '''</pspan style="color:#FF0000">TWI1-SDA<p/span>'''timeout = 6000| '''</p>span style="color:#FF0000">3<p/span>'''index|-url = https://pypi.tuna.tsinghua.edu.cn/simple| '''<span style="color:#FF0000">263</p><pspan>'''trusted-host = pypi.tuna.tsinghua.edu.cn| '''</pspan style="color:#FF0000">v<p/span>'''EOF| '''</p></li><lispan style="color:#FF0000"><p>Then use pip3 to install the Python library very quicklyTWI1-SCL</p></li></ol></lispan><li><p>How to temporarily change the pip source under Linux, where '''<packagename>| ''' needs to be replaced with a specific package name</pspan style="color:#FF0000">5<p/span>orangepi@orangepi:~$ '''pip3 install <packagename> |-i \| '''269'''</p><p>| '''PI13''https:/'| '''PWM3/pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cnUART4_TX'''</p></li></ol> <span id="how-to-install-docker"></span>== How to install Docker == The Linux image provided by Orange Pi has Docker pre-installed, but the Docker service is not turned on by default. Use the | '''enable_docker.sh7''' script to enable the docker service, and then you can start using the docker command, and the docker service will be automatically started the next time you start the system.|-orangepi@orangepi:~$ | style="text-align: left;"|| style="text-align: left;"|| '''enable_docker.shGND''' You can use the following command to test docker. If | '''hello-world9''' can be run, docker can be used normally.|-orangepi@orangepi:~$ | '''docker run hello-world226''' Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 256ab8fe8778: Pull complete Digest: sha256:7f0a9f93b4aa3022c3a4c147a449ef11e0941a1fd0bf4a8e6c9408b2600777c5 Status: Downloaded newer image for hello-world:latest | '''Hello from Docker!PH2''' | '''This message shows that your installation appears to be working correctly.UART5_TX''' | '''.….11'''|-When using the docker command, if you are prompted for | '''permission denied227''', please add the current user to the docker user group so that you can run the docker command without sudo.| '''PH3'''orangepi@orangepi:~$ | '''sudo usermod -aG docker $USERUART5_RX''' | '''Note: You need to log out and log in again to the system to take effect. You can also restart the system.13'''|-| '''<span idstyle="how-to-install-home-assistantcolor:#FF0000">261</span>== How to install Home Assistant == '''Note that this article will only provide methods for installing Home Assistant in Ubuntu or Debian systems. For detailed usage of Home Assistant, please refer to the official documentation or corresponding books.| ''' <span idstyle="installation-via-dockercolor:#FF0000">PI5</span>'''=== Installation via docker === | '''<ol span style="list-style-typecolor: decimal;#FF0000">TWI0_SCL<li/span><p>First, please install docker and ensure that docker can run normally. For the installation steps of docker, please refer to the instructions in the [[\l|/UART2_TX'''How to Install Docker| ''']] section.</pspan style="color:#FF0000">15</li><li><pspan>Then you can search for the docker image of Home Assistant</p><p>orangepi@orangepi:~$ '''docker search homeassistant'''</p></li><li><p>Then use the following command to download the Docker image of Home Assistant to your local computer. The image size is about 1GB, and the download time will be relatively long. Please be patient and wait for the download to complete.</p>|-| style="text-align: left;"|<p>orangepi@orangepi| style="text-align:~$ left;"|| '''docker pull homeassistant/home-assistant3.3V'''| '''17'''</p><p>Using default tag: latest</p><p>latest: Pulling from homeassistant/home|-assistant</p><p>be307f383ecc: Downloading</p>| '''231'''<p>5fbc4c07ac88: Download complete</p><p>| '''...... (Omit some output)PH7'''</p><p>3cc6a1510c9f: Pull complete</p>| '''SPI1_MOSI'''| '''19'''<p>7a4e4d5b979f: Pull complete</p>|-<p>Digest: sha256:81d381f5008c082a37da97d8b08dd8b358dae7ecf49e62ce3ef1eeaefc4381bb</p>| '''232'''<p>Status: Downloaded newer image for homeassistant/home-assistant:latest</p>| '''PH8'''<p>docker.io/homeassistant/home-assistant:latest</p></li>| '''SPI1_MISO'''<li><p>Then you can use the following command to view the docker image of Home Assistant you just downloaded</p><p>orangepi@orangepi:~$ | '''docker images homeassistant/home-assistant21'''</p><p>REPOSITORY TAG IMAGE ID CREATED SIZE</p>|-<p>homeassistant/home-assistant latest bfa0ab9e1cf5 2 months ago | '''1.17GB230'''</p></li><li><p>At this point you can run the Home Assistant docker container</p><p>orangepi@orangepi:~$ | '''''docker run -d \PH6'''</p><p>| '''--name homeassistant \SPI1_CLK'''</p><p>| '''--privileged \23'''</p><p>'''|-| style="text-restartalign: left;"|| style=unless"text-stopped \align: left;"|| '''GND'''</p><p>| '''25'''|-e TZ=Asia/Shanghai \| '''</pspan style="color:#FF0000">266<p/span>'''-v /home/orangepi/home-assistant:/config \''| '''</pspan style="color:#FF0000">PI10<p/span>'''--network=host \| '''</pspan style="color:#FF0000">TWI2-SDA<p/span>/UART3_RX'''homeassistant/home-assistant:latest| '''</pspan style="color:#FF0000">27</li><li><p>Then enter【the IP address of the development board: 8123】in the browser to see the Home Assistant interface</p><pspan>'''It takes a while for the Home Assistant container to start. If the interface below does not display normally, please wait a few seconds before refreshing it. If the following interface is not displayed normally after waiting for more than a minute, it means there is a problem with the Home Assistant installation. At this time, you need to check whether there is a problem with the previous installation and setting process.|-| '''256'''| '''PI0'''</p><div class| style="figure"> [[Filetext-align:zero2w-img180.png]]left;"| </div></li><li><p>Then enter your | '''name, username29''' and |-| '''password271''' and click | '''Create AccountPI15'''</p><div class| style="figuretext-align: left;">|| '''31'''[[File:zero2w|-img181.png]]| '''268'''</div></li><li><p>Then follow the interface prompts to set according to your own preferences, and then click Next</p>| '''PI12'''<div class="figure">| '''PWM2'''| '''33'''[[File:zero2w|-img182.png]]| '''258'''</div></li>| '''PI2'''<li><p>Then click Next</p><div class| style="figuretext-align: left;">| [[File:zero2w| '''35'''|-img183.png]]| '''272'''</div></li>| '''PI16'''<li><p>Then click Finish</p><div class| style="figuretext-align: left;">|| '''37'''[[File:zero2w|-img184.png]]| style="text-align: left;"|</div></li><li><p>The main interface finally displayed by Home Assistant is as shown below</p><p>[[File| style="text-align:zero2w-img185.png]]</p></li>left;"|<li><p>Method to stop Home Assistant container</p>| '''GND'''<ol style="list-| '''39'''|}{| class="wikitable" style="width:390px;margin-typeright: lower20px;text-alphaalign: center;"><li><p>The command to view the docker container is as follows</p>|-<p>orangepi@orangepi:~$ | '''docker ps -aPin'''</p></li><li><p>The command to stop the Home Assistant container is as follows</p>| '''Function'''<p>orangepi@orangepi:~$ | '''docker stop homeassistantGPIO'''</p></li><li><p>The command to delete the Home Assistant container is as follows</p><p>orangepi@orangepi:~$ | '''docker rm homeassistantGPIO NO.'''</p></li></ol></li></ol>|-| '''2'''| '''5V'''<span id| style="installationtext-via-pythonalign: left;"></span>|| style=== Installation via python ==="text-align: left;"||-| '''Before installation, please change the source of pip to a domestic source to speed up the installation of Python packages. For the configuration method, see the instructions in the section "[[\l|How to Change the Pip Source of Python]]"4''' <ol | '''5V'''| style="listtext-align: left;"|| style="text-typealign: decimalleft;">|<li><p>First install dependency packages</p>|-<p>orangepi@orangepi:~$ | '''sudo apt-get update6'''</p><p>orangepi@orangepi:~$ | '''sudo apt-get install -y python3 python3-dev python3-venv \GND'''</p><p>'''python3| style="text-pip libffi-dev libssl-dev libjpeg-dev zlib1galign: left;"|| style="text-dev autoconf buildalign: left;"||-essential \| '''8'''</p><p>| '''libopenjp2-7 libtiff5 libturbojpeg0-dev tzdataUART0_TX'''</p><p>| '''If it is debian12, please use the following command:PH0'''</p><p>orangepi@orangepi:~$ | '''sudo apt-get update224'''</p><p>orangepi@orangepi:~$ |-| '''sudo apt-get install -y python3 python3-dev python3-venv \10'''</p><p>| '''python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \UART0_RX'''</p><p>| '''libopenjp2-7 libturbojpeg0-dev tzdataPH1'''</p></li><li><p>Then you need to compile and install Python3.9. For the method, please refer to the [[\l|'''Python source code compilation and installation method225''']] section.</p><p>|-| '''The default Python version of Debian Bullseye is Python3.9, so there is no need to compile and install it.12'''</p><p>| style="text-align: left;"|| '''PI1'The default Python version of Ubuntu Jammy is Python3.10, so there is no need to compile and install it.''| '''257'''</p><p>|-| '''The default Python version of Debian Bookworm is Python3.11, so there is no need to compile and install it.14'''</p></li><li><p>Then create a Python virtual environment</p><p>| '''Debian Bookworm is python3.11, please remember to replace the corresponding command.GND'''</p><p>orangepi@orangepi| style="text-align:~$ '''sudo mkdir /srv/homeassistantleft;"|| style="text-align: left;"||-| '''16'''</p><p>orangepi@orangepi:~$ | '''sudo chown orangepi:orangepi PWM4/srv/homeassistantUART4_RX'''</p><p>orangepi@orangepi:~$ | '''cd /srv/homeassistantPI14'''</p><p>orangepi@orangepi:~$ | '''python3.9 -m venv .270'''</p><p>orangepi@orangepi:~$ |-| '''source bin/activate18'''</p><p>(homeassistant) orangepi@orangepi| style="text-align:/srv/homeassistant$</p></li>left;"|<li><p>Then install the required Python packages</p>| '''PH4'''<p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ | '''228'''python3 |-m pip install wheel| '''20'''</p></li><li><p>Then you can install Home Assistant Core</p><p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ | '''pip3 install homeassistantGND'''</p></li><li><p>Then enter the following command to run Home Assistant Core</p>| style="text-align: left;"|<p>(homeassistant) orangepi@orangepi| style="text-align:/srv/homeassistant$ '''hassleft;"||-| '''</pspan style="color:#FF0000">22</lispan>'''| '''<lispan style="color:#FF0000">TWI0_SDA<p/span>Then enter【/UART2_RX'''development board IP address: 8123| '''】 in the browser to see the Home Assistant interface</pspan style="color:#FF0000">PI6<p/span>'''When you run the hass command for the first time, some libraries and dependency packages necessary for operation will be downloaded, installed and cached. This process may take several minutes. Note that you cannot see the Home Assistant interface in the browser at this time. Please wait for a while and then refresh it.| '''</p><div classspan style="figurecolor:#FF0000"> [[File:zero2w-img180.png]] 262</div></li></olspan>'''|-| '''24'''| '''SPI1_CS0'''<span id="opencv-installation-method"></span>| '''PH5'''== OpenCV installation method ==| '''229'''|-<span id="use-apt-to-install-opencv"></span>=== Use apt to install OpenCV ===| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''<ol span style="list-style-typecolor: decimal;#FF0000">28<li/span>'''| '''<pspan style="color:#FF0000">The installation command is as followsTWI2-SCL</pspan><p>orangepi@orangepi:~$ /UART3_TX'''sudo apt-get update| '''</pspan style="color:#FF0000">PI9<p/span>orangepi@orangepi:~$ '''sudo apt-get install -y libopencv-dev python3-opencv| '''</pspan style="color:#FF0000">265</lispan>'''<li><p>Then use the following command to print the version number of OpenCV. The output is normal, indicating that the OpenCV installation is successful.</p>|-| '''30'''| '''GND'''<ol | style="listtext-align: left;"|| style="text-typealign: lower-alphaleft;">|<li><p>The version of OpenCV in Ubuntu22.04 is as follows:</p>|-<p>orangepi@orangepi:~$ | '''python3 -c "import cv2; print(cv2.__version__)"32'''</p><p>| '''PWM1''4.5.4'| '''PI11'''</p></li><li><p>The version of OpenCV in Ubuntu20.04 is as follows:</p><p>orangepi@orangepi:~$ | '''python3 267'''|-c "import cv2; print(cv2.__version__)"| '''34'''</p><p>| '''4.2.0GND'''</p></li><li><p>The version of OpenCV in Debian11 is as follows| style="text-align:</p>left;"|<p>orangepi@orangepi| style="text-align:~$ left;"||-| '''python3 36'''| style="text-c "import cv2; print(cv2.__version__)"align: left;"|| '''PC12'''</p><p>| '''4.5.176'''</p></li><li><p>The version of OpenCV in Debian12 is as follows:</p>|-<p>orangepi@orangepi:~$ | '''python3 -c "import cv2; print(cv2.__version__)"38'''</p><p>| style="text-align: left;"|| '''4.6.0PI4'''</p></li></ol>| '''260'''|-| '''40'''| style="text-align: left;"|| '''PI3'''| '''259'''|}</li></oldiv>
<span idol start="set-up-the-chinese-environment-and-install-the-chinese-input-method2"></span>== Set up the Chinese environment and install the Chinese input method == '''Note, before installing the Chinese input method, please make sure that the Linux system used by the development board is a desktop version.''' <span id="debian-system-installation-method"></span>=== Debian system installation method === <ol style="list-style-type: decimal;"><li><p>First set the i2c is turned off by default '''locale''' in Linux systems and needs to Chinesebe turned on manually to use it. The opening steps are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>Enter the following command to start configuring '''localeFirst run '''</p><p>orangepi@orangepi:~$ '''sudo dpkg-reconfigure locales'''</p></li><li><p>Then select config'''zh_CN.UTF-8 UTF-8''' in the pop-up interface (use > 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 Ordinary users remember to add '''<OK>sudo''', and then return Car can be used)permissions.</p><p>[[File{| class="wikitable" style="width:zero2w-img186.png]]</p></li>800px;" <li><p>Then set the default '''locale''' to '''zh_CN.UTF|-8'''</p><p>[[File:zero2w-img187.png]]</p></li><li><p>After exiting the interface, the '''locale''' setting will begin. > The output displayed on the command line is as follows:</p>| <p>orangepi@orangepi:~$ '''sudo dpkgorangepi-reconfigure localesconfig'''</p><p>Generating locales (this might take a while)...</p><p>en_US.UTF-8... done</p><p>zh_CN.UTF-8... done</p><p>Generation complete.</p></li></ol>|}
</li>
[[File:zero2w-img173.png]]</divol></liol start="5" style="list-style-type: lower-alpha;"><li><p>Then put '''Google Pinyin''' on topselect </pspan class="mark"><Save><p/span>[[File:zero2w-img196.png]]to save</p><p>[[File:zero2w-img197img83.png]]</p></li><li><p>Then open the '''Geany''' editor to test the Chinese input methodselect <span class="mark"><Back></span></p><p>[[File:zero2w-img198img84.png]]</p></li><li><p>The Chinese input method test is as followsThen select <span class="mark"><Reboot></span> to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img199img85.png]]</p></li></ol></li><p/ol>You can switch between Chinese and English input methods through the '''Ctrl+Space''' shortcut key</p!-- --></liol start="3" style="list-style-type: decimal;"><li><p>If you need After starting the entire Linux system to be displayed in Chinese, you can set all variables in '''first confirm that there is an open i2c device node under <span class="mark">/etcdev</default/locale''' to '''zh_CN.UTF-8'''span></p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo vim ls /etcdev/default/localei2c-*'''</p><p># File generated by update-locale</p><p>LC_MESSAGES='''zh_CN.UTF/dev/i2c-8*'''</p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <pbig>LANG='''zh_CN.UTF-8注意,这里说的Linux镜像具体指的是从Orange Pi资料下载页面下载的Debian或者Ubuntu这样的Linux发行版镜像。'''</pbig>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>LANGUAGE='''zh_CNSometimes the i2c device node and the i2c bus serial number do not correspond one to one.UTFFor example, the i2c device node of the i2c1 bus may be /dev/i2c-83.'''</p></li><li><p>Then '''restart The method to accurately confirm the device node under /dev corresponding to the systemi2c bus is: ''' and you will see that the system is displayed in Chinese.</p><p>[[File:zero2w-img200.png]]</p></li></olbig>
<ol style="list-style-type: decimallower-alpha;"><li><p>First open '''Language SupportFirst run the following command to check the corresponding relationship of i2c'''</p><p>orangepi@orangepizero2w:~$ '''ls /sys/devices/platform/soc*/*/i2c-* | grep "i2c-[[File:zero2w0-img201.png]9]"'''</p><p>/sys/devices/platform/soc/5002000.i2c/i2c-0:</lip><li><p>Then find the '''Chinese (China)''' option/sys/devices/platform/soc/5002400.i2c/i2c-3:</p><p>[[File/sys/devices/platform/soc/5002800.i2c/i2c-4:zero2w-img202.png]]</p><p>/sys/devices/platform/lisoc/5002c00.i2c/i2c-5:</p><li><p>Then please use the left button of the mouse to select '''Chinese (China)''' and hold it down, then drag it up to the starting position/sys/devices/platform/soc/6000000. After dragging, the display will be as shown belowhdmi/i2c-2:</p><p>[[File/sys/devices/platform/soc/7081400.i2c/i2c-1:zero2w-img203.png]]</p></li></ol>
<li><p>'''In the above output'''</p>
<ol style="list-style-type: none;">
<li><p>a) 5002000 is the register base address of the i2c0 bus, and i2c-0 shown behind it is its corresponding i2c device node</p></li>
<li><p>b) 5002400 is the register base address of the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li>
<li><p>c) 5002800 is the register base address of the i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p></li></ol>
</li></ol>
|}
</li></ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>Then select '''Apply Systemstart testing i2c, first install i2c-Wide''' to apply the Chinese settings to the entire systemtools</p><p>[[File{| class="wikitable" style="width:zero2w800px;" |-img204.png]]</p></li><li>| <p>Then set the orangepi@orangepi:~$ '''Keyboard input method system''' system to '''fcitxsudo apt-get update'''</p><p>[[Fileorangepi@orangepi:zero2w-img205.png]]</p></li><li><p>~$ '''Then restart the Linux system to make the configuration take effectsudo'''</p></li><li><p>After re-entering the system, please select '''Do not ask me againapt-get install -y i2c-tools''' in the following interface, and then please decide according to your own preferences whether the standard folder should also be updated to Chinese</p><p>[[File:zero2w-img206.png]]</p>|}</li><li><p>Then you can see that connect an i2c device to the i2c pin of the 40pin connector. Here we take the desktop is displayed in ChineseDS1307 RTC module as an example.</p><p>[[File:zero2w-img207img178.png]]</p></li><li><p>Then we can open use the '''Geanyi2cdetect -y x''' to test command. If the address of the connected i2c device can be detected, it means that the Chinese input methodi2c device is connected correctly. The opening method is as shown in the figure below</p><p>[[File{| class="wikitable" style="background-color:#ffffdc;width:zero2w800px;" |-img208.png]]</p></li>| <libig>'''<p>After opening '''Geany''', Note that x in the i2cdetect -y x command needs to be replaced with the English input method is still serial number of the default. We can switch device node corresponding to the Chinese input method through the i2c bus.'''Ctrl+Space</p>''' shortcut key, and then we can input Chinese.</pbig><p>[[File:zero2w-img209.png]]</p></li></ol>|}
[[File:zero2w-img179.png]]<span id/li></ol><ol start="7" style="installationlist-methodstyle-oftype: decimal;"><li><p>Then you can run the '''ds1307.py''' test program in '''examples''' to read the RTC time</p>{| class="wikitable" style="background-ubuntucolor:#ffffdc;width:800px;" |-22| <big><p>'''Note that the x in i2c-x in the following command needs to be replaced with the serial number of the device node corresponding to the i2c bus.04-system"'''</p></spanbig>|}{| class="wikitable" style== Installation method of Ubuntu 22"width:800px;" |-| <p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p><p>root@orangepi:~/wiringOP-Python/examples# '''python3 ds1307.py --device \'''</p><p>'''"/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 system ===:35:48</p><p>^C</p><p>exit</p>|}</li></ol>
<ol stylespan id="listpin-styleuart-type: decimal;test-1"><li><p>First open '''Language Support'''</p><p>[[File:zero2w-img201.png]]</p></li><li><p>Then find the '''Chinese (China)''' option</p><p>[[File:zero2w-img210.png]]</p></li><li><p>Then please use the left button of the mouse to select '''Chinese (China)''' and hold it down, then drag it up to the starting position. After dragging, the display will be as shown below:</p><p>[[File:zero2w-img211.png]]</p></li></olspan>
<ol start="2" style="list-style-type: decimal;">
<li><p>In Linux systems, uart is turned off by default and needs to be turned on manually before it can be used. The link to the official installation documentation of ROS 1 '''Noetic Ninjemys''' is opening steps are as follows::</p><p>[httpol style="list-style-type://wiki.ros.org/noetic/Installation/Ubuntu '''http://wiki.ros.org/noetic/Installation/Ubuntu''']</p></lilower-alpha;"><li><p>In the official installation documentation of ROS First run '''Noetic Ninjemysorangepi-config''', Ubuntu recommends using Ubuntu20.04, so please ensure that the system used by the development board is Ordinary users remember to add '''Ubuntu20.04 desktop systemsudo'''permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>[httporangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</wiki.ros.org/noetic/Installation li><li><p>Then select '''http://wiki.ros.org/noetic/InstallationSystem''']</p><p>[[File:zero2w-img247img80.png]]</p></li><li><p>Then use the script below to install ros1select '''Hardware'''</p><p>orangepi@orangepi[[File:~$ '''install_roszero2w-img81.sh ros1'''png]]</p></li><li><p>Before using Then use the ROS toolkeyboard's arrow keys to locate the position shown in the picture below, you first need and then use the '''space''' to initialize rosdep. Then when compiling select the source code, serial port you can quickly install some system dependencies and some core components in ROSwant to open.</p></li></ol>
{| class="wikitable" style="width:800px;text-align: center;"|-| '''Multiplexing function in 40pin'''| '''Corresponding dtbo configuration'''|-| '''40pin - uart2'''| '''pi-uart2'''|-| '''40pin - uart3'''| '''Note that when running the following command, you need to ensure that the development board can access github normally, otherwise an error will be reported due to network problems.pi-uart3'''|-| '''40pin - uart4'''| '''The install_ros.sh script will try to modify /etc/hosts and automatically run the following commands. However, this method cannot guarantee that github can be accessed normally every time. If install_ros.sh prompts the following error after installing ros1, please find other ways to allow the linux system of the development board to access github normally, and then manually run the following Order.pi-uart4'''|-| '''40pin - uart5'''| '''ph-uart5'''|}
[[File:zero2w-img175.png]]</ol><ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select '''https<Save>''' to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''<Back>'''</rawp><p>[[File:zero2w-img84.githubusercontentpng]]</p></li><li><p>Then select '''<Reboot>''' to restart the system to make the configuration take effect.com</rosp><p>[[File:zero2w-img85.png]]</rosdistrop></masterli></rosdepol></osxli></ol><!-homebrew- --><ol start="3" style="list-style-type: decimal;"><li><p>After entering the Linux system, first confirm whether there is a uart5 device node under '''<span class="mark">/dev</span>'''</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''注意, linux5.4系统为/dev/ttyASx.yaml'''</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''ls /dev/ttyS*'''</p><p>/dev/ttySx</p>|}</li><li><p>Then start testing the uart interface. First use Dupont wire to short-circuit the rx and tx pins of the uart interface to be tested.</p></li><li><p>Use the '''gpio''' command in wiringOP to test the loopback function of the serial port as shown below. If you can see the following print, it means the serial port communication is normal.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that the last x in the gpio serial /dev/ttySx command needs to be replaced with the serial number of the corresponding uart device node.'''</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''gpio serial /dev/ttySx # linux-6.1 test command'''</p><p>orangepi@orangepi:~$ '''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: -> 3^C</p>|}</li><li><p>Finally, you can run the '''ERROR: error loading sources list:serialTest.py'''program in examples to test the loopback function of the serial port. If you can see the following print, it means that the serial port loopback test is normal.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''The read operation timed outNote that the x in /dev/ttySx or /dev/ttyASx in the command needs to be replaced with the serial number of the corresponding uart device node.'''</p></big>|}{| class="wikitable" style="width:800px;" |-| orangepi<p>root@orangepi:~$ /wiringOP-Python# '''source /opt/ros/noetic/setup.bashcd examples'''</p> orangepi<p>root@orangepi:~$ /wiringOP-Python/examples# '''sudo rosdep initpython3 serialTest.py --device "/dev/ttySx" # linux6.1 use'''</p> Wrote <p>root@orangepi:~/etcwiringOP-Python/rosexamples# '''python3 serialTest.py --device "/rosdepdev/sourcesttyASx" # linux5.list.d4 use'''</20-default.listp>
'''<span idstyle="how-to-install-ros-2-humble-on-ubuntu22.04color:#FF0000">Hello from Docker!</span>=== How to install ROS 2 Humble on Ubuntu22.04 ==='''
'''<ol span style="list-style-typecolor: decimal;#FF0000"><li><p>Use the install_ros.sh script to '''install_ros.sh'''</p><p>orangepi@orangepi:~$ '''install_ros.sh ros2'''</p></li><li><p>The '''install_ros.sh''' script will automatically run the '''ros2 -h''' command after installing ros2. If you can see the following print, it means This message shows that the ros2 your installation is complete.</p><p>usage: ros2 [-h] Call `ros2 <command> -h` for more detailed usage. ...</p><p>ros2 is an extensible command-line tool for ROS 2.</p><p>optional arguments:</p><p>-h, --help show this help message and exit</p><p>Commands:</p><p>action Various action related sub-commands</p><p>bag Various rosbag related sub-commands</p><p>component Various component related sub-commands</p><p>daemon Various daemon related sub-commands</p><p>doctor Check ROS setup and other potential issues</p><p>interface Show information about ROS interfaces</p><p>launch Run a launch file</p><p>lifecycle Various lifecycle related sub-commands</p><p>multicast Various multicast related sub-commands</p><p>node Various node related sub-commands</p><p>param Various param related sub-commands</p><p>pkg Various package related sub-commands</p><p>run Run a package specific executable</p><p>security Various security related sub-commands</p><p>service Various service related sub-commands</p><p>topic Various topic related sub-commands</p><p>wtf Use `wtf` as alias appears to `doctor`</p><p>Call `ros2 <command> -h` for more detailed usagebe working correctly.</p></li><li><pspan>Then you can use the '''test_ros.sh''' script to test whether ROS 2 is successfully installed. If you can see the following print, it means ROS 2 can run normally.</p><p>orangepi@orangepi:~$ '''test_ros.sh'''</p><p>[INFO] [1671174101.200091527] [talker]: Publishing: 'Hello World: 1'</p><p>[INFO] [1671174101.235661048] [listener]: I heard: [Hello World: 1]</p><p>[INFO] [1671174102.199572327] [talker]: Publishing: 'Hello World: 2'</p><p>[INFO] [1671174102.204196299] [listener]: I heard: [Hello World: 2]</p><p>[INFO] [1671174103.199580322] [talker]: Publishing: 'Hello World: 3'</p><p>[INFO] [1671174103.204019965] [listener]: I heard: [Hello World: 3]</p></li><li><p>Run the following command to open rviz2</p><p>orangepi@orangepi:~$ '''source /opt/ros/humble/setup.bash'''</p><p>orangepi@orangepi:~$ '''ros2 run rviz2 rviz2'''</p><p>[[File:zero2w-img254.png]]</p></li><li><p>Reference documentation</p><p>'''http://docs.ros.org/en/humble/index.html'''</p><p>[http://docs.ros.org/en/galactic/Tutorials.html '''http://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html''']</p></li></ol>
When using the docker command, if you are prompted for '''Debian11 system with Linux6.1 kernel will report GCC error when compiling kernel module. So if permission denied''', please add the current user to the docker user group so that you want to compile can run the kernel module, please use Debian12 or Ubuntu22docker command without sudo.04.'''
<span id="debianinstallation-bullseyevia-systemdocker"></span>=== Debian Bullseye system Installation via docker ===
<ol style="list-style-type: decimal;">
<li><p>Debian Bullseye is installed with the gcc compilation tool chain by defaultFirst, which please install docker and ensure that docker can directly compile C language programs in run normally. For the Linux system installation steps of docker, please refer to the instructions in the development board.</p><ol style="list-style-type: lower-alpha;"><li><p>The version of a.gcc is as follows</p><p>orangepi@orangepi:~$ [[Orange Pi Zero 2W#How to install Docker|'''gcc --versionHow to Install Docker'''</p><p>gcc (Debian 10.2.1-6) 10.2.1 20210110</p><p>Copyright (C) 2020 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE]] section.</p></li><li><p>Write Then you can search for the '''hello_world.c''' program in C languagedocker image of Home Assistant</p><p>orangepi@orangepi{| class="wikitable" style="width:~$ '''vim hello_world.c'''</p><p>#include <800px;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.cdocker search homeassistant'''</p><p>orangepi@orangepi:~$ '''./hello_world'''</p><p>Hello World!</p></li></ol>|}
</li>
<li><p>Debian Bullseye has Python3 installed by defaultThen use the following command to download the Docker image of Home Assistant to your local computer. The image size is about 1GB, and the download time will be relatively long. Please be patient and wait for the download to complete.</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>The specific version of Python is as follows</p>|-| <p>orangepi@orangepi:~$ '''python3docker pull homeassistant/home-assistant'''</p><p>Using default tag: latest</p><p>latest: Pulling from homeassistant/home-assistant</p><p>be307f383ecc: Downloading</p><p>5fbc4c07ac88: Download complete</p><p>'''Python 3.9.2.... (Omit some output)''' (default, Feb 28 2021, 17</p><p>3cc6a1510c9f: Pull complete</p><p>7a4e4d5b979f: Pull complete</p><p>Digest: sha256:81d381f5008c082a37da97d8b08dd8b358dae7ecf49e62ce3ef1eeaefc4381bb</p><p>Status:03Downloaded newer image for homeassistant/home-assistant:44)latest</p><p>[GCC 10docker.2.1 20210110] on linuxio/homeassistant/home-assistant:latest</p>|}</li><li><p>Then you can use the following command to view the docker image of Home Assistant you just downloaded</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''docker images homeassistant/home-assistant'''</p><p>Type REPOSITORY "nbsp;help"nbsp; TAG IMAGE ID , "nbsp;copyrightCREATED "nbsp;, "nbsp;credits"nbsp; or "nbsp;license"nbsp; for more information.SIZE</p><p>homeassistant/home-assistant latest bfa0ab9e1cf5 2 months ago >nbsp;>nbsp;>nbsp;'''</pspan style="color:#FF0000">1.17GB<p/span>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p>|}</li><li><p>Write At this point you can run the '''hello_world.py''' program in Python languageHome Assistant docker container</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.pydocker run -d \'''</p>:<p>print('Hello World!')'--name homeassistant \'''</p>:<p>'''--privileged \'''</lip>:<p>'''--restart=unless-stopped \'''<li/p>:<p>The result of running '''hello_world.py-e TZ=Asia/Shanghai \''' is as follows</p>:<p>orangepi@orangepi:~$ '''python3 hello_world.py-v /home/orangepi/home-assistant:/config \'''</p>:<p>Hello World!'''--network=host \'''</p>:<p>'''homeassistant/li>home-assistant:latest'''</olp>|}
</li>
<li><p>Debian Bullseye does not install Java compilation tools and operating environment by default.Then enter【the IP address of the development board: 8123】in the browser to see the Home Assistant interface</p><ol {| class="wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;"><li><p>You can use the following command to install openjdk. The latest > version in Debian Bullseye is openjdk|-17</p><p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''</p></li>| <libig><p>After installation, you can check the Java version.</p><p>orangepi@orangepi:~$ '''java --version'''</p></li><li><p>Write It takes a while for the Java version of '''hello_worldHome Assistant container to start.java'''</p><p>orangepi@orangepi:~$ '''vim hello_worldIf the interface below does not display normally, please wait a few seconds before refreshing it.java'''</p><p>public class hello_world</p><p>{</p><p>public static void main(String[] args)</p><p>{</p><p>SystemIf the following interface is not displayed normally after waiting for more than a minute, it means there is a problem with the Home Assistant installation.out.println("Hello World!");</p><p>}</p><p>}</p></li><li><p>Then compile At this time, you need to check whether there is a problem with the previous installation and run '''hello_worldsetting process.java'''</p><p>orangepi@orangepi:~$ '''javac hello_world.java'''</pbig><p>orangepi@orangepi:~$ '''java hello_world'''</p>|}<p>Hello World!</p></li></ol></li></oldiv class="figure">
<ol style/div></li><li><p>Then enter your '''name, username''' and '''password''' and click '''Create Account'''</p><div class="listfigure"> [[File:zero2w-styleimg181.png]] </div></li><li><p>Then follow the interface prompts to set according to your own preferences, and then click Next</p><div class="figure"> [[File:zero2w-typeimg182.png]] </div></li><li><p>Then click Next</p><div class="figure"> [[File: decimal;zero2w-img183.png]] </div></li><li><p>Then click Finish</p><div class="figure"> [[File:zero2w-img184.png]] </div></li><li><p>Debian Bookworm The main interface finally displayed by Home Assistant is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development boardas shown below</p><p>[[File:zero2w-img185.png]]</p></li><li><p>Method to stop Home Assistant container</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The version of a.gcc command to view the docker container is as follows</p><p>orangepi@orangepi{| class="wikitable" style="width:~$ '''gcc --version'''</p>800px;" <p>gcc (Debian 12.2.0|-14) 12.2.0</p><p>Copyright (C) 2022 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p></li><li><p>Write the '''hello_world.c''' program in C language</p>| <p>orangepi@orangepi:~$ '''vim hello_world.cdocker ps -a'''</p><p>#include <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 defaultThe command to stop the Home Assistant container is as follows</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>The specific version of Python is as follows</p><p>orangepi@orangepi:~$ '''python3'''</p><p>Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux</p><p>Type "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.pydocker stop homeassistant'''</p><p>Hello World!</p></li></ol>|}
</li>
<li><p>Debian Bookworm does not install Java compilation tools and operating environment by default.The command to delete the Home Assistant container is as follows</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>You can use the following command to install openjdk. The latest > version in Debian Bookworm is openjdk|-17</p><p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''</p></li><li><p>After installation, you can check the Java version.</p>| <p>orangepi@orangepi:~$ '''java --version'''</p></li><li><p>Write the Java version of '''hello_world.javadocker rm homeassistant'''</p><p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p><p>public static void main(String[] args)</p><p>{</p><p>System.out.println("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="ubuntuinstallation-focalvia-systempython"></span> === Ubuntu Focal system Installation via python === {| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Before installation, please change the source of pip to a domestic source to speed up the installation of Python packages. For the configuration method, see the instructions in the section "[[Orange Pi Zero 2W#How to replace pip source in Python|How to Change the Pip Source of Python]]"'''</big>|}
<ol style="list-style-type: decimal;">
<li><p>Ubuntu Focal is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.First install dependency packages</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>The version of a.gcc is as follows</p>|-| <p>orangepi@orangepi:~$ '''gcc -sudo apt-versionget update'''</p><p>gcc (Ubuntu 9.4.0orangepi@orangepi:~$ '''sudo apt-1ubuntu1~20.04.1) 9.4.0</p><p>Copyright (C) 2019 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NOget install -y python3 python3-dev python3-venv \'''</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p></li><li><p>Write the '''hello_world.cpython3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \''' program in C language</p><p>orangepi@orangepi:~$ '''vim hello_world.clibopenjp2-7 libtiff5 libturbojpeg0-dev tzdata'''</p><p>#include <stdio.h></p><p>int main(void)</p>|}<p>{</p><p>printf("| class="wikitable" style="background-color:#ffffdc;Hello World!\n"width:800px;);</p>" <p>return 0;</p>|-<p>}</p></li>| <libig><p>Then compile and run '''hello_world.cIf it is debian12, please use the following command:'''</p></big><p>orangepi@orangepi:~$ '''gcc sudo apt-o hello_world hello_world.cget update'''</p><p>orangepi@orangepi:~$ '''./hello_worldsudo apt-get install -y python3 python3-dev python3-venv \'''</p><p>Hello World!'''python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \'''</p></lip>'''libopenjp2-7 libturbojpeg0-dev tzdata'''</olp>|}
</li>
<li><p>Ubuntu Focal has Then you need to compile and install Python3 installed by default.9. For the method, please refer to the [[Orange Pi Zero 2W#Python related instructions|'''Python source code compilation and installation method''']] section.</p><ol {| class="wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;">|-| <libig><p>'''The specific default Python version of Debian Bullseye is Python3 is as follows</p><p>orangepi@orangepi:~$ '''python3'''</p><p>Python 3.8.10 (default, Nov 14 2022, 12:59:47)</p><p>[GCC 9.4.0] on linux</p><p>Type "help", "copyright", "credits" or "license" for more information.</p><p>>>></p><p>'''Use the Ctrl+D shortcut key so there is no need to exit python's interactive modecompile and install it.'''</p></li><li><p>Write the '''hello_worldThe default Python version of Ubuntu Jammy is Python3.10, so there is no need to compile and install it.py''' program in Python language</p><p>orangepi@orangepi:~$ '''vim hello_world.py'''</p><p>print('Hello World!')</p></li><li><p>The result default Python version of running '''hello_worldDebian Bookworm is Python3.py''' 11, so there is as follows</p><p>orangepi@orangepi:~$ '''python3 hello_worldno need to compile and install it.py'''</p><p>Hello World!</p></li></olbig>|}
</li>
<li><p>Ubuntu Focal does not have Java compilation tools and running Then create a Python virtual environment installed by default.</p><ol {| class="wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;"><li><p>You can use the following command to install openjdk|-17</p><p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''</p></li>| <libig><p>After installation, you can check the Java version.</p><p>orangepi@orangepi:~$ '''java --version'''</p><p>openjdk 17Debian Bookworm is python3.0.2 2022-01-18</p><p>OpenJDK Runtime Environment (build 17.0.2+8-Ubuntu-120.04)</p><p>OpenJDK 64-Bit Server VM (build 17.0.2+8-Ubuntu-120.0411, mixed mode, sharing)</p></li><li><p>Write please remember to replace the Java version of '''hello_worldcorresponding command.java'''</p><p>orangepi@orangepi:~$ '''vim hello_world.java'''</pbig><p>public class hello_world</p>|}<p>{</p><p>public static void main(String[] args)</p><p>{</p><p>System.out.println("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| class="ubuntu-jammy-systemwikitable"></span>=== Ubuntu Jammy system === <ol style="list-style-typewidth: decimal800px;"><li><p>Ubuntu Jammy is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.</p><ol style="list-style-type: lower|-alpha;"><li><p>The version of a.gcc is as follows</p>| <p>orangepi@orangepi:~$ '''gcc --versionsudo mkdir /srv/homeassistant'''</p><p>gcc (Ubuntu 11.3.0-1ubuntu1orangepi@orangepi:~22.04.1) $ '''11.3.0'''<sudo chown orangepi:orangepi /p><p>Copyright (C) 2021 Free Software Foundation, Inc.<srv/p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p></li><li><p>Write the 'homeassistant''hello_world.c''' program in C language</p><p>orangepi@orangepi:~$ '''vim hello_world.c'''</p><p>#include <stdio.h><cd /p><p>int main(void)<srv/p><p>{</p><p>printf("Hello World!\n");</p><p>return 0;</p><p>}</p></li><li><p>Then compile and run '''hello_world.chomeassistant'''</p><p>orangepi@orangepi:~$ '''gcc python3.9 -o hello_world hello_worldm venv .c'''</p><p>orangepi@orangepi:~$ '''.source bin/hello_worldactivate'''</p><p>Hello World!<(homeassistant) orangepi@orangepi:/p><srv/li>homeassistant$</olp>|}
</li>
<li><p>Ubuntu Jammy has Python3 installed by defaultThen install the required Python packages</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>The specific version of Python3 is as follows</p>|-| <p>(homeassistant) orangepi@orangepi:~/srv/homeassistant$ '''python3-m pip install wheel'''</p><p>Python 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0] on linux</p><p>Type "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 languageThen you can install Home Assistant Core</p>{| class="wikitable" style="width:800px;" |-| <p>(homeassistant) orangepi@orangepi:~/srv/homeassistant$ '''vim hello_world.pypip3 install homeassistant'''</p><p>print('Hello World!')</p>|}</li><li><p>The result of running '''hello_world.py''' is as followsThen enter the following command to run Home Assistant Core</p>{| class="wikitable" style="width:800px;" |-| <p>(homeassistant) orangepi@orangepi:~/srv/homeassistant$ '''python3 hello_world.pyhass'''</p><p>Hello World!</p></li></ol>|}
</li>
<li><p>Ubuntu Jammy does not install Java compilation tools and operating environment by default.Then enter【'''development board IP address: 8123'''】 in the browser to see the Home Assistant interface</p><ol {| class="wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;"><li><p>You can use the following command to install openjdk|-18| </pbig><p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-18-jdk'''</p></li><li><p>After installation, When you can check run the Java versionhass command for the first time, some libraries and dependency packages necessary for operation will be downloaded, installed and cached.</p><p>orangepi@orangepi:~$ '''java --version'''</p><p>openjdk 18This process may take several minutes.0.2-ea 2022-07-19</p><p>OpenJDK Runtime Environment (build 18.0.2-ea+9-Ubuntu-222.04)</p><p>OpenJDK 64-Bit Server VM (build 18.0.2-ea+9-Ubuntu-222.04, mixed mode, sharing)</p></li><li><p>Write Note that you cannot see the Home Assistant interface in the Java version of '''hello_worldbrowser at this time.java'''</p><p>orangepi@orangepi:~$ '''vim hello_worldPlease wait for a while and then refresh it.java'''</p><p>public class hello_world</p><p>{</p><p>public static void main(String[] args)</p><p>{</p><p>System.out.println("Hello World!");</pbig><p>|}</p><p>}</p></lidiv class="figure"><li><p>Then compile and run '''hello_world.java'''</p><p>orangepi@orangepi[[File:~$ '''javac hello_worldzero2w-img180.java'''</p>png]]<p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</pdiv></li></ol></li></ol>
<span id="methodopencv-ofinstallation-uploading-files-to-the-development-board-linux-systemmethod"></span>== Method of uploading files to the development board Linux system ==
<span id="howuse-apt-to-upload-files-using-scpinstall-commandopencv"></span>==== How Use apt to upload files using scp command =install OpenCV ===
<ol style="list-style-type: decimal;">
<li><p>Use The installation command is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y libopencv-dev python3-opencv'''</p>|}</li><li><p>Then use the scp following command to upload files to print the Linux system version number of the development board in Ubuntu PCOpenCV. The specific command output is normal, indicating that the OpenCV installation is as followssuccessful.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The version of OpenCV in Ubuntu22.04 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 -c "import cv2; print(cv2.__version__)"'''</p><p>'''file_path: 4.5.4'''Needs to be replaced with the path of the file to > be uploaded</p>|}</li><li><p>'''The version of OpenCV in Ubuntu20.04 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi: ~$ '''This is the user name of the development board's python3 -c >quot;import cv2; Linux systemprint(cv2. It can also be replaced with something else, __version__)>quot; such as root.'''</p></li><li><p>'''1924.1682.xx.xx:0''' This is the IP address of the development > board. Please modify it according to the actual situation.</p>|}</li><li><p>'''/home/orangepi:''' The path version of OpenCV in the development board Linux > system can also be modified to other paths.Debian11 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>testorangepi@testorangepi:~$ '''scp file_path orangepi@192python3 -c "import cv2; print(cv2.168.xx.xx:/home/orangepi/__version__)"'''</p></lip>'''4.5.1'''</olp>|}
</li>
<li><p>If you want to upload a folder, you need to add the -r parameterThe version of OpenCV in Debian12 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>testorangepi@testorangepi:~$ '''scp python3 -r dir_path orangepi@192c "import cv2; print(cv2.168.xx.xx:/home/orangepi/__version__)"'''</p><p>'''4.6.0'''</lip>|}</li><p>There are more usages of scp, please use the following command to view the man manual</pol></li></ol>
<ol style="list-style-type: decimal;"><li><p>First set the default '''locale''' to Chinese</p><ol style="list-style-type: lower-alpha;"><li><p>Enter the following command to start configuring '''locale'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo dpkg-reconfigure locales'''</p>|}</li><li><p>Then select '''zh_CN.UTF-8 UTF-8''' in the pop-up interface (use the up and down keys on the keyboard to move up and down, use the space bar to select, and finally use the Tab key to move the cursor to '''<OK>''', and then return Car can be used)</p><p>[[File:zero2w-img186.png]]</p></li><li><p>Then set the default '''locale''' to '''zh_CN.UTF-8'''</p><p>[[File:zero2w-img187.png]]</divp></li><li><p>After exiting the interface, the '''locale''' setting will begin. The method of connecting output displayed on the development board command line is as shown in the figure belowfollows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo dpkg-reconfigure locales'''</p><p>Generating locales (this might take a while)...</p>:<p>en_US.UTF-8... done</p>:<p>zh_CN.UTF-8... done</p><p>Generation complete.</p>|}</li></ol></li><li><p>Then open '''Input Method'''</p><p>[[File:zero2w-img188.png]]</p></li><li><p>Then select '''OK'''</p><p>[[File:zero2w-img189.png]]</p></li><li><p>Then select '''Yes'''</p><p>[[File:zero2w-img190.png]]</p></li><li><p>Then select '''fcitx'''</p><p>[[File:zero2w-img191.png]]</p></li><li><p>Then select '''OK'''</p><p>[[File:zero2w-img192.png]]</p></li><div classli><p>'''<span style="figurecolor:#FF0000">Then restart the Linux system to make the configuration take effect.</span>'''</p></li><li><p>Then open '''Fcitx configuration'''</p><p>[[File:zero2w-img256img193.png]]</p></li><li><p>Then click the + sign as shown in the picture below</p><p>[[File:zero2w-img194.png]]</p></li><li><p>Then search '''Google Pinyin''' and click '''OK'''</p><div class="figure">
</div ></li><li><p>Then put '''Google Pinyin''' on top</p><p>[[File:zero2w-img196.png]]</p><p>[[File:zero2w-img197.png]]</p></li><li><p>Then open the '''Geany''' editor to test the Chinese input method</p><p>[[File:zero2w-img198.png]]</p></li><li><p>The Chinese input method test is as follows</p><p>[[File:zero2w-img199.png]]</p></li><li><p>You can switch between Chinese and English input methods through the '''Ctrl+Space''' shortcut key</p></li><li><p>If you need the entire system to be displayed in Chinese, you can set all variables in '''/etc/default/locale''' to '''zh_CN.UTF-8'''</p>{| class="figurewikitable"style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo vim /etc/default/locale'''</p><p># File generated by update-locale</p><p>LC_MESSAGES='''<span style="color:#FF0000">zh_CN.UTF-8</span>'''</p><p>LANG='''<span style="color:#FF0000">zh_CN.UTF-8</span>'''</p><p>LANGUAGE='''<span style="color:#FF0000">zh_CN.UTF-8</span>'''</p>|}</li><li><p>Then '''<span style="color:#FF0000">restart the system</span>''' and you will see that the system is displayed in Chinese.</p><p>[[File:zero2w-img200.png]]</p></li></ol>
<div ol style="list-style-type: decimal;"><li><p>First open '''Language Support'''</p><p>[[File:zero2w-img201.png]]</p></li><li><p>Then find the '''Chinese (China)''' option</p><p>[[File:zero2w-img202.png]]</p></li><li><p>Then please use the left button of the mouse to select '''Chinese (China)''' and hold it down, then drag it up to the starting position. After dragging, the display will be as shown below:</p><p>[[File:zero2w-img203.png]]</p></li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note that this step is not easy to drag, please be patient and try it a few times.'''</big>|}</ol><ol start="4" style="list-style-type: decimal;"><li><p>Then select '''Apply System-Wide''' to apply the Chinese settings to the entire system</p><p>[[File:zero2w-img204.png]]</p></li><li><p>Then set the '''Keyboard input method system''' system to '''fcitx'''</p><p>[[File:zero2w-img205.png]]</p></li><li><p>'''<span style="color:#FF0000">Then restart the Linux system to make the configuration take effect</span>'''</p></li><li><p>After re-entering the system, please select '''Do not ask me again''' in the following interface, and then please decide according to your own preferences whether the standard folder should also be updated to Chinese</p><p>[[File:zero2w-img206.png]]</p></li><li><p>Then you can see that the desktop is displayed in Chinese</p><p>[[File:zero2w-img207.png]]</p></li><li><p>Then we can open '''Geany''' to test the Chinese input method. The opening method is as shown in the figure"below</p><p>[[File:zero2w-img208.png]]</p></li><li><p>After opening '''Geany''', the English input method is still the default. We can switch to the Chinese input method through the '''Ctrl+Space''' shortcut key, and then we can input Chinese.</p><p>[[File:zero2w-img209.png]]</p></li></ol>
<ol style="list-style-type: decimal;">
<li><p>First open '''Language Support'''</p>
<p>[[File:zero2w-img201.png]]</p></li>
<li><p>Then find the '''Chinese (China)''' option</p>
<p>[[File:zero2w-img210.png]]</p></li>
<li><p>Then please use the left button of the mouse to select '''Chinese (China)''' and hold it down, then drag it up to the starting position. After dragging, the display will be as shown below:</p>
<p>[[File:zero2w-img211.png]]</p></li>
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|
<big>'''Note that this step is not easy to drag, please be patient and try it a few times.'''</big>
|}
</ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>Then select '''Apply System-Wide''' to apply the Chinese settings to the entire system</p>
<p>[[File:zero2w-img212.png]]</p></li>
<li><p>'''<span style="color:#FF0000">Then restart the Linux system to make the configuration take effect</span>'''</p></li>
<li><p>After re-entering the system, please select '''Do not ask me again''' in the following interface, and then please decide whether the standard folder should also be updated to Chinese according to your own preferences.</p>
<p>[[File:zero2w-img206.png]]</p></li>
<li><p>Then you can see that the desktop is displayed in Chinese</p>
<p>[[File:zero2w-img207.png]]</p></li>
<li><p>Then open the Fcitx5 configuration program</p>
<p>[[File:zero2w-img213.png]]</p></li>
<li><p>Then choose to use Pinyin input method</p>
<div class="figure">
[[File:zero2w-img260img214.png]]
</div></li><li><p>The interface after selection is as shown below, then click OK</p><ol start="9" style="listp>[[File:zero2w-style-type: decimal;"img215.png]]</p></li><li><p>After the upload is completed, you Then we can go open '''Geany''' to test the corresponding path Chinese input method. The opening method is as shown in the development board Linux system to view the uploaded filefigure below</p><p>[[File:zero2w-img208.png]]</p></li><li><p>The After opening '''Geany''', the English input method of uploading a folder is still the same as default. We can switch to the Chinese input method of uploading a filethrough the '''Ctrl+Space''' shortcut key, so I won't go into details hereand then we can enter Chinese.</p><p>[[File:zero2w-img216.png]]</p></li></ol>
<span id="methodhow-to-uploadremotely-fileslog-from-windows-pcin-to-development-boardthe-linux-system-desktop"></span>=== Method to upload files from Windows PC to development board Linux system ===
<div ol style="list-style-type: decimal;"><li><p>First download the installation package of the NoMachine software Linux '''<span style="color:#FF0000">arm64</span>''' deb version, and then install it into the Linux system of the development board</p><ol style="list-style-type: lower-alpha;"><li>Since H618 is an ARMv8 architecture SOC and the system we use is Ubuntu or Debian, we need to download the '''NoMachine for ARM ARMv8 DEB''' installation package. The download link is as follows:</li>{| class="figurewikitable" style="background-color:#ffffdc;width:800px;"|-| <big>'''Note that this download link may change, please look for the Armv8/Arm64 version of the deb package.'''</big>|}{| class="wikitable" style="width:800px;" |-| [https://www.nomachine.com/download/download&id=112&s=ARM '''https://downloads.nomachine.com/download/?id=118&distro=ARM''']|}
[[File:zero2w-img262img217.png]]</ol><ol start="2" style="list-style-type: lower-alpha;"><li><p>In addition, you can also download the '''NoMachine''' installation package from the official tool.</p><p>[[File:zero2w-img218.png]]</p><p>First enter the '''remote login software-NoMachine''' folder</p><p>[[File:zero2w-img219.png]]</p><p>Then download the arm64 version of the deb installation package</p><p>[[File:zero2w-img220.png]]</p></li><li><p>Then upload the downloaded '''nomachine_x.x.x_x_arm64.deb''' to the Linux system of the development board</p></li><li><p>Then use the following command to install '''NoMachine''' in the Linux system of the development board</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo dpkg -i nomachine_x.x.x_x_arm64_arm64.deb'''</p>|}</li></ol></li></divol>
<ol start="2" style="list-style-type: decimal;">
<li><p>The downloaded Then download the installation package of the Windows version of the NoMachine software. The download address is as shown below, then double-click to install it directlyfollows</pli>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <pbig>'''FileZilla_Server_1Note that this download link may change.5.1_win64-setup.exe'''</pbig><|}{| class="wikitable" style="width:800px;" |-| '''https://downloads.nomachine.com/li><download/ol>?id=9'''|}
<div class="figure"p>New 'X' desktop is orangepi:1</p>
<p>Creating default startup script /divroot/.vnc/xstartup</p><ol start="5" style="list-style-type: decimal;"p>Starting applications specified in /root/.vnc/xstartup</p><lip>Then choose to '''save the password''' and click '''OK'''<Log file is /root/.vnc/li>orangepi:1.log</olp>
<div class="figure"p>New 'X' desktop is orangepi:1</p>
<p>Starting applications specified in /root/.vnc/xstartup</divp><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="7" style="list-style-type: decimallower-alpha;"><li>After the connection is successfulFirst click Session, then select VNC, you can see then fill in the directory structure IP address and port of the development board's Linux file system on the right side of the filezilla software, and finally click OK to confirm.</li></ol>
<div class="figure">
[[File:zero2w-img267img227.png]]
</div></ol><ol start="82" style="list-style-type: decimallower-alpha;"><li><p>Then select enter the path to be uploaded to the development board on the right side of the filezilla software, select the file to be uploaded on the Windows PC on the left side of the filezilla softwareVNC password set earlier</p><p>[[File:zero2w-img228.png]]</p></li><li><p>After successful login, right-click the mouseinterface is displayed as shown below, and then click you can remotely operate the upload option to start uploading the file to desktop of the development boardLinux system.</lip></olli>
[[File:zero2w-img229.png]]<div class/ol></li></ol><span id="figureqt-installation-method"></span>
<ol style="list-style-type: decimal;">
<li><p>The power onUse the following script to install QT5 and QT Creator</off logo will only be displayed on the desktop version of the system by defaultp>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''install_qt.sh'''</p>|}</li><li><p>Set After installation, the QT version number will be automatically printed.</p><ol style="list-style-type: lower-alpha;"><li><p>The qt version that comes with Ubuntu20.04 is '''bootlogo5.12.8''' variable to </p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''falseinstall_qt.sh''' in </p><p>......</p><p>QMake version 3.1</p><p>Using Qt version '''<span style="color:#FF0000">5.12.8</span>'''in /usr/lib/aarch64-linux-gnu</bootp>|}</orangepiEnvli><li><p>The QT version that comes with Ubuntu22.txt04 is ''' to turn off the switch logo5.15.3'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo vim /boot/orangepiEnvinstall_qt.txtsh'''</p><p>verbosity=......</p><p>QMake version 3.1</p><p>Using Qt version '''bootlogo<span style=false"color:#FF0000">5.15.3</span>'''in /usr/lib/aarch64-linux-gnu</p>|}</li><li><p>Set the The QT version that comes with Debian11 is '''bootlogo''' variable to '''true''' in '''/boot/orangepiEnv5.15.txt2''' to enable the power on/off logo.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo vim /boot/orangepiEnvinstall_qt.txtsh'''</p><p>verbosity=......</p><p>QMake version 3.1</p><p>Using Qt version '''bootlogo<span style=true"color:#FF0000">5.15.2</span>'''in /usr/lib/aarch64-linux-gnu</p>|}</li><li><p>The location of the boot logo picture in the Linux system QT version that comes with Debian12 is'''5.15.8'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''install_qt.sh'''</usrp><p>......</sharep><p>QMake version 3.1</plymouthp><p>Using Qt version '''<span style="color:#FF0000">5.15.8</themes/orangepi/watermark.pngspan>'''in /usr/lib/aarch64-linux-gnu</p>|}</li></ol></li><li><p>After replacing Then you can see the boot logo image, you need to run QT Creator startup icon in '''Applications'''</p><p>[[File:zero2w-img230.png]]</p><p>You can also use the following command to take effectopen QT Creator</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo update-initramfs -uqtcreator'''</p>|}</li></ol> <span id="how-to-turn-on-the-power-button-in-linux5.4"li></spanp>== How to turn on the power button in Linux5.4 == There The interface after QT Creator 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 opened is as follows:</p><p>[[File:zero2w-img269img231.png]]</p></li> <li><p>The power on/off button version of the Linux 6.1 image QT Creator 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:</p><ol style="list-style-type: decimallower-alpha;"><li><p>First run '''orangepi-configThe default version of QT Creator in '''Ubuntu20. Ordinary users remember to add 04'''sudo''' permissions.is as follows</p><p>orangepi@orangepi[[File:~$ '''sudo orangepizero2w-config'''img232.png]]</p></li><li><p>Then select The default version of QT Creator in '''SystemUbuntu22.04'''is as follows</p><p>[[File:zero2w-img80img233.png]]</p></li><li><p>Then select The default version of QT Creator in '''HardwareDebian11'''is as follows</p><p>[[File:zero2w-img81img234.png]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown The default version of QT Creator in the picture below, and then use the '''spaceDebian12''' to select the dtbo configuration of the SPI you want to open.is as follows</p><p>[[File:zero2w-img270img235.png]]</p></li></ol></li><li><p>Then select set up QT</p><ol style="list-style-type: lower-alpha;"><li><p>First open '''<SaveHelp'''->''' to saveAbout Plugins...'''.</p><p>[[File:zero2w-img83img236.png]]</p></li><li><p>Then select remove the check mark of '''<Back>ClangCodeModel'''</p><p>[[File:zero2w-img84img237.png]]</p></li><li><p>Then select '''<Reboot>''' <span style="color:#FF0000">After setting up, you need to restart the system to make the configuration take effect.QT Creator</pspan>'''</p>[[File:zero2w-img85.png]]</pli></li></olp> <span id="how-Then make sure the GCC compiler used by QT Creator. If the default is Clang, please change it to-shut-down-and-restart-the-development-board">GCC.</spanp>{| class== How to shut down and restart the development board == <ol "wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;">|-| <libig><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 '''poweroffDebian12 please skip this step.''' command to shut down the Linux system of the development board before powering off, and then unplug the power supply.</p></big>|}<p>orangepi@orangepi[[File:~$ '''sudo poweroff'''zero2w-img238.png]]</p><p>'''Note that after turning off the development board, you need to unplug and replug the power supply before it can be turned on[[File:zero2w-img239.'''png]]</p></li></ol></li><li><p>In addition to using the poweroff command to shut down, Then you can also use the power on/off button on the expansion board to shut down.open a sample code</p><p>[[File:zero2w-img269img240.png]]</p></li><li><p>'''Note that Linux 5.4 requires manual configuration of the power After clicking on/off button before it can be used. For the opening methodsample code, please refer to the method of opening corresponding instruction document will automatically open. You can read the power button in Linux5instructions carefully.4</p><p>[[File:zero2w-img241.'''png]]</p></li><li><p>Use the Then click '''rebootConfigure Project''' command to restart </p><p>[[File:zero2w-img242.png]]</p></li><li><p>Then click the Linux system green triangle in the development boardlower left corner to compile and run the sample code</p><p>orangepi@orangepi[[File:~$ '''sudo''' '''reboot'''zero2w-img243.png]]</p></li><li><p>After waiting for a period of time, the interface shown in the figure below will pop up, which means that QT can compile and run normally.</olp> <span id="linuxp>[[File:zero2w-sdkorangepi-build-usage-instructions"img244.png]]</p></spanli> = '''Linux SDK——orangepi-build usage instructions''' = <span id="compilation-system-requirements"li><p>References</spanp>{| class="wikitable" style= Compilation system requirements =="width:800px;" |-| The Linux SDK, <p>[https://wiki.qt.io/Install_Qt_5_on_Ubuntu '''orangepi-buildhttps://wiki.qt.io/Install_Qt_5_on_Ubuntu''', only supports running on X64 computers with ]</p><p>[https://download.qt.io/archive/qtcreator '''Ubuntu 22https://download.04qt.io/archive/qtcreator''' installed]</p><p>[https://download. Therefore, before downloading orangepi-build, please first ensure that the Ubuntu version installed on your computer is Ubuntu 22qt.04. The command to check the Ubuntu version installed on the computer is as follows. If the Release field does not display io/archive/qt '''22https://download.qt.04io/archive/qt''', it means that the Ubuntu version currently used does not meet the requirements. Please change the system before performing the following operations.]</p>|}test@test:~$ '''lsb_release -a'''</li></ol>
::{| class="wikitable" style="width:800px;" |-| [httpshttp://repodocs.huaweicloudros.comorg/ubuntu-releases/21.04/ubuntu-21.04-desktop-amd64.iso '''httpshttp://mirrorsdocs.tuna.tsinghua.edu.cn/ubuntu-releases/22.04/ubuntu-22.04-desktop-amd64ros.isoorg''']
<ol start="2" style="list-style-type: lower-alphadecimal;"><li><p>The link to the official installation documentation of ROS 1 '''Noetic Ninjemys''' is as follows:</p>{| class="wikitable" style="width:800px;"|-| <p>[http://wiki.ros.org/noetic/Installation/Ubuntu '''http://wiki.ros.org/noetic/Installation/Ubuntu''']</p>|}</li><li>For <p>In the method official installation documentation of replacing Tsinghua SourceROS '''Noetic Ninjemys''', Ubuntu recommends using Ubuntu20.04, so please refer ensure that the system used by the development board is '''<span style="color:#FF0000">Ubuntu20.04 desktop system</span>'''.</p>{| class="wikitable" style="width:800px;" |-| <p>[http://wiki.ros.org/noetic/Installation '''http://wiki.ros.org/noetic/Installation''']</p><p>[[File:zero2w-img247.png]]</p>|}</li><li><p>Then use the script below to install ros1</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''install_ros.sh ros1'''</p>|}</li><li><p>Before using the ROS tool, you first need to initialize rosdep. Then when compiling the instructions on this pagesource code, you can quickly install some system dependencies and some core components in ROS.</p></li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''<span style="color:#FF0000">Note that when running the following command, you need to ensure that the development board can access github normally, otherwise an error will be reported due to network problems.</olspan>'''
::'''<span style="color:# FF0000">The read operation timed out</span>'''</big>|}{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''source code image is commented by default to improve apt update speed. You can uncomment it yourself if necessary/opt/ros/noetic/setup.bash'''
updated cache in /home/orangepi/.ros/rosdep/sources.cache|}</ol><ol start="6" style="list-style-type: 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 testwhether ROS can be used normally.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@testorangepi:~$ '''test_ros.sh'''</orangepi-build$ p>|}</li><li><p>After running the '''lstest_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>
<span id/div></ol><ol start="9" style="download-thelist-crossstyle-compilation-tool-chaintype: decimal;"><li><p>At this time, press the direction keys on the keyboard to control the little turtle to move up, down, left, and right.</spanp>=== Download the cross<p>[[File:zero2w-compilation tool chain ===img250.png]]</p></li></ol>
<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-img273img251.png]]</p><p>[[File:zero2w-img252.png]]</p>{| class="wikitable" style="width:800px;" |-| <p>[http://docs.ros.org/ '''http://docs.ros.org''']</p><p>'''http://docs.ros.org/en/galactic/Releases.html'''</p>|}</li><li><p>The link to the official installation documentation of ROS 2 '''Galactic Geochelone''' is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>'''docs.ros.org/en/galactic/Installation.html'''</p><p>'''http://docs.ros.org/en/galactic/Installation/Ubuntu-Install-Debians.html'''</p>|}</li><li><p>In the official installation documentation of ROS 2 '''Galactic Geochelone''', Ubuntu Linux recommends using Ubuntu20.04, so please ensure that the system used by the development board is the '''<span style="color:#FF0000">Ubuntu20.04 desktop system</span>'''. There are several ways to install ROS 2. The following demonstrates how to install ROS 2 '''Galactic Geochelone''' through '''Debian packages'''.</p></li><li><p>Use the '''install_ros.sh''' script to install ros2</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''install_ros.sh ros2'''</p>|}</li><li><p>The '''install_ros.sh''' script will automatically run the '''ros2 -h''' command after installing ros2. If you can see the following print, it means that the ros2 installation is complete.</p>{| class="wikitable" style="width:800px;" |-| <p>usage: ros2 [-h] Call `ros2 <command> -h` for more detailed usage. ...</p>
<ol stylespan id="listhow-styleto-type: lowerinstall-alpha;ros-2-humble-on-ubuntu22.04"><li>v2018.05</li></olspan>
<ol style="list-style-type: decimal;">
<li><p>After downloading, the orangepi-build warehouse does not contain Use the source code of the linux kernel, u-boot and cross-compilation tool chaininstall_ros. The source code of the linux kernel and u-boot is stored in an independent git warehousesh script to '''install_ros.sh'''</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"|-| <p>orangepi@orangepi:~$ '''install_ros.sh ros2'''</p>|}</li><li><p>The git warehouse where '''install_ros.sh''' script will automatically run the linux kernel source code is stored is as follows'''ros2 -h''' command after installing ros2. Please note If you can see the following print, it means that the branch of the linux-orangepi warehouse ros2 installation is switched tocomplete.</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li>Linux5.4</li></ol>|-</li></ol>| </lip>usage: ros2 [-h] Call `ros2 <command> -h` for more detailed usage. ...</olp>
<ol start="p>ros2 is an extensible command-line tool for ROS 2" style="list-style-type: lower-alpha;"><li>Linux6.1</li></olp>
<ol start="2" style="listp>Commands:</p>:<p>action Various action related sub-commands</p>:<p>bag Various rosbag related sub-commands</p>:<p>component Various component related sub-commands</p>:<p>daemon Various daemon related sub-commands</p>:<p>doctor Check ROS setup and other potential issues</p>:<p>interface Show information about ROS interfaces</p>:<p>launch Run a launch file</p>:<p>lifecycle Various lifecycle related sub-stylecommands</p>:<p>multicast Various multicast related sub-typecommands</p>: lower<p>node Various node related sub-alpha;"commands</p>:<lip>v2021.07param Various param related sub-commands</lip>:<p>pkg Various package related sub-commands</p>:<p>run Run a package specific executable</p>:<p>security Various security related sub-commands</p>:<p>service Various service related sub-commands</p>:<p>topic Various topic related sub-commands</p>:<p>wtf Use `wtf` as alias to `doctor`</olp>
:<ol start="2" style="listp>Call `ros2 <command> -style-type: decimal;"h` for more detailed usage.</p>|}</li><li><p>When orangepi-build Then you can use the '''test_ros.sh''' script to test whether ROS 2 is run for successfully installed. If you can see the first timefollowing print, it will download the cross-compilation tool chain, u-boot and linux kernel source codemeans ROS 2 can run normally. After successfully compiling a linux image, the files and folders that can be seen in orangepi-build are:</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li>|-| <p>orangepi@orangepi:~$ '''buildtest_ros.sh''': Compile startup script</p></li><li><p>[INFO] [1671174101.200091527] [talker]: Publishing: 'Hello World: 1''external''': Contains the configuration files needed to compile the image, scripts for specific functions, and the source code of some programs. The rootfs compressed package cached during the image compilation process is also stored in external.</p><p>[INFO] [1671174101.235661048] [listener]: I heard: [Hello World: 1]</lip><li><p>[INFO] [1671174102.199572327] [talker]: Publishing: 'Hello World: 2''kernel''': Store the source code of the linux kernel</p><p>[INFO] [1671174102.204196299] [listener]: I heard: [Hello World: 2]</lip><li><p>[INFO] [1671174103.199580322] [talker]: Publishing: 'Hello World: 3''LICENSE''': GPL 2 license file</p></li><li><p>'''README[INFO] [1671174103.md'''204019965] [listener]: I heard: [Hello World: orangepi-build documentation3]</p>|}</li><li><p>Run the following command to open rviz2</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''outputsource /opt/ros/humble/setup.bash''': Store compiled u-boot, linux and other deb packages, compilation logs, and compiled images and other files</p></li><li><p>orangepi@orangepi:~$ '''scriptsros2 run rviz2 rviz2''': Common script for compiling linux images</p></li><li><p>'''toolchains'''[[File: Store crosszero2w-compilation tool chainimg254.png]]</p>|}</li><li><p>Reference documentation</p>{| class="wikitable" style="width:800px;" |-| <p>'''u-boothttp://docs.ros.org/en/humble/index.html''': Store the source code of u-boot</p></li><li><p>[http://docs.ros.org/en/galactic/Tutorials.html '''userpatcheshttp://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html''': Store the configuration files needed to compile the script]</p></li></ol>|}
</li></ol>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Debian11 system with <span idstyle="compile-u-bootcolor:#FF0000">Linux6.1</span> kernel will report GCC error when compiling kernel module. So if you want to compile the kernel module, please use Debian12 or Ubuntu22.04.'''</big>== Compile u-boot ==|}
</li>
<li><p>If you select Use the next branch, you will also be prompted '''rmmod''' command to select uninstall the memory size, and you do not need to select the current branch'''hello.ko''' kernel module</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:/usr/src/hello$ '''sudo rmmod hello'''</p><p>orangepi@orangepi:/usr/src/hello$ '''dmesg | grep "Hello"'''</p><p>[ 2871.893988] Hello Orange Pi -- init</p><p>[ 3173.800892] '''Hello Orange Pi -- exit'''</p>|}</li></ol>
<blockquotespan id="testing-of-some-programming-languages-supported-by-linux-system"></span>a. If the development board you purchased has a memory size of 1.5GB, please select the first option.
<ol startspan id="6debian-bullseye-system" ></span>=== Debian Bullseye system === <ol style="list-style-type: decimal;"><li><p>Then it will start to Debian Bullseye is installed with the gcc compilation tool chain by default, which can directly compile u-boot. Some C language programs in the Linux system of the information prompted when compiling the next branch is as follows:development board.</p>
<ol style="list-style-type: lower-alpha;">
<li>Version <p>The version of ua.gcc is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''gcc --version'''</p><p>gcc (Debian 10.2.1-boot 6) 10.2.1 20210110</p><p>Copyright (C) 2020 Free Software Foundation, Inc.</p><p>This is free software; see the source codefor copying conditions. There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>|}</li><li><p>Write the '''hello_world.c''' program in C language</olp>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.c'''</lip><p>#include <stdio.h></olp>
<ol start="2" style="list-style-type: lower-alpha;"p>int main(void)</p><lip>Version of the cross-compilation tool chain{</lip>:<p>printf("Hello World!\n");</olp>
:<p>return 0;</p><p>}</p>|}<ol start/li><li><p>Then compile and run '''hello_world.c'''</p>{| class="3wikitable" style="list-style-typewidth: lower-alpha800px;">|-| <lip>Path to the compiled uorangepi@orangepi:~$ '''gcc -boot deb packageo hello_world hello_world.c'''</lip></olp> [ oorangepi@orangepi:~$ '''.k. ] Target directory [ /hello_world'''orangepi-build</p><p>Hello World!</outputp>|}</debsli></u-boot''' ]ol></li><li><p>Debian Bullseye has Python3 installed by default</p><ol start="4" style="list-style-type: lower-alpha;"><li><p>The package name specific version of the compiled uPython is as follows</p>{| class="wikitable" style="width:800px;" |-boot deb package| <p>orangepi@orangepi:~$ '''python3'''</lip><p>'''Python 3.9.2''' (default, Feb 28 2021, 17:03:44)</olp> <p>[ oGCC 10.k2. 1 20210110] File name [ on linux</p><p>Type "help", "copyright", "credits" or "license" for more information.</p><p>>>></p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Use the Ctrl+D shortcut key to exit python'linux-u-boot-next-orangepizero2w_xs interactive mode.x.x_arm64.deb''' ]</p></big>|}</li><ol startli><p>Write the '''hello_world.py''' program in Python language</p>{| class="5wikitable" style="list-style-typewidth: lower-alpha800px;"|-| <p>orangepi@orangepi:~$ '''vim hello_world.py'''</p><p>print('Hello World!')</p>|}</li>Compilation time</li><p>The result of running '''hello_world.py''' is as follows</olp>{| class="wikitable" style="width:800px;" |-[ o.k. ] Runtime [ | <p>orangepi@orangepi:~$ '''1 minpython3 hello_world.py''' ]</p><p>Hello World!</p>|}</li></ol></li><li><p>Debian Bullseye does not install Java compilation tools and operating environment by default.</p><ol start="6" style="list-style-type: lower-alpha;"><li>Repeat <p>You can use the following command to compile u-bootinstall openjdk. Use the following command without selecting through the graphical interface. You can start compiling uThe latest version in Debian Bullseye is openjdk-boot directly.17</lip>{| class="wikitable" style="width:800px;" |-| </olp> [ o.k. ] Repeat Build Options [ orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''</p>|}</li><li><p>After installation, you can check the Java version.</build.sh BOARDp>{| class=orangepizero2w BRANCH"wikitable" style=next BUILD_OPT=u"width:800px;" |-| <p>orangepi@orangepi:~$ '''java --bootversion''' ]</p>|}<ol start/li><li><p>Write the Java version of '''hello_world.java'''</p>{| class="7wikitable" style="listwidth:800px;" |-style-type| <p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>:: decimal<p>System.out.println(""Hello World!");</p>:<p>}</p><p>}</p>|}</li>View the compiled u-boot deb package</li><p>Then compile and run '''hello_world.java'''</olp>{| class="wikitable" style="width:800px;" |-test| <p>orangepi@testorangepi:~$ '''javac hello_world.java'''</p><p>orangepi-build@orangepi:~$ '''ls outputjava hello_world'''</p><p>Hello World!</p>|}</debsli></u-bootol></li></'''ol>
<blockquoteol style="list-style-type: decimal;"><li><p>Set Debian Bookworm is installed with the IGNORE_UPDATES variable gcc compilation tool chain by default, which can directly compile C language programs in uthe Linux system of the development board.</p><ol style="list-style-type: lower-alpha;"><li><p>The version of a.gcc is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''userpatches/configgcc --default.confversion''' to "</p><p>gcc (Debian 12.2.0-14) 12.2.0</p><p>Copyright (C) 2022 Free Software Foundation, Inc.</p><p>This is free software;yes"see the source for copying conditions. There is NO</p><p>warranty;not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>|}</blockquoteli>test<li><p>Write the '''hello_world.c''' program in C language</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@testorangepi:~/orangepi-build$ '''vim userpatches/config-defaulthello_world.confc'''</p><p>#include <stdio.h></p>
:<p>return 0;<ol start/p><p>}</p>|}</li><li><p>Then compile and run '''hello_world.c'''</p>{| class="9wikitable" style="listwidth:800px;" |-style| <p>orangepi@orangepi:~$ '''gcc -typeo hello_world hello_world.c'''</p><p>orangepi@orangepi: decimal;"~$ '''./hello_world'''</p><p>Hello World!</p>|}</li></ol></li><li><p>When debugging u-boot code, you can use the following method to update u-boot in the linux image for testingDebian Bookworm has Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li>First upload the compiled deb package <p>The specific version of uPython is as follows</p>{| class="wikitable" style="width:800px;" |-boot to the Linux system of the development board| <p>orangepi@orangepi:~$ '''python3'''</p><p>Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux</lip><p>Type "help", "copyright", "credits" or "license" for more information.</olp></lip>>>></olp>|}test@test{| class="wikitable" style="background-color:#ffffdc;width:~/orangepi800px;" |-build$ | <big><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''cd output</debsp></u-bootbig>|}</li><li><p>Write the '''hello_world.py'''program in Python language</p>{| class="wikitable" style="width:800px;" |-| test<p>orangepi@testorangepi:~/orangepi_build/output/debs/u-boot$ '''scp \vim hello_world.py'''</p><p>print('Hello World!')</p>|}</li><li><p>The result of running '''linux-u-boot-next-orangepizero2w_xhello_world.x.x_arm64.deb [mailtopy''' is as follows</p>{| class="wikitable" style="width:root800px;" |-| <p>orangepi@192.168.1.xxxorangepi:/root root@192.168~$ '''python3 hello_world.1.xxx:/root]py'''</p><p>Hello World!</p>|}</li></ol></li><li><p>Debian Bookworm does not install Java compilation tools and operating environment by default.</p><ol start="2" style="list-style-type: lower-alpha;"><li>Install <p>You can use the new ufollowing command to install openjdk. The latest version in Debian Bookworm is openjdk-boot deb package just uploaded17</lip>{| class="wikitable" style="width:800px;" |-| </olp> orangepi@orangepi:~$ '''sudo dpkg apt install -i''' '''linux-uy openjdk-boot17-next-orangepizero2w_x.x.x_arm64.debjdk'''</p>|}<ol start/li><li><p>After installation, you can check the Java version.</p>{| class="3wikitable" style="list-style-typewidth: lower-alpha800px;">|-| <lip>Then run the nandorangepi@orangepi:~$ '''java -sata-install scriptversion'''</p>|}</li><li><p>Write the Java version of '''hello_world.java'''</olp>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo nand-sata-installvim hello_world.java'''</p><p>public class hello_world</p><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println("Hello World!");</p>:<p>}<ol start/p><p>}</p>|}</li><li><p>Then compile and run '''hello_world.java'''</p>{| class="4wikitable" style="list-style-typewidth: lower-alpha800px;"|-| <p>orangepi@orangepi:~$ '''javac hello_world.java'''</p><lip>Then select orangepi@orangepi:~$ '''5 Install/Update the bootloader on SD/eMMCjava hello_world'''</p><p>Hello World!</p>|}</li></ol> [[File:zero2w-img278.png]]</li></ol>
<ol startspan id="5" style="listubuntu-stylefocal-type: lower-alpha;system"><li>After pressing the Enter key, a Warning will pop up first.</li></olspan>
<ol style="list-style-type: decimal;">
<li><p>Ubuntu Focal is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.</p>
<ol style="list-style-type: lower-alpha;">
<li>If you do <p>The version of a.gcc is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''gcc --version'''</p><p>gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0</p><p>Copyright (C) 2019 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not need to modify even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>|}</li><li><p>Write the kernel configuration options, when running the build'''hello_world.sh script, pass c'''KERNEL_CONFIGUREprogram in C language</p>{| class=no"wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ ''' to temporarily block the pop-up of the kernel configuration interfacevim hello_world.c'''</lip><p>#include <stdio.h></olp>
:<p>return 0;<ol start/p><p>}</p>|}</li><li><p>Then compile and run '''hello_world.c'''</p>{| class="7wikitable" style="listwidth:800px;" |-style| <p>orangepi@orangepi:~$ '''gcc -typeo hello_world hello_world.c'''</p><p>orangepi@orangepi: decimal;"~$ '''./hello_world'''</p><p>Hello World!</p>|}</li></ol></li><li><p>Part of the information prompted when compiling the next branch kernel source code is explained as follows:Ubuntu Focal has Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li>Version <p>The specific version of Python3 is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3'''</p><p>Python 3.8.10 (default, Nov 14 2022, 12:59:47)</p><p>[GCC 9.4.0] on linux</p><p>Type "help", "copyright", "credits" or "license" for more information.</p><p>>>></p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Use the linux kernel source codeCtrl+D shortcut key to exit python's interactive mode.'''</p></big>|}</li><li><p>Write the '''hello_world.py''' program in Python language</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.py'''</p><p>print('Hello World!')</p>|}</li><li><p>The result of running '''hello_world.py''' is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 hello_world.py'''</p><p>Hello World!</olp>|}
</li></ol>
<ol style="list-style-type: lower-alpha;">
<li><p>You can use the following command to install openjdk-17</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''linuxsudo apt install -dtby openjdk-next17-sun50iw9_x.x.x_arm64.debjdk''' Contains dtb files used by the kernel</p>|}</li><li><p>After installation, you can check the Java version.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''linuxjava --headersversion'''</p><p>openjdk 17.0.2 2022-next01-sun50iw9_x18</p><p>OpenJDK Runtime Environment (build 17.x0.x_arm642+8-Ubuntu-120.04)</p><p>OpenJDK 64-Bit Server VM (build 17.0.2+8-Ubuntu-120.deb04, mixed mode, sharing)</p>|}</li><li><p>Write the Java version of '''hello_world.java''' Contains kernel header files</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println("Hello World!");</p>:<p>}</p><p>}</p>|}</li><li><p>Then compile and run '''hello_world.java''linux'</p>{| class="wikitable" style="width:800px;" |-image-next-sun50iw9_x| <p>orangepi@orangepi:~$ '''javac hello_world.x.x_arm64.debjava'''</p><p>orangepi@orangepi:~$ '''java hello_world''' Contains kernel images and kernel modules</p><p>Hello World!</p>|}</li></ol>
</li></ol>
<ol style="list-style-type: lower-alpha;">
<li>Upload the compiled deb package <p>The version of a.gcc is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''gcc --version'''</p><p>gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) '''11.3.0'''</p><p>Copyright (C) 2021 Free Software Foundation, Inc.</p><p>This is free software; see the Linux kernel to the Linux system of the development boardsource 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-alphap>return 0;"</p><lip>Install the deb package of the new linux kernel just uploaded.}</lip>|}</olli> orangepi@orangepi:~$ <li><p>Then compile and run '''sudo dpkg -i linux-image-next-sun50iw9_x.x.x_arm64hello_world.debc'''</p> <ol start{| class="3wikitable" style="list-style-typewidth: lower-alpha800px;"><li>Then restart the development board and check whether the kernel|-related modifications have taken effect.| </li></olp> orangepi@orangepi:~$ '''sudogcc -o hello_world hello_world.c''' '''reboot''' <span id="compile-rootfs"/p></spanp>== Compile rootfs == # Run the build.sh script, remember to add sudo permissions testorangepi@testorangepi:~/orangepi-build$ '''sudo ./build.sh''' <ol start="2" style="list-style-type: decimal;"><li>Select '''Rootfs and all deb packageshello_world''' and press Enter</li></olp> <div class="figure"p> [[File:zero2w-img285.png]] Hello World!</divp><ol start="3" style="list-style-type: decimal;">|}<li>Then select the model of the development board</li></ol> [[File:zero2w-img275.png]] <ol start="4" style="list-style-type: decimal;"/li><li><p>Then select the branch type of the kernel source code. Different versions of the kernel source code maintain different rootfs types.Ubuntu Jammy has Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li><p>In the current branchThe specific version of Python3 is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3'''</p><p>Python 3.10.6 (main, May 29 2023, you can see three options11:10: debian1138) [GCC 11.3.0] on linux</p><p>Type "help", ubuntu20.04"copyright", and ubuntu22.04"credits" or "license" for more information.</p><p>>>></lip>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <libig><p>In '''Use the next branch, you can see three options: debian11, debian12, and ubuntu22.04Ctrl+D shortcut key to exit python's interactive mode.'''</p></libig>|}</olli></li><p>Write the '''hello_world.py''' program in Python language</olp> [[File:zero2w-img276.png]] <ol start{| class="5wikitable" style="list-style-typewidth: decimal800px;"|-| <p>orangepi@orangepi:~$ '''vim hello_world.py'''</p><lip>Then select the type of rootfsprint('Hello World!')</lip>|}</olli> [[File:zero2w-img286<li><p>The result of running '''hello_world.png]]py''' is as follows</p> <ol start{| class="6wikitable" style="list-style-typewidth: decimal800px;"|-| <p>orangepi@orangepi:~$ '''python3 hello_world.py'''</p><p>Hello World!</p>|}</li></ol></li><li><p>Then select the type of imageUbuntu Jammy does not install Java compilation tools and operating environment by default.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>You can use the following command to install openjdk-18</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''Image with console interface (server)sudo apt install -y openjdk-18-jdk''' Represents the image of the server version, which is relatively small in size.</p>|}</li><li><p>After installation, you can check the Java version.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''Image with desktop environmentjava --version''' Represents an image with a desktop, which is relatively large in size</p><p>openjdk 18.0.2-ea 2022-07-19</p><p>OpenJDK Runtime Environment (build 18.0.2-ea+9-Ubuntu-222.04)</lip><p>OpenJDK 64-Bit Server VM (build 18.0.2-ea+9-Ubuntu-222.04, mixed mode, sharing)</olp>|}</li><li><p>Write the Java version of '''hello_world.java'''</olp> <div {| class="figurewikitable"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[[File] args)</p>:<p>{</p>::zero2w-img287<p>System.out.png]]println("Hello World!");</p>:<p>}</p><p>}</p>|}</divli><ol startli><p>Then compile and run '''hello_world.java'''</p>{| class="7wikitable" style="list-style-typewidth: decimal800px;"|-| <p>orangepi@orangepi:~$ '''javac hello_world.java'''</p><lip>If you are compiling the server version of the image, you can also choose to compile the Standard version or the Minimal version. The Minimal version will have much less pre-installed software than the Standard version (orangepi@orangepi:~$ '''please do not choose the Minimal version without special needs, because many things are not pre-installed by default. Some functions may not be availablejava hello_world''')</p><p>Hello World!</p>|}</li></ol> <div class="figure"/li></ol> [[File:zero2w-img288.png]]
</div><ol startspan id="8" style="listmethod-of-uploading-stylefiles-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-development-board-linux-system"></olspan>
<ol style="list-style-type: lower-alpha;">
<li>Type <p>'''file_path: '''Needs to be replaced with the path of the file to be uploaded</p></li><li><p>'''orangepi: '''This is the user name of the development board's Linux system. It can also be replaced with something else, such as root.</p></li><li><p>'''192.168.xx.xx:''' This is the IP address of rootfsthe development board. Please modify it according to the actual situation.</p></li><li><p>'''/home/orangepi:''' The path in the development board Linux system can also be modified to other paths.</p>{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''scp file_path orangepi@192.168.xx.xx:/home/orangepi/'''</olp>|}
</li></ol>
</li>
<li><p>If you want to upload a folder, you need to add the -r parameter</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''scp <span style="color:#FF0000">-r</span> dir_path orangepi@192.168.xx.xx:/home/orangepi/'''</p>
|}
</li>
<li><p>There are more usages of scp, please use the following command to view the man manual</p></li>
{| class="wikitable" style="width:800px;"
|-
|
test@test:~$ '''man scp'''
|}
</ol>
<span id="how-to-upload-files-using-filezilla"></span>
<ol start="2" style="list-style-type: lowerdecimal;"><li><p>First install filezilla in Ubuntu PC</p>{| class="wikitable" style="width:800px;" |-alpha| <p>test@test:~$ '''sudo apt install -y filezilla'''</p>|}</li><li><p>Then use the following command to open filezilla</p>{| class="wikitable" style="width:800px;"|-| <p>test@test:~$ '''filezilla'''</p>|}</li><li><p>The storage path of interface after opening filezilla is as shown below. At this time, the compiled rootfs compressed packageremote site on the right is empty.</lip></oldiv class="figure">
[ o.k[File:zero2w-img255. png] Target directory [ '''orangepi-build/external/cache/rootfs''' ]
<ol start="3" style="list-style-type: lower-alpha;"/div></li><li><p>The name method of connecting the rootfs compressed package generated by compilationdevelopment board is as shown in the figure below</lip></olli>
<blockquote/div>a) </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'bullseye''and click ' represents the type of Linux distribution of rootfs''OK'''</p></li>
<span id/div></ol><ol start="9" style="compilelist-linuxstyle-imagetype: decimal;"><li><p>After the upload is completed, you can go to the corresponding path in the development board Linux system to view the uploaded file.</p></spanli>== Compile linux image ==<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>
<ol startspan id="2" style="listhow-to-upload-files-using-stylefilezilla-type: decimal;1"><li>Select '''Full OS image for flashing''' and press Enter</li></olspan>==== How to upload files using filezilla ====
::{| class="wikitable" style="width:800px;" |-| [[Filehttps://filezilla-project.org/download.php?type=client '''https:zero2w//filezilla-img292project.png]org/download.php?type=client''']|}
<ol startdiv class="5figure" style="list-style-type: decimal;"><li><p>If you select the next branch, you will also be prompted to select the memory size, and you do not need to select the current branch.</p><ol style="list-style-type: lower-alpha;"><li><p>If the development board you purchased has a memory size of 1.5GB, please select the first option.</p></li><li><p>If the development board you purchased has 1GB or 2GB or 4GB memory size, please choose the second option.</p><p>[[File:zero2w-img277.png]]</p></li></ol></li><li><p>Then select the type of rootfs</p></li></ol>
[[File:zero2w-img286img263.png]]
</li></ol>
<ol start="3" style="list-style-type: decimal;">
<li>The interface after opening filezilla is as shown below. At this time, the remote site on the right is empty.</li>
<div class="figure">
[[File:zero2w-img287img264.png]]
</div></ol><ol start="84" style="list-style-type: decimal;"><li>If you are compiling the server version The method of connecting the image, you can also choose to compile development board is as shown in the Standard version or the Minimal version. The Minimal version will have much less pre-installed software than the Standard version ('''please do not choose the Minimal version without special needs, because many things are not pre-installed by default. Some functions may not be available''')figure below:</li></ol>
<div class="figure">
[[File:zero2w-img288img256.png]]
</div></ol><ol start="95" style="list-style-type: decimal;"><li>If you are compiling a desktop version of the image, you also need Then choose to select '''save the type of desktop environment. Currently, only XFCE is maintained, so please select an XFCE type desktop.password''' and click '''OK'''</li></ol>
[[File:zero2w-img290img265.png]]
</li></ol>
<span idol style="instructionslist-forstyle-usingtype: decimal;"><li><p>First run '''orangepi-theconfig'''. Ordinary users remember to add '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-orangeconfig'''</p>|}</li><li><p>Then select '''System'''</p><p>[[File:zero2w-piimg80.png]]</p></li><li><p>Then select '''Hardware'''</p><p>[[File:zero2w-osimg81.png]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown in the picture below, and then use the '''space''' to select the dtbo configuration of the SPI you want to open.</p><p>[[File:zero2w-archimg270.png]]</p></li><li><p>Then select '''<Save>''' to save</p><p>[[File:zero2w-system"img83.png]]</p></li><li><p>Then select '''<Back>'''</spanp><p>[[File:zero2w-img84.png]]</p></li>= <li><p>Then select '''Instructions for using the Orange Pi OS Arch system<Reboot>''' to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol> <span id="how-to-shut-down-and-restart-the-development-board"></span>
<ol style="list-style-type: decimal;"><li><p>During the running of the Linux system, if you directly unplug the power supply, it may cause the file system to lose some data. It is recommended to use the '''poweroff''' command to shut down the Linux system of the development board before powering off, and then unplug the power supply.</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''Motherboard functionssudo poweroff'''</p>| '''OPi OS Arch'''}{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big><p>'''HDMI videoNote that after turning off the development board, you need to unplug and replug the power supply before it can be turned on.'''</p></big>|}</li><li><p>In addition to using the poweroff command to shut down, you can also use the power on/off button on the expansion board to shut down.</p><p>[[File:zero2w-img269.png]]</p>{| '''OK'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big><p>'''HDMI AudioNote that Linux 5.4 requires manual configuration of the power on/off button before it can be used. For the opening method, please refer to [[Orange Pi Zero 2W#How to turn on the power button in Linux5.4|the method of opening the power button in Linux5.4]].'''</p></big>| }</li><li><p>Use the '''OKreboot'''command to restart the Linux system in the development board</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''sudo''' '''Typereboot'''</p>|}</li></ol> <span id="linux-C USB2sdkorangepi-build-usage-instructions"></span> = '''Linux SDK——orangepi-build usage instructions''' = <span id="compilation-system-requirements"></span>== Compilation system requirements == The Linux SDK, '''orangepi-build''', only supports running on X64 computers with '''<span style="color:#FF0000">Ubuntu 22.0 x 204</span>'''| installed. Therefore, before downloading orangepi-build, please first ensure that the Ubuntu version installed on your computer is Ubuntu 22.04. The command to check the Ubuntu version installed on the computer is as follows. If the Release field does not display '''OK<span style="color:#FF0000">22.04</span>''', it means that the Ubuntu version currently used does not meet the requirements. Please change the system before performing the following operations. {| class="wikitable" style="width:800px;"
|-
| test@test:~$ '''lsb_release -a''' No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04 LTS Release: '''<span style="color:#FF0000">22.04</span>''TF Card Startup' Codename: '''jammy'''| } If the computer is installed with a Windows system and does not have Ubuntu 22.04 installed on it, you can consider using'''OKVirtualBox'''or '''VMware''' to install an Ubuntu 22.04 virtual machine in the Windows system. But please note, do not compile orangepi-build on the WSL virtual machine, because orangepi-build has not been tested in the WSL virtual machine, so there is no guarantee that orangepi-build can be used normally in WSL. In addition, please do not compile the Linux system on the development board. Use orangepi-build. The installation image download address of Ubuntu 22.04 amd64 version is: {| class="wikitable" style="width:800px;"
|-
| '''WIFI'''| '''OK'''|-| '''Bluetooth'''| '''OK'''|[https://repo.huaweicloud.com/ubuntu-| '''LED Light'''| '''OK'''|releases/21.04/ubuntu-| '''40pin GPIO'''| '''OK'''|-| '''40pin I2C'''| '''OK'''|-| '''40pin SPI'''| '''OK'''|21.04-| '''40pin UART'''| '''OK'''|desktop-| '''40pin PWM'''| amd64.iso '''OK'''|https://mirrors.tuna.tsinghua.edu.cn/ubuntu-| '''Temperature Sensor'''| '''OK'''|releases/22.04/ubuntu-| '''Hardware watchdog'''| '''OK'''|22.04-| '''Mali GPU'''| '''NO'''|desktop-| '''Video codec'''| '''NOamd64.iso''']
|}
After installing Ubuntu 22.04 on your computer or virtual machine, please first set the software source of Ubuntu 22.04 to Tsinghua source (or other domestic sources that you think is fast), otherwise it is easy to make errors due to network reasons when installing the software later. The steps to replace Tsinghua Source are as follows: <ol style="list-style-type: lower-alpha;"><li>For the method of replacing Tsinghua Source, please refer to the instructions on this page.</li> {| class="wikitable" style="width:800px;"
|-
| [https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/ '''24pin expansion board functionhttps://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/''']| }</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 '''OPi OS Arch/etc/apt/sources.list'''file that need to be replaced are:</li>{| class="wikitable" style="width:800px;"
|-
| '''100M network port'''| test@test:~$ '''OK'''|-| '''100M Ethernet port light'''| '''OK'''|-| '''USB2sudo mv /etc/apt/sources.0 HOST x 2'''| '''OK'''|-| '''Infrared reception'''| '''OK'''|-| '''Headphone audio playback'''| '''OK'''|-| '''Onlist cat /etc/apt/off button'''| '''OK'''|-| '''LRADC''' '''Custom buttons x 2'''| '''OKsources.list.bak'''|-| '''TV-OUT'''| '''NO'''|}
'''#''' deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse|}</divol></liol start="4" style="list-style-type: lower-alpha;"><li>After the replacement, you need to update the package information and ensure that no errors are reported.<p/li>Then create a new username and set a password{| class="wikitable" style="width:800px;" |-| test@test:~$ '''sudo apt-get update'''|}</pol><ol start="5" style="list-style-type: lower-alpha;"><div classli>'''<span style="figurecolor:#FF0000">In addition, since the source code of the kernel and Uboot are stored on GitHub, it is very important to ensure that the computer can download the code from GitHub normally when compiling the image.</span>'''</li></ol>
<div class="figure">
[[File:zero2w-img302img272.png|center|800px]]
</div>
|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <pbig>At '''When downloading the orangepi-build code through the git clone command, you do not need to enter the user name and password of the github account (the same is true for downloading other codes in this pointmanual). If after entering the git clone command, Ubuntu PC prompts you can use to enter the user name of the newly created username github account. The name and password to log are usually entered incorrectly in the address of the orangepi-build warehouse behind git clone. Please carefully check whether there are any errors in the spelling of the command, rather than thinking that we have forgotten to provide the OPi OS system through username and password of the serial port or sshgithub account.'''</p></li></olbig>|}
<ol style="list-style-type: lower-alpha;"><li><p>'''Note that xxxbuild.dtbo in FDTOVERLAYS sh''': Compile startup script</dtbsp></allwinner/overlay/xxx.dtbo needs li><li><p>'''external''': Contains configuration files needed to be replaced with compile the image, specific dtbo configurationscripts, and source code of some programs, please do not copy itetc.</p></li><li><p>'''LICENSE''': GPL 2 license file</p></li><li><p>'''README.md''': orangepi-build documentation</p></li><li><p>'''scripts''': Common script for compiling linux images</p></li></ol>{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''ls'''
<ol start="3" style="list-style-type: decimal;"/div><li><p>The storage path mirror URL of xxx.dtbo the cross-compilation tool chain in the OPi OS Arch image China is as follows. Please note that not all dtbo under this path can be used.</p><p>'''/boot/dtbs/allwinner/overlay/'''</p></li><li><p>The DT overlays configuration that can be used by the development board is as follows</p></li></ol>open source software mirror site of Tsinghua University:
{| class="wikitable" style="width:800px;"
|-
| [https://mirrors.tuna.tsinghua.edu.cn/armbian-releases/_toolchain/ '''Functions on the development boardhttps://mirrors.tuna.tsinghua.edu.cn/armbian-releases/_toolchain/''']| } After toolchains is downloaded, it will contain multiple versions of cross-compilation '''Corresponding DT overlays configurationtoolchain''': {| class="wikitable" style="width:800px;"
|-
| '''40pin - i2c0'''| '''sun50i-h616-pi-i2c0.dtbo'''|-| '''40pin - i2c1'''| '''sun50i-h616-pi-i2c1.dtbo'''|-| '''40pin - i2c2'''| '''sun50i-h616-pi-i2c2.dtbo'''|-| '''40pin - uart2'''| '''sun50i-h616-pi-uart2.dtbo'''|-| '''40pin - uart3'''| '''sun50i-h616-pi-uart3.dtbo'''|-| '''40pin - uart4'''| '''sun50i-h616-pi-uart4.dtbo'''|-| '''40pin - uart5'''| '''sun50i-h616-ph-uart5.dtbo'''|-| '''40pin - pwm1'''| '''sun50i-h616-pi-pwm1.dtbo'''|test@test:~/orangepi-| build$ '''40pin - pwm2ls toolchains/'''| '''sun50i-h616-pi-pwm2.dtbo'''|gcc-| '''40pin arm- pwm3'''| '''sun50i-h616-pi-pwm311.dtbo'''|-| '''40pin - pwm4'''| '''sun50i2-h616-pi-pwm42022.dtbo'''|02-| '''40pin x86_64- spi1 cs0'''| '''sun50iaarch64-h616none-spi1-cs0-spidev.dtbo'''|linux-gnu | '''40pin - spi1 cs1'''| '''sun50igcc-h616linaro-spi1-cs1-spidev4.dtbo'''|-| '''40pin - spi1 cs0 cs1'''| '''sun50i-h616-spi1-cs0-cs1-spidev9.dtbo'''|-| '''设Set USB0 to Host mode'''| '''sun50i4-h616-usb0-host2017.dtbo'''|-| '''Turn off the green LED light'''| '''sun50i-h616-zero2w-disable-led.dtbo'''|-| '''How to close the UART0 debugging serial port'''| '''sun50i01-h616x86_64_aarch64-disablelinux-uart0.dtbo'''|}gnu
<span idol style="androidlist-12style-tvtype: lower-systemalpha;"><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-usagestyle-instructionstype: lower-alpha;"><li>linux6.1</spanli>{| class="wikitable" style="width:800px;" |-| '''gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu'''|}</ol>The cross-compilation tool chain used to compile the H618 u-boot source code is:
|-
| Android Version'''gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabi'''|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>v2021.07</li>{| Kernel versionclass="wikitable" style="width:800px;"
|-
| '''Android 12 TV Version'''| '''linux5gcc-arm-11.2-2022.402-x86_64-aarch64-none-linux-gnu'''
|}
</ol>
<span id="orangepi-build-complete-directory-structure-description"></span>
<ol style="list-style-type: decimal;"><li><p>After downloading, the orangepi-build warehouse does not contain the source code of the linux kernel, u-boot and cross-compilation tool chain. The source code of the linux kernel and u-boot is stored in an independent git warehouse.</p><ol style="list-style-type: lower-alpha;"><li><p>The git warehouse where the linux kernel source code is stored is as follows. Please note that the branch of the linux-orangepi warehouse is switched to</p><ol style="list-style-type: none;"><li>a) Linux5.4</li>{| class="wikitable" style="width:800px;"
|-
| https://github.com/orangepi-xunlong/linux-orangepi/tree/'''Motherboard functionsorange-pi-5.4-sun50iw9'''| '''Android12 TV'''}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>b) Linux6.1</li>{| class="wikitable" style="width:800px;"
|-
| https://github.com/orangepi-xunlong/linux-orangepi/tree/'''HDMI videoorange-pi-6.1-sun50iw9'''| '''OK'''}</ol></li></ol><ol start="2" style="list-style-type: lower-alpha;"><li><p>The git warehouse where the u-boot source code is stored is as follows. Please note that the branch of the u-boot-orangepi warehouse is switched to</p><ol style="list-style-type: lower-alpha;"><li>a) v2018.05</li>{| class="wikitable" style="width:800px;"
|-
| https://github.com/orangepi-xunlong/u-boot-orangepi/tree/'''HDMI Audiov2018.05-h618'''| '''OK'''}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>b) v2021.07</li>{| class="wikitable" style="width:800px;"
|-
| https://github.com/orangepi-xunlong/u-boot-orangepi/tree/'''Typev2021.07-sunxi'''|}</ol></li></ol></li></ol><ol start="2" style="list-style-type: decimal;"><li><p>When orangepi-build is run for the first time, it will download the cross-compilation tool chain, u-boot and linux kernel source code. After successfully compiling a linux image, the files and folders that can be seen in orangepi-build are:</p><ol style="list-style-type: lower-C USB2alpha;"><li><p>'''build.0 x sh''': Compile startup script</p></li><li><p>'''external''': Contains the configuration files needed to compile the image, scripts for specific functions, and the source code of some programs. The rootfs compressed package cached during the image compilation process is also stored in external.</p></li><li><p>'''kernel''': Store the source code of the linux kernel</p></li><li><p>'''LICENSE''': GPL 2license file</p></li><li><p>'''README.md''': orangepi-build documentation</p></li><li><p>'''output''': Store compiled u-boot, linux and other deb packages, compilation logs, and compiled images and other files</p></li>| <li><p>'''scripts''': Common script for compiling linux images</p></li><li><p>'''toolchains''': Store cross-compilation tool chain</p></li><li><p>'''u-boot''': Store the source code of u-boot</p></li><li><p>'''OKuserpatches''': Store the configuration files needed to compile the script</p></li>{| class="wikitable" style="width:800px;"
|-
| test@test:~/orangepi-build$ '''TF card startupls'''| '''OKbuild.sh external kernel LICENSE output README.md scripts toolchains u-boot userpatches'''|}</ol></li></ol> <span id="compile-u-boot"></span> == Compile u-boot == # Run the build.sh script, remember to add sudo permissions {| class="wikitable" style="width:800px;"
|-
| test@test:~/orangepi-build$ '''WIFIsudo ./build.sh'''| } <ol start="2" style="list-style-type: decimal;"><li>Select '''OKU-boot package'''and press Enter</li> <div class="figure"> [[File:zero2w-img274.png]] </div></ol><ol start="3" style="list-style-type: decimal;"><li>Then select the model of the development board</li> [[File:zero2w-img275.png]]|</ol><ol start="4" style="list-style-type: decimal;"><li><p>Then select the branch type of u-boot</p><ol style="list-style-type: lower-alpha;"><li><p>The current branch will compile the u-boot v2018.05 version code that needs to be used by the linux5.4 image.</p></li><li><p>The next branch will compile the u-boot v2021.07 version code that needs to be used by the linux6.1 image.</p><p>[[File:zero2w-img276.png]]</p></li></ol></li><li><p>If you select the next branch, you will also be prompted to select the memory size, and you do not need to select the current branch.</p><ol style="list-style-type: lower-alpha;">| '''Bluetooth'''<li><p>If the development board you purchased has a memory size of 1.5GB, please select the first option.</p></li>| '''OK'''<li><p>If the development board you purchased has 1GB or 2GB or 4GB memory size, please choose the second option.</p>|<p>[[File:zero2w-img277.png]]</p></li></ol>| '''USB Camera'''</li></ol><ol start="6" style="list-style-type: decimal;">| '''OK'''<li><p>Then it will start to compile u-boot. Some of the information prompted when compiling the next branch is as follows:</p>|<ol style="list-style-type: lower-alpha;">| '''LED Light'''<li>Version of u-boot source code</li>{| '''OK'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] Compiling u-boot [ '''40pin GPIOv2021.07''']|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Version of the cross-compilation tool chain</li>{| '''OK'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] Compiler version [ '''40pin I2Caarch64-linux-gnu-gcc 11''']|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>Path to the compiled u-boot deb package</li>{| '''OK'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] Target directory [ '''40pin SPI1orangepi-build/output/debs/u-boot''']|}</ol><ol start="4" style="list-style-type: lower-alpha;"><li>The package name of the compiled u-boot deb package</li>{| '''OK'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] File name [ '''40pin UARTlinux-u-boot-next-orangepizero2w_x.x.x_arm64.deb''']|}</ol><ol start="5" style="list-style-type: lower-alpha;"><li>Compilation time</li>{| '''OK'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] Runtime [ '''40pin PWM1 min''']| '''OK'''}</ol>|<ol start="6" style="list-style-type: lower-alpha;">| '''Temperature Sensor'''<li>Repeat the command to compile u-boot. Use the following command without selecting through the graphical interface. You can start compiling u-boot directly.</li>{| '''OK'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] Repeat Build Options [ '''Hardware watchdogsudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=u-boot''']| '''OK'''}</ol></li></ol><ol start="7" style="list-style-type: decimal;"><li>View the compiled u-boot deb package</li>{| class="wikitable" style="width:800px;"
|-
| '''Mali GPU'''| test@test:~/orangepi-build$ '''OKls output/debs/u-boot/'''|-| '''Video codec'''| '''OKlinux-u-boot-next-orangepizero2w_x.x.x_arm64.deb'''
|}
</ol>
<ol start="8" style="list-style-type: decimal;">
<li>When the orangepi-bulid compilation system compiles the u-boot source code, it will first synchronize the u-boot source code with the u-boot source code of the github server. Therefore, if you want to modify the u-boot source code, you first need to turn off the download and update function of the source code. ('''You need to completely compile u-boot before you can turn off this function, otherwise it will prompt that the source code of u-boot cannot be found'''), otherwise the modifications will be restored. The method is as follows:</li>
Set the IGNORE_UPDATES variable in u'''userpatches/config-default.conf''' to "yes"
{| class="wikitable" style="width:800px;"
|-
| test@test:~/orangepi-build$ '''24pin Expansion board functionvim userpatches/config-default.conf'''| ...... IGNORE_UPDATES="'''Android12 TV<span style="color:#FF0000">yes</span>'''" ......|}</ol><ol start="9" style="list-style-type: decimal;"><li><p>When debugging u-boot code, you can use the following method to update u-boot in the linux image for testing</p><ol style="list-style-type: lower-alpha;"><li>First upload the compiled deb package of u-boot to the Linux system of the development board.</li>{| class="wikitable" style="width:800px;"
|-
| test@test:~/orangepi-build$ '''cd output/debs/u-boot''' test@test:~/orangepi_build/output/debs/u-boot$ '''100M network portscp \'''| '''OKlinux-u-boot-next-orangepizero2w_x.x.x_arm64.deb [mailto:root@192.168.1.xxx:/root root@192.168.1.xxx:/root]'''|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Install the new u-boot deb package just uploaded</li>{| class="wikitable" style="width:800px;"
|-
| orangepi@orangepi:~$ '''100M Ethernet port lightsudo dpkg -i'''| '''OKlinux-u-boot-next-orangepizero2w_x.x.x_arm64.deb'''|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>Then run the nand-sata-install script</li>{| class="wikitable" style="width:800px;"
|-
| '''USB2.0 HOST x 2'''| '''OK'''|-| '''Infrared reception'''| ''orangepi@orangepi:~$ 'OK'''|sudo nand-| '''Headphone audio playback'''| '''OK'''|sata-| '''On/off button'''| '''OK'''|-| '''LRADC''' '''Custom buttons x 2'''| '''OK, The default setting is the volume up and down keys.'''|-| '''TV-OUT'''| '''OKinstall'''
|}
</ol>
<ol start="4" style="list-style-type: lower-alpha;">
<li>Then select '''5 Install/Update the bootloader on SD/eMMC'''</li>
[[File:zero2w-img278.png]]
</ol>
<ol start="5" style="list-style-type: lower-alpha;">
<li>After pressing the Enter key, a Warning will pop up first.</li>
[[File:zero2w-img279.png]]
</ol>
<ol start="6" style="list-style-type: lower-alpha;">
<li>Press the Enter key again to start updating u-boot. After the update is completed, the following information will be displayed.</li>
[[File:zero2w-img280.png]]</ol><ol start="7" style="list-style-type: lower-alpha;"><li>Then you can restart the development board to test whether the u-boot modification has taken effect.</li></ol></li></ol><span id="onboardcompile-ledthe-lightlinux-display-instructionskernel"></span> == Onboard LED light display instructions Compile the linux kernel == # Run the '''build.sh''' script, remember to add sudo permissions
::{| class="wikitable" style="width:800px;"
|-
|| '''green light'''| '''red light'''|-| '''u-boot startup phase'''| '''Off'''| '''on'''|test@test:~/orangepi-| '''Kernel boot to enter the system'''| '''on'''| build$ '''onsudo ./build.sh'''
|}
<span idol start="how2" style="list-tostyle-return-to-the-previous-interface-in-androidtype: decimal;"><li>Select '''Kernel package''' and press Enter</spanli>== How to return to the previous interface in Android ==
[[File:zero2w-img282.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then connect network adb on Ubuntu PC</li></ol> test@test:~$ '''adb connect 192.168.1.xxx:5555''' '''(Need to be modified to select the IP address model of the development board)''' * daemon not running; starting now at tcp:5037 * daemon started successfully connected to 192.168.1.xxx:5555 test@test:~$ '''adb devices''' List of devices attached 192.168.1.xxx:5555 device</li>
[[File:zero2w-img275.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>Then you can log in to select the android system through adb shell on Ubuntu PCbranch type of the kernel source code</li></ol>
::[[File:zero2w-img276.png]]<span id/ol><ol start="use-data-cable-to-connect6" style="list-adbstyle-debuggingtype: decimal;"><li>If you choose to display the kernel configuration menu (the second option) in step 3), the kernel configuration interface opened through '''make menuconfig''' will pop up. At this time, you can directly modify the kernel configuration. After modification, save and exit. Yes, compilation of the kernel source code will begin after exiting.</spanli>=== Use data cable to connect adb debugging ===
<ol style="list-style-type: lower-alpha;">
<li>HDMI to VGA converterVersion of the linux kernel source code</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-| [o.k. ] Compiling current kernel [File:zero2w-img144'''6.1.png]31''' ]|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>A VGA cable and a Mini HDMI male to HDMI female adapterThe version of the cross-compilation tool chain used</li></ol>{| class="wikitable" style="width:800px;" |-| [[File:zero2w-img145o.k.png]] Compiler version [[File:zero2w'''aarch64-linux-gnu-img146.png]gcc 11''' ]|}</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>A monitor or TV that supports VGA The default configuration file used by the kernel and the path where it is stored are as follows</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Using kernel config file [ '''orangepi-build/external/config/kernel/linux-6.1-sun50iw9-next.config''' ]|}</ol><ol start="4" style="list-style-type: lower-alpha;"><li>The path to the kernel-related deb package generated by compilation</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Target directory [ '''output/debs/''' ]|}</ol><ol start="5" style="list-style-type: lower-alpha;"><li>The package name of the kernel image deb package generated by compilation</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] File name [ '''linux-image-next-sun50iw9_x.x.x_arm64.deb''' ]|}</ol><ol start="6" style="list-style-type: lower-alpha;"><li>Compilation time</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Runtime [ '''10 min''' ]|}</ol><ol start="7" style="list-style-type: lower-alpha;"><li>Finally, the compilation command to repeatedly compile the last selected kernel will be displayed. Use the following command without selecting through the graphical interface, and you can directly start compiling the kernel source code.</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=kernel KERNEL_CONFIGURE=no''' ]|}</ol></li></ol><ol start="8" style="list-style-type: decimal;"><li><p>View the kernel-related deb package generated by compilation</p><ol style="list-style-type: lower-alpha;"><li><p>'''linux-dtb-next-sun50iw9_x.x.x_arm64.deb''' Contains dtb files used by the kernel</p></li><li><p>'''linux-headers-next-sun50iw9_x.x.x_arm64.deb''' Contains kernel header files</p></li><li><p>'''linux-image-next-sun50iw9_x.x.x_arm64.deb''' Contains kernel images and kernel modules</p></li>{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''ls output/debs/linux-*'''
<div class="figure">
[[File:zero2w-img317img285.png]]
</div></ol><ol start="63" style="list-style-type: decimal;"><li>Then use the keyboard to enter the password corresponding to the WI-FI, and then use the mouse to click the Enter button on select the virtual keyboard to start connecting to model of the WI-FI.development board</li></ol>
[[File:zero2w-img275.png]]<div class/ol><ol start="figure4" style="list-style-type: decimal;"><li><p>Then select the branch type of the kernel source code. Different versions of the kernel source code maintain different rootfs types.</p><ol style="list-style-type: lower-alpha;"><li><p>In the current branch, you can see three options: debian11, ubuntu20.04, and ubuntu22.04.</p></li><li><p>In the next branch, you can see three options: debian11, debian12, and ubuntu22.04.</p></li>
[[File:zero2w-img318img276.png]]</ol></li></ol><ol start="5" style="list-style-type: decimal;"><li>Then select the type of rootfs</li>
[[File:zero2w-img286.png]]</divol><ol start="76" style="list-style-type: decimal;"><li>The display after successful WI<p>Then select the type of image</p><ol style="list-FI connection style-type: lower-alpha;"><li><p>'''Image with console interface (server)''' Represents the image of the server version, which is as shown belowrelatively small in size.</p></li><li><p>'''Image with desktop environment''' Represents an image with a desktop, which is relatively large in size.</olp></li>
[[File:zero2w-img320img290.png]]
[[File:zero2w-img321img291.png]]</ol><ol start="9" style="list-style-type: decimal;"><li><p>Then the compilation of rootfs will start. Some of the information prompted during compilation are as follows:</p><ol style="list-style-type: lower-alpha;"><li>Type of rootfs</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] local not found [ Creating new rootfs cache for '''bullseye''' ]|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>The storage path of the compiled rootfs compressed package</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Target directory [ '''orangepi-build/external/cache/rootfs''' ]|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>The name of the rootfs compressed package generated by compilation</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] File name [ '''bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4''' ]|}</ol></li></ol><ol start="10" style="list-style-type: decimal;"><li><p>View the compiled rootfs compressed package</p><ol style="list-style-type: lower-alpha;"><li>'''bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4''' It is a compressed package of rootfs. The meaning of each field in the name is</li>
<ol startspan id="2" style="listcompile-stylelinux-type: decimal;image"><li><p>Then make sure the network port of the expansion board is connected to the router or switch</p></li><li><p>Then open '''Settings'''</p><p>[[File:zero2w-img324.png]]</p></li><li><p>Then select '''Network & Internet'''</p><p>[[File:zero2w-img325.png]]</p></li><li><p>Then you can see the IP address of the development board's wired network port at the location shown in the picture below.</p><p>[[File:zero2w-img326.png]]</p></li></olspan>
# Choose first Run the '''Settingsbuild.sh'''script, remember to add sudo permissions
<ol start="2" style="list-style-type: decimal;">
<li>Then select Select '''BluetoothFull OS image for flashing'''and press Enter</li> </oldiv class="figure">
[[File:zero2w-img327img292.png]]
</div></ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then Open '''Bluetooth Enable'''select the model of the development board</li></ol> [[File:zero2w-img328.png]]
[[File:zero2w-img275.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>Then click '''Pair new device'''to start scanning for surrounding Bluetooth devicesselect the branch type of the kernel source code. Different versions of the kernel source code maintain different rootfs types.</p><ol style="list-style-type: lower-alpha;"><li><p>In the current branch, you can see three options: debian11, ubuntu20.04, and ubuntu22.04.</olp></li> [[File<li><p>In the next branch, you can see three options:zero2w-img329debian11, debian12, and ubuntu22.04.png]]</p></li>
[[File:zero2w-img276.png]]
</ol>
</li></ol>
<ol start="5" style="list-style-type: decimal;">
<li>The searched Bluetooth devices <p>If you select the next branch, you will also be displayed under '''Available devices'''prompted to select the memory size, and you do not need to select the current branch.</p><ol style="list-style-type: lower-alpha;"><li><p>If the development board you purchased has a memory size of 1.5GB, please select the first option.</p></li><li><p>If the development board you purchased has 1GB or 2GB or 4GB memory size, please choose the second option.</p><p>[[File:zero2w-img277.png]]</p></li></ol></li><li><p>Then select the type of rootfs</p></li>
[[File:zero2w-img330img286.png]]</ol><ol start="7" style="list-style-type: decimal;"><li><p>Then select the type of image</p><ol style="list-style-type: lower-alpha;"><li><p>'''Image with console interface (server)''' Represents the image of the server version, which is relatively small in size.</p></li><li><p>'''Image with desktop environment'''Represents an image with a desktop, which is relatively large in size.</p></li>
<ol startdiv class="6figure" style="list-style-type: decimal;"><li>Then click on the Bluetooth device you want to connect to start pairing. When the following interface pops up, please use the mouse to select the '''Pair'''option</li></ol>
[[File:zero2w-img331img287.png]]
</div></ol></li></ol><ol start="78" style="list-style-type: decimal;"><li>What is tested here is the Bluetooth configuration process between If you are compiling the development board and server version of the Android phone. At this timeimage, you can also choose to compile the following confirmation interface will pop up on Standard version or the phoneMinimal version. Click The Minimal version will have much less pre-installed software than the pairing button on Standard version ('''please do not choose the phone to start the pairing processMinimal version without special needs, because many things are not pre-installed by default.Some functions may not be available''')</li></ol>
</div></ol>
<ol start="9" style="list-style-type: decimal;">
<li>At this time, If you can use the Bluetooth are compiling a desktop version of your mobile phone to send a picture to the development board. After sendingimage, you can see also need to select the following confirmation interface in the Android system type of the development boarddesktop environment. Currently, only XFCE is maintained, and then click '''Accept''' to start receiving the pictures sent by the mobile phoneso please select an XFCE type desktop.</li></ol>
[[File:zero2w-img334img289.png]]
[[File:zero2w-img291.png]]</ol><span idol start="how-to-set-usb0-to-host10" style="list-modestyle-1type: decimal;"><li>Then the compilation of the linux image will begin. The general process of compilation is as follows</spanli>== How to set USB0 to HOST mode ==
<span id="orange-pi-os-arch-system-function-adaptation-status"></dev/video0span>== Orange Pi OS Arch system function adaptation status ==
<ol style="list-style-type: lower-alpha;">
<li><p>After burning the system, when you start it for the first time and enter the desktop, you will see the user wizard program shown in the figure below.</p>
<div class="figure">
[[File:zero2w-img336img293.png]]
</div></li><li><p>First you need to select the language you want</p>
<div class="figure">
[[File:zero2w-img339img294.png]] </div></li><li><p>After selecting the language, the user wizard will immediately switch to the corresponding language interface, as shown below in Chinese</p><div class="figure">
<div class="figure">
[[File:zero2w-img344img300.png]]
</div></li>
<li><p>Then find After the screen mirroring function in installation is complete, you need to click the phone settings. Here we take '''Xiaomi 12S Pro mobile phoneFinish''' as an example. Please research other brands of mobile phones by yourself. As shown in the picture below, click the button in the red box to open the screen mirroring function of restart the phone.</p><p>[[File:zero2w-img345system.png]]</p></li><li><p>After waiting for a period of time, you will be able to see the searched connectable devices on your mobile phone, and then we can select the device corresponding to the development board to connect.</p><p>[[File:zero2w-img346.png]]</p></li><li><p>Then the selection box shown in the div class="figure below will pop up in the '''MiracastReceiver''' application interface of the development board. Here we can select '''Accept'''</p><p>[[File:zero2w-img347.png]]</p></li><li><p>Then you can see the content of the mobile phone screen on the HDMI screen connected to the development board</p><p>[[File:zero2w-img348.png]]</p></li></ol">
[[File:zero2w-img107img302.png]]
The location of multiplexing functions such as I2C/SPI/UART/PWM in the 40-pin development board are turned off by default in the kernel's dts, and the infrared remote control power button is as follows:corresponding DT overlays need to be manually turned on before they can be used.
::{| class="wikitable" style="width:800px;" |-| [[File:zero2worangepi@orangepi-img350pc ~]$ '''sudo vim /boot/extlinux/extlinux.png]]conf'''|}
'''FDTOVERLAYS /dtbs/allwinner/overlay/<span style="color:#FF0000">xxx.dtbo</span>''' #Configuration that needs to be added
|}
</ol>
<ol start="3" style="list-style-type: decimal;">
<li><p>The GPIO test interface is as shown in the figure below. The two rows storage path of '''CheckBox''' buttons on the left have a one-to-one correspondence with the 40pin pinsxxx. When the '''CheckBox''' button is checked, the corresponding GPIO pin will be set to '''OUT''' mode and dtbo in the pin level OPi OS Arch image is set to high level; when unchecked, the GPIO pin level will as follows. Please note that not all dtbo under this path can be set to low level; when the GPIO is clicked When you click the '''GPIO READALL''' button, you can get information such as wPi number, GPIO mode, pin level, etcused.</p>{| class="wikitable" style="width:800px; when you click the" |-| <p>'''BLINK ALL GPIO/boot/dtbs/allwinner/overlay/''' button, all GPIO ports will cycle through outputting high and low levels. This function </p>|}</li><li><p>The DT overlays configuration that can be used to test all by the 40pin pins. GPIO port.development board is as follows</lip></olli>
|-
| '''GPIO序号40pin - i2c0'''| '''GPIO'''| '''功能'''| '''引脚'''|| '''引脚'''| '''功能'''| '''GPIO'''| '''GPIO序号sun50i-h616-pi-i2c0.dtbo'''
|-
|-
| '''26440pin - i2c2'''| '''PI8'''| '''TWI1sun50i-h616-pi-SDAi2c2.dtbo'''| '''3'''|| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''26340pin - uart2'''| '''PI7'''| '''TWI1sun50i-h616-pi-SCLuart2.dtbo'''| '''5'''|| '''6'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''26940pin - uart3'''| '''PI13'''| '''PWM3'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224sun50i-h616-pi-uart3.dtbo'''
|-
|-
| '''22640pin - uart5'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''12'''| style="textsun50i-h616-ph-align: left;"|| '''PI1'''| '''257uart5.dtbo'''
|-
| '''22740pin - pwm1'''| '''PH3'''| '''UART5_RX'''| '''13'''|| '''14''sun50i-h616-pi-pwm1.dtbo'| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''26140pin - pwm2'''| '''PI5'''| '''UART2_TX'''| '''15'''|| '''16'''| '''PWM4'''| '''PI14'''| '''270sun50i-h616-pi-pwm2.dtbo'''
|-
|-
| '''23140pin - spi1 cs0'''| '''PH7'''| '''SPI1_MOSI'''| '''19sun50i-h616-spi1-cs0-spidev.dtbo'''|| '''20'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''23240pin - spi1 cs1'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''UART2_RX'''| '''PI6'''| '''262sun50i-h616-spi1-cs1-spidev.dtbo'''
|-
| '''23040pin - spi1 cs0 cs1'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229sun50i-h616-spi1-cs0-cs1-spidev.dtbo'''
|-
|-
| '''266Turn off the green LED light'''| '''PI10'''| '''TWI2sun50i-h616-zero2w-SDA'''| '''27'''|| '''28'''| '''TWI2disable-SCL'''| '''PI9'''| '''265led.dtbo'''
|-
| '''256How to close the UART0 debugging serial port'''| '''PI0sun50i-h616-disable-uart0.dtbo'''| }</ol><ol start="5" style="textlist-style-aligntype: leftdecimal;"|>| <li>If you need to open multiple configurations at the same time, just add the paths of multiple configurations directly after '''29FDTOVERLAYS.'''For example, the configuration of opening i2c1 and uart5 at the same time is as follows</li>{|| '''30'''| '''GND'''| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| [orangepi@orangepi-pc ~]$ '''271sudo vim /boot/extlinux/extlinux.conf'''| LABEL Orange Pi KERNEL /Image FDT /dtbs/allwinner/sun50i-h616-orangepi-zero2w.dtb '''PI15FDTOVERLAYS <span style="color:#FF0000">/dtbs/allwinner/overlay/sun50i-h616-pi-i2c1.dtbo /dtbs/allwinner/overlay/sun50i-h616-ph-uart5.dtbo</span>'''| }</ol><ol start="6" style="textlist-style-aligntype: leftdecimal;"|>| '''31'''<li>After setting, you need to restart the system for the configuration to take effect.</li>{|| '''32'''| '''PWM1'''| '''PI11'''| '''267'''class="wikitable" style="width:800px;"
|-
| [orangepi@orangepi-pc ~]$ '''268sudo reboot'''| '''PI12'''}</ol><span id="how-to-install-software"></span>| '''PWM2'''| '''33'''== How to install software ==|| '''34'''You can use the pacman package management tool to install software that is not available in OPi OS. For example, the command to install the vim editor is as follows. If you want to install other software, you only need to replace vim with the package name of the software you want to install.| '''GND'''{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
|}
<ol startspan id="2" style="listandroid-12-tv-system-styleusage-type: decimal;instructions"><li>The device node corresponding to uart2 is '''/dev/ttyAS2''', and the device node corresponding to uart5 is'''/dev/ttyAS5'''</li></olspan>
<span id="supported-android-versions"></dev/ttyAS0 /dev/ttyAS1 '''/dev/ttyAS2 /dev/ttyAS5'''span>== Supported Android versions ==
|-
| '''GPIO serial numberTF card startup'''| '''GPIO'''| '''Function'''| '''pin'''|| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO serial numberOK'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''1'''|| '''2WIFI'''| '''5VOK'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''264Bluetooth'''| '''PI8OK'''| '''TWI1-SDA'''| '''3'''|| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''263USB Camera'''| '''PI7OK'''| '''TWI1-SCL'''| '''5'''|| '''6'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''269LED Light'''| '''PI13'''| '''PWM3'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224OK'''
|-
|-
| '''22640pin I2C'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''12'''| style="text-align: left;"|| '''PI1'''| '''257OK'''
|-
| '''22740pin SPI1'''| '''PH3OK'''| '''UART5_RX'''| '''13'''|| '''14'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''26140pin UART'''| '''PI5'''| '''UART2_TX'''| '''15'''|| '''16'''| '''PWM4'''| '''PI14'''| '''270OK'''
|-
|-
| '''231Hardware watchdog'''| '''PH7OK'''| '''SPI1_MOSI'''| '''19'''|| '''20'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''232Mali GPU'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''UART2_RX'''| '''PI6'''| '''262OK'''
|-
| '''230Video codec'''| '''PH6OK'''| '''SPI1_CLK'''}| '''23'''|{| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''class="wikitable" style="width:800px;text-align: center;"
|-
|-
| '''266100M network port'''| '''PI10OK'''|-| '''TWI2-SDA100M Ethernet port light'''| '''27OK'''|-| '''28USB2.0 HOST x 2'''| '''TWI2-SCLOK'''|-| '''PI9Infrared reception'''| '''265OK'''
|-
| '''256Headphone audio playback'''| '''PI0OK'''| style="text-align: left;"|| '''29'''|| '''30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''271On/off button'''| '''PI15'''| style="text-align: left;"|| '''31'''|| '''32'''| '''PWM1'''| '''PI11'''| '''267OK'''
|-
| '''268LRADC'''| '''PI12'''| '''PWM2'''| '''33Custom buttons x 2'''|| '''34OK, The default setting is the volume up and down keys.'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''258'''| '''PI2'''| style="textTV-align: left;"|| '''35'''|| '''36'''| style="text-align: left;"|| '''PC12OUT'''| '''76OK'''
|}
<ol startspan id="2" style="listonboard-led-light-styledisplay-type: decimal;instructions"><li>The device node corresponding to SPI1 CS0 is '''/dev/spidev1.0''', and the device node corresponding to SPI1 CS1 is '''/dev/spidev1.1'''</li></olspan>== Onboard LED light display instructions ==
<ol startspan id="5" style="listuse-network-connection-styleadb-type: decimal;debugging"><li>Then click the '''SPI_TEST''' button to open the SPI test interface</li></olspan>=== Use network connection adb debugging ===
test@test:~$ '''sudo apt-get install -y adb'''|}</ol><ol start="94" style="list-style-type: decimal;"><li>Finally, Then connect network adb on Ubuntu PC</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''adb connect 192.168.1.xxx:5555''' '''(Need to be modified to the APP will display the read ID information IP address of the onboard SPI Flash.development board)''' <p>* daemon not running; starting now at tcp:5037</lip> <p>* daemon started successfully</olp> [[Fileconnected to 192.168.1.xxx:zero2w-img369.png]]5555
192.168.1.xxx:5555 device|}</ol><ol start="5" style="list-style-type: decimal;"><li>Then you can log in to the android system through adb shell on Ubuntu PC</li>{| class="wikitable" style="width:800px;"
|-
| test@test:~$ '''GPIO serial numberadb shell''' apollo-p2:/ #| '''GPIO'''}</ol><span id="use-data-cable-to-connect-adb-debugging"></span> === Use data cable to connect adb debugging === | '''Function'# Prepare a USB Type C interface data cable, plug one end of the USB interface into the USB interface of the computer, and plug one end of the USB Type C interface into the USB0 interface of the development board (see the description of the picture on the right below for the location of USB0). In this case, the development board is powered by the computer's USB interface, so please ensure that the computer's USB interface can provide the most sufficient power to drive the development board.| '''pin'''|::[[File:zero2w-img304.png]] [[File:zero2w-img305.png]]| '''pin'''| '''Function'''<ol start="2" style="list-style-type: decimal;">| '''GPIO'''<li>Install adb tool on Ubuntu PC</li>{| '''GPIO serial number'''class="wikitable" style="width:800px;"
|-
|-
| test@test:~$ '''264adb devices'''| '''PI8'''| '''TWI1-SDA'''List of devices attached| '''3'''|4c00146473c28651dd0 device| '''4'''}| '''5V'''</ol>| <ol start="4" style="textlist-alignstyle-type: leftdecimal;"|><li>Then you can log in to the android system through adb shell on Ubuntu PC</li>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| test@test:~$ '''263adb shell''' apollo-p2:/ $| }</ol><span id="view-how-to-set-hdmi-display-resolution"></span> == View how to set HDMI display resolution == <ol style="list-style-type: decimal;"><li><p>Enter first '''PI7Settings'''</p><p>[[File:zero2w-img306.png]]</p></li>| <li><p>Then select '''TWI1-SCLDevice Preferences'''</p><p>[[File:zero2w-img307.png]]</p></li>| <li><p>Then select '''5Display & Sound'''</p>|<p>[[File:zero2w-img308.png]]</p></li>| <li><p>Then select '''6Advanced display settings'''</p><p>[[File:zero2w-img309.png]]</p></li>| <li><p>Then select '''GNDHDMI output mode'''</p><p>[[File:zero2w-img310.png]]</p></li>| <li><p>Then you can see the list of resolutions supported by the monitor. At this time, clicking the corresponding option will switch to the corresponding resolution. Please note that different monitors may support different resolutions. If you connect it to a TV, you will generally see more resolution options than the picture below.</p><p>[[File:zero2w-img311.png]]</p></li><li><p>The HDMI output of the development board supports 4K display. When connected to a 4K TV, you can see the 4K resolution option.</p><p>[[File:zero2w-img312.png]]</p></li></ol> <span id="hdmi-to-vga-display-test-1"></span>=== HDMI to VGA display test === <ol style="textlist-style-aligntype: leftdecimal;"|><li><p>First you need to prepare the following accessories</p>| <ol style="textlist-style-aligntype: leftlower-alpha;"|>|-<li>HDMI to VGA converter</li>| '''269'''| '''PI13'''[[File:zero2w-img144.png]]| '''PWM3'''</ol>| '''7'''<ol start="2" style="list-style-type: lower-alpha;">|<li>A VGA cable and a Mini HDMI male to HDMI female adapter</li>| '''8'''| '''UART0_TX'''[[File:zero2w-img145.png]] [[File:zero2w-img146.png]]| '''PH0'''</ol>| '''224'''|-| <ol start="3" style="textlist-style-aligntype: leftlower-alpha;"|><li>A monitor or TV that supports VGA interface</li></ol></li></ol> | <ol start="2" style="textlist-style-aligntype: leftdecimal;"|>| '''GND'''<li>HDMI to VGA display test is as follows</li>| '''9'''|[[File:zero2w-img313.png]]| '''10'''{| '''UART0_RX'''| '''PH1'''| '''225'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big>'''226When using HDMI to VGA display, the development board and the Android system of the development board do not need to make any settings. You only need the Mini HDMI interface of the development board to display normally. So if there is a problem with the test, please check whether there is a problem with the HDMI to VGA converter, VGA cable and monitor.'''</big>| }</ol><span id="wi-fi-connection-method"></span> == WI-FI connection method == # Choose first '''PH2Settings'''| ::[[File:zero2w-img306.png]] <ol start="2" style="list-style-type: decimal;"><li>Then select '''UART5_TXNetwork & Internet'''</li> [[File:zero2w-img314.png]]</ol><ol start="3" style="list-style-type: decimal;"><li>Then turn on WI-FI</li>| '''11'''|[[File:zero2w-img315.png]]| '''12'''</ol>| <ol start="4" style="textlist-style-aligntype: leftdecimal;"|>| <li>After turning on WI-FI, you can see the searched signals under '''PI1Available networks'''.</li> [[File:zero2w-img316.png]]| '''257'''</ol>|<ol start="5" style="list-style-type: decimal;">| '''227'''<li>After selecting the WI-FI you want to connect to, the password input interface shown below will pop up.</li>| '''PH3'''| '''UART5_RX'''<div class="figure">| '''13'''|[[File:zero2w-img317.png]]| '''14'''| '''GND'''</div></ol>| <ol start="6" style="textlist-alignstyle-type: leftdecimal;"|><li>Then use the keyboard to enter the password corresponding to the WI-FI, and then use the mouse to click the Enter button on the virtual keyboard to start connecting to the WI-FI.</li> <div class="figure"> [[File:zero2w-img318.png]] </div></ol>| <ol start="7" style="textlist-alignstyle-type: leftdecimal;"|><li>The display after successful WI-FI connection is as shown below</li> [[File:zero2w-img319.png]]</ol><span id="how-to-use-wi-fi-hotspot"></span> |== How to use WI-FI hotspot ==| '''261'''| '''PI5'''# First, please make sure that the Ethernet port is connected to the network cable and can access the Internet normally.| # Then select '''UART2_TXSettings'''| '''15'''|::[[File:zero2w-img306.png]]| '''16'''| '''PWM4'''<ol start="3" style="list-style-type: decimal;">| <li>Then select '''PI14Network & Internet'''</li>| '''270'''|[[File:zero2w-img314.png]]</ol>| style<ol start="text-align: left;4"|| style="textlist-style-aligntype: leftdecimal;"|>| <li>Then select '''3.3VWIFI hotspot'''</li>| '''17'''|[[File:zero2w-img320.png]]| '''18'''</ol>| <ol start="5" style="textlist-style-aligntype: leftdecimal;"|>| <li>Then open '''PH4Hotspot Enable'''. You can also see the name and password of the generated hotspot in the picture below. Remember them and use them when connecting to the hotspot (if you need to modify the name and password of the hotspot, you need to close Hotspot Enable first. Then you can modify it)</li> [[File:zero2w-img321.png]]| '''228'''</ol>|<ol start="6" style="list-style-type: decimal;">| <li>At this time, you can take out your mobile phone. If everything is normal, you can find the WIFI hotspot with the same name ('''231here AndroidAP_7132'''| ) shown under the '''PH7Hotspot name'''| in the picture above in the WI-FI list searched by the mobile phone. Then you can click AndroidAP_7132 to connect to the hotspot. The password can be seen under the '''SPI1_MOSIHotspot password'''in the picture above.</li> | [[File:zero2w-img322.png]]</ol><ol start="7" style="list-style-type: decimal;"><li>After the connection is successful, it will be displayed as shown below (the interface will be different on different mobile phones, the specific interface is subject to the one displayed on your mobile phone). At this time, you can open a web page on your mobile phone to see if you can access the Internet. If the web page can be opened normally, it means that the '''19WI-FI Hotspot'''of the development board can be used normally.</li>|| '''20'''[[File:zero2w-img323.png]]| '''GND'''</ol>| style<span id="texthow-to-check-the-ip-address-of-the-ethernet-alignport"></span> == How to check the IP address of the Ethernet port == # There is no wired network interface on the main board of the development board. We can expand the 100M Ethernet through a 24pin expansion board. : left;:[[File:zero2w-img107.png]] <ol start="2"|| style="textlist-alignstyle-type: leftdecimal;"|>|-<li><p>Then make sure the network port of the expansion board is connected to the router or switch</p></li>| <li><p>Then open '''232Settings'''</p>| <p>[[File:zero2w-img324.png]]</p></li><li><p>Then select '''PH8Network & Internet'''</p>| '''SPI1_MISO''<p>[[File:zero2w-img325.png]]</p></li><li><p>Then you can see the IP address of the development board's wired network port at the location shown in the picture below.</p><p>[[File:zero2w-img326.png]]</p></li></ol> <span id="bluetooth-connection-method"></span> == Bluetooth connection method == | # Choose first '''21Settings'''|| ::[[File:zero2w-img306.png]] <ol start="2" style="list-style-type: decimal;"><li>Then select '''22Bluetooth'''</li> [[File:zero2w-img327.png]]</ol><ol start="3" style="list-style-type: decimal;">| <li>Then Open '''UART2_RXBluetooth Enable'''</li>| [[File:zero2w-img328.png]]</ol><ol start="4" style="list-style-type: decimal;"><li>Then click '''PI6Pair new device'''to start scanning for surrounding Bluetooth devices</li>| '''262'''|[[File:zero2w-img329.png]]| '''230'''</ol>| '''PH6'''<ol start="5" style="list-style-type: decimal;">| <li>The searched Bluetooth devices will be displayed under '''SPI1_CLKAvailable devices'''</li>| '''23'''|[[File:zero2w-img330.png]]| '''24'''</ol>| '''SPI1_CS0'''<ol start="6" style="list-style-type: decimal;">| <li>Then click on the Bluetooth device you want to connect to start pairing. When the following interface pops up, please use the mouse to select the '''PH5Pair'''option</li>| '''229'''|[[File:zero2w-img331.png]]</ol>| <ol start="7" style="textlist-alignstyle-type: leftdecimal;"|><li>What is tested here is the Bluetooth configuration process between the development board and the Android phone. At this time, the following confirmation interface will pop up on the phone. Click the pairing button on the phone to start the pairing process.</li> [[File:zero2w-img332.png]]</ol>| <ol start="8" style="textlist-style-aligntype: leftdecimal;"|>| <li>After pairing is completed, open '''GNDPaired devices'''and you will see the paired Bluetooth devices.</li> [[File:zero2w-img333.png]]| </ol><ol start="9" style="list-style-type: decimal;"><li>At this time, you can use the Bluetooth of your mobile phone to send a picture to the development board. After sending, you can see the following confirmation interface in the Android system of the development board, and then click '''25Accept'''to start receiving the pictures sent by the mobile phone.</li> [[File:zero2w-img334.png]]|</ol><ol start="10" style="list-style-type: decimal;">| <li>Pictures received by the Bluetooth system of the development board Android system can be viewed in '''26Received files'''.</li> [[File:zero2w-img335.png]]</ol><span id="how-to-set-usb0-to-host-mode-1"></span> == How to set USB0 to HOST mode == As shown in the figure below, there are two Type-C interfaces on the motherboard of the development board: USB0 and USB1. Both of these interfaces can be used to power the development board, and they can also be used as USB2.0 HOST interfaces. The difference between USB0 and USB1 is that in addition to being set to HOST mode, USB0 can also be set to Device mode, while USB1 only has HOST mode. [[File:zero2w-img160.png]] USB0 of the Android12 TV system released by Orange Pi is set to Device mode by default, so when there is no need to use USB0 Device mode (ADB function needs to ensure that USB0 is in Device mode), it is recommended to use USB0 for power supply, so that USB1 can be directly used to connect USB devices .| '''SPI1_CS1'''| '''PH9'''If you want to use USB0 to connect USB devices, you need to set USB0 to HOST mode. The method is as follows: <ol style="list-style-type: lower-alpha;"><li>Run the following command to set USB0 to HOST mode:</li>{| '''233'''class="wikitable" style="width:800px;"
|-
| apollo-p2:/ # '''266cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_host'''| '''PI10'''| '''TWI2host_chose finished! apollo-SDA'''p2:/ #| '''27'''}|</ol>| '''28'''| '''TWI2<ol start="2" style="list-style-type: lower-SCL'''alpha;">| '''PI9'''<li>Run the following command to switch back to Device mode</li>{| '''265'''class="wikitable" style="width:800px;"
|-
| apollo-p2:/ # '''256cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_device'''| '''PI0'''| style="textdevice_chose finished! apollo-alignp2: left;"|/ #| '''29'''}|</ol>| '''30'''| '''GND'''| <ol start="3" style="textlist-alignstyle-type: leftlower-alpha;"|><li>The command to view the current mode of USB0 is</li>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| apollo-p2:/ # '''271cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/otg_role''' usb_host| '''PI15'''}</ol>| style<span id="texthow-to-use-usb-align: left;camera"|></span> | '''31'''== How to use USB camera ==|| '''32'''# First insert the USB (UVC protocol) camera into the USB interface of the development board| '''PWM1'''# If the USB camera is recognized normally, the corresponding video device node will be generated under /dev| '''PI11'''::{| '''267'''class="wikitable" style="width:800px;"
|-
| '''268'''| '''PI12'''| '''PWM2'''| '''33'''|| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''258'''| '''PI2'''| style="text-align: left;"|| '''35'''|| '''36'''| style="text-alignconsole: left;"|| / # '''PC12ls /dev/video0'''| '''76'''|-| '''272'''| '''PI16'''| style="text-align: left;"|| '''37'''|| '''38'''| style="text-align: left;"|| '''PI4'''| '''260'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''39'''|| '''40'''| style="text-align: left;"|| '''PI3'''| '''259'''/dev/video0
|}
<ol start="23" style="list-style-type: decimal;"><li>The device node corresponding <p>Then make sure that the adb connection between the Ubuntu PC and the development board is normal. For how to use adb, please refer to the instructions in the section "[[Orange Pi Zero 2W#How to i2c1 is use ADB|'''/dev/i2c-1How to use ADB''', and ]]".</p></li><li><p>Download the USB camera test APP from the device node corresponding to i2c2 is '''/dev/i2c-2official tool'''on the development board information download page</lip></olli>
<ol start="3" style/div><div class="list-style-type: decimal;figure"><li>First open wiringOP APP on the desktop</li></ol>
[[File:zero2w-img351.png]] <ol start="4" style="list-style-type: decimal;"><li>Then click the '''I2C_TEST''' button to open the i2c test interface</li></ol> [[File:zero2w-img370img337.png]]
</div></ol>
<ol start="5" style="list-style-type: decimal;">
<li>The i2c Then use the adb command to install the USB camera test interface of wiringOP is shown in APP into the figure belowAndroid system. Of course, you can also use a USB disk copy to install it.</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''adb install usbcamera.apk'''|}</ol><ol start="6" style="list-style-type: decimal;"><li>After installation, you can see the startup icon of the USB camera on the Android desktop.</li>
[[File:zero2w-img371img338.png]]</ol><ol start="7" style="list-style-type: decimal;"><li>Then double-click to open the USB camera APP and you can see the output video of the USB camera.</li></ol> <span id="android-system-root-description"></span>
<span id/div><div class="pin-pwm-testfigure"></span>=== 40pin PWM test ===
</div><ol start="2" style="list-style-type: decimal;"><li><p>Then make sure that the adb connection between the Ubuntu PC and the development board is normal. For how to use adb, please refer to the instructions in the section "[[Orange Pi Zero 2W#How to use ADB|'''How to use ADB''']]".</p></li><li><p>Then use the adb command to install rootcheck.apk into the Android system. Of course, you can also use a USB disk copy to install it.</p></li>{| class="wikitable" style="width:800px;"
|-
| '''GPIO serial number'''| test@test:~$ '''GPIOadb install rootcheck.apk'''| '''Function'''}| '''pin'''</ol>|<ol start="4" style="list-style-type: decimal;">| '''pin'''| '''Function'''<li>After installation, you can see the startup icon of the ROOT test tool on the Android desktop.</li>| '''GPIO'''| '''GPIO serial number'''[[File:zero2w-img340.png]]|-</ol>| style<ol start="text-align: left;5"|| style="textlist-style-aligntype: leftdecimal;"|| '''3.3V'''>| <li>The display interface after opening the '''1ROOT test tool'''for the first time is as shown below</li>|| '''2'''[[File:zero2w-img341.png]]| '''5V'''</ol>| style<ol start="text-align: left;6"|| style="textlist-style-aligntype: leftdecimal;"||->| <li>Then you can click '''264CHECK NOW'''to start checking the ROOT status of the Android system. After the check is completed, the display is as follows. You can see that the Android system has obtained ROOT permissions.</li>| '''PI8'''| '''TWI1[[File:zero2w-SDA'''img342.png]]</ol>| '''3'''<span id="how-to-use-miracastreceiver-to-cast-the-mobile-phone-screen-to-the-development-board"></span>|| '''4'''== How to use MiracastReceiver to cast the mobile phone screen to the development board ==| '''5V'''| <ol style="textlist-align: left;"|| style="text-aligntype: leftdecimal;"|>|<li><p>First, please make sure that both the development board and the mobile phone are connected to the same WIFI hotspot. For the method of connecting the development board to WIFI, please refer to [[Orange Pi Zero 2W#WI-FI connection method| '''263the instructions in the WI-FI connection method.''']]</p></li>| <li><p>Then open the '''PI7MiracastReceiver'''application in the Android system of the development board</p><p>[[File:zero2w-img343.png]]</p></li>| <li><p>The interface after '''TWI1-SCLMiracastReceiver'''is opened is as follows</p>| <div class="figure"> [[File:zero2w-img344.png]] </div></li><li><p>Then find the screen mirroring function in the phone settings. Here we take '''5Xiaomi 12S Pro mobile phone'''as an example. Please research other brands of mobile phones by yourself. As shown in the picture below, click the button in the red box to open the screen mirroring function of the phone.</p><p>[[File:zero2w-img345.png]]</p></li><li><p>After waiting for a period of time, you will be able to see the searched connectable devices on your mobile phone, and then we can select the device corresponding to the development board to connect.</p>|<p>[[File:zero2w-img346.png]]</p></li>| <li><p>Then the selection box shown in the figure below will pop up in the '''6MiracastReceiver'''| application interface of the development board. Here we can select '''GNDAccept'''</p>| style<p>[[File:zero2w-img347.png]]</p></li><li><p>Then you can see the content of the mobile phone screen on the HDMI screen connected to the development board</p><p>[[File:zero2w-img348.png]]</p></li></ol> <span id="textmethod-of-turning-on-and-off-the-align: left;machine-through-buttons-or-infrared-remote-control"|></span> | style="text= Method of turning on and off the machine through buttons or infrared remote control == We can turn off or turn on the Android system of the development board through the power on/off button or infrared remote control. However, it should be noted that there is no power on/off button and infrared receiver on the main board of the development board, and it needs to be expanded through a 24pin expansion board. [[File:zero2w-img107.png]] The location of the power button on the 24pin expansion board is as shown in the figure below: [[File:zero2w-alignimg269.png]] The location of the infrared remote control power button is as follows: left;"||[[File:zero2w-img349.png]] | When shutting down, we need to press and hold the power button or the power button on the infrared remote control, and then the Android system will pop up the confirmation dialog box shown in the figure below, and then select '''269OK'''to shut down the Android system. | '''PI13'''[[File:zero2w-img350.png]]| '''PWM3'''| '''7'''After shutting down, press and hold the power button or the power button on the infrared remote control again to turn it on.|| '''8'''<span id="pin-interface-gpio-uart-spi-test"></span>| '''UART0_TX'''== 40pin interface GPIO, UART, SPI test ==| '''PH0'''{| '''224'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big>'''Note: The pin header on the 40pin interface is not soldered by default, and you need to solder it yourself before it can be used.'''</big>|} <span id="pin-gpio-port-test-method"></span>=== 40pin GPIO port test method === # First open wiringOP APP on the desktop ::[[File:zero2w-img351.png]] <ol start="2" style="textlist-style-aligntype: leftdecimal;"|><li>Then click the '''GPIO_TEST''' button to open the GPIO test interface</li> [[File:zero2w-img352.png]]</ol>| <ol start="3" style="textlist-style-aligntype: leftdecimal;"|>| <li>The GPIO test interface is as shown in the figure below. The two rows of '''GNDCheckBox'''| buttons on the left have a one-to-one correspondence with the 40pin pins. When the '''9CheckBox'''|| button is checked, the corresponding GPIO pin will be set to '''10OUT'''| mode and the pin level is set to high level; when unchecked, the GPIO pin level will be set to low level; when the GPIO is clicked When you click the '''UART0_RXGPIO READALL'''| button, you can get information such as wPi number, GPIO mode, pin level, etc.; when you click the'''PH1BLINK ALL GPIO'''button, all GPIO ports will cycle through outputting high and low levels. This function can be used to test all the 40pin pins. GPIO port.</li> [[File:zero2w-img353.png]]</ol><ol start="4" style="list-style-type: decimal;">| <li>Then click the '''225GPIO READALL'''button, and the output information is as shown below:</li> <div class="figure"> [[File:zero2w-img354.png]] </div></ol>|<ol start="5" style="list-style-type: decimal;">| <li>There are a total of 28 GPIO ports available in the 40-pin development board. The following takes pin 12 - corresponding to GPIO PI01 - corresponding to wPi serial number 6 - as an example to demonstrate how to set the high and low levels of the GPIO port. First click the '''226CheckBox'''| button corresponding to pin 12. When the button is selected, pin 12 will be set to high level. After setting, you can use a multimeter to measure the value of the voltage of the pin. If it is '''PH23.3v''', it means the setting High level success.</li> [[File:zero2w-img355.png]]</ol><ol start="6" style="list-style-type: decimal;">| <li>Then click the '''UART5_TXGPIO READALL'''| button and you can see that the current pin 12 mode is '''11OUT'''and the pin level is high level.</li> [[File:zero2w-img356.png]]</ol>|<ol start="7" style="list-style-type: decimal;">| <li>Click the '''CheckBox'''button in the picture below again to uncheck it, and pin 12will be set to low level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is '''0v''', it means the low level setting is successful.</li> [[File:zero2w-img357.png]]</ol>| <ol start="8" style="textlist-style-aligntype: leftdecimal;"|>| <li>Then click the '''PI1GPIO READALL'''button and you can see that the current pin 12 mode is OUT and the pin level is low level.</li> [[File:zero2w-img358.png]]</ol><span id="pin-uart-test-method"></span> === 40pin UART test method === # As can be seen from the table below, the default uarts available in the Android12 TV system are uart2 and uart5. Please note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial port. <div style="display: flex;">::{| '''257'''class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''227GPIO NO.'''| '''PH3GPIO'''| '''UART5_RXFunction'''| '''13'''|| '''14'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''261'''| '''PI5'''| '''UART2_TX'''| '''15'''|| '''16'''| '''PWM4'''| '''PI14'''| '''270Pin'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''171'''|-| '''18264'''| '''PI8'''| '''TWI1-SDA'''| '''3'''|-| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|-| '''269'''| '''PI13'''| '''PWM3'''| '''7'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''9'''|-| '''<span style="color:#FF0000">226</span>'''| '''<span style="color:#FF0000">PH2</span>'''| '''<span style="color:#FF0000">UART5_TX</span>'''| '''<span style="color:#FF0000">11</span>'''|-| '''<span style="color:#FF0000">227</span>'''| '''<span style="color:#FF0000">PH3</span>'''| '''<span style="color:#FF0000">UART5_RX</span>'''| '''<span style="color:#FF0000">13</span>'''|-| '''<span style="color:#FF0000">261</span>'''| '''<span style="color:#FF0000">PI5</span>'''| '''<span style="color:#FF0000">UART2_TX</span>'''| '''<span style="color:#FF0000">15</span>'''|-| style="text-align: left;"|
| style="text-align: left;"|
| '''PH43.3V'''| '''22817'''
|-
| '''231'''
| '''SPI1_MOSI'''
| '''19'''
|-
| '''232'''
| '''SPI1_MISO'''
| '''21'''
|-
| '''230'''
| '''SPI1_CLK'''
| '''23'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|-
| '''266'''
| '''TWI2-SDA'''
| '''27'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|-| style="text-align: left;"|| style="text-align: left;"|| '''38GND'''| '''39'''|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''4'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''6'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"||-| '''8'''PI3| '''UART0_TX'''| '''PH0'''| '''224'''|-| '''10'''| '''UART0_RX'''| '''PH1'''| '''259225'''|}-| '''12'''<ol start| style="2text-align: left;" || '''PI1'''| '''257'''|-| '''14'''| '''GND'''| style="listtext-align: left;"|| style="text-typealign: decimalleft;">||-| '''16'''| '''PWM4'''<li>First click the wiringOP icon to open wiringOP APP</li></ol>| '''PI14'''| '''270'''[[File:zero2w|-img351.png]]| '''18'''<ol start="3" | style="listtext-style-typealign: decimalleft;">|<li>Then click the | '''PWM_TESTPH4''' button on the main interface of wiringOP to enter the PWM test interface</li></ol>| '''228'''[[File:zero2w|-img380.png]]| '''20'''<ol start| '''GND'''| style="4text-align: left;" || style="list-styletext-typealign: decimalleft;">||-| '''<lispan style="color:#FF0000">The PWM test interface is as follows22</li></olspan>''' | '''<div classspan style="figurecolor:#FF0000"> [[File:zero2w-img381.png]] UART2_RX</divspan>'''| '''<ol start="5" span style="list-style-typecolor: decimal;#FF0000"><li>Then set which PWM you want to use in the Channel. The default is PWM1. If you want to set it to PWM2, just enter 2 in the Channel. PWM3 and PWM4 and so on.PI6</li></olspan>''' [[File:zero2w-img382.png]] | '''<ol start="6" span style="list-style-typecolor: decimal;#FF0000">262<li/span>Then you can set the PWM period. The default configuration is '''50000ns|-| '''24'''| '''SPI1_CS0''. The converted PWM frequency is '| ''20KHz'PH5'''</li></ol>| '''229'''[[File:zero2w|-img383.png]]| '''26'''<ol start="7" style="list| '''SPI1_CS1'''| '''PH9'''| '''233'''|-style| '''28'''| '''TWI2-type: decimal;">SCL'''<li>Then click the | '''EXPORTPI9'''button to export PWM</li></ol>| '''265'''[[File:zero2w|-img384.png]]| '''30'''<ol start| '''GND'''| style="8text-align: left;" || style="list-styletext-typealign: decimalleft;">||-| '''32'''| '''PWM1'''<li>Then drag the progress bar below to change the PWM duty cycle, and then check | '''EnablePI11''' to output the PWM waveform.</li></ol>| '''267'''[[File:zero2w|-img385.png]]| '''34'''| '''GND'''<ol start="9" | style="list-styletext-typealign: decimalleft;">|<li>Then use an oscilloscope to measure the corresponding pins in the 40pin development board and you can see the following waveform.</li></ol> [[File:zero2w-img386.png]] <span id| style="howtext-to-compile-android-12-source-codealign: left;"></span>||-= | '''How to compile Android 12 source code36''' = <span id| style="downloadtext-the-source-code-of-android-12align: left;"></span>|== Download the source code of Android 12 ==| '''PC12'''| '''76'''<ol style="list|-style-type: decimal;"><li><p>First download the compressed package of the Android 12 source code and the compressed package of the files modified by Orange Pi Zero2w from Google Cloud Drive</p>| '''38'''<ol | style="listtext-style-typealign: lower-alphaleft;">|<li>Google Cloud Drive</li></ol>| '''PI4'''</li></ol>| '''260''' [[File:zero2w|-img387.png]]| '''40'''<ol start="2" | style="list-styletext-typealign: decimalleft;">|| '''PI3'''<li>After downloading the compressed package of Android 12 source code, please check whether the MD5 checksum is correct. If it is incorrect, please download the source code again. Here| '''259'''s how to check the MD5 checksum:|}</li></oldiv>
[[File:zero2w-img360.png]]</ol><ol start="6" style="list-style-type: decimal;"><li><p>Then select the '''/dev/ttyAS2''' or'''/dev/ttyAS5''' node in the selection box</p><p>[[File:zero2w-img361.png]]</p></li><li><p>Enter the baud rate you want to set in the edit box, and then click the '''OPEN''' button to open the uart node.After the opening is successful, the '''OPEN''' button becomes unselectable, and the '''CLOSE''' button and '''SEND''' button become selectable...</p></li>
[[File:zero2w-img362.png]]</ol><ol start="38" style="list-style-type: decimal;"><li><p>Then use Dupont wire to short the rx and tx pins of uart</p></li><li><p>Then you need to merge multiple compressed files into one, can enter a paragraph of characters in the send edit box below and then extract click the Android source code'''SEND''' button to start sending. The command looks like this:</lip></olli>
Opios-arch-aarch64-xfce-opizero2w-23.09-linux6.1.31.img.xz