Changes

Jump to: navigation, search

Orange Pi Zero 2W

26,102 bytes added, 20:33, 27 September 2023
Download orangepi-build from github
<div class="figure">
[[File:zero2w-img3.png|800px]]
</div>
<div class="figure">
[[File:zero2w-img4.png|800px]]
</div>
<div class="figure">
[[File:zero2w-img5.png|800px]]
</div>
<span id="orange-pi-zero-2w-24pin-expansion-board-interface-details"></span>
 
== Orange Pi Zero 2w 24pin expansion board interface details ==
<div class="figure">
[[File:zero2w-img6.png|800px]]
</div>
[[File:zero2w-img7.png|800px]]
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
<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 &gt; '''sudo''' permissions.</p>
{| class="wikitable" style="width:800px;"
|-
<li><p>Then select '''Hardware'''</p>
<p>[[File:zero2w-img81.png]]</p></li>
<li><p>Then use the keyboard's arrow keys to locate the position shown &gt; in the figure below, and then use the '''space''' to select the &gt; dtbo configuration of the SPI you want to open.</p></li>
{| class="wikitable" style="width:800px;text-align: center;"
<li><p>Then select '''&lt;Back&gt;'''</p>
<p>[[File:zero2w-img84.png]]</p></li>
<li><p>Then select '''&lt;Reboot&gt;'''to restart the system to make the &gt; configuration take effect.</p>
<p>[[File:zero2w-img85.png]]</p></li></ol>
</li></ol>
<ol style="list-style-type: decimal;">
<li><p>First install dependency packages</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>root@orangepi:~# '''sudo apt-get update'''</p>
<p>root@orangepi:~# '''sudo apt-get -y install git swig python3-dev python3-setuptools'''</p>|}</li><li><p>Then use the following command to download the source code of wiringOP-Python</p></li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| </olbig> '''Note that the following git clone--recursive command will automatically download the source code of wiringOP, because wiringOP-Python depends on wiringOP. Please make sure there are no errors during the download process due to network problems.''' If there is a problem downloading the code from GitHub, you can directly use the wiringOP-Python source code that comes with the Linux image. The storage location is: '''/usr/src/wiringOP-Python'''
'''If there is a problem downloading the code from GitHub, you can directly use the wiringOP-Python source code that comes with the Linux image. The storage location is: /usr/src/wiringOP-Python'''</big>
|}
{| class="wikitable" style="width:800px;"
|-
|
root@orangepi:~# '''git clone --recursive https://github.com/orangepi-xunlong/wiringOP-Python -b next'''
root@orangepi:~/wiringOP-Python# '''git submodule update --init --remote'''
|}</ol>
<ol start="3" style="list-style-type: decimal;">
<li><p>Then use the following command to compile wiringOP-Python and install it into the Linux system of the development board</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>root@orangepi:~# '''cd wiringOP-Python'''</p>
<p>root@orangepi:~/wiringOP-Python# '''python3 generate-bindings.py &gt; bindings.i'''</p>
<p>root@orangepi:~/wiringOP-Python# '''sudo python3 setup.py install'''</p>|}</li><li><p>Then enter the following command. If helpful information is output, it means wiringOP-Python is successfully installed. Press the '''q''' key to exit the help information interface.</p></li></ol>{| class="wikitable" style="width:800px;" |-|
root@orangepi:~/wiringOP-Python# '''python3 -c &quot;import wiringpi; help(wiringpi)&quot;'''
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.
: # the SWIG interface file instead.
|}
</ol>
<ol start="5" style="list-style-type: decimal;">
<li><p>The steps to test whether wiringOP-Python is installed successfully under the python command line are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li>First use the python3 command to enter the command line mode of &gt; python3</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
root@orangepi:~# '''python3'''
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>Then import the python module of wiringpi</li></ol>{| class="wikitable" style="width:800px;" |-|
&gt;&gt;&gt; '''import wiringpi;'''
|}</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>Finally, enter the following command to view the help information of &gt; wiringOP-Python. Press the q key to exit the help information &gt; interface.</li></ol>{| class="wikitable" style="width:800px;" |-|
&gt;&gt;&gt; '''help(wiringpi)'''
Help on module wiringpi:
 
NAME
:wiringpi 
DESCRIPTION
: # This file was automatically generated by SWIG (http://www.swig.org). : # Version 4.0.2
: # Version 4.0.2
: #Do not make changes to this file unless you know what you are doing--modify
: # Do not make changes to this the SWIG interface file unless you know what you are doing--modifyinstead.
# the SWIG interface file instead.
CLASSES
:builtins.object ::GPIO ::I2C
GPIO::Serial
I2C::nes
Serial
nes:class GPIO(builtins.object)
class :| GPIO(builtins.objectpinmode=0)
:| GPIO(pinmode=0)
|
&gt;&gt;&gt;
|}
</ol>
</li></ol>
<span id="pin-gpio-port-test-1"></span>
<span id="pin-gpio-port-test-1"></span>
=== 40pin GPIO port test ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Like wiringOP, wiringOP-Python can also determine which GPIO pin to operate by specifying the wPi number. Because there is no command to view the wPi number in wiringOP-Python, you can only view the board's wPi number and physics through the gpio command in wiringOP Correspondence of pins.'''</big>
[[File:zero2w-img170.png|center]]|}
<ol style="list-style-type: decimal;">
<li><p>The steps for testing directly with commands are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First set the GPIO port to output mode, where the first &gt; parameter of the '''pinMode''' function is the serial number of &gt; the wPi corresponding to the pin, and the second parameter is &gt; the GPIO mode.</p>{| class="wikitable" style="width:800px;" |-|
<p>root@orangepi:~/wiringOP-Python# '''python3 -c &quot;import wiringpi; \'''</p>
<p>'''from wiringpi import GPIO; wiringpi.wiringPiSetup() ; \'''</p>
<p>'''wiringpi.pinMode(<span style="color:#FF0000">2, GPIO.OUTPUT</span>) ; &quot;'''</p>|}</li><li><p>Then set the GPIO port to output a low level. After setting, you &gt; can use a multimeter to measure the voltage value of the pin. &gt; If it is 0v, it means the low level is set successfully.</p>{| class="wikitable" style="width:800px;" |-|
<p>root@orangepi:~/wiringOP-Python# '''python3 -c &quot;import wiringpi; \'''</p>
<p>'''from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\'''</p>
<p>'''wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.LOW</span>)&quot;'''</p>|}</li><li><p>Then set the GPIO port to output a high level. After setting, &gt; you can use a multimeter to measure the voltage value of the &gt; pin. If it is 3.3v, it means the setting of the high level is &gt; successful.</p>{| class="wikitable" style="width:800px;" |-|
<p>root@orangepi:~/wiringOP-Python# '''python3 -c &quot;import wiringpi; \'''</p>
<p>'''from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\'''</p>
<p>'''wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.HIGH</span>)&quot;'''</p>|}</li></ol>
</li>
<li><p>The steps for testing in the command line of python3 are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First use the python3 command to enter the command line mode of &gt; python3</p>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~# '''python3'''</p>|}</li>
<li><p>Then import the python module of wiringpi</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>&gt;&gt;&gt; '''import wiringpi'''</p>
<p>&gt;&gt;&gt; '''from wiringpi import GPIO'''</p>|}</li><li><p>Then set the GPIO port to output mode, where the first parameter &gt; of the '''pinMode'''function is the serial number of the wPi &gt; corresponding to the pin, and the second parameter is the GPIO &gt; mode.</p>{| class="wikitable" style="width:800px;" |-|
<p>&gt;&gt;&gt; '''wiringpi.wiringPiSetup()'''</p>
<p>0</p>
<p>&gt;&gt;&gt; '''wiringpi.pinMode(<span style="color:#FF0000">2, GPIO.OUTPUT</span>)'''</p>|}</li><li><p>Then set the GPIO port to output a low level. After setting, you &gt; can use a multimeter to measure the voltage value of the pin. &gt; If it is 0v, it means the low level is set successfully.</p>{| class="wikitable" style="width:800px;" |-| <p>&gt;&gt;&gt; '''wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.LOW</span>)'''</p>|}</li><li><p>Then set the GPIO port to output a high level. After setting, &gt; you can use a multimeter to measure the voltage value of the &gt; pin. If it is 3.3v, it means the setting of the high level is &gt; successful.</p>{| class="wikitable" style="width:800px;" |-| <p>&gt;&gt;&gt; '''wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.HIGH</span>)'''</p>|}</li></ol>
</li>
<li><p>For wiringOP-Python to set the GPIO high and low levels in the python code, you can refer to the '''blink.py''' test program in the examples. The '''blink.py''' test program will set the voltage of all GPIO ports in the 40 Pin of the development board to continuously change high and low.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p>
<p>root@orangepi:~/wiringOP-Python/examples# '''ls blink.py'''</p>
<p>'''blink.py'''</p>
<p>root@orangepi:~/wiringOP-Python/examples'''# python3 blink.py'''</p>|}</li></ol>
<span id="pin-spi-test-1"></span>
 
=== 40pin SPI test ===
# As can be seen from the table below, the spi available for the 40pin interface is spi1, and there are two chip select pins cs0 and cs1
<div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO NO.'''
| '''Function'''
| '''Pin'''
|
| '''Pin'''
| '''Function'''
| '''GPIO'''
| '''GPIO NO.'''
|-
| 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;"|
| style="text-align: left;"|
|-
| '''263'''
| '''TWI1-SCL'''
| '''5'''
|
| '''6'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''269'''
| '''PWM3/UART4_TX'''
| '''7'''
|
| '''8'''
| '''UART0_TX'''
| '''PH0'''
| '''224'''
|-
| style="text-align: left;"|
| '''GND'''
| '''9'''
|
| '''10'''
| '''UART0_RX'''
| '''PH1'''
| '''225'''
|-
| '''226'''
| '''UART5_TX'''
| '''11'''
|
| '''12'''
| style="text-align: left;"|
| '''PI1'''
| '''257'''
|-
| '''227'''
| '''UART5_RX'''
| '''13'''
|
| '''14'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''261'''
| '''TWI0_SCL/UART2_TX'''
| '''15'''
|
| '''16'''
| '''PWM4/UART4_RX'''
| '''PI14'''
| '''270'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|
| '''18'''
| style="text-align: left;"|
| '''PH4'''
| '''228'''
|-
| '''<span style="color:#FF0000">231</span>'''| '''<span style="color:#FF0000">PH7</span>'''| '''<span style="color:#FF0000">SPI1_MOSI</span>'''| '''19'''|| '''20'''| '''GND'''| <span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"|>19</span>'''
|-
| '''<span style="color:#FF0000">232</span>'''| '''<span style="color:#FF0000">PH8</span>'''| '''<span style="color:#FF0000">SPI1_MISO</span>'''| '''<span style="color:#FF0000">21'''|| '''22'''| '''TWI0_SDA</UART2_RX'''| '''PI6'''| '''262span>'''
|-
| '''<span style="color:#FF0000">230</span>'''| '''<span style="color:#FF0000">PH6</span>'''| '''<span style="color:#FF0000">SPI1_CLK</span>'''| '''<span style="color:#FF0000">23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229</span>'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|
| '''26'''
| '''SPI1_CS1'''
| '''PH9'''
| '''233'''
|-
| '''266'''
| '''TWI2-SDA/UART3_RX'''
| '''27'''
|
| '''28'''
| '''TWI2-SCL/UART3_TX'''
| '''PI9'''
| '''265'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|
| '''30'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|
| '''32'''
| '''PWM1'''
| '''PI11'''
| '''267'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''PC12'''
| '''76'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|
| '''40'''
| style="text-align: left;"|
| '''PI3'''
| '''259'''
|}
 <ol start{| class="2wikitable" style="listwidth:390px;margin-styleright: 20px;text-typealign: decimalcenter;"><li><p>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;">| '''Pin'''<li><p>First run | '''orangepi-configFunction'''| '''. Ordinary users remember to add &gt; GPIO'''sudo| ''' permissionsGPIO NO.</p>'''|-<p>orangepi@orangepi:~$ | '''sudo orangepi-config2'''</p></li><li><p>Then select | '''System5V'''</p><p>[[File| style="text-align: left;"|| style="text-align:zero2wleft;"||-img80.png]]</p></li><li><p>Then select | '''4'''| '''Hardware5V'''</p><p>[[File| style="text-align:zero2wleft;"|| style="text-align: left;"||-img81.png]]</p></li><li><p>Then use the keyboard| 's arrow keys to locate the position shown &gt; in the figure below, and then use the ''6'''| '''spaceGND''' to select the &gt| style="text-align: left; dtbo configuration of the SPI you want to open.</p></li></ol></li></ol>"|{| classstyle="wikitabletext-align: left;"|
|-
| '''dtbo configuration8'''| '''illustrateUART0_TX'''| '''PH0'''| '''224'''
|-
| '''spi1-cs0-cs1-spidev10'''| '''Open cs0 and cs1 of spi1 at the same timeUART0_RX'''| '''PH1'''| '''225'''
|-
| '''spi112'''| style="text-cs0-spidevalign: left;"|| '''PI1'''| '''Only open cs0 of spi1257'''
|-
| '''spi1-cs1-spidev14'''| '''Only open cs1 of spi1GND'''|} <ol start="5" style="listtext-style-typealign: lower-alphaleft;"><li><p>Then select '''&lt;Save&gt;''' to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''&lt;Back&gt;'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''&lt;Reboot&gt;''' to restart the system to make the &gt; configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol> <!-- --><ol start="3" style="list-style-type: decimal;"><li><p>Then check whether there is a '''spidev1.x''' device node in the Linux system. If it exists, it means that the SPI1 configuration has taken effect.</p><p>orangepi@orangepi:~$ '''ls /dev/spidev1*'''</p><p>/dev/spidev1.0 /dev/spidev1.1</p><p>'''Note that only when you open spi1-cs0-cs1-spidev, you will see the device nodes of the two spi.'''</p></li><li><p>Then you can use the '''spidev_test.py''' program in examples to test the SPI loopback function. The '''spidev_test.py''' program needs to specify the following two parameters:</p><ol style="list-style-type: lower-alpha;"><li><p>'''--channel''': Specify the channel number of SPI</p></li><li><p>'''--port''': Specify the port number of the SPI</p></li></ol></li><li><p>Without shorting the mosi and miso pins of SPI1, the output result of running spidev_test.py is as follows. You can see that the data of TX and RX are inconsistent.</p><p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p></li></ol> root@orangepi:~/wiringOP-Python/examples# '''python3 spidev_test.py \''' '''--channel 1 --port 0''' spi mode: 0x0 max speed: 500000 Hz (500 KHz) Opening device /dev/spidev1.1 TX | FF FF FF FF FF FF '''40 00 00 00 00 95''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…RX | FF FF FF FF FF FF '''FF FF FF FF FF FF''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF |.............….<ol start="6" style="listtext-style-typealign: decimalleft;"><li><p>Then use Dupont wire to short-circuit the txd (pin 19 in the 40pin interface) and rxd (pin 21 in the 40pin interface) of SPI1 and then run spidev_test.py. The output is as follows, you can see If the data sent and received are the same, it means that the SPI1 loopback test is normal.</p><p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p></li></ol> root@orangepi:~/wiringOP-Python/examples# '''python3 spidev_test.py \''' '''--channel 1 --port 0''' spi mode: 0x0 max speed: 500000 Hz (500 KHz) Opening device /dev/spidev1.1 TX | FF FF FF FF FF FF '''40 00 00 00 00 95''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…| RX | FF FF FF FF FF FF '''40 00 00 00 00 95''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…| <span id="pin-i2c-test-1"></span>=== 40pin I2C test === # As can be seen from the table below, the i2c available for the 40pin interface are i2c0, i2c1 and i2c2 {| class="wikitable"
|-
| '''GPIO NO.16'''| '''GPIOPWM4/UART4_RX'''| '''FunctionPI14'''| '''Pin'''|| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.270'''
|-
| '''18'''
| style="text-align: left;"|
| style="text-align: left;"|| '''3.3VPH4'''| '''1228'''|-| '''220'''| '''5VGND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26422'''| '''PI8TWI0_SDA/UART2_RX'''| '''TWI1PI6'''| '''262'''|-| '''<span style="color:#FF0000">24</span>'''| '''<span style="color:#FF0000">SPI1_CS0</span>'''| '''<span style="color:#FF0000">PH5</span>'''| '''<span style="color:#FF0000">229</span>'''|-| '''<span style="color:#FF0000">26</span>'''| '''<span style="color:#FF0000">SPI1_CS1</span>'''| '''<span style="color:#FF0000">PH9</span>'''| '''<span style="color:#FF0000">233</span>'''|-| '''28'''| '''TWI2-SDASCL/UART3_TX'''| '''3PI9'''|'''265'''|-| '''430'''| '''5VGND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26332'''| '''PI7PWM1'''| '''TWI1-SCLPI11'''| '''5267'''|-| '''634'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26936'''| '''PI13'''| '''PWM3/UART4_TX'''style="text-align: left;"| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0PC12'''| '''22476'''
|-
| '''38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| '''40'''
| style="text-align: left;"|
| '''GNDPI3'''| '''9259'''|}</div> <ol start="2" style="list-style-type: decimal;"><li><p>In Linux systems, spi1 is turned off by default and needs to be turned on manually before it can be used. The opening steps are as follows:</p><ol style="list-style-type: lower-alpha;"><li><p>First run '''orangepi-config'''. Ordinary users remember to add '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''10sudo orangepi-config'''</p>| }</li><li><p>Then select '''UART0_RXSystem'''</p><p>[[File:zero2w-img80.png]]</p></li>| <li><p>Then select '''PH1Hardware'''</p><p>[[File:zero2w-img81.png]]</p></li>| <li><p>Then use the keyboard's arrow keys to locate the position shown in the figure below, and then use the '''225space'''to select the dtbo configuration of the SPI you want to open.</p></li> {| class="wikitable" style="width:800px;text-align: center;"
|-
| '''226dtbo configuration'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''12'''| style="text-align: left;"|| '''PI1'''| '''257illustrate'''
|-
| '''227'''| '''PH3spi1-cs0-cs1-spidev'''| '''UART5_RXOpen cs0 and cs1 of spi1 at the same time'''| '''13'''|| '''14'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''261spi1-cs0-spidev'''| '''PI5'''| '''TWI0_SCL/UART2_TX'''| '''15'''|| '''16'''| '''PWM4/UART4_RX'''| '''PI14'''| '''270Only open cs0 of spi1'''
|-
| style="text'''spi1-cs1-align: left;"spidev'''|'''Only open cs1 of spi1'''| }</ol><ol start="5" style="textlist-style-aligntype: leftlower-alpha;"|>| <li><p>Then select '''3.3V&lt;Save&gt;'''to save</p><p>[[File:zero2w-img83.png]]</p></li>| <li><p>Then select '''17&lt;Back&gt;'''</p>|<p>[[File:zero2w-img84.png]]</p></li>| <li><p>Then select '''18&lt;Reboot&gt;'''to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol></li></ol><!-- -->| <ol start="3" style="textlist-alignstyle-type: leftdecimal;"|>| <li><p>Then check whether there is a '''PH4spidev1.x'''device node in the Linux system. If it exists, it means that the SPI1 configuration has taken effect.</p>{| '''228'''class="wikitable" style="width:800px;"
|-
| '''231'''| <p>orangepi@orangepi:~$ '''PH7ls /dev/spidev1*'''</p>| '''SPI1_MOSI'''| '''19'''<p>/dev/spidev1.0 /dev/spidev1.1</p>|}{| '''20'''| '''GND'''| styleclass="text-align: left;wikitable"|| style="textbackground-aligncolor:#ffffdc;width: left800px;"|
|-
| <big><p>'''232Note that only when you open spi1-cs0-cs1-spidev, you will see the device nodes of the two spi.'''</p></big>| }</li><li><p>Then you can use the '''PH8spidev_test.py'''| program in examples to test the SPI loopback function. The '''SPI1_MISOspidev_test.py'''program needs to specify the following two parameters:</p><ol style="list-style-type: lower-alpha;">| <li><p>'''21--channel''': Specify the channel number of SPI</p></li>|| <li><p>'''22--port''': Specify the port number of the SPI</p></li></ol>| '''TWI0_SDA</UART2_RX'''li>| '''PI6'''<li><p>Without shorting the mosi and miso pins of SPI1, the output result of running spidev_test.py is as follows. You can see that the data of TX and RX are inconsistent.</p>{| '''262'''class="wikitable" style="width:800px;"
|-
| <p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p> root@orangepi:~/wiringOP-Python/examples# '''python3 spidev_test.py \''' '''230--channel 1 --port 0''' spi mode: 0x0 max speed: 500000 Hz (500 KHz) Opening device /dev/spidev1.1 TX | FF FF FF FF FF FF '''PH6<span style="color:#FF0000">40 00 00 00 00 95</span>'''FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…| RX | FF FF FF FF FF FF '''SPI1_CLK<span style="color:#FF0000">FF FF FF FF FF FF</span>'''FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF |.............….||}</li></ol><ol start="6" style="list-style-type: decimal;"><li><p>Then use Dupont wire to short-circuit the txd (pin 19 in the 40pin interface) and rxd (pin 21 in the 40pin interface) of SPI1 and then run spidev_test.py. The output is as follows, you can see If the data sent and received are the same, it means that the SPI1 loopback test is normal.</p>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p> root@orangepi:~/wiringOP-Python/examples# '''23python3 spidev_test.py \''' '''--channel 1 --port 0''' spi mode: 0x0 max speed: 500000 Hz (500 KHz) Opening device /dev/spidev1.1 TX | FF FF FF FF FF FF '''<span style="color:#FF0000">40 00 00 00 00 95</span>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…| RX | FF FF FF FF FF FF '''<span style="color:#FF0000">40 00 00 00 00 95</span>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…||}</li></ol><span id="pin-i2c-test-1"></span> === 40pin I2C test === # As can be seen from the table below, the i2c available for the 40pin interface are i2c0, i2c1 and i2c2 <div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''24GPIO NO.'''| '''SPI1_CS0GPIO'''| '''PH5Function'''| '''229Pin'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND3.3V'''| '''25'''|| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''2331'''
|-
| '''266<span style="color:#FF0000">264</span>'''| '''PI10<span style="color:#FF0000">PI8</span>'''| '''TWI2<span style="color:#FF0000">TWI1-SDA</UART3_RXspan>'''| '''27<span style="color:#FF0000">3</span>'''|-| '''<span style="color:#FF0000">263</span>'''| '''28<span style="color:#FF0000">v</span>'''| '''TWI2<span style="color:#FF0000">TWI1-SCL</UART3_TXspan>'''| '''PI9<span style="color:#FF0000">5</span>'''|-| '''269'''| '''PI13'''| '''PWM3/UART4_TX'''| '''2657'''
|-
| '''256'''
| '''PI0'''
| style="text-align: left;"|
| '''29'''style="text-align: left;"|| '''30'''
| '''GND'''
| style="text'''9'''|-align: left;"|'''226'''| style="text-align: left;"'''PH2'''| '''UART5_TX'''|'''11'''
|-
| '''271227'''| '''PI15'''| style="text-align: left;"|| '''31'''|| '''32'''| '''PWM1PH3'''| '''PI11UART5_RX'''| '''26713'''
|-
| '''268<span style="color:#FF0000">261</span>'''| '''PI12<span style="color:#FF0000">PI5</span>'''| '''PWM2'''| '''33'''|| '''34<span style="color:#FF0000">TWI0_SCL</span>/UART2_TX'''| '''GND'''| <span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"|>15</span>'''
|-
| '''258'''
| '''PI2'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''PC123.3V'''| '''7617'''|-| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|-| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''25'''|-| '''<span style="color:#FF0000">266</span>'''| '''<span style="color:#FF0000">PI10</span>'''| '''<span style="color:#FF0000">TWI2-SDA</span>/UART3_RX'''| '''<span style="color:#FF0000">27</span>'''|-| '''256'''| '''PI0'''| style="text-align: left;"|| '''29'''|-| '''271'''| '''PI15'''| style="text-align: left;"|| '''31'''|-| '''268'''| '''PI12'''| '''PWM2'''| '''33'''|-| '''258'''| '''PI2'''| style="text-align: left;"|| '''35'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|
| '''40'''
| style="text-align: left;"|
| '''PI3'''
| '''259'''
|}
 <ol start{| class="2wikitable" style="listwidth:390px;margin-styleright: 20px;text-typealign: decimalcenter;"><li><p>i2c is turned off by default in Linux systems and needs to be turned on manually to use it|-| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO. The opening steps are as follows:</p>'''|-| '''2'''| '''5V'''<ol | style="listtext-align: left;"|| style="text-typealign: lower-alphaleft;">|<li><p>First run |-| '''orangepi-config4'''. Ordinary users remember to add &gt; | '''sudo5V''' permissions.</p><p>orangepi@orangepi| style="text-align: left;"|| style="text-align:~$ left;"||-| '''sudo orangepi-config6'''</p></li><li><p>Then select | '''SystemGND'''</p><p>[[File| style="text-align:zero2wleft;"|| style="text-align: left;"||-img80.png]]</p></li><li><p>Then select | '''Hardware8'''</p><p>[[File:zero2w-img81.png]]</p></li>| '''UART0_TX'''<li><p>Then use the keyboard| 's arrow keys to locate the position shown &gt; in the picture below, and then use the ''PH0'space''' to select the &gt; corresponding i2c configuration in the picture below.</p></li></ol></li></ol> {| class="wikitable"'''224'''
|-
| '''Multiplexing function in 40pin10'''| '''Corresponding dtbo configurationUART0_RX'''| '''PH1'''| '''225'''
|-
| '''40pin 12'''| style="text- i2c0align: left;"|| '''PI1'''| '''pi-i2c0257'''
|-
| '''40pin - i2c114'''| '''pi-i2c1GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - i2c216'''| '''pi-i2c2PWM4/UART4_RX'''|} [[File:zero2w-img173.png]] <ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select <span class="mark">&lt;Save&gt;</span> to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select <span class="mark">&lt;Back&gt;</span></p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select <span class="mark">&lt;Reboot&gt;</span> to restart the system to make the &gt; configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol> <!-- --><ol start="3" style="list-style-type: decimal;"><li><p>After starting the Linux system, first confirm that there is an open i2c device node under <span class="mark">/dev</span></p><p>orangepi@orangepi:~$ '''ls /dev/i2c-*'''</p><p>'''/dev/i2c-*'''</p><p>'''Sometimes the i2c device node and the i2c bus serial number do not correspond one to one. For example, the i2c device node of the i2c1 bus may be /dev/i2c-3.'''</p><p>'''The method to accurately confirm the device node under /dev corresponding to the i2c bus is:'''</p></li></ol> <!-- --><ol start="3" style="list-style-type: lower-alpha;"><li><p>'''First run the following command to check the corresponding relationship of i2cPI14'''</p><p>orangepi@orangepizero2w:~$ '''ls /sys/devices/platform/soc*/*/i2c-* | grep &quot;i2c-[0-9]&quot;'''</p><p>/sys/devices/platform/soc/5002000.i2c/i2c-0:</p><p>/sys/devices/platform/soc/5002400.i2c/i2c-3:</p><p>/sys/devices/platform/soc/5002800.i2c/i2c-4:</p><p>/sys/devices/platform/soc/5002c00.i2c/i2c-5:</p><p>/sys/devices/platform/soc/6000000.hdmi/i2c-2:</p><p>/sys/devices/platform/soc/7081400.i2c/i2c-1:</p></li><li><p>'''In the above output270'''</p></li></ol> <!-- --><ol start="4" style="list-style-type: lower-alpha;"><li><p>002000 is the register base address of the i2c0 bus, and i2c-0 shown behind it is its corresponding i2c device node</p></li><li><p>5002400 is the register base address of the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li><li><p>5002800 is the register base address of the i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p></li></ol> <!-- --><ol start="4" style="list-style-type: decimal;"><li><p>Then start testing i2c, first install i2c-tools</p><p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo''' '''apt-get install -y i2c-tools'''</p></li><li><p>Then connect an i2c device to the i2c pin of the 40pin connector. Here we take the DS1307 RTC module as an example.</p><p>[[File:zero2w-img178.png]]</p></li><li><p>Then use the '''i2cdetect -y x'''command. If the address of the connected i2c device can be detected, it means that the i2c device is connected correctly.</p><p>'''Note that x in the i2cdetect -y x command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p></li></ol> [[File:zero2w-img179.png]] <ol start="7" style="list-style-type: decimal;"><li><p>Then you can run the '''ds1307.py''' test program in '''examples''' to read the RTC time</p><p>'''Note that the x in i2c-x in the following command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p><p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p><p>root@orangepi:~/wiringOP-Python/examples# '''python3 ds1307.py --device \'''</p><p>'''&quot;/dev/i2c-x&quot;'''</p><p>Thu 2022-06-16 04:35:46</p><p>Thu 2022-06-16 04:35:47</p><p>Thu 2022-06-16 04:35:48</p><p>^C</p><p>exit</p></li></ol> <span id="pin-uart-test-1"></span>=== 40pin UART test === # As can be seen from the table below, the available uarts are uart2, uart3, uart4 and uart5. Please note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial port. {| class="wikitable"
|-
| '''GPIO NO.18'''| '''GPIO'''| '''Function'''style="text-align: left;"| '''Pin'''|| '''Pin'''| '''Function'''| '''GPIOPH4'''| '''GPIO NO.228'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''1'''|| '''220'''| '''5VGND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''264<span style="color:#FF0000">22</span>'''| '''PI8<span style="color:#FF0000">TWI0_SDA</span>/UART2_RX'''| '''TWI1<span style="color:#FF0000">PI6</span>'''| '''<span style="color:#FF0000">262</span>'''|-| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''<span style="color:#FF0000">28</span>'''| '''<span style="color:#FF0000">TWI2-SDASCL</span>/UART3_TX'''| '''3<span style="color:#FF0000">PI9</span>'''|'''<span style="color:#FF0000">265</span>'''|-| '''430'''| '''5VGND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26332'''| '''PI7PWM1'''| '''TWI1-SCLPI11'''| '''5267'''|-| '''634'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26936'''| '''PI13'''| '''PWM3/UART4_TX'''style="text-align: left;"| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0PC12'''| '''22476'''
|-
| '''38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| '''40'''
| style="text-align: left;"|
| '''GNDPI3'''| '''9259'''|}</div> <ol start="2" style="list-style-type: decimal;"><li><p>i2c is turned off by default in Linux systems and needs to be turned on manually to use it. The opening steps are as follows:</p><ol style="list-style-type: lower-alpha;"><li><p>First run '''orangepi-config'''. Ordinary users remember to add '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''10sudo orangepi-config'''</p>| }</li><li><p>Then select '''UART0_RXSystem'''</p><p>[[File:zero2w-img80.png]]</p></li>| <li><p>Then select '''PH1Hardware'''</p><p>[[File:zero2w-img81.png]]</p></li>| <li><p>Then use the keyboard's arrow keys to locate the position shown in the picture below, and then use the '''225space'''to select the corresponding i2c configuration in the picture below.</p></li> {| class="wikitable" style="width:800px;text-align: center;"
|-
| '''226Multiplexing function in 40pin'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''12'''| style="text-align: left;"|| '''PI1'''| '''257Corresponding dtbo configuration'''
|-
| '''22740pin - i2c0'''| '''PH3'''| '''UART5_RX'''| '''13'''|| '''14'''| '''GNDpi-i2c0'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''26140pin - i2c1'''| '''PI5'''| '''TWI0_SCL/UART2_TX'''| '''15'''|| '''16'''| '''PWM4/UART4_RX'''| '''PI14'''| '''270pi-i2c1'''
|-
| '''40pin - i2c2'''| '''pi-i2c2'''|} [[File:zero2w-img173.png]]</ol><ol start="5" style="textlist-style-aligntype: leftlower-alpha;"|>| style<li><p>Then select <span class="textmark">&lt;Save&gt;</span> to save</p><p>[[File:zero2w-alignimg83.png]]</p></li><li><p>Then select <span class="mark">&lt;Back&gt;</span></p><p>[[File: leftzero2w-img84.png]]</p></li><li><p>Then select <span class="mark">&lt;"|Reboot&gt;</span> to restart the system to make the configuration take effect.</p>| '''3<p>[[File:zero2w-img85.3V'''png]]</p></li></ol>| '''17'''</li></ol>|<!-- -->| '''18'''| <ol start="3" style="textlist-style-aligntype: leftdecimal;"|>| '''PH4'''<li><p>After starting the Linux system, first confirm that there is an open i2c device node under <span class="mark">/dev</span></p>{| '''228'''class="wikitable" style="width:800px;"
|-
| '''231'''| <p>orangepi@orangepi:~$ '''PH7ls /dev/i2c-*'''</p>| <p>'''SPI1_MOSI/dev/i2c-*'''</p>| '''19'''}{|| '''20'''| '''GND'''| styleclass="text-align: left;wikitable"|| style="textbackground-aligncolor: left#ffffdc;width:800px;"|
|-
| '''232'''| ''<big>'PH8''注意,这里说的Linux镜像具体指的是从Orange Pi资料下载页面下载的Debian或者Ubuntu这样的Linux发行版镜像。'| '''SPI1_MISO'''| '''21'''|| '''22'''| '''TWI0_SDA</UART2_RX'''big>| '''PI6'''}{| '''262'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big><p>'''230Sometimes the i2c device node and the i2c bus serial number do not correspond one to one. For example, the i2c device node of the i2c1 bus may be /dev/i2c-3.'''</p>| <p>'''PH6The method to accurately confirm the device node under /dev corresponding to the i2c bus is: '''</p></big>  | <ol style="list-style-type: lower-alpha;"><li><p>'''SPI1_CLKFirst run the following command to check the corresponding relationship of i2c'''</p>| <p>orangepi@orangepizero2w:~$ '''23ls /sys/devices/platform/soc*/*/i2c-* | grep &quot;i2c-[0-9]&quot;'''</p><p>/sys/devices/platform/soc/5002000.i2c/i2c-0:</p><p>/sys/devices/platform/soc/5002400.i2c/i2c-3:</p><p>/sys/devices/platform/soc/5002800.i2c/i2c-4:</p><p>/sys/devices/platform/soc/5002c00.i2c/i2c-5:</p><p>/sys/devices/platform/soc/6000000.hdmi/i2c-2:</p><p>/sys/devices/platform/soc/7081400.i2c/i2c-1:</p></li> || <li><p>'''24In the above output'''</p><ol style="list-style-type: none;"><li><p>a) 5002000 is the register base address of the i2c0 bus, and i2c-0 shown behind it is its corresponding i2c device node</p></li><li><p>b) 5002400 is the register base address of the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li><li><p>c) 5002800 is the register base address of the i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p></li></ol></li></ol>| '''SPI1_CS0'''}</li></ol><ol start="4" style="list-style-type: decimal;">| '''PH5'''<li><p>Then start testing i2c, first install i2c-tools</p>{| '''229'''class="wikitable" style="width:800px;"
|-
| style="text-align: left;"|| style="text-align<p>orangepi@orangepi: left;"|| ~$ '''GNDsudo apt-get update'''</p>| <p>orangepi@orangepi:~$ '''25sudo'''|| '''26apt-get install -y i2c-tools'''</p>| '''SPI1_CS1'''}</li><li><p>Then connect an i2c device to the i2c pin of the 40pin connector. Here we take the DS1307 RTC module as an example.</p><p>[[File:zero2w-img178.png]]</p></li>| <li><p>Then use the '''PH9i2cdetect -y x'''command. If the address of the connected i2c device can be detected, it means that the i2c device is connected correctly.</p>{| '''233'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| '''266'''| <big>'''PI10<p>'''| Note that x in the i2cdetect -y x command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''TWI2-SDA</UART3_RXp>'''</big>| '''27'''} [[File:zero2w-img179.png]]|</li></ol>| '''28'''<ol start="7" style="list-style-type: decimal;">| <li><p>Then you can run the '''TWI2-SCL/UART3_TXds1307.py'''| test program in '''PI9examples'''to read the RTC time</p>{| '''265'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| '''256'''| <big><p>'''PI0'''| style="textNote that the x in i2c-align: left;"|| '''29x in the following command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p></big>|}{| '''30'''| '''GND'''| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| <p>root@orangepi:~/wiringOP-Python# '''271cd examples'''</p>| <p>root@orangepi:~/wiringOP-Python/examples# '''python3 ds1307.py --device \'''</p><p>'''PI15&quot;/dev/i2c-x&quot;'''</p><p>Thu 2022-06-16 04:35:46</p><p>Thu 2022-06-16 04:35:47</p><p>Thu 2022-06-16 04:35:48</p><p>^C</p><p>exit</p>|}</li></ol> <span id="pin-uart-test-1"></span> === 40pin UART test === # As can be seen from the table below, the available uarts are uart2, uart3, uart4 and uart5. Please note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial port. <div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: leftcenter;"|| '''31'''|-| '''32GPIO NO.'''| '''PWM1GPIO'''| '''PI11Function'''| '''267Pin'''
|-
| '''268'''
| '''PI12'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| 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'''
|-
| '''258'''
| '''PI2'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''PC12GND'''| '''769'''|-| '''272226'''| '''PI16PH2'''| '''UART5_TX'''| '''11'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-| '''261'''| '''PI5'''| '''TWI0_SCL/UART2_TX'''| '''15'''|-
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''PI43.3V'''| '''26017'''|-| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|-| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''3925'''|-| '''40266'''| '''PI10'''| '''TWI2-SDA/UART3_RX'''| '''27'''|-| '''256'''| '''PI0'''
| style="text-align: left;"|
| '''PI329'''|-| '''259271'''|}'''PI15''' <ol start="2" | style="listtext-style-typealign: decimalleft;">|<li><p>In Linux systems, uart is turned off by default and needs to be turned on manually before it can be used. The opening steps are as follows:: </p>| '''31'''<ol style="list-style-type: lower|-alpha;"><li><p>First run | '''orangepi-config268'''. Ordinary users remember to add &gt; | '''sudoPI12''' permissions.</p><p>orangepi@orangepi:~$ | '''sudo orangepi-configPWM2'''</p></li><li><p>Then select | '''System33'''</p><p>[[File:zero2w|-img80.png]]</p></li><li><p>Then select | '''Hardware258'''</p><p>[[File:zero2w-img81.png]]</p></li><li><p>Then use the keyboard| 's arrow keys to locate the position shown &gt; in the picture below, and then use the ''PI2'space''' to select the &gt; serial port you want to open.</p></li></ol></li></ol> {| classstyle="wikitabletext-align: left;"|| '''35'''
|-
| '''Multiplexing function in 40pin272'''| '''Corresponding dtbo configurationPI16'''| style="text-align: left;"|| '''37'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''40pin - uart2GND'''| '''pi-uart239'''|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''40pin - uart3Pin'''| '''pi-uart3Function'''| '''GPIO'''| '''GPIO NO.'''
|-
| '''40pin - uart42'''| '''pi-uart45V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - uart54'''| '''ph-uart55V'''|} [[File:zero2w-img175.png]] <ol startstyle="5text-align: left;" || style="listtext-style-typealign: lower-alphaleft;">|<li><p>Then select '''&lt;Save&gt;''' to save</p><p>[[File:zero2w|-img83.png]]</p></li><li><p>Then select | '''&lt;Back&gt;6'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select | '''&lt;Reboot&gt;GND''' to restart the system to make the &gt; configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol> <!-- --><ol start| style="3text-align: left;" || style="list-styletext-typealign: decimalleft;">|<li><p>After entering the Linux system, first confirm whether there is a uart5 device node under |-| '''<span class="mark">/dev</span>8'''</p><p>| '''注意, linux5.4系统为/dev/ttyASx.UART0_TX'''</p><p>orangepi@orangepi:~$ | '''ls /dev/ttyS*PH0'''</p><p>/dev/ttySx</p></li>| '''224'''<li><p>Then start testing the uart interface. First use Dupont wire to short|-circuit the rx and tx pins of the uart interface to be tested.</p></li><li><p>Use the | '''gpio10''' command in wiringOP to test the loopback function of the serial port as shown below. If you can see the following print, it means the serial port communication is normal.</p><p>| '''Note that the last x in the gpio serial /dev/ttySx command needs to be replaced with the serial number of the corresponding uart device node.UART0_RX'''</p><p>orangepi@orangepi:~$ | '''gpio serial /dev/ttySx # linux-6.1 test commandPH1'''</p><p>orangepi@orangepi:~$ | '''gpio serial /dev/ttyASx # linux-5.4 test command225'''</p><p>Out: 0: |-&gt; 0</p><p>Out: 1: -&gt; 1</p>| '''12'''<p>Out: 2: | style="text-&gt; 2</p><p>Outalign: 3: -&gtleft; 3^C</p></li>"|<li><p>Finally, you can run the | '''serialTest.pyPI1''' program in examples to test the loopback function of the serial port. If you can see the following print, it means that the serial port loopback test is normal.</p><p>| '''Note that the x in /dev/ttySx or /dev/ttyASx in the command needs to be replaced with the serial number of the corresponding uart device node.257'''</p><p>root@orangepi:~/wiringOP|-Python# | '''cd examples14'''</p><p>root@orangepi:~/wiringOP-Python/examples# | '''GND'''python3 serialTest.py | style="text-align: left;"|| style="text-device &quotalign: left;/dev/ttySx&quot; # linux6.1 use"||-| '''16'''</p><p>root@orangepi:~/wiringOP-Python/examples# | '''python3 serialTest.py --device &quot;PWM4/dev/ttyASx&quot; # linux5.4 useUART4_RX'''</p><p>Out: 0: -&gt; 0</p>| '''PI14'''<p>Out: 1: -&gt; 1</p>| '''270'''<p>Out: 2: |-&gt; 2</p><p>Out: 3: -&gt; 3</p>| '''18'''<p>Out: 4:^C</p><p>exit</p></li></ol> <span id| style="hardwaretext-watchdog-testalign: left;"></span>|| '''PH4'''== Hardware watchdog test ==| '''228''' The watchdog_test program is pre|-installed in the Linux system released by Orange Pi and can be tested directly.| '''20'''The method to run the watchdog_test program is as follows:| '''GND''' <ol | style="listtext-align: left;"|| style="text-typealign: lower-alphaleft;">|<li><p>The second parameter 10 represents the counting time of the watchdog. If the dog is not fed within this time, the system will restart.</p></li>|-<li><p>We can feed the dog by pressing any key on the keyboard (except ESC). After feeding the dog, the program will print a line &quot;keep alive&quot; to indicate that the dog feeding is successful.</p><p>orangepi@orangepi:~$ | '''sudo watchdog_test 1022'''</p><p>open success<| '''TWI0_SDA/p>UART2_RX'''<p>options is 33152,identity is sunxi-wdt</p>| '''PI6'''<p>put_usr return,if 0,success:0</p>| '''262'''<p>The old reset time is: 16</p><p>return ENOTTY,if |-1,success:0</p><p>return ENOTTY,if -1,success:0</p>| '''24'''<p>put_user return,if 0,success:0</p>| '''SPI1_CS0'''<p>put_usr return,if 0,success:0</p>| '''PH5'''<p>keep alive</p>| '''229'''<p>keep alive</p><p>keep alive</p></li></ol> <span id="check|-the-chipid-of-h618-chip"></span>== Check the chipid of H618 chip ==| '''26'''| '''SPI1_CS1'''The command to view the H618 chip chipid is as follows. The chipid of each chip is different, so you can use chipid to distinguish multiple development boards.| '''PH9''' orangepi@orangepi:~$ | '''cat /sys/class/sunxi_info/sys_info | grep &quot;chipid&quot;233'''|-sunxi_chipid : 338020004c0048080147478824681ed1| '''28''' <span id="python| '''TWI2-related-instructions"><SCL/span>UART3_TX'''== Python related instructions ==| '''PI9'''| '''265'''<span id="how-to-compile-and-install|-python-source-code"></span>=== How to compile and install Python source code === | '''If the Python version in the Ubuntu or Debian system software repository you are using does not meet the development requirements and you want to use the latest version of Python, you can use the following method to download the Python source code package to compile and install the latest version of Python.30''' | '''The following demonstration is to compile and install the latest version of Python 3.9. If you want to compile and install other versions of Python, the method is the same (you need to download the source code corresponding to the Python you want to install).GND''' <ol | style="listtext-align: left;"|| style="text-typealign: decimalleft;">|<li><p>First install the dependency packages needed to compile Python</p>|-<p>orangepi@orangepi:~$ | '''sudo apt-get update32'''</p><p>orangepi@orangepi:~$ | '''sudo apt-get install -y build-essential zlib1g-dev \PWM1'''</p><p>| '''libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev \PI11'''</p><p>| '''267'''libreadline|-dev libffi-dev curl libbz2-dev| '''34'''</p></li><li><p>Then download the latest version of Python3.9 source code and unzip it</p><p>orangepi@orangepi:~$ | '''wget \GND'''</p><p>[https| style="text-align: left;"|| style="text-align://www.python.org/ftp/python/3.9.10/Pythonleft;"||-3.9.10.tgz | '''https://www.python.org/ftp/python/3.9.10/Python-3.9.10.tgz36''']</p><p>orangepi@orangepi| style="text-align:~$ left;"|| '''tar xvf Python-3.9.10.tgzPC12'''</p></li><li><p>Then run the configuration command</p><p>orangepi@orangepi:~$ | '''cd Python-3.9.1076'''</p><p>orangepi@orangepi:~$ |-| '''./configure --enable-optimizations38'''</p></li><li><p>Then compile and install Python3.9. The compilation time takes about half an hour.</p>| style="text-align: left;"|<p>orangepi@orangepi:~$ | '''make -j4PI4'''</p><p>orangepi@orangepi:~$ | '''sudo make altinstall260'''</p></li><li><p>After installation, you can use the following command to check the version number of the Python you just installed.</p>|-<p>orangepi@orangepi:~$ | '''python3.9 --version40'''</p><p>| style="text-align: left;"|| '''Python 3.9.10PI3'''</p></li><li><p>Then update pip</p><p>orangepi@orangepi:~$ | '''/usr/local/bin/python3.9 -m pip install --upgrade pip259'''|}</p></li></oldiv>
<span idol start="how-to-replace-pip-source-in-python2"></span>=== How to replace pip source in Python === '''The default source used by Linux system pip is the official source of Python. However, accessing the official source of Python in China is very slow, and the installation of Python software packages often fails due to network reasons. So when using pip to install the Python library, please remember to change the pip source.''' <ol style="list-style-type: decimal;"><li><p>First install '''python3-pip'''</p><p>orangepi@orangepiIn Linux systems, uart is turned off by default and needs to be turned on manually before it can be used. The opening steps are as follows:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y python3-pip'''</p></li><li><p>How to permanently change the pip source under Linux</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First create a new run '''~/.piporangepi-config''' directory, then . Ordinary users remember to add the &gt; '''pip.confsudo''' configuration file, and set the pip source in it &gt; to Tsinghua sourcepermissions.</p><p>orangepi@orangepi{| class="wikitable" style="width:~$ '''mkdir 800px;" |-p ~/.pip'''</p>| <p>orangepi@orangepi:~$ '''cat &lt;&lt;EOF &gt; ~/.pip/pip.conf'''</p><p>'''[global]'''</p><p>'''timeout = 6000'''</p><p>'''index-url = https://pypi.tuna.tsinghua.edu.cn/simple'''</p><p>'''trustedsudo orangepi-host = pypi.tuna.tsinghua.edu.cn'''</p><p>'''EOFconfig'''</p></li><li><p>Then use pip3 to install the Python library very quickly</p></li></ol>|}
</li>
<li><p>How to temporarily change the pip source under Linux, where Then select '''&lt;packagename&gt;System''' needs to be replaced with a specific package name</p><p>orangepi@orangepi[[File:~$ zero2w-img80.png]]</p></li><li><p>Then select '''pip3 install &lt;packagename&gt; -i \Hardware'''</p><p>[[File:zero2w-img81.png]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown in the picture below, and then use the '''https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cnspace'''to select the serial port you want to open.</p></li></ol>
<span id{| class="howwikitable" style="width:800px;text-align: center;"|-| '''Multiplexing function in 40pin'''| '''Corresponding dtbo configuration'''|-to| '''40pin -installuart2'''| '''pi-docker"></span>uart2'''|-| '''40pin - uart3'''| '''pi-uart3'''|-| '''40pin - uart4'''| '''pi-uart4'''|-| '''40pin - uart5'''| '''ph-uart5'''== How to install Docker ==|}
The [[File:zero2w-img175.png]]</ol><ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select '''&lt;Save&gt;''' to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''&lt;Back&gt;'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''&lt;Reboot&gt;''' to restart the system to make the 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 image provided by Orange Pi has Docker presystem, first confirm whether there is a uart5 device node under '''<span class="mark">/dev</span>'''</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-installed| <big><p>'''注意, but linux5.4系统为/dev/ttyASx.'''</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 Docker service is not turned on by defaultuart interface to be tested. </p></li><li><p>Use the '''enable_docker.shgpio''' script command in wiringOP to enable test the loopback function of the docker service, and then serial port as shown below. If you can start using see the docker commandfollowing print, and 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 docker service will gpio serial /dev/ttySx command needs to be automatically started replaced with the next time you start serial number of the systemcorresponding uart device node.'''</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''gpio serial /dev/ttySx &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # linux-6.1 test command'''</p><p>orangepi@orangepi:~$ '''gpio serial /dev/ttyASx &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # linux-5.4 test command'''</p>
orangepi@orangepi:~$ '''enable_docker.sh'''
You <p>Out: 0: -&gt; 0</p><p>Out: 1: -&gt; 1</p><p>Out: 2: -&gt; 2</p><p>Out: 3: -&gt; 3^C</p>|}</li><li><p>Finally, you can use run the '''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>'''Note that the x in /dev/ttySx or /dev/ttyASx in the command needs to test dockerbe replaced with the serial number of the corresponding uart device node. If '''hello</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP-worldPython# ''' can be run, docker can be used normallycd examples'''</p><p>root@orangepi:~/wiringOP-Python/examples# '''python3 serialTest.py --device &quot;/dev/ttySx&quot; # linux6.1 use'''</p> orangepi<p>root@orangepi:~$ /wiringOP-Python/examples# '''docker run hellopython3 serialTest.py --worlddevice &quot;/dev/ttyASx&quot; # linux5.4 use'''</p>
Unable to find image 'hello-world:latest' locally
latest<p>Out: Pulling from library0: -&gt; 0</p><p>Out: 1: -&gt; 1</hellop><p>Out: 2: -world&gt; 2</p><p>Out: 3: -&gt; 3</p><p>Out: 4:^C</p><p>exit</p>|}</li></ol>
256ab8fe8778: Pull complete<span id="hardware-watchdog-test"></span>
Digest: sha256:7f0a9f93b4aa3022c3a4c147a449ef11e0941a1fd0bf4a8e6c9408b2600777c5== Hardware watchdog test ==
Status: Downloaded newer image for helloThe watchdog_test program is pre-world:latestinstalled in the Linux system released by Orange Pi and can be tested directly.
'''Hello from Docker!'''The method to run the watchdog_test program is as follows:
<ol style="list-style-type: lower-alpha;"><li><p>The second parameter 10 represents the counting time of the watchdog. If the dog is not fed within this time, the system will restart.</p></li><li><p>We can feed the dog by pressing any key on the keyboard (except ESC). After feeding the dog, the program will print a line &quot;keep alive&quot; to indicate that the dog feeding is successful.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''This message shows that your installation appears to be working correctly.sudo watchdog_test 10'''</p><p>open success</p><p>options is 33152,identity is sunxi-wdt</p><p>put_usr return,if 0,success:0</p><p>The old reset time is: 16</p><p>return ENOTTY,if -1,success:0</p><p>return ENOTTY,if -1,success:0</p><p>put_user return,if 0,success:0</p><p>put_usr return,if 0,success:0</p><p>keep alive</p><p>keep alive</p><p>keep alive</p>|}</li></ol>
'''.….'''<span id="check-the-chipid-of-h618-chip"></span>
When using == Check the docker command, if you are prompted for '''permission denied''', please add the current user to the docker user group so that you can run the docker command without sudo.chipid of H618 chip ==
orangepi@orangepi:~$ '''sudo usermod -aG docker $USER'''The command to view the H618 chip chipid is as follows. The chipid of each chip is different, so you can use chipid to distinguish multiple development boards.
{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''Note: You need to log out and log in again to the system to take effect. You can also restart the system.cat /sys/class/sunxi_info/sys_info | grep &quot;chipid&quot;'''
<span id="how-to-install-home-assistant"></span>sunxi_chipid : 338020004c0048080147478824681ed1== 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 id="python-related-instructions"></span>
<span id="installation-via-docker"></span>=== Installation via docker =Python related instructions ==
<ol stylespan id="listhow-style-type: decimal;"><li><p>First, please install docker and ensure that docker can run normally. For the installation steps of docker, please refer to the instructions in the [[\l|'''How to Install Docker''']] section.</p></li><li><p>Then you can search for the docker image of Home Assistant</p><p>orangepi@orangepi:~$ '''docker search homeassistant'''</p></li><li><p>Then use the following command to download the Docker image of Home Assistant to your local computer. The image size is about 1GB, and the download time will be relatively long. Please be patient and wait for the download to complete.</p><p>orangepi@orangepi:~$ '''docker pull homeassistant/home-assistant'''</p><p>Using default tag: latest</p><p>latest: Pulling from homeassistant/home-assistant</p><p>be307f383ecc: Downloading</p><p>5fbc4c07ac88: Download complete</p><p>'''...... (Omit some output)'''</p><p>3cc6a1510c9f: Pull complete</p><p>7a4e4d5b979f: Pull complete</p><p>Digest: sha256:81d381f5008c082a37da97d8b08dd8b358dae7ecf49e62ce3ef1eeaefc4381bb</p><p>Status: Downloaded newer image for homeassistant/homecompile-assistant:latest</p><p>docker.io/homeassistant/homeand-assistant:latest</p></li><li><p>Then you can use the following command to view the docker image of Home Assistant you just downloaded</p><p>orangepi@orangepi:~$ '''docker images homeassistant/home-assistant'''</p><p>REPOSITORY TAG IMAGE ID CREATED SIZE</p><p>homeassistant/home-assistant latest bfa0ab9e1cf5 2 months ago '''1.17GB'''</p></li><li><p>At this point you can run the Home Assistant docker container</p><p>orangepi@orangepi:~$ '''docker run install-d \'''</p><p>'''python-source-name homeassistant \'''</p><pcode">'''--privileged \'''</pspan><p>'''--restart=unless-stopped \'''</p><p>'''-e TZ=Asia/Shanghai \'''</p><p>'''-v /home/orangepi/home-assistant:/config \'''</p><p>'''--network=host \'''</p><p>'''homeassistant/home-assistant:latest'''</p></li><li><p>Then enter【the IP address of the development board: 8123】in the browser to see the Home Assistant interface</p><p>'''It takes a while for the Home Assistant container to start. If the interface below does not display normally, please wait a few seconds before refreshing it. If the following interface is not displayed normally after waiting for more than a minute, it means there is a problem with the Home Assistant installation. At this time, you need How to check whether there is a problem with the previous installation compile and setting process.'''</p><div classinstall Python source code ==="figure">
[[File{| class="wikitable" style="background-color:#ffffdc;width:zero2w800px;" |-img180| <big>'''If the Python version in the Ubuntu or Debian system software repository you are using does not meet the development requirements and you want to use the latest version of Python, you can use the following method to download the Python source code package to compile and install the latest version of Python.png]]'''
</div></li><li><p>Then enter your '''name, username''' The following demonstration is to compile and '''password''' install the latest version of Python 3.9. If you want to compile and click '''Create Accountinstall other versions of Python, the method is the same (you need to download the source code corresponding to the Python you want to install).'''</pbig><div class="figure">|}
[[File<ol style="list-style-type: decimal;"><li><p>First install the dependency packages needed to compile Python</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:zero2w~$ '''sudo apt-img181.png]]get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y build-essential zlib1g-dev \'''</p><p>'''libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev \'''</p><p>'''libreadline-dev libffi-dev curl libbz2-dev'''</divp>|}</li><li><p>Then follow download the interface prompts to set according to your own preferences, latest version of Python3.9 source code and then click Nextunzip it</p><div {| class="figurewikitable"style="width:800px;" |-| <p>orangepi@orangepi:~$ '''wget \'''</p><p>'''https://www.python.org/ftp/python/3.9.10/Python-3.9.10.tgz'''</p>[[File<p>orangepi@orangepi:zero2w~$ '''tar xvf Python-img1823.png]]9.10.tgz'''</p>|}</divli><li><p>Then run the configuration command</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''cd Python-3.9.10'''</p><p>orangepi@orangepi:~$ '''./configure --enable-optimizations'''</p>|}</li><li><p>Then click Nextcompile and install Python3.9. The compilation time takes about half an hour.</p><div {| class="figurewikitable" style="width:800px;"|-| <p>orangepi@orangepi:~$ '''make -j4'''</p><p>orangepi@orangepi:~$ '''sudo make altinstall'''</p>|}</li>[[File<li><p>After installation, you can use the following command to check the version number of the Python you just installed.</p>{| class="wikitable" style="width:zero2w800px;" |-img183.png]]| <p>orangepi@orangepi:~$ '''python3.9 --version'''</divp><p>'''Python 3.9.10'''</p>|}</li><li><p>Then click Finishupdate pip</p><div {| class="figurewikitable"style="width:800px;" |-| <p>orangepi@orangepi:~$ '''/usr/local/bin/python3.9 -m pip install --upgrade pip'''</p>|}</li></ol>
[[File:zero2w<span id="how-img184.png]]to-replace-pip-source-in-python"></span>
</div></li><li><p>The main interface finally displayed by Home Assistant is as shown below</p><p>[[File:zero2w-img185.png]]</p></li><li><p>Method === How to stop Home Assistant container</p><ol stylereplace pip source in Python ==="list-style-type: lower-alpha;"><li><p>The command to view the docker container is as follows</p><p>orangepi@orangepi:~$ '''docker ps -a'''</p></li><li><p>The command to stop the Home Assistant container is as follows</p><p>orangepi@orangepi:~$ '''docker stop homeassistant'''</p></li><li><p>The command to delete the Home Assistant container is as follows</p><p>orangepi@orangepi:~$ '''docker rm homeassistant'''</p></li></ol></li></ol>
<span id{| class="wikitable" style="installationbackground-via-pythoncolor:#ffffdc;width:800px;"></span>=== Installation via python ===|-| <big>'''Before installationThe default source used by Linux system pip is the official source of Python. However, please change accessing the official source of pip to a domestic source to speed up Python in China is very slow, and the installation of Python software packagesoften fails due to network reasons. For So when using pip to install the configuration methodPython library, see the instructions in the section &quot;[[\l|How please remember to Change change the Pip Source of Python]]&quot;pip source.'''</big>|}
<ol style="list-style-type: decimal;">
<li><p>First install dependency packages'''python3-pip'''</p>{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepi:~$ '''sudo apt-get update'''</p>
<p>orangepi@orangepi:~$ '''sudo apt-get install -y python3 python3-dev python3-venv \pip'''</p><p>'''python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \'''|}</pli><p>'''libopenjp2-7 libtiff5 libturbojpeg0-dev tzdata'''</pli><p>'''If it is debian12, please use How to permanently change the following command:'''pip source under Linux</p><p>orangepi@orangepiol style="list-style-type:~$ '''sudo aptlower-get update'''</palpha;"><pli>orangepi@orangepi:~$ '''sudo apt-get install -y python3 python3-dev python3-venv \'''</p><p>First create a new '''python3-~/.pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \'''</p><p>'''libopenjp2-7 libturbojpeg0-dev tzdata'''</p></li><li><p>Then you need to compile and install Python3.9. For the methoddirectory, please refer to then add the [[\l|'''Python source code compilation and installation method''']] sectionpip.</p><p>conf'''The default Python version of Debian Bullseye is Python3.9configuration file, so there is no need to compile and install set the pip source in itto Tsinghua source.'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''The default Python version of Ubuntu Jammy is Python3.10, so there is no need to compile and install itmkdir -p ~/.pip'''</p><p>orangepi@orangepi:~$ '''The default Python version of Debian Bookworm is Python3cat &lt;&lt;EOF &gt; ~/.11, so there is no need to compile and install itpip/pip.conf'''</p></li><li><p>Then create a Python virtual environment</p><p>'''Debian Bookworm is python3.11, please remember to replace the corresponding command.[global]'''</p><p>orangepi@orangepi:~$ '''sudo mkdir /srv/homeassistanttimeout = 6000'''</p><p>orangepi@orangepi:~$ '''sudo chown orangepiindex-url = https:orangepi /srv/homeassistant'''<pypi.tuna.tsinghua.edu.cn/p><p>orangepi@orangepi:~$ '''cd /srv/homeassistantsimple'''</p><p>orangepi@orangepi:~$ '''python3trusted-host = pypi.tuna.tsinghua.9 -m venv edu.cn'''</p><p>orangepi@orangepi:~$ '''source bin/activateEOF'''</p><p>(homeassistant) orangepi@orangepi:/srv/homeassistant$</p>|}</li><li><p>Then use pip3 to install the required Python packageslibrary very quickly</p><p/li>(homeassistant) orangepi@orangepi:/srv/homeassistant$ '''python3 -m pip install wheel'''</pol></li><li><p>Then you can install Home Assistant Core</p><p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ How to temporarily change the pip source under Linux, where '''pip3 install homeassistant&lt;packagename&gt;'''needs to be replaced with a specific package name</p></li><li><p>Then enter the following command to run Home Assistant Core</p>{| class="wikitable" style="width:800px;" |-| <p>(homeassistant) orangepi@orangepi:/srv/homeassistant~$ '''hasspip3 install &lt;packagename&gt; -i \'''</p></li><li><p>Then enter【'''development board IP addresshttps: 8123'''】 in the browser to see the Home Assistant interface</p><p>'''When you run the hass command for the first time, some libraries and dependency packages necessary for operation will be downloaded, installed and cached/pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi. This process may take several minutestuna. Note that you cannot see the Home Assistant interface in the browser at this timetsinghua. Please wait for a while and then refresh itedu.cn'''</p>|}<div class="figure"/li></ol>
[[File:zero2w<span id="how-img180.png]]to-install-docker"></span>
</div></li></ol>== How to install Docker ==
<span id="opencvThe Linux image provided by Orange Pi has Docker pre-installation-method"></span>== OpenCV installation method ==installed, but the Docker service is not turned on by default. Use the '''enable_docker.sh''' script to enable the docker service, and then you can start using the docker command, and the docker service will be automatically started the next time you start the system.
<span id{| class="usewikitable" style="width:800px;" |-apt-to-install-opencv"></span>=== Use apt to install OpenCV ===| orangepi@orangepi:~$ '''enable_docker.sh'''|}
<ol style="list-style-type: decimal;"><li><p>The installation command is as follows</p><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 You can use the following command to print the version number of OpenCVtest docker. The output is normal, indicating that the OpenCV installation is successful.</p><ol style="list-style-type: lower-alpha;"><li><p>The version of OpenCV in Ubuntu22.04 is as follows:</p><p>orangepi@orangepi:~$ If '''python3 hello-c &quot;import cv2; print(cv2.__version__)&quot;world'''</p><p>'''4.5.4'''</p></li><li><p>The version of OpenCV in Ubuntu20.04 is as follows:</p><p>orangepi@orangepi:~$ '''python3 -c &quot;import cv2; print(cv2.__version__)&quot;'''</p><p>'''4.2.0'''</p></li><li><p>The version of OpenCV in Debian11 is as follows:</p><p>orangepi@orangepi:~$ '''python3 -c &quot;import cv2; print(cv2can be run, docker can be used normally.__version__)&quot;'''</p><p>'''4.5.1'''</p></li><li><p>The version of OpenCV in Debian12 is as follows:</p><p>orangepi@orangepi:~$ '''python3 -c &quot;import cv2; print(cv2.__version__)&quot;'''</p><p>'''4.6.0'''</p></li></ol></li></ol>
<span id{| class="setwikitable" style="width:800px;" |-up| orangepi@orangepi:~$ '''docker run hello-the-chinese-environment-and-install-the-chineseworld''' Unable to find image 'hello-input-method"></span>== Set up the Chinese environment and install the Chinese input method ==world:latest' locally
'''Note, before installing the Chinese input method, please make sure that the Linux system used by the development board is a desktop version.'''latest: Pulling from library/hello-world
<span id="debian-system-installation-method"></span>=== Debian system installation method ===256ab8fe8778: Pull complete
<ol style="list-style-typeDigest: decimal;"><li><p>First set the default '''locale''' to Chinese</p><ol style="list-style-typesha256: lower-alpha;"><li><p>Enter the following command to start configuring '''locale'''</p><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 &gt; the up and down keys on the keyboard to move up and down, use &gt; the space bar to select, and finally use the Tab key to move &gt; the cursor to '''&lt;OK&gt;''', and then return Car can be used)</p><p>[[File:zero2w-img186.png]]</p></li><li><p>Then set the default '''locale''' to '''zh_CN.UTF-8'''</p><p>[[File:zero2w-img187.png]]</p></li><li><p>After exiting the interface, the '''locale''' setting will begin. &gt; The output displayed on the command line is as follows:</p><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><li><p>'''Then restart the Linux system to make the configuration take effect.'''</p></li><li><p>Then open '''Fcitx configuration'''</p><p>[[File:zero2w-img193.png]]</p></li><li><p>Then click the + sign as shown in the picture below</p><p>[[File:zero2w-img194.png]]</p></li><li><p>Then search '''Google Pinyin''' and click '''OK'''</p><div class="figure">7f0a9f93b4aa3022c3a4c147a449ef11e0941a1fd0bf4a8e6c9408b2600777c5
[[FileStatus:zero2wDownloaded newer image for hello-img195.png]]world:latest
</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>
<p>orangepi@orangepi:~$ '''sudo vim /etc/default/locale'''</p>
<p># File generated by update-locale</p>
<p>LC_MESSAGES='''zh_CN.UTF-8'''</p>
<p>LANG='''zh_CN.UTF-8'''</p>
<p>LANGUAGE='''zh_CN.UTF-8'''</p></li>
<li><p>Then '''restart the system''' and you will see that the system is displayed in Chinese.</p>
<p>[[File:zero2w-img200.png]]</p></li></ol>
'''<span idstyle="installation-method-of-ubuntu-20.04-systemcolor:#FF0000">Hello from Docker!</span>=== Installation method of Ubuntu 20.04 system ==='''
'''<ol span style="list-style-typecolor: decimal;#FF0000"><li><p>First open '''Language Support'''</p><p>[[File:zero2w-img201.png]]</p></li><li><p>Then find the '''Chinese (China)''' option</p><p>[[File:zero2w-img202This message shows that your installation appears to be working correctly.png]]</pspan></li><li><p>Then please use the left button of the mouse to select '''Chinese (China)''' and hold it down, then drag it up to the starting position. After dragging, the display will be as shown below:</p><p>[[File:zero2w-img203.png]]</p></li></ol>
'''Note that this step is not easy to drag, please be patient and try it a few times.….'''|}
<ol start="4" style="list-style-type: decimal;"><li><p>Then select '''Apply System-Wide''' to apply When using 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>docker command, if you are prompted for '''Then restart the Linux system to make the configuration take effectpermission denied'''</p></li><li><p>After re-entering the system, please select '''Do not ask me again''' in add the following interface, and then please decide according current user 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 docker user group so that 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 run 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-img209docker command without sudo.png]]</p></li></ol>
<span id{| class="installationwikitable" style="width:800px;" |-method-of| orangepi@orangepi:~$ '''sudo usermod -ubuntu-22.04-system"></span>aG docker $USER'''=== Installation method of Ubuntu 22.04 system ===|}
<ol {| class="wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;"><li><p>First open '''Language Support'''</p>|-<p>[[File:zero2w-img201.png]]</p></li>| <li><pbig>Then find the '''Chinese (China)''' option</p><p>[[FileNote:zero2w-img210.png]]</p></li><li><p>Then please use the left button of the mouse You need to select '''Chinese (China)''' log out and hold it down, then drag it up log in again to the starting positionsystem to take effect. After dragging, You can also restart the display will be as shown below:system.'''</pbig><p>[[File:zero2w-img211.png]]</p></li></ol>|}
'''Note that this step is not easy <span id="how-to drag, please be patient and try it a few times.'''-install-home-assistant"></span>
<ol start="4" style="list-style-type: decimal;"><li><p>Then select '''Apply System-Wide''' How to apply the Chinese settings to the entire system</p><p>[[File:zero2w-img212.png]]</p></li><li><p>'''Then restart the Linux system to make the configuration take effect'''</p></li><li><p>After re-entering the system, please select '''Do not ask me again''' in the following 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 classinstall Home Assistant =="figure">
[[File{| class="wikitable" style="background-color:zero2w#ffffdc;width:800px;" |-img214| <big>'''Note that this article will only provide methods for installing Home Assistant in Ubuntu or Debian systems. For detailed usage of Home Assistant, please refer to the official documentation or corresponding books.png]]'''</big>|}
</div></li><li><p>The interface after selection is as shown below, then click OK</p><p>[[File:zero2wspan id="installation-img215.png]]</p></li><li><p>Then we can open '''Geany''' to test the Chinese input method. The opening method is as shown in the figure below</p><p>[[File:zero2wvia-img208.png]]</pdocker"></lispan><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 enter Chinese.</p><p>[[File:zero2w-img216.png]]</p></li></ol>=== Installation via docker ===
<span idol style="howlist-style-type: decimal;"><li><p>First, please install docker and ensure that docker can run normally. For the installation steps of docker, please refer to the instructions in the [[Orange Pi Zero 2W#How toinstall Docker|'''How to Install Docker''']] section.</p></li><li><p>Then you can search for the docker image of Home Assistant</p>{| class="wikitable" style="width:800px;" |-remotely| <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>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''docker pull homeassistant/home-assistant'''</p><p>Using default tag: latest</p><p>latest: Pulling from homeassistant/home-logassistant</p><p>be307f383ecc: Downloading</p><p>5fbc4c07ac88: Download complete</p><p>'''...... (Omit some output)'''</p><p>3cc6a1510c9f: Pull complete</p><p>7a4e4d5b979f: Pull complete</p><p>Digest: sha256:81d381f5008c082a37da97d8b08dd8b358dae7ecf49e62ce3ef1eeaefc4381bb</p><p>Status: Downloaded newer image for homeassistant/home-inassistant:latest</p><p>docker.io/homeassistant/home-assistant:latest</p>|}</li><li><p>Then you can use the following command to-view thedocker image of Home Assistant you just downloaded</p>{| class="wikitable" style="width:800px;" |-linux| <p>orangepi@orangepi:~$ '''docker images homeassistant/home-systemassistant'''</p><p>REPOSITORY &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TAG &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IMAGE &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ID &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CREATED &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIZE</p><p>homeassistant/home-desktopassistant &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; latest &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bfa0ab9e1cf5 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2 months ago &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '''<span style="color:#FF0000">1.17GB</span>'''</p>== How to remotely log in to |}</li><li><p>At this point you can run the Linux system desktop Home Assistant docker container</p>{| class="wikitable" style="width:800px;" |-| <span id="remotep>orangepi@orangepi:~$ '''docker run -logind \'''</p>:<p>'''-using-nomachine"name homeassistant \'''</p>:<p>'''--privileged \'''</spanp>:<p>'''--restart=unless-stopped \'''</p>:<p>'''-e TZ=Asia/Shanghai \'''</p>:<p>'''-v /home/orangepi/home-assistant:/config \'''</p>:<p>'''--network= Remote login using NoMachine host \'''</p>:<p>'''homeassistant/home-assistant:latest'''</p>|}</li><li><p>Then enter【the IP address of the development board: 8123】in the browser to see the Home Assistant interface</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''It takes a while for the Home Assistant container to start. If the interface below does not display normally, please wait a few seconds before refreshing it. If the following interface is not displayed normally after waiting for more than a minute, it means there is a problem with the Home Assistant installation. At this time, you need to check whether there is a problem with the previous installation and setting process.'''</p></big>|}<div class="figure"> [[File:zero2w-img180.png]]
</div></li><li><p>Then enter your '''Please ensure that the Ubuntu or Debian system installed on the development board is a desktop version of the system. In additionname, NoMachine also provides detailed usage documentation. It is strongly recommended to read this document thoroughly to become familiar with the use of NoMachine. The document link is as follows:username'''and '''password''' and click '''Create Account'''</p><div class="figure">
'''https[[File://knowledgebasezero2w-img181.nomachine.com/DT10R00166'''png]]
'''NoMachine supports Windows, Mac, Linux, iOS and Android platforms, so we can remotely log in and control </div></li><li><p>Then follow the Orange Pi development board through NoMachine on a variety of devices. The following demonstrates how interface prompts to remotely log in set according to the Linux system desktop of the Orange Pi development board through NoMachine in Windows. For installation methods on other platformsyour own preferences, please refer to NoMachine's official documentation.'''and then click Next</p><div class="figure">
'''Before operating, please make sure that the Windwos computer and the development board are in the same LAN, and that you can log in to the Ubuntu or Debian system of the development board through ssh normally[[File:zero2w-img182.'''png]]
<ol style="list-style-type: decimal;"/div></li><li><p>First download the installation package of the NoMachine software Linux '''arm64''' deb version, and then install it into the Linux system of the development boardThen click Next</p><ol stylediv class="list-style-type: lower-alpha;figure"><li>Since H618 is an ARMv8 architecture SOC and the system we use is &gt; Ubuntu or Debian, we need to download the '''NoMachine for ARM &gt; ARMv8 DEB''' installation package. The download link is as &gt; follows:</li></ol></li></ol>
'''Note that this download link may change, please look for the Armv8/Arm64 version of the deb package[[File:zero2w-img183.'''png]]
[https:</div></www.nomachine.comli><li><p>Then click Finish</download/download&id=112&s=ARM '''https://downloads.nomachine.com/download/?id=118&amp;distrop><div class=ARM''']"figure">
[[File:zero2w-img217img184.png]]
<ol start="2" style="list-style-type: lower-alpha;"/div></li><li><p>In addition, you can also download the '''NoMachine''' installation &gt; package from the official tool.The main interface finally displayed by Home Assistant is as shown below</p><p>[[File:zero2w-img218img185.png]]</p></li><li><p>First enter the '''remote login software-NoMachine''' folderMethod to stop Home Assistant container</p><p>[[Fileol style="list-style-type:zero2wlower-img219.png]]alpha;"></pli><p>Then download the arm64 version of The command to view the deb installation packagedocker container is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>[[Fileorangepi@orangepi:zero2w~$ '''docker ps -img220.png]]a'''</p>|}</li><li><p>Then upload The command to stop the downloaded Home Assistant container is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''nomachine_x.x.x_x_arm64.debdocker stop homeassistant''' to the &gt; Linux system of the development board</p>|}</li><li><p>Then use the following The command to install '''NoMachine''' in the Linux &gt; system of delete the development boardHome Assistant container is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo dpkg -i nomachine_x.x.x_x_arm64_arm64.debdocker rm homeassistant'''</p>|}</li></ol></li></ol>
<!-- --><ol startspan id="2" style="listinstallation-stylevia-type: decimal;python"><li>Then download the installation package of the Windows version of the NoMachine software. The download address is as follows</li></olspan>
'''Note that this download link may change.'''=== Installation via python ===
'''https://downloads.nomachine.com/download/?id=9''' [[File:zero2w-img221.png]] <ol start{| class="3wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;">|-| <li><pbig>Then install NoMachine in Windows. '''Please restart your computer after Before installation.'''</p></li><li><p>Then open '''NoMachine''' in Window</p><p>[[File:zero2w-img222.png]]</p></li><li><p>After NoMachine is started, it will automatically scan other devices with NoMachine installed on please change the source of pip to a domestic source to speed up the LANinstallation of Python packages. After entering For the main interface of NoMachineconfiguration method, you can see that the development board is already instructions in the list of connectable devices, and then click on the location shown in the red box in the picture below You can now log section &quot;[[Orange Pi Zero 2W#How to replace pip source in Python|How to Change the Linux system desktop Pip Source of the development board.</p><p>[[File:zero2w-img223.pngPython]]</p></li><li><p>Then click &quot;'''OK'''</p><p>[[File:zero2w-img224.png]]</p></li><li><p>Then enter the username and password of the development board Linux system in the corresponding positions in the figure below, and then click OK to start logging in.</p><p>[[File:zero2w-img225.png]]</p></li><li><p>Then click OK in the next interface.</p></li><li><p>Finally you can see the desktop of the development board Linux system</p><p>[[File:zero2w-img226.png]]</p></li></ol> <span id="remote-login-using-vnc"></spanbig>=== Remote login using VNC === '''Before operating, please make sure that the Windwos computer and the development board are in the same LAN, and that you can log in to the Ubuntu or Debian system of the development board through ssh normally.''' '''There are many problems with VNC testing in Ubuntu20.04, please do not use this method.'''|}
<ol style="list-style-type: decimal;">
<li><p>First run the '''set_vnc.sh''' script to set up vnc, '''remember to add sudo permission'''sinstall dependency packages</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo set_vnc.shapt-get update'''</p><p>You will require a password to access your desktops.</p><p>Passwordorangepi@orangepi: ~$ '''#Set the vnc password here, 8 characterssudo apt-get install -y python3 python3-dev python3-venv \'''</p><p>Verify: '''#Set the vnc password here, 8 characterspython3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \'''</p><p>Would you like to enter a view-only password (y/n)? '''nlibopenjp2-7 libtiff5 libturbojpeg0-dev tzdata'''</p><p>xauth: file /root/.Xauthority does not exist</p><p>New 'X' desktop is orangepi:1</p><p>Creating default startup script /root/.vnc/xstartup</p>|}<p>Starting applications specified in /root/.vnc/xstartup</p><p>Log file is /root/.vnc/orangepi:1.log</p><p>Killing Xtightvnc process ID 3047</p><p>New 'X' desktop is orangepi:1</p><p>Starting applications specified in /root/.vnc/xstartup</p><p>Log file is /root/.vnc/orangepi:1.log</p></li><li><p>The steps to use MobaXterm software to connect to the development board Linux system desktop are as follows:</p><ol style="list-style-type: lower-alpha;"><li>First click Session, then select VNC, then fill in the IP &gt; address and port of the development board, and finally click &gt; OK to confirm.</li></ol></li></ol> <div {| class="figure"> [[File:zero2w-img227.png]] </div><ol start="2wikitable" style="listbackground-style-typecolor: lower-alpha#ffffdc;"><li><p>Then enter the VNC password set earlier</p><p>[[Filewidth:zero2w-img228.png]]</p></li><li><p>After successful login, the interface is displayed as shown below, &gt800px; and then you can remotely operate the desktop of the development &gt; board Linux system.</p></li></ol>"  [[File:zero2w|-img229.png]] <span id="qt-installation-method"></span>== QT installation method ==| <ol style="list-style-type: decimal;"><libig><p>Use the following script to install QT5 and QT Creator</p><p>orangepi@orangepi:~$ '''install_qt.sh'''</p></li><li><p>After installationIf it is debian12, please use the QT version number will be automatically printed.</p><ol style="list-style-type: lower-alpha;"><li><p>The qt version that comes with Ubuntu20.04 is '''5.12.8'''</p><p>orangepi@orangepifollowing command:~$ '''install_qt.sh'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version '''5.12.8''' in /usr/lib/aarch64-linux-gnu</p></li><li><p>The QT version that comes with Ubuntu22.04 is '''5.15.3'''</pbig><p>orangepi@orangepi:~$ '''install_qt.sh'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version '''5.15.3''' in /usr/lib/aarch64-linuxsudo apt-gnu</p></li><li><p>The QT version that comes with Debian11 is '''5.15.2get update'''</p><p>orangepi@orangepi:~$ '''install_qt.shsudo apt-get install -y python3 python3-dev python3-venv \'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version '''5.15.2''' in /usr/lib/aarch64python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-linuxdev autoconf build-gnu</p></li><li><p>The QT version that comes with Debian12 is '''5.15.8essential \'''</p><p>orangepi@orangepi:~$ '''install_qt.shlibopenjp2-7 libturbojpeg0-dev tzdata'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version '''5.15.8''' in /usr/lib/aarch64-linux-gnu</p></li></ol>|}
</li>
<li><p>Then you can see need to compile and install Python3.9. For the method, please refer to the QT Creator startup icon in [[Orange Pi Zero 2W#Python related instructions|'''ApplicationsPython source code compilation and installation method''']] section.</p><p>[[File{| class="wikitable" style="background-color:#ffffdc;width:zero2w800px;" |-img230.png]]| </pbig><p>You can also use the following command '''The default Python version of Debian Bullseye is Python3.9, so there is no need to open QT Creatorcompile and install it.'''</p><p>orangepi@orangepi:~$ '''qtcreatorThe default Python version of Ubuntu Jammy is Python3.10, so there is no need to compile and install it.'''</p></li><li><p>'''The interface after QT Creator default Python version of Debian Bookworm is opened Python3.11, so there is as followsno need to compile and install it.'''</p><p>[[File:zero2w-img231.png]]</pbig>|}</li><li><p>The version of QT Creator is as followsThen create a Python virtual environment</p><ol {| class="wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;">|-| <libig><p>The default version of QT Creator in '''Ubuntu20Debian Bookworm is python3.11, please remember to replace the corresponding command.04''' is as &gt; follows</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>[[Fileorangepi@orangepi:zero2w-img232.png]]~$ '''sudo mkdir /srv/homeassistant'''</p><p>orangepi@orangepi:~$ '''sudo chown orangepi:orangepi /srv/homeassistant'''</lip><li><p>The default version of QT Creator in orangepi@orangepi:~$ '''Ubuntu22.04cd /srv/homeassistant''' is as &gt; follows</p><p>[[Fileorangepi@orangepi:zero2w~$ '''python3.9 -img233m venv .png]]'''</p></li><li><p>The default version of QT Creator in orangepi@orangepi:~$ '''Debian11source bin/activate''' is as follows</p><p>[[File(homeassistant) orangepi@orangepi:zero2w-img234.png]]/srv/homeassistant$</p>|}</li><li><p>The default version of QT Creator in '''Debian12''' is as followsThen install the required Python packages</p>{| class="wikitable" style="width:800px;" |-| <p>[[File(homeassistant) orangepi@orangepi:zero2w/srv/homeassistant$ '''python3 -img235.png]]m pip install wheel'''</p></li></ol>|}
</li>
<li><p>Then set up QTyou can install Home Assistant Core</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>First open '''Help'''|-&gt;'''About Plugins...'''.</p><p>[[File:zero2w-img236.png]]</p></li>| <li><p>Then remove the check mark of '''ClangCodeModel'''</p><p>[[File(homeassistant) orangepi@orangepi:zero2w-img237.png]]</p></li><li><p>'''After setting up, you need to restart QT Creator'''</p></li><li><p>Then make sure the GCC compiler used by QT Creator. If the &gt; default is Clang, please change it to GCC.<srv/p><p>homeassistant$ '''Debian12 please skip this step.pip3 install homeassistant'''</p><p>[[File:zero2w-img238.png]]</p><p>[[File:zero2w-img239.png]]</p></li></ol>|}
</li>
<li><p>Then you can open a sample codeenter the following command to run Home Assistant Core</p><p>[[File{| class="wikitable" style="width:zero2w800px;" |-img240.png]]</p></li><li><p>After clicking on the sample code, the corresponding instruction document will automatically open. You can read the instructions carefully.</p>| <p>[[File(homeassistant) orangepi@orangepi:zero2w-img241.png]]</p><srv/li><li><p>Then click homeassistant$ '''Configure Projecthass'''</p><p>[[File:zero2w-img242.png]]</p>|}</li><li><p>Then click the green triangle enter【'''development board IP address: 8123'''】 in the lower left corner browser to compile and run see the sample codeHome Assistant interface</p><p>[[File{| class="wikitable" style="background-color:#ffffdc;width:zero2w800px;" |-img243.png]]</p></li>| <libig><p>After waiting '''When you run the hass command for a period of the first time, the interface shown in the figure below some libraries and dependency packages necessary for operation will pop upbe downloaded, which means that QT can compile installed and run normallycached.</p><p>[[File:zero2w-img244This process may take several minutes.png]]</p></li><li><p>References</p><p>[https://wikiNote that you cannot see the Home Assistant interface in the browser at this time.qt.io/Install_Qt_5_on_Ubuntu '''https://wiki.qt.io/Install_Qt_5_on_Ubuntu''']</p><p>[https://download.qt.io/archive/qtcreator '''https://download.qt.io/archive/qtcreator''']</p><p>[https://download.qt.io/archive/qt '''https://downloadPlease wait for a while and then refresh it.qt.io/archive/qt''']</p></li></olbig>|}<span iddiv class="ros-installation-methodfigure"></span>== ROS installation method ==[[File:zero2w-img180.png]]
<span id="how-to-install-ros-1-noetic-on-ubuntu20.04"/div></li></spanol>=== How to install ROS 1 Noetic on Ubuntu20.04 ===
# The currently active version of ROS 1 is as follows, the recommended version is '''Noetic Ninjemys'''<span id="opencv-installation-method"></span>
[[File:zero2w-img245.png]]== OpenCV installation method ==
[[File:zero2w<span id="use-img246.png]]apt-to-install-opencv"></span>=== Use apt to install OpenCV ===
[http<ol style="list-style-type:decimal;"><li><p>The installation command is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y libopencv-dev python3-opencv'''</p>|}</li><li><p>Then use the following command to print the version number of OpenCV. The output is normal, indicating that the OpenCV installation is successful.</p><ol style="list-style-type: lower-alpha;"><li><p>The version of OpenCV in Ubuntu22.04 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 -c &quot;import cv2; print(cv2.__version__)&quot;'''</p><p>'''4.5.4'''</p>|}</li><li><p>The version of OpenCV in Ubuntu20.04 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 -c &quot;import cv2; print(cv2.__version__)&quot;'''</docsp><p>'''4.ros2.org0'''</p>|}</li><li><p>The version of OpenCV in Debian11 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 -c &quot;import cv2; print(cv2.__version__)&quot;'''</ p><p>'''4.5.1'http''</p>|}</li><li><p>The version of OpenCV in Debian12 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 -c &quot;import cv2; print(cv2.__version__)&quot;'''</docsp><p>'''4.ros6.org0''']</p>|}</li></ol></li></ol>
'''https:<span id="set-up-the-chinese-environment-and-install-the-chinese-input-method"><//wiki.ros.org/Distributions'''span>
<ol start="2" style="list-style-type: decimal;"><li><p>The link to Set up the official installation documentation of ROS 1 '''Noetic Ninjemys''' is as follows:</p><p>[http://wiki.ros.org/noetic/Installation/Ubuntu '''http://wiki.ros.org/noetic/Installation/Ubuntu''']</p></li><li><p>In the official installation documentation of ROS '''Noetic Ninjemys''', Ubuntu recommends using Ubuntu20.04, so please ensure that the system used by the development board is '''Ubuntu20.04 desktop system'''.</p><p>[http://wiki.ros.org/noetic/Installation '''http://wiki.ros.org/noetic/Installation''']</p><p>[[File:zero2w-img247.png]]</p></li><li><p>Then use the script below to Chinese environment and install ros1</p><p>orangepi@orangepi:~$ '''install_ros.sh ros1'''</p></li><li><p>Before using the ROS tool, you first need to initialize rosdep. Then when compiling the source code, you can quickly install some system dependencies and some core components in ROS.</p></li></ol>Chinese input method ==
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note that when running , before installing the following commandChinese input method, you need to ensure please make sure that the Linux system used by the development board can access github normally, otherwise an error will be reported due to network problemsis a desktop version.'''</big>|}
'''The install_ros.sh script will try to modify <span id="debian-system-installation-method"></etc/hosts and automatically run the following commands. However, this span>=== Debian system installation 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.'''===
<ol style="list-style-type: decimal;"><li><p>First set the default '''locale''' to Chinese</p><ol style="list-style-type: lower-alpha;"><li><p>Enter the following command to start configuring '''locale'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo dpkg-reconfigure locales'''</p>|}</li><li><p>Then select '''zh_CN.UTF-8 UTF-8''' in the pop-up interface (use the up and down keys on the keyboard to move up and down, use the space bar to select, and finally use the Tab key to move the cursor to '''&lt;OK&gt;''', and then return Car can be used)</p><p>[[File:zero2w-img186.png]]</p></li><li><p>Then set the default '''locale''' to '''zh_CN.UTF-8'''</p><p>[[File:zero2w-img187.png]]</p></li><li><p>After exiting the interface, the '''locale''' setting will begin. The output displayed on the command line is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@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 '''httpsInput Method'''</p><p>[[File:zero2w-img188.png]]</p></rawli><li><p>Then select '''OK'''</p><p>[[File:zero2w-img189.githubusercontentpng]]</p></li><li><p>Then select '''Yes'''</p><p>[[File:zero2w-img190.compng]]</rosp></rosdistroli><li><p>Then select '''fcitx'''</masterp><p>[[File:zero2w-img191.png]]</p></li><li><p>Then select '''OK'''</p><p>[[File:zero2w-img192.png]]</p></li><li><p>'''<span style="color:#FF0000">Then restart the Linux system to make the configuration take effect.</span>'''</p></rosdepli><li><p>Then open '''Fcitx configuration'''</osxp><p>[[File:zero2w-homebrewimg193.yamlpng]]</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">
'''Hit https[[File://rawzero2w-img195.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml'''png]]
</div></li><li><p>Then put '''ERROR: error loading sources list:Google Pinyin'''on top</p><p>[[File:zero2w-img196.png]]</p><p>[[File:zero2w-img197.png]]</p></li><li><p>Then open the '''The read operation timed outGeany'''editor to test the Chinese input method</p><p>[[File:zero2w-img198.png]]</p></li><li><p>The Chinese input method test is as follows</p>orangepi@orangepi<p>[[File:~$ zero2w-img199.png]]</p></li><li><p>You can switch between Chinese and English input methods through the '''Ctrl+Space'''source shortcut key</optp></rosli><li><p>If you need the entire system to be displayed in Chinese, you can set all variables in '''/noeticetc/setupdefault/locale''' to '''zh_CN.bashUTF-8'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo rosdep initvim /etc/default/locale'''</p><p># File generated by update-locale</p>Wrote <p>LC_MESSAGES='''<span style="color:#FF0000">zh_CN.UTF-8</etcspan>'''</rosp><p>LANG='''<span style="color:#FF0000">zh_CN.UTF-8</rosdepspan>'''</sourcesp><p>LANGUAGE='''<span style="color:#FF0000">zh_CN.listUTF-8</span>'''</p>|}</li><li><p>Then '''<span style="color:#FF0000">restart the system</span>''' and you will see that the system is displayed in Chinese.d</20p><p>[[File:zero2w-defaultimg200.listpng]]</p></li></ol>
Recommended: please run<span id="installation-method-of-ubuntu-20.04-system"></span>
rosdep update=== Installation method of Ubuntu 20.04 system ===
orangepi@orangepi<ol style="list-style-type:~$ decimal;"><li><p>First open '''rosdep updateLanguage 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>
reading in sources list data from /etc/ros/rosdep<span id="installation-method-of-ubuntu-22.04-system"></sources.list.dspan>
Hit https://raw=== Installation method of Ubuntu 22.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml04 system ===
Hit https<ol style="list-style-type:decimal;"><li><p>First open '''Language Support'''<//rawp><p>[[File:zero2w-img201.githubusercontent.compng]]</rosp></rosdistroli><li><p>Then find the '''Chinese (China)''' option</masterp><p>[[File:zero2w-img210.png]]</rosdepp></baseli><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.yamlAfter dragging, the display will be as shown below:</p> Hit https<p>[[File:zero2w-img211.png]]</p></rawli>{| 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.githubusercontent.com'''</rosbig>|}</rosdistrool><ol start="4" style="list-style-type: decimal;"><li><p>Then select '''Apply System-Wide''' to apply the Chinese settings to the entire system</master/rosdep/python.yamlp>Hit https<p>[[File://rawzero2w-img212.githubusercontent.compng]]</rosp></rosdistroli><li><p>'''<span style="color:#FF0000">Then restart the Linux system to make the configuration take effect</masterspan>'''</rosdepp></rubyli><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.yaml</p>Hit https<p>[[File://rawzero2w-img206.githubusercontent.compng]]</rosp></rosdistroli><li><p>Then you can see that the desktop is displayed in Chinese</masterp><p>[[File:zero2w-img207.png]]</releasesp></fuerte.yamlli><li><p>Then open the Fcitx5 configuration program</p>Query rosdistro index https<p>[[File://raw.githubusercontentzero2w-img213.compng]]</rosp></rosdistroli><li><p>Then choose to use Pinyin input method</master/index-v4.yamlp>Skip end-of-life distro &quot;ardent&quot;<div class="figure">
Skip end[[File:zero2w-of-life distro &quot;bouncy&quot;img214.png]]
Skip end</div></li><li><p>The interface after selection is as shown below, then click OK</p><p>[[File:zero2w-ofimg215.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-life distro &quot;crystal&quot;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 enter Chinese.</p><p>[[File:zero2w-img216.png]]</p></li></ol>
Skip end<span id="how-ofto-life distro &quot;dashing&quot;remotely-log-in-to-the-linux-system-desktop"></span>
Skip end-of-life distro &quot;eloquent&quot;== How to remotely log in to the Linux system desktop ==
Add distro &quot;foxy&quot;<span id="remote-login-using-nomachine"></span>=== Remote login using NoMachine ===
Add distro &quot{| class="wikitable" style="background-color:#ffffdc;galactic&quotwidth:800px;" |-| <big>'''Please ensure that the Ubuntu or Debian system installed on the development board is a <span style="color:#FF0000">desktop version</span> of the system. In addition, NoMachine also provides detailed usage documentation. It is strongly recommended to read this document thoroughly to become familiar with the use of NoMachine. The document link is as follows:'''
Skip end'''https://knowledgebase.nomachine.com/DT10R00166'''</big>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''NoMachine supports Windows, Mac, Linux, iOS and Android platforms, so we can remotely log in and control the Orange Pi development board through NoMachine on a variety of devices. The following demonstrates how to remotely log in to the Linux system desktop ofthe Orange Pi development board through NoMachine in Windows. For installation methods on other platforms, please refer to NoMachine's official documentation.'''</big>|}{| class="wikitable" style="background-life distro &quotcolor:#ffffdc;groovy&quotwidth:800px;" |-| <big>'''Before operating, please make sure that the Windwos computer and the development board are in the same LAN, and that you can log in to the Ubuntu or Debian system of the development board through ssh normally.'''</big>|}
Add distro <ol style="list-style-type: decimal;"><li><p>First download the installation package of the NoMachine software Linux '''<span style="color:#FF0000">arm64</span>''' deb version, and then install it into the Linux system of the development board</p><ol style="list-style-type: lower-alpha;"><li>Since H618 is an ARMv8 architecture SOC and the system we use is Ubuntu or Debian, we need to download the '''NoMachine for ARM ARMv8 DEB''' installation package. The download link is as follows:</li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note that this download link may change, please look for the Armv8/Arm64 version of the deb package.'''</big>|}{| class="wikitable" style="width:800px;" |-| [https://www.nomachine.com/download/download&id=112&quot;humbles=ARM '''https://downloads.nomachine.com/download/?id=118&quotamp;distro=ARM''']|}
Skip end[[File:zero2w-ofimg217.png]]</ol><ol start="2" style="list-style-type: lower-life distro &quot;hydro&quotalpha;"><li><p>In addition, you can also download the '''NoMachine''' installation package from the official tool.</p><p>[[File:zero2w-img218.png]]</p>Skip end<p>First enter the '''remote login software-NoMachine''' folder</p><p>[[File:zero2w-img219.png]]</p><p>Then download the arm64 version ofthe deb installation package</p><p>[[File:zero2w-life distro &quot;indigo&quotimg220.png]]</p></li><li><p>Then upload the downloaded '''nomachine_x.x.x_x_arm64.deb''' to the Linux system of the development board</p></li><li><p>Then use the following command to install '''NoMachine''' in the Linux system of the development board</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo dpkg -i nomachine_x.x.x_x_arm64_arm64.deb'''</p>|}</li></ol></li></ol>Skip end<ol start="2" style="list-style-type: decimal;"><li>Then download the installation package ofthe Windows version of the NoMachine software. The download address is as follows</li>{| class="wikitable" style="background-life distro &quotcolor:#ffffdc;jade&quotwidth:800px;" |-| <big>'''Note that this download link may change.'''</big>|}{| class="wikitable" style="width:800px;" |-| '''https://downloads.nomachine.com/download/?id=9'''|}
Skip end[[File:zero2w-img221.png]]</ol><ol start="3" style="list-style-type: decimal;"><li><p>Then install NoMachine in Windows. '''Please restart your computer after installation.'''</p></li><li><p>Then open '''NoMachine''' in Window</p><p>[[File:zero2w-img222.png]]</p></li><li><p>After NoMachine is started, it will automatically scan other devices with NoMachine installed on the LAN. After entering the main interface ofNoMachine, you can see that the development board is already in the list of connectable devices, and then click on the location shown in the red box in the picture below You can now log in to the Linux system desktop of the development board.</p><p>[[File:zero2w-life distro &quot;kinetic&quot;img223.png]]</p></li><li><p>Then click '''OK'''</p><p>[[File:zero2w-img224.png]]</p></li><li><p>Then enter the username and password of the development board Linux system in the corresponding positions in the figure below, and then click OK to start logging in.</p><p>[[File:zero2w-img225.png]]</p></li><li><p>Then click OK in the next interface.</p></li><li><p>Finally you can see the desktop of the development board Linux system</p><p>[[File:zero2w-img226.png]]</p></li></ol>
Skip end<span id="remote-oflogin-life distro &quot;lunar&quot;using-vnc"></span>
Add distro &quot;melodic&quot;=== Remote login using VNC ===
Add distro &quot{| class="wikitable" style="background-color:#ffffdc;noetic&quotwidth:800px;" |-| <big>'''Before operating, please make sure that the Windwos computer and the development board are in the same LAN, and that you can log in to the Ubuntu or Debian system of the development board through ssh normally.'''
Add distro &quot;rolling&quot;'''<span style="color:#FF0000">There are many problems with VNC testing in Ubuntu20.04, please do not use this method.</span>'''</big>|}
updated cache in /home<ol style="list-style-type: decimal;"><li><p>First run the '''set_vnc.sh''' script to set up vnc, '''remember to add sudo permission'''s</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo set_vnc.sh'''</p><p>You will require a password to access your desktops.ros</rosdep/sources.cachep>
<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 test whether ROS can be used normally.</p>
<p>orangepi@orangepi:~$ '''test_ros.sh'''</p></li>
<li><p>After running the '''test_ros.sh''' script, a small turtle as shown in the picture below will pop up.</p>
<p>[[File:zero2w-img248.png]]</p></li>
<li><p>Then please keep the terminal window you just opened at the top</p></li></ol>
<div classp>Password: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '''<span style="figurecolor:#FF0000">#Set the vnc password here, 8 characters</span>'''</p><p>Verify: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '''<span style="color:#FF0000">#Set the vnc password here, 8 characters</span>'''</p><p>Would you like to enter a view-only password (y/n)? '''<span style="color:#FF0000">n</span>'''</p><p>xauth: file /root/.Xauthority does not exist</p>
[[File:zero2w-img249.png]]
</divp><ol start="9" style="list-style-typeNew 'X' desktop is orangepi: 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.1</p><p>[[File:zero2w-img250.png]]</p></li></ol>
<span id="how-to-install-ros-2-galactic-on-ubuntu20p>Creating default startup script /root/.04"vnc/xstartup</p><p>Starting applications specified in /root/.vnc/xstartup</spanp>=== How to install ROS 2 Galactic on Ubuntu20<p>Log file is /root/.04 ===vnc/orangepi:1.log</p>
<ol style="list-style-type: decimal;">
<li><p>The currently active version of ROS 2 is as follows, the recommended version is '''Galactic Geochelone'''</p>
<p>[[File:zero2w-img251.png]]</p>
<p>[[File:zero2w-img252.png]]</p>
<p>[http://docs.ros.org/ '''http://docs.ros.org''']</p>
<p>'''http://docs.ros.org/en/galactic/Releases.html'''</p></li>
<li><p>The link to the official installation documentation of ROS 2 '''Galactic Geochelone''' is as follows:</p>
<p>'''docs.ros.org/en/galactic/Installation.html'''</p>
<p>'''http://docs.ros.org/en/galactic/Installation/Ubuntu-Install-Debians.html'''</p></li>
<li><p>In the official installation documentation of ROS 2 '''Galactic Geochelone''', Ubuntu Linux recommends using Ubuntu20.04, so please ensure that the system used by the development board is the '''Ubuntu20.04 desktop system'''. There are several ways to install ROS 2. The following demonstrates how to install ROS 2 '''Galactic Geochelone''' through '''Debian packages'''.</p></li>
<li><p>Use the '''install_ros.sh''' script to install ros2</p>
<p>orangepi@orangepi:~$ '''install_ros.sh ros2'''</p></li>
<li><p>The '''install_ros.sh''' script will automatically run the '''ros2 -h''' command after installing ros2. If you can see the following print, it means that the ros2 installation is complete.</p>
<p>usage: ros2 [-h] Call `ros2 &lt;command&gt; -h` for more detailed usage. ...</p>
<p>ros2 is an extensible command-line tool for ROS 2.</p>
<p>optional arguments:</p>
<p>-h, --help show this help message and exit</p>
<p>Commands:</p>
<p>action Various action related sub-commands</p>
<p>bag Various rosbag related sub-commands</p>
<p>component Various component related sub-commands</p>
<p>daemon Various daemon related sub-commands</p>
<p>doctor Check ROS setup and other potential issues</p>
<p>interface Show information about ROS interfaces</p>
<p>launch Run a launch file</p>
<p>lifecycle Various lifecycle related sub-commands</p>
<p>multicast Various multicast related sub-commands</p>
<p>node Various node related sub-commands</p>
<p>param Various param related sub-commands</p>
<p>pkg Various package related sub-commands</p>
<p>run Run a package specific executable</p>
<p>security Various security related sub-commands</p>
<p>service Various service related sub-commands</p>
<p>topic Various topic related sub-commands</p>
<p>wtf Use `wtf` as alias to `doctor`</p>
<p>Call `ros2 &lt;command&gt; -h` for more detailed usage.</p></li>
<li><p>Then you can use the '''test_ros.sh''' script to test whether ROS 2 is installed successfully. If you can see the following print, it means ROS 2 can run normally.</p>
<p>orangepi@orangepi:~$ '''test_ros.sh'''</p>
<p>[INFO] [1671174101.200091527] [talker]: Publishing: 'Hello World: 1'</p>
<p>[INFO] [1671174101.235661048] [listener]: I heard: [Hello World: 1]</p>
<p>[INFO] [1671174102.199572327] [talker]: Publishing: 'Hello World: 2'</p>
<p>[INFO] [1671174102.204196299] [listener]: I heard: [Hello World: 2]</p>
<p>[INFO] [1671174103.199580322] [talker]: Publishing: 'Hello World: 3'</p>
<p>[INFO] [1671174103.204019965] [listener]: I heard: [Hello World: 3]</p></li>
<li><p>Run the following command to open rviz2</p>
<p>orangepi@orangepi:~$ '''source /opt/ros/galactic/setup.bash'''</p>
<p>orangepi@orangepi:~$ '''ros2 run rviz2 rviz2'''</p>
<p>[[File:zero2w-img253.png]]</p></li>
<li><p>For how to use ROS, please refer to the documentation of ROS 2.</p>
<p>[http://docs.ros.org/en/galactic/Tutorials.html '''http://docs.ros.org/en/galactic/Tutorials.html''']</p></li></ol>
<span id="how-to-install-ros-2-humble-on-ubuntu22.04"p>Killing Xtightvnc process ID 3047</spanp>=== How to install ROS 2 Humble on Ubuntu22.04 ===
<ol style="list-style-type: decimal;">
<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 that the ros2 installation is complete.</p>
<p>usage: ros2 [-h] Call `ros2 &lt;command&gt; -h` for more detailed usage. ...</p>
<p>ros2 is an extensible command-line tool for ROS 2.</p>
<p>optional arguments:</p>
<p>-h, --help show this help message and exit</p>
<p>Commands:</p>
<p>action Various action related sub-commands</p>
<p>bag Various rosbag related sub-commands</p>
<p>component Various component related sub-commands</p>
<p>daemon Various daemon related sub-commands</p>
<p>doctor Check ROS setup and other potential issues</p>
<p>interface Show information about ROS interfaces</p>
<p>launch Run a launch file</p>
<p>lifecycle Various lifecycle related sub-commands</p>
<p>multicast Various multicast related sub-commands</p>
<p>node Various node related sub-commands</p>
<p>param Various param related sub-commands</p>
<p>pkg Various package related sub-commands</p>
<p>run Run a package specific executable</p>
<p>security Various security related sub-commands</p>
<p>service Various service related sub-commands</p>
<p>topic Various topic related sub-commands</p>
<p>wtf Use `wtf` as alias to `doctor`</p>
<p>Call `ros2 &lt;command&gt; -h` for more detailed usage.</p></li>
<li><p>Then you can use the '''test_ros.sh''' script to test whether ROS 2 is successfully installed. If you can see the following print, it means ROS 2 can run normally.</p>
<p>orangepi@orangepi:~$ '''test_ros.sh'''</p>
<p>[INFO] [1671174101.200091527] [talker]: Publishing: 'Hello World: 1'</p>
<p>[INFO] [1671174101.235661048] [listener]: I heard: [Hello World: 1]</p>
<p>[INFO] [1671174102.199572327] [talker]: Publishing: 'Hello World: 2'</p>
<p>[INFO] [1671174102.204196299] [listener]: I heard: [Hello World: 2]</p>
<p>[INFO] [1671174103.199580322] [talker]: Publishing: 'Hello World: 3'</p>
<p>[INFO] [1671174103.204019965] [listener]: I heard: [Hello World: 3]</p></li>
<li><p>Run the following command to open rviz2</p>
<p>orangepi@orangepi:~$ '''source /opt/ros/humble/setup.bash'''</p>
<p>orangepi@orangepi:~$ '''ros2 run rviz2 rviz2'''</p>
<p>[[File:zero2w-img254.png]]</p></li>
<li><p>Reference documentation</p>
<p>'''http://docs.ros.org/en/humble/index.html'''</p>
<p>[http://docs.ros.org/en/galactic/Tutorials.html '''http://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html''']</p></li></ol>
<span id="how-to-install-kernel-header-files"p>New 'X' desktop is orangepi:1</spanp>== How to install kernel header files ==
'''Debian11 system with Linux6.1 kernel will report GCC error when compiling kernel module. So if you want to compile the kernel module, please use Debian12 or Ubuntu22.04.'''
<ol style="list-style-type: decimal;"><li><p>The Linux image released by OPi comes with the deb package of the kernel header file by default, and the storage location is '''Starting applications specified in /optroot/'''</p><p>orangepi@orangepi:~$ '''ls /opt.vnc/linux-headers*'''xstartup</p><p>Log file is /optroot/linux-headers-xxx-sun50iw9_x.x.x_arm64.deb</p><vnc/li><li><p>Use the following command to install the deb package of the kernel header file</p><p>orangepi@orangepi:~$ '''sudo dpkg -i /opt/linux-headers*1.deb'''log</p>|}</li><li><p>After installation, you can see The steps to use MobaXterm software to connect to the folder where the kernel header file is located under '''/usr/src'''.</p><p>orangepi@orangepidevelopment board Linux system desktop are as follows:~$ '''ls /usr/src'''</p><p>linuxol style="list-headersstyle-x.x.x</p></litype: lower-alpha;"><li><p>Then you can compile First click Session, then select VNC, then fill in the source code of the hello kernel module that comes with the Linux image. The source code IP address and port of the hello module is in '''/usr/src/hello'''. After entering this directorydevelopment board, then use the make command and finally click OK to compileconfirm.</pli><p>orangepi@orangepi:~$ '''cd /usr/src/hello/'''</p><p>orangepi@orangepi:/usr/src/hello$ '''sudo make'''</pdiv class="figure"><p>make -C /lib/modules/5.4.125/build M=/usr/src/hello modules</p><p>make[1][File: Entering directory '/usr/src/linux-headerszero2w-5img227.4.125'</p><p>CC [Mpng]] /usr/src/hello/hello.o</p><p>Building modules, stage 2.</p><p>MODPOST 1 modules</p><p>CC [M] /usr/src/hello/hello.mod.o</pdiv><p>LD [M] /usr/src/hello/hello.ko</pol><p>make[1]: Leaving directory '/usr/src/linuxol start="2" style="list-headersstyle-5.4.125'</p></li><li><p>After compilation, the '''hello.ko''' kernel module will be generated</p><p>orangepi@orangepitype:/usr/src/hello$ '''ls *.ko'''</p><p>hello.ko</p></lilower-alpha;"><li><p>Use the '''insmod''' command to insert Then enter the '''hello.ko''' kernel module into the kernelVNC password set earlier</p><p>orangepi@orangepi[[File:/usr/src/hello$ '''sudo insmod hellozero2w-img228.ko'''png]]</p></li><li><p>Then use After successful login, the '''demsg''' command to view the output of the '''hello.ko''' kernel module. If interface is displayed as shown below, and then you can see remotely operate the following output, it means that desktop of the '''hello.ko''' kernel module is loaded correctly.</p><p>orangepi@orangepi:/usr/src/hello$ '''dmesg | grep &quot;Hello&quot;'''</p><p>[ 2871.893988] '''Hello Orange Pi -- init'''</p></li><li><p>Use the '''rmmod''' command to uninstall the '''hellodevelopment board Linux system.ko''' kernel module</p><p>orangepi@orangepi:/usr/src/hello$ '''sudo rmmod hello'''</p><p>orangepi@orangepi:/usr/src/hello$ '''dmesg | grep &quot;Hello&quot;'''</p><p>[ 2871.893988] Hello Orange Pi -- init</p><p>[ 3173.800892] '''Hello Orange Pi -- exit'''</p></li></ol>
[[File:zero2w-img229.png]]</ol></li></ol><span id="testing-of-some-programming-languages-supported-byqt-linuxinstallation-systemmethod"></span>== Testing of some programming languages supported by Linux system ==
<span id="debian-bullseye-system"></span>=== Debian Bullseye system =QT installation method ==
<ol style="list-style-type: decimal;">
<li><p>Debian Bullseye is installed with Use the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.following script to install QT5 and QT Creator</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>The version of a.gcc is as follows</p><p>orangepi@orangepi:~$ '''gcc -|-version'''</p><p>gcc (Debian 10.2.1-6) 10.2.1 20210110</p><p>Copyright (C) 2020 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p></li><li><p>Write the '''hello_world.c''' program in C language</p>| <p>orangepi@orangepi:~$ '''vim hello_worldinstall_qt.csh'''</p><p>#include &lt;stdio.h&gt;</p><p>int main(void)</p><p>{</p><p>printf(&quot;Hello World!\n&quot;);</p><p>return 0;</p><p>|}</p></li><li><p>Then compile and run '''hello_world.c'''</p><p>orangepi@orangepi:~$ '''gcc -o hello_world hello_world.c'''</p><p>orangepi@orangepi:~$ '''./hello_world'''</p><p>Hello World!</p></li></ol>
</li>
<li><p>Debian Bullseye has Python3 installed by defaultAfter installation, the QT version number will be automatically printed.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The specific qt version of Python that comes with Ubuntu20.04 is as follows'''5.12.8'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3install_qt.sh'''</p><p>'''Python 3.9.2''' (default, Feb 28 2021, 17:03:44)....</p><p>[GCC 10.2QMake version 3.1 20210110] on linux</p><p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.Using Qt version '''</pspan style="color:#FF0000"><p>&gt;&gt;&gt;5.12.8</p><pspan>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''in /usr/lib/aarch64-linux-gnu</p>|}</li><li><p>Write the The QT version that comes with Ubuntu22.04 is '''hello_world5.15.py3''' program in Python language</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_worldinstall_qt.pysh'''</p><p>print(......</p><p>QMake version 3.1</p><p>Using Qt version ''Hello World!')<span style="color:#FF0000">5.15.3</span>''' in /usr/lib/aarch64-linux-gnu</p>|}</li><li><p>The result of running QT version that comes with Debian11 is '''hello_world5.py15.2''' is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 hello_worldinstall_qt.pysh'''</p><p>Hello World!......</p><p>QMake version 3.1</lip><p>Using Qt version '''<span style="color:#FF0000">5.15.2</span>''' in /usr/lib/aarch64-linux-gnu</olp>|}
</li>
<li><p>Debian Bullseye does not install Java compilation tools and operating environment by defaultThe QT version that comes with Debian12 is '''5.15.8'''</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>You can use the following command to install openjdk. The latest &gt; version in Debian Bullseye is openjdk|-17</p>| <p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdkinstall_qt.sh'''</p></li><li><p>After installation, you can check the Java version......</p><p>orangepi@orangepi:~$ '''java --QMake version'''3.1</p></li><li><p>Write the Java Using Qt version of '''hello_world.java'''</p><p>orangepi@orangepispan style="color:~$ '''vim hello_world.java'''</p#FF0000"><p>public class hello_world</p><p>{</p><p>public static void main(String[] args)</p><p>{</p><p>System5.out15.println(&quot;Hello World!&quot;);</p><p>}8</pspan><p>}</p></li><li><p>Then compile and run '''hello_world.java'''<in /usr/p><p>orangepi@orangepi:~$ '''javac hello_world.java'''<lib/p><p>orangepi@orangepi:~$ '''java hello_world'''aarch64-linux-gnu</p><p>Hello World!</p></li></ol>|}
</li></ol>
</li><span id="debianli><p>Then you can see the QT Creator startup icon in '''Applications'''</p><p>[[File:zero2w-bookworm-system"img230.png]]</p><p>You can also use the following command to open QT Creator</spanp>{| class=== Debian Bookworm system === <ol "wikitable" style="list-style-typewidth: decimal800px;"|-| <p>orangepi@orangepi:~$ '''qtcreator'''</p>|}</li><li><p>Debian Bookworm The interface after QT Creator is opened is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system as follows</p><p>[[File:zero2w-img231.png]]</p></li><li><p>The version of the development board.QT Creator is as follows</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The default version of a.gcc is as follows</p><p>orangepi@orangepi:~$ QT Creator in '''gcc --versionUbuntu20.04'''is as follows</p><p>gcc (Debian 12.2.0[[File:zero2w-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 PURPOSEimg232.png]]</p></li><li><p>Write the The default version of QT Creator in '''hello_worldUbuntu22.c04''' program in C languageis as follows</p><p>orangepi@orangepi[[File:~$ '''vim hello_worldzero2w-img233.c'''</p><p>#include &lt;stdio.h&gt;</p><p>int main(void)</p><p>{</p><p>printf(&quot;Hello World!\n&quot;);</p><p>return 0;</p><p>}png]]</p></li><li><p>Then compile and run The default version of QT Creator in '''hello_world.cDebian11'''is as follows</p><p>orangepi@orangepi[[File:~$ '''gcc zero2w-o hello_world hello_worldimg234.c'''png]]</p></li><li><p>orangepi@orangepi:~$ The default version of QT Creator in '''./hello_worldDebian12'''is as follows</p><p>Hello World![[File:zero2w-img235.png]]</p></li></ol>
</li>
<li><p>Debian Bookworm has Python3 installed by defaultThen set up QT</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The specific version of Python is as follows</p><p>orangepi@orangepi:~$ First open '''Help'''-&gt;'python3''About Plugins...'''.</p><p>Python 3.11.2 (main, Mar 13 2023, 12:18[[File:29) [GCC 12zero2w-img236.2.0png]] on linux</p><p/li>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</pli><p>&gt;&gt;&gt;Then remove the check mark of '''ClangCodeModel'''</p><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode[[File:zero2w-img237.'''png]]</p></li><li><p>Write the '''hello_world.py''' program in Python language</pspan style="color:#FF0000">After setting up, you need to restart QT Creator<p/span>orangepi@orangepi:~$ '''vim hello_world.py'''</p></li><pli>print('Hello World!')</p>Then make sure the GCC compiler used by QT Creator. If the default is Clang, please change it to GCC.</lip>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <libig><p>The result of running '''hello_worldDebian12 please skip this step.py''' is as follows</p></big>|}<p>orangepi@orangepi[[File:~$ '''python3 hello_worldzero2w-img238.py'''png]]</p><p>Hello World![[File:zero2w-img239.png]]</p></li></ol>
</li>
<li><p>Debian Bookworm does not install Java compilation tools and operating environment by default.</p><ol style="list-style-type: lower-alpha;"><li><p>You Then you can use the following command to install openjdk. The latest &gt; version in Debian Bookworm is openjdk-17open a sample code</p><p>orangepi@orangepi[[File:~$ '''sudo apt install zero2w-y openjdk-17-jdk'''img240.png]]</p></li><li><p>After installationclicking on the sample code, you the corresponding instruction document will automatically open. You can check read the Java versioninstructions carefully.</p><p>orangepi@orangepi[[File:~$ '''java zero2w--version'''img241.png]]</p></li><li><p>Write the Java version of Then click '''hello_world.javaConfigure Project'''</p><p>orangepi@orangepi[[File:~$ '''vim hello_worldzero2w-img242.java'''png]]</p><p/li>public class hello_world</pli><p>{Then click the green triangle in the lower left corner to compile and run the sample code</p><p>public static void main(String[[File:zero2w-img243.png]] args)</p></li><li><p>{After waiting for a period of time, the interface shown in the figure below will pop up, which means that QT can compile and run normally.</p><p>System[[File:zero2w-img244.out.println(&quot;Hello World!&quot;);png]]</p><p>}</pli><pli>}</p>References</lip><li>{| class="wikitable" style="width:800px;" |-| <p>Then compile and run [https://wiki.qt.io/Install_Qt_5_on_Ubuntu '''hello_worldhttps://wiki.javaqt.io/Install_Qt_5_on_Ubuntu''']</p><p>orangepi@orangepi[https:~$ //download.qt.io/archive/qtcreator '''javac hello_worldhttps://download.javaqt.io/archive/qtcreator''']</p><p>orangepi@orangepi[https:~$ //download.qt.io/archive/qt '''java hello_worldhttps://download.qt.io/archive/qt''']</p>|}<p/li>Hello World!</pol> </lispan id="ros-installation-method"></olspan== ROS installation method == </lispan id="how-to-install-ros-1-noetic-on-ubuntu20.04"></olspan>=== How to install ROS 1 Noetic on Ubuntu20.04 === # The currently active version of ROS 1 is as follows, the recommended version is '''Noetic Ninjemys''' ::[[File:zero2w-img245.png]] ::[[File:zero2w-img246.png]] ::{| class="wikitable" style="width:800px;" |-| [http://docs.ros.org/ '''http://docs.ros.org''']
<span id="ubuntu-focal-system"><'''https:/span>/wiki.ros.org/Distributions'''=== Ubuntu Focal system ===|}
<ol start="2" 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 link to the Linux system official installation documentation of the development board.ROS 1 '''Noetic Ninjemys''' is as follows:</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>The version of a.gcc is as follows</p>|-| <p>orangepi@orangepi[http:~$ '''gcc --version'''</p><p>gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0</p><p>Copyright (C) 2019 Free Software Foundation, Incwiki.</p><p>This is free software; see the source for copying conditionsros. There is NO<org/p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.<noetic/p><Installation/li><li><p>Write the Ubuntu '''hello_world.c''' program in C language<http:/p><p>orangepi@orangepi:~$ '''vim hello_world.c'''</p><p>#include &lt;stdiowiki.h&gt;</p><p>int main(void)</p><p>{</p><p>printf(&quot;Hello World!\n&quot;);</p><p>return 0;</p><p>}</p></li><li><p>Then compile and run '''hello_worldros.c'''<org/p><p>orangepi@orangepi:~$ '''gcc -o hello_world hello_world.c'''<noetic/p><p>orangepi@orangepi:~$ '''.Installation/hello_worldUbuntu''']</p><p>Hello World!</p></li></ol>|}
</li>
<li><p>In the official installation documentation of ROS '''Noetic Ninjemys''', Ubuntu Focal has Python3 installed recommends using Ubuntu20.04, so please ensure that the system used by defaultthe development board is '''</p><ol span style="list-style-typecolor: lower-alpha;#FF0000"><li><p>The specific version of Python3 is as followsUbuntu20.04 desktop system</p><pspan>orangepi@orangepi:~$ '''python3'''.</p><p>Python 3.8.10 (default, Nov 14 2022, 12{| class="wikitable" style="width:59:47)</p>800px;" |-| <p>[GCC 9.4http://wiki.0] on linux</p><p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more informationros.<org/p><p>&gt;&gt;&gt;<noetic/p><p>Installation '''Use the Ctrl+D shortcut key to exit python's interactive modehttp://wiki.ros.'''<org/p><noetic/li><li><p>Write the Installation'''hello_world.py''' program in Python language]</p><p>orangepi@orangepi[[File:~$ '''vim hello_worldzero2w-img247.py'''png]]</p><p>print('Hello World!')</p>|}</li><li><p>The result of running '''hello_world.py''' is as followsThen use the script below to install ros1</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 hello_worldinstall_ros.pysh ros1'''</p><p>Hello World!</p></li></ol>|}
</li>
<li><p>Ubuntu Focal does not have Java compilation tools Before using the ROS tool, you first need to initialize rosdep. Then when compiling the source code, you can quickly install some system dependencies and running environment installed by defaultsome core components in ROS.</p></li><ol {| class="wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;"><li><p>You can use the following command to install openjdk|-17</p>| <pbig>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''</pspan style="color:#FF0000"></li><li><p>After installationNote that when running the following command, you need to ensure that the development board can check the Java versionaccess github normally, otherwise an error will be reported due to network problems.</p><pspan>orangepi@orangepi:~$ '''java --version  '''</p><p>openjdk 17The install_ros.0.2 2022-01-18<sh script will try to modify /p><p>OpenJDK Runtime Environment (build 17.0.2+8-Ubuntu-120.04)<etc/p><p>OpenJDK 64-Bit Server VM (build 17hosts and automatically run the following commands.0However, this method cannot guarantee that github can be accessed normally every time.2+8-Ubuntu-120If install_ros.04sh prompts the following error after installing ros1, mixed modeplease find other ways to allow the linux system of the development board to access github normally, sharing)</p></li><li><p>Write and then manually run the Java version of '''hello_worldfollowing Order.java'''</p><p>orangepi@orangepi:~$  '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p><p>public static void main(String[] args)<https:/p><p>{</p><p>Systemraw.outgithubusercontent.println(&quot;Hello World!&quot;);<com/ros/p><p>}<rosdistro/p><p>}<master/p><rosdep/li><li><p>Then compile and run '''hello_worldosx-homebrew.javayaml'''</p><p>orangepi@orangepi:~$ '''javac hello_world.java'''<Hit https:/p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!<raw.githubusercontent.com/p><ros/li><rosdistro/ol><master/li><rosdep/ol>base.yaml'''
'''<span idstyle="ubuntu-jammy-systemcolor:#FF0000">ERROR: error loading sources list:</span>=== Ubuntu Jammy system ==='''
<ol style="list-style-type: decimal;"><li><p>Ubuntu Jammy is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.</p>:'''<ol span style="list-style-typecolor: lower-alpha;#FF0000"><li><p>The version of a.gcc is as follows</p><p>orangepi@orangepi:~$ '''gcc --version'''read operation timed out</p><pspan>gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) '''11.3.0'''</pbig><p>Copyright (C) 2021 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p></li><li><p>Write the '''hello_world.c''' program in C language</p><p>orangepi@orangepi:~$ '''vim hello_world.c'''</p><p>#include &lt;stdio.h&gt;</p><p>int main(void)</p>|}<p>{</p><p>printf(&quot;Hello World!\n&quot;);</p><p>return 0;</p><p>}</p></li><li><p>Then compile and run '''hello_world.c'''</p><p>orangepi@orangepi:~$ '''gcc -o hello_world hello_world.c'''</p><p>orangepi@orangepi:~$ '''./hello_world'''</p><p>Hello World!</p></li></ol></li><li><p>Ubuntu Jammy has Python3 installed by default</p><ol style| class="list-style-type: lower-alpha;wikitable"><li><p>The specific version of Python3 is as follows</p><p>orangepi@orangepi:~$ '''python3'''</p><p>Python 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0] on linux</p><p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</p><p>&gt;&gt;&gt;</p><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p></li><li><p>Write the '''hello_world.py''' program in Python language</p><p>orangepi@orangepi:~$ '''vim hello_world.py'''</p><p>print('Hello World!')</p></li><li><p>The result of running '''hello_world.py''' is as follows</p><p>orangepi@orangepi:~$ '''python3 hello_world.py'''</p><p>Hello World!</p></li></ol></li><li><p>Ubuntu Jammy does not install Java compilation tools and operating environment by default.</p><ol style="list-style-typewidth: lower-alpha800px;"><li><p>You can use the following command to install openjdk-18</p><p>orangepi@orangepi:~$ '''sudo apt install |-y openjdk-18-jdk'''</p></li><li><p>After installation, you can check the Java version.</p>| <p>orangepi@orangepi:~$ '''java --version'''<source /p><p>openjdk 18.0.2-ea 2022-07-19<opt/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)<ros/p></li><li><p>Write the Java version of '''hello_world.java'''<noetic/p><p>orangepi@orangepi:~$ '''vim hello_worldsetup.javabash'''</p><p>public class hello_world</p><p>{</p><p>public static void main(String[] args)</p><p>{</p><p>System.out.println(&quot;Hello World!&quot;);</p><p>}</p><p>}</p></li><li><p>Then compile and run '''hello_world.java'''</p><p>orangepi@orangepi:~$ '''javac hello_world.java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p></li></ol></li></ol>
<span id="method-of-uploading-files-to-the-development-board-linux-system"></span>== Method of uploading files to the development board Linux system ==orangepi@orangepi:~$ '''sudo rosdep init'''
<span id="methodWrote /etc/ros/rosdep/sources.list.d/20-to-upload-files-to-the-development-board-linux-system-in-ubuntu-pc"></span>=== Method to upload files to the development board Linux system in Ubuntu PC ===default.list
<span id="how-to-upload-files-using-scp-command"></span>==== How to upload files using scp command ====Recommended: please run
<ol style="list-style-type: decimal;">
<li><p>Use the scp command to upload files to the Linux system of the development board in Ubuntu PC. The specific command is as follows</p>
<ol style="list-style-type: lower-alpha;">
<li><p>'''file_path: '''Needs to be replaced with the path of the file to &gt; be uploaded</p></li>
<li><p>'''orangepi: '''This is the user name of the development board's &gt; Linux system. It can also be replaced with something else, &gt; such as root.</p></li>
<li><p>'''192.168.xx.xx:''' This is the IP address of the development &gt; board. Please modify it according to the actual situation.</p></li>
<li><p>'''/home/orangepi:''' The path in the development board Linux &gt; system can also be modified to other paths.</p>
<p>test@test:~$ '''scp file_path orangepi@192.168.xx.xx:/home/orangepi/'''</p></li></ol>
</li>
<li><p>If you want to upload a folder, you need to add the -r parameter</p>
<p>test@test:~$ '''scp -r 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></ol>
test@test:~$ '''man scp''':rosdep update
<span id="how-to-upload-files-using-filezilla"></span>==== How to upload files using filezilla ====orangepi@orangepi:~$ '''rosdep update'''
<ol style="reading in sources list-style-type: decimal;"><li><p>First install filezilla in Ubuntu PC</p><p>test@test:~$ '''sudo apt install -y filezilla'''</p><data from /li><li><p>Then use the following command to open filezilla<etc/p><p>test@test:~$ '''filezilla'''<ros/p><rosdep/li><li><p>The interface after opening filezilla is as shown belowsources. At this time, the remote site on the right is emptylist.</p><div class="figure">d
[[FileHit https:zero2w//raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-img255homebrew.png]]yaml
<Hit https:/div></li><li><p>The method of connecting the development board is as shown in the figure below<raw.githubusercontent.com/p><ros/li><rosdistro/ol>master/rosdep/base.yaml
<div class="figure">Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
[[FileHit https:zero2w-img256//raw.png]]githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml Hit https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml
<Query rosdistro index https:/div><ol start="5" style="list-style-type: decimal;"><li><p>Then choose to '''save the password''' and click '''OK'''</p><p>[[File:zero2w-img257raw.githubusercontent.png]]<com/p><ros/li><li><p>Then select '''Always trust this host''' and click '''OK'''<rosdistro/p><master/li></ol>index-v4.yaml
<div class="figure">Skip end-of-life distro &quot;ardent&quot;
[[File:zero2wSkip end-img258.png]]of-life distro &quot;bouncy&quot;
</div><ol start="7" style="listSkip end-styleof-type: decimallife distro &quot;crystal&quot;"><li>After the connection is successful, you can see the directory structure of the development board's Linux file system on the right side of the filezilla software.</li></ol>
<div class="figure">Skip end-of-life distro &quot;dashing&quot;
[[File:zero2wSkip end-img259.png]]of-life distro &quot;eloquent&quot;
</div><ol start="8" style="list-style-type: decimalAdd distro &quot;foxy&quot;"><li>Then select the path to be uploaded to the development board on the right side of the filezilla software, select the file to be uploaded in Ubuntu PC on the left side of the filezilla software, right-click the mouse, and then click the upload option to start uploading the file to the development board.</li></ol>
<div class="figure">Add distro &quot;galactic&quot;
[[File:zero2wSkip end-img260.png]]of-life distro &quot;groovy&quot;
</div><ol start="9" style="list-style-type: decimalAdd distro &quot;humble&quot;"><li><p>After the upload is completed, you can go to the corresponding path in the development board Linux system to view the uploaded file.</p></li><li><p>The method of uploading a folder is the same as the method of uploading a file, so I won't go into details here.</p></li></ol>
<span id="methodSkip end-toof-upload-files-from-windows-pc-to-development-board-linux-system"></span>=== Method to upload files from Windows PC to development board Linux system ===life distro &quot;hydro&quot;
<span id="howSkip end-toof-upload-files-using-filezilla-1"></span>==== How to upload files using filezilla ====life distro &quot;indigo&quot;
# First download the installation file Skip end-of the Windows version of the filezilla software. The download link is as follows-life distro &quot;jade&quot;
[https://filezillaSkip end-project.org/download.php?type=client '''https://filezillaof-project.org/download.php?type=client''']life distro &quot;kinetic&quot;
[[File:zero2wSkip end-img261.png]]of-life distro &quot;lunar&quot;
<div class="figure">Add distro &quot;melodic&quot;
[[File:zero2w-img262.png]]Add distro &quot;noetic&quot;
</div><ol start="2" style="list-style-type: decimalAdd distro &quot;rolling&quot;"><li><p>The downloaded installation package is as shown below, then double-click to install it directly</p><p>'''FileZilla_Server_1.5.1_win64-setup.exe'''</p></li></ol>
During 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 installation process, please select '''Declinedesktop''' on the following installation interface, and then select use the '''Next&gttest_ros.sh''' script to start a small turtle routine to test whether ROS can be used normally.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''test_ros.sh'''</p>|}</li><li><p>After running the '''test_ros.sh''' script, a small turtle as shown in the picture below will pop up.</p><p>[[File:zero2w-img248.png]]</p></li><li><p>Then please keep the terminal window you just opened at the top</p></li>
<div class="figure">
[[File:zero2w-img263img249.png]]
</div></ol><ol start="39" style="list-style-type: decimal;"><li>The interface after opening filezilla is as shown below. <p>At this time, press the remote site direction keys on the keyboard to control the little turtle to move up, down, left, and right is empty.</p><p>[[File:zero2w-img250.png]]</p></li></ol>
<div classspan id="figurehow-to-install-ros-2-galactic-on-ubuntu20.04"></span>
[[File:zero2w-img264=== How to install ROS 2 Galactic on Ubuntu20.png]]04 ===
<ol style="list-style-type: decimal;"><li><p>The currently active version of ROS 2 is as follows, the recommended version is '''Galactic Geochelone'''</divp><ol startp>[[File:zero2w-img251.png]]</p><p>[[File:zero2w-img252.png]]</p>{| class="4wikitable" style="listwidth:800px;" |-| <p>[http://docs.ros.org/ '''http://docs.ros.org''']</p><p>'''http://docs.ros.org/en/galactic/Releases.html'''</p>|}</li><li><p>The link to the official installation documentation of ROS 2 '''Galactic Geochelone''' is as follows:</p>{| class="wikitable" style-type="width: decimal800px;"|-| <p>'''docs.ros.org/en/galactic/Installation.html'''</p><p>'''http://docs.ros.org/en/galactic/Installation/Ubuntu-Install-Debians.html'''</p>|}</li><li>The method <p>In the official installation documentation of connecting ROS 2 '''Galactic Geochelone''', Ubuntu Linux recommends using Ubuntu20.04, so please ensure that the system used by the development board is as shown in the figure below'''<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 &lt;command&gt; -h` for more detailed usage. ...</olp>
<div class="figure">
[[File:zero2w<p>ros2 is an extensible command-img256line tool for ROS 2.png]]</p>
</div>
<ol start="5" style="list-style-type: decimal;">
<li>Then choose to '''save the password''' and click '''OK'''</li></ol>
<div class="figure"p>optional arguments:</p>:<p>-h, --help show this help message and exit</p>
[[File:zero2w-img265.png]]
<p>Commands:</divp>:<ol start="6" style="listp>action Various action related sub-stylecommands</p>:<p>bag Various rosbag related sub-commands</p>:<p>component Various component related sub-typecommands</p>: decimal;"<p>daemon Various daemon related sub-commands</p>:<lip>Then select '''Always trust this host''' doctor Check ROS setup and click '''OK'''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</lip>:<p>multicast Various multicast related sub-commands</p>:<p>node Various node related sub-commands</p>:<p>param Various param related sub-commands</p>:<p>pkg Various package related sub-commands</p>:<p>run Run a package specific executable</p>:<p>security Various security related sub-commands</p>:<p>service Various service related sub-commands</p>:<p>topic Various topic related sub-commands</p>:<p>wtf Use `wtf` as alias to `doctor`</olp>
<div class="figure">
:<p>Call `ros2 &lt;command&gt; -h` for more detailed usage.</p>|}</li><li><p>Then you can use the '''test_ros.sh''' script to test whether ROS 2 is installed successfully. If you can see the following print, it means ROS 2 can run normally.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''test_ros.sh'''</p><p>[INFO] [1671174101.200091527] [Filetalker]: 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:zero2w-img2663'</p><p>[INFO] [1671174103.png204019965] [listener]: I heard: [Hello World: 3]</p>|}</divli><ol startli><p>Run the following command to open rviz2</p>{| class="7wikitable" style="list-style-typewidth: decimal800px;"|-| <p>orangepi@orangepi:~$ '''source /opt/ros/galactic/setup.bash'''</p><p>orangepi@orangepi:~$ '''ros2 run rviz2 rviz2'''</p>|}<p>[[File:zero2w-img253.png]]</p></li><li>After the connection is successful<p>For how to use ROS, you can see please refer to the directory structure documentation of the development board's Linux file system on the right side of the filezilla softwareROS 2.</lip>{| class="wikitable" style="width:800px;" |-| <p>[http://docs.ros.org/en/galactic/Tutorials.html '''http://docs.ros.org/en/galactic/Tutorials.html''']</olp>|}<div class="figure"/li></ol>
[[File:zero2w<span id="how-img267to-install-ros-2-humble-on-ubuntu22.png]]04"></span>
</div><ol start="8" style="list-style-type: decimal;"><li>Then select the path = How 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 install ROS 2 Humble on the left side of the filezilla software, right-click the mouse, and then click the upload option to start uploading the file to the development boardUbuntu22.</li></ol>04 ===
<div ol style="list-style-type: decimal;"><li><p>Use the install_ros.sh script to '''install_ros.sh'''</p>{| class="figurewikitable" 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 &lt;command&gt; -h` for more detailed usage. ...</p>
[[File:zero2w-img268.png]]
</div><ol start="9" style="list-style-type: decimal;"><li><p>After the upload ros2 is completed, you can go to the corresponding path in the development board Linux system to view the uploaded file.</p></li><li><p>The method of uploading a folder is the same as the method of uploading a file, so I won't go into details herean extensible command-line tool for ROS 2.</p></li></ol>
<span id="instructions-for-using-the-logo-on-and-off-the-machine"></span>
== Instructions for using the logo on and off the machine ==
<ol style="list-style-type: decimal;"><li><p>The power on/off logo will only be displayed on the desktop version of the system by default.</p></li><li><p>Set the '''bootlogo''' variable to '''false''' in '''/boot/orangepiEnv.txt''' to turn off the switch logo.</p><p>orangepi@orangepioptional arguments:~$ '''sudo vim /boot/orangepiEnv.txt'''</p><p>verbosity=1</p><p>'''bootlogo=false'''</p></li><li><p>Set the '''bootlogo''' variable to '''true''' in '''/boot/orangepiEnv.txt''' to enable the power on/off logo.</p><p>orangepi@orangepi:~$ '''sudo vim /boot/orangepiEnv.txt'''</p><p>verbosity=1</p><p>'''bootlogo=true'''</p></li><li><p>The location of the boot logo picture in the Linux system is</p><p>'''/usr/share/plymouth/themes/orangepi/watermark.png'''</p></li><li><p>After replacing the boot logo image-h, you need to run the following command to take effect</p><p>orangepi@orangepi:~$ '''sudo update-initramfs -u'''help show this help message and exit</p></li></ol>
<span id="how-to-turn-on-the-power-button-in-linux5.4"></span>
== How to turn on the power button in Linux5.4 ==
There is no power on<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</off button on the main board of the development board. We can expand it through 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 24pin expansion board. The location of the power onpackage specific executable</p>:<p>security Various security related sub-commands</off button on the expansion board is p>:<p>service Various service related sub-commands</p>:<p>topic Various topic related sub-commands</p>:<p>wtf Use `wtf` as follows:alias to `doctor`</p>
[[File:zero2w-img269.png]]
The power on:<p>Call `ros2 &lt;command&gt; -h` for more detailed usage.</off button of p>|}</li><li><p>Then you can use the Linux 6'''test_ros.1 image sh''' script to test whether ROS 2 is turned on by defaultsuccessfully installed. If you can see the following print, but it means ROS 2 can run normally.</p>{| class="wikitable" style="width:800px;" |-| <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 power onfollowing command to open rviz2</off button of the Linux 5p>{| class="wikitable" style="width:800px;" |-| <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>{| class="wikitable" style="width:800px;" |-| <p>'''http://docs.ros.org/en/humble/index.html'''</p><p>[http://docs.ros.4 kernel image is turned off by default and needs to be turned on manually for normal useorg/en/galactic/Tutorials. The steps are as followshtml '''http://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html''']</p>|}</li></ol> <span id="how-to-install-kernel-header-files"></span>
<ol style="list-style-type: decimal;"><li><p>First run '''orangepi-config'''. Ordinary users remember = How 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 dtbo configuration of the SPI you want to open.</p><p>[[File:zero2w-img270.png]]</p></li><li><p>Then select '''&lt;Save&gt;''' to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''&lt;Back&gt;'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''&lt;Reboot&gt;''' to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol>install kernel header files ==
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Debian11 system with <span idstyle="how-to-shut-down-and-restart-the-development-boardcolor:#FF0000">Linux6.1</span>== How kernel will report GCC error when compiling kernel module. So if you want to shut down and restart compile the development board ==kernel module, please use Debian12 or Ubuntu22.04.'''</big>|}
<ol style="list-style-type: decimal;">
<li><p>During The Linux image released by OPi comes with the deb package of the kernel header file by default, and the storage location is '''/opt/'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''ls /opt/linux-headers*'''</p><p>/opt/linux-headers-xxx-sun50iw9_x.x.x_arm64.deb</p>|}</li><li><p>Use the running following command to install the deb package of the Linux systemkernel header file</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo dpkg -i /opt/linux-headers*.deb'''</p>|}</li><li><p>After installation, if you directly unplug can see the power supply, it may cause folder where the kernel header file system to lose some datais located under '''/usr/src'''. It is recommended to use the </p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''poweroffls /usr/src''' command to shut down </p><p>linux-headers-x.x.x</p>|}</li><li><p>Then you can compile the source code of the hello kernel module that comes with the Linux system image. The source code of the development board before powering offhello module is in '''/usr/src/hello'''. After entering this directory, and then unplug use the power supplymake command to compile.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''cd /usr/src/hello/'''</p><p>orangepi@orangepi:/usr/src/hello$ '''sudo poweroffmake'''</p><p>make -C /lib/modules/5.4.125/build M=/usr/src/hello modules</p><p>make[1]: Entering directory '/usr/src/linux-headers-5.4.125'</p>:<p>CC [M] /usr/src/hello/hello.o</p>:<p>Building modules, stage 2.</p>:<p>MODPOST 1 modules</p>:<p>CC [M] /usr/src/hello/hello.mod.o</p>:<p>LD [M] /usr/src/hello/hello.ko</p><p>make[1]: Leaving directory '/usr/src/linux-headers-5.4.125'Note that after turning off the development board</p>|}</li><li><p>After compilation, you need to unplug and replug the power supply before it can '''hello.ko''' kernel module will be turned ongenerated</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:/usr/src/hello$ '''ls *.ko'''</p><p>hello.ko</p>|}</li><li><p>In addition to using Use the poweroff '''insmod''' command to shut down, you can also use insert the power on/off button on '''hello.ko''' kernel module into the expansion board to shut down.kernel</p>{| class="wikitable" style="width:800px;" |-| <p>[[Fileorangepi@orangepi:zero2w-img269/usr/src/hello$ '''sudo insmod hello.png]]ko'''</p>|}</li><li><p>Then use the '''Note that Linux 5.4 requires manual configuration demsg''' command to view the output of the power on/off button before it '''hello.ko''' kernel module. If you can be used. For see the opening methodfollowing output, please refer to it means that the method of opening the power button in Linux5'''hello.ko''' kernel module is loaded correctly.4</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:/usr/src/hello$ '''dmesg | grep &quot;Hello&quot;'''</p><p>[ 2871.893988] '''Hello Orange Pi -- init'''</p>|}</li><li><p>Use the '''rebootrmmod''' command to restart uninstall the Linux system in the development board'''hello.ko''' kernel module</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~/usr/src/hello$ '''sudormmod hello''' </p><p>orangepi@orangepi:/usr/src/hello$ '''dmesg | grep &quot;Hello&quot;'''</p><p>[ 2871.893988] Hello Orange Pi -- init</p><p>[ 3173.800892] '''rebootHello Orange Pi -- exit'''</p>|}</li></ol>
<span id="linuxtesting-of-some-programming-languages-sdkorangepisupported-buildby-usagelinux-instructionssystem"></span>
= '''= Testing of some programming languages supported by Linux SDK——orangepi-build usage instructions''' system ==
<span id="compilationdebian-bullseye-system-requirements"></span>== Compilation = Debian Bullseye system requirements ===
<ol style="list-style-type: decimal;"><li><p>Debian Bullseye is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.</p><ol style="list-style-type: lower-alpha;"><li><p>The Linux SDK, version of a.gcc is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''orangepigcc --buildversion''', only supports running on X64 computers with '''Ubuntu 22</p><p>gcc (Debian 10.04''' installed2. Therefore, before downloading orangepi1-build6) 10.2.1 20210110</p><p>Copyright (C) 2020 Free Software Foundation, please first ensure that Inc.</p><p>This is free software; see the Ubuntu version installed on your computer is Ubuntu 22source for copying conditions.04. The command to check the Ubuntu version installed on the computer There is as followsNO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. If </p>|}</li><li><p>Write the Release field does not display '''22hello_world.04c''', it means that the Ubuntu version currently used does not meet the requirements. Please change the system before performing the following operations.program in C language</p>{| class="wikitable" style="width:800px;" |-| test<p>orangepi@testorangepi:~$ '''lsb_release -avim hello_world.c'''</p><p>#include &lt;stdio.h&gt;</p>
No LSB modules are available.
Distributor ID<p>int main(void)</p><p>{</p>: Ubuntu<p>printf(&quot;Hello World!\n&quot;);</p>
Description: Ubuntu 22.04 LTS
 
Release: '''22.04'''
 
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'''VirtualBox''' 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:
 
[https://repo.huaweicloud.com/ubuntu-releases/21.04/ubuntu-21.04-desktop-amd64.iso '''https://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/22.04/ubuntu-22.04-desktop-amd64.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:
:<p>return 0;</p>
<p>}</p>
|}
</li>
<li><p>Then compile and run '''hello_world.c'''</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''gcc -o hello_world hello_world.c'''</p>
<p>orangepi@orangepi:~$ '''./hello_world'''</p>
<p>Hello World!</p>
|}
</li></ol>
</li>
<li><p>Debian Bullseye has Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li>For the method of replacing Tsinghua Source, please refer to the instructions on this page.</lip></ol> [https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/ '''https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/'''] <ol start="2" style="list-style-type: lower-alpha;"><li>Note that the Ubuntu The specific version needs to be switched to 22.04.</li></ol> [[File:zero2w-img271.png]] <ol start="3" style="list-style-type: lower-alpha;"><li>The contents of the '''/etc/apt/sources.list''' file that need to be replaced are:</li></ol> test@test:~$ '''sudo mv /etc/apt/sources.list cat /etc/apt/sources.list.bak''' test@test:~$ '''sudo vim /etc/apt/sources.list''' # The source code image Python is commented by default to improve apt update speed. You can uncomment it yourself if necessary. deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse # Pre-release software source, not recommended to be enabled # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse <ol start="4" style="list-style-type: lower-alpha;"><li>After the replacement, you need to update the package information and ensure that no errors are reported.as follows</li></olptest@test:~$ '''sudo apt-get update''' <ol start{| class="5wikitable" style="list-style-typewidth: lower-alpha800px;"><li>'''In addition, since the source code of the kernel and Uboot are stored on GitHub, it is very important to ensure that the computer can download the code from GitHub normally when compiling the image.'''</li></ol> <span id="obtain-the-source-code-of-linux-sdk"></span>== Obtain the source code of linux sdk == <span id="download-orangepi-build-from-github"></span>=== Download orangepi-build from github === Linux sdk refers to the orangepi-build set of codes. Orangepi-build is modified based on the armbian build compilation system. Multiple versions of Linux images can be compiled using orangepi-build. Use the following command to download the orangepi-build code: test@test:~$ '''sudo apt-get update''' test@test:~$ '''sudo apt-get install -y git''' test@test:~$ '''git clone https://github.com/orangepi-xunlong/orangepi-build.git -b next''' '''Note that when using the H618 Soc development board, you need to download the source code of the next branch of orangepi-build. The above git clone command needs to specify the branch of the orangepi-build source code as next.''' <div class="figure"> [[File:zero2w-img272.png]] </div>'''When downloading the orangepi-build code through the git clone command, you do not need to enter the user name and password of the github account (the same is true for downloading other codes in this manual). If after entering the git clone command, Ubuntu PC prompts you to enter the user name of the github account. The name and password are usually entered incorrectly in the address of the orangepi-build warehouse behind git clone. Please carefully check whether there are any errors in the spelling of the command, rather than thinking that we have forgotten to provide the username and password of the github account.''' The u-boot and linux kernel versions currently used by the H618 series development boards are as follows: {| class="wikitable"
|-
| <p>orangepi@orangepi:~$ '''branchpython3'''</p>| <p>'''u-boot VersionPython 3.9.2'''(default, Feb 28 2021, 17:03:44)</p><p>[GCC 10.2.1 20210110] on linux</p><p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</p><p>&gt;&gt;&gt;</p>|}{| '''linux Kernel version'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big><p>'''currentUse the Ctrl+D shortcut key to exit python's interactive mode.'''</p></big>| }</li><li><p>Write the '''u-boot v2018hello_world.05py'''program in Python language</p>{| '''linux5.4'''class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''nextvim hello_world.py'''</p><p>print('Hello World!')</p>| }</li><li><p>The result of running '''hello_world.py'u'' is as follows</p>{| class="wikitable" style="width:800px;" |-boot v2021| <p>orangepi@orangepi:~$ '''python3 hello_world.07py'''</p><p>Hello World!</p>| }</li></ol></li><li><p>Debian Bullseye does not install Java compilation tools and operating environment by default.</p><ol style="list-style-type: lower-alpha;"><li><p>You can use the following command to install openjdk. The latest version in Debian Bullseye is openjdk-17</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''linux6sudo apt install -y openjdk-17-jdk'''</p>|}</li><li><p>After installation, you can check the Java version.1</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''java --version'''</p>|}</li><li><p>Write the Java version of '''hello_world.java'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println(&quot;Hello World!&quot;);</p>:<p>}</p><p>}</p>|}</li><li><p>Then compile and run '''hello_world.java'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''javac hello_world.java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p>
|}
</li></ol>
</li></ol>
'''The branch mentioned here is not the same thing as the branch of orangepi<span id="debian-build source code, please don't get confused. This branch is mainly used to distinguish different kernel source code versions.'''bookworm-system"></span>
'''We define the linux5.4 bsp kernel currently provided by Allwinner as the current branch. The latest linux6.1 LTS kernel is defined as the next branch.''' After downloading, the following files and folders will be included:=== Debian Bookworm system ===
<ol style="list-style-type: decimal;">
<li><p>Debian Bookworm is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>'''buildThe version of a.sh''': Compile startup scriptgcc is as follows</p></li><li>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''externalgcc --version''': Contains configuration files needed to compile the image, specific scripts, and source code of some programs, etc.</p><p>gcc (Debian 12.2.0-14) 12.2.0</lip><lip>Copyright (C) 2022 Free Software Foundation, Inc.</p>'''LICENSE''': GPL 2 license file</p>This is free software; see the source for copying conditions. There is NO</lip><li><p>'''READMEwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.md''': orangepi-build documentation</p>|}</li><li><p>Write the '''scriptshello_world.c''': Common script for compiling linux imagesprogram in C language</p>{| class="wikitable" style="width:800px;" |-| </lip></ol> testorangepi@testorangepi:~/orangepi-build$ '''ls''' '''buildvim hello_world.sh external LICENSE README.md scriptsc''' '''If you downloaded the orangepi-build code from github, after downloading, you may find that orangepi-build does not contain the source code of u-boot and linux kernel, and there is no cross-compilation tool required to compile u-boot and linux kernel. chain, this is normal, because these things are stored in other separate github repositories or some servers (their addresses will be detailed below). Orangepi-build will specify the addresses of u-boot, Linux kernel and cross-compilation tool chain in the script and configuration file. When running orangepi-build, when it finds that these things are not available locally, it will automatically download them from the corresponding places.'''</p><span id="download-the-cross-compilation-tool-chain"p>#include &lt;stdio.h&gt;</spanp>=== Download the cross-compilation tool chain ===
When orangepi-build is run for the first time, it will automatically download the cross-compilation '''toolchain''' and put it in the '''toolchains''' folder. Every time you run orangepi-build's build.sh script, it will check whether the cross-compilation toolchain in toolchains exists. If If it does not exist, the download will be restarted. If it exists, it will be used directly without repeated downloading.
<div class="figure"p>int main(void)</p><p>{</p>:<p>printf(&quot;Hello World!\n&quot;);</p>
[[File:zero2w-img273.png]]
 
</div>
The mirror URL of the cross-compilation tool chain in China is the open source software mirror site of Tsinghua University:
 
[https://mirrors.tuna.tsinghua.edu.cn/armbian-releases/_toolchain/ '''https://mirrors.tuna.tsinghua.edu.cn/armbian-releases/_toolchain/''']
 
After toolchains is downloaded, it will contain multiple versions of cross-compilation t'''toolchain''':
 
test@test:~/orangepi-build$ '''ls toolchains/'''
 
gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu gcc-linaro-4.9.4-2017.01-x86_64_aarch64-linux-gnu gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabi
 
gcc-arm-11.2-2022.02-x86_64-arm-none-linux-gnueabihf gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabi gcc-linaro-aarch64-none-elf-4.8-2013.11_linux
 
gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf gcc-linaro-arm-linux-gnueabihf-4.8-2014.04_linux
 
gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu gcc-linaro-arm-none-eabi-4.8-2014.04_linux
 
The cross-compilation tool chain used to compile the H618 Linux kernel source code is:
:<p>return 0;</p>
<p>}</p>
|}
</li>
<li><p>Then compile and run '''hello_world.c'''</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''gcc -o hello_world hello_world.c'''</p>
<p>orangepi@orangepi:~$ '''./hello_world'''</p>
<p>Hello World!</p>
|}
</li></ol>
</li>
<li><p>Debian Bookworm has Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li>linux5.4</lip>The specific version of Python is as follows</olp>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3'gcc-arm-''</p><p>Python 3.11.2-2022(main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux</p><p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.02</p><p>&gt;&gt;&gt;</p>|}{| class="wikitable" style="background-x86_64color:#ffffdc;width:800px;" |-aarch64-none-linux-gnu| <big><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p></big>|}<ol start/li><li><p>Write the '''hello_world.py''' program in Python language</p>{| class="2wikitable" style="list-style-typewidth: lower-alpha800px;">|-| <lip>linux6orangepi@orangepi:~$ '''vim hello_world.1py'''</lip><p>print('Hello World!')</olp>|}</li><li><p>The result of running '''gcc-arm-11hello_world.2py''' is as follows</p>{| class="wikitable" style="width:800px;" |-2022| <p>orangepi@orangepi:~$ '''python3 hello_world.02-x86_64-aarch64-none-linux-gnupy'''</p><p>Hello World!</p>The cross-|}</li></ol></li><li><p>Debian Bookworm does not install Java compilation tool chain used to compile the H618 u-boot source code is:tools and operating environment by default.</p>
<ol style="list-style-type: lower-alpha;">
<li>v2018<p>You can use the following command to install openjdk.05The latest version in Debian Bookworm is openjdk-17</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''</p>|}</li><li><p>After installation, you can check the Java version.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''java --version'''</p>|}</li><li><p>Write the Java version of '''hello_world.java'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println(&quot;Hello World!&quot;);</p>:<p>}</p><p>}</p>|}</li><li><p>Then compile and run '''hello_world.java'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''javac hello_world.java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p>|}</li></ol></li></ol>
'''gcc<span id="ubuntu-linarofocal-7.4.1-2019.02-x86_64_arm-linux-gnueabi'''system"></span>
<ol start="2" style="list-style-type: lower-alpha;"><li>v2021.07</li></ol> '''gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu''' <span id="orangepi-build-complete-directory-structure-description"></span>=== orangepi-build complete directory structure description Ubuntu Focal system ===
<ol style="list-style-type: decimal;">
<li><p>After downloading, the orangepi-build warehouse does not contain the source code of Ubuntu Focal is installed with the linux kernel, u-boot and cross-gcc compilation tool chain. The source code by default, which can directly compile C language programs in the Linux system of the linux kernel and u-boot is stored in an independent git warehousedevelopment board.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The git warehouse where the linux kernel source code is stored version of a.gcc is as follows. Please note that the branch of the linux-orangepi warehouse is switched to</p><ol {| class="wikitable" style="listwidth:800px;" |-style| <p>orangepi@orangepi:~$ '''gcc -type: lower-alpha;"version'''</p><lip>Linux5gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0</lip><p>Copyright (C) 2019 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</olp>|}</li><li><p>Write the '''hello_world.c''' program in C language</olp>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.c'''</lip><p>#include &lt;stdio.h&gt;</olp>
https://github.com/orangepi-xunlong/linux-orangepi/tree/'''orange-pi-5.4-sun50iw9'''
<ol start="2" style="list-style-type: lower-alpha;"p>int main(void)</p><lip>Linux6.1{</lip>:<p>printf(&quot;Hello World!\n&quot;);</olp>
https://github.com/orangepi-xunlong/linux-orangepi/tree/'''orange-pi-6.1-sun50iw9'''
:<ol start="2" style="list-style-type: lower-alphap>return 0;"</p><p>}</p>|}</li><li><p>The git warehouse where the u-boot source code is stored is as followsThen compile and run '''hello_world. Please note that the branch of the u-boot-orangepi warehouse is switched toc'''</p><ol {| class="wikitable" style="listwidth:800px;" |-style-type| <p>orangepi@orangepi: lower~$ '''gcc -alpha;"o hello_world hello_world.c'''</p><lip>v2018orangepi@orangepi:~$ '''.05/hello_world'''</lip><p>Hello World!</olp>|}
</li></ol>
 https://github.com/orangepi-xunlong/u-boot-orangepi/tree/'''v2018.05-h618''' <ol start="2" style="list-style-type: lower-alpha;"><li>v2021.07</li></ol> https://github.com/orangepi-xunlong/u-boot-orangepi/tree/'''v2021.07-sunxi''' <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:Ubuntu Focal has Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The specific version of Python3 is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''build.shpython3''': Compile startup script</p><p>Python 3.8.10 (default, Nov 14 2022, 12:59:47)</lip><lip>[GCC 9.4.0] on linux</p><p>'''external''': Contains the configuration files needed to compile the imageType &quot;help&quot;, &quot;copyright&quot;, scripts &quot;credits&quot; or &quot;license&quot; for specific functions, and the source code of some programs. The rootfs compressed package cached during the image compilation process is also stored in externalmore information.</p><p>&gt;&gt;&gt;</lip>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <libig><p>'''kernelUse the Ctrl+D shortcut key to exit python's interactive mode.''': Store the source code of the linux kernel</p></big>|}</li><li><p>Write the '''LICENSEhello_world.py'''program in Python language</p>{| class="wikitable" style="width: GPL 2 license file800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.py'''</p><p>print('Hello World!')</p>|}</li><li><p>The result of running '''READMEhello_world.mdpy'''is as follows</p>{| class="wikitable" style="width: 800px;" |-| <p>orangepi-build documentation@orangepi:~$ '''python3 hello_world.py'''</p><p>Hello World!</p>|}</li></ol></li><li><p>Ubuntu Focal does not have Java compilation tools and running environment installed by default.</p><ol style="list-style-type: lower-alpha;"><li><p>You can use the following command to install openjdk-17</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''outputsudo apt install -y openjdk-17-jdk''': Store compiled u-boot, linux and other deb packages, compilation logs, and compiled images and other files</p>|}</li><li><p>After installation, you can check the Java version.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''scriptsjava --version''': Common script for compiling linux images</p><p>openjdk 17.0.2 2022-01-18</p><p>OpenJDK Runtime Environment (build 17.0.2+8-Ubuntu-120.04)</p><p>OpenJDK 64-Bit Server VM (build 17.0.2+8-Ubuntu-120.04, mixed mode, sharing)</p>|}</li><li><p>Write the Java version of '''toolchainshello_world.java'''</p>{| class="wikitable" style="width: Store cross800px;" |-compilation tool chain| <p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println(&quot;Hello World!&quot;);</p>:<p>}</p><p>}</p>|}</li><li><p>Then compile and run '''u-boothello_world.java'''</p>{| class="wikitable" style="width: Store the source code of u800px;" |-boot| </p>orangepi@orangepi:~$ '''javac hello_world.java'''</lip><li><p>orangepi@orangepi:~$ '''userpatchesjava hello_world''': Store the configuration files needed to compile the script</p><p>Hello World!</p>|}</li></ol>
</li></ol>
test@test:~<span id="ubuntu-jammy-system"></orangepi-build$ '''ls'''span>
'''build.sh external kernel LICENSE output README.md scripts toolchains u-boot userpatches'''=== Ubuntu Jammy system ===
<span idol style="list-style-type: decimal;"><li><p>Ubuntu Jammy is installed with the gcc compilation tool chain by default, which can directly compileC language programs in the Linux system of the development board.</p><ol style="list-ustyle-boottype: lower-alpha;"><li><p>The version of a.gcc is as follows</spanp>{| class="wikitable" style= Compile u"width:800px;" |-| <p>orangepi@orangepi:~$ '''gcc --boot 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 source for copying conditions. There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>|}</li><li><p>Write the '''hello_world.c''' program in C language</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.c'''</p><p>#include &lt;stdio.h&gt;</p>
# Run the build.sh script, remember to add sudo permissions
test@test<p>int main(void)</p><p>{</p>:~/orangepi-build$ '''sudo .<p>printf(&quot;Hello World!\n&quot;);</build.sh'''p>
<ol start="2" style="list-style-type: decimal;">
<li>Select '''U-boot package''' and press Enter</li></ol>
:<div class="figure"p[[File:zero2w-img274.png]] return 0;</divp><ol start="3" style="list-style-type: decimal;"><lip>Then select the model of the development board}</li></olp[[File:zero2w-img275.png]]|}<ol start="4" style="list-style-type: decimal;"/li><li><p>Then select the branch type of u-bootcompile and run '''hello_world.c'''</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li>|-| <p>The current branch will compile the uorangepi@orangepi:~$ '''gcc -boot v2018.05 version code that needs to be used by the linux5.4 imageo hello_world hello_world.c'''</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 imageorangepi@orangepi:~$ '''./hello_world'''</p><p>[[File:zero2w-img276.png]]Hello World!</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></li></ol> <blockquote>a. If the development board you purchased Ubuntu Jammy has a memory size of 1.5GB, please select the first option. b. If the development board you purchased has 1GB or 2GB or 4GB memory size, please choose the second option.</blockquote>[[File:zero2w-img277.png]] <ol start="6" style="list-style-type: decimal;"><li><p>Then it will start to compile u-boot. Some of the information prompted when compiling the next branch is as follows:Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li>Version of u-boot source code</lip>The specific version of Python3 is as follows</olp></li></ol> [ o.k. ] Compiling u-boot [ '''v2021.07''' ] <ol start{| class="2wikitable" style="list-style-typewidth: lower-alpha800px;">|-| <lip>Version of the cross-compilation tool chainorangepi@orangepi:~$ '''python3'''</lip></olpPython 3.10.6 (main, May 29 2023, 11:10:38) [ oGCC 11.k3. 0] Compiler version [ '''aarch64-on linux-gnu-gcc 11''' ] <ol start="3" style="list-style-type: lower-alpha;"/p><lip>Path to the compiled u-boot deb packageType &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</lip><p>&gt;&gt;&gt;</olp>|}[ o.k. ] Target directory [ '''orangepi-build/output/debs/u-boot''' ] <ol start{| class="4wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;"><li>The package name of the compiled u|-boot deb package| </libig></olp[ o.k. ] File name [ '''linux-u-boot-next-orangepizero2w_xUse the Ctrl+D shortcut key to exit python's interactive mode.x.x_arm64.deb''' ] <ol start="5" style="list-style-type: lower-alpha;"><li>Compilation time</lip></olbig[ o.k. ] Runtime [ '''1 min''' ]|}<ol start="6" style="list-style-type: lower-alpha;"/li><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.</lip></ol> [ o.k. ] Repeat Build Options [ Write the '''sudo ./buildhello_world.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=u-bootpy''' ]program in Python language</p> <ol start{| class="7wikitable" style="list-style-typewidth: decimal800px;"><li>View the compiled u|-boot deb package| </lip></ol> testorangepi@testorangepi:~/orangepi-build$ '''ls output/debs/u-boot/vim hello_world.py'''</p> '''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb'<p>print('Hello World!')</p>|}<ol start="8" style="list-style-type: decimal;"/li><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 <p>The result of the source code. (running '''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 foundhello_world.py'''), otherwise the modifications will be restored. The method is as follows:</li></olp>{| class="wikitable" style="width:800px;" <blockquote>Set the IGNORE_UPDATES variable in u'''userpatches/config|-default.conf''' to &quot;yes&quot;| </blockquotep>testorangepi@testorangepi:~/orangepi-build$ '''vim userpatches/config-defaultpython3 hello_world.confpy'''</p><p>Hello World!</p>...... IGNORE_UPDATES=&quot;'''yes'''&quot; ......|}</li></ol><ol start="9" style="list-style-type: decimal;"/li><li><p>When debugging u-boot code, you can use the following method to update u-boot in the linux image for testingUbuntu Jammy does not install Java compilation tools and operating environment by default.</p>
<ol style="list-style-type: lower-alpha;">
<li>First upload <p>You can use the compiled deb package of ufollowing command to install openjdk-boot to the Linux system of the development board.18</lip>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-18-jdk'''</olp>|}</li><li><p>After installation, you can check the Java version.</olp>{| class="wikitable" style="width:800px;" |-| test<p>orangepi@testorangepi:~$ '''java --version'''</p><p>openjdk 18.0.2-ea 2022-07-19</p><p>OpenJDK Runtime Environment (build 18.0.2-ea+9-Ubuntu-222.04)</orangepip><p>OpenJDK 64-Bit Server VM (build18.0.2-ea+9-Ubuntu-222.04, mixed mode, sharing)</p>|}</li><li><p>Write the Java version of '''hello_world.java'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''cd outputvim hello_world.java'''</p><p>public class hello_world</debsp><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println(&quot;Hello World!&quot;);</p>:<p>}</p><p>}</p>|}</li><li><p>Then compile and run '''hello_world.java'''</up>{| class="wikitable" style="width:800px;" |-boot| <p>orangepi@orangepi:~$ '''javac hello_world.java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p>|}</li></ol></li></ol>
test@test:~/orangepi_build/output<span id="method-of-uploading-files-to-the-development-board-linux-system"></debs/u-boot$ '''scp \'''span>
'''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb [mailto:root@192.168.1.xxx:/root root@192.168.1.xxx:/root]'''== Method of uploading files to the development board Linux system ==
<ol startspan id="2" style="listmethod-to-upload-stylefiles-type: lowerto-alpha;"><li>Install the new u-boot deb package just uploaded</lidevelopment-board-linux-system-in-ubuntu-pc"></olspan>=== Method to upload files to the development board Linux system in Ubuntu PC ===
orangepi@orangepi:~$ '''sudo dpkg <span id="how-i''' '''linuxto-uupload-bootfiles-nextusing-orangepizero2w_x.x.x_arm64.deb'''scp-command"></span>==== How to upload files using scp command ====
<ol startstyle="3list-style-type: decimal;" ><li><p>Use the scp command to upload files to the Linux system of the development board in Ubuntu PC. The specific command is as follows</p><ol style="list-style-type: lower-alpha;"><li>Then run <p>'''file_path: '''Needs to be replaced with the nand-sata-install scriptpath of the file to be uploaded</lip></olliorangepi@<li><p>'''orangepi:~$ '''sudo nand-sata-installThis 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 the 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><ol start{| class="4wikitable" style="list-style-typewidth: lower-alpha800px;">|-| <lip>Then select test@test:~$ '''5 Installscp file_path orangepi@192.168.xx.xx:/Update the bootloader on SDhome/orangepi/eMMC'''</p>|}</li></ol></li>[[File:zero2w<li><p>If you want to upload a folder, you need to add the -img278.png]]r parameter</p><ol start{| class="5wikitable" style="listwidth:800px;" |-| <p>test@test:~$ '''scp <span style="color:#FF0000">-typer</span> dir_path orangepi@192.168.xx.xx: lower-alpha;"/home/orangepi/'''</p>|}</li><li>After pressing <p>There are more usages of scp, please use the Enter key, a Warning will pop up first.following command to view the man manual</p></li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''man scp'''|}</ol> [[File:zero2w<span id="how-to-upload-files-using-img279.png]]filezilla"></span>
<ol start="6" style="list-style-type: lower-alpha;"><li>Press the Enter key again == How to start updating u-boot. After the update is completed, the following information will be displayed.</li></ol>upload files using filezilla ====
[[File<ol style="list-style-type:zero2wdecimal;"><li><p>First install filezilla in Ubuntu PC</p>{| class="wikitable" style="width:800px;" |-img280| <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 interface after opening filezilla is as shown below. At this time, the remote site on the right is empty.png]]</p><div class="figure">
<ol start="7" style="list-style-type[[File: lower-alpha;"><li>Then you can restart the development board to test whether the uzero2w-boot modification has taken effectimg255.</li></ol>png]]
<span id="compile-the-linux-kernel"/div></spanli>== Compile <li><p>The method of connecting the linux kernel ==development board is as shown in the figure below</p></li>
# Run the '''build.sh''' script, remember to add sudo permissions<div class="figure">
test@test[[File:~/orangepizero2w-build$ '''sudo img256./build.sh'''png]]
</div></ol><ol start="25" style="list-style-type: decimal;"><li>Select <p>Then choose to '''Kernel packagesave the password''' and press Enterclick '''OK'''</p><p>[[File:zero2w-img257.png]]</p></li><li><p>Then select '''Always trust this host''' and click '''OK'''</p></olli>
<div class="figure">
[[File:zero2w-img281img258.png]]
</div></ol><ol start="37" style="list-style-type: decimal;"><li>Then you will be prompted whether you need to display After the kernel configuration interface. If connection is successful, you do not need to modify can see the kernel configuration, select directory structure of the first one. If you need to modify development board's Linux file system on the kernel configuration, select right side of the second onefilezilla software.</li></ol>
[[File:zero2w-img282.png]]<div class="figure">
<ol start="4" style="list[[File:zero2w-style-type: decimal;"><li>Then select the model of the development board</li></ol>img259.png]]
[[File</div></ol><ol start="8" style="list-style-type:zero2wdecimal;"><li>Then select the path to be uploaded to the development board on the right side of the filezilla software, select the file to be uploaded in Ubuntu PC on the left side of the filezilla software, right-img275click the mouse, and then click the upload option to start uploading the file to the development board.png]]</li>
<ol startdiv class="5figure" style="list-style-type: decimal;"><li>Then select the branch type of the kernel source code</li></ol>
<blockquote>a[[File:zero2w-img260. The current branch will compile the linux5.4 kernel source codepng]]
b</div></ol><ol start="9" style="list-style-type: decimal;"><li><p>After the upload is completed, you can go to the corresponding path in the development board Linux system to view the uploaded file. </p></li><li><p>The next branch will compile method of uploading a folder is the same as the linux6method of uploading a file, so I won't go into details here.1 kernel source code</blockquotep></li></ol>[[File:zero2w-img276.png]]
<ol startspan id="6" style="listmethod-to-upload-files-from-windows-pc-to-development-board-stylelinux-type: decimal;system"><li>If you choose to display the kernel configuration menu (the second option) in step 3), the kernel configuration interface opened through '''make menuconfig''' will pop up. At this time, you can directly modify the kernel configuration. After modification, save and exit. Yes, compilation of the kernel source code will begin after exiting.</li></olspan>
[[File:zero2w-img283.png]]=== Method to upload files from Windows PC to development board Linux system ===
<ol stylespan id="listhow-styleto-upload-files-using-type: lowerfilezilla-alpha;1"><li/span>If you do not need ==== How to modify the kernel configuration options, when running the build.sh script, pass '''KERNEL_CONFIGUREupload files using filezilla ====no''' to temporarily block the pop-up of the kernel configuration interface.</li></ol>
test@test:~/orangepi-build$ '''sudo # First download the installation file of the Windows version of the filezilla software./build.sh KERNEL_CONFIGURE=no'''The download link is as follows
<ol start::{| class="2wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>b|-| [https://filezilla-project. You can also set '''KERNEL_CONFIGUREorg/download.php?type=noclient ''' in the orangepi-buildhttps:/userpatches/configfilezilla-defaultproject.confconfiguration file to permanently disable this functionorg/download.</p></li>php?type=client''']<li><p>If the following error is prompted when compiling the kernel, it is because the Ubuntu PC terminal interface is too small, causing the make menuconfig interface to be unable to be displayed. Please increase the Ubuntu PC terminal to the maximum size, and then rerun the build.sh script.</p></li></ol>|}
::[[File:zero2w-img284img261.png]]
<ol startdiv class="7figure" style="list-style-type: decimal;"><li><p>Part of the information prompted when compiling the next branch kernel source code is explained as follows:</p><ol style="list-style-type: lower-alpha;"><li>Version of the linux kernel source code</li></ol></li></ol>
::[ o.k[File:zero2w-img262. png] Compiling current kernel [ '''6.1.31''' ]
</div><ol start="2" style="list-style-type: lower-alphadecimal;"><li><p>The version of the crossdownloaded installation package is as shown below, then double-compilation tool chain usedclick to install it directly</lip>{| class="wikitable" style="width:800px;" |-| <p>'''FileZilla_Server_1.5.1_win64-setup.exe'''</olp>|}During the installation process, please select '''Decline''' on the following installation interface, and then select '''Next&gt;'''
[ o.k. ] Compiler version [ '''aarch64-linux-gnu-gcc 11''' ]<div class="figure">
<ol start="3" style="list-style-type[[File: lowerzero2w-alpha;"><li>The default configuration file used by the kernel and the path where it is stored are as follows</li></ol>img263.png]]
[ o.k. ] Using kernel config file [ '''orangepi-build</externaldiv></configli></kernel/linuxol><ol start="3" style="list-style-6type: decimal;"><li>The interface after opening filezilla is as shown below.1-sun50iw9-nextAt this time, the remote site on the right is empty.config''' ]</li>
<ol startdiv class="4figure" style="list-style-type: lower-alpha;"><li>The path to the kernel-related deb package generated by compilation</li></ol>
[ o.k[File:zero2w-img264. png] Target directory [ '''output/debs/''' ]
</div></ol><ol start="54" style="list-style-type: lower-alphadecimal;"><li>The package name method of connecting the development board is as shown in the kernel image deb package generated by compilationfigure below:</li></ol>
[ o.k. ] File name [ '''linux-image-next-sun50iw9_x.x.x_arm64.deb''' ]<div class="figure">
<ol start="6" style="list-style-type[[File: lowerzero2w-alpha;"><li>Compilation time</li></ol>img256.png]]
[ o.k. ] Runtime [ </div></ol><ol start="5" style="list-style-type: decimal;"><li>Then choose to '''10 minsave the password''' ]and click '''OK'''</li>
<ol startdiv class="7figure" 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></ol>
[ o.k[File:zero2w-img265. png] Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=kernel KERNEL_CONFIGURE=no''' ]
<ol start="8" style="list-style-type: decimal;"><li/div><p>View the kernel-related deb package generated by compilation</pol><ol start="6" style="list-style-type: lower-alphadecimal;"><li><p>Then select '''linux-dtb-next-sun50iw9_x.x.x_arm64.debAlways trust this host''' 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>and click '''linux-image-next-sun50iw9_x.x.x_arm64.debOK''' Contains kernel images and kernel modules</p></li></ol></li></ol>
test@test:~/orangepi-build$ '''ls output/debs/linux-*'''<div class="figure">
output/debs/linux[[File:zero2w-dtb-next-sun50iw9_x.x.x_arm64img266.debpng]]
output</debsdiv></linuxol><ol start="7" style="list-headersstyle-next-sun50iw9_xtype: decimal;"><li>After the connection is successful, you can see the directory structure of the development board's Linux file system on the right side of the filezilla software.x.x_arm64.deb</li>
output/debs/linux-image-next-sun50iw9_x.x.x_arm64.deb<div class="figure">
<ol start="9" style="list-style-type[[File: decimal;"><li>When the orangepizero2w-bulid compilation system compiles the linux kernel source code, it will first synchronize the linux kernel source code with the linux kernel source code of the github server. Therefore, if you want to modify the linux kernel source code, you first need to turn off the update function of the source code ('''it needs to be completely compiled once This function can only be turned off after obtaining the Linux kernel source code, otherwise it will prompt that the source code of the Linux kernel cannot be found'''), otherwise the modifications will be restoredimg267. The method is as follows:</li></ol>png]]
<blockquote/div>Set the IGNORE_UPDATES variable in '''userpatches/config-default.conf''' to &quot;yes&quot;</blockquoteol>test@test:~/orangepi-build$ '''vim userpatches/config-default.conf''' IGNORE_UPDATES=&quot;'''yes'''&quot; <ol start="108" style="list-style-type: decimal;"><li><p>If Then select the kernel is modified, you can use the following method path to be uploaded to update the kernel and kernel module of the development board Linux system</p><ol style="list-style-type: lower-alpha;"><li>Upload on the compiled deb package right side of the Linux kernel filezilla software, select the file to be uploaded on the Windows PC on the Linux system left side of the development board</li></ol></li></ol> test@test:~/orangepi-build$ '''cd output/debs''' test@test:~/orangepi-build/output/debs$ '''scp \''' '''linux-image-next-sun50iw9_x.x.x_arm64.deb root@192.168.1.xxx:/root''' <ol start="2" style="list-style-type: lowerfilezilla software, right-alpha;"><li>Install click the deb package of mouse, and then click the new linux kernel just uploaded.</li></ol> orangepi@orangepi:~$ '''sudo dpkg -i linux-image-next-sun50iw9_x.x.x_arm64.deb''' <ol upload option to start="3" style="list-style-type: lower-alpha;"><li>Then restart uploading the file to the development board and check whether the kernel-related modifications have taken effect.</li></ol> orangepi@orangepi:~$ '''sudo''' '''reboot''' <span id="compile-rootfs"></span>== Compile rootfs == # Run the build.sh script, remember to add sudo permissions test@test:~/orangepi-build$ '''sudo ./build.sh''' <ol start="2" style="list-style-type: decimal;"><li>Select '''Rootfs and all deb packages''' and press Enter</li></ol>
<div class="figure">
[[File:zero2w-img285img268.png]]
</div></ol><ol start="39" style="list-style-type: decimal;"><li>Then select <p>After the model of upload is completed, you can go to the corresponding path in the development boardLinux system to view the uploaded file.</p></li><li><p>The method of uploading a folder is the same as the method of uploading a file, so I won't go into details here.</p></li></ol>
[[File:zero2w<span id="instructions-img275.png]]for-using-the-logo-on-and-off-the-machine"></span>
<ol start="4" style="list-style-type: decimal;"><li><p>Then select Instructions for using the branch type of logo on and off the kernel source code. Different versions of the kernel source code maintain different rootfs types.</p><ol stylemachine =="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></ol></li></ol>
[[File:zero2w-img276.png]] <ol start="5" style="list-style-type: decimal;"><li>Then select <p>The power on/off logo will only be displayed on the type desktop version of rootfsthe system by default.</p></li><li><p>Set the '''bootlogo''' variable to '''false''' in '''/boot/orangepiEnv.txt''' to turn off the switch logo.</olp>{| class="wikitable" style="width:800px;" |-[[File| <p>orangepi@orangepi:zero2w-img286~$ '''sudo vim /boot/orangepiEnv.png]]txt'''</p><p>verbosity=1</p><ol start="6" p>'''<span style="list-style-typecolor: decimal;#FF0000">bootlogo=false</span>'''</p>|}</li><li><p>Then select Set the '''bootlogo''' variable to '''true''' in '''/boot/orangepiEnv.txt''' to enable the type of imagepower on/off logo.</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"|-| <p>orangepi@orangepi:~$ '''sudo vim /boot/orangepiEnv.txt'''</p><lip>verbosity=1</p><p>'''Image with console interface (server)<span style="color:#FF0000">bootlogo=true</span>''' Represents the image of the server version, which is relatively small in size.</p>|}</li><li><p>The location of the boot logo picture in the Linux system is</p>{| class="wikitable" style="width:800px;" |-| <p>'''Image with desktop environment/usr/share/plymouth/themes/orangepi/watermark.png''' Represents an </p>|}</li><li><p>After replacing the boot logo image with a desktop, which is relatively large in size.you need to run the following command to take effect</p>{| class="wikitable" style="width:800px;" |-| </lip>orangepi@orangepi:~$ '''sudo update-initramfs -u'''</olp>|}
</li></ol>
<div classspan id="figurehow-to-turn-on-the-power-button-in-linux5.4"></span>
[[File:zero2w-img287== How to turn on the power button in Linux5.png]]4 ==
<There is no power on/div><ol start="7" style="list-style-type: decimal;"><li>If you are compiling off button on the server version main board of the image, you development board. We can also choose to compile the Standard version or the Minimal versionexpand it through a 24pin expansion board. The Minimal version will have much less pre-installed software than location of the Standard version ('''please do not choose power on/off button on the Minimal version without special needs, because many things are not pre-installed by default. Some functions may not be available''')</li></ol>expansion board is as follows:
<div class="figure">[[File:zero2w-img269.png]]
[[FileThe power on/off button of the Linux 6.1 image is turned on by default, but the power on/off button of the Linux 5.4 kernel image is turned off by default and needs to be turned on manually for normal use. The steps are as follows:zero2w-img288.png]]
</div><ol start="8" style="list-style-type: decimal;"><li>If you are compiling a desktop version of <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 imagepicture below, you also need and then use the '''space''' to select the type dtbo configuration of desktop environmentthe SPI you want to open. Currently, only XFCE is maintained, so please select an XFCE type desktop</p><p>[[File:zero2w-img270.png]]</p></li><li><p>Then select '''&lt;Save&gt;''' to save</olp<p>[[File:zero2w-img289img83.png]]</p></li><li><p>Then select '''&lt;Back&gt;'''</p><p>[[File:zero2w-img290img84.png]]</p></li> You can then <li><p>Then select additional packages that need '''&lt;Reboot&gt;''' to be installed. Please press restart the Enter key here system to skip directlymake 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>
[[File:zero2w-img291.png]]== How to shut down and restart the development board ==
<ol start="9" style="list-style-type: decimal;"><li><p>Then During the compilation running of rootfs will startthe Linux system, if you directly unplug the power supply, it may cause the file system to lose some data. Some It is recommended to use the '''poweroff''' command to shut down the Linux system of the information prompted during compilation are as follows:development board before powering off, and then unplug the power supply.</p><ol {| class="wikitable" style="listwidth:800px;" |-| <p>orangepi@orangepi:~$ '''sudo poweroff'''</p>|}{| class="wikitable" style="background-typecolor:#ffffdc;width: lower-alpha800px;"|-| <big><p>'''Note that after turning off the development board, you need to unplug and replug the power supply before it can be turned on.'''</p></big>|}</li>Type <li><p>In addition to using the poweroff command to shut down, you can also use the power on/off button on the expansion board to shut down.</p><p>[[File:zero2w-img269.png]]</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that Linux 5.4 requires manual configuration of the power on/off button before it can be used. For the opening method, please refer to [[Orange Pi Zero 2W#How to turn on the power button in Linux5.4|the method of rootfsopening the power button in Linux5.4]].'''</p></big>|}</li><li><p>Use the '''reboot''' command to restart the Linux system in the development board</olp>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo''' '''reboot'''</p>|}
</li></ol>
[ o.k. ] local not found [ Creating new rootfs cache for '''bullseye''' ]<span id="linux-sdkorangepi-build-usage-instructions"></span>
<ol start="2" style'''Linux SDK——orangepi-build usage instructions''' ="list-style-type: lower-alpha;"><li>The storage path of the compiled rootfs compressed package</li></ol>
[ o.k. ] Target directory [ '''orangepi<span id="compilation-build/external/cachesystem-requirements"></rootfs''' ]span>== Compilation system requirements ==
The Linux SDK, '''orangepi-build''', only supports running on X64 computers with '''<ol start="3" span style="list-style-typecolor: lower-alpha;#FF0000">Ubuntu 22.04<li/span>''' installed. Therefore, before downloading orangepi-build, please first ensure that the Ubuntu version installed on your computer is Ubuntu 22.04. The name of command to check the Ubuntu version installed on the rootfs compressed package generated by compilationcomputer is as follows. If the Release field does not display '''</lispan style="color:#FF0000">22.04</olspan>''', it means that the Ubuntu version currently used does not meet the requirements. Please change the system before performing the following operations.
[ o.k. ] File name [ {| class="wikitable" style="width:800px;" |-| test@test:~$ '''bullseye-xfcelsb_release -arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4a''' ]
<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-arm64No LSB modules are available.5250ec7002de9e81a41de169f1f89721.tar.lz4''' It is a compressed package of rootfs. The meaning of each field in the name is</li></ol></li></ol>
<blockquote>a) '''bullseye''' represents the type of Linux distribution of rootfsDistributor ID: Ubuntu
b) Description: Ubuntu 22.04 LTS Release: '''xfce<span style="color:#FF0000">22.04</span>''' indicates that the rootfs is the desktop version, and if it is cli, it indicates the server version. Codename: '''jammy'''|}
c) If the computer is installed with a Windows system and does not have Ubuntu 22.04 installed on it, you can consider using'''VirtualBox'''arm64or ''' represents 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 architecture type development board. Use orangepi-build. The installation image download address of rootfsUbuntu 22.04 amd64 version is:
d) '''25250ec7002de9e81a41de169f1f89721''' is the MD5 hash value generated by the package names of all software packages installed by rootfs. As long as the list of software packages installed by rootfs is not modified, this value will not change. The compilation script will use this MD5 hash value. Determine whether rootfs needs to be recompiled</blockquote><ol start{| class="2wikitable" style="list-style-typewidth: lower-alpha800px;"><li>|-| [https://repo.huaweicloud.com/ubuntu-releases/21.04/ubuntu-21.04-desktop-amd64.iso '''bullseyehttps://mirrors.tuna.tsinghua.edu.cn/ubuntu-xfcereleases/22.04/ubuntu-arm6422.5250ec7002de9e81a41de169f1f89721.tar.lz404-desktop-amd64.listiso''' Lists the package names of all packages installed by rootfs</li></ol>]|}
test@testAfter 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:~/orangepi-build$ '''ls external/cache/rootfs/'''
bullseye<ol style="list-xfcestyle-arm64.5250ec7002de9e81a41de169f1f89721.tartype: lower-alpha;"><li>For the method of replacing Tsinghua Source, please refer to the instructions on this page.lz4</li>
bullseye{| class="wikitable" style="width:800px;" |-xfce-arm64| [https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/ '''https://mirrors.tuna.tsinghua.5250ec7002de9e81a41de169f1f89721edu.tarcn/help/ubuntu/''']|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Note that the Ubuntu version needs to be switched to 22.lz404.current</li>
bullseye[[File:zero2w-xfceimg271.png]]</ol><ol start="3" style="list-arm64style-type: lower-alpha;"><li>The contents of the '''/etc/apt/sources.5250ec7002de9e81a41de169f1f89721list''' file that need to be replaced are:</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''sudo mv /etc/apt/sources.tarlist cat /etc/apt/sources.lz4list.listbak'''
<ol start="11" style="list-style-typetest@test: decimal;"><li>If the required rootfs already exists under ~$ '''externalsudo vim /cacheetc/rootfs''', then compiling the rootfs again will directly skip the compilation process and will not restart the compilationapt/sources. When compiling the image, it will also go to 'list''external/cache/rootfs''' to check whether it already exists. There is a cached rootfs available. If it is available, use it directly. This can save a lot of download and compilation time.</li></ol>
<span id="compile-linux-'''#''' The source code image"></span>== Compile linux image ==is commented by default to improve apt update speed. You can uncomment it yourself if necessary.
# Run the '''builddeb https://mirrors.sh''' script, remember to add sudo permissionstuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
test@test:~/orangepi-build$ '''sudo ./build.sh#'''deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
<ol start="2" style="list-style-typedeb https: decimal;"><li>Select '''Full OS image for flashing''' and press Enter</li></ol>mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
<div class="figure">'''#''' deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
[[Filedeb https:zero2w//mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-img292.png]]backports main restricted universe multiverse
</div><ol start="3" style="list'''#''' deb-style-typesrc https: decimal;"><li>Then select the model of the development board</li></ol>mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
[[Filedeb https:zero2w//mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-img275.png]]security main restricted universe multiverse
<ol start="4" style="list'''#''' deb-style-typesrc https: 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/mirrors.04, and ubuntu22tuna.04tsinghua.</p></li><li><p>In the next branch, you can see three options: debian11, debian12, and ubuntu22.04edu.<cn/p><ubuntu/li></ol></li></ol>jammy-security main restricted universe multiverse
[[File:zero2w-img276.png]]
<ol start="5" style="list'''#''' Pre-style-type: decimal;"><li><p>If you select the next branch, you will also be prompted to select the memory sizerelease software source, and you do not need recommended 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>be enabled
[[File'''#''' deb https:zero2w//mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-img286.png]]proposed main restricted universe multiverse
'''#''' deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse|}</ol><ol start="74" style="list-style-type: decimallower-alpha;"><li>After the replacement, you need to update the package information and ensure that no errors are reported.<p/li>Then select the type of image{| class="wikitable" style="width:800px;" |-| test@test:~$ '''sudo apt-get update'''|}</pol><ol start="5" style="list-style-type: lower-alpha;"><li><p>'''Image with console interface (server)''' Represents <span style="color:#FF0000">In addition, since the image source code of the server versionkernel and Uboot are stored on GitHub, which it is relatively small in sizevery important to ensure that the computer can download the code from GitHub normally when compiling the image.</p></li><li><pspan>'''Image with desktop environment'''Represents an image with a desktop, which is relatively large in size.</p></li></ol></li></ol>
<div classspan id="figureobtain-the-source-code-of-linux-sdk"></span>
[[File:zero2w-img287.png]]== Obtain the source code of linux sdk ==
</div><ol start="8" stylespan id="listdownload-styleorangepi-type: decimal;"><li>If you are compiling the server version of the image, you can also choose to compile the Standard version or the Minimal version. The Minimal version will have much less prebuild-installed software than the Standard version ('''please do not choose the Minimal version without special needs, because many things are not prefrom-installed by default. Some functions may not be available''')</ligithub"></olspan>=== Download orangepi-build from github ===
<div class="figure">Linux sdk refers to the orangepi-build set of codes. Orangepi-build is modified based on the armbian build compilation system. Multiple versions of Linux images can be compiled using orangepi-build. Use the following command to download the orangepi-build code:
[[File{| class="wikitable" style="width:zero2w800px;" |-img288.png]]| test@test:~$ '''sudo apt-get update'''
</div><ol start="9" style="listtest@test:~$ '''sudo apt-styleget install -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></ol>y git'''
[[Filetest@test:zero2w~$ '''git clone https://github.com/orangepi-xunlong/orangepi-build.git -b next'''|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note that when using the H618 Soc development board, you need to download the source code of the <span style="color:#FF0000">next</span> branch of orangepi-build. The above git clone command needs to specify the branch of the orangepi-img289build source code as next.png]]'''</big>
[[File:zero2w-img290.png]]<div class="figure">
You can then select additional packages that need to be installed. Please press the Enter key here to skip directly[[File:zero2w-img272.png|center|800px]]
[[File</div>|}{| class="wikitable" style="background-color:#ffffdc;width:zero2w800px;" |-| <big>'''When downloading the orangepi-img291build code through the git clone command, you do not need to enter the user name and password of the github account (the same is true for downloading other codes in this manual). If after entering the git clone command, Ubuntu PC prompts you to enter the user name of the github account. The name and password are usually entered incorrectly in the address of the orangepi-build warehouse behind git clone. Please carefully check whether there are any errors in the spelling of the command, rather than thinking that we have forgotten to provide the username and password of the github account.png]]'''</big>|}
<ol start="10" style="listThe u-style-type: decimal;"><li>Then the compilation of boot and linux kernel versions currently used by the linux image will begin. The general process of compilation is H618 series development boards are as follows</li></ol>:
a{| class="wikitable" style="width:800px;text-align: center;"|-| '''branch'''| '''u-boot Version'''| '''linux Kernel version'''|-| '''current'''| '''u-boot v2018. Initialize the compilation environment of Ubuntu PC and install the software packages required for the compilation process05'''| '''linux5.4'''|-| '''next'''| '''u-boot v2021.07'''| '''linux6.1'''|}
b{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''The branch mentioned here is not the same thing as the branch of orangepi-build source code, please don't get confused. This branch is mainly used to distinguish different kernel source code versions.''' '''We define the linux5. Download 4 bsp kernel currently provided by Allwinner as the current branch. The latest linux6.1 LTS kernel is defined as the next branch.'''</big>|} After downloading, the following files and folders will be included: <ol style="list-style-type: lower-alpha;"><li><p>'''build.sh''': Compile startup script</p></li><li><p>'''external''': Contains configuration files needed to compile the image, specific scripts, and source code of some programs, etc.</p></li><li><p>'''LICENSE''': GPL 2 license file</p></li><li><p>'''README.md''': orangepi-build documentation</p></li><li><p>'''scripts''': Common script for compiling linux images</p></li></ol>{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''ls''' '''build.sh &nbsp;&nbsp;&nbsp;&nbsp; external &nbsp;&nbsp;&nbsp;&nbsp; LICENSE &nbsp;&nbsp;&nbsp;&nbsp; README.md &nbsp;&nbsp;&nbsp;&nbsp; scripts'''|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''If you downloaded the orangepi-build code from github, after downloading, you may find that orangepi-build does not contain the source code of u-boot and linux kernel , and there is no cross-compilation tool required to compile u-boot and linux kernel. chain, this is normal, because these things are stored in other separate github repositories or some servers (if already cachedtheir addresses will be detailed below). Orangepi-build will specify the addresses of u-boot, only update Linux kernel and cross-compilation tool chain in the script and configuration file. When running orangepi-build, when it finds that these things are not available locally, it will automatically download them from the code)corresponding places.'''</big>|}
c. Compile u<span id="download-boot source code and generate uthe-boot deb packagecross-compilation-tool-chain"></span>
d. Compile linux source code and generate linux=== Download the cross-related deb packagescompilation tool chain ===
eWhen orangepi-build is run for the first time, it will automatically download the cross-compilation '''toolchain''' and put it in the '''toolchains''' folder. Every time you run orangepi-build's build.sh script, it will check whether the cross-compilation toolchain in toolchains exists. Make If If it does not exist, the deb package of linux firmwaredownload will be restarted. If it exists, it will be used directly without repeated downloading.
f. Make the deb package of orangepi-config tool<div class="figure">
g[[File:zero2w-img273. Create a deb package with board-level supportpng]]
h. If you compile </div>The mirror URL of the desktop version image, you will also create a desktopcross-related deb package.compilation tool chain in China is the open source software mirror site of Tsinghua University:
i{| class="wikitable" style="width:800px;" |-| [https://mirrors.tuna.tsinghua. Check whether rootfs has been cachededu. If not, recn/armbian-create rootfsreleases/_toolchain/ '''https://mirrors.tuna. If it has been cached, decompress it directly and use ittsinghua.edu.cn/armbian-releases/_toolchain/''']|}
j. Install the deb package generated previously into rootfsAfter toolchains is downloaded, it will contain multiple versions of cross-compilation '''toolchain''':
k. Make some specific settings for different development boards and different types of images, such as pre{| class="wikitable" style="width:800px;" |-installing additional software packages, modifying system configurations, etc.| test@test:~/orangepi-build$ '''ls toolchains/'''
lgcc-arm-11. Then create the image file and format the partition. The default type is ext42-2022.02-x86_64-aarch64-none-linux-gnu
mgcc-linaro-4. Then copy the configured rootfs to the mirror partition9.4-2017.01-x86_64_aarch64-linux-gnu
ngcc-linaro-7. Then update initramfs4.1-2019.02-x86_64_arm-linux-gnueabi
ogcc-arm-11. Finally, write the bin file of u2-boot into the image through the dd command2022.02-x86_64-arm-none-linux-gnueabihf
<ol start="11" style="listgcc-stylelinaro-type: decimal;"><li><p>After compiling the image, the following message will be displayed</p><ol style="list4.9.4-style2017.01-type: lowerx86_64_arm-alpha;"><li>The storage path of the compiled image</li></ol></li></ol>linux-gnueabi
[ ogcc-linaro-aarch64-none-elf-4.k8-2013. ] Done building [ '''output/images/orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop/orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop.img''' ]11_linux
<ol start="gcc-arm-9.2" style="list-style2019.12-x86_64-aarch64-none-type: lowerlinux-alpha;"><li>Compilation time</li></ol>gnu
'''[ ogcc-linaro-5.k5. ] Runtime [ 19 min ]'''0-2017.10-x86_64_arm-linux-gnueabihf
<ol start="3" style="listgcc-stylelinaro-type: lowerarm-alpha;"><li>Repeat the command to compile the imagelinux-gnueabihf-4. Use the following command to start compiling the image directly without selecting it through the graphical interface8-2014.</li></ol>04_linux
[ ogcc-arm-9.k2-2019. ] Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=image RELEASE=bullseye BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_CONFIGURE=yes''' ]12-x86_64-arm-none-linux-gnueabihf
<span id="instructionsgcc-forlinaro-using7.4.1-the2019.02-orangex86_64_aarch64-pilinux-os-arch-system"></span>gnu
= '''Instructions for using the Orange Pi OS Arch system''' =gcc-linaro-arm-none-eabi-4.8-2014.04_linux|}
<span id="orangeThe cross-pi-os-arch-system-function-adaptation-status"></span>== Orange Pi OS Arch system function adaptation status ==compilation tool chain used to compile the H618 Linux kernel source code is:
<ol style="list-style-type: lower-alpha;"><li>linux5.4</li>{| class="wikitable" style="width:800px;"
|-
| '''Motherboard functionsgcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu'''| '''OPi OS Arch'''}</ol>|<ol start="2" style="list-style-type: lower-alpha;">| '''HDMI video'''<li>linux6.1</li>{| '''OK'''class="wikitable" style="width:800px;"
|-
| '''HDMI Audiogcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu'''| '''OK'''}</ol>The cross-compilation tool chain used to compile the H618 u-boot source code is: <ol style="list-style-type: lower-alpha;"><li>v2018.05</li>{| class="wikitable" style="width:800px;"
|-
| '''Typegcc-linaro-C USB27.4.0 x 21-2019.02-x86_64_arm-linux-gnueabi'''| '''OK'''}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>v2021.07</li>{| class="wikitable" style="width:800px;"
|-
| '''TF Card Startupgcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu'''| '''OK'''}</ol><span id="orangepi-build-complete-directory-structure-description"></span> === orangepi-build complete directory structure description === <ol style="list-style-type: decimal;"><li><p>After downloading, the orangepi-build warehouse does not contain the source code of the linux kernel, u-boot and cross-compilation tool chain. The source code of the linux kernel and u-boot is stored in an independent git warehouse.</p><ol style="list-style-type: lower-alpha;"><li><p>The git warehouse where the linux kernel source code is stored is as follows. Please note that the branch of the linux-orangepi warehouse is switched to</p><ol style="list-style-type: none;"><li>a) Linux5.4</li>{| class="wikitable" style="width:800px;"
|-
| https://github.com/orangepi-xunlong/linux-orangepi/tree/'''WIFIorange-pi-5.4-sun50iw9'''| '''OK'''}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>b) Linux6.1</li>{| class="wikitable" style="width:800px;"
|-
| https://github.com/orangepi-xunlong/linux-orangepi/tree/'''Bluetoothorange-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/'''LED Lightv2018.05-h618'''| '''OK'''}</ol>|<ol start="2" style="list-style-type: lower-alpha;">| '''40pin GPIO'''<li>b) v2021.07</li>{| '''OK'''class="wikitable" style="width:800px;"
|-
| https://github.com/orangepi-xunlong/u-boot-orangepi/tree/'''40pin I2Cv2021.07-sunxi'''| }</ol></li></ol></li></ol><ol start="2" style="list-style-type: decimal;"><li><p>When orangepi-build is run for the first time, it will download the cross-compilation tool chain, u-boot and linux kernel source code. After successfully compiling a linux image, the files and folders that can be seen in orangepi-build are:</p><ol style="list-style-type: lower-alpha;"><li><p>'''OKbuild.sh''': Compile startup script</p></li><li><p>'''external''': Contains the configuration files needed to compile the image, scripts for specific functions, and the source code of some programs. The rootfs compressed package cached during the image compilation process is also stored in external.</p></li><li><p>'''kernel''': Store the source code of the linux kernel</p></li><li><p>'''LICENSE''': GPL 2 license file</p></li><li><p>'''README.md''': orangepi-build documentation</p></li><li><p>'''output''': Store compiled u-boot, linux and other deb packages, compilation logs, and compiled images and other files</p></li><li><p>'''scripts''': Common script for compiling linux images</p></li><li><p>'''toolchains''': Store cross-compilation tool chain</p></li><li><p>'''u-boot''': Store the source code of u-boot</p></li><li><p>'''userpatches''': Store the configuration files needed to compile the script</p></li>{| class="wikitable" style="width:800px;"
|-
| test@test:~/orangepi-build$ '''40pin SPIls'''| '''OKbuild.sh &nbsp;&nbsp;&nbsp;&nbsp; external &nbsp;&nbsp;&nbsp;&nbsp; kernel &nbsp;&nbsp;&nbsp;&nbsp; LICENSE &nbsp;&nbsp;&nbsp;&nbsp; output &nbsp;&nbsp;&nbsp;&nbsp; README.md &nbsp;&nbsp;&nbsp;&nbsp; scripts &nbsp;&nbsp;&nbsp;&nbsp; toolchains &nbsp;&nbsp;&nbsp;&nbsp; u-boot &nbsp;&nbsp;&nbsp;&nbsp; userpatches'''|}</ol></li></ol> <span id="compile-u-boot"></span> == Compile u-boot == # Run the build.sh script, remember to add sudo permissions {| class="wikitable" style="width:800px;"
|-
| '''40pin UART'''| '''OK'''|test@test:~/orangepi-| '''40pin PWM'''| '''OK'''|-| '''Temperature Sensor'''| '''OK'''|-| '''Hardware watchdog'''| '''OK'''|-| '''Mali GPU'''| '''NO'''|-| '''Video codec'''| build$ '''NOsudo ./build.sh'''
|}
{| class<ol start="wikitable2"|style="list-| '''24pin expansion board function'''| '''OPi OS Arch'''|style-type: decimal;">| '''100M network port'''| '''OK'''|-| '''100M Ethernet port light'''| '''OK'''|-| '''USB2.0 HOST x 2'''| '''OK'''|-| '''Infrared reception'''| '''OK<li>Select '''|U-| boot package'''Headphone audio playback'''| '''OK'''|-| '''Onand press Enter</off button'''| '''OK'''|-| '''LRADC''' '''Custom buttons x 2'''| '''OK'''|-| '''TV-OUT'''| '''NO'''|}li>
<span iddiv class="orange-pi-os-arch-system-user-guide-instructionsfigure"></span>== Orange Pi OS Arch System User Guide Instructions ==
First of all, please note that the OPi OS Arch system does not have a default orangepi user and password, so you cannot directly log in remotely through the serial port and ssh after the system is started after burning (not even the root user). This is different from Ubuntu and Debian systems[[File:zero2w-img274.png]]
When </div></ol><ol start="3" style="list-style-type: decimal;"><li>Then select the OPi OS Arch system is started for the first time, you need to connect an HDMI display and then initialize the system settings through the user wizard (including creating a new user name and setting a password). The setup steps model of the user wizard are as follows: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;">
<li><p>If the development board you purchased has a memory size of 1.5GB, please select the first option.</p></li>
<li><p>If the development board you purchased has 1GB or 2GB or 4GB memory size, please choose the second option.</p>
<p>[[File:zero2w-img277.png]]</p></li></ol>
</li></ol>
<ol start="6" style="list-style-type: decimal;">
<li><p>Then it will start to compile u-boot. Some of the information prompted when compiling the next branch is as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li>Version of u-boot source code</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Compiling u-boot [ '''v2021.07''' ]|}<p/ol>After burning the system, when you <ol start it for ="2" style="list-style-type: lower-alpha;"><li>Version of the first time and enter the desktop, you will see the user wizard program shown in the figure belowcross-compilation tool chain</li>{| class="wikitable" style="width:800px;" |-| [ o.k.] Compiler version [ '''aarch64-linux-gnu-gcc 11''' ]|}</pol><div ol start="3" style="list-style-type: lower-alpha;"><li>Path to the compiled u-boot deb package</li>{| class="figurewikitable">style="width:800px;" |-| [o.k. ] Target directory [File'''orangepi-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>{| class="wikitable" style="width:zero2w800px;" |-img293| [ o.k.png]File name [ '''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb''' ]|}</divol><ol start="5" style="list-style-type: lower-alpha;"><li>Compilation time</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Runtime [ '''1 min''' ]|}<li/ol><ol start="6" style="list-style-type: lower-alpha;"><pli>First you need Repeat the command to select compile u-boot. Use the following command without selecting through the language you wantgraphical interface. You can start compiling u-boot directly.</pli><div {| class="figurewikitable">style="width:800px;" |-| [o.k. ] Repeat Build Options [File:zero2w'''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=u-img294.png]boot''' ]|}</divol></li></ol><liol start="7" style="list-style-type: decimal;"><pli>After selecting View the language, the user wizard will immediately switch to the corresponding language interface, as shown below in Chinesecompiled u-boot deb package</pli><div {| class="figurewikitable">style="width:800px;" |-| test@test:~/orangepi-build$ '''ls output/debs/u-boot/'''
[[File'''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb'''|}</ol><ol start="8" style="list-style-type:zero2wdecimal;"><li>When the orangepi-bulid compilation system compiles the u-img295boot source code, it will first synchronize the u-boot source code with the u-boot source code of the github server.png]]Therefore, if you want to modify the u-boot source code, you first need to turn off the download and update function of the source code. ('''You need to completely compile u-boot before you can turn off this function, otherwise it will prompt that the source code of u-boot cannot be found'''), otherwise the modifications will be restored. The method is as follows:</li>
</div></li><li><p>Then select Set the area<IGNORE_UPDATES variable in u'''userpatches/p><div class="figure">config-default.conf''' to &quot;yes&quot;
[[File{| class="wikitable" style="width:zero2w800px;" |-img296| test@test:~/orangepi-build$ '''vim userpatches/config-default.png]]conf'''
</div></li><li><p>Then select the keyboard model</p><div class="figure">......
[[FileIGNORE_UPDATES=&quot;'''<span style="color:zero2w-img297.png]]#FF0000">yes</span>'''&quot;
......|}</divol></liol start="9" style="list-style-type: decimal;"><li><p>Then create a new username and set a passwordWhen debugging u-boot code, you can use the following method to update u-boot in the linux image for testing</p><div ol style="list-style-type: lower-alpha;"><li>First upload the compiled deb package of u-boot to the Linux system of the development board.</li>{| class="figurewikitable" style=">width:800px;" |-| test@test:~/orangepi-build$ '''cd output/debs/u-boot'''
[[Filetest@test:zero2w~/orangepi_build/output/debs/u-img298.png]]boot$ '''scp \'''
'''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb [mailto:root@192.168.1.xxx:/root root@192.168.1.xxx:/root]'''|}</divol><ol start="2" style="list-style-type: lower-alpha;"><li>Install the new u-boot deb package just uploaded</li>{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''sudo dpkg -i''' '''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb'''|}</ol><liol start="3" style="list-style-type: lower-alpha;"><pli>Then make sure there is no problem with the selection, and then click run the nand-sata-install script</li>{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''buttonsudo nand-sata-install'''|}</pol><div classol start="4" style="figurelist-style-type: lower-alpha;"><li>Then select '''5 Install/Update the bootloader on SD/eMMC'''</li>
[[File:zero2w-img299img278.png]]</ol><ol start="5" style="list-style-type: lower-alpha;"><li>After pressing the Enter key, a Warning will pop up first.</li>
[[File:zero2w-img279.png]]</divol></liol start="6" style="list-style-type: lower-alpha;"><li><p>Then wait for Press the installation Enter key again to completestart updating u-boot. After the update is completed, the following information will be displayed.</p><div class="figure"li>
[[File:zero2w-img300img280.png]]</ol><ol start="7" style="list-style-type: lower-alpha;"><li>Then you can restart the development board to test whether the u-boot modification has taken effect.</li></ol></li></ol><span id="compile-the-linux-kernel"></span>
</div></li><li><p>After == Compile the installation is complete, you need to click the '''Finish''' button to restart the system.</p><div classlinux kernel =="figure">
[[File:zero2w-img301# Run the '''build.png]]sh''' script, remember to add sudo permissions
</div><::{| class="wikitable" style="width:800px;" |-| test@test:~/li><li><p>The Orange Pi Hello program will automatically start after restarting. At this time, you need to remove the check orangepi-build$ '''mark of Start on startupsudo ./build.sh''' in the lower right corner, otherwise you need to manually close the Orange Pi Hello program every time you start it.</p><div class="figure">|}
[[File<ol start="2" style="list-style-type:zero2w-img302.png]]decimal;"><li>Select '''Kernel package''' and press Enter</li>
</div><p>At this point, you can use the newly created username and password to log in to the OPi OS system through the serial port or ssh.</p></li></olclass="figure">
<span id="how[[File:zero2w-to-set-dt-overlays"></span>== How to set DT overlays ==img281.png]]
The multiplexing functions such as I2C</SPIdiv></UART/PWM in ol><ol start="3" style="list-style-type: decimal;"><li>Then you will be prompted whether you need to display the 40-pin development board are turned off by default in kernel configuration interface. If you do not need to modify the kernel's dtsconfiguration, and select the corresponding DT overlays first one. If you need to be manually turned on before they can be usedmodify the kernel configuration, select the second one.</li>
The method to open DT overlays in OPi OS Arch system is as follows[[File:zero2w-img282.png]]</ol><ol start="4" style="list-style-type: decimal;"><li>Then select the model of the development board</li>
# First open [[File:zero2w-img275.png]]</ol><ol start="5" style="list-style-type: decimal;"><li>Then select the branch type of the '''/bootkernel source code</extlinux/extlinux.conf''' configuration fileli>
[orangepi@orangepi-pc ~]$ '''sudo vim /boot/extlinux/extlinux::a.conf'''The current branch will compile the linux5.4 kernel source code
<ol start="2" style="list-style-type: decimal;"><li>Then open :b. The next branch will compile the corresponding configuration by adding '''FDTOVERLAYS''' '''/dtbs/allwinner/overlay/xxx.dtbo''' in '''/boot/extlinux/extlinuxlinux6.conf'''</li></ol>1 kernel source code
'''Note that xxx::[[File:zero2w-img276.dtbo in FDTOVERLAYS /dtbs/allwinner/overlaypng]]</xxx.dtbo needs ol><ol start="6" style="list-style-type: decimal;"><li>If you choose to be replaced with display the specific dtbo kernel configurationmenu (the second option) in step 3), please do not copy it.the kernel configuration interface opened through '''make menuconfig'''will pop up. At this time, you can directly modify the kernel configuration. After modification, save and exit. Yes, compilation of the kernel source code will begin after exiting.</li>
[orangepi@orangepi[File:zero2w-pc ~img283.png]]$ '''sudo vim /boot/extlinux/extlinux.conf'''
LABEL Orange Pi<ol style="list-style-type: lower-alpha;"><li>If you do not need to modify the kernel configuration options, when running the build.sh script, pass '''KERNEL_CONFIGURE=no''' to temporarily block the pop-up of the kernel configuration interface.</li>{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''sudo ./build.sh KERNEL_CONFIGURE=no'''|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li><p>b. You can also set '''KERNEL_CONFIGURE=no''' in the orangepi-build/userpatches/config-default.confconfiguration file to permanently disable this function.</p></li><li><p>If the following error is prompted when compiling the kernel, it is because the Ubuntu PC terminal interface is too small, causing the make menuconfig interface to be unable to be displayed. Please increase the Ubuntu PC terminal to the maximum size, and then rerun the build.sh script.</p></li>
KERNEL /Image FDT /dtbs/allwinner/sun50i-h616-orangepi[[File:zero2w-zero2wimg284.dtbpng]]</ol>'''FDTOVERLAYS </dtbs/allwinner/overlay/xxx.dtbo''' #Configuration that needs to be addedol><ol start="37" style="list-style-type: decimal;"><li><p>The storage path Part of xxx.dtbo in the OPi OS Arch image information prompted when compiling the next branch kernel source code is explained as follows. Please note that not all dtbo under this path can be used.:</p><p>'''/boot/dtbs/allwinner/overlay/'''</p></liol style="list-style-type: lower-alpha;"><li><p>The DT overlays configuration that can be used by Version of the development board is as follows</p>linux kernel source code</li></ol> {| class="wikitable" style="width:800px;"
|-
| [ o.k. ] Compiling current kernel [ '''Functions on the development board6.1.31''']|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>The version of the cross-compilation tool chain used</li>{| '''Corresponding DT overlays configuration'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] Compiler version [ '''40pin aarch64- i2c0linux-gnu-gcc 11''']| '''sun50i}</ol><ol start="3" style="list-h616style-pitype: lower-i2c0.dtbo'''alpha;"><li>The default configuration file used by the kernel and the path where it is stored are as follows</li>{| class="wikitable" style="width:800px;"
|-
| [ o.k. ] Using kernel config file [ '''40pin orangepi-build/external/config/kernel/linux- i2c16.1-sun50iw9-next.config''']| '''sun50i}</ol><ol start="4" style="list-style-h616type: lower-pialpha;"><li>The path to the kernel-i2c1.dtbo'''related deb package generated by compilation</li>{| class="wikitable" style="width:800px;"
|-
| [ o.k. ] Target directory [ '''40pin - i2c2output/debs/''']| '''sun50i}</ol><ol start="5" style="list-h616style-pitype: lower-i2c2.dtbo'''alpha;"><li>The package name of the kernel image deb package generated by compilation</li>{| class="wikitable" style="width:800px;"
|-
| [ o.k. ] File name [ '''40pin linux-image-next- uart2sun50iw9_x.x.x_arm64.deb''']| '''sun50i}</ol><ol start="6" style="list-h616style-pitype: lower-uart2.dtbo'''alpha;"><li>Compilation time</li>{| class="wikitable" style="width:800px;"
|-
| [ o.k. ] Runtime [ '''40pin - uart310 min''']| '''sun50i}</ol><ol start="7" style="list-h616style-pitype: lower-uart3alpha;"><li>Finally, the compilation command to repeatedly compile the last selected kernel will be displayed. Use the following command without selecting through the graphical interface, and you can directly start compiling the kernel source code.dtbo'''</li>{| class="wikitable" style="width:800px;"
|-
| [ o.k. ] Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=kernel KERNEL_CONFIGURE=no''' ]|}</ol></li></ol><ol start="8" style="list-style-type: decimal;"><li><p>View the kernel-related deb package generated by compilation</p><ol style="list-style-type: lower-alpha;"><li><p>'''linux-dtb-next-sun50iw9_x.x.x_arm64.deb''' Contains dtb files used by the kernel</p></li><li><p>'''40pin linux-headers-next- uart4sun50iw9_x.x.x_arm64.deb'''Contains kernel header files</p></li>| <li><p>'''sun50ilinux-h616image-pinext-uart4sun50iw9_x.x.x_arm64.dtbodeb'''Contains kernel images and kernel modules</p></li>{| class="wikitable" style="width:800px;"
|-
| test@test:~/orangepi-build$ '''40pin ls output/debs/linux- uart5*'''| '''sun50ioutput/debs/linux-h616dtb-phnext-uart5sun50iw9_x.dtbo'''x.x_arm64.deb |output/debs/linux-headers-next-sun50iw9_x.x.x_arm64.deb| '''40pin - pwm1'''| '''sun50ioutput/debs/linux-h616image-pinext-pwm1sun50iw9_x.dtbo'''x.x_arm64.deb|}</ol></li></ol><ol start="9" style="list-style-type: decimal;">| <li>When the orangepi-bulid compilation system compiles the linux kernel source code, it will first synchronize the linux kernel source code with the linux kernel source code of the github server. Therefore, if you want to modify the linux kernel source code, you first need to turn off the update function of the source code ('''40pin - pwm2it needs to be completely compiled once This function can only be turned off after obtaining the Linux kernel source code, otherwise it will prompt that the source code of the Linux kernel cannot be found'''), otherwise the modifications will be restored. The method is as follows:</li>| Set the IGNORE_UPDATES variable in '''sun50i-h616-piuserpatches/config-pwm2default.dtboconf'''to &quot;yes&quot; {| class="wikitable" style="width:800px;"
|-
| test@test:~/orangepi-build$ '''40pin vim userpatches/config- pwm3default.conf'''| IGNORE_UPDATES=&quot;'''<span style="color:#FF0000">yes</span>'''sun50i&quot;|}</ol><ol start="10" style="list-h616style-pitype: decimal;"><li><p>If the kernel is modified, you can use the following method to update the kernel and kernel module of the development board Linux system</p><ol style="list-style-type: lower-pwm3.dtbo'''alpha;"><li>Upload the compiled deb package of the Linux kernel to the Linux system of the development board</li>{| class="wikitable" style="width:800px;"
|-
| test@test:~/orangepi-build$ '''cd output/debs'40pin '' test@test:~/orangepi- pwm4build/output/debs$ '''scp \'''| '''sun50ilinux-h616image-pinext-pwm4sun50iw9_x.x.x_arm64.deb root@192.168.1.dtboxxx:/root'''|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Install the deb package of the new linux kernel just uploaded.</li>{| class="wikitable" style="width:800px;"
|-
| orangepi@orangepi:~$ '''40pin sudo dpkg - spi1 cs0i linux-image-next-sun50iw9_x.x.x_arm64.deb'''| '''sun50i}</ol><ol start="3" style="list-h616style-spi1type: lower-cs0alpha;"><li>Then restart the development board and check whether the kernel-spidevrelated modifications have taken effect.dtbo'''</li>{| class="wikitable" style="width:800px;"
|-
| '''40pin - spi1 cs1'''| '''sun50i-h616-spi1-cs1-spidev.dtbo'''|-| '''40pin - spi1 cs0 cs1'''| '''sun50i-h616-spi1-cs0-cs1-spidev.dtbo'''|-| '''设Set USB0 to Host mode'''| '''sun50i-h616-usb0-host.dtbo'''|-| '''Turn off the green LED light'''| orangepi@orangepi:~$ '''sun50i-h616-zero2w-disable-led.dtbosudo'''|-| '''How to close the UART0 debugging serial port'''| '''sun50i-h616-disable-uart0.dtboreboot'''
|}
</ol>
</li></ol>
<span id="compile-rootfs"></span>
<ol start="5" style="list-style-type: decimal;"><li>If you need to open multiple configurations at the same time, just add the paths of multiple configurations directly after '''FDTOVERLAYS.''' For example, the configuration of opening i2c1 and uart5 at the same time is as follows</li></ol>Compile rootfs ==
[orangepi@orangepi-pc ~]$ '''# Run the build.sh script, remember to add sudo vim /boot/extlinux/extlinux.conf'''permissions
LABEL Orange Pi::{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''sudo ./build.sh'''|} <ol start="2" style="list-style-type: decimal;"><li>Select '''Rootfs and all deb packages''' and press Enter</li> <div class="figure"> [[File:zero2w-img285.png]]
KERNEL </Imagediv></ol><ol start="3" style="list-style-type: decimal;"><li>Then select the model of the development board</li>
FDT [[File:zero2w-img275.png]]</dtbs/allwinnerol><ol start="4" style="list-style-type: decimal;"><li><p>Then select the branch type of the kernel source code. Different versions of the kernel source code maintain different rootfs types.</sun50ip><ol style="list-h616style-orangepitype: lower-zero2walpha;"><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.dtb</p></li>
'''FDTOVERLAYS /dtbs/allwinner/overlay/sun50i-h616-pi[[File:zero2w-i2c1img276.dtbo png]]</dtbsol></allwinnerli></overlay/sun50iol><ol start="5" style="list-h616style-ph-uart5.dtbo'''type: decimal;"><li>Then select the type of rootfs</li>
[[File:zero2w-img286.png]]
</ol>
<ol start="6" style="list-style-type: decimal;">
<li>After setting, you need to restart <p>Then select the type of image</p><ol style="list-style-type: lower-alpha;"><li><p>'''Image with console interface (server)''' Represents the system for image of the configuration to take effectserver 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.</olp></li>
[orangepi@orangepi-pc ~]$ '''sudo reboot'''<div class="figure">
<span id="how[[File:zero2w-to-install-software"></span>== How to install software ==img287.png]]
You </div></ol></li></ol><ol start="7" style="list-style-type: decimal;"><li>If you are compiling the server version of the image, you can use the pacman package management tool also choose to install software that is not available in OPi OS. For example, compile the command to install Standard version or the vim editor is as followsMinimal version. If you want to install other The Minimal version will have much less pre-installed software, you only need to replace vim with than the package name of Standard version ('''please do not choose the software you want to installMinimal version without special needs, because many things are not pre-installed by default.Some functions may not be available''')</li>
[orangepi@orangepi-pc ~]$ '''sudo pacman -Syy vim'''<div class="figure">
<span id="android[[File:zero2w-12-tv-system-usage-instructions"></span>img288.png]]
</div></ol><ol start= '''Android 12 TV system usage instructions''' "8" style="list-style-type: decimal;"><li>If you are compiling a desktop version of the image, you also need to select the type of desktop environment. Currently, only XFCE is maintained, so please select an XFCE type desktop.</li>
<span id="supported[[File:zero2w-android-versions"></span>== Supported Android versions ==img289.png]]
{| class="wikitable"|[[File:zero2w-| Android Version| Kernel version|-| '''Android 12 TV Version'''| '''linux5img290.4'''|}png]]
<span id="android-12-tv-function-adaptation-status"></span>== Android 12 TV function adaptation status ==You can then select additional packages that need to be installed. Please press the Enter key here to skip directly.
{| class[[File:zero2w-img291.png]]</ol><ol start="9" style="wikitablelist-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;">| '''Motherboard functions'''<li>Type of rootfs</li>{| '''Android12 TV'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] local not found [ Creating new rootfs cache for '''HDMI videobullseye''']|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>The storage path of the compiled rootfs compressed package</li>{| '''OK'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] Target directory [ '''HDMI Audioorangepi-build/external/cache/rootfs''']|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>The name of the rootfs compressed package generated by compilation</li>{| '''OK'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] File name [ '''Typebullseye-xfce-C USB2arm64.0 x 25250ec7002de9e81a41de169f1f89721.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>'''OKbullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4''' It is a compressed package of rootfs. The meaning of each field in the name is</li> :a) '''bullseye''' represents the type of Linux distribution of rootfs :b) '''xfce''' indicates that the rootfs is the desktop version, and if it is cli, it indicates the server version. :c) '''arm64''' represents the architecture type of rootfs :d) '''25250ec7002de9e81a41de169f1f89721''' is the MD5 hash value generated by the package names of all software packages installed by rootfs. As long as the list of software packages installed by rootfs is not modified, this value will not change. The compilation script will use this MD5 hash value. Determine whether rootfs needs to be recompiled</ol><ol start="2" style="list-style-type: lower-alpha;"><li>'''bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4.list''' Lists the package names of all packages installed by rootfs</li>{| class="wikitable" style="width:800px;"
|-
| test@test:~/orangepi-build$ '''TF card startupls external/cache/rootfs/''' bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4 bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4.current bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4.list| }</ol></li></ol><ol start="11" style="list-style-type: decimal;"><li>If the required rootfs already exists under '''external/cache/rootfs''', then compiling the rootfs again will directly skip the compilation process and will not restart the compilation. When compiling the image, it will also go to '''external/cache/rootfs''' to check whether it already exists. There is a cached rootfs available. If it is available, use it directly. This can save a lot of download and compilation time.</li></ol> <span id="compile-linux-image"></span> == Compile linux image == # Run the '''OKbuild.sh'''script, remember to add sudo permissions ::{| class="wikitable" style="width:800px;"
|-
| '''WIFI'''| '''OK'''|-| '''Bluetooth'''| '''OK'''|test@test:~/orangepi-| '''USB Camera'''| '''OK'''|-| '''LED Light'''| '''OK'''|-| '''40pin GPIO'''| '''OK'''|-| '''40pin I2C'''| '''OK'''|-| '''40pin SPI1'''| '''OK'''|-| '''40pin UART'''| '''OK'''|-| '''40pin PWM'''| '''OK'''|-| '''Temperature Sensor'''| '''OK'''|-| '''Hardware watchdog'''| '''OK'''|-| '''Mali GPU'''| '''OK'''|-| '''Video codec'''| build$ '''OKsudo ./build.sh'''
|}
{| class<ol start="wikitable2" style="|list-| '''24pin Expansion board function'''| '''Android12 TV'''|style-type: decimal;">| <li>Select '''100M network portFull OS image for flashing'''and press Enter</li>| '''OK'''|-<div class="figure">| '''100M Ethernet port light'''| '''OK'''|[[File:zero2w-img292.png]]| '''USB2.0 HOST x 2'''| '''OK'''</div></ol>|<ol start="3" style="list-| '''Infrared reception'''| '''OK'''|style-type: decimal;">| '''Headphone audio playback'''<li>Then select the model of the development board</li>| '''OK'''|[[File:zero2w-img275.png]]| '''On</off button'''ol>| '''OK'''|<ol start="4" style="list-style-type: decimal;">| '''LRADC''' '''Custom buttons x 2'''| '''OK, The default setting is <li><p>Then select the branch type of the kernel source code. Different versions of the volume up and down keyskernel source code maintain different rootfs types.'''</p>|<ol style="list-| '''TVstyle-type: lower-OUT'''alpha;">| '''OK'''<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-img276.png]]</ol></li></ol><span idol start="5" style="onboardlist-ledstyle-lighttype: 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-displaystyle-instructionstype: 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.</spanp>== Onboard LED light display instructions ==<p>[[File:zero2w-img277.png]]</p></li></ol></li><li><p>Then select the type of rootfs</p></li>
{| class[[File:zero2w-img286.png]]</ol><ol start="wikitable7" style="|list-style-type: decimal;">|<li><p>Then select the type of image</p>| '''green light'''| '''red light'''|<ol style="list-style-| '''utype: lower-boot startup phase'''alpha;">| <li><p>'''OffImage with console interface (server)'''| '''on'''|-| '''Kernel boot to enter Represents the image of the system'''| '''on'''server version, which is relatively small in size.</p></li>| <li><p>'''onImage with desktop environment'''|}Represents an image with a desktop, which is relatively large in size.</p></li>
<span iddiv class="how-to-return-to-the-previous-interface-in-androidfigure"></span>== How to return to the previous interface in Android ==
We generally use the mouse and keyboard to control the Android system of the development board. When entering certain interfaces and need to return to the previous interface or desktop, we can only return by right[[File:zero2w-clicking the mouse, and the keyboard cannot returnimg287.png]]
</div></ol></li></ol><ol start="8" style="list-style-type: decimal;"><li>If you have purchased are compiling the infrared remote control (other remote controls do not work) and a 24pin expansion board that come with server version of the development board, after connecting the 24pin expansion board to the development boardimage, you can also use the return key on choose to compile the remote control to return to Standard version or the previous menuMinimal version. The location of Minimal version will have much less pre-installed software than the Standard version ('''please do not choose the return key is as shown belowMinimal version without special needs, because many things are not pre-installed by default. Shown:Some functions may not be available''')</li>
[[File:zero2w-img303.png]]<div class="figure">
<span id="how[[File:zero2w-to-use-adb"></span>== How to use ADB ==img288.png]]
<span id/div></ol><ol start="use-network-connection9" style="list-adbstyle-debuggingtype: decimal;"><li>If you are compiling a desktop version of the image, you also need to select the type of desktop environment. Currently, only XFCE is maintained, so please select an XFCE type desktop.</spanli>=== Use network connection adb debugging ===
'''Using network adb does not require a USB Typc C interface data cable to connect the computer and the development board[[File:zero2w-img289. Instead, it communicates through the network, so first make sure that the development board's wired or wireless network is connected, and then obtain the IP address of the development board. Next To be used.'''png]]
# Make sure the '''service[[File:zero2w-img290.adb.tcp.port''' of the Android system is set to 5555 port numberpng]]
apollo-p2:/ # '''getprop | grep &quot;adbYou can then select additional packages that need to be installed. Please press the Enter key here to skip directly.tcp&quot;'''
[service[File:zero2w-img291.adb.tcp.portpng]]</ol><ol start="10" style="list-style-type: [5555]decimal;"><li>Then the compilation of the linux image will begin. The general process of compilation is as follows</li>
<ol start="2" style="list-style-type: decimal;"><li>If '''service.adb.tcp:a.port''' is not set, you can use Initialize the following command in compilation environment of Ubuntu PC and install the serial port to set software packages required for the port number of the network adb</li></ol>compilation process.
apollo-p2:/ # '''setprop service:b.adb.tcp.port 5555'''<br />apolloDownload the source code of u-p2:/ # '''stop adbd'''boot and linux kernel (if already cached, only update the code)
apollo::c. Compile u-boot source code and generate u-p2:/ # '''start adbd'''boot deb package
<ol start="3" style="list-style::d. Compile linux source code and generate linux-type: decimal;"><li>Install adb tool on Ubuntu PC</li></ol>related deb packages
test@test:~$ '''sudo apt-get update''':e. Make the deb package of linux firmware
test@test:~$ '''sudo apt-get install :f. Make the deb package of orangepi-y adb'''config tool
<ol start="4" style="list-style::g. Create a deb package with board-type: decimal;"><li>Then connect network adb on Ubuntu PC</li></ol>level support
test@test:~$ '''adb connect 192:h.168.1If you compile the desktop version image, you will also create a desktop-related deb package.xxx:5555''' '''(Need to be modified to the IP address of the development board)'''
* daemon ::i. Check whether rootfs has been cached. If not running; starting now at tcp:5037, re-create rootfs. If it has been cached, decompress it directly and use it.
* daemon started successfully::j. Install the deb package generated previously into rootfs
connected to 192.168::k.1Make some specific settings for different development boards and different types of images, such as pre-installing additional software packages, modifying system configurations, etc.xxx:5555
test@test:~$ '''adb devices''':l. Then create the image file and format the partition. The default type is ext4.
List of devices attached::m. Then copy the configured rootfs to the mirror partition.
192::n.168.1.xxx:5555 deviceThen update initramfs
::o. Finally, write the bin file of u-boot into the image through the dd command.</ol><ol start="511" style="list-style-type: decimal;"><li>Then you can log in <p>After compiling the image, the following message will be displayed</p><ol style="list-style-type: lower-alpha;"><li>The storage path of the compiled image</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Done building [ '''output/images/orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop/orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop.img''' ]|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Compilation time</li>{| class="wikitable" style="width:800px;" |-| '''[ o.k. ] Runtime [ 19 min ]'''|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>Repeat the command to compile the image. Use the following command to start compiling the android system image directly without selecting it through adb shell on Ubuntu PCthe graphical interface.</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=image RELEASE=bullseye BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_CONFIGURE=yes''' ]|}</ol></li></ol><span id="instructions-for-using-the-orange-pi-os-arch-system"></span>
test@test:~$ = '''adb shellInstructions for using the Orange Pi OS Arch system'''=
apollo<span id="orange-p2:pi-os-arch-system-function-adaptation-status"></ #span>== Orange Pi OS Arch system function adaptation status ==
<span id{| class="wikitable" style="usewidth:800px;text-align: center;"|-| '''Motherboard functions'''| '''OPi OS Arch'''|-| '''HDMI video'''| '''OK'''|-| '''HDMI Audio'''| '''OK'''|-| '''Type-C USB2.0 x 2'''| '''OK'''|-| '''TF Card Startup'''| '''OK'''|-| '''WIFI'''| '''OK'''|-| '''Bluetooth'''| '''OK'''|-| '''LED Light'''| '''OK'''|-| '''40pin GPIO'''| '''OK'''|-data| '''40pin I2C'''| '''OK'''|-cable| '''40pin SPI'''| '''OK'''|-to| '''40pin UART'''| '''OK'''|-connect| '''40pin PWM'''| '''OK'''|-adb| '''Temperature Sensor'''| '''OK'''|-debugging| '''Hardware watchdog'''| '''OK'''|-| '''Mali GPU'''| '''<span style="color:#FF0000">NO</span>'''=== Use data cable to connect adb debugging ===|-| '''Video codec'''| '''<span style="color:# 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 computerFF0000">NO</span>''s USB interface, so please ensure that the computer's USB interface can provide the most sufficient power to drive the development board. [[File:zero2w-img304.png]] [[File:zero2w-img305.png]]|}
<ol start{| class="2wikitable" style="listwidth:800px;text-style-typealign: decimalcenter;"><li>Install adb tool on Ubuntu PC</li></ol>|-| '''24pin expansion board function'''| '''OPi OS Arch'''|-| '''100M network port'''| '''OK'''|-| '''100M Ethernet port light'''| '''OK'''|-| '''USB2.0 HOST x 2'''test@test:~$ | '''OK'''sudo apt|-get update| '''Infrared reception'''| '''OK'''|-test@test:~$ | '''Headphone audio playback'''| '''OK'''sudo apt|-get install | '''On/off button'''| '''OK'''|-y adb| '''LRADC''' '''Custom buttons x 2'''| '''OK'''|-| '''TV-OUT'''| '''<ol start="3" span style="list-style-typecolor: decimal;#FF0000"><li>Check whether the ADB device is recognizedNO</lispan></ol> test@test:~$ '''adb devices'''|}
List of devices attached<span id="orange-pi-os-arch-system-user-guide-instructions"></span>
4c00146473c28651dd0 device== Orange Pi OS Arch System User Guide Instructions ==
<ol start="4" style="list-style-type: decimal;"><li>Then First of all, please note that the OPi OS Arch system does not have a default orangepi user and password, so you can cannot directly log in to remotely through the serial port and ssh after the android system through adb shell on is started after burning (not even the root user). This is different from Ubuntu PC</li></ol>and Debian systems.
test@testWhen the OPi OS Arch system is started for the first time, you need to connect an HDMI display and then initialize the system settings through the user wizard (including creating a new user name and setting a password). The setup steps of the user wizard are as follows:~$ '''adb shell'''
apollo<ol style="list-p2style-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">
<span id="view[[File:zero2w-how-to-set-hdmi-display-resolution"></span>== View how to set HDMI display resolution ==img293.png]]
<ol style="list-style-type: decimal;"><li><p>Enter first '''Settings'''</p><p>[[File:zero2w-img306.png]]</p></li><li><p>Then select '''Device Preferences'''</p><p>[[File:zero2w-img307.png]]</p></li><li><p>Then select '''Display &amp; Sound'''</p><p>[[File:zero2w-img308.png]]</p></li><li><p>Then select '''Advanced display settings'''</p><p>[[File:zero2w-img309.png]]</p></li><li><p>Then select '''HDMI output mode'''</p><p>[[File:zero2w-img310.png]]</pdiv></li><li><p>Then First you can see the list of resolutions supported by the monitor. At this time, clicking the corresponding option will switch need to select the corresponding resolution. Please note that different monitors may support different resolutions. If language you connect it to a TV, you will generally see more resolution options than the picture below.want</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></oldiv class="figure">
<span id="hdmi[[File:zero2w-to-vga-display-test-1"></span>=== HDMI to VGA display test ===img294.png]]
<ol style="list-style-type: decimal;"/div></li><li><p>First you need After selecting the language, the user wizard will immediately switch to prepare the following accessoriescorresponding language interface, as shown below in Chinese</p><ol stylediv class="list-style-type: lower-alpha;figure"><li>HDMI to VGA converter</li></ol></li></ol>
[[File:zero2w-img144img295.png]]
<ol start="2" style="list-style-type: lower-alpha;"/div></li><li>A VGA cable and a Mini HDMI male to HDMI female adapter<p>Then select the area</lip></oldiv class="figure">
[[File:zero2w-img145.png]] [[File:zero2w-img146img296.png]]
<ol start="3" style="list-style-type: lower-alpha;"/div></li><li>A monitor or TV that supports VGA interface<p>Then select the keyboard model</lip></oldiv class="figure">
<!-- [[File:zero2w--><ol start="2" style="list-style-type: decimal;"><li>HDMI to VGA display test is as follows</li></ol>img297.png]]
[[File:zero2w-img313.png]]</div></li><li><p>Then create a new username and set a password</p><div class="figure">
'''When using HDMI to VGA display, the development board and the Android system of the development board do not need to make any settings[[File:zero2w-img298. 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.'''png]]
<span id="wi-fi-connection-method"/div></li><li><p>Then make sure there is no problem with the selection, and then click the install '''button'''</spanp><div class== WI-FI connection method =="figure">
# Choose first '''Settings'''[[File:zero2w-img299.png]]
[[File:zero2w-img306.png]]</div></li><li><p>Then wait for the installation to complete</p><div class="figure">
<ol start="2" style="list[[File:zero2w-style-type: decimal;"><li>Then select '''Network &amp; Internet'''</li></ol>img300.png]]
[[File:zero2w-img314</div></li><li><p>After the installation is complete, you need to click the '''Finish''' button to restart the system.png]]</p><div class="figure">
<ol start="3" style="list-style-type: decimal;"><li>Then turn on WI-FI</li></ol> [[File:zero2w-img315.png]] <ol start="4" style="list-style-type: decimal;"><li>After turning on WI-FI, you can see the searched signals under '''Available networks'''.</li></ol> [[File:zero2w-img316img301.png]] <ol start="5" style="list-style-type: decimal;"><li>After selecting the WI-FI you want to connect to, the password input interface shown below will pop up.</li></ol>
</div></li>
<li><p>The Orange Pi Hello program will automatically start after restarting. At this time, you need to remove the check '''mark of Start on startup''' in the lower right corner, otherwise you need to manually close the Orange Pi Hello program every time you start it.</p>
<div class="figure">
[[File:zero2w-img317img302.png]]
</div>
<ol start="6" style="list-style-type: decimal;"p><li>Then At this point, you can use the keyboard to enter the newly created username and password corresponding to the WI-FI, and then use the mouse log in to click the Enter button on the virtual keyboard to start connecting to OPi OS system through the WI-FIserial port or ssh.</p></li></ol>
<div classspan id="figurehow-to-set-dt-overlays"></span>== How to set DT overlays ==
[[File:zero2wThe multiplexing functions such as I2C/SPI/UART/PWM in the 40-img318pin development board are turned off by default in the kernel's dts, and the corresponding DT overlays need to be manually turned on before they can be used.png]]
</div><ol start="7" style="list-style-type: decimal;"><li>The display after successful WI-FI connection method to open DT overlays in OPi OS Arch system is as shown below</li></ol>follows:
[[File:zero2w-img319# First open the '''/boot/extlinux/extlinux.png]]conf''' configuration file
<span id="how-to-use-wi-fi-hotspot"></span>== How to use WI-FI hotspot == # First, please make sure that the Ethernet port is connected to the network cable and can access the Internet normally.# Then select '''Settings''' [[File:zero2w-img306.png]] <ol start:{| class="3wikitable" style="list-style-typewidth: decimal800px;"><li>Then select '''Network &amp; Internet'''</li></ol> [[File:zero2w|-img314.png]]| <ol start="4" style="list-style-type: decimal;"><li>Then select '''WIFI hotspot'''</li></ol> [[File:zero2worangepi@orangepi-img320.pngpc ~]] <ol start="5" style="list-style-type: decimal;"><li>Then open '''Hotspot Enable$ '''. You can also see the name and password of the generated hotspot in the picture below. Remember them and use them when connecting to the hotspot (if you need to modify the name and password of the hotspot, you need to close Hotspot Enable first. Then you can modify it)<sudo vim /li><boot/ol> [[File:zero2w-img321.png]] <ol start="6" style="list-style-type: decimal;"><li>At this time, you can take out your mobile phone. If everything is normal, you can find the WIFI hotspot with the same name ('''here AndroidAP_7132''') shown under the '''Hotspot 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 '''Hotspot password''' in the picture above.<extlinux/li></ol> [[File:zero2w-img322.png]] <ol start="7" style="list-style-type: decimal;"><li>After the connection is successful, it will be displayed as shown below (the interface will be different on different mobile phones, the specific interface is subject to the one displayed on your mobile phone). At this time, you can open a web page on your mobile phone to see if you can access the Internetextlinux. If the web page can be opened normally, it means that the ''conf'WI-FI Hotspot''' of the development board can be used normally.</li></ol> [[File:zero2w-img323.png]] <span id="how-to-check-the-ip-address-of-the-ethernet-port"></span>== How to check the IP address of the Ethernet port == # There is no wired network interface on the main board of the development board. We can expand the 100M Ethernet through a 24pin expansion board. [[File:zero2w-img107.png]]|}
<ol start="2" style="list-style-type: decimal;">
<li><p>Then make sure open the network port of the expansion board is connected to the router or switch</p></li><li><p>Then open corresponding configuration by adding '''FDTOVERLAYS'''Settings'''</p><p>[[File:zero2w-img324.png]]<dtbs/allwinner/p><overlay/li><li><p>Then select xxx.dtbo'''Network &amp; Internetin '''</p><p>[[File:zero2w-img325.png]]<boot/p><extlinux/li><li><p>Then you can see the IP address of the development boardextlinux.conf'''s wired network port at the location shown in the picture below.</p><p>[[File:zero2w-img326.png]]</p></li></ol>
<span id{| class="wikitable" style="bluetoothbackground-connectioncolor:#ffffdc;width:800px;" |-method"| <big>'''Note that xxx.dtbo in FDTOVERLAYS /dtbs/allwinner/overlay/xxx.dtbo needs to be replaced with the specific dtbo configuration, please do not copy it.'''</spanbig>|}{| class="wikitable" style= Bluetooth connection method =="width:800px;" |-| [orangepi@orangepi-pc ~]$ '''sudo vim /boot/extlinux/extlinux.conf'''
# Choose first '''Settings'''LABEL Orange Pi
[[File:zero2w-img306.png]]KERNEL /Image
<ol start="2" style="listFDT /dtbs/allwinner/sun50i-styleh616-orangepi-type: decimal;"><li>Then select '''Bluetooth'''</li></ol> [[File:zero2w-img327.png]]dtb
'''FDTOVERLAYS /dtbs/allwinner/overlay/<span style="color:#FF0000">xxx.dtbo</span>''' #Configuration that needs to be added
|}
</ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then Open <p>The storage path of xxx.dtbo in the OPi OS Arch image is as follows. Please note that not all dtbo under this path can be used.</p>{| class="wikitable" style="width:800px;" |-| <p>'''Bluetooth Enable/boot/dtbs/allwinner/overlay/'''</p>|}</li><li><p>The DT overlays configuration that can be used by the development board is as follows</p></olli>
[[File:zero2w-img328.png]] <ol start{| class="4wikitable" style="listwidth:800px;text-style-typealign: decimalcenter;"><li>Then click |-| '''Functions on the development board'''| '''Pair new deviceCorresponding DT overlays configuration'''to start scanning for surrounding Bluetooth devices</li></ol>|-| '''40pin - i2c0'''[[File:zero2w| '''sun50i-h616-pi-img329i2c0.png]]dtbo'''|-| '''40pin - i2c1'''| '''sun50i-h616-pi-i2c1.dtbo'''<ol start="5" style="list|-style| '''40pin -type: decimal;">i2c2'''<li>The searched Bluetooth devices will be displayed under | '''Available devicessun50i-h616-pi-i2c2.dtbo'''</li></ol>|-[[File:zero2w| '''40pin - uart2'''| '''sun50i-h616-pi-img330uart2.png]]dtbo'''|-| '''40pin - uart3'''| '''sun50i-h616-pi-uart3.dtbo'''<ol start="6" style="list|-style| '''40pin -type: decimal;">uart4'''<li>Then click on the Bluetooth device you want to connect to start pairing| '''sun50i-h616-pi-uart4. When the following interface pops up, please use the mouse to select the dtbo'''|-| '''40pin - uart5'''| 'Pair''sun50i-h616-ph-uart5.dtbo'option</li></ol>''|-| '''40pin - pwm1'''[[File:zero2w| '''sun50i-h616-pi-img331pwm1.png]]dtbo'''|-| '''40pin - pwm2'''| '''sun50i-h616-pi-pwm2.dtbo'''<ol start="7" style="list|-style| '''40pin -type: decimal;">pwm3'''<li>What is tested here is the Bluetooth configuration process between the development board and the Android phone| '''sun50i-h616-pi-pwm3. At this time, the following confirmation interface will pop up on the phonedtbo'''|-| '''40pin - pwm4'''| '''sun50i-h616-pi-pwm4. Click the pairing button on the phone to start the pairing processdtbo'''|-| '''40pin - spi1 cs0'''| '''sun50i-h616-spi1-cs0-spidev.</li></ol>dtbo'''|-| '''40pin - spi1 cs1'''[[File:zero2w| '''sun50i-h616-spi1-cs1-img332spidev.png]]dtbo'''|-<ol start="8" style="list| '''40pin - spi1 cs0 cs1'''| '''sun50i-h616-spi1-cs0-cs1-stylespidev.dtbo'''|-type: decimal;"><li>After pairing is completed, open | '''设Set USB0 to Host mode'''| '''sun50i-h616-usb0-host.dtbo'''Paired devices|-| ''' and you will see Turn off the paired Bluetooth devicesgreen LED light'''| '''sun50i-h616-zero2w-disable-led.</li></ol>dtbo'''|-| '''How to close the UART0 debugging serial port'''[[File:zero2w| '''sun50i-h616-disable-img333uart0.png]]dtbo'''|}</ol><ol start="95" style="list-style-type: decimal;"><li>At this time, If you can use the Bluetooth of your mobile phone to send a picture need to open multiple configurations at the development board. After sendingsame time, you can see just add the following confirmation interface in the Android system paths of the development board, and then click multiple configurations directly after '''AcceptFDTOVERLAYS.''' to start receiving For example, the pictures sent by configuration of opening i2c1 and uart5 at the mobile phone.same time is as follows</li></ol[[File:zero2w-img334.png]] <ol start{| class="10wikitable" style="list-style-typewidth: decimal800px;"><li>Pictures received by the Bluetooth system of the development board Android system can be viewed in |-| [orangepi@orangepi-pc ~]$ '''Received filessudo vim /boot/extlinux/extlinux.conf'''.</li></ol> [[File:zero2w-img335.png]]
<span id="how-to-set-usb0-to-host-mode-1"></span>== How to set USB0 to HOST mode ==LABEL Orange Pi
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.KERNEL /Image
[[File:FDT /dtbs/allwinner/sun50i-h616-orangepi-zero2w-img160.png]]dtb
USB0 of the Android12 TV system released by Orange Pi is set to Device mode by default'''FDTOVERLAYS <span style="color:#FF0000">/dtbs/allwinner/overlay/sun50i-h616-pi-i2c1.dtbo /dtbs/allwinner/overlay/sun50i-h616-ph-uart5.dtbo</span>'''|}</ol><ol start="6" style="list-style-type: decimal;"><li>After setting, so when there is no you need to use USB0 Device mode (ADB function needs to ensure that USB0 is in Device mode), it is recommended to use USB0 restart the system for power supply, so that USB1 can be directly used the configuration to connect USB devices take effect.</li>{| class="wikitable" style="width:800px;" |-| [orangepi@orangepi-pc ~]$ '''sudo reboot'''|}</ol><span id="how-to-install-software"></span>
If you want == How to use USB0 to connect USB devices, you need to set USB0 to HOST mode. The method is as follows:install software ==
<ol style="list-style-type: lower-alpha;"><li>Run You can use the pacman package management tool to install software that is not available in OPi OS. For example, the following command to set USB0 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 HOST mode:</li></ol>install.
apollo{| class="wikitable" style="width:800px;" |-p2:/ # | [orangepi@orangepi-pc ~]$ '''cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_hostsudo pacman -Syy vim'''|}
host_chose finished!<span id="android-12-tv-system-usage-instructions"></span>
apollo-p2:/ #= '''Android 12 TV system usage instructions''' =
<ol startspan id="2" style="list-stylesupported-type: lowerandroid-alpha;versions"><li>Run the following command to switch back to Device mode</li></olspan>== Supported Android versions ==
apollo{| class="wikitable" style="width:800px;text-p2align:/ # center;"|-| Android Version| Kernel version|-| '''Android 12 TV Version'''cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_device| '''linux5.4'''|}
device_chose finished!<span id="android-12-tv-function-adaptation-status"></span>== Android 12 TV function adaptation status ==
apollo-p2:/ # <ol start{| class="3wikitable" style="list-stylewidth:800px;text-typealign: lower-alphacenter;"><li>The command to view the current mode of USB0 is</li></ol>|-| '''Motherboard functions'''| '''Android12 TV'''|-| '''HDMI video'''| '''OK'''|-| '''HDMI Audio'''| '''OK'''apollo|-p2:/ # | '''cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@Type-C USB2.0/otg_rolex 2'''| '''OK'''usb_host|-| '''TF card startup'''| '''OK'''<span id="how|-to| '''WIFI'''| '''OK'''|-use| '''Bluetooth'''| '''OK'''|-usb| '''USB Camera'''| '''OK'''|-camera"></span>== How to use USB camera ==| '''LED Light'''| '''OK'''|-| '''40pin GPIO'''| '''OK'''|-| '''40pin I2C'''| '''OK'''|-| '''40pin SPI1'''# First insert the USB (UVC protocol) camera into the USB interface of the development board| '''OK'''# If the USB camera is recognized normally, the corresponding video device node will be generated under /dev|-| '''40pin UART'''console:/ # | '''ls /dev/video0OK'''|-/dev/video0| '''40pin PWM'''| '''OK'''<ol start="3" style="list|-style| '''Temperature Sensor'''| '''OK'''|-type: decimal;"><li><p>Then make sure that the adb connection between the Ubuntu PC and the development board is normal. For how to use adb, please refer to the instructions in the section &quot;| '''How to use ADBHardware watchdog'''&quot;.</p></li><li><p>Download the USB camera test APP from the | '''official toolOK''' on the development board information download page</p></li></ol>|-<div class="figure">| '''Mali GPU'''| '''OK'''[[File:zero2w|-img336.png]]| '''Video codec'''</div>| '''OK'''<div class="figure">|}
[[File{| class="wikitable" style="width:zero2w800px;text-img337align: center;"|-| '''24pin Expansion board function'''| '''Android12 TV'''|-| '''100M network port'''| '''OK'''|-| '''100M Ethernet port light'''| '''OK'''|-| '''USB2.0 HOST x 2'''| '''OK'''|-| '''Infrared reception'''| '''OK'''|-| '''Headphone audio playback'''| '''OK'''|-| '''On/off button'''| '''OK'''|-| '''LRADC''' '''Custom buttons x 2'''| '''OK, The default setting is the volume up and down keys.png]]'''|-| '''TV-OUT'''| '''OK'''|}
</div><ol startspan id="5" style="listonboard-led-light-styledisplay-type: decimal;instructions"><li>Then use the adb command to install the USB camera test APP into the Android system. Of course, you can also use a USB disk copy to install it.</li></olspan>== Onboard LED light display instructions ==
test@test{| class="wikitable" style="width:~$ 800px;text-align: center;"|-|| '''green light'''| '''red light'''|-| '''u-boot startup phase'''| '''Off'''| '''on'''|-| '''Kernel boot to enter the system'''| '''on'''| '''adb install usbcamera.apkon'''|}
<ol startspan id="6" style="listhow-to-return-to-the-previous-interface-stylein-type: decimal;android"><li/span>After installation, you can see the startup icon of the USB camera on == How to return to the previous interface in Android desktop.</li></ol>==
[[File:zero2wWe generally use the mouse and keyboard to control the Android system of the development board. When entering certain interfaces and need to return to the previous interface or desktop, we can only return by right-img338clicking the mouse, and the keyboard cannot return.png]]
<ol start="7" style="list-style-type: decimal;"><li>Then double-click If you have purchased the infrared remote control (other remote controls do not work) and a 24pin expansion board that come with the development board, after connecting the 24pin expansion board to open the USB camera APP and development board, you can see also use the output video return key on the remote control to return to the previous menu. The location of the USB camerareturn key is as shown below.</li></ol>Shown:
<span id="android[[File:zero2w-system-root-description"></span>== Android system ROOT description ==img303.png]]
'''The Android system released by Orange Pi has been ROOT and can be tested using the following method.'''<span id="how-to-use-adb"></span>== How to use ADB ==
# Download from the '''official tool''' on the development board data download page '''rootcheck.apk'''<span id="use-network-connection-adb-debugging"></span>=== Use network connection adb debugging ===
<div {| class="figurewikitable" style="background-color:#ffffdc;width:800px;"|-| <big>'''Using network adb does not require a USB Typc C interface data cable to connect the computer and the development board. Instead, it communicates through the network, so first make sure that the development board's wired or wireless network is connected, and then obtain the IP address of the development board. Next To be used.'''</big>|}
[[File:zero2w-img336# Make sure the '''service.png]]adb.tcp.port''' of the Android system is set to 5555 port number
</div><div ::{| class="figurewikitable">style="width:800px;" |-| apollo-p2:/ # '''getprop | grep &quot;adb.tcp&quot;'''
[[File:zero2w-img339service.adb.tcp.pngport]: [5555]|}
</div>
<ol start="2" style="list-style-type: decimal;">
<li><p>Then make sure that the adb connection between the Ubuntu PC and the development board is normal. For how to use adb, please refer to the instructions in the section &quot;If '''How to use ADB'''&quot;service.</p></li><li><p>Then use the adb command to install rootcheck.apk into the Android systemtcp. Of courseport''' is not set, you can also use a USB disk copy the following command in the serial port to install it.</p>set the port number of the network adb</li><{| class="wikitable" style="width:800px;" |-| apollo-p2:/ol># '''setprop service.adb.tcp.port 5555'''
test@testapollo-p2:~$ / # '''adb install rootcheck.apkstop adbd'''
apollo-p2:/ # '''start adbd'''|}</ol><ol start="43" style="list-style-type: decimal;"><li>After installation, you can see the startup icon of the ROOT test Install adb tool on the Android desktop.Ubuntu PC</li></ol>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''sudo apt-get update'''
[[Filetest@test:zero2w~$ '''sudo apt-img340get install -y adb'''|}</ol><ol start="4" style="list-style-type: decimal;"><li>Then connect network adb on Ubuntu PC</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''adb connect 192.png]]168.1.xxx:5555''' '''(Need to be modified to the IP address of the development board)'''
<ol start="5" style="list-style-typep>* daemon not running; starting now at tcp: decimal;"><li>The display interface after opening the '''ROOT test tool''' for the first time is as shown below</li>5037</olp>
[[File:zero2w-img341.png]]<p>* daemon started successfully</p>
<ol start="6" style="list-style-type: decimal;"><li>Then you can click '''CHECK NOW''' connected to start checking the ROOT status of the Android system192. After the check is completed, the display is as follows168. You can see that the Android system has obtained ROOT permissions1.</li></ol>xxx:5555
[[File:zero2w-img342.png]]
<span id="how-to-use-miracastreceiver-to-cast-the-mobile-phone-screen-to-the-development-board"></span>== How to use MiracastReceiver to cast the mobile phone screen to the development board ==test@test:~$ '''adb devices'''
<ol style="list-style-type: decimal;"><li><p>First, please make sure that both the development board and the mobile phone are connected to the same WIFI hotspot. For the method List of connecting the development board to WIFI, please refer to '''the instructions in the WI-FI connection method.'''</p></li><li><p>Then open the '''MiracastReceiver'''application in the Android system of the development board</p><p>[[File:zero2w-img343.png]]</p></li><li><p>The interface after '''MiracastReceiver''' is opened is as follows</p><div class="figure">devices attached
[[File192.168.1.xxx:zero2w5555 device|}</ol><ol start="5" style="list-img344.png]]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:~$ '''adb shell'''
<apollo-p2:/div></li>#|}<li><p>Then find the screen mirroring function in the phone settings. Here we take '''Xiaomi 12S Pro mobile phone''' as an example. Please research other brands of mobile phones by yourself. As shown in the picture below, click the button in the red box to open the screen mirroring function of the phone.</pol><p>[[File:zero2wspan id="use-data-cable-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 '''MiracastReceiver''' application interface of the development board. Here we can select '''Accept'''</p><p>[[File:zero2wadb-img347.png]]</pdebugging"></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></olspan>
<span id="method-of-turning-on-and-off-the-machine-through-buttons-or-infrared-remote-control"></span>== Method of turning on and off the machine through buttons or infrared remote control Use data cable to connect adb debugging ===
We can turn off or turn on # 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 Android system USB0 interface of the development board through (see the description of the power picture on/off button or infrared remote controlthe right below for the location of USB0). HoweverIn this case, it should be noted that there is no power on/off button and infrared receiver on the main development board of is powered by the development boardcomputer's USB interface, and it needs so please ensure that the computer's USB interface can provide the most sufficient power to be expanded through a 24pin expansion drive the development board.
::[[File:zero2w-img304.png]] [[File:zero2w-img107img305.png]]
The location of the power button <ol start="2" style="list-style-type: decimal;"><li>Install adb tool on the 24pin expansion board is as shown in the figure belowUbuntu PC</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''sudo apt-get update'''
[[Filetest@test:zero2w~$ '''sudo apt-img269.png]]get install -y adb'''|}</ol><ol start="3" style="list-style-type: decimal;">The location of <li>Check whether the infrared remote control power button ADB device is as followsrecognized</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''adb devices'''
[[File:zero2w-img349.png]]List of devices attached
When shutting down, we need 4c00146473c28651dd0 device|}</ol><ol start="4" style="list-style-type: decimal;"><li>Then you can log in to press and hold the power button or the power button android system through adb shell 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 Ubuntu PC</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''OKadb shell''' to shut down the Android system.
[[Fileapollo-p2:zero2w/ $|}</ol><span id="view-how-to-set-hdmi-display-img350.png]]resolution"></span>
After shutting down, press and hold the power button or the power button on the infrared remote control again == View how to turn it on.set HDMI display resolution ==
<span idol style="pinlist-interfacestyle-gpiotype: decimal;"><li><p>Enter first '''Settings'''</p><p>[[File:zero2w-uartimg306.png]]</p></li><li><p>Then select '''Device Preferences'''</p><p>[[File:zero2w-spiimg307.png]]</p></li><li><p>Then select '''Display &amp; Sound'''</p><p>[[File:zero2w-img308.png]]</p></li><li><p>Then select '''Advanced display settings'''</p><p>[[File:zero2w-test"img309.png]]</p></li><li><p>Then select '''HDMI output mode'''</p><p>[[File:zero2w-img310.png]]</p></spanli>== 40pin interface GPIO<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, UARTyou 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, SPI test ==you can see the 4K resolution option.</p><p>[[File:zero2w-img312.png]]</p></li></ol>
'''Note: The pin header on the 40pin interface is not soldered by default, and you need <span id="hdmi-to solder it yourself before it can be used.'''-vga-display-test-1"></span>=== HDMI to VGA display test ===
<span idol style="pinlist-gpiostyle-porttype: decimal;"><li><p>First you need to prepare the following accessories</p><ol style="list-teststyle-methodtype: lower-alpha;"><li>HDMI to VGA converter</spanli>=== 40pin GPIO port test method ===
# First open wiringOP APP on the desktop[[File:zero2w-img144.png]]</ol><ol start="2" style="list-style-type: lower-alpha;"><li>A VGA cable and a Mini HDMI male to HDMI female adapter</li>
[[File:zero2w-img351img145.png]][[File:zero2w-img146.png]]</ol><ol start="3" style="list-style-type: lower-alpha;"><li>A monitor or TV that supports VGA interface</li></ol></li></ol>
<ol start="2" style="list-style-type: decimal;">
<li>Then click the '''GPIO_TEST''' button HDMI to open the GPIO VGA display test interfaceis as follows</li></ol>
[[File:zero2w-img352img313.png]]
<ol start{| class="3wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;">|-| <libig>The GPIO test interface is as shown in the figure below. The two rows of '''CheckBox''' buttons on the left have a one-When using HDMI to-one correspondence with VGA display, the 40pin pins. When development board and the '''CheckBox''' button is checked, Android system of the corresponding GPIO pin will be set development board do not need to '''OUT''' mode and make any settings. You only need the pin level is set to high level; when unchecked, Mini HDMI interface of the GPIO pin level will be set development board to low level; when display normally. So if there is a problem with the GPIO test, please check whether there is clicked When you click a problem with the '''GPIO READALL''' buttonHDMI to VGA converter, you can get information such as wPi number, GPIO mode, pin level, etcVGA cable and monitor.; when you click the'''BLINK ALL GPIO''' button, all GPIO ports will cycle through outputting high and low levels. This function can be used to test all the 40pin pins. GPIO port.</libig>|}</ol><span id="wi-fi-connection-method"></span> == WI-FI connection method == # Choose first '''Settings''' ::[[File:zero2w-img353img306.png]]
<ol start="42" style="list-style-type: decimal;"><li>Then click the select '''GPIO READALLNetwork &amp; Internet''' button, and the output information is as shown below:</li></ol>
[[File:zero2w-img314.png]]<div class/ol><ol start="3" style="figurelist-style-type: decimal;"><li>Then turn on WI-FI</li>
[[File:zero2w-img354img315.png]]</ol><ol start="4" style="list-style-type: decimal;"><li>After turning on WI-FI, you can see the searched signals under '''Available networks'''.</li>
[[File:zero2w-img316.png]]</divol>
<ol start="5" style="list-style-type: decimal;">
<li>There are a total of 28 GPIO ports available in After selecting the 40WI-pin development board. The following takes pin 12 - corresponding FI you want to GPIO PI01 - corresponding connect to wPi serial number 6 - as an example to demonstrate how to set the high and low levels of the GPIO port. First click the '''CheckBox''' button corresponding to pin 12. When , the button is selected, pin 12 password input interface shown below will be set to high level. After setting, you can use a multimeter to measure the value of the voltage of the pin. If it is '''3.3v''', it means the setting High level successpop up.</li> </oldiv class="figure">
[[File:zero2w-img355img317.png]]
</div></ol>
<ol start="6" style="list-style-type: decimal;">
<li>Then use the keyboard to enter the password corresponding to the WI-FI, and then use the mouse to click the '''GPIO READALL''' Enter button and you can see that on the current pin 12 mode is '''OUT''' and virtual keyboard to start connecting to the pin level is high levelWI-FI.</li> </oldiv class="figure">
[[File:zero2w-img356img318.png]]
</div></ol>
<ol start="7" style="list-style-type: decimal;">
<li>Click the '''CheckBox''' button in the picture The display after successful WI-FI connection is as shown below again to uncheck it, and pin 12 will be set to low level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is '''0v''', it means the low level setting is successful.</li> [[File:zero2w-img319.png]]</ol><span id="how-to-use-wi-fi-hotspot"></span> == How to use WI-FI hotspot ==
[[File:zero2w-img357# First, please make sure that the Ethernet port is connected to the network cable and can access the Internet normally.png]]# Then select '''Settings'''
<ol start="8" style="list::[[File:zero2w-style-type: decimal;"><li>Then click the '''GPIO READALL''' button and you can see that the current pin 12 mode is OUT and the pin level is low levelimg306.</li></ol>png]]
[[File<ol start="3" style="list-style-type:zero2w-img358.png]]decimal;"><li>Then select '''Network &amp; Internet'''</li>
[[File:zero2w-img314.png]]</ol><span idol start="pin-uart4" style="list-teststyle-methodtype: decimal;"><li>Then select '''WIFI hotspot'''</spanli>=== 40pin UART test method ===
# As [[File:zero2w-img320.png]]</ol><ol start="5" style="list-style-type: decimal;"><li>Then open '''Hotspot Enable'''. You can be seen from also see the table below, name and password of the default uarts available generated hotspot in the Android12 TV system are uart2 picture below. Remember them and uart5. Please note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial portthem 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>
{| class[[File:zero2w-img321.png]]</ol><ol start="wikitable6" 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 ('''GPIO序号here AndroidAP_7132'''| ) shown under the '''GPIOHotspot 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 '''功能Hotspot 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 '''GPIOWI-FI Hotspot'''of the development board can be used normally.</li>| '''GPIO序号'''|[[File:zero2w-img323.png]]</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. ::[[File: left;zero2w-img107.png]] <ol start="2"|| style="textlist-style-aligntype: 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 '''3.3VSettings'''</p><p>[[File:zero2w-img324.png]]</p></li>| <li><p>Then select '''1Network &amp; Internet'''</p>|<p>[[File:zero2w-img325.png]]</p></li>| '''2''<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 '''5VSettings'''| style::[[File:zero2w-img306.png]] <ol start="text-align: left;2"|| style="textlist-style-aligntype: leftdecimal;"|>|-| <li>Then select '''264Bluetooth'''</li> [[File:zero2w-img327.png]]| '''PI8'''</ol>| '''TWI1<ol start="3" style="list-style-SDA'''type: decimal;">| <li>Then Open '''3Bluetooth Enable'''</li> [[File:zero2w-img328.png]]|</ol>| '''<ol start="4'''" style="list-style-type: decimal;">| <li>Then click '''5VPair new device'''to start scanning for surrounding Bluetooth devices</li>| style[[File:zero2w-img329.png]]</ol><ol start="text-align: left;5"|| style="textlist-style-aligntype: leftdecimal;"||->| <li>The searched Bluetooth devices will be displayed under '''263Available devices'''</li> [[File:zero2w-img330.png]]| '''PI7'''</ol>| '''TWI1<ol start="6" style="list-style-SCL'''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 '''5Pair'''option</li>|| '''6'''[[File:zero2w-img331.png]]| '''GND'''</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 '''269Paired 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 '''PI13Accept'''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 '''PWM3Received 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 .| '''7'''|If you want to use USB0 to connect USB devices, you need to set USB0 to HOST mode. The method is as follows:| '''8'''| '''UART0_TX'''<ol style="list-style-type: lower-alpha;">| '''PH0'''<li>Run the following command to set USB0 to HOST mode:</li>{| '''224'''class="wikitable" style="width:800px;"
|-
| style="text-align: left;"|| style="textapollo-alignp2: left;"|| / # '''GNDcat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_host'''| '''9'''host_chose finished! apollo-p2:/ #|}| '''10'''</ol>| '''UART0_RX'''<ol start="2" style="list-style-type: lower-alpha;">| '''PH1'''<li>Run the following command to switch back to Device mode</li>{| '''225'''class="wikitable" style="width:800px;"
|-
| apollo-p2:/ # '''226cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_device'''| '''PH2'''| '''UART5_TX'''device_chose finished! | '''11'''apollo-p2:/ #|}| '''12'''</ol>| <ol start="3" style="textlist-style-aligntype: leftlower-alpha;"|>| '''PI1'''<li>The command to view the current mode of USB0 is</li>{| '''257'''class="wikitable" style="width:800px;"
|-
| '''227'''| apollo-p2:/ # '''PH3'''| '''UART5_RXcat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/otg_role'''| '''13'''|usb_host| '''14'''}| '''GND'''</ol>| style<span id="texthow-to-use-usb-align: left;camera"|></span> == How to use USB camera == # First insert the USB (UVC protocol) camera into the USB interface of the development board# If the USB camera is recognized normally, the corresponding video device node will be generated under /dev ::{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| console:/ # '''261ls /dev/video0''' /dev/video0| '''PI5'''} <ol start="3" style="list-style-type: decimal;"><li><p>Then make sure that the adb connection between the Ubuntu PC and the development board is normal. For how to use adb, please refer to the instructions in the section &quot;[[Orange Pi Zero 2W#How to use ADB| '''UART2_TXHow to use ADB''']]&quot;.</p></li>| <li><p>Download the USB camera test APP from the '''15official tool'''on the development board information download page</p></li> <div class="figure"> [[File:zero2w-img336.png]] </div><div class="figure"> [[File:zero2w-img337.png]]|| '''16'''</div></ol>| '''PWM4'''<ol start="5" style="list-style-type: decimal;">| '''PI14'''<li>Then use the adb command to install the USB camera test APP into the Android system. Of course, you can also use a USB disk copy to install it.</li>{| '''270'''class="wikitable" style="width:800px;"
|-
| test@test:~$ '''adb install usbcamera.apk'''|}</ol><ol start="6" style="textlist-alignstyle-type: leftdecimal;"|><li>After installation, you can see the startup icon of the USB camera on the Android desktop.</li> [[File:zero2w-img338.png]]</ol>| <ol start="7" style="textlist-style-aligntype: leftdecimal;"|>| '''3<li>Then double-click to open the USB camera APP and you can see the output video of the USB camera.3V'''</li></ol> <span id="android-system-root-description"></span>| '''17'''|== Android system ROOT description ==| '''18'''{| class="wikitable" style="textbackground-aligncolor:#ffffdc;width: left800px;"|| '''PH4'''| '''228'''
|-
| <big>'''231The Android system released by Orange Pi has been ROOT and can be tested using the following method.'''</big>| } # Download from the '''PH7official tool'''| on the development board data download page '''SPI1_MOSIrootcheck.apk'''| '''19'''|<div class="figure"> ::[[File:zero2w-img336.png]] </div><div class="figure"> ::[[File:zero2w-img339.png]] </div><ol start="2" style="list-style-type: decimal;"><li><p>Then make sure that the adb connection between the Ubuntu PC and the development board is normal. For how to use adb, please refer to the instructions in the section &quot;[[Orange Pi Zero 2W#How to use ADB| '''20How to use ADB''']]&quot;.</p></li>| '''GND'''<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>{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| '''232'''| test@test:~$ '''PH8adb install rootcheck.apk'''| '''SPI1_MISO'''}| '''21'''</ol>|<ol start="4" style="list-style-type: decimal;">| '''22'''<li>After installation, you can see the startup icon of the ROOT test tool on the Android desktop.</li>| '''UART2_RX'''| '''PI6'''[[File:zero2w-img340.png]]| '''262'''</ol>|<ol start="5" style="list-style-type: decimal;">| <li>The display interface after opening the '''230ROOT test tool'''for the first time is as shown below</li>| '''PH6'''| '''SPI1_CLK'''[[File:zero2w-img341.png]]| '''23'''</ol>|| '''24'''<ol start="6" style="list-style-type: decimal;">| <li>Then you can click '''SPI1_CS0CHECK 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>| '''PH5'''| '''229'''[[File:zero2w-img342.png]]|-</ol>| style<span id="texthow-to-use-miracastreceiver-to-cast-the-mobile-phone-screen-to-align: left;the-development-board"|></span> == How to use MiracastReceiver to cast the mobile phone screen to the development board == | <ol style="textlist-alignstyle-type: leftdecimal;"|><li><p>First, please make sure that both the development board and the mobile phone are connected to the same WIFI hotspot. For the method of connecting the development board to WIFI, please refer to [[Orange Pi Zero 2W#WI-FI connection method| '''GNDthe instructions in the WI-FI connection method.''']]</p></li>| <li><p>Then open the '''25MiracastReceiver'''application in the Android system of the development board</p>|<p>[[File:zero2w-img343.png]]</p></li>| <li><p>The interface after '''26MiracastReceiver'''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 '''SPI1_CS1Xiaomi 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 '''PH9MiracastReceiver'''| application interface of the development board. Here we can select '''233Accept'''</p><p>[[File:zero2w-img347.png]]</p></li>|<li><p>Then you can see the content of the mobile phone screen on the HDMI screen connected to the development board</p><p>[[File:zero2w-img348.png]]</p></li></ol> <span id="method-of-turning-on-and-off-the-machine-through-buttons-or-infrared-remote-control"></span> == Method of turning on and off the machine through buttons or infrared remote control == We can turn off or turn on the Android system of the development board through the power on/off button or infrared remote control. However, it should be noted that there is no power on/off button and infrared receiver on the main board of the development board, and it needs to be expanded through a 24pin expansion board. [[File:zero2w-img107.png]] The location of the power button on the 24pin expansion board is as shown in the figure below: [[File:zero2w-img269.png]] The location of the infrared remote control power button is as follows: [[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 '''266OK'''to shut down the Android system.| '''PI10'''| '''TWI2[[File:zero2w-SDA'''img350.png]]| '''27'''|After shutting down, press and hold the power button or the power button on the infrared remote control again to turn it on.| '''28'''| '''TWI2<span id="pin-interface-gpio-uart-spi-SCL'''test"></span>== 40pin interface GPIO, UART, SPI test ==| '''PI9'''{| '''265'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| '''256'''| ''<big>'PI0'''| style="text-alignNote: left;"|| '''29The pin header on the 40pin interface is not soldered by default, and you need to solder it yourself before it can be used.'''</big>|}| '''30'''| '''GND'''| style<span id="textpin-align: left;"|| style="textgpio-align: left;"||port-| '''271'''| '''PI15'''| style="texttest-align: left;method"|></span>| '''31'''|| '''32'''| '''PWM1'''| '''PI11'''| '''267'''|-| '''268'''| '''PI12'''| '''PWM2'''| '''33'''|| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''258'''| '''PI2'''| style="text-align: left;"|| '''35'''|| '''36'''| style40pin GPIO port test method =="text-align: left;"|| '''PC12'''| '''76'''|-| '''272'''| '''PI16'''| style="text-align: left;"|| '''37'''|# First open wiringOP APP on the desktop| '''38'''| style="text-align: left;"|| '''PI4'''| '''260'''|-| style="text-align: left;"|| style="text-align[[File: left;"|| '''GND'''| '''39'''|| '''40'''| style="textzero2w-align: left;"|| '''PI3'''| '''259'''|}img351.png]] <ol start="2" style="list-style-type: decimal;"><li>The device node corresponding to uart2 is Then click the '''/dev/ttyAS2GPIO_TEST''', and button to open the device node corresponding to uart5 is'''/dev/ttyAS5'''GPIO test interface</li></olapollo[[File:zero2w-p2:/ # ls /dev/ttyAS*img352.png]]</dev/ttyAS0 /dev/ttyAS1 '''/dev/ttyAS2 /dev/ttyAS5'''ol>
<ol start="3" style="list-style-type: decimal;">
<li>First open wiringOP APP The GPIO test interface is as shown in the figure below. The two rows of '''CheckBox''' buttons on the desktopleft have a one-to-one correspondence with the 40pin pins. When the '''CheckBox''' button is checked, the corresponding GPIO pin will be set to '''OUT''' mode and the pin level is set to high level; when unchecked, the GPIO pin level will be set to low level; when the GPIO is clicked When you click the '''GPIO READALL''' button, you can get information such as wPi number, GPIO mode, pin level, etc.; when you click the'''BLINK ALL GPIO''' button, all GPIO ports will cycle through outputting high and low levels. This function can be used to test all the 40pin pins. GPIO port.</li></ol>
[[File:zero2w-img351img353.png]]</ol><ol start="4" style="list-style-type: decimal;"><li>Then click the '''GPIO READALL''' button, and the output information is as shown below:</li>
<ol startdiv class="4figure" style="list-style-type: decimal;"><li>Then click the '''UART_TEST'''button to open the UART test interface</li></ol>
[[File:zero2w-img359img354.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 test interface . First click the '''CheckBox''' button corresponding to pin 12. When the button is selected, pin 12 will be set to high level. After setting, you can use a multimeter to measure the value of the voltage of wiringOP the pin. If it is as shown in '''3.3v''', it means the figure belowsetting High level success.</li></ol> [[File:zero2w-img360.png]]
[[File:zero2w-img355.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 '''OPENGPIO READALL''' button to open the uart node. After and you can see that the opening current pin 12 mode is successful, the '''OPENOUT''' button becomes unselectable, and the '''CLOSE''' button and '''SEND''' button become selectablepin level is high level.</p></li></ol>
[[File:zero2w-img362img356.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 12 will be set to low level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is '''0v''', it means the low level setting is successful.</li>
[[File:zero2w-img357.png]]
</ol>
<ol start="8" style="list-style-type: decimal;">
<li><p>Then use Dupont wire to short the rx and tx pins of uart</p></li><li><p>Then you can enter a paragraph of characters in the send edit box below and click the '''SENDGPIO READALL''' button to start sendingand you can see that the current pin 12 mode is OUT and the pin level is low level.</p></li></ol>
[[File:zero2w-img363img358.png]]</ol><span id="pin-uart-test-method"></span>
<ol start="10" style="list-style-type: decimal;"><li>If everything is normal, the received string will be displayed in the receiving box</li></ol>= 40pin UART test method ===
[[File:zero2w-img364# 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.png]]
<span iddiv style="pin-spi-test-methoddisplay: flex;"></span>=== 40pin SPI test method === # As can be seen from the table below, the spi available for the 40pin interface is spi1, and there are two chip select pins cs0 and cs1 ::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO serial numberNO.'''
| '''GPIO'''
| '''Function'''
| '''pin'''|| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO serial numberPin'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|
| '''2'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''264'''
| '''TWI1-SDA'''
| '''3'''
|
| '''4'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''263'''
| '''TWI1-SCL'''
| '''5'''
|
| '''6'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''269'''
| '''PWM3'''
| '''7'''
|
| '''8'''
| '''UART0_TX'''
| '''PH0'''
| '''224'''
|-
| style="text-align: left;"|
| '''GND'''
| '''9'''
|
| '''10'''
| '''UART0_RX'''
| '''PH1'''
| '''225'''
|-
| '''<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>'''|-| '''12'''| <span style="text-aligncolor: left;#FF0000"|| '''PI1'''| '''257'''|-| '''>227</span>'''| '''<span style="color:#FF0000">PH3</span>'''| '''<span style="color:#FF0000">UART5_RX</span>'''| '''<span style="color:#FF0000">13</span>'''|-| '''14'''| '''GND'''| <span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"||-| '''>261</span>'''| '''<span style="color:#FF0000">PI5</span>'''| '''<span style="color:#FF0000">UART2_TX</span>'''| '''<span style="color:#FF0000">15'''|| '''16'''| '''PWM4'''| '''PI14'''| '''270</span>'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|
| '''18'''
| style="text-align: left;"|
| '''PH4'''
| '''228'''
|-
| '''231'''
| '''SPI1_MOSI'''
| '''19'''
|
| '''20'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''232'''
| '''SPI1_MISO'''
| '''21'''
|
| '''22'''
| '''UART2_RX'''
| '''PI6'''
| '''262'''
|-
| '''230'''
| '''SPI1_CLK'''
| '''23'''
|
| '''24'''
| '''SPI1_CS0'''
| '''PH5'''
| '''229'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|
| '''26'''
| '''SPI1_CS1'''
| '''PH9'''
| '''233'''
|-
| '''266'''
| '''TWI2-SDA'''
| '''27'''
|
| '''28'''
| '''TWI2-SCL'''
| '''PI9'''
| '''265'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|
| '''30'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|| '''32'''| '''PWM1'''| '''PI11'''| '''267'''|-
| '''268'''
| '''PI12'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|-| '''36272'''| '''PI16'''| style="text-align: left;"|| '''37'''|-| style="text-align: left;"|
| style="text-align: left;"|
| '''PC12GND'''| '''7639'''
|}
 <ol start="2" style="list-style-type: decimal;"><li>The device node corresponding to SPI1 CS0 is '''/dev/spidev1.0''', and the device node corresponding to SPI1 CS1 is '''/dev/spidev1.1'''</li></ol> apollo-p2:/ # '''ls /dev/spidev1.*''' '''/dev/spidev1.0 /dev/spidev1.1''' <ol start="3" style="list-style-type: decimal;"><li>Here is a demonstration to test the SPI1 interface through the '''w25qxx''' module. First, connect the w25qxx module to the SPI1 interface.</li></ol> '''It doesn't matter if there is no w25qxx module, because there is a SPIFlash on the development board connected to SPI0, and the configuration of SPI0 is also turned on by default in Android, so we can also directly use the onboard SPIFlash for testing.''' <ol start="4" style="list-style-type: decimal;"><li>Then open wiringOP APP on the desktop</li></ol> [[File:zero2w-img351.png]] <ol start="5" style="list-style-type: decimal;"><li>Then click the '''SPI_TEST''' button to open the SPI test interface</li></ol> [[File:zero2w-img365.png]] <ol start="6" style="list-style-type: decimal;"><li><p>Then select the spi device node in the upper left corner. If you test the onboard SPIFlash directly, just keep the default '''/dev/spidev0.0'''. If the '''w25qxx''' module is connected to the 40pin spi1 cs0, then please select'''/dev/spidev1.0''', if the w25qxx module is connected to the 40pin spi1 cs1, then please select '''/dev/spidev1.1'''</p><div {| class="figure"> [[File:zero2w-img366.png]] </div></li><li><p>Then click the '''OPEN''' button to initialize the SPI</p></li></ol> [[File:zero2w-img367.png]] <ol start="8wikitable" style="list-style-typewidth: decimal390px;"><li>Then fill in the bytes that need to be sent, such as reading the ID information of the onboard SPIFlash, filling in the address 0x9f in data[0], and then click the '''TRANSFER''' button</li></ol> [[File:zero2w-img368.png]] <ol start="9" style="listmargin-style-typeright: decimal20px;"><li>Finally, the APP will display the read ID information of the onboard SPI Flash.</li></ol> [[File:zero2wtext-img369.png]] <ol start="10" style="list-style-typealign: decimalcenter;"><li>If the w25qxx module connected to 40pin SPI1 is read, the ID information of the onboard SPI Flash is also similar.</li></ol> <span id="pin-i2c-test-method"></span>=== 40pin I2C test method === # As can be seen from the table below, the Android12 TV system has i2c1 and i2c2 turned on by default. {| class="wikitable"|-| '''GPIO serial number'''| '''GPIO'''| '''Function'''| '''pin'''|| '''pinPin'''| '''Function'''| '''GPIO'''| '''GPIO serial numberNO.'''|-| 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;"|| style="text-align: left;"||-| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|| '''6'''| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''269'''
| '''PI13'''
| '''PWM3'''
| '''7'''
|
| '''8'''
| '''UART0_TX'''
| '''224'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''9'''|| '''10'''
| '''UART0_RX'''
| '''PH1'''
| '''225'''
|-
| '''226'''
| '''PH2'''
| '''UART5_TX'''
| '''11'''
|
| '''12'''
| style="text-align: left;"|
| '''257'''
|-
| '''227'''
| '''PH3'''
| '''UART5_RX'''
| '''13'''
|
| '''14'''
| '''GND'''
| style="text-align: left;"|
|-
| '''261'''
| '''PI5'''
| '''UART2_TX'''
| '''15'''
|
| '''16'''
| '''PWM4'''
| '''270'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|
| '''18'''
| style="text-align: left;"|
| '''228'''
|-
| '''231'''
| '''PH7'''
| '''SPI1_MOSI'''
| '''19'''
|
| '''20'''
| '''GND'''
| style="text-align: left;"|
|-
| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''<span style="color:#FF0000">22</span>'''| '''<span style="color:#FF0000">UART2_RX</span>'''| '''<span style="color:#FF0000">PI6</span>'''| '''<span style="color:#FF0000">262</span>'''
|-
| '''230'''
| '''PH6'''
| '''SPI1_CLK'''
| '''23'''
|
| '''24'''
| '''SPI1_CS0'''
| '''229'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''25'''
|
| '''26'''
| '''SPI1_CS1'''
| '''233'''
|-
| '''266'''
| '''PI10'''
| '''TWI2-SDA'''
| '''27'''
|
| '''28'''
| '''TWI2-SCL'''
| '''265'''
|-
| '''256'''
| '''PI0'''
| style="text-align: left;"|
| '''29'''
|
| '''30'''
| '''GND'''
| style="text-align: left;"|
|-
| '''271'''| '''PI15'''| style="text-align: left;"|| '''31'''|| '''32'''
| '''PWM1'''
| '''PI11'''
| '''267'''
|-
| '''268'''
| '''PI12'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
|-
| '''258'''
| '''PI2'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''76'''
|-
| '''272'''
| '''PI16'''
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''260'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''39'''
|
| '''40'''
| style="text-align: left;"|
| '''259'''
|}
</div>
<ol start="2" style="list-style-type: decimal;">
<li>The device node corresponding to i2c1 uart2 is '''/dev/i2c-1ttyAS2''', and the device node corresponding to i2c2 uart5 is '''/dev/i2c-2ttyAS5'''</li>{| class="wikitable" style="width:800px;" |-| </olp> apollo-p2:/ # '''ls /dev/i2c-ttyAS*'''</p><p>/dev/ttyAS0 &nbsp;&nbsp;&nbsp;&nbsp; /dev/ttyAS1 &nbsp;&nbsp;&nbsp;&nbsp; '''<span style="color:#FF0000">/dev/i2c-1 ttyAS2 &nbsp;&nbsp;&nbsp;&nbsp; /dev/i2c-2ttyAS5</span>''' </devp>|}</i2c-5ol>
<ol start="3" style="list-style-type: decimal;">
<li>First open wiringOP APP on the desktop</li></ol>
[[File:zero2w-img351.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then click the '''I2C_TESTUART_TEST''' button to open the i2c UART test interface</li></ol> [[File:zero2w-img370.png]]
[[File:zero2w-img359.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>The i2c serial port test interface of wiringOP is as shown in the figure below</li></ol>
[[File:zero2w-img371img360.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="68" style="list-style-type: decimal;"><li><p>Then click use Dupont wire to short the device node selection box rx and tx pins of uart</p></li><li><p>Then you can enter a paragraph of characters in the upper left corner to select send edit box below and click the i2c you want '''SEND''' button to teststart sending.</lip></olli>
[[File:zero2w-img372img363.png]]</ol><ol start="10" style="list-style-type: decimal;"><li>If everything is normal, the received string will be displayed in the receiving box</li>
[[File:zero2w-img364.png]]</ol start><span id="7" style="listpin-spi-styletest-type: decimal;method"><li>Then connect an i2c device to the 40pin i2c pin. Here we take the ds1307 rtc module as an example.</li></olspan>
[[File:zero2w-img178.png]]=== 40pin SPI test method ===
<ol start="8" style="list-style-type: decimal;"><li><p>The i2c address of the ds1307 rtc module is 0x68. After connecting the lines, we can use the '''i2cdetect -y 1''' or '''i2cdetect -y 2''' command on the serial port command line to check whether the i2c address of the ds1307 rtc module # As can be scanned. If you can see seen from the address 0x68table below, it means that the ds1307 rtc module spi available for the 40pin interface is wired correctly.</p><p>apollo-p2:/ # '''i2cdetect -y 1'''</p><p>'''Or'''</p><p>apollo-p2:/ # '''i2cdetect -y 2'''</p><p>[[File:zero2w-img373.png]]</p></li><li><p>Then set the i2c address to 0x68 in wiringOPspi1, and then click the '''OPEN''' button to open i2c</p><p>[[File:zero2w-img374.png]]</p></li><li><p>After clicking the '''OPEN''' button to open i2c, the display is as follows</p><p>[[File:zero2w-img375.png]]</p></li><li><p>Then we test writing a value to the register of the rtc module, for example, writing 0x55 to the 0x1c address</p><ol style="list-style-type: lower-alpha;"><li><p>We first set the address of the register to be written to 0x1c</p><p>[[File:zero2w-img376.png]]</p></li><li><p>Then set the value to be written to 0x55</p><p>[[File:zero2w-img377.png]]</p></li><li><p>Then click the '''WRITE BYTE''' button to perform the writing action</p><p>[[File:zero2w-img378.png]]</p></li></ol></li><li><p>Then click the '''READ BYTE''' button to read the value of the 0x1c register. If it displays 0x55, it means that the i2c read there are two chip select pins cs0 and write test has passed.</p><p>[[File:zero2w-img379.png]]</p></li></ol>cs1
<span iddiv style="pin-pwm-testdisplay: flex;"></span>=== 40pin PWM test === # As can be seen from the table below, the available pwm are pwm1, pwm2, pwm3 and pwm4. ::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO serial numberNO.'''
| '''GPIO'''
| '''Function'''
| '''pin'''|| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO serial numberPin'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|
| '''2'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''264'''
| '''TWI1-SDA'''
| '''3'''
|
| '''4'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''263'''
| '''TWI1-SCL'''
| '''5'''
|
| '''6'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''269'''
| '''PWM3'''
| '''7'''
|
| '''8'''
| '''UART0_TX'''
| '''PH0'''
| '''224'''
|-
| style="text-align: left;"|
| '''GND'''
| '''9'''
|
| '''10'''
| '''UART0_RX'''
| '''PH1'''
| '''225'''
|-
| '''226'''
| '''UART5_TX'''
| '''11'''
|
| '''12'''
| style="text-align: left;"|
| '''PI1'''
| '''257'''
|-
| '''227'''
| '''UART5_RX'''
| '''13'''
|
| '''14'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''261'''
| '''UART2_TX'''
| '''15'''
|
| '''16'''
| '''PWM4'''
| '''PI14'''
| '''270'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|
| '''18'''
| style="text-align: left;"|
| '''PH4'''
| '''228'''
|-
| '''231'''
| '''SPI1_MOSI'''
| '''19'''
|
| '''20'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''232'''
| '''SPI1_MISO'''
| '''21'''
|
| '''22'''
| '''UART2_RX'''
| '''PI6'''
| '''262'''
|-
| '''230'''
| '''SPI1_CLK'''
| '''23'''
|
| '''24'''
| '''SPI1_CS0'''
| '''PH5'''
| '''229'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|
| '''26'''
| '''SPI1_CS1'''
| '''PH9'''
| '''233'''
|-
| '''266'''
| '''TWI2-SDA'''
| '''27'''
|
| '''28'''
| '''TWI2-SCL'''
| '''PI9'''
| '''265'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|
| '''30'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|
| '''32'''
| '''PWM1'''
| '''PI11'''
| '''267'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|}{| '''36'''| class="wikitable" style="width:390px;margin-right: 20px;text-align: leftcenter;"|| '''PC12'''| '''76'''
|-
| '''272Pin'''| '''PI16Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''4'''| '''5V'''
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| '''6'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''8'''
| '''UART0_TX'''
| '''PH0'''
| '''224'''
|-
| '''10'''
| '''UART0_RX'''
| '''PH1'''
| '''225'''
|-
| '''12'''
| style="text-align: left;"|
| '''PI1'''
| '''257'''
|-
| '''14'''
| '''GND'''
| '''39'''
|
| '''40'''
| style="text-align: left;"|
| style="text-align: left;"||-| '''16'''| '''PWM4'''| ''PI3'PI14'''| '''259270'''|}-| '''18'''<ol start="2" | style="list-styletext-typealign: decimalleft;">|<li>First click the wiringOP icon to open wiringOP APP</li></ol>| '''PH4'''| '''228'''[[File:zero2w|-img351.png]]| '''20'''| '''GND'''<ol start| style="3text-align: left;" || style="list-styletext-typealign: decimalleft;">||-| '''22'''| '''UART2_RX'''| '''PI6'''| '''262'''|-| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''28'''| '''TWI2-SCL'''<li>Then click the | '''PWM_TESTPI9''' button on the main interface of wiringOP to enter the PWM test interface</li></ol>| '''265'''[[File:zero2w|-img380.png]]| '''30'''| '''GND'''<ol start| style="4text-align: left;" || style="list-styletext-typealign: decimalleft;">||-<li>The PWM test interface is as follows</li></ol>| '''32'''| '''PWM1'''<div class="figure">| '''PI11'''| '''267'''[[File:zero2w|-img381.png]]| '''34'''</div>| '''GND'''<ol start| style="5text-align: left;" || style="listtext-align: left;"||-| '''36'''| style="text-typealign: decimalleft;">|| '''PC12'''| '''76'''|}<li>Then set which PWM you want to use in the Channel. The default is PWM1. If you want to set it to PWM2, just enter 2 in the Channel. PWM3 and PWM4 and so on.</li></oldiv[[File:zero2w-img382.png]]
<ol start="62" style="list-style-type: decimal;"><li>Then you can set the PWM period. The default configuration device node corresponding to SPI1 CS0 is '''50000ns/dev/spidev1.0'''. The converted PWM frequency , and the device node corresponding to SPI1 CS1 is '''20KHz/dev/spidev1.1'''</li><{| class="wikitable" style="width:800px;" |-| apollo-p2:/ # '''ls /dev/ol>spidev1.*'''
'''<span style="color:#FF0000">/dev/spidev1.0 &nbsp;&nbsp;&nbsp;&nbsp; /dev/spidev1.1</span>'''|}</ol><ol start="3" style="list-style-type: decimal;"><li>Here is a demonstration to test the SPI1 interface through the '''w25qxx''' module. First, connect the w25qxx module to the SPI1 interface.</li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''It doesn't matter if there is no w25qxx module, because there is a SPIFlash on the development board connected to SPI0, and the configuration of SPI0 is also turned on by default in Android, so we can also directly use the onboard SPIFlash for testing.'''</big>|}</ol><ol start="4" style="list-style-type: decimal;"><li>Then open wiringOP APP on the desktop</li> [[File:zero2w-img383img351.png]]</ol><ol start="5" style="list-style-type: decimal;"><li>Then click the '''SPI_TEST''' button to open the SPI test interface</li> [[File:zero2w-img365.png]]</ol><ol start="6" style="list-style-type: decimal;"><li><p>Then select the spi device node in the upper left corner. If you test the onboard SPIFlash directly, just keep the default '''/dev/spidev0.0'''. If the '''w25qxx''' module is connected to the 40pin spi1 cs0, then please select'''/dev/spidev1.0''', if the w25qxx module is connected to the 40pin spi1 cs1, then please select '''/dev/spidev1.1'''</p><div class="figure">
<ol start="7" style="list[[File:zero2w-style-type: decimal;"><li>Then click the '''EXPORT'''button to export PWM</li></ol>img366.png]]
[[File:zero2w-img384.png]]</div></li><li><p>Then click the '''OPEN''' button to initialize the SPI</p></li>
[[File:zero2w-img367.png]]
</ol>
<ol start="8" style="list-style-type: decimal;">
<li>Then drag fill in the progress bar below bytes that need to change be sent, such as reading the ID information of the onboard SPIFlash, filling in the PWM duty cycleaddress 0x9f in data[0], and then check click the '''EnableTRANSFER''' to output the PWM waveform.button</li></ol> [[File:zero2w-img385.png]]
[[File:zero2w-img368.png]]
</ol>
<ol start="9" style="list-style-type: decimal;">
<li>Then use an oscilloscope to measure Finally, the corresponding pins in APP will display the 40pin development board and you can see read ID information of the following waveformonboard SPI Flash.</li></ol>
[[File:zero2w-img386img369.png]]</ol><ol start="10" style="list-style-type: decimal;"><li>If the w25qxx module connected to 40pin SPI1 is read, the ID information of the onboard SPI Flash is also similar.</li></ol>
<span id="howpin-toi2c-compiletest-android-12-source-codemethod"></span>
= '''How to compile Android 12 source code''' == 40pin I2C test method ===
<span id="download-# As can be seen from the-source-code-of-android-12"></span>== Download table below, the source code of Android 12 ==Android12 TV system has i2c1 and i2c2 turned on by default.
<ol div style="listdisplay: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''GPIO NO.'''| '''GPIO'''| '''Function'''| '''Pin'''|-| style="text-typealign: decimalleft;">|| style="text-align: left;"|| '''3.3V'''| '''1'''|-| '''<li><pspan style="color:#FF0000">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 Drive264</pspan>'''| '''<ol span style="list-style-typecolor: lower-alpha;#FF0000">PI8<li/span>Google Cloud Drive'''| '''</lispan style="color:#FF0000">TWI1-SDA</olspan>'''| '''</lispan style="color:#FF0000">3</olspan>''' [[File:zero2w|-img387.png]] | '''<ol startspan style="2color:#FF0000" >263</span>'''| '''<span style="list-style-typecolor: decimal;#FF0000">PI7<li/span>After downloading the compressed package of Android 12 source code, please check whether the MD5 checksum is correct. If it is incorrect, please download the source code again. Here's how to check the MD5 checksum''| '''<span style="color:#FF0000">TWI1-SCL</lispan>'''| '''<span style="color:#FF0000">5</olspan>'''|-test@test:~$ | '''md5sum -c H618-Android12-Src.tar.gz.md5sum269'''| '''PI13'''H618-Android12-Src.tar.gzaa: | '''OKPWM3''' H618-Android12-Src.tar.gzab: | '''OK7'''|-...... <ol start| style="3text-align: left;" || style="list-styletext-typealign: decimalleft;">|| '''GND'''| '''9'''|-| '''226'''<li>Then you need to merge multiple compressed files into one, and then extract the Android source code. The command looks like this:</li></ol>| '''PH2'''| '''UART5_TX'''test@test:~$ | '''11'''cat H618|-Android12| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-Src.tar.gza* &gt; H618-Android12-Src.tar.gz| '''261'''| '''PI5'''| '''UART2_TX'''test@test:~$ | '''tar -xvf H618-Android12-Src.tar.gz15'''|-<ol start| style="4text-align: left;" || style="listtext-style-typealign: decimalleft;">|| '''3.3V'''| '''17'''|-| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''<li>Then unzip the compressed package of the files modified by Orange Pi Zero2w</li></ol>| '''PH8'''| '''SPI1_MISO'''test@test:~$ | '''tar zxf opizero2w_android12_patches.tar.gz21'''|-test@test:~$ | '''230'''| '''lsPH6'''| '''SPI1_CLK'''| '''opizero2w_android12_patches23''' opizero2w_android12_patches.tar.gz|-<ol start| style="5text-align: left;" || style="list-styletext-typealign: decimalleft;">|| '''GND'''| '''25'''|-| '''<lispan style="color:#FF0000">Then copy the files modified by Orange Pi Zero2w to the Android source code266</lispan>'''| '''<span style="color:#FF0000">PI10</olspan>''' test@test:~$ | '''cp <span style="color:#FF0000">TWI2-rf opizero2w_android12_patches/* H618-Android12-SrcSDA</span>''' | '''<span idstyle="compile-the-source-code-of-android-12color:#FF0000">27</span>'''== Compile the source code of Android 12 ==|-| '''256'''| '''PI0''Android12 is compiled on an x86_64 computer with Ubuntu 22.04 installed. Other versions of Ubuntu system package dependencies may have some differences. The image download address of the Ubuntu 22.04 amd64 version is as follows'| style="text-align:left;"|| '''29'''|-[https://repo.huaweicloud.com/ubuntu-releases/22.04/ubuntu-22.04.2-desktop-amd64.iso | '''271'''| '''https://repo.huaweicloud.com/ubuntu-releases/22.04/ubuntu-22.04.2-desktop-amd64.isoPI15''']| style="text-align: left;"|| '''The x86_64 computer hardware configuration for compiling Android12 source code recommends a memory of 16GB or more, and a hard disk space of 200GB or more is recommended. The more CPU cores, the better.31'''|-# First install the software packages needed to compile Android12 source code| '''268'''| '''PI12'''test@test:~$ | '''sudo apt-get updatePWM2''' test@test:~$ | '''sudo apt-get install -y git gnupg flex bison gperf build-essential \33'''|-| '''zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \258''' | '''lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev ccache \PI2'''| style="text-align: left;"|| '''libgl1-mesa-dev libxml2-utils xsltproc unzip u-boot-tools python-is-python3 \35'''|-| '''libssl-dev libncurses5 clang gawk272'''| '''PI16'''<ol start="2" | style="list-styletext-typealign: decimalleft;">|| '''37'''<li><p>Then compile the code in the longan folder, which mainly contains u|-boot and linux kernel</p><ol | style="listtext-align: left;"|| style="text-typealign: lower-alphaleft;">|<li>First run | '''./build.sh configGND''' to set compilation options</li></ol></li></ol> test@test:~$ | '''cd H618-Android12-Src/longan39'''|}test@test{| class="wikitable" style="width:~/H618390px;margin-Android12right: 20px;text-Src/longan$ align: center;"|-| '''./build.sh configPin'''| '''Function'''Welcome to mkscript setup progress| '''GPIO'''| '''GPIO NO.'''All available platform:|-| '''2'''0. android| '''5V'''| style="text-align: left;"|1. linux| style="text-align: left;"||-Choice [android]: | '''04'''| '''5V'''All available ic| style="text-align:left;"|| style="text-align: left;"|0. h618|-| '''6'''Choice [h618]: | '''0GND'''| style="text-align: left;"|All available board| style="text-align:left;"||-0. ft| '''8'''| '''UART0_TX'''1. p1| '''PH0'''| '''224'''2. p2|-| '''10'''3. p7| '''UART0_RX'''| '''PH1'''4. p7l| '''225'''|-5. perf1| '''12'''| style="text-align: left;"|6. perf2| '''PI1'''| '''257'''7. perf3 8. qa|-| '''14'''Choice [p2]: | '''2GND'''| style="text-align: left;"|All available flash| style="text-align:left;"||-0. default| '''16'''| '''PWM4'''| '''PI14'''1. nor| '''270'''|-Choice [default]: | '''018''' All available kern_ver| style="text-align:left;"|| '''PH4'''0. linux| '''228'''|-5.4| '''20'''Choice [linux-5.4]: | '''0GND'''| style="text-align: left;"|All available arch| style="text-align:left;"||-0. arm| '''22'''| '''UART2_RX'''1. arm64| '''PI6'''Choice [arm64]: | '''1262'''|-| '''......24'''| '''SPI1_CS0'''*** Default configuration is based on | '''PH5''sun50iw9p1smp_h618_android_defconfig'| '''229'''#|-| '''26'''# configuration written to .config| '''SPI1_CS1'''| '''PH9'''#| '''233'''|-make[1]| '''<span style="color: Leaving directory #FF0000">28</span>''/home/test/H618'| '''<span style="color:#FF0000">TWI2-Android12-SrcSCL</longanspan>'''| '''<span style="color:#FF0000">PI9</outspan>'''| '''<span style="color:#FF0000">265</kernel/buildspan>'''|-| '''30'''make: Leaving directory | '''GND'''/home/test/H618| style="text-Android12align: left;"|| style="text-Src/longan/kernel/linuxalign: left;"||-5.4| '''32'''| '''PWM1'''| '''PI11'''INFO: clean buildserver| '''267'''|-INFO: prepare_buildserver| '''34'''| '''GND'''<ol start| style="2text-align: left;" || style="listtext-align: left;"||-| '''36'''| style="text-typealign: lower-alphaleft;">|<li>Then run the | '''./build.shPC12''' script to start compilation.</li></ol>| '''76'''test@test:~/H618|-Android12-Src/longan$ | '''./build.sh38''' <ol start| style="3text-align: left;" || '''PI4'''| '''260'''|-| '''40'''| style="list-styletext-typealign: lower-alphaleft;">|| '''PI3'''| '''259'''|}<li>After compilation is completed, you will see the following output</li></oldivsun50iw9p1 compile Kernel successful INFO: Prepare toolchain ...
<ol start="2" style="list-style-type: decimal;"><li>The device node corresponding to i2c1 is '''....../dev/i2c-1''', and the device node corresponding to i2c2 is '''/dev/i2c-2'''</li>{| class="wikitable" style="width:800px;" |-| apollo-p2:/ # '''ls /dev/i2c-*'''
INFO'''<span style="color: build kernel OK.#FF0000">/dev/i2c-1 &nbsp;&nbsp;&nbsp;&nbsp; /dev/i2c-2</span>''' &nbsp;&nbsp;&nbsp;&nbsp; /dev/i2c-5|}</ol><ol start="3" style="list-style-type: decimal;"><li>First open wiringOP APP on the desktop</li>
INFO[[File: build rootfs ..zero2w-img351.png]]</ol><ol start="4" style="list-style-type: decimal;"><li>Then click the '''I2C_TEST''' button to open the i2c test interface</li>
INFO[[File: skip make rootfs for androidzero2w-img370.png]]</ol><ol start="5" style="list-style-type: decimal;"><li>The i2c test interface of wiringOP is shown in the figure below</li>
[[File:zero2w-img371.png]]</ol><ol start="6" style="list-style-type: decimal;"><li>Then click the device node selection box in the upper left corner to select the i2c you want to test</li> [[File:zero2w-img372.png]]</ol><ol start="7" style="list-style-type: decimal;"><li>Then connect an i2c device to the 40pin i2c pin. Here we take the ds1307 rtc module as an example.</li> [[File:zero2w-img178.png]]</ol><ol start="8" style="list-style-type: decimal;"><li><p>The i2c address of the ds1307 rtc module is 0x68. After connecting the lines, we can use the '''i2cdetect -y 1''' or '''i2cdetect -y 2''' command on the serial port command line to check whether the i2c address of the ds1307 rtc module can be scanned. If you can see the address 0x68, it means that the ds1307 rtc module is wired correctly.</p>{| class="wikitable" style="width:800px;" |-| <p>apollo-p2:/ # '''i2cdetect -y 1'''</p><p>'''Or'''</p><p>apollo-p2:/ # '''i2cdetect -y 2'''</p>|}<p>[[File:zero2w-img373.png]]</p></li><li><p>Then set the i2c address to 0x68 in wiringOP, and then click the '''OPEN''' button to open i2c</p><p>[[File:zero2w-img374.png]]</p></li><li><p>After clicking the '''OPEN''' button to open i2c, the display is as follows</p><p>[[File:zero2w-img375.png]]</p></li><li><p>Then we test writing a value to the register of the rtc module, for example, writing 0x55 to the 0x1c address</p><ol style="list-style-type: lower-alpha;"><li><p>We first set the address of the register to be written to 0x1c</p><p>[[File:zero2w-img376.png]]</p></li><li><p>Then set the value to be written to 0x55</p><p>[[File:zero2w-img377.png]]</p></li><li><p>Then click the '''WRITE BYTE''' button to perform the writing action</p><p>[[File:zero2w-img378.png]]</p></li></ol></li><li><p>Then click the '''READ BYTE''' button to read the value of the 0x1c register. If it displays 0x55, it means that the i2c read and write test has passed.</p><p>[[File:zero2w-img379.png]]</p></li></ol> <span id="pin-pwm-test"></span> === 40pin PWM test === # As can be seen from the table below, the available pwm are pwm1, pwm2, pwm3 and pwm4. <div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''GPIO NO.'''| '''GPIO'''| '''Function'''| '''Pin'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''1'''|-| '''264'''| '''PI8'''| '''TWI1-SDA'''| '''3'''|-| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|-| '''<span style="color:#FF0000">269</span>'''| '''<span style="color:#FF0000">PI13</span>'''| '''<span style="color:#FF0000">PWM3</span>'''| '''<span style="color:#FF0000">7</span>'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''9'''|-| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-| '''261'''| '''PI5'''| '''UART2_TX'''| '''15'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''17'''|-| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|-| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''25'''|-| '''266'''| '''PI10'''| '''TWI2-SDA'''| '''27'''|-| '''256'''| '''PI0'''| style="text-align: left;"|| '''29'''|-| '''271'''| '''PI15'''| style="text-align: left;"|| '''31'''|-| '''<span style="color:#FF0000">268</span>'''| '''<span style="color:#FF0000">PI12</span>'''| '''<span style="color:#FF0000">PWM2</span>'''| '''<span style="color:#FF0000">33</span>'''|-| '''258'''| '''PI2'''| style="text-align: left;"|| '''35'''|-| '''272'''| '''PI16'''| style="text-align: left;"|| '''37'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''39'''|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''6'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''8'''| '''UART0_TX'''| '''PH0'''| '''224'''|-| '''10'''| '''UART0_RX'''| '''PH1'''| '''225'''|-| '''12'''| style="text-align: left;"|| '''PI1'''| '''257'''|-| '''14'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''<span style="color:#FF0000">16</span>'''| '''<span style="color:#FF0000">PWM4</span>'''| '''<span style="color:#FF0000">PI14</span>'''| '''<span style="color:#FF0000">270</span>'''|-| '''18'''| style="text-align: left;"|| '''PH4'''| '''228'''|-| '''20'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''22'''| '''UART2_RX'''| '''PI6'''| '''262'''|-| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''28'''| '''TWI2-SCL'''| '''PI9'''| '''265'''|-| '''30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''<span style="color:#FF0000">32</span>'''| '''<span style="color:#FF0000">PWM1</span>'''| '''<span style="color:#FF0000">PI11</span>'''| '''<span style="color:#FF0000">267</span>'''|-| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''36'''| style="text-align: left;"|| '''PC12'''| '''76'''|-| '''38'''| style="text-align: left;"|| '''PI4'''| '''260'''|-| '''40'''| style="text-align: left;"|| '''PI3'''| '''259'''|}</div> <ol start="2" style="list-style-type: decimal;"><li>First click the wiringOP icon to open wiringOP APP</li> [[File:zero2w-img351.png]]</ol><ol start="3" style="list-style-type: decimal;"><li>Then click the '''PWM_TEST''' button on the main interface of wiringOP to enter the PWM test interface</li> [[File:zero2w-img380.png]]</ol><ol start="4" style="list-style-type: decimal;"><li>The PWM test interface is as follows</li> <div class="figure"> [[File:zero2w-img381.png]] </div></ol><ol start="5" style="list-style-type: decimal;"><li>Then set which PWM you want to use in the Channel. The default is PWM1. If you want to set it to PWM2, just enter 2 in the Channel. PWM3 and PWM4 and so on.</li> [[File:zero2w-img382.png]]</ol><ol start="6" style="list-style-type: decimal;"><li>Then you can set the PWM period. The default configuration is '''50000ns'''. The converted PWM frequency is '''20KHz'''</li> [[File:zero2w-img383.png]]</ol><ol start="7" style="list-style-type: decimal;"><li>Then click the '''EXPORT'''button to export PWM</li> [[File:zero2w-img384.png]]</ol><ol start="8" style="list-style-type: decimal;"><li>Then drag the progress bar below to change the PWM duty cycle, and then check '''Enable''' to output the PWM waveform.</li> [[File:zero2w-img385.png]]</ol><ol start="9" style="list-style-type: decimal;"><li>Then use an oscilloscope to measure the corresponding pins in the 40pin development board and you can see the following waveform.</li> [[File:zero2w-img386.png]]</ol><span id="how-to-compile-android-12-source-code"></span> = '''How to compile Android 12 source code''' = <span id="download-the-source-code-of-android-12"></span>== Download the source code of Android 12 == <ol style="list-style-type: decimal;"><li><p>First download the compressed package of the Android 12 source code and the compressed package of the files modified by Orange Pi Zero2w from Google Cloud Drive</p><ol style="list-style-type: lower-alpha;"><li>Google Cloud Drive</li> [[File:zero2w-img387.png]]</ol></li></ol><ol start="2" style="list-style-type: decimal;"><li>After downloading the compressed package of Android 12 source code, please check whether the MD5 checksum is correct. If it is incorrect, please download the source code again. Here's how to check the MD5 checksum:</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''md5sum -c H618-Android12-Src.tar.gz.md5sum''' H618-Android12-Src.tar.gzaa: '''<span style="color:#FF0000">OK</span>''' H618-Android12-Src.tar.gzab: '''<span style="color:#FF0000">OK</span>''' ......|}</ol><ol start="3" style="list-style-type: decimal;"><li>Then you need to merge multiple compressed files into one, and then extract the Android source code. The command looks like this:</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''cat H618-Android12-Src.tar.gz<span style="color:#FF0000">a</span>* &gt; H618-Android12-Src.tar.gz''' test@test:~$ '''tar -xvf H618-Android12-Src.tar.gz'''|}</ol><ol start="4" style="list-style-type: decimal;"><li>Then unzip the compressed package of the files modified by Orange Pi Zero2w</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''tar zxf opizero2w_android12_patches.tar.gz''' test@test:~$ '''ls''' '''opizero2w_android12_patches''' opizero2w_android12_patches.tar.gz|}</ol><ol start="5" style="list-style-type: decimal;"><li>Then copy the files modified by Orange Pi Zero2w to the Android source code</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''cp -rf opizero2w_android12_patches/* H618-Android12-Src/'''|}</ol><span id="compile-the-source-code-of-android-12"></span> == Compile the source code of Android 12 == {| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Android12 is compiled on an x86_64 computer with <span style="color:#FF0000">Ubuntu 22.04</span> installed. Other versions of Ubuntu system package dependencies may have some differences. The image download address of the Ubuntu 22.04 <span style="color:#FF0000">amd64</span> version is as follows:''' [https://repo.huaweicloud.com/ubuntu-releases/22.04/ubuntu-22.04.2-desktop-amd64.iso '''https://repo.huaweicloud.com/ubuntu-releases/22.04/ubuntu-22.04.2-desktop-amd64.iso'''] '''The x86_64 computer hardware configuration for compiling Android12 source code recommends a memory of 16GB or more, and a hard disk space of 200GB or more is recommended. The more CPU cores, the better.'''</big>|} # First install the software packages needed to compile Android12 source code ::{| class="wikitable" style="width:800px;" |-| test@test:~$ '''sudo apt-get update''' test@test:~$ '''sudo apt-get install -y git gnupg flex bison gperf build-essential \''' '''zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \''' '''lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev ccache \''' '''libgl1-mesa-dev libxml2-utils xsltproc unzip u-boot-tools python-is-python3 \''' '''libssl-dev libncurses5 clang gawk'''|} <ol start="2" style="list-style-type: decimal;"><li><p>Then compile the code in the longan folder, which mainly contains u-boot and linux kernel</p><ol style="list-style-type: lower-alpha;"><li>First run '''./build.sh config''' to set compilation options</li>{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''cd H618-Android12-Src/longan'''</p><p>test@test:~/H618-Android12-Src/longan$ '''./build.sh config'''</p>  <p>Welcome to mkscript setup progress</p><p>All available platform:</p>:<p>0. android</p>:<p>1. linux</p><p>Choice [android]: '''<span style="color:#FF0000">0</span>'''</p><p>All available ic:</p>:<p>0. h618</p><p>Choice [h618]: '''<span style="color:#FF0000">0</span>'''</p><p>All available board:</p>:<p>0. ft</p>:<p>1. p1</p>:<p>2. p2</p>:<p>3. p7</p>:<p>4. p7l</p>:<p>5. perf1</p>:<p>6. perf2</p>:<p>7. perf3</p>:<p>8. qa</p><p>Choice [p2]: '''<span style="color:#FF0000">2</span>'''</p><p>All available flash:</p>:<p>0. default</p>:<p>1. nor</p><p>Choice [default]: '''<span style="color:#FF0000">0</span>'''</p><p>All available kern_ver:</p>:<p>0. linux-5.4</p><p>Choice [linux-5.4]: '''<span style="color:#FF0000">0</span>'''</p><p>All available arch:</p>:<p>0. arm</p>:<p>1. arm64</p><p>Choice [arm64]: '''<span style="color:#FF0000">1</span>'''</p><p>'''......'''</p><p>*** Default configuration is based on 'sun50iw9p1smp_h618_android_defconfig'</p><p>#</p><p># configuration written to .config</p><p>#</p><p>make[1]: Leaving directory '/home/test/H618-Android12-Src/longan/out/kernel/build'</p><p>make: Leaving directory '/home/test/H618-Android12-Src/longan/kernel/linux-5.4'</p><p>INFO: clean buildserver</p><p>INFO: prepare_buildserver</p>|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Then run the '''./build.sh''' script to start compilation.</li>{| class="wikitable" style="width:800px;" |-| test@test:~/H618-Android12-Src/longan$ '''./build.sh'''|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>After compilation is completed, you will see the following output</li>{| class="wikitable" style="width:800px;" |-| sun50iw9p1 compile Kernel successful INFO: Prepare toolchain ... '''......''' INFO: build kernel OK. INFO: build rootfs ... INFO: skip make rootfs for android INFO: ----------------------------------------
INFO: build lichee OK.
INFO: ----------------------------------------|}</ol></li></ol><ol start="3" style="list-style-type: decimal;"><li>Then use the following command to compile the Android source code and generate the final Android image</li></ol>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''cd H618-Android12-Src''' test@test:~/H618-Android12-Src$ '''source build/envsetup.sh''' test@test:~/H618-Android12-Src$ '''lunch apollo_p2-userdebug''' test@test:~/H618-Android12-Src$ '''make -j8''' test@test:~/H618-Android12-Src$ '''pack'''|}</ol><ol start="4" style="list-style-type: decimal;"><li><p>The storage path of the Android image generated by compilation is:</p>{| class="wikitable" style="width:800px;" |-| <p>'''longan/out/h618_android12_p2_uart0.img'''</p>|}</li></ol> <span id="appendix"></span> = '''Appendix''' = <span id="user-manual-update-history"></span>== User manual update history == {| class="wikitable" style="width:800px;text-align: center;"|-| '''Version'''| '''Date'''| '''Release Notes'''|-| v1.0| 2023-09-14| initial version|} <span id="image-update-history"></span>== Image update history == {| class="wikitable" style="width:800px;"|-| style="text-align: center;"| '''Date''' | style="text-align: center;"| '''Release Notes'''|-| 202 3style="text-align: center;"| 2023-09-14| orangepizero2w_1.0.0_debian_bullseye_server_linux5.4.125.7z orangepizero2w_1.0.0_ubuntu_focal_server_linux5.4.125.7z orangepizero2w_1.0.0_ubuntu_focal_desktop_xfce_linux5.4.125.7z orangepizero2w_1.0.0_debian_bullseye_desktop_xfce_linux5.4.125.7z  orangepizero2w_1.0.0_ubuntu_jammy_server_linux6.1.31.7z orangepizero2w_1.0.0_debian_bookworm_server_linux6.1.31.7z orangepizero2w_1.0.0_debian_bullseye_server_linux6.1.31.7z orangepizero2w_1.0.0_ubuntu_jammy_desktop_xfce_linux6.1.31.7z orangepizero2w_1.0.0_debian_bookworm_desktop_xfce_linux6.1.31.7z orangepizero2w_1.0.0_debian_bullseye_desktop_xfce_linux6.1.31.7z  OrangePi_Zero2w_Android12_v1.0.tar.gz 
Opios-arch-aarch64-xfce-opizero2w-23.09-linux6.1.31.img.xz

Navigation menu