Open main menu

Wiki-Orange Pi β

Changes

Orange Pi Zero 2W

34,335 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>First insert the USB camera into the USB interface of the Orange Pi development board</p></li>
<li><p>Then you can see through the lsmod command that the kernel automatically loads the following modules</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''lsmod'''</p>
<pspan style="margin-right: 100px;">Module </span><span style="margin-right: 50px;">Size </span><span style="margin-right: 45px;">Used by</pspan><br><pspan style="margin-right: 100px;">'''uvcvideo </span><span style="margin-right: 50px;">106496 </span><span style="margin-right: 50px;">0'''</pspan><br>|}</li>
<li><p>Through the v4l2-ctl command, you can see that the device node information of the USB camera is/dev/video0</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo apt update'''</p>
<p>orangepi@orangepi:~$ '''sudo''' '''apt install -y v4l-utils'''</p>
<p>orangepi@orangepi:~$ '''v4l2-ctl --list-devices'''</p>
<p>USB 2.0 Camera (usb-sunxi-ehci-1):</p>
::<p>/dev/video0</p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that the l in v4l2 is the lowercase letter l, not the number 1.'''</p><p>'''In addition, the serial number of the video may not always be video0, please refer to what you actually see.'''</p></big>|}</li>
<li><p>Use fswebcam to test the USB camera</p>
<ol style="list-style-type: lower-alpha;">
<li><p>Install fswebcam</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo''' '''apt update'''</p>
<p>orangepi@orangepi:~$ '''sudo apt-get install -y fswebcam'''</p>|}</li><li><p>After installing fswebcam, you can use the following command to &gt; take pictures</p><ol style="list-style-type: lower-alphanone;"><li><p>a) -d Option to specify the device node of the USB camera</p></li><li><p>b) --no-banner Used to remove watermarks from photos</p></li><li><p>c) -r option is used to specify the resolution of the photo</p></li><li><p>d) -S Option to skip previous frames</p></li><li><p>e) ./image.jpg Used to set the name and path of the generated &gt; photo</p>{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepi:~$ '''sudo''' '''fswebcam -d /dev/video0 \'''</p>
<p>'''--no-banner -r 1280x720 -S 5 ./image.jpg'''</p>|}</li></ol></li><li><p>In the server version of Linux system, after taking the picture, you can use the scp command to transfer the taken picture to the Ubuntu PC for mirror viewing.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''scp image.jpg [mailto:test@192.168.1.55:/home/test test@192.168.1.55:/home/test] (Modify the IP address and path according to the actual situation)'''</p>|}
</li>
<li><p>In the server version of Linux system, after taking the picture, &gt; you can use the scp command to transfer the taken picture to &gt; the Ubuntu PC for mirror viewing.</p><p>orangepi@orangepi:~$ '''scp image.jpg [mailto:test@192.168.1.55:/home/test test@192.168.1.55:/home/test] (Modify the IP address and path according to the actual situation)'''</p></li><li><p>In the desktop version of Linux system, you can directly view &gt; the captured pictures through the HDMI display</p></li></ol>
</li>
<li><p>Use mjpg-streamer to test the USB camera</p>
<ol style="list-style-type: lower-alpha;">
<li><p>Download mjpg-streamer</p>
<ol style="list-style-type: lower-alphanone;"><li><p>a) Github download address:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''git clone https://github.com/jacksonliam/mjpg-streamer'''</p>|}</li><li><p>b) The image download address of Gitee is:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''git clone https://gitee.com/leeboby/mjpg-streamer'''</p>|}</li></ol>
</li>
<li><p>Install dependent software packages</p>
<ol style="list-style-type: lower-alphanone;"><li><p>a) Ubuntu system</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt-get install -y cmake libjpeg8-dev'''</p>|}</li><li><p>b) Debian system</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt-get install -y cmake libjpeg62-turbo-dev'''</p>|}</li></ol>
</li>
<li><p>Compile and install mjpg-streamer</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''cd mjpg-streamer/mjpg-streamer-experimental'''</p>
<p>orangepi@orangepi:~/mjpg-streamer/mjpg-streamer-experimental$ '''make -j4'''</p>
<p>orangepi@orangepi:~/mjpg-streamer/mjpg-streamer-experimental$ '''sudo make install'''</p>|}</li>
<li><p>Then enter the following command to start mjpg_streamer</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that the serial number of the video is not always video0, please refer to what you actually see.'''</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~/mjpg-streamer/mjpg-streamer-experimental$ '''export LD_LIBRARY_PATH=.'''</p>
<p>orangepi@orangepi:~/mjpg-streamer/mjpg-streamer-experimental$ '''sudo ./mjpg_streamer -i &quot;./input_uvc.so -d \'''</p>
<p>'''/dev/video0 -u -f 30&quot; -o &quot;./output_http.so -w ./www&quot;'''</p>|}</li><li><p>Then enter ['''the IP address of the development board: 8080'''] &gt; in the Ubuntu PC or Windows PC or mobile phone browser on the &gt; same LAN as the development board to see the video output by &gt; the camera.</p>
<div class="figure">
<li><p>Use the '''aplay -l''' command to view the sound card devices supported by the Linux system</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The output of the linux5.4 system is as follows, where '''card 0: &gt; audiocodec''' is the sound card device required for headphone &gt; playback</p>{| class="wikitable" style="width:800px;" |-|
<p>root@orangepi:~# '''aplay -l'''</p>
<p>**** List of PLAYBACK Hardware Devices ****</p>
<p>'''card 0: audiocodec [audiocodec], device 0: soc@3000000:codec_plat-5096000.codec 5096000.codec-0 []'''</p>
:<p>'''Subdevices: 1/1'''</p>:<p>'''Subdevice #0: subdevice #0'''</p>|}</li><li><p>The output of the b.linux6.1 system is as follows, where &gt; '''audiocodec''' is the sound card device required for headphone &gt; playback.</p>{| class="wikitable" style="width:800px;" |-|
<p>root@orangepi:~# '''aplay -l'''</p>
<p>**** List of PLAYBACK Hardware Devices ****</p>
<p>'''card 0: audiocodec [audiocodec], device 0: CDC PCM Codec-0 [CDC PCM Codec-0]'''</p>
:<p>'''Subdevices: 1/1'''</p>:<p>'''Subdevice #0: subdevice #0'''</p>|}</li></ol>
</li>
<li><p>Then use the '''aplay''' command to play the audio, and the sound can be heard through the headphones</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>root@orangepi:~# '''aplay -D hw:0,0 /usr/share/sounds/alsa/audio.wav'''</p>
<p>Playing WAVE 'audio.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo</p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| </libig></ol> '''If there is noise during the headphone test, please pull out some of the headphones and do not plug them all the way in.'''</big>|}</li></ol><span id="hdmi-audio-playback-test"></span>
<span id="hdmi-audio-playback-test"></span>
==== HDMI audio playback test ====
<li><p>First use the Mini HDMI to HDMI cable to connect the Orange Pi development board to the TV (other HDMI displays need to ensure that they can play audio)</p></li>
<li><p>HDMI audio playback does not require other settings, just use the '''aplay''' command to play directly</p>
{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~# '''aplay -D hw:2,0 /usr/share/sounds/alsa/audio.wav'''</p>|}</li></ol>
<span id="test-audio-methods-on-desktop-systems"></span>
 
=== Test audio methods on desktop systems ===
<li><p>First open the volume control interface</p>
<p>[[File:zero2w-img166.png]]</p></li>
<li><p>When playing audio, the audio device options that can be used by &gt; the '''Playback''' software will be displayed in '''Playback''', &gt; as shown in the figure below. Here you can set which audio &gt; device needs to be played.</p>
<div class="figure">
<span id="infrared-reception-test"></span>
 
== Infrared reception test ==
<li><p>There is no infrared receiver on the main board of the development board. We can expand it through a 24pin expansion board.</p>
<p>[[File:zero2w-img107.png]]</p></li>
<li><p>Install ir-keytable infrared test software</p></li></ol>{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''sudo''' '''apt update'''
orangepi@orangepi:~$ '''sudo''' '''apt-get install -y ir-keytable'''
|}</ol>
<ol start="3" style="list-style-type: decimal;">
<li><p>Then execute ir-keytable to view the information of the infrared device</p>
<ol style="list-style-type: lower-alpha;">
<li>linux5.4 system output is as follows</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''ir-keytable'''
Found /sys/class/rc/rc0/ with:
::Name: sunxi-ir
::Driver: sunxi-rc-recv
::Default keymap: rc_map_sunxi
::Input device: /dev/input/event1
::LIRC device: /dev/lirc0
::Attached BPF protocols: Operation not permitted
::Supported kernel protocols: lirc nec
::Enabled kernel protocols: lirc nec
::bus: 25, vendor/product: 0001:0001, version: 0x0100 Repeat delay = 500 ms, repeat period = 125 ms
::Repeat delay = 500 ms, repeat period = 125 ms
|}
</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li><p>The output of the linux6.1 system is as follows</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''ir-keytable'''</p>
<p>Found /sys/class/rc/rc0/ with:</p>
::<p>Name: sunxi-ir</p>::<p>Driver: sunxi-ir</p>::<p>Default keymap: rc-empty</p>::<p>Input device: /dev/input/event5</p>::<p>LIRC device: /dev/lirc0</p>::<p>Attached BPF protocols: Operation not permitted</p>::<p>Supported kernel protocols: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp imon rc-mm</p>::<p>Enabled kernel protocols: lirc</p>::<p>bus: 25, vendor/product: 0001:0001, version: 0x0100</p>::<p>Repeat delay = 500 ms, repeat period = 125 ms</p>|}</li></ol> <!-- --/li></ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>Before testing the infrared reception function, you need to prepare an Orange Pi-specific infrared remote control. '''<span classstyle="markcolor:#FF0000">Other remote controls do not support it</span>'''.</p>
<div class="figure">
<li><p>Then enter the '''ir-keytable -t''' command in the terminal, and then use the infrared remote control to press the button against the infrared receiver of the Orange Pi development board to see the received key code in the terminal.</p>
<ol style="list-style-type: lower-alpha;">
<li>linux5.4 system output is as follows</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''sudo ir-keytable -t'''
1598339152.914715: event type EV_MSC(0x04): scancode = 0xfb0410
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li><p>linux6.1 system output is as follows</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo ir-keytable -c -p NEC -t'''</p>
<p>Old keytable cleared</p>
<p>202.063219: lirc protocol(nec): scancode = 0x45c</p>
<p>202.063249: event type EV_MSC(0x04): scancode = 0x45c</p>
<p>202.063249: event type EV_SYN(0x00).</p>|}</li></ol></li></ol><span id="temperature-sensor"></span>
<span id="temperature-sensor"></span>
== Temperature sensor ==
H618 has a total of 4 temperature sensors. The command to view the temperature is as follows:
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''The displayed temperature value needs to be divided by 1000, and the unit is Celsius.'''</big>|}
<ol style="list-style-type: lower-alpha;">
<li>sensor0: CPU temperature sensor, the first command is used to view &gt; the type of temperature sensor, the second command is used to view &gt; the value of the temperature sensor</li></ol>{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''cat /sys/class/thermal/thermal_zone0/type'''
'''57734'''
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li><p>sensor1: DDR temperature sensor, the first command is used to view &gt; the type of temperature sensor, the second command is used to view &gt; the value of the temperature sensor</p>{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepi:~$ '''cat /sys/class/thermal/thermal_zone1/type'''</p>
<p>'''ddr'''_thermal_zone</p>
<p>orangepi@orangepi:~$ '''cat /sys/class/thermal/thermal_zone1/temp'''</p>
<p>'''57410'''</p>|}</li><li><p>sensor2: GPU temperature sensor, the first command is used to view &gt; the type of temperature sensor, the second command is used to view &gt; the value of the temperature sensor</p>{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepi:~$ '''cat /sys/class/thermal/thermal_zone2/type'''</p>
<p>'''gpu'''_thermal_zone</p>
<p>orangepi@orangepi:~$ '''cat /sys/class/thermal/thermal_zone2/temp'''</p>
<p>'''59273'''</p>|}</li><li><p>sensor3: VE's temperature sensor. The first command is used to view &gt; the type of temperature sensor, and the second command is used to &gt; view the value of the temperature sensor.</p>{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepi:~$ '''cat /sys/class/thermal/thermal_zone3/type'''</p>
<p>'''ve'''_thermal_zone</p>
<p>orangepi@orangepi:~$ '''cat /sys/class/thermal/thermal_zone3/temp'''</p>
<p>'''58949'''</p>|}</li></ol>
<span id="how-to-check-the-temperature-in-linux6.1-system"></span>
 
=== How to check the temperature in linux6.1 system ===
{| class="wikitable" style="width:800px;"
|-
|
orangepi@orangepi:~$ '''sensors'''
Adapter: Virtual device
temp1: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +'''<span style="color:#FF0000">47.4°C</span>''' (crit = +110.0°C) 
gpu_thermal-virtual-0
Adapter: Virtual device
temp1: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +'''<span style="color:#FF0000">48.7°C</span>''' (crit = +110.0°C) 
ddr_thermal-virtual-0
Adapter: Virtual device
temp1: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +'''<span style="color:#FF0000">47.8°C</span>''' (crit = +110.0°C) 
ve_thermal-virtual-0
Adapter: Virtual device
temp1: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +'''<span style="color:#FF0000">47.2°C</span>''' (crit = +110.0°C)|}
<span id="pin-interface-pin-description"></span>
 
== 40 Pin Interface pin description ==
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note: The pin header on the 40pin interface is not soldered by default, and you need to solder it yourself before it can be used.'''</big>|}
<ol style="list-style-type: decimal;">
</div></li>
<li><p>The functions of the 40 Pin interface pins on the development board are as shown in the table below</p></li></ol>
<div style="display: flex;">{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO序号GPIO NO.'''
| '''GPIO'''
| '''Function'''
| '''pin'''
|
| '''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'''
|-
| '''231'''
| '''SPI1_MOSI'''
| '''19'''
|
| '''20'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''232'''
| '''SPI1_MISO'''
| '''21'''
|
| '''22'''
| '''TWI0_SDA/UART2_RX'''
| '''PI6'''
| '''262'''
|-
| '''230'''
| '''SPI1_CLK'''
| '''23'''
|
| '''24'''
| '''SPI1_CS0'''
| '''PH5'''
| '''229'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''266'''
| '''PI10'''
| '''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'''
|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''pin'40''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''4'''| '''5V'''| style="text-align: left;"|
| style="text-align: left;"|
| '''PI3'''
| '''259'''
|}
 
<ol start="3" style="list-style-type: decimal;">
<li>There are a total of 28 GPIO ports in the 40pin interface. The high-level voltage of all GPIO ports is '''3.3v'''</li></ol>
 
<span id="how-to-install-wiringop"></span>
== How to install wiringOP ==
 
'''Note that wiringOP is already pre-installed in the linux image released by Orange Pi. Unless the wiringOP code is updated, there is no need to re-download, compile and install, you can just use it directly.'''
 
'''The storage path of the compiled wiringOP deb package in orangepi-build is: '''
 
'''orangepi-build/external/cache/debs/arm64/wiringpi_x.xx.deb'''
 
'''After entering the system, you can run the gpio readall command. If you can see the following output, it means that wiringOP has been pre-installed and can be used normally.'''
 
[[File:zero2w-img170.png]]
 
'''WiringOP currently mainly adapts to the functions of setting GPIO port input and output, setting GPIO port output high and low levels, and setting pull-up and pull-down resistors. Functions such as hardware PWM cannot be used.'''
 
<ol style="list-style-type: decimal;">
<li><p>Download the code of wiringOP</p>
<p>orangepi@orangepi:~$ '''sudo apt update'''</p>
<p>orangepi@orangepi:~$ '''sudo apt install -y git'''</p>
<p>orangepi@orangepi:~$ '''git clone https://github.com/orangepi-xunlong/wiringOP.git -b next'''</p>
<p>'''Note that the source code needs to download the code of wiringOP next branch. Please don't miss the -b next parameter.'''</p>
<p>'''If there is a problem downloading the code from GitHub, you can directly use the wiringOP source code that comes with the Linux image. The storage location is: /usr/src/wiringOP.'''</p></li>
<li><p>Compile and install wiringOP</p>
<p>orangepi@orangepi:~$ '''cd wiringOP'''</p>
<p>orangepi@orangepi:~/wiringOP$ '''sudo ./build clean'''</p>
<p>orangepi@orangepi:~/wiringOP$ '''sudo ./build'''</p></li>
<li><p>The output of the test gpio readall command is as follows</p>
<p>[[File:zero2w-img170.png]]</p></li></ol>
 
<span id="pin-interface-gpio-i2c-uart-spi-and-pwm-testing"></span>
== 40pin interface GPIO, I2C, UART, SPI and PWM testing ==
 
'''Note: The pin header on the 40pin interface is not soldered by default, and you need to solder it yourself before it can be used.'''
 
<span id="pin-gpio-port-test"></span>
=== 40pin GPIO port test ===
 
<ol style="list-style-type: decimal;">
<li><p>The following uses pin No. 7 - corresponding to GPIO PI13 - corresponding to wPi serial number 2 - as an example to demonstrate how to set the high and low levels of the GPIO port.</p>
<p>[[File:zero2w-img171.png]]</p></li>
<li><p>First set the GPIO port to output mode, and the third parameter needs to be the serial number of the wPi corresponding to the input pin.</p>
<p>root@orangepi:~/wiringOP# '''gpio mode 2 out'''</p></li>
<li><p>Then set the GPIO port to output a low level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 0v, it means the low level is set successfully.</p>
<p>root@orangepi:~/wiringOP# '''gpio write 2 0'''</p></li>
<li><p>Then set the GPIO port to output a high level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 3.3v, it means the setting of the high level is successful.</p>
<p>root@orangepi:~/wiringOP# '''gpio write 2 1'''</p></li>
<li><p>The setting method for other pins is similar. You only need to modify the serial number of wPi to the serial number corresponding to the pin.</p></li></ol>
 
<span id="how-to-set-the-pull-down-resistor-of-40-pin-gpio-port"></span>
=== How to set the pull-down resistor of 40 Pin GPIO port ===
 
<ol style="list-style-type: decimal;">
<li><p>The following uses pin No. 7—corresponding to GPIO PI13—corresponding to wPi serial number 2—as an example to demonstrate how to set the pull-up and pull-down resistors of the GPIO port.</p>
<p>[[File:zero2w-img171.png]]</p></li>
<li><p>First, you need to set the GPIO port to input mode, and the third parameter needs to be the serial number of the wPi corresponding to the input pin.</p>
<p>root@orangepi:~/wiringOP# '''gpio mode 2 in'''</p></li>
<li><p>After setting to input mode, execute the following command to set the GPIO port to pull-up mode.</p>
<p>root@orangepi:~/wiringOP# '''gpio mode 2 up'''</p></li>
<li><p>Then enter the following command to read the level of the GPIO port. If the level is 1, it means that the pull-up mode is set successfully.</p>
<p>root@orangepi:~/wiringOP# '''gpio read 2'''</p>
<p>'''1'''</p></li>
<li><p>Then execute the following command to set the GPIO port to pull-down mode</p>
<p>root@orangepi:~/wiringOP# '''gpio mode 2 down'''</p></li>
<li><p>Then enter the following command to read the level of the GPIO port. If the level is 0, it means that the pull-down mode is set successfully.</p>
<p>root@orangepi:~/wiringOP# '''gpio read 2'''</p>
<p>'''0'''</p></li></ol>
 
<span id="pin-spi-test"></span>
=== 40pin SPI test ===
 
# As can be seen from the table below, the spi available for the 40pin interface is spi1, and there are two chip select pins cs0 and cs1
 
{| class="wikitable"
|-
| '''GPIO序号'''
| '''GPIO'''
| '''Function'''
| '''pin'''
|
| '''pin'''
| '''Function'''
| '''GPIO'''
| '''GPIO序号'''
|-
| '''6'''
| '''GND'''
| 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/UART4_TX'''| '''7'''|| '''8'''
| '''UART0_TX'''
| '''PH0'''
| '''224'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''9'''
|
| '''10'''
| '''UART0_RX'''
| '''225'''
|-
| '''226'''
| '''PH2'''
| '''UART5_TX'''
| '''11'''
|
| '''12'''
| style="text-align: left;"|
| '''257'''
|-
| '''227'''
| '''PH3'''
| '''UART5_RX'''
| '''13'''
|
| '''14'''
| '''GND'''
| style="text-align: left;"|
|-
| '''261'''
| '''PI5'''
| '''TWI0_SCL/UART2_TX'''
| '''15'''
|
| '''16'''
| '''PWM4/UART4_RX'''
| '''270'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|
| '''18'''
| style="text-align: left;"|
| '''228'''
|-
| '''231'''
| '''PH7'''
| '''SPI1_MOSI'''
| '''19'''
|
| '''20'''
| '''GND'''
| style="text-align: left;"|
|-
| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''22'''
| '''TWI0_SDA/UART2_RX'''
| '''PI6'''
| '''262'''
|-
| '''230'''
| '''PH6'''
| '''SPI1_CLK'''
| '''23'''
|
| '''24'''
| '''SPI1_CS0'''
| '''229'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''25'''
|
| '''26'''
| '''SPI1_CS1'''
| '''233'''
|-
| '''266'''
| '''PI10'''
| '''TWI2-SDA/UART3_RX'''
| '''27'''
|
| '''28'''
| '''TWI2-SCL/UART3_TX'''
| '''265'''
|-
| '''256'''
| '''PI0'''
| style="text-align: left;"|
| '''29'''
|
| '''30'''
| '''GND'''
| style="text-align: left;"|
|-
| '''271'''
| '''PI15'''
| style="text-align: left;"|
| '''31'''
|
| '''32'''
| '''PWM1'''
| '''267'''
|-
| '''268'''
| '''PI12'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
|-
| '''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>
<ol start="3" style="list-style-type: decimal;">
<li>There are a total of 28 GPIO ports in the 40pin interface. The high-level voltage of all GPIO ports is '''<span style="color:#FF0000">3.3v</span>'''</li></ol>
<ol stylespan id="listhow-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-styleinstall-type: lower-alpha;wiringop"><li><p>First run '''orangepi-config'''. Ordinary users remember to add &gt; '''sudo''' permissions.</p><p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p></li><li><p>Then select '''System'''</p><p>[[File:zero2w-img80.png]]</p></li><li><p>Then select '''Hardware'''</p><p>[[File:zero2w-img81.png]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown &gt; in the figure below, and then use the '''space''' to select the &gt; dtbo configuration of the SPI you want to open.</p></li></ol></li></olspan>
== How to install wiringOP == {| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| '''dtbo configuration'''| '''illustrate<big>'''|Note that wiringOP is already pre-| '''spi1-cs0installed in the linux image released by Orange Pi. Unless the wiringOP code is updated, there is no need to re-cs1-spidev'''| '''Open cs0 download, compile and cs1 of spi1 at the same timeinstall, you can just use it directly.'''|-| '''spi1-cs0-spidev'''| '''Only open cs0 The storage path of spi1'''|-| '''spi1the compiled wiringOP deb package in orangepi-cs1-spidev'''| 'build is: ''Only open cs1 of spi1'''|}
[[File'''<span style="color:zero2wblue">orangepi-img172build/external/cache/debs/arm64/wiringpi_x.png]]xx.deb</span>'''
<ol start="5" style="list-style-type: lower-alpha;">
<li><p>Then select '''&lt;Save&gt;''' to save</p>
<p>[[File:zero2w-img83.png]]</p></li>
<li><p>Then select '''&lt;Back&gt;'''</p>
<p>[[File:zero2w-img84.png]]</p></li>
<li><p>Then select '''&lt;Reboot&gt;'''to restart the system to make the &gt; configuration take effect.</p>
<p>[[File:zero2w-img85.png]]</p></li></ol>
<!-- --><ol start="2" style="list-style-type: decimal;"><li><p>Then check whether there is a '''spidev1.x''' device node in After entering the Linux system. If it exists, it means that you can run the SPI1 configuration has taken effectgpio readall command.</p><p>orangepi@orangepi:~$ '''ls /dev/spidev1*'''</p><p>/dev/spidev1.0 /dev/spidev1.1</p><p>'''Note that only when If you open spi1-cs0-cs1-spidev, you will can see the device nodes of the two spi.'''</p></li><li><p>Nextfollowing output, start the spi loopback test. Do not short-circuit the mosi and miso pins of SPI1 first. The output result of running spidev_test is as follows. You can see it means that the data of TX and RX are inconsistent.</p><p>orangepi@orangepi:~$ '''sudo spidev_test -v wiringOP has been pre-D /dev/spidev1.0'''</p><p>spi mode: 0x0</p><p>bits per word: 8</p><p>max speed: 500000 Hz (500 KHz)</p><p>TX | FF FF FF FF FF FF '''40 00 00 00 00 95''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p><p>RX | FF FF FF FF FF FF '''FF FF FF FF FF FF''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF | ............................….</p></li><li><p>Then short-circuit the two pins of SPI1 mosi (pin 19 in the 40pin interface) and miso (pin 21 in the 40pin interface) installed and then run spidev_test. The output is as follows. You can see the sending and receiving The data is the same, indicating that the loopback test passed.</p><p>orangepi@orangepi:~$ '''sudo spidev_test -v -D /dev/spidev1.0'''</p><p>spi mode: 0x0</p><p>bits per word: 8</p><p>max speed: 500000 Hz (500 KHz)</p><p>TX | FF FF FF FF FF FF '''40 00 00 00 00 95''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒be used normally.</p><p>RX | FF FF FF FF FF FF '''40 00 00 00 00 95''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p></li></olbig>
<span id="pin[[File:zero2w-i2c-test"></span>=== 40pin I2C test ===img170.png|center]]
# As can be seen from <big>'''WiringOP currently mainly adapts to the table belowfunctions of setting GPIO port input and output, the i2c available for the 40pin interface are i2c0setting GPIO port output high and low levels, i2c1 and i2c2setting pull-up and pull-down resistors. Functions such as hardware PWM cannot be used.'''</big>|}
<ol style="list-style-type: decimal;"><li><p>Download the code of wiringOP</p>{| class="wikitable" style="width:800px;"
|-
| '''GPIO序号'''| <p>orangepi@orangepi:~$ '''GPIOsudo apt update'''</p>| <p>orangepi@orangepi:~$ '''Functionsudo apt install -y git'''</p>| <p>orangepi@orangepi:~$ '''pin'''|| '''pingit clone https://github.com/orangepi-xunlong/wiringOP.git -b next'''</p>| '''Function'''}{| '''GPIO'''| '''GPIO NO.'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| style="text-align: left;"|| style="text-align: left;"|| <big><p>'''Note that the source code needs to download the code of wiringOP next branch. Please don'3t miss the -b next parameter.3V'''</p>| <p>'''1If there is a problem downloading the code from GitHub, you can directly use the wiringOP source code that comes with the Linux image. The storage location is: /usr/src/wiringOP.'''</p></big>|}| '''2'''</li>| '''5V'''<li><p>Compile and install wiringOP</p>{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| <p>orangepi@orangepi:~$ '''264cd wiringOP'''</p>| <p>orangepi@orangepi:~/wiringOP$ '''PI8sudo ./build clean'''</p>| <p>orangepi@orangepi:~/wiringOP$ '''TWI1-SDAsudo ./build'''</p>| '''3'''}</li>|<li><p>The output of the test gpio readall command is as follows</p>| '''4'''<p>[[File:zero2w-img170.png]]</p></li></ol>| '''5V'''| style<span id="textpin-interface-gpio-i2c-uart-spi-align: left;and-pwm-testing"|></span> == 40pin interface GPIO, I2C, UART, SPI and PWM testing == {| class="wikitable" style="textbackground-aligncolor: left#ffffdc;width:800px;"|
|-
| '''263'''| <big>'''PI7Note: The pin header on the 40pin interface is not soldered by default, and you need to solder it yourself before it can be used.'''</big>| '''TWI1-SCL'''}| '''5'''|<span id="pin-gpio-port-test"></span>| '''6'''=== 40pin GPIO port test ===| '''GND'''| <ol style="textlist-alignstyle-type: leftdecimal;"|><li><p>The following uses pin No. 7 - corresponding to GPIO PI13 - corresponding to wPi serial number 2 - as an example to demonstrate how to set the high and low levels of the GPIO port.</p><p>[[File:zero2w-img171.png]]</p></li><li><p>First set the GPIO port to output mode, and the third parameter needs to be the serial number of the wPi corresponding to the input pin.</p>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| '''269'''| <p>root@orangepi:~/wiringOP# '''PI13'''| gpio mode <span style="color:#FF0000">2</span> out'''PWM3</UART4_TX'''p>| '''7'''}|</li>| '''8'''| '''UART0_TX'''<li><p>Then set the GPIO port to output a low level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 0v, it means the low level is set successfully.</p>{| '''PH0'''| '''224'''class="wikitable" style="width:800px;"
|-
| style="text-align<p>root@orangepi: left;"|| ~/wiringOP# '''gpio write 2 <span style="text-aligncolor: left;#FF0000"|| '''GND'''| '''9>0</span>'''</p>|}| '''10'''| '''UART0_RX'''</li>| '''PH1'''<li><p>Then set the GPIO port to output a high level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 3.3v, it means the setting of the high level is successful.</p>{| '''225'''class="wikitable" style="width:800px;"
|-
| <p>root@orangepi:~/wiringOP# '''226gpio write 2 <span style="color:#FF0000">1</span>'''</p>| '''PH2'''}</li><li><p>The setting method for other pins is similar. You only need to modify the serial number of wPi to the serial number corresponding to the pin.</p></li></ol> | '''UART5_TX'''<span id="how-to-set-the-pull-down-resistor-of-40-pin-gpio-port"></span>| '''11'''|=== How to set the pull-down resistor of 40 Pin GPIO port ===| '''12'''| <ol style="textlist-style-aligntype: leftdecimal;"|><li><p>The following uses pin No. 7—corresponding to GPIO PI13—corresponding to wPi serial number 2—as an example to demonstrate how to set the pull-up and pull-down resistors of the GPIO port.</p><p>[[File:zero2w-img171.png]]</p></li>| '''PI1'''<li><p>First, you need to set the GPIO port to input mode, and the third parameter needs to be the serial number of the wPi corresponding to the input pin.</p>{| '''257'''class="wikitable" style="width:800px;"
|-
| '''227'''| <p>root@orangepi:~/wiringOP# '''PH3gpio mode <span style="color:#FF0000">2</span> in'''</p>| '''UART5_RX'''}| '''13'''</li>|| '''14'''| '''GND'''<li><p>After setting to input mode, execute the following command to set the GPIO port to pull-up mode.</p>{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| <p>root@orangepi:~/wiringOP# '''261gpio mode <span style="color:#FF0000">2</span> up'''</p>|}</li><li><p>Then enter the following command to read the level of the GPIO port. If the level is 1, it means that the pull-up mode is set successfully.</p>{| class="wikitable" style="width:800px;" | -| <p>root@orangepi:~/wiringOP# '''gpio read <span style="color:#FF0000">2</span>'''</p><p>'''PI5<span style="color:#FF0000">1</span>'''</p>|}</li><li><p>Then execute the following command to set the GPIO port to pull-down mode</p>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP# '''TWI0_SCLgpio mode <span style="color:#FF0000">2</UART2_TXspan> down'''</p>|}</li><li><p>Then enter the following command to read the level of the GPIO port. If the level is 0, it means that the pull-down mode is set successfully.</p>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP# '''gpio read <span style="color:#FF0000">2</span>'''</p><p>'''15<span style="color:#FF0000">0</span>'''</p>|}</li></ol> <span id="pin-spi-test"></span> === 40pin SPI test === # As can be seen from the table below, the spi available for the 40pin interface is spi1, and there are two chip select pins cs0 and cs1 <div style="display: flex;">::{|class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''16GPIO NO.'''| '''PWM4/UART4_RXGPIO'''| '''PI14Function'''| '''270pin'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''17'''|| '''18'''| style="text-align: left;"|| '''PH4'''| '''2281'''
|-
| '''231264'''| '''PH7PI8'''| '''SPI1_MOSI'''| '''19TWI1-SDA'''|| '''203'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''232263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|-| '''269'''| '''PI13'''| '''PWM3/UART4_TX'''| '''7'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''9'''|-| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-| '''261'''| '''PI5'''| '''TWI0_SCL/UART2_TX'''| '''15'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''17'''|-| '''<span style="color:#FF0000">231</span>'''| '''PH8<span style="color:#FF0000">PH7</span>'''| '''SPI1_MISO<span style="color:#FF0000">SPI1_MOSI</span>'''| '''21<span style="color:#FF0000">19</span>'''|-| '''22<span style="color:#FF0000">232</span>'''| '''TWI0_SDA<span style="color:#FF0000">PH8</UART2_RXspan>'''| '''PI6<span style="color:#FF0000">SPI1_MISO</span>'''| '''262<span style="color:#FF0000">21</span>'''
|-
| '''<span style="color:#FF0000">230</span>'''| '''<span style="color:#FF0000">PH6</span>'''| '''<span style="color:#FF0000">SPI1_CLK</span>'''| '''<span style="color:#FF0000">23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229</span>'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|
| '''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="list-stylewidth:390px;margin-typeright: decimal20px;"><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="listtext-style-typealign: lower-alphacenter;"><li><p>First run '''orangepi|-config'''. Ordinary users remember to add &gt; | '''sudopin''' permissions.</p><p>orangepi@orangepi:~$ | '''sudo orangepi-configFunction'''</p></li><li><p>Then select | '''SystemGPIO'''</p><p>[[File:zero2w-img80.png]]</p></li><li><p>Then select '''Hardware| '''</p><p>[[File:zero2w-img81GPIO NO.png]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown &gt; in the picture below, and then use the '''space''' to select the &gt; corresponding i2c configuration in the picture below.</p></li></ol></li></ol> {| class="wikitable"
|-
| '''Multiplexing function in 40pin2'''| '''Corresponding dtbo configuration5V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - i2c04'''| '''pi-i2c05V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - i2c16'''| '''pi-i2c1GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - i2c28'''| '''pi-i2c2UART0_TX'''|} [[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 '''&lt;Back&gt;PH0'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''&lt;Reboot&gt;''' to restart the system to make the &gt; configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol> <!-- --><ol start="3" style="list-style-type: decimal;"><li><p>After starting the Linux system, first confirm that there is an open i2c device node under /dev</p><p>orangepi@orangepi:~$ '''ls /dev/i2c-*'''</p><p>'''/dev/i2c-*'''</p><p>'''Sometimes the i2c device node and the i2c bus serial number do not correspond one to one. For example, the i2c device node of the i2c1 bus may be /dev/i2c-3.'''</p><p>'''The method to accurately confirm the device node under /dev corresponding to the i2c bus is: '''</p></li></ol> <!-- --><ol style="list-style-type: lower-alpha;"><li><p>'''First run the following command to check the corresponding relationship of i2c'''</p><p>orangepi@orangepizero2w:~$ '''ls /sys/devices/platform/soc*/*/i2c-* | grep &quot;i2c-[0-9]&quot;'''</p><p>/sys/devices/platform/soc/5002000.i2c/i2c-0:</p><p>/sys/devices/platform/soc/5002400.i2c/i2c-3:</p><p>/sys/devices/platform/soc/5002800.i2c/i2c-4:</p><p>/sys/devices/platform/soc/5002c00.i2c/i2c-5:</p><p>/sys/devices/platform/soc/6000000.hdmi/i2c-2:</p><p>/sys/devices/platform/soc/7081400.i2c/i2c-1:</p></li><li><p>'''In the above output224'''</p></li></ol> <!-- --><ol style="list-style-type: lower-alpha;"><li><p>5002000 is the register base address of the i2c0 bus, and i2c-0 shown behind it is its corresponding i2c device node</p></li><li><p>5002400 is the register base address of the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li><li><p>5002800 is the register base address of the i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p></li></ol> <!-- --><ol start="4" style="list-style-type: decimal;"><li><p>Then start testing i2c, first install i2c-tools</p><p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y i2c-tools'''</p></li><li><p>Then connect an i2c device to the i2c pin of the 40pin connector</p></li><li><p>Then use the '''i2cdetect -y x''' x command. If the address of the connected i2c device can be detected, it means that i2c can be used normally.</p><p>'''Note that x in the i2cdetect -y x command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p><p>'''Different i2c device addresses are different. The 0x50 address in the picture below is just an example. Please refer to what you actually see.'''</p><div class="figure"> [[File:zero2w-img174.png]] </div></li></ol> <span id="pin-uart-test"></span>=== 40pin UART test === # As can be seen from the table below, the available uarts are uart2, uart3, uart4 and uart5. Please note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial port. {| class="wikitable"
|-
| '''GPIO NO.10'''| '''GPIOUART0_RX'''| '''FunctionPH1'''| '''pin'''|| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.225'''
|-
| '''12'''
| style="text-align: left;"|
| '''PI1'''
| '''257'''
|-
| '''14'''
| '''GND'''
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|
| '''2'''
| '''5V'''
| style="text-align: left;"|
|-
| '''16'''
| '''PWM4/UART4_RX'''
| '''PI14'''
| '''270'''
|-
| '''18'''
| style="text-align: left;"|
| '''PH4'''
| '''228'''
|-
| '''26420'''| '''PI8'''| '''TWI1-SDA'''| '''3'''|| '''4'''| '''5VGND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26322'''| '''PI7TWI0_SDA/UART2_RX'''| '''TWI1PI6'''| '''262'''|-| '''<span style="color:#FF0000">24</span>'''| '''<span style="color:#FF0000">SPI1_CS0</span>'''| '''<span style="color:#FF0000">PH5</span>'''| '''<span style="color:#FF0000">229</span>'''|-| '''<span style="color:#FF0000">26</span>'''| '''<span style="color:#FF0000">SPI1_CS1</span>'''| '''<span style="color:#FF0000">PH9</span>'''| '''<span style="color:#FF0000">233</span>'''|-| '''28'''| '''TWI2-SCL/UART3_TX'''| '''5PI9'''|'''265'''|-| '''630'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26932'''| '''PI13PWM1'''| '''PWM3/UART4_TXPI11'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224267'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''| '''9'''|| '''10'''| '''UART0_RX'''| '''PH1'''| '''225'''|-| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''1236'''
| style="text-align: left;"|
| '''PI1PC12'''| '''25776'''
|-
| '''22738'''| '''PH3'''| '''UART5_RX'''| '''13'''|| '''14'''| '''GND'''| style="text-align: left;"|
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| '''26140'''| '''PI5'''| '''TWI0_SCL/UART2_TX'''| '''15'''|| '''16'''| '''PWM4/UART4_RX'''| '''PI14'''| '''270'''|-
| style="text-align: left;"|
| style="text-align: left;"|| '''3.3VPI3'''| '''17259'''|}| '''18'''</div> <ol style="list-style-type: decimal;"><li><p>In Linux systems, spi1 is turned off by default and needs to be turned on manually before it can be used. The opening steps are as follows:</p>| <ol style="textlist-style-aligntype: leftlower-alpha;"|>| <li><p>First run '''PH4orangepi-config'''| . Ordinary users remember to add '''228sudo'''permissions.</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''231sudo orangepi-config'''</p>| }</li><li><p>Then select '''PH7System'''</p>| '''SPI1_MOSI'''<p>[[File:zero2w-img80.png]]</p></li>| <li><p>Then select '''19Hardware'''</p>|<p>[[File:zero2w-img81.png]]</p></li>| <li><p>Then use the keyboard's arrow keys to locate the position shown in the figure below, and then use the '''20space'''to select the dtbo configuration of the SPI you want to open.</p></li>| '''GND'''{| styleclass="text-align: left;wikitable"|| style="width:800px;text-align: leftcenter;"|
|-
| '''232dtbo configuration'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''TWI0_SDA/UART2_RX'''| '''PI6'''| '''262illustrate'''
|-
| '''230spi1-cs0-cs1-spidev'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229Open cs0 and cs1 of spi1 at the same time'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''25'''|| '''26'''| '''SPI1_CS1'''| '''PH9spi1-cs0-spidev'''| '''233Only open cs0 of spi1'''
|-
| '''266spi1-cs1-spidev'''| '''PI10Only open cs1 of spi1'''| '''TWI2} [[File:zero2w-SDAimg172.png]]</UART3_RX'''ol><ol start="5" style="list-style-type: lower-alpha;">| <li><p>Then select '''27&lt;Save&gt;'''to save</p>|<p>[[File:zero2w-img83.png]]</p></li>| <li><p>Then select '''28&lt;Back&gt;'''</p>| '''TWI2<p>[[File:zero2w-SCLimg84.png]]</p></UART3_TX'''li>| <li><p>Then select '''PI9&lt;Reboot&gt;'''to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol></li></ol><ol start="2" style="list-style-type: decimal;">| <li><p>Then check whether there is a '''265spidev1.x'''device node in the Linux system. If it exists, it means that the SPI1 configuration has taken effect.</p>{| class="wikitable" style="width:800px;"
|-
| '''256'''| '''PI0'''| style="text-align<p>orangepi@orangepi: left;"|| ~$ '''29ls /dev/spidev1*'''</p>|<p>/dev/spidev1.0 /dev/spidev1.1</p>| '''30'''| '''GND'''}{| styleclass="text-align: left;wikitable"|| style="textbackground-aligncolor:#ffffdc;width: left800px;"|
|-
| <big><p>'''271Note that only when you open spi1-cs0-cs1-spidev, you will see the device nodes of the two spi.'''</p></big>| '''PI15'''}</li><li><p>Next, start the spi loopback test. Do not short-circuit the mosi and miso pins of SPI1 first. The output result of running spidev_test is as follows. You can see that the data of TX and RX are inconsistent.</p>{| class="wikitable" style="text-alignwidth: left800px;"|| '''31'''|| '''32'''| '''PWM1'''| '''PI11'''| '''267'''
|-
| <p>orangepi@orangepi:~$ '''268sudo spidev_test -v -D /dev/spidev1.0'''</p><p>spi mode: 0x0</p><p>bits per word: 8</p><p>max speed: 500000 Hz (500 KHz)</p><p>TX | FF FF FF FF FF FF '''PI12<span style="color:#FF0000">40 00 00 00 00 95</span>'''FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p><p>RX | FF FF FF FF FF FF '''PWM2<span style="color:#FF0000">FF FF FF FF FF FF</span>'''FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF | ............................….</p>|}</li><li><p>Then short-circuit the two pins of SPI1 mosi (pin 19 in the 40pin interface) and miso (pin 21 in the 40pin interface) and then run spidev_test. The output is as follows. You can see the sending and receiving The data is the same, indicating that the loopback test passed.</p>{| class="wikitable" style="width:800px;" | -| <p>orangepi@orangepi:~$ '''33sudo spidev_test -v -D /dev/spidev1.0'''</p><p>spi mode: 0x0</p><p>bits per word: 8</p>|<p>max speed: 500000 Hz (500 KHz)</p><p>TX | FF FF FF FF FF FF '''34<span style="color:#FF0000">40 00 00 00 00 95</span>'''FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p><p>RX | FF FF FF FF FF FF '''GND<span style="color:#FF0000">40 00 00 00 00 95</span>'''FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p>| }</li></ol> <span id="pin-i2c-test"></span> === 40pin I2C test === # As can be seen from the table below, the i2c available for the 40pin interface are i2c0, i2c1 and i2c2 <div style="text-aligndisplay: leftflex;"|>::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: leftcenter;"|-| '''GPIO NO.'''| '''GPIO'''| '''Function'''| '''pin'''
|-
| '''258'''
| '''PI2'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''PC123.3V'''| '''761'''|-| '''<span style="color:#FF0000">264</span>'''| '''<span style="color:#FF0000">PI8</span>'''| '''<span style="color:#FF0000">TWI1-SDA</span>'''| '''<span style="color:#FF0000">3</span>'''|-| '''<span style="color:#FF0000">263</span>'''| '''<span style="color:#FF0000">v</span>'''| '''<span style="color:#FF0000">TWI1-SCL</span>'''| '''<span style="color:#FF0000">5</span>'''
|-
| '''272269'''| '''PI16PI13'''| style="text-align: left;"|| '''37'''|| '''38'''| style="text-align: left;"|| '''PI4PWM3/UART4_TX'''| '''2607'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''399'''|| '''40'''| style="text-align: left;"|| '''PI3'''| '''259'''|} <ol start="2" style="list-style-type: decimal;"><li><p>In Linux systems, uart is turned off by default and needs to be turned on manually before it can be used. The opening steps are as follows:</p><ol style="list-style-type: lower-alpha;"><li><p>First run '''orangepi-config'''. Ordinary users remember to add &gt; '''sudo''' permissions.</p><p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p></li><li><p>Then select '''System'''</p><p>[[File:zero2w-img80.png]]</p></li><li><p>Then select '''Hardware'''</p><p>[[File:zero2w-img81.png]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown &gt; in the picture below, and then use the '''space''' to select the &gt; serial port you want to open.</p></li></ol></li></ol> {| class="wikitable"
|-
| '''Multiplexing function in 40pin226'''| '''Corresponding dtbo configurationPH2'''| '''UART5_TX'''| '''11'''
|-
| '''40pin - uart2227'''| '''pi-uart2PH3'''|-| '''40pin - uart3UART5_RX'''| '''pi-uart313'''
|-
| '''40pin - uart4'''| '''pi-uart4'''|-| '''40pin - uart5'''| '''ph-uart5'''|} [[File:zero2w-img175.png]] <ol start="5" span style="list-style-typecolor: lower-alpha;#FF0000"><li><p>Then select '''&lt;Save&gt;''' to save261</pspan><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" span style="list-style-typecolor: decimal;#FF0000">PI5<li><p/span>After entering the Linux system, first confirm whether there is a uart5 device node under '''/dev'''</p><p>'''Note that the linux5.4 system is /dev/ttyASx.| '''</p><p>orangepi@orangepispan style="color:~$ '''ls /dev/ttyS*'''</p#FF0000">TWI0_SCL<p>/dev/ttySx</p></li><li><p>Then start testing the uart interface. First use Dupont wire to short-circuit the rx and tx pins of the uart interface to be tested.</p></li><li><pspan>Use the '''gpio''' command in wiringOP to test the loopback function of the serial port as shown below. If you can see the following print, it means the serial port communication is normal.</p><p>UART2_TX'''Note that the last x in the gpio serial /dev/ttySx command needs to be replaced with the serial number of the corresponding uart device node.'''</p><p>orangepi@orangepi:~$ '''gpio serial /dev/ttySx # linux-6.1 test command'''</p><p>orangepi@orangepi:~$ '''gpio serial /dev/ttyASx # linux-5.4 test command| '''</p><p>Out: 0: -&gt; 0</p><p>Out: 1: -&gt; 1</p><p>Out: 2: -&gt; 2</p><p>Out: 3: -&gt; 3^C</p></li></ol> <span idstyle="pwm-test-methodcolor:#FF0000">15</span>=== PWM test method === # As can be seen from the following table, the available pwm are pwm1, pwm2, pwm3 and pwm4. {| class="wikitable"|-| '''GPIO NO.'''| '''GPIO'''| '''Function'''| '''Pin'''|| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''117'''|-| '''231'''| '''PH7'''| '''2SPI1_MOSI'''| '''5V19'''| style="text-align: left;"| '''232'''| '''PH8'''|'''SPI1_MISO'''| '''21'''| style="text-align: left;"| '''230'''|'''PH6'''| '''SPI1_CLK'''| '''23'''
|-
| '''264'''
| '''PI8'''
| '''TWI1-SDA'''
| '''3'''
|
| '''4'''
| '''5V'''
| 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>'''
|-
| '''263256'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|| '''6'''| '''GNDPI0'''
| style="text-align: left;"|
| '''29'''
|-
| '''271'''
| '''PI15'''
| style="text-align: left;"|
| '''31'''
|-
| '''269268'''| '''PI13PI12'''| '''PWM3/UART4_TXPWM2'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''22433'''
|-
| '''258'''
| '''PI2'''
| style="text-align: left;"|
| '''35'''
|-
| '''272'''
| '''PI16'''
| style="text-align: left;"|
| '''37'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''939'''|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''6'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''8'''| '''UART0_TX'''| '''PH0'''| '''224'''|-| '''10'''| '''UART0_RX'''| '''PH1'''| '''225'''
|-
| '''226'''
| '''PH2'''
| '''UART5_TX'''
| '''11'''
|
| '''12'''
| style="text-align: left;"|
| '''257'''
|-
| '''227'''
| '''PH3'''
| '''UART5_RX'''
| '''13'''
|
| '''14'''
| '''GND'''
| style="text-align: left;"|
|-
| '''261'''
| '''PI5'''
| '''TWI0_SCL/UART2_TX'''
| '''15'''
|
| '''16'''
| '''PWM4/UART4_RX'''
| '''270'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|
| '''18'''
| style="text-align: left;"|
| '''228'''
|-
| '''231'''
| '''PH7'''
| '''SPI1_MOSI'''
| '''19'''
|
| '''20'''
| '''GND'''
| style="text-align: left;"|
|-
| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''<span style="color:#FF0000">22</span>'''| '''<span style="color:#FF0000">TWI0_SDA</span>/UART2_RX'''| '''<span style="color:#FF0000">PI6</span>'''| '''<span style="color:#FF0000">262</span>'''|-| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''
| '''SPI1_CS0'''
| '''PH5'''
| '''229'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''25'''
|
| '''26'''
| '''SPI1_CS1'''
| '''233'''
|-
| '''266'''| '''PI10'''| '''TWI2-SDA<span style="color:#FF0000">28</UART3_RX'''| '''27'''|| '''28span>'''| '''<span style="color:#FF0000">TWI2-SCL</span>/UART3_TX'''| '''<span style="color:#FF0000">PI9</span>'''| '''<span style="color:#FF0000">265</span>'''
|-
| '''256'''
| '''PI0'''
| style="text-align: left;"|
| '''29'''
|
| '''30'''
| '''GND'''
| style="text-align: left;"|
|-
| '''271'''
| '''PI15'''
| style="text-align: left;"|
| '''31'''
|
| '''32'''
| '''PWM1'''
| '''267'''
|-
| '''268'''
| '''PI12'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
|-
| '''258'''
| '''PI2'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''76'''
|-
| '''272'''
| '''PI16'''
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''260'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''39'''
|
| '''40'''
| style="text-align: left;"|
| '''259'''
|}
</div>
<ol start="2" style="list-style-type: decimal;">
<li><p>pwm i2c is turned off by default in Linux systems and needs to be turned on manually to use it. The opening steps are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First run '''orangepi-config'''. Ordinary users remember to add &gt; '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li><li><p>Then select '''System'''</p>
<p>[[File:zero2w-img80.png]]</p></li>
<li><p>Then select '''Hardware'''</p>
<p>[[File:zero2w-img81.png]]</p></li>
<li><p>Then use the keyboard's arrow keys to locate the position shown &gt; in the figure picture below, and then use the '''space''' to select the &gt; corresponding i2c configuration corresponding to in the pwm you want to openpicture below.</p><p/li{| class="wikitable" style="width:800px;text-align: center;"|-| '''Multiplexing function in 40pin'''| '''Corresponding dtbo configuration'''|-| '''40pin - i2c0'''| '''pi-i2c0'''|-| '''40pin - i2c1'''| '''pi-i2c1'''|-| '''40pin - i2c2'''| '''pi-i2c2'''|} [[File:zero2w-img176img173.png]]</pol></liol start="5" style="list-style-type: lower-alpha;"><li><p>Then select '''<span class="mark">&lt;Save&gt;''' </span> to save</p>
<p>[[File:zero2w-img83.png]]</p></li>
<li><p>Then select '''&lt;Back&gt;'''</p>
<p>[[File:zero2w-img84.png]]</p></li>
<li><p>Then select '''&lt;Reboot&gt;''' to restart the system to make the &gt; configuration take effect.</p>
<p>[[File:zero2w-img85.png]]</p></li></ol>
</li>
<li><p>After restarting, you can start the PWM test</p>
<p>'''Please execute the following commands under the root user.'''</p>
<ol style="list-style-type: lower-alpha;">
<li><p>Enter the following command on the command line to make pwm1 &gt; output a 50Hz square wave</p>
<p>root@orangepi:~# '''echo 1 &gt; /sys/class/pwm/pwmchip0/export'''</p>
<p>root@orangepi:~# '''echo 20000000 &gt; /sys/class/pwm/pwmchip0/pwm1/period'''</p>
<p>root@orangepi:~# '''echo 1000000 &gt; /sys/class/pwm/pwmchip0/pwm1/duty_cycle'''</p>
<p>root@orangepi:~# '''echo 1 &gt; /sys/class/pwm/pwmchip0/pwm1/enable'''</p></li>
<li><p>Enter the following command on the command line to make pwm2 &gt; output a 50Hz square wave</p></li></ol>
</li></ol>
<ol start="3" style="list-style-type: decimal;">
<li><p>After starting the Linux system, first confirm that there is an open i2c device node under /dev</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''ls /dev/i2c-*'''</p>
<p>'''/dev/i2c-*'''</p>
|}
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|
<big><p>'''Sometimes the i2c device node and the i2c bus serial number do not correspond one to one. For example, the i2c device node of the i2c1 bus may be /dev/i2c-3.'''</p>
<p>'''The method to accurately confirm the device node under /dev corresponding to the i2c bus is: '''</p></big>
root@orangepi:~# '''echo 2 &gt; /sys/class/pwm/pwmchip0/export'''
root<ol style="list-style-type: lower-alpha;"><li><p>'''First run the following command to check the corresponding relationship of i2c'''</p><p>orangepi@orangepiorangepizero2w:~# $ '''echo 20000000 &gt; ls /sys/classdevices/pwmplatform/pwmchip0soc*/pwm2*/periodi2c-* | 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>
root@orangepi:~# '''echo 1000000 &gt; /sys/class/pwm/pwmchip0/pwm2/duty_cycle'''
 
root@orangepi:~# '''echo 1 &gt; /sys/class/pwm/pwmchip0/pwm2/enable'''
 
<ol start="3" style="list-style-type: lower-alpha;">
<li>Enter the following command on the command line to make pwm3 output &gt; a 50Hz square wave</li></ol>
 
root@orangepi:~# '''echo 3 &gt; /sys/class/pwm/pwmchip0/export'''
 
root@orangepi:~# '''echo 20000000 &gt; /sys/class/pwm/pwmchip0/pwm3/period'''
 
root@orangepi:~# '''echo 1000000 &gt; /sys/class/pwm/pwmchip0/pwm3/duty_cycle'''
 
root@orangepi:~# '''echo 1 &gt; /sys/class/pwm/pwmchip0/pwm3/enable'''
 
<ol start="4" style="list-style-type: lower-alpha;">
<li>Enter the following command on the command line to make pwm4 output &gt; a 50Hz square wave</li></ol>
 
root@orangepi:~# '''echo 4 &gt; /sys/class/pwm/pwmchip0/export'''
 
root@orangepi:~# '''echo 20000000 &gt; /sys/class/pwm/pwmchip0/pwm4/period'''
 
root@orangepi:~# '''echo 1000000 &gt; /sys/class/pwm/pwmchip0/pwm4/duty_cycle'''
 
root@orangepi:~# '''echo 1 &gt; /sys/class/pwm/pwmchip0/pwm4/enable'''
<li><p>'''In the above output'''</p>
<ol style="list-style-type: none;">
<li><p>a) 5002000 is the register base address of the i2c0 bus, and i2c-0 shown behind it is its corresponding i2c device node</p></li>
<li><p>b) 5002400 is the register base address of the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li>
<li><p>c) 5002800 is the register base address of the i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p></li></ol>
</li></ol>
|}
</li></ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>Then start testing i2c, first install i2c-tools</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo apt-get update'''</p>
<p>orangepi@orangepi:~$ '''sudo apt-get install -y i2c-tools'''</p>
|}
</li>
<li><p>Then connect an i2c device to the i2c pin of the 40pin connector</p></li>
<li><p>Then use the '''i2cdetect -y x''' x command. If the address of the connected i2c device can be detected, it means that i2c can be used normally.</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|
<big><p>'''Note that x in the i2cdetect -y x command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p>
<p>'''Different i2c device addresses are different. The 0x50 address in the picture below is just an example. Please refer to what you actually see.'''</p></big>
|}
<div class="figure">
[[File:zero2w-img177img174.png]]
</div><span id="how-to-install-and-use-wiringop-python"/li></spanol>== How to install and use wiringOP-Python ==
'''Note: The <span id="pin header on the 40pin interface is not soldered by default, and you need to solder it yourself before it can be used.'''-uart-test"></span>
'''wiringOP-Python is the Python language version of wiringOP library, used to operate the development board's GPIO, I2C, SPI, === 40pin UART and other hardware resources in the Python program'''test ===
'''Also please # As can be seen from the table below, the available uarts are uart2, uart3, uart4 and uart5. Please note that all the following commands are operated under the root useruart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial port.'''
<span iddiv style="how-to-install-wiringop-pythondisplay: flex;"></span>::{| class=== How to install wiringOP-Python === <ol "wikitable" style="listwidth:390px;margin-styleright: 20px;text-typealign: decimalcenter;"><li><p>First install dependency packages</p>|-<p>root@orangepi:~# | '''sudo apt-get updateGPIO NO.'''</p><p>root@orangepi:~# | '''sudo apt-get -y install git swig python3-dev python3-setuptoolsGPIO'''</p></li><li><p>Then use the following command to download the source code of wiringOP-Python</p></li></ol>| '''Function'''| '''pin'''Note that the following git clone|-| style="text-recursive command will automatically download the source code of wiringOP, because wiringOPalign: left;"|| style="text-Python depends on wiringOP. Please make sure there are no errors during the download process due to network problemsalign: left;"|| '''3.3V'''| '''1'''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-Python264''' root@orangepi:~# | '''git clone --recursive https://github.com/orangepi-xunlong/wiringOP-Python -b nextPI8''' root@orangepi:~# | '''cd wiringOPTWI1-PythonSDA''' root@orangepi:~/wiringOP-Python# | '''git submodule update --init --remote3''' <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>| '''263'''<p>root@orangepi:~# | '''cd wiringOP-PythonPI7'''</p><p>root@orangepi:~/wiringOP-Python# | '''python3 generateTWI1-bindings.py &gt; bindings.iSCL'''</p><p>root@orangepi:~/wiringOP-Python# | '''sudo python3 setup.py install5'''</p></li><li><p>Then enter the following command. If helpful information is output, it means wiringOP|-Python is successfully installed. Press the | '''q269''' key to exit the help information interface.</p></li></ol> root@orangepi:~/wiringOP-Python# | '''python3 -c &quot;import wiringpi; help(wiringpi)&quot;PI13''' Help on module wiringpi: NAME wiringpi DESCRIPTION # This file was automatically generated by SWIG (http:| '''PWM3//www.swig.org).UART4_TX'''| '''7'''# Version 4.0.2 # # Do not make changes to this file unless you know what you are doing|--modify # the SWIG interface file instead. <ol start="5" | style="list-styletext-typealign: decimalleft;">|<li><p>The steps to test whether wiringOP-Python is installed successfully under the python command line are as follows:</p><ol | style="list-styletext-typealign: lower-alphaleft;">|<li>First use the python3 command to enter the command line mode of &gt; python3</li></ol></li></ol> root@orangepi:~# | '''python3GND''' <ol start="2" style="list-style-type: lower-alpha;"><li>Then import the python module of wiringpi</li></ol> &gt;&gt;&gt; | '''import wiringpi;9''' <ol start="3" style="list-style-type: lower|-alpha;"><li>Finally, enter the following command to view the help information of &gt; wiringOP-Python. Press the q key to exit the help information &gt; interface.</li></ol> &gt;&gt;&gt; | '''help(wiringpi)226''' Help on module wiringpi: NAME wiringpi DESCRIPTION # This file was automatically generated by SWIG (http://www.swig.org). # Version 4.0.2 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. CLASSES builtins.object GPIO I2C Serial nes class GPIO(builtins.object) | GPIO(pinmode=0) | &gt;&gt;&gt; <span id="pin-gpio-port-test-1"></span>=== 40pin GPIO port test === '''Like wiringOP, wiringOP-Python can also determine which GPIO pin to operate by specifying the wPi number. Because there is no command to view the wPi number in wiringOP-Python, you can only view the board's wPi number and physics through the gpio command in wiringOP Correspondence of pins.PH2''' [[File:zero2w-img170.png]] <ol style="list-style-type: decimal;"><li><p>The following uses pin No. 7 - corresponding to GPIO PI13 - corresponding to wPi serial number 2 - as an example to demonstrate how to set the high and low levels of the GPIO port.</p><p>[[File:zero2w-img171.png]]</p></li><li><p>The steps for testing directly with commands are as follows:</p><ol style="list-style-type: lower-alpha;"><li><p>First set the GPIO port to output mode, where the first &gt; parameter of the | '''pinModeUART5_TX''' function is the serial number of &gt; the wPi corresponding to the pin, and the second parameter is &gt; the GPIO mode.</p><p>root@orangepi:~/wiringOP-Python# | '''python3 -c &quot;import wiringpi; \11'''</p><p>|-| '''from wiringpi import GPIO; wiringpi.wiringPiSetup() ; \227'''</p><p>| '''wiringpi.pinMode(2, GPIO.OUTPUT) ; &quot;PH3'''</p></li><li><p>Then set the GPIO port to output a low level. After setting, you &gt; can use a multimeter to measure the voltage value of the pin. &gt; If it is 0v, it means the low level is set successfully.</p><p>root@orangepi:~/wiringOP-Python# | '''python3 -c &quot;import wiringpi; \UART5_RX'''</p><p>| '''from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\13'''</p><p>|-| '''wiringpi.digitalWrite(2, GPIO.LOW)&quot;261'''</p></li><li><p>Then set the GPIO port to output a high level. After setting, &gt; you can use a multimeter to measure the voltage value of the &gt; pin. If it is 3.3v, it means the setting of the high level is &gt; successful.</p><p>root@orangepi:~/wiringOP-Python# | '''python3 -c &quot;import wiringpi; \PI5'''</p><p>| '''from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\TWI0_SCL/UART2_TX'''</p><p>| '''wiringpi.digitalWrite(2, GPIO.HIGH)&quot;15'''</p></li></ol></li>|-<li><p>The steps for testing in the command line of python3 are as follows| style="text-align:</p>left;"|<ol | style="list-styletext-typealign: lower-alphaleft;">|<li><p>First use the python3 command to enter the command line mode of &gt; python3</p><p>root@orangepi:~# | '''python33.3V'''</p></li><li><p>Then import the python module of wiringpi</p><p>&gt;&gt;&gt; | '''import wiringpi17'''</p><p>&gt;&gt;&gt; |-| '''from wiringpi import GPIO231'''</p></li><li><p>Then set the GPIO port to output mode, where the first parameter &gt; of the | '''pinModePH7'''function is the serial number of the wPi &gt; corresponding to the pin, and the second parameter is the GPIO &gt; mode.</p><p>&gt;&gt;&gt; | '''wiringpi.wiringPiSetup()SPI1_MOSI'''</p><p>0</p><p>&gt;&gt;&gt; | '''wiringpi.pinMode(2, GPIO.OUTPUT)19'''</p></li><li><p>Then set the GPIO port to output a low level. After setting, you &gt; can use a multimeter to measure the voltage value of the pin. &gt; If it is 0v, it means the low level is set successfully.</p>|-<p>&gt;&gt;&gt; | '''wiringpi.digitalWrite(2, GPIO.LOW)232'''</p></li><li><p>Then set the GPIO port to output a high level. After setting, &gt; you can use a multimeter to measure the voltage value of the &gt; pin. If it is 3.3v, it means the setting of the high level is &gt; successful.</p><p>&gt;&gt;&gt; | '''wiringpi.digitalWrite(2, GPIO.HIGH)PH8'''</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.pySPI1_MISO''' test program in the examples. The | '''blink.py21''' test program will set the voltage of all GPIO ports in the 40 Pin of the development board to continuously change high and low.</p><p>root@orangepi:~/wiringOP|-Python# | '''cd examples230'''</p><p>root@orangepi:~/wiringOP-Python/examples# | '''ls blink.pyPH6'''</p><p>| '''blink.pySPI1_CLK'''</p><p>root@orangepi:~/wiringOP-Python/examples| '''# python3 blink.py23'''</p></li></ol>|-<span id| style="pintext-spialign: left;"|| style="text-test-1align: left;"></span>|| '''GND'''| '''25'''=== 40pin SPI test ===|-| '''266'''# 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| '''PI10'''| '''TWI2-SDA/UART3_RX'''{| class="wikitable"'''27'''
|-
| '''GPIO NO.256'''| '''GPIOPI0'''| '''Function'''| '''Pin'''|style="text-align: left;"| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.29'''
|-
| '''271'''
| '''PI15'''
| style="text-align: left;"|
| '''31'''
|-
| '''268'''
| '''PI12'''
| '''PWM2'''
| '''33'''
|-
| '''258'''
| '''PI2'''
| style="text-align: left;"|
| '''3.3V35'''|-| '''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'''| '''1GPIO NO.'''|-
| '''2'''
| '''5V'''
| style="text-align: left;"|
|-
| '''264'''
| '''PI8'''
| '''TWI1-SDA'''
| '''3'''
|
| '''4'''
| '''5V'''
| style="text-align: left;"|
|-
| '''263'''
| '''PI7'''
| '''TWI1-SCL'''
| '''5'''
|
| '''6'''
| '''GND'''
| style="text-align: left;"|
|-
| '''269'''
| '''PI13'''
| '''PWM3/UART4_TX'''
| '''7'''
|
| '''8'''
| '''UART0_TX'''
| '''224'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''9'''
|
| '''10'''
| '''UART0_RX'''
| '''225'''
|-
| '''226'''
| '''PH2'''
| '''UART5_TX'''
| '''11'''
|
| '''12'''
| style="text-align: left;"|
| '''257'''
|-
| '''227'''
| '''PH3'''
| '''UART5_RX'''
| '''13'''
|
| '''14'''
| '''GND'''
| style="text-align: left;"|
|-
| '''261'''
| '''PI5'''
| '''TWI0_SCL/UART2_TX'''
| '''15'''
|
| '''16'''
| '''PWM4/UART4_RX'''
| '''270'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|
| '''18'''
| style="text-align: left;"|
| '''228'''
|-
| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|| '''20'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''232'''
| '''PH8'''
| '''SPI1_MISO'''
| '''21'''
|
| '''22'''
| '''TWI0_SDA/UART2_RX'''
| '''262'''
|-
| '''230'''
| '''PH6'''
| '''SPI1_CLK'''
| '''23'''
|
| '''24'''
| '''SPI1_CS0'''
| '''229'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''25'''
|
| '''26'''
| '''SPI1_CS1'''
| '''233'''
|-
| '''266'''
| '''PI10'''
| '''TWI2-SDA/UART3_RX'''
| '''27'''
|
| '''28'''
| '''TWI2-SCL/UART3_TX'''
| '''265'''
|-
| '''256'''
| '''PI0'''
| style="text-align: left;"|
| '''29'''
|
| '''30'''
| '''GND'''
| style="text-align: left;"|
|-
| '''271'''
| '''PI15'''
| style="text-align: left;"|
| '''31'''
|
| '''32'''
| '''PWM1'''
| '''267'''
|-
| '''268'''
| '''PI12'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
|-
| '''258'''
| '''PI2'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''76'''
|-
| '''272'''
| '''PI16'''
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''260'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''39'''
|
| '''40'''
| style="text-align: left;"|
| '''259'''
|}
</div>
<ol start="2" style="list-style-type: decimal;">
<li><p>In Linux systems, spi1 uart is turned off by default and needs to be turned on manually before it can be used. The opening steps are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First run '''orangepi-config'''. Ordinary users remember to add &gt; '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li><li><p>Then select '''System'''</p><p>[[File:zero2w-img80.png]]</p></li>
<li><p>Then select '''Hardware'''</p>
<p>[[File:zero2w-img81.png]]</p></li>
<li><p>Then use the keyboard's arrow keys to locate the position shown &gt; in the figure picture below, and then use the '''space''' to select the &gt; dtbo configuration of the SPI serial port you want to open.</p></li></ol></li></ol>
{| class="wikitable"style="width:800px;text-align: center;"|-| '''Multiplexing function in 40pin'''| '''Corresponding dtbo configuration'''
|-
| '''dtbo configuration40pin - uart2'''| '''illustratepi-uart2'''
|-
| '''spi140pin -cs0-cs1-spidevuart3'''| '''Open cs0 and cs1 of spi1 at the same timepi-uart3'''
|-
| '''spi140pin -cs0-spidevuart4'''| '''Only open cs0 of spi1pi-uart4'''
|-
| '''spi140pin -cs1-spidevuart5'''| '''Only open cs1 of spi1ph-uart5'''
|}
[[File:zero2w-img175.png]]
</ol>
<ol start="5" style="list-style-type: lower-alpha;">
<li><p>Then select '''&lt;Save&gt;''' to save</p>
<li><p>Then select '''&lt;Back&gt;'''</p>
<p>[[File:zero2w-img84.png]]</p></li>
<li><p>Then select '''&lt;Reboot&gt;''' to restart the system to make the &gt; configuration take effect.</p>
<p>[[File:zero2w-img85.png]]</p></li></ol>
</li></ol>
<!-- -->
<ol start="3" style="list-style-type: decimal;">
<li><p>Then check After entering the Linux system, first confirm whether there is a '''spidev1.x''' uart5 device node in the Linux system. If it exists, it means that the SPI1 configuration has taken effect.</p><p>orangepi@orangepi:~$ under '''ls /dev/spidev1*'''</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <p>/dev/spidev1.0 /dev/spidev1.1</pbig><p>'''Note that only when you open spi1-cs0-cs1-spidev, you will see the device nodes of the two spilinux5.4 system is /dev/ttyASx.'''</p></libig><li><p>Then you can use the '''spidev_test.py''' program in examples to test the SPI loopback function. The '''spidev_test.py''' program needs to specify the following two parameters:</p>|}<ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li>|-| <p>orangepi@orangepi:~$ '''--channells /dev/ttyS*''': Specify the channel number of SPI</p></li><li><p>'''--port''': Specify the port number of the SPI</p><dev/li>ttySx</olp>|}
</li>
<li><p>Without shorting Then start testing the mosi uart interface. First use Dupont wire to short-circuit the rx and miso tx pins of SPI1, the output result uart interface to be tested.</p></li><li><p>Use the '''gpio''' command in wiringOP to test the loopback function of running spidev_test.py is the serial port as followsshown below. You If you can see the following print, it means the serial port communication is normal.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that the data last x in the gpio serial /dev/ttySx command needs to be replaced with the serial number of TX and RX are inconsistentthe corresponding uart device node.'''</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>rootorangepi@orangepi:~/wiringOP-Python# $ '''cd examplesgpio serial /dev/ttySx # linux-6.1 test command'''</p><p>orangepi@orangepi:~$ '''gpio serial /li>dev/ttyASx # linux-5.4 test command'''</olp>
root@orangepi:~/wiringOP-Python/examples# '''python3 spidev_test.py \'''
'''<p>Out: 0: -&gt; 0</p><p>Out: 1: -channel &gt; 1 </p><p>Out: 2: -&gt; 2</p><p>Out: 3: -port 0'''&gt; 3^C</p>|}</li></ol>
spi mode: 0x0<span id="pwm-test-method"></span>
max speed: 500000 Hz (500 KHz)=== PWM test method ===
Opening device /dev/spidev1.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="list-style-type: decimal;"><li><p>Then use Dupont wire to short-circuit # As can be seen from 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 followsfollowing table, you can see If the data sent and received available pwm are the samepwm1, pwm2, 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 |......@......pwm3 and pwm4.…| <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;"
|-
| '''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'''
| '''TWI1-SDA'''
| '''3'''
|
| '''4'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''263'''
| '''TWI1-SCL'''
| '''5'''
|
| '''6'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''<span style="color:#FF0000">269</span>'''| '''<span style="color:#FF0000">PI13</span>'''| '''<span style="color:#FF0000">PWM3</span>/UART4_TX'''| '''<span style="color:#FF0000">7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224</span>'''
|-
| style="text-align: left;"|
| '''GND'''
| '''9'''
|| '''10'''| '''UART0_RX'''| '''PH1'''| '''225'''|-
| '''226'''
| '''PH2'''
| '''UART5_TX'''
| '''11'''
|
| '''12'''
| style="text-align: left;"|
| '''PI1'''
| '''257'''
|-
| '''227'''
| '''UART5_RX'''
| '''13'''
|
| '''14'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''261'''
| '''TWI0_SCL/UART2_TX'''
| '''15'''
|
| '''16'''
| '''PWM4/UART4_RX'''
| '''PI14'''
| '''270'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|
| '''18'''
| style="text-align: left;"|
| '''PH4'''
| '''228'''
|-
| '''231'''
| '''SPI1_MOSI'''
| '''19'''
|
| '''20'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''232'''
| '''SPI1_MISO'''
| '''21'''
|
| '''22'''
| '''TWI0_SDA/UART2_RX'''
| '''PI6'''
| '''262'''
|-
| '''230'''
| '''SPI1_CLK'''
| '''23'''
|
| '''24'''
| '''SPI1_CS0'''
| '''PH5'''
| '''229'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|
| '''26'''
| '''SPI1_CS1'''
| '''PH9'''
| '''233'''
|-
| '''266'''
| '''TWI2-SDA/UART3_RX'''
| '''27'''
|
| '''28'''
| '''TWI2-SCL/UART3_TX'''
| '''PI9'''
| '''265'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|
| '''30'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|| '''32'''| '''PWM1'''| '''PI11'''| '''267'''|-| '''<span style="color:#FF0000">268</span>'''| '''<span style="color:#FF0000">PI12</span>'''| '''<span style="color:#FF0000">PWM2</span>'''| '''33'''|| '''34'''| '''GND'''| <span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"|>33</span>'''
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''PC12'''
| '''76'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|
| '''40'''
| style="text-align: left;"|
| '''PI3'''
| '''259'''
|}
 <ol start{| class="2wikitable" style="list-stylewidth:390px;margin-typeright: decimal20px;"><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="listtext-style-typealign: lower-alphacenter;"><li><p>First run '''orangepi|-config'''. Ordinary users remember to add &gt; | '''sudoPin''' permissions.</p><p>orangepi@orangepi:~$ | '''sudo orangepi-configFunction'''</p></li><li><p>Then select | '''SystemGPIO'''</p><p>[[File:zero2w-img80.png]]</p></li><li><p>Then select '''Hardware| '''</p><p>[[File:zero2w-img81GPIO NO.png]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown &gt; in the picture below, and then use the '''space''' to select the &gt; corresponding i2c configuration in the picture below.</p></li></ol></li></ol> {| class="wikitable"
|-
| '''Multiplexing function in 40pin2'''| '''Corresponding dtbo configuration5V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - i2c04'''| '''pi-i2c05V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - i2c16'''| '''pi-i2c1GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - i2c28'''| '''pi-i2c2UART0_TX'''|} [[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 i2cPH0'''</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>''224'In the above output'''</p></li></ol> <!-- --><ol start="4" style="list-style-type: lower-alpha;"><li><p>002000 is the register base address of the i2c0 bus, and i2c-0 shown behind it is its corresponding i2c device node</p></li><li><p>5002400 is the register base address of the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li><li><p>5002800 is the register base address of the i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p></li></ol> <!-- --><ol start="4" style="list-style-type: decimal;"><li><p>Then start testing i2c, first install i2c-tools</p><p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo''' '''apt-get install -y i2c-tools'''</p></li><li><p>Then connect an i2c device to the i2c pin of the 40pin connector. Here we take the DS1307 RTC module as an example.</p><p>[[File:zero2w-img178.png]]</p></li><li><p>Then use the '''i2cdetect -y x'''command. If the address of the connected i2c device can be detected, it means that the i2c device is connected correctly.</p><p>'''Note that x in the i2cdetect -y x command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p></li></ol> [[File:zero2w-img179.png]] <ol start="7" style="list-style-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.10'''| '''GPIOUART0_RX'''| '''FunctionPH1'''| '''Pin'''|| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.225'''
|-
| '''12'''
| style="text-align: left;"|
| '''PI1'''
| '''257'''
|-
| '''14'''
| '''GND'''
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|
| '''2'''
| '''5V'''
| style="text-align: left;"|
|-
| '''<span style="color:#FF0000">16</span>'''
| '''<span style="color:#FF0000">PWM4</span>/UART4_RX'''
| '''<span style="color:#FF0000">PI14</span>'''
| '''<span style="color:#FF0000">270</span>'''
|-
| '''18'''
| style="text-align: left;"|
| '''PH4'''
| '''228'''
|-
| '''26420'''| '''PI8'''| '''TWI1-SDA'''| '''3'''|| '''4'''| '''5VGND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26322'''| '''PI7TWI0_SDA/UART2_RX'''| '''TWI1PI6'''| '''262'''|-| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''28'''| '''TWI2-SCL/UART3_TX'''| '''5PI9'''|'''265'''|-| '''630'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''269<span style="color:#FF0000">32</span>'''| '''PI13<span style="color:#FF0000">PWM1</span>'''| '''PWM3<span style="color:#FF0000">PI11</UART4_TXspan>'''| '''7<span style="color:#FF0000">267</span>'''|-| '''8'''| '''UART0_TX34'''| '''PH0GND'''| '''224'''|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''9'''
|
| '''10'''
| '''UART0_RX'''
| '''PH1'''
| '''225'''
|-
| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''1236'''
| style="text-align: left;"|
| '''PI1PC12'''| '''25776'''
|-
| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|| '''14'''| '''GND38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| '''40'''
| style="text-align: left;"|
| '''PI3'''
| '''259'''
|}
</div>
 
<ol start="2" style="list-style-type: decimal;">
<li><p>pwm is turned off by default in Linux systems and needs to be turned on manually to use it. The opening steps are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First run '''orangepi-config'''. Ordinary users remember to add '''sudo''' permissions.</p>
{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''261sudo orangepi-config'''</p>| }</li><li><p>Then select '''PI5System'''</p>| '''TWI0_SCL<p>[[File:zero2w-img80.png]]</p></UART2_TX'''li>| <li><p>Then select '''15Hardware'''</p>|<p>[[File:zero2w-img81.png]]</p></li>| <li><p>Then use the keyboard's arrow keys to locate the position shown in the figure below, and then use the '''16space'''to select the configuration corresponding to the pwm you want to open.</p>| '''PWM4<p>[[File:zero2w-img176.png]]</p></UART4_RX'''li>| <li><p>Then select '''PI14&lt;Save&gt;'''to save</p><p>[[File:zero2w-img83.png]]</p></li>| <li><p>Then select '''270&lt;Back&gt;'''</p>|-| style="text-align<p>[[File: left;"|| style="textzero2w-align: left;"|img84.png]]</p></li>| <li><p>Then select '''3.3V&lt;Reboot&gt;'''to restart the system to make the configuration take effect.</p>| '''17'''<p>[[File:zero2w-img85.png]]</p></li></ol>|</li>| '''18'''<li><p>After restarting, you can start the PWM test</p>{| class="wikitable" style="textbackground-aligncolor:#ffffdc;width: left800px;"|| '''PH4'''| '''228'''
|-
| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|| <big><p>'''20Please execute the following commands under the root user.'''</p></big>| '''GND'''}| <ol style="textlist-style-aligntype: leftlower-alpha;"|><li><p>Enter the following command on the command line to make pwm1 output a 50Hz square wave</p>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| <p>root@orangepi:~# '''232echo 1 &gt; /sys/class/pwm/pwmchip0/export'''</p>| <p>root@orangepi:~# '''PH8echo 20000000 &gt; /sys/class/pwm/pwmchip0/pwm1/period'''</p>| <p>root@orangepi:~# '''SPI1_MISOecho 1000000 &gt; /sys/class/pwm/pwmchip0/pwm1/duty_cycle'''</p>| <p>root@orangepi:~# '''21echo 1 &gt; /sys/class/pwm/pwmchip0/pwm1/enable'''</p>|}| '''22'''</li>| '''TWI0_SDA<li><p>Enter the following command on the command line to make pwm2 output a 50Hz square wave</p></UART2_RX'''li>{| '''PI6'''| '''262'''class="wikitable" style="width:800px;"
|-
| root@orangepi:~# '''230echo 2 &gt; /sys/class/pwm/pwmchip0/export'''| root@orangepi:~# '''PH6echo 20000000 &gt; /sys/class/pwm/pwmchip0/pwm2/period'''| root@orangepi:~# '''SPI1_CLKecho 1000000 &gt; /sys/class/pwm/pwmchip0/pwm2/duty_cycle'''| root@orangepi:~# '''23echo 1 &gt; /sys/class/pwm/pwmchip0/pwm2/enable'''|}| '''24'''</ol>| '''SPI1_CS0'''<ol start="3" style="list-style-type: lower-alpha;">| '''PH5'''<li>Enter the following command on the command line to make pwm3 output a 50Hz square wave</li>{| '''229'''class="wikitable" style="width:800px;"
|-
| style="text-align: left;"|| style="text-alignroot@orangepi: left;"|| ~# '''GNDecho 3 &gt; /sys/class/pwm/pwmchip0/export'''| root@orangepi:~# '''25echo 20000000 &gt; /sys/class/pwm/pwmchip0/pwm3/period'''|| root@orangepi:~# '''26echo 1000000 &gt; /sys/class/pwm/pwmchip0/pwm3/duty_cycle'''| root@orangepi:~# '''SPI1_CS1echo 1 &gt; /sys/class/pwm/pwmchip0/pwm3/enable'''| '''PH9'''}</ol><ol start="4" style="list-style-type: lower-alpha;"><li>Enter the following command on the command line to make pwm4 output a 50Hz square wave</li>{| '''233'''class="wikitable" style="width:800px;"
|-
| root@orangepi:~# '''266echo 4 &gt; /sys/class/pwm/pwmchip0/export'''| root@orangepi:~# '''PI10echo 20000000 &gt; /sys/class/pwm/pwmchip0/pwm4/period'''| root@orangepi:~# '''TWI2-SDAecho 1000000 &gt; /sys/class/pwm/pwmchip0/pwm4/UART3_RXduty_cycle'''| root@orangepi:~# '''27echo 1 &gt; /sys/class/pwm/pwmchip0/pwm4/enable'''|}| '''28'''| '''TWI2<div class="figure"> [[File:zero2w-img177.png]] </div></ol></li></ol><span id="how-to-install-and-use-wiringop-SCLpython"></UART3_TX'''span> == How to install and use wiringOP-Python ==| '''PI9'''{| '''265'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big>'''256Note: The pin header on the 40pin interface is not soldered by default, and you need to solder it yourself before it can be used.'''</big>| '''PI0'''}{| styleclass="text-align: left;wikitable"|| '''29'''|| '''30'''| '''GND'''| style="textbackground-aligncolor: left#ffffdc;"|| style="text-alignwidth: left800px;"|
|-
| <big>'''271wiringOP-Python is the Python language version of wiringOP library, used to operate the development board's GPIO, I2C, SPI, UART and other hardware resources in the Python program'''| '''PI15Also please note that all the following commands are operated under the root user.'''</big>| } <span id="how-to-install-wiringop-python"></span>=== How to install wiringOP-Python === <ol style="textlist-style-aligntype: leftdecimal;"|>| '''31'''<li><p>First install dependency packages</p>{|| '''32'''| '''PWM1'''| '''PI11'''| '''267'''class="wikitable" style="width:800px;"
|-
| '''268'''| <p>root@orangepi:~# '''PI12sudo apt-get update'''</p>| <p>root@orangepi:~# '''PWM2sudo apt-get -y install git swig python3-dev python3-setuptools'''</p>| '''33'''}|</li>| '''34'''| '''GND'''<li><p>Then use the following command to download the source code of wiringOP-Python</p></li>{| styleclass="text-align: left;wikitable"|| style="textbackground-aligncolor:#ffffdc;width: left800px;"|
|-
| <big>'''258Note 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.'''| '''PI2'''| style="textIf there is a problem downloading the code from GitHub, you can directly use the wiringOP-alignPython source code that comes with the Linux image. The storage location is: left;"|| '''35/usr/src/wiringOP-Python'''</big>|}{| '''36'''| class="wikitable" style="text-alignwidth: left800px;"|| '''PC12'''| '''76'''
|-
| root@orangepi:~# '''272git clone --recursive https://github.com/orangepi-xunlong/wiringOP-Python -b next'''| root@orangepi:~# '''PI16cd wiringOP-Python'''| style="textroot@orangepi:~/wiringOP-align: left;"|| Python# '''37git submodule update --init --remote'''|}| '''38'''</ol>| <ol start="3" style="textlist-style-aligntype: leftdecimal;"|>| '''PI4'''<li><p>Then use the following command to compile wiringOP-Python and install it into the Linux system of the development board</p>{| '''260'''class="wikitable" style="width:800px;"
|-
| style="text-align: left;"|| style="text-align<p>root@orangepi: left;"|| ~# '''GNDcd wiringOP-Python'''</p>| '''39'''|| <p>root@orangepi:~/wiringOP-Python# '''40'''| style="textpython3 generate-align: leftbindings.py &gt;"|| '''PI3bindings.i'''</p>| <p>root@orangepi:~/wiringOP-Python# '''259sudo 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>
{| class="wikitable" style="width:800px;"
|-
|
root@orangepi:~/wiringOP-Python# '''python3 -c &quot;import wiringpi; help(wiringpi)&quot;'''
<ol start="2" style="list-style-type: decimal;"><li><p>In Linux systems, uart is turned off by default and needs to be turned Help on manually before it can be used. The opening steps are as follows:: </p><ol style="list-style-type: lower-alpha;"><li><p>First run '''orangepi-config'''. Ordinary users remember to add &gt; '''sudo''' permissions.</p><p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p></li><li><p>Then select '''System'''</p><p>[[File:zero2w-img80.png]]</p></li><li><p>Then select '''Hardware'''</p><p>[[Filemodule wiringpi:zero2w-img81.png]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown &gt; in the picture below, and then use the '''space''' to select the &gt; serial port you want to open.</p></li></ol></li></ol>
{| class="wikitable"
|-
| '''Multiplexing function in 40pin'''
| '''Corresponding dtbo configuration'''
|-
| '''40pin - uart2'''
| '''pi-uart2'''
|-
| '''40pin - uart3'''
| '''pi-uart3'''
|-
| '''40pin - uart4'''
| '''pi-uart4'''
|-
| '''40pin - uart5'''
| '''ph-uart5'''
|}
[[File:zero2w-img175.png]]NAME
<ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select '''&lt;Save&gt;''' to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''&lt;Back&gt;'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''&lt;Reboot&gt;''' to restart the system to make the &gt; configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol>wiringpi
<!-- -->
<ol start="3" style="list-style-type: decimal;">
<li><p>After entering the Linux system, first confirm whether there is a uart5 device node under '''<span class="mark">/dev</span>'''</p>
<p>'''注意, linux5.4系统为/dev/ttyASx.'''</p>
<p>orangepi@orangepi:~$ '''ls /dev/ttyS*'''</p>
<p>/dev/ttySx</p></li>
<li><p>Then start testing the uart interface. First use Dupont wire to short-circuit the rx and tx pins of the uart interface to be tested.</p></li>
<li><p>Use the '''gpio''' command in wiringOP to test the loopback function of the serial port as shown below. If you can see the following print, it means the serial port communication is normal.</p>
<p>'''Note that the last x in the gpio serial /dev/ttySx command needs to be replaced with the serial number of the corresponding uart device node.'''</p>
<p>orangepi@orangepi:~$ '''gpio serial /dev/ttySx # linux-6.1 test command'''</p>
<p>orangepi@orangepi:~$ '''gpio serial /dev/ttyASx # linux-5.4 test command'''</p>
<p>Out: 0: -&gt; 0</p>
<p>Out: 1: -&gt; 1</p>
<p>Out: 2: -&gt; 2</p>
<p>Out: 3: -&gt; 3^C</p></li>
<li><p>Finally, you can 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>
<p>'''Note that the x in /dev/ttySx or /dev/ttyASx in the command needs to be replaced with the serial number of the corresponding uart device node.'''</p>
<p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p>
<p>root@orangepi:~/wiringOP-Python/examples# '''python3 serialTest.py --device &quot;/dev/ttySx&quot; # linux6.1 use'''</p>
<p>root@orangepi:~/wiringOP-Python/examples# '''python3 serialTest.py --device &quot;/dev/ttyASx&quot; # linux5.4 use'''</p>
<p>Out: 0: -&gt; 0</p>
<p>Out: 1: -&gt; 1</p>
<p>Out: 2: -&gt; 2</p>
<p>Out: 3: -&gt; 3</p>
<p>Out: 4:^C</p>
<p>exit</p></li></ol>
<span id="hardware-watchdog-test"></span>== Hardware watchdog test ==DESCRIPTION
The watchdog_test program is pre-installed in the Linux system released : # This file was automatically generated by Orange Pi and can be tested directlySWIG (http://www.swig.org).
The method to run the watchdog_test program is as follows:# Version 4.0.2
<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><p>orangepi@orangepi:~$ '''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: # Do not make changes to this file unless you know what you are doing-the-chipid-of-h618-chip"></span>== Check the chipid of H618 chip ==modify
: # the SWIG interface file instead.|}</ol><ol start="5" style="list-style-type: decimal;"><li><p>The command steps to view test whether wiringOP-Python is installed successfully under the H618 chip chipid is python command line are as follows. The chipid of each chip is different, so you can :</p><ol style="list-style-type: lower-alpha;"><li>First use chipid the python3 command to distinguish multiple development boards.enter the command line mode of &gt; python3</li>{| class="wikitable" style="width:800px;" |-| orangepiroot@orangepi:~$ # '''cat /sys/class/sunxi_info/sys_info | grep &quot;chipid&quot;python3'''|}sunxi_chipid : 338020004c0048080147478824681ed1</ol><span idol start="python2" style="list-relatedstyle-instructionstype: lower-alpha;"><li>Then import the python module of wiringpi</spanli>{| class="wikitable" style= Python related instructions =="width:800px;" |-| &gt;&gt;&gt; '''import wiringpi;'''|}</ol><span idol start="how3" style="list-tostyle-compiletype: lower-and-install-python-source-codealpha;"><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.</spanli>{| class="wikitable" style== How to compile and install Python source code ==="width:800px;" |-| &gt;&gt;&gt; '''help(wiringpi)'''
'''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.'''Help on module wiringpi:
'''The following demonstration is to compile and install the latest version of Python 3.9. If you want to compile and install other versions of Python, the method is the same (you need to download the source code corresponding to the Python you want to install).'''
<ol style="list-style-type: decimal;"><li><p>First install the dependency packages needed to compile Python</p><p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y build-essential zlib1g-dev \'''</p><p>'''libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev \'''</p><p>'''libreadline-dev libffi-dev curl libbz2-dev'''</p></li><li><p>Then download the latest version of Python3.9 source code and unzip it</p><p>orangepi@orangepi:~$ '''wget \'''</p><p>[https://www.python.org/ftp/python/3.9.10/Python-3.9.10.tgz '''https://www.python.org/ftp/python/3.9.10/Python-3.9.10.tgz''']</p><p>orangepi@orangepi:~$ '''tar xvf Python-3.9.10.tgz'''</p></li><li><p>Then run the configuration command</p><p>orangepi@orangepi:~$ '''cd Python-3.9.10'''</p><p>orangepi@orangepi:~$ '''./configure --enable-optimizations'''</p></li><li><p>Then compile and install Python3.9. The compilation time takes about half an hour.</p><p>orangepi@orangepi:~$ '''make -j4'''</p><p>orangepi@orangepi:~$ '''sudo make altinstall'''</p></li><li><p>After installation, you can use the following command to check the version number of the Python you just installed.</p><p>orangepi@orangepi:~$ '''python3.9 --version'''</p><p>'''Python 3.9.10'''</p></li><li><p>Then update pip</p><p>orangepi@orangepi:~$ '''/usr/local/bin/python3.9 -m pip install --upgrade pip'''</p></li></ol>NAME
<span id="how-to-replace-pip-source-in-python"></span>=== How to replace pip source in Python ===:wiringpi
'''The default source used by Linux system pip is the official source of Python. However, accessing the official source of Python in China is very slow, and the installation of Python software packages often fails due to network reasons. So when using pip to install the Python library, please remember to change the pip source.'''
<ol style="list-style-type: decimal;"><li><p>First install '''python3-pip'''</p><p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y python3-pip'''</p></li><li><p>How to permanently change the pip source under Linux</p><ol style="list-style-type: lower-alpha;"><li><p>First create a new '''~/.pip''' directory, then add the &gt; '''pip.conf''' configuration file, and set the pip source in it &gt; to Tsinghua source.</p><p>orangepi@orangepi:~$ '''mkdir -p ~/.pip'''</p><p>orangepi@orangepi:~$ '''cat &lt;&lt;EOF &gt; ~/.pip/pip.conf'''</p><p>'''[global]'''</p><p>'''timeout = 6000'''</p><p>'''index-url = https://pypi.tuna.tsinghua.edu.cn/simple'''</p><p>'''trusted-host = pypi.tuna.tsinghua.edu.cn'''</p><p>'''EOF'''</p></li><li><p>Then use pip3 to install the Python library very quickly</p></li></ol></li><li><p>How to temporarily change the pip source under Linux, where '''&lt;packagename&gt;''' needs to be replaced with a specific package name</p><p>orangepi@orangepi:~$ '''pip3 install &lt;packagename&gt; -i \'''</p><p>'''https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn'''</p></li></ol>DESCRIPTION
<span id="how-to-install-docker"><: # This file was automatically generated by SWIG (http:/span>== How to install Docker ==/www.swig.org).
The Linux image provided by Orange Pi has Docker pre-installed, but the Docker service is not turned on by default: # Version 4. 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 system0.2
orangepi@orangepi:~$ '''enable_docker.sh'''#
You can use the following command : # Do not make changes to test docker. If '''hellothis file unless you know what you are doing-world''' can be run, docker can be used normally.-modify
orangepi@orangepi:~$ '''docker run hello-world'''# the SWIG interface file instead.
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-worldCLASSES
256ab8fe8778: Pull completebuiltins.object
Digest: sha256:7f0a9f93b4aa3022c3a4c147a449ef11e0941a1fd0bf4a8e6c9408b2600777c5GPIO
Status: Downloaded newer image for hello-world:latestI2C
'''Hello from Docker!'''::Serial
'''This message shows that your installation appears to be working correctly.'''::nes
'''.….'''
When using the docker command, if you are prompted for '''permission denied''', please add the current user to the docker user group so that you can run the docker command without sudo:class GPIO(builtins.object)
orangepi@orangepi:~$ '''sudo usermod -aG docker $USER'''| GPIO(pinmode=0)
'''Note: You need to log out and log in again to the system to take effect. You can also restart the system.'''|
<span id="how-to-install-home-assistant"></span>
== How to install Home Assistant ==
'''Note that this article will only provide methods for installing Home Assistant in Ubuntu or Debian systems. For detailed usage of Home Assistant, please refer to the official documentation or corresponding books.'''&gt;&gt;&gt;|}</ol></li></ol><span id="pin-gpio-port-test-1"></span>
<span id="installation-via-docker"></span>=== Installation via docker 40pin GPIO port test ===
<ol {| class="wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;"><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>| <pbig>orangepi@orangepi:~$ '''docker search homeassistant'''</p></li><li><p>Then use the following command Like wiringOP, wiringOP-Python can also determine which GPIO pin to download operate by specifying the Docker image of Home Assistant to your local computerwPi number. The image size Because there 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/home-assistant:latest</p><p>docker.io/homeassistant/home-assistant:latest</p></li><li><p>Then you can use the following no command to view the docker image of Home Assistant you just downloaded</p><p>orangepi@orangepi:~$ '''docker images homeassistant/homewPi number in wiringOP-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 Python, you can run the Home Assistant docker container</p><p>orangepi@orangepi:~$ '''docker run -d \'''</p><p>'''--name homeassistant \'''</p><p>'''--privileged \'''</p><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 only view the development board: 8123】in the browser to see the Home Assistant interface</p><p>'''It takes a while for s wPi number and physics through 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 processgpio command in wiringOP Correspondence of pins.'''</p><div class="figure"big>
[[File:zero2w-img180img170.png|center]]|}
<ol style="list-style-type: decimal;"><li><p>The following uses pin No. 7 - corresponding to GPIO PI13 - corresponding to wPi serial number 2 - as an example to demonstrate how to set the high and low levels of the GPIO port.</p><p>[[File:zero2w-img171.png]]</divp></li><li><p>The steps for testing directly with commands are as follows:</p><ol style="list-style-type: lower-alpha;"><li><p>First set the GPIO port to output mode, where the first parameter of the '''pinMode''' function is the serial number of the wPi corresponding to the pin, and the second parameter is the GPIO mode.</p>{| class="wikitable" style="width:800px;" |-| <p>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 enter your set the GPIO port to output a low level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 0v, it means the low level is set successfully.</p>{| class="wikitable" style="width:800px;" |-| <p>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;'''name</p>|}</li><li><p>Then set the GPIO port to output a high level. After setting, usernameyou can use a multimeter to measure the voltage value of the pin. If it is 3.3v, it means the setting of the high level is successful.</p>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP-Python# ''' and python3 -c &quot;import wiringpi; \'''</p><p>'''passwordfrom wiringpi import GPIO; wiringpi.wiringPiSetup() ;\''' and click </p><p>'''Create Accountwiringpi.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><div ol style="list-style-type: lower-alpha;"><li><p>First use the python3 command to enter the command line mode of python3</p>{| class="figurewikitable" style="width:800px;"|-| <p>root@orangepi:~# '''python3'''</p>|}</li>[[File<li><p>Then import the python module of wiringpi</p>{| class="wikitable" style="width:zero2w800px;" |-img181.png]]| <p>&gt;&gt;&gt; '''import wiringpi'''</p><p>&gt;&gt;&gt; '''from wiringpi import GPIO'''</divp>|}</li><li><p>Then follow set the interface prompts GPIO port to set according output mode, where the first parameter of the '''pinMode'''function is the serial number of the wPi corresponding to your own preferencesthe pin, and then click Nextthe second parameter is the GPIO mode.</p>{| class="wikitable" style="width:800px;" |-| <p>&gt;&gt;&gt; '''wiringpi.wiringPiSetup()'''</p><div 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 can use a multimeter to measure the voltage value of the pin. If it is 0v, it means the low level is set successfully.</p>{| class="figurewikitable" style="width:800px;" |-| <p>&gt;&gt;&gt; '''wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.LOW</span>)'''</p>|}</li>[[File<li><p>Then set the GPIO port to output a high level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 3.3v, it means the setting of the high level is successful.</p>{| class="wikitable" style="width:zero2w800px;" |-img182| <p>&gt;&gt;&gt; '''wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.png]]HIGH</span>)'''</p>|}</divli></ol></li><li><p>Then click NextFor 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><div {| class="figurewikitable"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>
[[File:zero2w<span id="pin-img183.png]]spi-test-1"></span>
</div></li><li><p>Then click Finish</p><div class="figure">== 40pin SPI test ===
[[File:zero2w-img184.png]]# As can be seen from the table below, the spi available for the 40pin interface is spi1, and there are two chip select pins cs0 and cs1
</div></listyle="display: flex;"><li><p>The main interface finally displayed by Home Assistant is as shown below</p><p>[[File:zero2w-img185.png]]</p></li><li><p>Method to stop Home Assistant container</p><ol :{| class="wikitable" style="listwidth:390px;margin-styleright: 20px;text-typealign: lower-alphacenter;"><li><p>The command to view the docker container is as follows</p>|-<p>orangepi@orangepi:~$ | '''docker ps -aGPIO NO.'''</p></li><li><p>The command to stop the Home Assistant container is as follows</p>| '''GPIO'''<p>orangepi@orangepi:~$ | '''docker stop homeassistantFunction'''</p></li><li><p>The command to delete the Home Assistant container is as follows</p><p>orangepi@orangepi:~$ | '''docker rm homeassistantPin'''</p></li></ol></li></ol> <span id|-| style="installationtext-via-pythonalign: left;"></span>|| style=== Installation via python ==="text-align: left;"|| '''Before installation, please change the source of pip to a domestic source to speed up the installation of Python packages3. For the configuration method, see the instructions in the section &quot;[[\l3V'''|How to Change the Pip Source of Python]]&quot;'''1''' <ol style="list-style|-type: decimal;"><li><p>First install dependency packages</p>| '''264'''<p>orangepi@orangepi:~$ | '''sudo apt-get updatePI8'''</p><p>orangepi@orangepi:~$ | '''sudo apt-get install -y python3 python3TWI1-dev python3-venv \SDA'''</p><p>| '''3'python3''|-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \| '''263'''</p><p>| '''libopenjp2-7 libtiff5 libturbojpeg0-dev tzdataPI7'''</p><p>| '''If it is debian12, please use the following command:TWI1-SCL'''</p><p>orangepi@orangepi:~$ | '''sudo apt-get update5'''</p><p>orangepi@orangepi:~$ |-| '''sudo apt-get install -y python3 python3-dev python3-venv \269'''</p><p>| ''''python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \PI13'''</p><p>| '''libopenjp2-7 libturbojpeg0-dev tzdataPWM3/UART4_TX'''</p></li><li><p>Then you need to compile and install Python3.9. For the method, please refer to the [[\l|'''Python source code compilation and installation method7''']] section.</p><p>|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''The default Python version of Debian Bullseye is Python3.9, so there is no need to compile and install it.'''</p><p>|-| '''The default Python version of Ubuntu Jammy is Python3.10, so there is no need to compile and install it.226'''</p><p>| '''The default Python version of Debian Bookworm is Python3.11, so there is no need to compile and install it.PH2'''</p></li><li><p>Then create a Python virtual environment</p><p>| '''Debian Bookworm is python3.11, please remember to replace the corresponding command.UART5_TX'''</p><p>orangepi@orangepi:~$ | '''sudo mkdir /srv/homeassistant11'''</p><p>orangepi@orangepi:~$ |-| '''sudo chown orangepi:orangepi /srv/homeassistant227'''</p><p>orangepi@orangepi:~$ | '''cd /srv/homeassistantPH3'''</p><p>orangepi@orangepi:~$ | '''UART5_RX''python3.9 '| '''13'''|-m venv .| '''261'''</p><p>orangepi@orangepi:~$ | '''source bin/activatePI5'''</p><p>(homeassistant) orangepi@orangepi:| '''TWI0_SCL/srv/homeassistant$</p></li>UART2_TX'''<li><p>Then install the required Python packages</p><p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ | '''python3 -m pip install wheel15'''</p></li><li><p>Then you can install Home Assistant Core</p>|-| style="text-align: left;"|<p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ | style="text-align: left;"|| '''3.3V''pip3 install homeassistant'| '''17'''</p></li><li><p>Then enter the following command to run Home Assistant Core</p>|-<p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ '''hass| '''</pspan style="color:#FF0000">231</lispan><li><p>Then enter【'''development board IP address: 8123| '''】 in the browser to see the Home Assistant interface</pspan style="color:#FF0000">PH7<p/span>'''When you run the hass command for the first time, some libraries and dependency packages necessary for operation will be downloaded, installed and cached. This process may take several minutes. Note that you cannot see the Home Assistant interface in the browser at this time. Please wait for a while and then refresh it.| '''</p><div classspan style="figurecolor:#FF0000"> [[File:zero2w-img180.png]] </div></li></olSPI1_MOSI</span>''' | '''<span idstyle="opencv-installation-methodcolor:#FF0000">19</span>'''== OpenCV installation method ==|-| '''<span idstyle="use-apt-to-install-opencvcolor:#FF0000">232</span>'''| '''<span style=== Use apt to install OpenCV === <ol style="list-style-type: decimal;"color:#FF0000"><li><p>The installation command is as followsPH8</p><pspan>orangepi@orangepi:~$ '''sudo apt-get update| '''</pspan style="color:#FF0000">SPI1_MISO<p/span>orangepi@orangepi:~$ '''sudo apt-get install -y libopencv-dev python3-opencv| '''</pspan style="color:#FF0000">21</lispan>'''|-| '''<li><pspan style="color:#FF0000">Then use the following command to print the version number of OpenCV. The output is normal, indicating that the OpenCV installation is successful.230</pspan>'''| '''<ol span style="list-style-typecolor: lower-alpha;#FF0000"><li><p>The version of OpenCV in Ubuntu22.04 is as follows:PH6</p><pspan>orangepi@orangepi:~$ '''python3 -c &quot;import cv2; print(cv2.__version__)&quot;| '''</pspan style="color:#FF0000">SPI1_CLK<p/span>'''4.5.4| '''</pspan style="color:#FF0000">23</li><lispan><p>The version of OpenCV in Ubuntu20.04 is as follows:</p><p>orangepi@orangepi:~$ '''python3 |-c &quot;import cv2| style="text-align: left; print(cv2.__version__)&quot"|| style="text-align: left;"|| '''GND'''</p><p>| '''4.2.025'''</p></li><li><p>The version of OpenCV in Debian11 is as follows:</p>|-<p>orangepi@orangepi:~$ | '''python3 -c &quot;import cv2; print(cv2.__version__)&quot;266'''</p><p>| '''4.5.1PI10'''</p></li><li><p>The version of OpenCV in Debian12 is as follows:</p><p>orangepi@orangepi:~$ | '''python3 TWI2-c &quot;import cv2; print(cv2.__version__)&quot;SDA/UART3_RX'''</p><p>| '''4.6.027'''</p></li></ol></li></ol> <span id="set-up-the-chinese-environment-and-install-the-chinese-input-method"></span>== Set up the Chinese environment and install the Chinese input method ==|-| '''Note, before installing the Chinese input method, please make sure that the Linux system used by the development board is a desktop version.256'''| '''PI0'''<span id| style="debiantext-system-installation-methodalign: left;"></span>|=== Debian system installation method ===| '''29''' <ol style="list-style|-type: decimal;"><li><p>First set the default | '''locale271''' to Chinese</p><ol style| '''PI15'''| style="list-styletext-typealign: lower-alphaleft;">|<li><p>Enter the following command to start configuring | '''locale31'''</p><p>orangepi@orangepi:~$ |-| '''268'sudo dpkg-reconfigure locales''| '''PI12'''</p></li><li><p>Then select | '''zh_CN.UTF-8 UTF-8PWM2''' 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;33''', and then return Car can be used)</p><p>[[File:zero2w|-img186.png]]</p></li><li><p>Then set the default | '''locale258''' to | '''zh_CN.UTF-8PI2'''</p><p>[[File| style="text-align:zero2w-img187.png]]</p></li>left;"|<li><p>After exiting the interface, the | '''locale35''' setting will begin. &gt; The output displayed on the command line is as follows:</p><p>orangepi@orangepi:~$ |-| '''sudo dpkg-reconfigure locales272'''| '''PI16'''</p><p>Generating locales (this might take a while)...</p><p>en_US.UTF| style="text-8... done</p>align: left;"|| '''37'''<p>zh_CN.UTF|-8... done</p><p>Generation complete.</p></li></ol>| style="text-align: left;"|</li>| style="text-align: left;"|<li><p>Then open | '''Input MethodGND'''</p><p>[[File:zero2w-img188.png]]</p></li><li><p>Then select | '''OK39'''</p><p>[[File|}{| class="wikitable" style="width:390px;margin-right:zero2w20px;text-align: center;"|-img189.png]]</p></li><li><p>Then select | '''YesPin'''| '''Function'''</p><p>[[File:zero2w-img190.png]]</p></li><li><p>Then select | '''fcitxGPIO'''</p><p>[[File:zero2w| '''GPIO NO.'''|-img191.png]]</p></li><li><p>Then select | '''OK2'''</p><p>[[File:zero2w-img192.png]]</p></li><li><p>| '''Then restart the Linux system to make the configuration take effect.5V'''</p></li><li><p>Then open '| style="text-align: left;"|| style="text-align: left;"||-| '''Fcitx configuration4'''</p><p>[[File| '''5V'''| style="text-align:zero2wleft;"|| style="text-img193.png]]</p></li>align: left;"|<li><p>Then click the + sign as shown in the picture below</p><p>[[File:zero2w|-img194.png]]</p></li><li><p>Then search | '''Google Pinyin6''' and click | '''OKGND'''</p><div class| style="figuretext-align: left;">|| style="text-align: left;"|[[File:zero2w|-img195.png]]| '''8'''</div></li>| '''UART0_TX'''<li><p>Then put | '''Google PinyinPH0''' on top</p><p>[[File:zero2w-img196.png]]</p>| '''224'''<p>[[File:zero2w|-img197.png]]</p></li><li><p>Then open the | '''Geany10''' editor to test the Chinese input method</p><p>[[File:zero2w-img198.png]]</p></li>| '''UART0_RX'''<li><p>The Chinese input method test is as follows</p>| '''PH1'''<p>[[File:zero2w| '''225'''|-img199.png]]</p></li><li><p>You can switch between Chinese and English input methods through the | '''Ctrl+Space12''' shortcut key</p></li><li><p>If you need the entire system to be displayed in Chinese, you can set all variables in | style="text-align: left;"|| '''/etc/default/localePI1''' to | '''zh_CN.UTF-8257'''</p><p>orangepi@orangepi:~$ |-| ''''sudo vim /etc/default/locale14'''</p><p># File generated by update-locale</p><p>LC_MESSAGES=| '''zh_CN.UTF-8GND'''</p><p>LANG| style='''zh_CN.UTF"text-align: left;"|| style="text-align: left;"||-8| '''</p><p>LANGUAGE=16'''zh_CN.UTF-8| '''<PWM4/p></li>UART4_RX'''<li><p>Then | '''restart the systemPI14''' and you will see that the system is displayed in Chinese.</p><p>[[File:zero2w-img200.png]]</p></li></ol>| '''270'''|-<span id| '''18'''| style="installationtext-method-of-ubuntu-20.04-systemalign: left;"></span>|=== Installation method of Ubuntu 20.04 system ===| '''PH4''' <ol style="list-style| '''228'''|-type: decimal;"><li><p>First open | '''Language Support20'''</p><p>[[File:zero2w-img201.png]]</p></li><li><p>Then find the '''Chinese (China)| '''GND''' option</p><p>[[File| style="text-align:zero2w-img202.png]]</p></li>left;"|<li><p>Then please use the | style="text-align: left button of the mouse to select ;"||-| '''Chinese (China)22''' 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]]<| '''TWI0_SDA/p></li></ol>UART2_RX'''| '''PI6'''| '''Note that this step is not easy to drag, please be patient and try it a few times.262'''|-| '''<ol start="4" span style="list-style-typecolor: decimal;#FF0000">24<li><p/span>Then select '''Apply System-Wide| ''' to apply the Chinese settings to the entire system</pspan style="color:#FF0000"><p>[[File:zero2w-img204.png]]SPI1_CS0</p></li><li><pspan>Then set the '''Keyboard input method system| ''' system to <span style="color:#FF0000">PH5</span>'''fcitx| '''</p><p>[[Filespan style="color:zero2w-img205.png]]</p#FF0000">229</li><li><pspan>'''Then restart the Linux system to make the configuration take effect|-| '''</p>span style="color:#FF0000">26</lispan>'''| '''<lispan style="color:#FF0000">SPI1_CS1<p/span>After re-entering the system, please select '''Do not ask me again| ''' in the following interface, and then please decide according to your own preferences whether the standard folder should also be updated to Chinese</p><p>[[Filespan style="color:zero2w-img206.png]]</p#FF0000">PH9</lispan>'''| '''<lispan style="color:#FF0000"><p>Then you can see that the desktop is displayed in Chinese233</pspan>'''<p>[[File:zero2w|-img207.png]]</p></li><li><p>Then we can open | '''Geany28''' to test the Chinese input method. The opening method is as shown in the figure below</p><p>[[File:zero2w| '''TWI2-img208.png]]<SCL/p></li>UART3_TX'''<li><p>After opening | '''GeanyPI9''', the English input method is still the default. We can switch to the Chinese input method through the | '''Ctrl+Space265''' shortcut key, and then we can input Chinese.</p><p>[[File:zero2w|-img209.png]]</p></li></ol>| '''30'''| '''GND'''<span id| style="installationtext-method-of-ubuntu-22.04-systemalign: left;"></span>=== Installation method of Ubuntu 22.04 system === <ol style|| style="list-styletext-typealign: decimalleft;">||-<li><p>First open | '''Language Support32'''</p><p>[[File:zero2w-img201.png]]</p></li>| '''PWM1'''<li><p>Then find the | '''Chinese (China)PI11''' option</p><p>[[File:zero2w| '''267'''|-img210.png]]</p></li><li><p>Then please use the left button of the mouse to select | '''Chinese (China)34''' and hold it down, then drag it up to the starting position. After dragging, the display will be as shown below:</p><p>[[File:zero2w-img211.png]]</p></li></ol> | '''Note that this step is not easy to drag, please be patient and try it a few times.GND''' <ol start| style="4text-align: left;" || style="listtext-style-typealign: decimalleft;">||-<li><p>Then select | '''Apply System-Wide36''' to apply the Chinese settings to the entire system</p><p>[[File| style="text-align:zero2w-img212.png]]</p></li>left;"|| '''PC12'''<li><p>| '''Then restart the Linux system to make the configuration take effect76'''</p></li><li><p>After re|-entering the system, please select | '''Do not ask me again38''' 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| style="text-align:zero2w-img206.png]]</p></li>left;"|<li><p>Then you can see that the desktop is displayed in Chinese</p>| '''PI4'''| '''260'''|-| '''40'''<p>[[File| style="text-align:zero2w-img207.png]]</p></li><li><p>Then open the Fcitx5 configuration program</p>left;"|| '''PI3'''| '''259'''|}<p>[[File:zero2w-img213.png]]</p></li><li><p>Then choose to use Pinyin input method</p><div class="figure">
<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:~$ '''sudo orangepi-config'''</p>|}</li><li><p>Then select '''System'''</p><p>[[File:zero2w-img214img80.png]]</p></li><li><p>Then select '''Hardware'''</p><p>[[File:zero2w-img81.png]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown in the figure below, and then use the '''space''' to select the dtbo configuration of the SPI you want to open.</p></li>
{| class="wikitable" style="width:800px;text-align: center;"|-| '''dtbo configuration'''| '''illustrate'''|-| '''spi1-cs0-cs1-spidev'''| '''Open cs0 and cs1 of spi1 at the same time'''|-| '''spi1-cs0-spidev'''| '''Only open cs0 of spi1'''|-| '''spi1-cs1-spidev'''| '''Only open cs1 of spi1'''|}</divol><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>The interface after selection is as shown below, then click OKThen select '''&lt;Back&gt;'''</p><p>[[File:zero2w-img215img84.png]]</p></li><li><p>Then we can open select '''Geany&lt;Reboot&gt;''' to test restart the system to make the Chinese input methodconfiguration take effect. The opening method is as shown in the figure below</p><p>[[File:zero2w-img208img85.png]]</p></li></ol></li></ol><!-- --><ol start="3" style="list-style-type: decimal;"><li><p>After opening Then check whether there is a '''Geanyspidev1.x'''device node in the Linux system. If it exists, it means that the English input method is still SPI1 configuration has taken effect.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''ls /dev/spidev1*'''</p><p>/dev/spidev1.0 /dev/spidev1.1</p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that only when you open spi1-cs0-cs1-spidev, you will see the device nodes of the defaulttwo spi. We '''</p></big>|}</li><li><p>Then you can switch use the '''spidev_test.py''' program in examples to test the Chinese input method through 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>'''Ctrl+Space--channel''' shortcut key, and then we can enter Chinese.: Specify the channel number of SPI</p></li><li><p>[[File'''--port''':zero2w-img216.png]]Specify the port number of the SPI</p></li></ol></li><li><p>Without shorting the mosi and miso pins of SPI1, the output result of running spidev_test.py is as follows. You can see that the data of TX and RX are inconsistent.</p>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p>
<span id="how-to-remotely-log-in-to-the-linux-systemroot@orangepi:~/wiringOP-desktop"><Python/span>== How to remotely log in to the Linux system desktop ==examples# '''python3 spidev_test.py \'''
<span id="remote'''-login-usingchannel 1 -nomachine"></span>=== Remote login using NoMachine ===-port 0'''
'''Please ensure that the Ubuntu or Debian system installed on the development board is a desktop version of the system. In addition, NoMachine also provides detailed usage documentation. It is strongly recommended to read this document thoroughly to become familiar with the use of NoMachine. The document link is as followsspi mode:'''0x0
'''httpsmax speed://knowledgebase.nomachine.com/DT10R00166'''500000 Hz (500 KHz)
'''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 devicesOpening device /dev/spidev1. The following demonstrates how to remotely log in to the Linux system desktop of the Orange Pi development board through NoMachine in Windows. For installation methods on other platforms, please refer to NoMachine's official documentation.'''1
TX | FF FF FF FF FF FF '''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.<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 |......@.......…|
<ol style="list-style-type: decimal;"><li><p>First download the installation package of the NoMachine software Linux '''arm64RX | FF FF FF FF FF FF ''' deb version, and then install it into the Linux system of the development board</p><ol span style="list-style-typecolor: lower-alpha;#FF0000">FF FF FF FF FF FF<li/span>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 packageFF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF |.............…. The download link is as &gt; follows:</li></ol>||}
</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# '''Note that this download link may change, please look for the Armv8/Arm64 version of the deb packagepython3 spidev_test.py \'''
[https://www.nomachine.com/download/download&id=112&s=ARM '''https://downloads.nomachine.com/download/?id=118&amp;distro=ARM--channel 1 --port 0''']
[[Filespi mode:zero2w-img217.png]]0x0
<ol start="2" style="list-style-typemax speed: lower-alpha;"><li><p>In addition, you can also download the '''NoMachine''' installation &gt; package from the official tool.</p><p>[[File:zero2w-img218.png]]</p><p>First enter the '''remote login software-NoMachine''' folder</p><p>[[File:zero2w-img219.png]]</p><p>Then download the arm64 version of the deb installation package</p><p>[[File:zero2w-img220.png]]</p></li><li><p>Then upload the downloaded '''nomachine_x.x.x_x_arm64.deb''' to the &gt; Linux system of the development board</p></li><li><p>Then use the following command to install '''NoMachine''' in the Linux &gt; system of the development board</p><p>orangepi@orangepi:~$ '''sudo dpkg -i nomachine_x.x.x_x_arm64_arm64.deb'''</p></li></ol>500000 Hz (500 KHz)
<!-- --><ol start="2" style="list-style-type: decimal;"><li>Then download the installation package of the Windows version of the NoMachine software. The download address is as follows<Opening device /li><dev/ol>spidev1.1
TX | FF FF FF FF FF FF '''Note that this download link may change.<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 '''https://downloads.nomachine.com/download/?id=9''' [[File:zero2w-img221.png]] <ol start="3" span style="list-style-typecolor: decimal;#FF0000"><li><p>Then install NoMachine in Windows. '''Please restart your computer after installation.'''40 00 00 00 00 95</pspan></li><li><p>Then open '''NoMachine''' in Window</p><p>[[File:zero2w-img222FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |.png]]</p></li><li><p>After NoMachine is started, it will automatically scan other devices with NoMachine installed on the LAN. After entering the main interface of NoMachine, you can see that the development board is already in the list of connectable devices, and then click on the location shown in the red box in the picture below You can now log in to the Linux system desktop of the development board.</p><p>[[File:zero2w-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> <span id="remote-login-using-vnc"></span>=== 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'''s</p><p>orangepi@orangepi:~$ '''sudo set_vnc.sh'''</p><p>You will require a password to access your desktops.</p><p>Password: '''#Set the vnc password here, 8 characters'''</p><p>Verify: '''#Set the vnc password here, 8 characters'''</p><p>Would you like to enter a view-only password (y/n)? '''n'''</p><p>xauth: file /root/.Xauthority does not exist</p><p>New 'X' desktop is orangepi:1</p><p>Creating default startup script /root/.vnc/xstartup</p><p>Starting applications specified in /root/.vnc/xstartup</p><p>Log file is /root/.vnc/orangepi:1.log</p>…|<p>Killing Xtightvnc process ID 3047</p><p>New 'X' desktop is orangepi:1</p><p>Starting applications specified in /root/.vnc/xstartup</p><p>Log file is /root/.vnc/orangepi:1.log</p></li><li><p>The steps to use MobaXterm software to connect to the development board Linux system desktop are as follows:</p><ol style="list-style-type: lower-alpha;"><li>First click Session, then select VNC, then fill in the IP &gt; address and port of the development board, and finally click &gt; OK to confirm.</li></ol>|}
</li></ol>
<span id="pin-i2c-test-1"></span>
<div class="figure">== 40pin I2C test ===
[[File:zero2w-img227.png]]# As can be seen from the table below, the i2c available for the 40pin interface are i2c0, i2c1 and i2c2
</divstyle="display: flex;"><ol start::{| class="2wikitable" style="listwidth:390px;margin-styleright: 20px;text-typealign: lower-alphacenter;"><li><p>Then enter the VNC password set earlier</p>|-<p>[[File:zero2w-img228| '''GPIO NO.png]]</p></li>'''<li><p>After successful login, the interface is displayed as shown below, &gt; and then you can remotely operate the desktop of the development &gt; board Linux system.</p></li></ol>| '''GPIO'''| '''Function'''| '''Pin'''[[File:zero2w|-img229.png]] <span id| style="qttext-installation-methodalign: left;"></span>|== QT installation method == <ol | style="listtext-style-typealign: decimalleft;">|<li><p>Use the following script to install QT5 and QT Creator</p>| '''3.3V'''<p>orangepi@orangepi:~$ | '''install_qt.sh1'''</p></li>|-| '''<li><p>After installation, the QT version number will be automatically printed.</p><ol span style="list-style-typecolor: lower-alpha;#FF0000">264<li/span><p>The qt version that comes with Ubuntu20.04 is '''5.12.8| '''</pspan style="color:#FF0000">PI8<p/span>orangepi@orangepi:~$ '''install_qt.sh| '''</pspan style="color:#FF0000">TWI1-SDA<p>......</p/span>'''| '''<pspan style="color:#FF0000">QMake version 3.1</pspan><p>Using Qt version '''5.12.8|-| ''' in /usr/lib/aarch64-linux-gnu</pspan style="color:#FF0000">263</lispan>'''<li><p>The QT version that comes with Ubuntu22.04 is '''5.15.3'| '''</pspan style="color:#FF0000">v<p/span>orangepi@orangepi:~$ '''install_qt.sh| '''</pspan style="color:#FF0000"><p>......TWI1-SCL</pspan>'''| '''<p>QMake version 3.1span style="color:#FF0000">5</pspan>'''|-<p>Using Qt version | '''269'5.15.3''| ' in /usr/lib/aarch64-linux-gnu</p></li><li><p>The QT version that comes with Debian11 is ''PI13'5.15.2'''</p><p>orangepi@orangepi:~$ | '''install_qt.shPWM3/UART4_TX'''| '''7'''</p><p>......</p>|-<p>QMake version 3.1</p>| style="text-align: left;"|| style="text-align: left;"|<p>Using Qt version | '''GND''5.15.2'| '''9''' in /usr/lib/aarch64|-linux-gnu</p></li><li><p>The QT version that comes with Debian12 is | '''226'5.15.8''| '''PH2'''</p><p>orangepi@orangepi:~$ | '''install_qt.shUART5_TX'''</p><p>......</p>| '''11'''<p>QMake version 3.1</p>|-<p>Using Qt version | '''5.15.8227''' in /usr/lib/aarch64-linux-gnu</p></li></ol></li><li><p>Then you can see the QT Creator startup icon in | '''ApplicationsPH3'''</p><p>[[File:zero2w-img230.png]]</p>| '''UART5_RX'''<p>You can also use the following command to open QT Creator</p><p>orangepi@orangepi:~$ | '''13'''qtcreator|-| '''</pspan style="color:#FF0000">261</lispan>'''| '''<li><pspan style="color:#FF0000">The interface after QT Creator is opened is as followsPI5</pspan>'''| '''<pspan style="color:#FF0000">[[File:zero2w-img231.png]]TWI0_SCL</pspan></li>UART2_TX'''| '''<li><pspan style="color:#FF0000">The version of QT Creator is as follows15</pspan>'''<ol |-| style="listtext-align: left;"|| style="text-typealign: lower-alphaleft;">|<li><p>The default version of QT Creator in | ''''Ubuntu203.043V''' is as &gt; follows</p><p>[[File:zero2w-img232.png]]</p></li><li><p>The default version of QT Creator in | '''Ubuntu22.0417''' is as &gt; follows</p><p>[[File:zero2w|-img233.png]]</p></li><li><p>The default version of QT Creator in | '''Debian11231''' is as follows</p><p>[[File:zero2w-img234.png]]</p></li>| '''PH7'''<li><p>The default version of QT Creator in | '''Debian12SPI1_MOSI''' is as follows</p><p>[[File:zero2w-img235.png]]</p></li></ol>| '''19'''</li>|-<li><p>Then set up QT</p>| '''232'''<ol style="list-style-type: lower-alpha;"><li><p>First open | '''HelpPH8'''-&gt;| '''About Plugins...SPI1_MISO'''| '''21'''.</p><p>[[File:zero2w|-img236.png]]</p></li><li><p>Then remove the check mark of | '''ClangCodeModel230'''</p><p>[[File:zero2w-img237.png]]</p></li>| '''PH6'''<li><p>| '''After setting up, you need to restart QT CreatorSPI1_CLK'''</p></li><li><p>Then make sure the GCC compiler used by QT Creator. If the &gt; default is Clang, please change it to GCC.</p><p>| '''23'Debian12 please skip this step.'''</p><p>[[File:zero2w|-img238.png]]</p><p>[[File| style="text-align:zero2wleft;"|| style="text-img239.png]]</p></li></ol>align: left;"|</li>| '''GND'''| '''25'''|-| '''<lispan style="color:#FF0000">266<p>Then you can open a sample code</p/span>'''| '''<p>[[Filespan style="color:zero2w-img240.png]]</p#FF0000">PI10</lispan>'''| '''<li><pspan style="color:#FF0000">After clicking on the sample code, the corresponding instruction document will automatically open. You can read the instructions carefully.TWI2-SDA</pspan>/UART3_RX'''| '''<p>[[Filespan style="color:zero2w-img241.png]]</p#FF0000">27</lispan>'''|-<li><p>Then click | '''Configure Project256'''</p><p>[[File:zero2w-img242.png]]</p></li>| '''PI0'''<li><p>Then click the green triangle in the lower | style="text-align: left corner to compile and run the sample code</p>;"|<p>[[File:zero2w| '''29'''|-img243.png]]</p></li><li><p>After waiting for a period of time, the interface shown in the figure below will pop up, which means that QT can compile and run normally.</p>| '''271'''<p>[[File| '''PI15'''| style="text-align:zero2wleft;"|| '''31'''|-img244.png]]</p></li><li><p>References</p><p>[https://wiki.qt.io/Install_Qt_5_on_Ubuntu | '''https://wiki.qt.io/Install_Qt_5_on_Ubuntu268'''| '''PI12''']</p><p>[https://download.qt.io/archive/qtcreator | '''https://download.qt.io/archive/qtcreatorPWM2''']</p><p>[https://download.qt.io/archive/qt | '''https://download.qt.io/archive/qt33''']</p></li></ol>|-<span id| '''258'''| '''PI2'''| style="rostext-installation-methodalign: left;"></span>|== ROS installation method ==| '''35'''|-| '''272'''| '''PI16'''<span id| style="howtext-to-install-ros-1-noetic-on-ubuntu20.04align: left;"></span>|=== How to install ROS 1 Noetic on Ubuntu20.04 === # The currently active version of ROS 1 is as follows, the recommended version is | '''Noetic Ninjemys37'''|-[[File| style="text-align:zero2wleft;"|| style="text-img245.png]] [[Filealign:zero2w-img246.png]]left;"| [http://docs.ros.org/ | '''http://docs.ros.orgGND'''] | '''https://wiki.ros.org/Distributions39'''|}<ol start{| class="2wikitable" style="listwidth:390px;margin-styleright: 20px;text-typealign: decimalcenter;"><li><p>The link to the official installation documentation of ROS 1 |-| '''Noetic NinjemysPin''' is as follows:</p><p>[http://wiki.ros.org/noetic/Installation/Ubuntu | '''Function''http://wiki.ros.org/noetic/Installation/Ubuntu'| '''GPIO''']</p></li><li><p>In the official installation documentation of ROS | '''Noetic NinjemysGPIO NO.''', Ubuntu recommends using Ubuntu20.04, so please ensure that the system used by the development board is |-| '''Ubuntu20.04 desktop system2'''.</p><p>[http://wiki.ros.org/noetic/Installation | '''5V''http://wiki.ros.org/noetic/Installation''']</p><p>[[File| style="text-align:zero2w-img247.png]]</p></li>left;"|<li><p>Then use the script below to install ros1</p>| style="text-align: left;"|<p>orangepi@orangepi:~$ |-| '''install_ros.sh ros14'''</p></li><li><p>Before using the ROS tool, you first need to initialize rosdep. Then when compiling the source code, you can quickly install some system dependencies and some core components in ROS.</p></li></ol> | '''Note that when running the following command, you need to ensure that the development board can access github normally, otherwise an error will be reported due to network problems.5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''The install_ros.sh script will try to modify /etc/hosts and automatically run the following commands. However, this method cannot guarantee that github can be accessed normally every time. If install_ros.sh prompts the following error after installing ros1, please find other ways to allow the linux system of the development board to access github normally, and then manually run the following Order.6''' | '''https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yamlGND'''| style="text-align: left;"|'''Hit https| style="text-align://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yamlleft;"||-| '''8''' | '''ERROR: error loading sources list:UART0_TX''' | '''The read operation timed outPH0''' orangepi@orangepi:~$ | ''''source /opt/ros/noetic/setup.bash224'''|-orangepi@orangepi:~$ | '''sudo rosdep init10''' Wrote /etc/ros/rosdep/sources.list.d/20-default.list Recommended: please run rosdep update orangepi@orangepi:~$ | '''rosdep updateUART0_RX'''| '''PH1'''reading in sources list data from /etc/ros/rosdep/sources.list.d| '''225'''|-Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx| '''12'''| style="text-homebrew.yamlalign: left;"|| '''PI1'''Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml| '''257'''|-Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml| '''14'''| '''GND'''Hit https| style="text-align://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yamlleft;"|| style="text-align: left;"||-Hit https://raw.githubusercontent.com| '''16'''| '''PWM4/ros/rosdistro/master/releases/fuerte.yamlUART4_RX'''| '''PI14'''Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index| '''270'''|-v4.yaml| '''18'''Skip end| style="text-of-life distro &quot;ardent&quotalign: left;"|| '''PH4'''Skip end-of-life distro &quot;bouncy&quot;| '''228'''|-Skip end-of-life distro &quot;crystal&quot;| '''20'''| '''GND'''Skip end| style="text-ofalign: left;"|| style="text-life distro &quotalign: left;dashing&quot"||-| '''<span style="color:#FF0000">22</span>'''| '''<span style="color:#FF0000">TWI0_SDA</span>/UART2_RX'''| '''<span style="color:#FF0000">PI6</span>'''| '''<span style="color:#FF0000">262</span>'''|-| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''<span style="color:#FF0000">28</span>'''| '''<span style="color:#FF0000">TWI2-SCL</span>/UART3_TX'''| '''<span style="color:#FF0000">PI9</span>'''| '''<span style="color:#FF0000">265</span>'''|-| '''30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''32'''| '''PWM1'''| '''PI11'''| '''267'''|-| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''36'''| style="text-align: left;"|| '''PC12'''| '''76'''|-| '''38'''| style="text-align: left;"|| '''PI4'''| '''260'''|-| '''40'''| style="text-align: left;"|| '''PI3'''| '''259'''|}</div>
Skip end<ol start="2" style="list-ofstyle-life distro &quottype: decimal;eloquent&quot"><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>Add distro &quot;foxy&quot{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li><li><p>Then select '''System'''</p><p>[[File:zero2w-img80.png]]</p></li><li><p>Then select '''Hardware'''</p><p>[[File:zero2w-img81.png]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown in the picture below, and then use the '''space''' to select the corresponding i2c configuration in the picture below.</p></li>
Add distro &quot{| class="wikitable" style="width:800px;galactic&quottext-align: center;"|-| '''Multiplexing function in 40pin'''| '''Corresponding dtbo configuration'''|-| '''40pin - i2c0'''| '''pi-i2c0'''|-| '''40pin - i2c1'''| '''pi-i2c1'''|-| '''40pin - i2c2'''| '''pi-i2c2'''|}
Skip end[[File:zero2w-ofimg173.png]]</ol><ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select <span class="mark">&lt;Save&gt;</span> to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select <span class="mark">&lt;Back&gt;</span></p><p>[[File:zero2w-life distro img84.png]]</p></li><li><p>Then select <span class="mark">&quotlt;groovyReboot&quotgt;</span> to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol></li></ol><!-- --><ol start="3" style="list-style-type: decimal;"><li><p>After starting the Linux system, first confirm that there is an open i2c device node under <span class="mark">/dev</span></p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''ls /dev/i2c-*'''</p><p>'''/dev/i2c-*'''</p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''注意,这里说的Linux镜像具体指的是从Orange Pi资料下载页面下载的Debian或者Ubuntu这样的Linux发行版镜像。'''</big>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Sometimes the i2c device node and the i2c bus serial number do not correspond one to one. For example, the i2c device node of the i2c1 bus may be /dev/i2c-3.'''</p><p>'''The method to accurately confirm the device node under /dev corresponding to the i2c bus is: '''</p></big>
Add distro &quot;humble&quot;
Skip end<ol style="list-style-type: lower-alpha;"><li><p>'''First run the following command to check the corresponding relationship ofi2c'''</p><p>orangepi@orangepizero2w:~$ '''ls /sys/devices/platform/soc*/*/i2c-life distro * | grep &quot;hydroi2c-[0-9]&quot;'''</p><p>/sys/devices/platform/soc/5002000.i2c/i2c-0:</p>Skip end<p>/sys/devices/platform/soc/5002400.i2c/i2c-of3:</p><p>/sys/devices/platform/soc/5002800.i2c/i2c-life distro &quot;indigo&quot;4:</p><p>/sys/devices/platform/soc/5002c00.i2c/i2c-5:</p>Skip end<p>/sys/devices/platform/soc/6000000.hdmi/i2c-of2:</p><p>/sys/devices/platform/soc/7081400.i2c/i2c-life distro &quot;jade&quot;1:</p></li>
Skip end-of-life distro &quot;kinetic&quot;
Skip end<li><p>'''In the above output'''</p><ol style="list-style-type: none;"><li><p>a) 5002000 is the register base address of the i2c0 bus, and i2c-0 shown behind it is its corresponding i2c device node</p></li><li><p>b) 5002400 is the register base address of the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li><li><p>c) 5002800 is the register base address of the i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p></li></ol></li></ol>|}</li></ol><ol start="4" style="list-style-type: decimal;"><li><p>Then start testing i2c, first install i2c-tools</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo''' '''apt-get install -y i2c-tools'''</p>|}</li><li><p>Then connect an i2c device to the i2c pin of the 40pin connector. 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 ofthe connected i2c device can be detected, it means that the i2c device is connected correctly.</p>{| class="wikitable" style="background-life distro &quotcolor:#ffffdc;lunar&quotwidth:800px;" |-| <big>'''<p>'''Note that x in the i2cdetect -y x command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p>'''</big>|}
Add distro [[File:zero2w-img179.png]]</li></ol><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>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that the x in i2c-x in the following command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p><p>root@orangepi:~/wiringOP-Python/examples# '''python3 ds1307.py --device \'''</p><p>'''&quot;melodic/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>
Add distro &quot;noetic&quot;<span id="pin-uart-test-1"></span>
Add distro &quot;rolling&quot;=== 40pin UART test ===
updated cache in /home/orangepi/# As can be seen from the table below, the available uarts are uart2, uart3, uart4 and uart5.ros/rosdep/sourcesPlease note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial port.cache
<ol startdiv style="display: flex;">::{| class="6wikitable" style="listwidth:390px;margin-styleright: 20px;text-typealign: decimalcenter;"><li><p>Then open a command line terminal window on the |-| '''desktopGPIO NO.''', and then use the | '''test_ros.shGPIO''' script to start a small turtle routine to test whether ROS can be used normally.</p><p>orangepi@orangepi:~$ | '''Function'test_ros.sh'''</p></li><li><p>After running the | '''test_ros.shPin''' 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>| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''1'''<div class="figure">|-| '''264'''[[File:zero2w| '''PI8'''| '''TWI1-img249.png]]SDA'''| '''3'''</div>|-<ol start="9" style="list-style-type: decimal;">| '''263'''<li><p>At this time, press the direction keys on the keyboard to control the little turtle to move up, down, left, and right.</p>| '''PI7'''<p>[[File:zero2w| '''TWI1-img250.png]]</p></li></ol>SCL'''| '''5'''<span id="how|-to-install-ros-2-galactic-on-ubuntu20.04"><| '''269'''| '''PI13'''| '''PWM3/span>UART4_TX'''=== How to install ROS 2 Galactic on Ubuntu20.04 ===| '''7'''|-<ol | style="listtext-align: left;"|| style="text-typealign: decimalleft;">|<li><p>The currently active version of ROS 2 is as follows, the recommended version is | '''GND'''| '''Galactic Geochelone9'''</p><p>[[File:zero2w|-img251.png]]</p><p>[[File:zero2w-img252.png]]</p><p>[http://docs.ros.org/ | '''http://docs.ros.org226''']</p><p>| '''http://docs.ros.org/en/galactic/Releases.htmlPH2'''</p></li><li><p>The link to the official installation documentation of ROS 2 | '''Galactic GeocheloneUART5_TX''' is as follows:</p><p>| '''11'''|-| '''docs.ros.org/en/galactic/Installation.html227'''</p><p>| '''http://docs.ros.org/en/galactic/Installation/Ubuntu-Install-Debians.htmlPH3'''</p></li><li><p>In the official installation documentation of ROS 2 | '''UART5_RX'Galactic Geochelone''| ', Ubuntu Linux recommends using Ubuntu20.04, so please ensure that the system used by the development board is the ''13'''Ubuntu20.04 desktop system|-| '''. There are several ways to install ROS 2. The following demonstrates how to install ROS 2 261'''Galactic Geochelone| ''' through PI5'''Debian packages| '''.<TWI0_SCL/p></li><li><p>Use the UART2_TX'''| '''install_ros.sh15''' script to install ros2</p><p>orangepi@orangepi|-| style="text-align:~$ '''install_ros.sh ros2'''</p></li>left;"|| style="text-align: left;"|<li><p>The | '''install_ros3.sh3V''' script will automatically run the | '''ros2 -h17''' 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>| '''231'''<p>optional arguments:</p>| '''PH7'''<p>-h, --help show this help message and exit</p>| '''SPI1_MOSI'''<p>Commands:</p>| '''19'''<p>action Various action related sub|-commands</p><p>bag Various rosbag related sub-commands</p>| '''232'''| '''PH8'''<p>component Various component related sub-commands</p>| '''SPI1_MISO'''| '''21'''<p>daemon Various daemon related sub|-commands</p><p>doctor Check ROS setup and other potential issues</p>| '''230'''<p>interface Show information about ROS interfaces</p>| '''PH6'''<p>launch Run a launch file</p>| '''SPI1_CLK'''<p>lifecycle Various lifecycle related sub| '''23'''|-commands</p><p>multicast Various multicast related sub| style="text-commands</p>align: left;"|<p>node Various node related sub-commands</p>| style="text-align: left;"|<p>param Various param related sub-commands</p>| '''GND'''<p>pkg Various package related sub-commands</p>| '''25'''<p>run Run a package specific executable</p><p>security Various security related sub|-commands</p><p>service Various service related sub-commands</p>| '''266'''| '''PI10'''<p>topic Various topic related sub| '''TWI2-commands<SDA/p>UART3_RX'''<p>wtf Use `wtf` as alias to `doctor`</p>| '''27'''<p>Call `ros2 &lt;command&gt; |-h` for more detailed usage.</p></li><li><p>Then you can use the | '''test_ros.sh256''' 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.shPI0'''</p><p>[INFO] [1671174101.200091527] [talker]: Publishing| style="text-align: left;"|| '''29''Hello World: 1'</p><p>[INFO] [1671174101.235661048] [listener]: I heard: [Hello World: 1]</p>|-<p>[INFO] [1671174102.199572327] [talker]: Publishing: | '''271''Hello World: 2'</p><p>[INFO] [1671174102.204196299] [listener]: I heard: [Hello World: 2]</p>| '''PI15'''<p>[INFO] [1671174103.199580322] [talker]: Publishing| style="text-align: left;"|| '''31''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:~$ |-| '''268'source /opt/ros/galactic/setup.bash''| '''PI12'''| '''PWM2'''</p><p>orangepi@orangepi:~$ | '''ros2 run rviz2 rviz233'''</p><p>[[File:zero2w|-img253.png]]</p></li><li><p>For how to use ROS, please refer to the documentation of ROS 2.</p>| '''258'''| '''PI2'''| style="text-align: left;"|<p>[http://docs.ros.org/en/galactic/Tutorials.html | '''35'''http://docs.ros.org/en/galactic/Tutorials.html|-| '''272''']</p></li></ol>| '''PI16'''<span id| style="howtext-toalign: left;"|| '''37'''|-install| style="text-ros-2-humble-on-ubuntu22.04align: left;"></span>|=== How to install ROS 2 Humble on Ubuntu22.04 === <ol | style="listtext-style-typealign: decimalleft;">|<li><p>Use the install_ros.sh script to | '''GND'''install_ros.sh'''</p><p>orangepi@orangepi:~$ | '''install_ros.sh ros239'''</p></li><li><p>The |}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''install_ros.shPin''' script will automatically run the | '''ros2 -hFunction''' command after installing ros2. If you can see the following print, it means that the ros2 installation is complete| '''GPIO'''| '''GPIO NO.</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>| '''2'''| '''5V'''<p>optional arguments| style="text-align:</p>left;"|<p>| style="text-h, align: left;"||--help show this help message and exit</p><p>Commands:</p>| '''4'''| '''5V'''<p>action Various action related sub| style="text-commands</p>align: left;"|<p>bag Various rosbag related sub| style="text-commands</p>align: left;"|<p>component Various component related sub|-commands</p><p>daemon Various daemon related sub-commands</p>| '''6'''<p>doctor Check ROS setup and other potential issues</p>| '''GND'''<p>interface Show information about ROS interfaces</p>| style="text-align: left;"|<p>launch Run a launch file</p>| style="text-align: left;"|<p>lifecycle Various lifecycle related sub|-commands</p><p>multicast Various multicast related sub-commands</p>| '''8'''| '''UART0_TX'''<p>node Various node related sub-commands</p>| '''PH0'''<p>param Various param related sub-commands</p>| '''224'''<p>pkg Various package related sub|-commands</p><p>run Run a package specific executable</p>| '''10'''<p>security Various security related sub-commands</p>| '''UART0_RX'''<p>service Various service related sub-commands</p>| '''PH1'''| '''225'''<p>topic Various topic related sub|-commands</p><p>wtf Use `wtf` as alias to `doctor`</p>| '''12'''<p>Call `ros2 &lt| style="text-align: left;command&gt; -h` for more detailed usage.</p></li>"|<li><p>Then you can use the | '''PI1''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.sh257'''</p><p>[INFO] [1671174101.200091527] [talker]: Publishing: |-| '''14''Hello World: 1'</p><p>[INFO] [1671174101.235661048] [listener]: I heard: [Hello World: 1]</p>| '''GND'''<p>[INFO] [1671174102.199572327] [talker]| style="text-align: Publishingleft;"|| style="text-align: left;"||-| '''16''Hello World: 2'</p><p>[INFO] [1671174102.204196299] [listener]: I heard: [Hello World: 2]<| '''PWM4/p>UART4_RX'''<p>[INFO] [1671174103.199580322] [talker]: Publishing: | '''PI14''Hello World: 3'</p><p>[INFO] [1671174103.204019965] [listener]: I heard: [Hello World: 3]</p></li>| '''270'''<li><p>Run the following command to open rviz2</p>|-<p>orangepi@orangepi:~$ | '''source /opt/ros/humble/setup.bash18'''</p><p>orangepi@orangepi| style="text-align:~$ 'left;"|| ''ros2 run rviz2 rviz2'PH4'''| '''228'''</p><p>[[File:zero2w|-img254.png]]</p></li><li><p>Reference documentation</p>| '''20'''<p>| '''http://docs.ros.org/en/humble/index.htmlGND'''</p><p>[http| style="text-align: left;"|| style="text-align://docs.ros.org/en/galactic/Tutorials.html left;"||-| '''http:22'''| '''TWI0_SDA//docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.htmlUART2_RX''']</p></li></ol> <span id="how-to-install-kernel-header-files"></span>== How to install kernel header files ==| '''PI6'''| '''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.262''' <ol style="list|-style-type: decimal;"><li><p>The Linux image released by OPi comes with the deb package of the kernel header file by default, and the storage location is | '''/opt/24'''| '''SPI1_CS0'''</p><p>orangepi@orangepi:~$ | '''ls /opt/linux-headers*PH5'''</p><p>/opt/linux| '''229'''|-headers-xxx-sun50iw9_x.x.x_arm64.deb</p></li><li><p>Use the following command to install the deb package of the kernel header file</p><p>orangepi@orangepi:~$ | '''26'sudo dpkg -i /opt/linux-headers*.deb'''</p></li><li><p>After installation, you can see the folder where the kernel header file is located under | '''/usr/srcSPI1_CS1'''.</p><p>orangepi@orangepi:~$ | '''PH9'''| '''ls /usr/src233'''</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 image. The source code of the hello module is in | ''''/usr/src/hello28'''. After entering this directory, then use the make command to compile.</p><p>orangepi@orangepi:~$ | '''cd /usr/src/helloTWI2-SCL/UART3_TX'''| '''PI9'''</p><p>orangepi@orangepi:/usr/src/hello$ | '''sudo make265'''</p><p>make |-C /lib/modules/5.4.125/build M=/usr/src/hello modules</p><p>make[1]: Entering directory | '''30'''| '''GND''/usr/src/linux-headers-5.4.125'</p><p>CC [M] /usr/src/hello/hello.o</p>| style="text-align: left;"|<p>Building modules, stage 2.</p>| style="text-align: left;"|<p>MODPOST 1 modules</p>|-<p>CC [M] /usr/src/hello/hello.mod.o</p>| '''32'''<p>LD [M] /usr/src/hello/hello.ko</p>| '''PWM1'''<p>make[1]: Leaving directory | '''PI11''/usr/src/linux-headers-5.4.125'</p></li><li><p>After compilation, the | '''hello.ko267'''|-| '''34''' kernel module will be generated</p><p>orangepi@orangepi:/usr/src/hello$ | '''ls *.koGND'''</p><p>hello.ko</p></li>| style="text-align: left;"|| style="text-align: left;"||-<li><p>Use the | '''insmod36''' command to insert the | style="text-align: left;"|| '''hello.koPC12''' kernel module into the kernel</p><p>orangepi@orangepi:/usr/src/hello$ | '''sudo insmod hello.ko76'''</p></li><li><p>Then use the |-| '''demsg38''' command to view the output of the | style="text-align: left;"|| '''hello.koPI4''' kernel module. If you can see the following output, it means that the | '''hello.ko260''' kernel module is loaded correctly.</p><p>orangepi@orangepi:/usr/src/hello$ |-| '''40'''dmesg | grep &quot;Hello&quotstyle="text-align: left;"|| '''PI3'''</p><p>[ 2871.893988] | '''Hello Orange Pi -- init259'''|}</p></lidiv> <li><p>Use the '''rmmod''' command to uninstall the '''hello.ko''' kernel moduleol start="2" style="list-style-type: decimal;"></pli><p>orangepi@orangepi:/usr/src/hello$ '''sudo rmmod hello'''</p><p>orangepi@orangepi:/usr/src/hello$ '''dmesg | grep &quot;Hello&quot;'''</p><p>[ 2871In Linux systems, uart is turned off by default and needs to be turned on manually before it can be used.893988] Hello Orange Pi -- init</p><p>[ 3173.800892] '''Hello Orange Pi -- exit'''</p></li></ol> <span id="testing-of-some-programming-languages-supported-by-linux-system"></span>== Testing of some programming languages supported by Linux system == <span id="debian-bullseye-system"></span>=== Debian Bullseye system === <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 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_world.c'''</p><p>#include &lt;stdio.h&gt;</p><p>int main(void)</p><p>{</p><p>printf(&quot;Hello World!\n&quot;);</p><p>return 0;</p><p>}</p></li><li><p>Then compile and run '''hello_world.c'''</p><p>orangepi@orangepi:~$ '''gcc -o hello_world hello_world.c'''</p><p>orangepi@orangepi:~$ '''./hello_world'''</p><p>Hello World!</p></li></ol></li><li><p>Debian Bullseye has Python3 installed by default</p><ol style="list-style-type: lower-alpha;"><li><p>The specific version of Python is as follows</p><p>orangepi@orangepi:~$ '''python3'''</p><p>'''Python 3.9.2''' (default, Feb 28 2021, 17:03:44)</p><p>[GCC 10.2.1 20210110] on linux</p><p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</p><p>&gt;&gt;&gt;</p><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p></li><li><p>Write the '''hello_world.py''' program in Python language</p><p>orangepi@orangepi:~$ '''vim hello_world.py'''</p><p>print('Hello World!')</p></li><li><p>The result of running '''hello_world.py''' is as follows</p><p>orangepi@orangepi:~$ '''python3 hello_world.py'''</p><p>Hello World!</p></li></ol></li><li><p>Debian Bullseye does not install Java compilation tools and operating environment by default.</p><ol style="list-style-type: lower-alpha;"><li><p>You can use the following command to install openjdk. The latest &gt; version in Debian Bullseye is openjdk-17</p><p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''</p></li><li><p>After installation, you can check the Java version.</p><p>orangepi@orangepi:~$ '''java --version'''</p></li><li><p>Write the Java version of '''hello_world.java'''</p><p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p><p>public static void main(String[] args)</p><p>{</p><p>System.out.println(&quot;Hello World!&quot;);</p><p>}</p><p>}</p></li><li><p>Then compile and run '''hello_world.java'''</p><p>orangepi@orangepi:~$ '''javac hello_world.java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p></li></ol></li></ol> <span id="debian-bookworm-system"></span>=== Debian Bookworm system === <ol style="list-style-type: decimal;"><li><p>Debian Bookworm is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.</p><ol style="list-style-type: lower-alpha;"><li><p>The version of a.gcc is as follows</p><p>orangepi@orangepi:~$ '''gcc --version'''</p><p>gcc (Debian 12.2.0-14) 12.2.0</p><p>Copyright (C) 2022 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p></li><li><p>Write the '''hello_world.c''' program in C language</p><p>orangepi@orangepi:~$ '''vim hello_world.c'''</p><p>#include &lt;stdio.h&gt;</p><p>int main(void)</p><p>{</p><p>printf(&quot;Hello World!\n&quot;);</p><p>return 0;</p><p>}</p></li><li><p>Then compile and run '''hello_world.c'''</p><p>orangepi@orangepi:~$ '''gcc -o hello_world hello_world.c'''</p><p>orangepi@orangepi:~$ '''./hello_world'''</p><p>Hello World!</p></li></ol></li><li><p>Debian Bookworm has Python3 installed by defaultThe opening steps are as follows:: </p>
<ol style="list-style-type: lower-alpha;">
<li><p>The specific version of Python is as follows</p><p>orangepi@orangepi:~$ First run '''python3orangepi-config'''</p><p>Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux</p><p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</p><p>&gt;&gt;&gt;</p><p>'''Use the Ctrl+D shortcut key Ordinary users remember to exit pythonadd 's interactive mode.'''</p></li><li><p>Write the sudo'''hello_worldpermissions.py''' program in Python language</p><p>orangepi@orangepi{| class="wikitable" style="width:~$ '''vim hello_world.py'''</p>800px;" <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.pysudo orangepi-config'''</p><p>Hello World!</p></li></ol>|}
</li>
<li><p>Debian Bookworm does not install Java compilation tools and operating environment by default.</p><ol style="list-style-type: lower-alpha;"><li><p>You can use the following command to install openjdk. The latest &gt; version in Debian Bookworm is openjdk-17</p><p>orangepi@orangepi:~$ Then select '''sudo apt install -y openjdk-17-jdkSystem'''</p></li><li><p>After installation, you can check the Java version.</p><p>orangepi@orangepi[[File:~$ '''java zero2w--version'''img80.png]]</p></li><li><p>Write the Java version of Then select '''hello_world.javaHardware'''</p><p>orangepi@orangepi[[File:~$ '''vim hello_worldzero2w-img81.java'''</p><p>public class hello_world</p><p>{</p><p>public static void main(String[png]] args)</p><p>{</p><p>System.out.println(&quot;Hello World!&quot;);</p><p>}</p><p>}</p></li><li><p>Then compile use the keyboard's arrow keys to locate the position shown in the picture below, and run then use the '''hello_world.javaspace'''</p><p>orangepi@orangepi:~$ '''javac hello_worldto select the serial port you want to open.java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p></li></ol></li></ol>
<span id{| class="ubuntuwikitable" style="width:800px;text-align: center;"|-| '''Multiplexing function in 40pin'''| '''Corresponding dtbo configuration'''|-| '''40pin - uart2'''| '''pi-uart2'''|-| '''40pin - uart3'''| '''pi-uart3'''|-| '''40pin -focaluart4'''| '''pi-system"></span>uart4'''|-| '''40pin - uart5'''| '''ph-uart5'''=== Ubuntu Focal system ===|}
<ol style="list[[File:zero2w-style-type: decimal;">img175.png]]<li><p>Ubuntu Focal is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.</pol><ol start="5" style="list-style-type: lower-alpha;"><li><p>The version of a.gcc is as follows</p><p>orangepi@orangepi:~$ Then select '''gcc --version&lt;Save&gt;'''to save</p><p>gcc (Ubuntu 9.4.0[[File:zero2w-1ubuntu1~20.04.1) 9.4img83.0png]]</p><p/li>Copyright (C) 2019 Free Software Foundation, Inc.</pli><p>This is free softwareThen select '''&lt;Back&gt; see the source for copying conditions. There is NO'''</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE[[File:zero2w-img84.png]]</p></li><li><p>Write the Then select '''hello_world.c&lt;Reboot&gt;''' program in C languageto restart the system to make the configuration take effect.</p><p>orangepi@orangepi[[File:~$ '''vim hello_worldzero2w-img85.c'''png]]</p><p/li>#include &lt;stdio.h&gt;</pol><p/li>int main(void)</pol><p>{</p!-- --><p>printf(&quotol start="3" style="list-style-type: decimal;Hello World!\n&quot;);</p"><pli>return 0;</p>After entering the Linux system, first confirm whether there is a uart5 device node under '''<pspan class="mark">}/dev</pspan>'''</lip>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <libig><p>Then compile and run '''hello_world注意, linux5.4系统为/dev/ttyASx.c'''</p><p/big>orangepi@orangepi|}{| class="wikitable" style="width:~$ '''gcc 800px;" |-o hello_world hello_world.c'''</p>| <p>orangepi@orangepi:~$ '''.ls /dev/hello_worldttyS*'''</p><p>Hello World!</p><dev/li>ttySx</olp>|}
</li>
<li><p>Ubuntu Focal has Python3 installed by default</p><ol style="listThen start testing the uart interface. First use Dupont wire to short-style-type: lower-alpha;"><li><p>The specific version circuit the rx and tx pins of Python3 is as follows</p><p>orangepi@orangepi:~$ '''python3'''</p><p>Python 3.8.10 (default, Nov 14 2022, 12:59:47)</p><p>[GCC 9.4.0] on linux</p><p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</p><p>&gt;&gt;&gt;</p><p>'''Use the Ctrl+D shortcut key uart interface to exit python's interactive modebe tested.'''</p></li><li><p>Write Use the '''hello_world.pygpio''' program command in Python language</p><p>orangepi@orangepi:~$ '''vim hello_worldwiringOP to test the loopback function of the serial port as shown below.py'''</p><p>If you can see the following print('Hello World!')</p></li><li><p>The result of running '''hello_world.py''' , it means the serial port communication is as follows</p><p>orangepi@orangepi:~$ '''python3 hello_worldnormal.py'''</p><p>Hello World!</p></li></ol></li><li><p>Ubuntu Focal does not have Java compilation tools and running environment installed by default.</p><ol {| class="wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;"><li><p>You can use the following command to install openjdk|-17| </pbig><p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''<Note that the last x in the gpio serial /p><dev/li><li><p>After installation, you can check ttySx command needs to be replaced with the serial number of the Java versioncorresponding uart device node.</p><p>orangepi@orangepi:~$ '''java --version'''</p><p>openjdk 17.0.2 2022-01-18</pbig><p>OpenJDK Runtime Environment (build 17.0.2+8-Ubuntu-120.04)</p>|}{| class="wikitable" style="width:800px;" <p>OpenJDK 64|-Bit Server VM (build 17.0.2+8-Ubuntu-120.04, mixed mode, sharing)</p></li><li><p>Write the Java version of '''hello_world.java'''</p>| <p>orangepi@orangepi:~$ '''vim hello_world.java'''<gpio serial /p><p>public class hello_world<dev/p><p>{</p><p>public static void main(String[] args)</p><p>{</p><p>System.out.println(ttySx &nbsp;&nbsp;&nbsp;&quotnbsp;Hello World!&quotnbsp;)&nbsp;</p><p>}</p><p>}</p></li><li><p>Then compile and run '''hello_world# linux-6.java1 test command'''</p><p>orangepi@orangepi:~$ '''javac hello_worldgpio serial /dev/ttyASx &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # linux-5.java'''</p><p>orangepi@orangepi:~$ '''java hello_world4 test command'''</p><p>Hello World!</p></li></ol></li></ol>
<span id="ubuntu-jammy-system"></span>
=== Ubuntu Jammy system ===
<ol style="list-style-type: decimal;"><li><p>Ubuntu Jammy is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.</p><ol style="list-style-typeOut: 0: lower-alpha&gt;"><li><p>The version of a.gcc is as follows0</p><p>orangepi@orangepiOut: 1:~$ '''gcc --version'''</p><p>gcc (Ubuntu 11.3.0-1ubuntu1~22.04.&gt; 1) '''11.3.0'''</p><p>Copyright (C) 2021 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p></li><li><p>Write the '''hello_world.c''' program in C language</p><p>orangepi@orangepiOut: 2:~$ '''vim hello_world.c'''</p><p>#include &lt;stdio.h-&gt;2</p><p>int main(void)</p><p>{</p><p>printf(Out: 3: -&quot;Hello World!\n&quot;);</p><p>return 0gt;3^C</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="list-style-type: lower-alpha;"><li><p>The specific version of Python3 is as follows</p><p>orangepi@orangepi:~$ Finally, you can run the '''python3serialTest.py'''</p><p>Python 3program in examples to test the loopback function of the serial port.10.6 (mainIf you can see the following print, May 29 2023, 11:10:38) [GCC 11it means that the serial port loopback test is normal.3.0] on linux</p><p>Type &quot{| class="wikitable" style="background-color:#ffffdc;help&quotwidth:800px;, &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>| <libig><p>Write the '''hello_world.py''' program Note that the x in Python language</p><p>orangepi@orangepi:~$ '''vim hello_world.py'''<dev/p><p>print('Hello World!')<ttySx or /p><dev/li><li><p>The result ttyASx in the command needs to be replaced with the serial number of running '''hello_worldthe corresponding uart device node.py''' is as follows</p><p>orangepi@orangepi:~$ '''python3 hello_world.py'''</pbig><p>Hello World!</p></li></ol>|}</li><li><p>Ubuntu Jammy does not install Java compilation tools and operating environment by default.</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>You can use the following command to install openjdk|-18</p>| <p>orangepiroot@orangepi:~$ /wiringOP-Python# '''sudo apt install -y openjdk-18-jdkcd examples'''</p></li><li><p>After installation, you can check the Java version.</p><p>orangepiroot@orangepi:~$ '''java /wiringOP--versionPython/examples# '''</p><p>openjdk 18python3 serialTest.0.2py -ea 2022-07-19</p><p>OpenJDK Runtime Environment (build 18.0.2-ea+9-Ubuntu-222.04)<device &quot;/p><p>OpenJDK 64-Bit Server VM (build 18.0.2-ea+9-Ubuntu-222.04, mixed mode, sharing)<dev/p></li><li><p>Write the Java version of '''hello_worldttySx&quot; # linux6.java1 use'''</p><p>orangepiroot@orangepi:~$ /wiringOP-Python/examples# '''vim hello_worldpython3 serialTest.java'''</p><p>public class hello_world</p><p>{</p><p>public static void main(String[] args)</p><p>{</p><p>System.out.println(py --device &quot;Hello World!/dev/ttyASx&quot;);</p><p>}</p><p>}</p></li><li><p>Then compile and run '''hello_world# linux5.java'''</p><p>orangepi@orangepi:~$ '''javac hello_world.java'''</p><p>orangepi@orangepi:~$ '''java hello_world4 use'''</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 ==
<span id="methodp>Out: 0: -to&gt; 0</p><p>Out: 1: -upload&gt; 1</p><p>Out: 2: -files&gt; 2</p><p>Out: 3: -to-the-development-board-linux-system-in-ubuntu-pc"&gt; 3</p><p>Out: 4:^C</p><p>exit</spanp>=== Method to upload files to the development board Linux system in Ubuntu PC ===|}</li></ol>
<span id="howhardware-towatchdog-upload-files-using-scp-commandtest"></span>==== How to upload files using scp command ====
<ol style="list-style-type: decimal;"><li><p>Use the scp command to upload files to the Linux system of the development board in Ubuntu PC. The specific command is as follows</p><ol style="list-style-type: lower-alpha;"><li><p>'''file_path: '''Needs to be replaced with the path of the file to &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>Hardware watchdog 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'''The watchdog_test program is pre-installed in the Linux system released by Orange Pi and can be tested directly.
<span id="how-The method to-upload-files-using-filezilla"></span>==== How to upload files using filezilla ====run the watchdog_test program is as follows:
<ol style="list-style-type: decimallower-alpha;"><li><p>First install filezilla in Ubuntu PCThe 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>testWe 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@testorangepi:~$ '''sudo apt install -y filezillawatchdog_test 10'''</p><p>open success</p><p>options is 33152,identity is sunxi-wdt</lip><lip>put_usr return,if 0,success:0</p><p>Then use the following command to open filezillaThe old reset time is: 16</p><p>test@testreturn ENOTTY,if -1,success:~$ '''filezilla'''0</p><p>return ENOTTY,if -1,success:0</lip><lip>put_user return,if 0,success:0</p><p>The interface after opening filezilla is as shown below. At this timeput_usr return,if 0, the remote site on the right is empty.success:0</p><p>keep alive</p><p>keep alive</p><p>keep alive</p>|}</li><div class="figure"/ol>
[[File:zero2w<span id="check-img255.png]]the-chipid-of-h618-chip"></span>
</div></li><li><p>The method == Check the chipid of connecting the development board is as shown in the figure below</p></li></ol>H618 chip ==
<div class="figure">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.
[[File{| class="wikitable" style="width:zero2w800px;" |-img256.png]]| orangepi@orangepi:~$ '''cat /sys/class/sunxi_info/sys_info | grep &quot;chipid&quot;'''
</div><ol start="5" style="list-style-type: decimal;"><li><p>Then choose to '''save the password''' and click '''OK'''</p><p>[[Filesunxi_chipid :zero2w-img257.png]]</p></li>338020004c0048080147478824681ed1<li><p>Then select '''Always trust this host''' and click '''OK'''</p></li></ol>|}
<div classspan id="figurepython-related-instructions"></span>
[[File:zero2w-img258.png]]== Python related instructions ==
</div><ol startspan id="7" style="listhow-to-compile-and-install-python-stylesource-type: decimal;code"><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></olspan>=== How to compile and install Python source code ===
<div {| class="figurewikitable"style="background-color:#ffffdc;width:800px;" |-| <big>'''If the Python version in the Ubuntu or Debian system software repository you are using does not meet the development requirements and you want to use the latest version of Python, you can use the following method to download the Python source code package to compile and install the latest version of Python.'''
[[File:zero2w-img259'''The following demonstration is to compile and install the latest version of Python 3.png]]9. If you want to compile and install other versions of Python, the method is the same (you need to download the source code corresponding to the Python you want to install).'''</big>|}
</div><ol start="8" style="list-style-type: decimal;"><li>Then select <p>First install the path dependency packages needed to be uploaded to the development board on compile Python</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y build-essential zlib1g-dev \'''</p><p>'''libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev \'''</p><p>'''libreadline-dev libffi-dev curl libbz2-dev'''</p>|}</li><li><p>Then download the right side latest version of Python3.9 source code and unzip it</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''wget \'''</p><p>'''https://www.python.org/ftp/python/3.9.10/Python-3.9.10.tgz'''</p><p>orangepi@orangepi:~$ '''tar xvf Python-3.9.10.tgz'''</p>|}</li><li><p>Then run the filezilla softwareconfiguration command</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''cd Python-3.9.10'''</p><p>orangepi@orangepi:~$ '''./configure --enable-optimizations'''</p>|}</li><li><p>Then compile and install Python3.9. The compilation time takes about half an hour.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''make -j4'''</p><p>orangepi@orangepi:~$ '''sudo make altinstall'''</p>|}</li><li><p>After installation, select you can use the file following command to be uploaded in Ubuntu PC on check the left side version number of the filezilla software, rightPython you just installed.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3.9 --version'''</p><p>'''Python 3.9.10'''</p>|}</li><li><p>Then update pip</p>{| class="wikitable" style="width:800px;" |-click the mouse, and then click the upload option to start uploading the file to the development board| <p>orangepi@orangepi:~$ '''/usr/local/bin/python3.9 -m pip install --upgrade pip'''</p>|}</li></ol>
<div classspan id="figurehow-to-replace-pip-source-in-python"></span>
[[File:zero2w-img260.png]]=== How to replace pip source in Python ===
</div><ol start{| class="9wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;">|-| <libig><p>After '''The default source used by Linux system pip is the upload is completedofficial source of Python. However, you can go to accessing the corresponding path official source of Python in China is very slow, and the development board Linux system installation of Python software packages often fails due to view the uploaded filenetwork reasons.</p></li><li><p>The method of uploading a folder is So when using pip to install the same as Python library, please remember to change the method of uploading a file, so I wonpip source.'''t go into details here.</p></li></olbig>|}
<span idol style="methodlist-tostyle-uploadtype: decimal;"><li><p>First install '''python3-filespip'''</p>{| class="wikitable" style="width:800px;" |-from| <p>orangepi@orangepi:~$ '''sudo apt-windowsget update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -pcy python3-pip'''</p>|}</li><li><p>How topermanently change the pip source under Linux</p><ol style="list-developmentstyle-boardtype: lower-linux-systemalpha;"><li><p>First create a new '''~/.pip''' directory, then add the '''pip.conf''' configuration file, and set the pip source in it to Tsinghua source.</spanp>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''mkdir -p ~/.pip'''</p><p>orangepi@orangepi:~$ '''cat &lt;&lt;EOF &gt; ~/.pip/pip.conf'''</p><p>'''[global]'''</p><p>'''timeout = Method 6000'''</p><p>'''index-url = https://pypi.tuna.tsinghua.edu.cn/simple'''</p><p>'''trusted-host = pypi.tuna.tsinghua.edu.cn'''</p><p>'''EOF'''</p>|}</li><li><p>Then use pip3 to upload files from Windows PC install the Python library very quickly</p></li></ol></li><li><p>How to development board temporarily change the pip source under Linux system =, where '''&lt;packagename&gt;''' needs to be replaced with a specific package name</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''pip3 install &lt;packagename&gt; -i \'''</p><p>'''https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn'''</p>|}</li></ol>
<span id="how-to-uploadinstall-files-using-filezilla-1docker"></span>==== How to upload files using filezilla ====
# First download the installation file of the Windows version of the filezilla software. The download link is as follows== How to install Docker ==
[https://filezillaThe Linux image provided by Orange Pi has Docker pre-projectinstalled, but the Docker service is not turned on by default.org/download.php?type=client Use the '''https://filezilla-project.org/downloadenable_docker.php?type=clientsh''']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.
[[File{| class="wikitable" style="width:zero2w800px;" |-img261| orangepi@orangepi:~$ '''enable_docker.png]]sh'''|}
<div class="figure">You can use the following command to test docker. If '''hello-world''' can be run, docker can be used normally.
[[File{| class="wikitable" style="width:zero2w800px;" |-img262.png]]| orangepi@orangepi:~$ '''docker run hello-world'''
</div><ol start="2" style="list-style-type: decimal;"><li><p>The downloaded installation package is as shown below, then double-click Unable to install it directly</p><p>find image '''FileZilla_Server_1.5.1_win64hello-setup.exe''world:latest'</p></li></ol>locally
During the installation process, please select '''Decline''' on the following installation interface, and then select '''Next&gt;'''latest: Pulling from library/hello-world
<div class="figure">256ab8fe8778: Pull complete
[[FileDigest:zero2w-img263.png]]sha256:7f0a9f93b4aa3022c3a4c147a449ef11e0941a1fd0bf4a8e6c9408b2600777c5
</div><ol start="3" style="list-styleStatus: Downloaded newer image for hello-typeworld: decimal;"><li>The interface after opening filezilla is as shown below. At this time, the remote site on the right is empty.</li></ol>latest
<div class="figure">
[[File'''<span style="color:zero2w-img264.png]]#FF0000">Hello from Docker!</span>'''
'''</div><ol start="4" span style="list-style-typecolor: decimal;#FF0000"><li>The method of connecting the development board is as shown in the figure below:</li>This message shows that your installation appears to be working correctly.</olspan>'''
<div class="figure">'''.….'''|}
[[File:zero2w-img256When using the docker command, if you are prompted for '''permission denied''', please add the current user to the docker user group so that you can run the docker command without sudo.png]]
</div><ol start{| class="5wikitable" style="list-style-typewidth: decimal800px;"><li>Then choose to |-| orangepi@orangepi:~$ '''save the passwordsudo usermod -aG docker $USER''' and click '''OK'''</li></ol>|}
<div {| class="figurewikitable" style="background-color:#ffffdc;width:800px;"|-| <big>'''Note: You need to log out and log in again to the system to take effect. You can also restart the system.'''</big>|}
[[File:zero2w<span id="how-img265.png]]to-install-home-assistant"></span>
</div><ol start="6" style="list-style-type: decimal;"><li>Then select '''Always trust this host''' and click '''OK'''</li></ol>How to install Home Assistant ==
<div {| class="figurewikitable" style="background-color:#ffffdc;width:800px;"|-| <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.'''</big>|}
[[File:zero2w-img266.png]] </div><ol start="7" style="list-style-type: decimal;"><li>After the connection is successful, you can see the directory structure of the development board's Linux file system on the right side of the filezilla software.</li></ol> <div class="figure"> [[File:zero2w-img267.png]] </div><ol start="8" style="list-style-type: decimal;"><li>Then select the path to be uploaded to the development board on the right side of the filezilla software, select the file to be uploaded on the Windows PC on the left side of the filezilla software, right-click the mouse, and then click the upload option to start uploading the file to the development board.</li></ol> <div class="figure"> [[File:zero2w-img268.png]] </div><ol start="9" style="list-style-type: decimal;"><li><p>After the upload is completed, you can go to the corresponding path in the development board Linux system to view the uploaded file.</p></li><li><p>The method of uploading a folder is the same as the method of uploading a file, so I won't go into details here.</p></li></ol> <span id="instructions-forinstallation-usingvia-the-logo-on-and-off-the-machinedocker"></span>== Instructions for using the logo on and off the machine = Installation via docker ===
<ol style="list-style-type: decimal;">
<li><p>The power on/off logo will only be displayed on First, please install docker and ensure that docker can run normally. For the desktop version installation steps of docker, please refer to the system by defaultinstructions in the [[Orange Pi Zero 2W#How to install Docker|'''How to Install Docker''']] section.</p></li><li><p>Set Then you can search for the docker image of Home Assistant</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''bootlogodocker search homeassistant''' variable </p>|}</li><li><p>Then use the following command to download the Docker image of Home Assistant to your local computer. The image size is about 1GB, and the download time will be relatively long. Please be patient and wait for the download to complete.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''falsedocker pull homeassistant/home-assistant''' in </p><p>Using default tag: latest</p><p>latest: Pulling from homeassistant/home-assistant</p><p>be307f383ecc: Downloading</p><p>5fbc4c07ac88: Download complete</p><p>'''/boot/orangepiEnv.txt..... (Omit some output)''' </p><p>3cc6a1510c9f: Pull complete</p><p>7a4e4d5b979f: Pull complete</p><p>Digest: sha256:81d381f5008c082a37da97d8b08dd8b358dae7ecf49e62ce3ef1eeaefc4381bb</p><p>Status: Downloaded newer image for homeassistant/home-assistant:latest</p><p>docker.io/homeassistant/home-assistant:latest</p>|}</li><li><p>Then you can use the following command to turn off view the switch logo.docker image of Home Assistant you just downloaded</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo vim docker images homeassistant/boot/orangepiEnv.txthome-assistant'''</p><p>verbosity=1REPOSITORY &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TAG &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IMAGE &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ID &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CREATED &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIZE</p><p>homeassistant/home-assistant &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; latest &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bfa0ab9e1cf5 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2 months ago &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '''bootlogo<span style=false"color:#FF0000">1.17GB</span>'''</p>|}</li><li><p>Set At this point you can run the Home Assistant docker container</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''bootlogodocker run -d \''' variable to </p>:<p>'''true--name homeassistant \''' in </p>:<p>'''/boot/orangepiEnv.txt--privileged \''' to enable the power on/off logo.</p>:<p>orangepi@orangepi:~$ '''sudo vim /boot/orangepiEnv.txt--restart=unless-stopped \'''</p>:<p>verbosity'''-e TZ=1Asia/Shanghai \'''</p>:<p>'''bootlogo=true-v /home/orangepi/home-assistant:/config \'''</p></li><li>:<p>The location of the boot logo picture in the Linux system is'''--network=host \'''</p>:<p>'''homeassistant/usr/share/plymouth/themes/orangepi/watermark.pnghome-assistant:latest'''</p>|}</li><li><p>After replacing Then enter【the IP address of the boot logo image, you need development board: 8123】in the browser to run see the following command to take effectHome Assistant interface</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>orangepi@orangepi:~$ '''sudo update-initramfs -uIt takes a while for the Home Assistant container to start. If the interface below does not display normally, please wait a few seconds before refreshing it. If the following interface is not displayed normally after waiting for more than a minute, it means there is a problem with the Home Assistant installation. At this time, you need to check whether there is a problem with the previous installation and setting process.'''</p></libig>|}</oldiv class="figure">
<span id="how[[File:zero2w-to-turn-on-the-power-button-in-linux5.4"></span>== How to turn on the power button in Linux5img180.4 ==png]]
There is no power on</off button on the main board of the development board. We can expand it through a 24pin expansion board. The location of the power ondiv></off button on the expansion board is as follows:li><li><p>Then enter your '''name, username''' and '''password''' and click '''Create Account'''</p><div class="figure">
[[File:zero2w-img269img181.png]]
The power on</off button of div></li><li><p>Then follow the Linux 6.1 image is turned on by defaultinterface prompts to set according to your own preferences, but the power onand then click Next</off button of the Linux 5.4 kernel image is turned off by default and needs to be turned on manually for normal use. The steps are as follows:p><div class="figure">
<ol style="list-style-type: decimal;"><li><p>First run '''orangepi-config'''. Ordinary users remember to add '''sudo''' permissions.</p><p>orangepi@orangepi:~$ '''sudo orangepi-config'''</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-img85img182.png]]</p></li></ol>
<span id="how-to-shut-down-and-restart-the-development-board"/div></li><li><p>Then click Next</spanp><div class== How to shut down and restart the development board =="figure">
<ol style="list-style-type: decimal;"><li><p>During the running of the Linux system, if you directly unplug the power supply, it may cause the file system to lose some data. It is recommended to use the '''poweroff''' command to shut down the Linux system of the development board before powering off, and then unplug the power supply.</p><p>orangepi@orangepi:~$ '''sudo poweroff'''</p><p>'''Note that after turning off the development board, you need to unplug and replug the power supply before it can be turned on.'''</p></li><li><p>In addition to using the poweroff command to shut down, you can also use the power on/off button on the expansion board to shut down.</p><p>[[File:zero2w-img269img183.png]]</p><p>'''Note that Linux 5.4 requires manual configuration of the power on/off button before it can be used. For the opening method, please refer to the method of opening the power button in Linux5.4.'''</p></li><li><p>Use the '''reboot''' command to restart the Linux system in the development board</p><p>orangepi@orangepi:~$ '''sudo''' '''reboot'''</p></li></ol>
<span id/div></li><li><p>Then click Finish</p><div class="linux-sdkorangepi-build-usage-instructionsfigure"></span>
= '''Linux SDK——orangepi[[File:zero2w-build usage instructions''' =img184.png]]
<span id/div></li><li><p>The main interface finally displayed by Home Assistant is as shown below</p><p>[[File:zero2w-img185.png]]</p></li><li><p>Method to stop Home Assistant container</p><ol style="compilationlist-style-systemtype: lower-requirementsalpha;"><li><p>The command to view the docker container is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''docker ps -a'''</p>|}</li><li><p>The command to stop the Home Assistant container is as follows</spanp>{| class="wikitable" style= Compilation system requirements "width:800px;" |-| <p>orangepi@orangepi:~$ '''docker stop homeassistant'''</p>|}</li><li><p>The command to delete the Home Assistant container is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''docker rm homeassistant'''</p>|}</li></ol></li></ol>
The Linux SDK, '''orangepi<span id="installation-build''', only supports running on X64 computers with '''Ubuntu 22.04''' installed. Therefore, before downloading orangepivia-build, please first ensure that the Ubuntu version installed on your computer is Ubuntu 22.04. The command to check the Ubuntu version installed on the computer is as follows. If the Release field does not display '''22.04''', it means that the Ubuntu version currently used does not meet the requirements. Please change the system before performing the following operations.python"></span>
test@test:~$ '''lsb_release -a'''=== Installation via python ===
No LSB modules are available{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Before installation, please change the source of pip to a domestic source to speed up the installation of Python packages.For the configuration method, see the instructions in the section &quot;[[Orange Pi Zero 2W#How to replace pip source in Python|How to Change the Pip Source of Python]]&quot;'''</big>|}
Distributor ID<ol style="list-style-type: Ubuntudecimal;"><li><p>First install dependency packages</p>Description{| class="wikitable" style="width: Ubuntu 22.04 LTS800px;" |-| Release<p>orangepi@orangepi: ~$ '''22.04sudo apt-get update'''</p> Codename<p>orangepi@orangepi: ~$ '''jammysudo apt-get install -y python3 python3-dev python3-venv \'''</p> If the computer is installed with a Windows system and does not have Ubuntu 22.04 installed on it, you can consider using<p>'''VirtualBoxpython3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \''' or </p><p>'''VMwarelibopenjp2-7 libtiff5 libturbojpeg0-dev tzdata''' to install an Ubuntu 22.04 virtual machine in the Windows system. But please note, do not compile orangepi</p>|}{| class="wikitable" style="background-build on the WSL virtual machine, because orangepicolor:#ffffdc;width:800px;" |-build has not been tested in the WSL virtual machine, so there | <big><p>'''If it is no guarantee that orangepi-build can be used normally in WSL. In additiondebian12, please do not compile use the Linux system on the development board. Use following command:'''</p></big><p>orangepi@orangepi:~$ '''sudo apt-build. The installation image download address of Ubuntu 22.04 amd64 version is:get update'''</p> [https<p>orangepi@orangepi://repo.huaweicloud.com/ubuntu~$ '''sudo apt-releases/21.04/ubuntuget install -21.04y python3 python3-desktopdev python3-amd64.iso venv \'''https:<//mirrors.tuna.tsinghua.edu.cn/ubuntup><p>'''python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-releasesessential \'''</22.04/ubuntup><p>'''libopenjp2-22.047 libturbojpeg0-desktop-amd64.isodev tzdata''']</p>|}</li>After installing Ubuntu 22<li><p>Then you need to compile and install Python3.9.04 on your computer or virtual machineFor the method, please first set refer to the software [[Orange Pi Zero 2W#Python related instructions|'''Python source of Ubuntu 22code compilation and installation method''']] section.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> <ol {| class="wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;"|-| <big><lip>For the method '''The default Python version of replacing Tsinghua SourceDebian Bullseye is Python3.9, please refer so there is no need to the instructions on this pagecompile and install it.'''</lip></olp[https://mirrors'''The default Python version of Ubuntu Jammy is Python3.tuna10, so there is no need to compile and install it.tsinghua.edu.cn/help/ubuntu'''</ p><p>'''https://mirrorsThe default Python version of Debian Bookworm is Python3.tuna.tsinghua.edu11, so there is no need to compile and install it.cn/help/ubuntu/''']</p></big>|}</li><ol startli><p>Then create a Python virtual environment</p>{| class="2wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;"|-| <big><lip>Note that '''Debian Bookworm is python3.11, please remember to replace the Ubuntu version needs to be switched to 22.04corresponding command.'''</lip></olbig>|}[[File:zero2w-img271.png]] <ol start{| class="3wikitable" style="list-style-typewidth: lower-alpha800px;">|-| <lip>The contents of the orangepi@orangepi:~$ '''sudo mkdir /etcsrv/apt/sources.listhomeassistant''' file that need to be replaced are:</lip></olptestorangepi@testorangepi:~$ '''sudo mv chown orangepi:orangepi /etcsrv/apthomeassistant'''</sources.list cat p><p>orangepi@orangepi:~$ '''cd /etcsrv/apthomeassistant'''</sourcesp><p>orangepi@orangepi:~$ '''python3.list9 -m venv .bak'''</p> test<p>orangepi@testorangepi:~$ '''sudo vim source bin/activate'''</p><p>(homeassistant) orangepi@orangepi:/srv/homeassistant$</p>|}</li><li><p>Then install the required Python packages</etcp>{| class="wikitable" style="width:800px;" |-| <p>(homeassistant) orangepi@orangepi:/aptsrv/sources.listhomeassistant$ '''python3 -m pip install wheel'''</p>|}# The source code image is commented by default to improve apt update speed. You </li><li><p>Then you can uncomment it yourself if necessary.install Home Assistant Core</p>{| class="wikitable" style="width:800px;" |-| deb https<p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ '''pip3 install homeassistant'''</mirrors.tuna.tsinghua.edu.cnp>|}</ubuntuli><li><p>Then enter the following command to run Home Assistant Core</ jammy main restricted universe multiversep>{| class="wikitable" style="width:800px;" # deb|-src https| <p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ '''hass'''</p>|}</mirrorsli><li><p>Then enter【'''development board IP address: 8123'''】 in the browser to see the Home Assistant interface</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''When you run the hass command for the first time, some libraries and dependency packages necessary for operation will be downloaded, installed and cached.tunaThis process may take several minutes.tsinghuaNote that you cannot see the Home Assistant interface in the browser at this time.eduPlease wait for a while and then refresh it.cn'''</ubuntup></ jammy main restricted universe multiversebig>|}<div class="figure">
deb https[[File://mirrorszero2w-img180.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiversepng]]
# deb-src https:</div></mirrors.tuna.tsinghua.edu.cnli></ubuntu/ jammy-updates main restricted universe multiverseol>
deb https://mirrors.tuna.tsinghua.edu.cn<span id="opencv-installation-method"></ubuntu/ jammy-backports main restricted universe multiversespan>
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse== OpenCV installation method ==
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu<span id="use-apt-to-install-opencv"></ jammy-security main restricted universe multiversespan>=== Use apt to install OpenCV ===
# 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-alphadecimal;"><li>After the replacement, you need to update the package information and ensure that no errors are reported.</lip>The installation command is as follows</olp>{| class="wikitable" style="width:800px;" |-test| <p>orangepi@testorangepi:~$ '''sudo apt-get update''' <ol start="5" style="list-style-type: lower-alpha;"/p><lip>orangepi@orangepi:~$ '''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.sudo apt-get install -y libopencv-dev python3-opencv'''</lip>|}</olli> <span id="obtain-li><p>Then use the following command to print the-source-code-version number of-linux-sdk">OpenCV. The output is normal, indicating that the OpenCV installation is successful.</spanp>== Obtain the source code of linux sdk == <span idol style="downloadlist-orangepistyle-buildtype: lower-from-githubalpha;"></spanli><p>=== Download orangepi-build from github === Linux sdk refers to the orangepi-build set The version of codesOpenCV in Ubuntu22. Orangepi-build 04 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 codeas follows:</p> test@test{| class="wikitable" style="width:~$ '''sudo apt-get update'''800px;"  test@test:~$ '''sudo apt-get install |-y git'''| test<p>orangepi@testorangepi:~$ '''git clone https://github.com/orangepipython3 -xunlong/orangepi-buildc &quot;import cv2; print(cv2.git -b next__version__)&quot;'''</p> <p>'''Note that when using the H618 Soc development board, you need to download the source code of the next branch of orangepi-build4. The above git clone command needs to specify the branch of the orangepi-build source code as next5.4''' <div class="figure"/p[[File:zero2w-img272.png]]|}</divli>'''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. <li><p>The name and password are usually entered incorrectly in the address version of the orangepi-build warehouse behind git clone. Please carefully check whether there are any errors OpenCV in the spelling of the command, rather than thinking that we have forgotten to provide the username and password of the github accountUbuntu20.''' The u-boot and linux kernel versions currently used by the H618 series development boards are 04 is as follows:</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''branchpython3 -c &quot;import cv2; print(cv2.__version__)&quot;'''</p>| <p>'''u-boot Version4.2.0'''</p>| '''linux Kernel }</li><li><p>The version'''of OpenCV in Debian11 is as follows:</p>{| class="wikitable" style="width:800px;"
|-
| '''current'''| <p>orangepi@orangepi:~$ '''upython3 -boot v2018c &quot;import cv2; print(cv2.05__version__)&quot;'''</p>| <p>'''linux54.45.1'''</p>|}</li><li><p>The version of OpenCV in Debian12 is as follows:</p>{| class="wikitable" style="width:800px;"
|-
| '''next'''| <p>orangepi@orangepi:~$ '''upython3 -boot v2021c &quot;import cv2; print(cv2.07__version__)&quot;'''</p>| <p>'''linux64.6.10'''</p>
|}
</li></ol>
</li></ol>
'''The branch mentioned here is not <span id="set-up-the same thing as -chinese-environment-and-install-the branch of orangepi-build source code, please don't get confused. This branch is mainly used to distinguish different kernel source code versions.'''chinese-input-method"></span>
'''We define == Set up the linux5.4 bsp kernel currently provided by Allwinner as Chinese environment and install the current branch. The latest linux6.1 LTS kernel is defined as the next branch.'''Chinese input method ==
After downloading{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note, before installing the Chinese input method, please make sure that the following files and folders will be included:Linux system used by the development board is a desktop version.'''</big>|}
<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> test@test:~/orangepi-build$ '''ls''' '''build.sh external LICENSE README.md scripts''' '''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.''' <span id="download-the-crossdebian-compilationsystem-toolinstallation-chainmethod"></span>=== Download the cross-compilation tool chain Debian system installation method === 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.
<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 '''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>'''<span style="color:#FF0000">Then restart the Linux system to make the configuration take effect.</span>'''</p></li>
<li><p>Then open '''Fcitx configuration'''</p>
<p>[[File:zero2w-img193.png]]</p></li>
<li><p>Then click the + sign as shown in the picture below</p>
<p>[[File:zero2w-img194.png]]</p></li>
<li><p>Then search '''Google Pinyin''' and click '''OK'''</p>
<div class="figure">
[[File:zero2w-img273img195.png]]
</div></li>The mirror URL of <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 cross-compilation tool chain in China is '''Geany''' editor to test the open source software mirror site of Tsinghua UniversityChinese input method</p><p>[[File:zero2w-img198.png]]</p></li><li><p>The Chinese input method test is as follows</p><p>[https[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/mirrorsdefault/locale''' to '''zh_CN.tuna.tsinghua.edu.cnUTF-8'''</armbianp>{| class="wikitable" style="width:800px;" |-releases| <p>orangepi@orangepi:~$ '''sudo vim /etc/default/locale'''</_toolchainp><p># File generated by update-locale</ p><p>LC_MESSAGES='''https<span style="color:#FF0000">zh_CN.UTF-8</span>'''</mirrorsp><p>LANG='''<span style="color:#FF0000">zh_CN.tunaUTF-8</span>'''</p><p>LANGUAGE='''<span style="color:#FF0000">zh_CN.tsinghua.edu.cnUTF-8</span>'''</armbian-releasesp>|}</_toolchainli><li><p>Then '''<span style="color:#FF0000">restart the system</span>'''and you will see that the system is displayed in Chinese.</p><p>[[File:zero2w-img200.png]]</p></li></ol>
After toolchains is downloaded, it will contain multiple versions <span id="installation-method-of cross-compilation t'''toolchain''':ubuntu-20.04-system"></span>
test@test:~/orangepi-build$ '''ls toolchains/'''=== Installation method of Ubuntu 20.04 system ===
gcc<ol style="list-armstyle-11type: decimal;"><li><p>First open '''Language Support'''</p><p>[[File:zero2w-img201.2png]]</p></li><li><p>Then find the '''Chinese (China)''' option</p><p>[[File:zero2w-2022img202.02png]]</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-x86_64img203.png]]</p></li>{| class="wikitable" style="background-aarch64color:#ffffdc;width:800px;" |-none| <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-linuxstyle-gnu gcctype: decimal;"><li><p>Then select '''Apply System-linaroWide''' to apply the Chinese settings to the entire system</p><p>[[File:zero2w-4.9img204.4png]]</p></li><li><p>Then set the '''Keyboard input method system''' system to '''fcitx'''</p><p>[[File:zero2w-2017img205.01png]]</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-x86_64_aarch64entering 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-linuximg206.png]]</p></li><li><p>Then you can see that the desktop is displayed in Chinese</p><p>[[File:zero2w-gnu gccimg207.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-linaro-7img208.png]]</p></li><li><p>After opening '''Geany''', the English input method is still the default.4We can switch to the Chinese input method through the '''Ctrl+Space''' shortcut key, and then we can input Chinese.1</p><p>[[File:zero2w-2019img209.02-x86_64_arm-linux-gnueabipng]]</p></li></ol>
gcc<span id="installation-armmethod-11.2-2022.02-x86_64of-armubuntu-none-linux-gnueabihf gcc-linaro-422.9.404-2017.01-x86_64_arm-linux-gnueabi gcc-linaro-aarch64-none-elf-4.8-2013.11_linuxsystem"></span>
gcc-arm-9=== Installation method of Ubuntu 22.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_linux04 system ===
gcc<ol style="list-armstyle-9type: decimal;"><li><p>First open '''Language Support'''</p><p>[[File:zero2w-img201.2png]]</p></li><li><p>Then find the '''Chinese (China)''' option</p><p>[[File:zero2w-2019img210.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.12After dragging, the display will be as shown below:</p><p>[[File:zero2w-x86_64img211.png]]</p></li>{| class="wikitable" style="background-armcolor:#ffffdc;width:800px;" |-none| <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-linuxstyle-gnueabihf gcctype: decimal;"><li><p>Then select '''Apply System-linaroWide''' to apply the Chinese settings to the entire system</p><p>[[File:zero2w-7img212.4png]]</p></li><li><p>'''<span style="color:#FF0000">Then restart the Linux system to make the configuration take effect</span>'''</p></li><li><p>After re-entering the system, please select '''Do not ask me again''' in the following interface, and then please decide whether the standard folder should also be updated to Chinese according to your own preferences.1</p><p>[[File:zero2w-2019img206.02png]]</p></li><li><p>Then you can see that the desktop is displayed in Chinese</p><p>[[File:zero2w-x86_64_aarch64-linux-gnu gcc-linaro-arm-none-eabi-4img207.8png]]</p></li><li><p>Then open the Fcitx5 configuration program</p><p>[[File:zero2w-2014img213.04_linuxpng]]</p></li><li><p>Then choose to use Pinyin input method</p><div class="figure">
The cross[[File:zero2w-compilation tool chain used to compile the H618 Linux kernel source code is:img214.png]]
<ol style="list/div></li><li><p>The interface after selection is as shown below, then click OK</p><p>[[File:zero2w-style-typeimg215.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: lowerzero2w-alpha;"img208.png]]</p></li><li>linux5<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.4</p><p>[[File:zero2w-img216.png]]</p></li></ol>
'''gcc<span id="how-armto-11.2remotely-2022.02log-x86_64in-aarch64to-nonethe-linux-gnu'''system-desktop"></span>
<ol start="2" style="list-style-type: lower-alpha;"><li>linux6.1</li></ol>How to remotely log in to the Linux system desktop ==
'''gcc<span id="remote-armlogin-11.2using-2022.02-x86_64-aarch64-none-linux-gnu'''nomachine"></span>=== Remote login using NoMachine ===
The cross{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-compilation tool chain used | <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 compile become familiar with the H618 u-boot source code use of NoMachine. The document link isas follows:'''
'''https://knowledgebase.nomachine.com/DT10R00166'''<ol /big>|}{| class="wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;">|-| <li>v2018.05</li></olbig> '''gcc-linaro-7NoMachine 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.4The following demonstrates how to remotely log in to the Linux system desktop of the Orange Pi development board through NoMachine in Windows.1-2019For installation methods on other platforms, please refer to NoMachine's official documentation.02-x86_64_arm-linux-gnueabi'''</big>|}<ol start{| class="2wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;">|-| <li>v2021.07</li></olbig> '''gcc-arm-11.2-2022Before 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.02-x86_64-aarch64-none-linux-gnu''' <span id="orangepi-build-complete-directory-structure-description"></spanbig>=== orangepi-build complete directory structure description ===|}
<ol style="list-style-type: decimal;">
<li><p>After downloading, the orangepi-build warehouse does not contain First download the source code installation package of the linux kernelNoMachine software Linux '''<span style="color:#FF0000">arm64</span>''' deb version, u-boot and cross-compilation tool chain. The source code then install it into the Linux system of the linux kernel and u-boot is stored in an independent git warehouse.development board</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The git warehouse where Since H618 is an ARMv8 architecture SOC and the linux kernel source code system we use is stored Ubuntu or Debian, we need to download the '''NoMachine for ARM ARMv8 DEB''' installation package. The download link is as follows. Please note that the branch of the linux-orangepi warehouse is switched to:</pli><ol {| class="wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;">|-| <libig>Linux5'''Note that this download link may change, please look for the Armv8/Arm64 version of the deb package.4</li>'''</olbig></li></ol>|}{| class="wikitable" style="width:800px;" </li></ol>|-| [https://githubwww.nomachine.com/orangepi-xunlong/linux-orangepi/treedownload/download&id=112&s=ARM '''orange-pi-5https://downloads.nomachine.4-sun50iw9com/download/?id=118&amp;distro=ARM''']|}
[[File:zero2w-img217.png]]
</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>Linux6<p>In addition, you can also download the '''NoMachine''' installation package from the official tool.1</lip><p>[[File:zero2w-img218.png]]</olp><p>First enter the '''remote login software-NoMachine''' folder</p>https<p>[[File://githubzero2w-img219.compng]]</orangepi-xunlongp><p>Then download the arm64 version of the deb installation package</linuxp><p>[[File:zero2w-orangepiimg220.png]]</treep></li><li><p>Then upload the downloaded '''orange-pi-6nomachine_x.x.x_x_arm64.1-sun50iw9deb''' to the Linux system of the development board</p><ol start="2" style="list-style-type: lower-alpha;"/li><li><p>The git warehouse where Then use the u-boot source code is stored is as follows. Please note that following command to install '''NoMachine''' in the branch Linux system of the u-boot-orangepi warehouse is switched todevelopment board</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;">|-| <lip>v2018orangepi@orangepi:~$ '''sudo dpkg -i nomachine_x.05x.x_x_arm64_arm64.deb'''</p>|}</li></ol>
</li></ol>
<ol start="2" style="list-style-type: decimal;">
<li>Then download the installation package of the Windows version of the NoMachine software. The download address is as follows</li>
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|
<big>'''Note that this download link may change.'''</big>
|}
{| class="wikitable" style="width:800px;"
|-
|
'''https://downloads.nomachine.com/download/?id=9'''
|}
https[[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</githubp><p>[[File:zero2w-img222.compng]]</p></orangepi-xunlongli><li><p>After NoMachine is started, it will automatically scan other devices with NoMachine installed on the LAN. After entering the main interface of NoMachine, you can see that the development board is already in the list of connectable devices, and then click on the location shown in the red box in the picture below You can now log in to the Linux system desktop of the development board.</up><p>[[File:zero2w-boot-orangepiimg223.png]]</treep></li><li><p>Then click '''v2018.05-h618OK'''</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>
<ol startspan id="2" style="listremote-stylelogin-type: lowerusing-alpha;vnc"><li>v2021.07</li></olspan>
https://github.com/orangepi-xunlong/u-boot-orangepi/tree/'''v2021.07-sunxi'''=== Remote login using VNC ===
<ol start{| class="2wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;"><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><pbig>'''build.sh''': Compile startup script</p></li><li><p>'''external''': Contains Before operating, please make sure that the Windwos computer and the configuration files needed to compile development board are in the image, scripts for specific functionssame LAN, and the source code of some programs. The rootfs compressed package cached during the image compilation process is also stored that you can log in external.</p></li><li><p>'''kernel''': Store to the source code Ubuntu or Debian system of the linux kernel</p></li><li><p>'''LICENSE''': GPL 2 license file</p></li><li><p>'''READMEdevelopment board through ssh normally.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></ol></li></ol>
test'''<span style="color:#FF0000">There are many problems with VNC testing in Ubuntu20.04, please do not use this method.</span>'''</big>|} <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@testorangepi:~/orangepi-build$ '''lssudo set_vnc.sh'''</p><p>You will require a password to access your desktops.</p>
'''build.sh external kernel LICENSE output README.md scripts toolchains u-boot userpatches'''
 
<span id="compile-u-boot"></span>
== Compile u-boot ==
<p>Password: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '''<span style="color:# Run FF0000">#Set the vnc password here, 8 characters</span>'''</p><p>Verify: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '''<span style="color:#FF0000">#Set the build.sh scriptvnc password here, remember 8 characters</span>'''</p><p>Would you like to add sudo permissionsenter a view-only password (y/n)? '''<span style="color:#FF0000">n</span>'''</p><p>xauth: file /root/.Xauthority does not exist</p>
test@test:~/orangepi-build$ '''sudo ./build.sh'''
<ol start="2" style="list-style-type: decimal;"><lip>Select New 'X''U-boot package''' and press Enter</li>desktop is orangepi:1</olp>
<div class="figure">
[[File<p>Creating default startup script /root/.vnc/xstartup</p><p>Starting applications specified in /root/.vnc/xstartup</p><p>Log file is /root/.vnc/orangepi:zero2w-img2741.png]]log</p>
</div>
<ol start="3" style="list-style-type: decimal;">
<li>Then select the model of the development board</li></ol>
[[File:zero2w-img275.png]]<p>Killing Xtightvnc process ID 3047</p>
<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></li></ol>
<blockquotep>a. If the development board you purchased has a memory size of New 'X' desktop is orangepi:1.5GB, please select the first option.</p>
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-typep>Starting applications specified in /root/.vnc/xstartup</p><p>Log file is /root/.vnc/orangepi: decimal;"1.log</p>|}</li><li><p>Then it will start The steps to use MobaXterm software to connect to compile u-boot. Some of the information prompted when compiling the next branch is development board Linux system desktop are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li>Version First click Session, then select VNC, then fill in the IP address and port of u-boot source codethe development board, and finally click OK to confirm.</li></ol> </li></oldiv class="figure">
[ o.k[File:zero2w-img227. png] Compiling u-boot [ '''v2021.07''' ]
</div></ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>Version of <p>Then enter the crossVNC password set earlier</p><p>[[File:zero2w-compilation tool chainimg228.png]]</p></li><li><p>After successful login, the interface is displayed as shown below, and then you can remotely operate the desktop of the development board Linux system.</p></olli>
[ o.k[File:zero2w-img229. png]] Compiler version [ '''aarch64</ol></li></ol><span id="qt-linuxinstallation-gnu-gcc 11''' ]method"></span>
<ol start="3" style="list-style-type: lower-alpha;"><li>Path to the compiled u-boot deb package</li></ol>QT installation method ==
[ o.k. ] Target directory [ '''orangepi-build/output/debs/u-boot''' ] <ol start="4" style="list-style-type: lower-alphadecimal;"><li>The package name of the compiled u-boot deb package</li></ol> [ o.k. ] File name [ '''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb''' ] <ol start="5" style="list-style-type: lower-alpha;"p><li>Compilation time</li></ol> [ o.k. ] Runtime [ '''1 min''' ] <ol start="6" style="list-style-type: lower-alpha;"><li>Repeat the command to compile u-boot. Use the following command without selecting through the graphical interface. You can start compiling u-boot directly.script to install QT5 and QT Creator</li></olp[ o.k. ] Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=u-boot''' ] <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/''' '''linux-u-boot-next-orangepizero2w_xinstall_qt.x.x_arm64.debsh''' <ol start="8" style="list-style-type: decimal;"><li>When the orangepi-bulid compilation system compiles the u-boot source code, it will first synchronize the u-boot source code with the u-boot source code of the github server. Therefore, if you want to modify the u-boot source code, you first need to turn off the download and update function of the source code. ('''You need to completely compile u-boot before you can turn off this function, otherwise it will prompt that the source code of u-boot cannot be found'''), otherwise the modifications will be restored. The method is as follows:</li></olp>|}<blockquote>Set the IGNORE_UPDATES variable in u'''userpatches/config-default.conf''' to &quot;yes&quot;</blockquote>test@test:~/orangepi-build$ '''vim userpatches/config-default.conf''' ...... IGNORE_UPDATES=&quot;'''yes'''&quot; ...... <ol start="9" style="list-style-type: decimal;"li><li><p>When debugging u-boot codeAfter installation, you can use the following method to update u-boot in the linux image for testingQT version number will be automatically printed.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The qt version that comes with Ubuntu20.04 is '''5.12.8'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''install_qt.sh'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version '''<span style="color:#FF0000">5.12.8</span>''' in /usr/lib/aarch64-linux-gnu</p>|}</li><li><p>The QT version that comes with Ubuntu22.04 is '''5.15.3'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''install_qt.sh'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version '''<span style="color:#FF0000">5.15.3</span>''' in /usr/lib/aarch64-linux-gnu</p>|}</li><li><p>The QT version that comes with Debian11 is '''5.15.2'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''install_qt.sh'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version '''<span style="color:#FF0000">5.15.2</span>''' in /usr/lib/aarch64-linux-gnu</p>|}</li><li><p>The QT version that comes with Debian12 is '''5.15.8'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''install_qt.sh'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version '''<span style="color:#FF0000">5.15.8</span>''' in /usr/lib/aarch64-linux-gnu</p>|}</li></ol></li><li><p>Then you can see the QT Creator startup icon in '''Applications'''</p><p>[[File:zero2w-img230.png]]</p><p>You can also use the following command to open QT Creator</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''qtcreator'''</p>|}</li><li><p>The interface after QT Creator is opened is as follows</p><p>[[File:zero2w-img231.png]]</p></li><li><p>The version of QT Creator is as follows</p><ol style="list-style-type: lower-alpha;"><li><p>The default version of QT Creator in '''Ubuntu20.04''' is as follows</p><p>[[File:zero2w-img232.png]]</p></li><li><p>The default version of QT Creator in '''Ubuntu22.04''' is as follows</p><p>[[File:zero2w-img233.png]]</p></li><li><p>The default version of QT Creator in '''Debian11''' is as follows</p><p>[[File:zero2w-img234.png]]</p></li><li><p>The default version of QT Creator in '''Debian12''' is as follows</p><p>[[File:zero2w-img235.png]]</p></li></ol></li><li><p>Then set up QT</p><ol style="list-style-type: lower-alpha;"><li><p>First upload open '''Help'''-&gt;'''About Plugins...'''.</p><p>[[File:zero2w-img236.png]]</p></li><li><p>Then remove the compiled deb package check mark of u'''ClangCodeModel'''</p><p>[[File:zero2w-img237.png]]</p></li><li><p>'''<span style="color:#FF0000">After setting up, you need to restart QT Creator</span>'''</p></li><li><p>Then make sure the GCC compiler used by QT Creator. If the default is Clang, please change it to GCC.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Debian12 please skip this step.'''</p></big>|}<p>[[File:zero2w-img238.png]]</p><p>[[File:zero2w-img239.png]]</p></li></ol></li><li><p>Then you can open a sample code</p><p>[[File:zero2w-boot img240.png]]</p></li><li><p>After clicking on the sample code, the corresponding instruction document will automatically open. You can read the instructions carefully.</p><p>[[File:zero2w-img241.png]]</p></li><li><p>Then click '''Configure Project'''</p><p>[[File:zero2w-img242.png]]</p></li><li><p>Then click the green triangle in the lower left corner to compile and run the Linux system sample code</p><p>[[File:zero2w-img243.png]]</p></li><li><p>After waiting for a period of time, the interface shown in the development boardfigure below will pop up, which means that QT can compile and run normally.</p><p>[[File:zero2w-img244.png]]</p></li><li><p>References</olp>{| class="wikitable" style="width:800px;" |-| <p>[https://wiki.qt.io/Install_Qt_5_on_Ubuntu '''https://wiki.qt.io/Install_Qt_5_on_Ubuntu''']</p><p>[https://download.qt.io/archive/qtcreator '''https://download.qt.io/archive/qtcreator''']</p><p>[https://download.qt.io/archive/qt '''https://download.qt.io/archive/qt''']</p>|}
</li></ol>
test@test:~/orangepi<span id="ros-installation-build$ '''cd output/debsmethod"></u-boot'''span>
test@test:~/orangepi_build/output/debs/u-boot$ '''scp \'''== ROS installation method ==
'''linux<span id="how-uto-bootinstall-nextros-orangepizero2w_x.x.x_arm64.deb [mailto:root@192.168.1-noetic-on-ubuntu20.xxx:04"></root root@192.168.span>=== How to install ROS 1Noetic on Ubuntu20.xxx:/root]'''04 ===
<ol start="2" style="list-style-type: lower-alpha;"><li>Install # The currently active version of ROS 1 is as follows, the new u-boot deb package just uploaded</li></ol>recommended version is '''Noetic Ninjemys'''
orangepi@orangepi:~$ '''sudo dpkg -i''' '''linux-u-boot-next:[[File:zero2w-orangepizero2w_x.x.x_arm64img245.deb'''png]]
<ol start="3" style="list-style-type: lower-alpha;"><li>Then run the nand-sata:[[File:zero2w-install script</li></ol>img246.png]]
orangepi@orangepi:~$ :{| class="wikitable" style="width:800px;" |-| [http://docs.ros.org/ '''sudo nand-sata-installhttp://docs.ros.org''']
<ol start="4" style="list-style-type: lower-alpha;"><li>Then select '''5 Installhttps:/Update the bootloader on SD/eMMCwiki.ros.org/Distributions'''</li></ol>|}
<ol start="2" style="list-style-type: decimal;"><li><p>The link to the official installation documentation of ROS 1 '''Noetic Ninjemys''' is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>[http://wiki.ros.org/noetic/Installation/Ubuntu '''http://wiki.ros.org/noetic/Installation/Ubuntu''']</p>|}</li><li><p>In the official installation documentation of ROS '''Noetic Ninjemys''', Ubuntu recommends using Ubuntu20.04, so please ensure that the system used by the development board is '''<span style="color:#FF0000">Ubuntu20.04 desktop system</span>'''.</p>{| class="wikitable" style="width:800px;" |-| <p>[http://wiki.ros.org/noetic/Installation '''http://wiki.ros.org/noetic/Installation''']</p><p>[[File:zero2w-img278img247.png]]</p>|}</li><li><p>Then use the script below to install ros1</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''install_ros.sh ros1'''</p>|}</li><li><p>Before using the ROS tool, you first need to initialize rosdep. Then when compiling the source code, you can quickly install some system dependencies and some core components in ROS.</p></li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''<span style="color:#FF0000">Note that when running the following command, you need to ensure that the development board can access github normally, otherwise an error will be reported due to network problems.</span>'''
<ol start="5" style="list-style-type: lower-alpha;">
<li>After pressing the Enter key, a Warning will pop up first.</li></ol>
[[File:zero2w-img279'''The install_ros.png]]sh script will try to modify /etc/hosts and automatically run the following commands. However, this method cannot guarantee that github can be accessed normally every time. If install_ros.sh prompts the following error after installing ros1, please find other ways to allow the linux system of the development board to access github normally, and then manually run the following Order.'''
<ol start="6" style="list-style-type: lower-alpha;">
<li>Press the Enter key again to start updating u-boot. After the update is completed, the following information will be displayed.</li></ol>
[[File'''https:zero2w//raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-img280homebrew.png]]yaml'''
<ol start="7" style="list-style-type'''Hit https: lower-alpha;"><li>Then you can restart the development board to test whether the u-boot modification has taken effect//raw.githubusercontent.<com/li><ros/ol>rosdistro/master/rosdep/base.yaml'''
'''<span idstyle="compile-the-linux-kernelcolor:#FF0000">ERROR: error loading sources list:</span>== Compile the linux kernel =='''
::'''<span style="color:# Run the FF0000">The read operation timed out</span>'''</big>|}{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''buildsource /opt/ros/noetic/setup.shbash''' script, remember to add sudo permissions
testorangepi@testorangepi:~/orangepi-build$ '''sudo ./build.shrosdep init'''
<ol start="2" style="Wrote /etc/ros/rosdep/sources.list.d/20-style-type: decimal;"><li>Select '''Kernel package''' and press Enter</li></ol>default.list
<div class="figure">Recommended: please run
[[File:zero2w-img281.png]]
</div><ol start="3" style="list-style-type: decimal;"><li>Then you will be prompted whether you need to display the kernel configuration interface. If you do not need to modify the kernel configuration, select the first one. If you need to modify the kernel configuration, select the second one.</li></ol>:rosdep update
[[Fileorangepi@orangepi:zero2w-img282.png]]~$ '''rosdep update'''
<ol start="4" style="reading in sources list-style-type: decimal;"><li>Then select the model of the development board<data from /li><etc/ol>ros/rosdep/sources.list.d
[[FileHit https:zero2w//raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-img275homebrew.png]]yaml
<ol start="5" style="list-style-typeHit https: decimal;">//raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml <li>Then select the branch type of the kernel source code<Hit https://raw.githubusercontent.com/ros/rosdistro/master/li><rosdep/ol>python.yaml
<blockquote>aHit https://raw. The current branch will compile the linux5githubusercontent.4 kernel source codecom/ros/rosdistro/master/rosdep/ruby.yaml
bHit https://raw. The next branch will compile the linux6githubusercontent.1 kernel source code<com/ros/rosdistro/master/releases/blockquote>[[File:zero2w-img276fuerte.png]]yaml
<ol start="6" style="list-style-typeQuery rosdistro index https: decimal;"><li>If you choose to display the kernel configuration menu (the second option) in step 3), the kernel configuration interface opened through '''make menuconfig''' will pop up//raw. At this time, you can directly modify the kernel configurationgithubusercontent. After modification, save and exit. Yes, compilation of the kernel source code will begin after exiting.<com/ros/rosdistro/li><master/ol>index-v4.yaml
[[File:zero2wSkip end-img283.png]]of-life distro &quot;ardent&quot;
<ol style="listSkip end-styleof-type: lower-alphalife distro &quot;bouncy&quot;"><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></ol>
test@test:~/orangepiSkip end-build$ '''sudo ./build.sh KERNEL_CONFIGURE=no'''of-life distro &quot;crystal&quot;
<ol start="2" style="listSkip end-styleof-type: lower-alphalife distro &quot;dashing&quot;"><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></ol>
[[File:zero2wSkip end-img284.png]]of-life distro &quot;eloquent&quot;
<ol start="7" style="list-style-type: decimalAdd distro &quot;"><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-alphafoxy&quot;"><li>Version of the linux kernel source code</li></ol></li></ol>
[ o.k. ] Compiling current kernel [ '''6.1.31''' ]Add distro &quot;galactic&quot;
<ol start="2" style="listSkip end-styleof-type: lower-alphalife distro &quot;groovy&quot;"><li>The version of the cross-compilation tool chain used</li></ol>
[ o.k. ] Compiler version [ '''aarch64-linux-gnu-gcc 11''' ]Add distro &quot;humble&quot;
<ol start="3" style="listSkip end-styleof-type: lower-alphalife distro &quot;hydro&quot;"><li>The default configuration file used by the kernel and the path where it is stored are as follows</li></ol>
[ o.k. ] Using kernel config file [ '''orangepiSkip end-build/external/config/kernel/linuxof-6.1-sun50iw9-next.config''' ]life distro &quot;indigo&quot;
<ol start="4" style="listSkip end-styleof-type: lower-alphalife distro &quot;jade&quot;"><li>The path to the kernel-related deb package generated by compilation</li></ol>
[ o.k. ] Target directory [ '''output/debs/''' ]Skip end-of-life distro &quot;kinetic&quot;
<ol start="5" style="listSkip end-styleof-type: lower-alphalife distro &quot;lunar&quot;"><li>The package name of the kernel image deb package generated by compilation</li></ol>
[ o.k. ] File name [ '''linux-image-next-sun50iw9_x.x.x_arm64.deb''' ]Add distro &quot;melodic&quot;
<ol start="6" style="list-style-type: lower-alphaAdd distro &quot;noetic&quot;"><li>Compilation time</li></ol>
[ o.k. ] Runtime [ '''10 min''' ]Add distro &quot;rolling&quot;
updated cache in /home/orangepi/.ros/rosdep/sources.cache|}</ol><ol start="76" style="list-style-type: lower-alphadecimal;"><li>Finally<p>Then open a command line terminal window on the '''desktop''', and then use the compilation command '''test_ros.sh''' script to start a small turtle routine to repeatedly compile the last selected kernel will test whether ROS can be displayedused normally.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''test_ros. Use sh'''</p>|}</li><li><p>After running the following command without selecting through the graphical interface'''test_ros.sh''' script, and you can directly start compiling a small turtle as shown in the kernel source codepicture 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></olli>
[ o.k. ] Repeat Build Options [ '''sudo ./build.sh BOARD<div class=orangepizero2w BRANCH=next BUILD_OPT=kernel KERNEL_CONFIGURE=no''' ]"figure">
<ol start="8" style="list-style-type: decimal;"><li><p>View the kernel-related deb package generated by compilation</p><ol style="list-style-type: lower-alpha;"><li><p>'''linux-dtb-next-sun50iw9_x.x.x_arm64.deb''' Contains dtb files used by the kernel</p></li><li><p>'''linux-headers-next-sun50iw9_x.x.x_arm64.deb''' Contains kernel header files</p></li><li><p>'''linux-image-next-sun50iw9_x.x.x_arm64.deb''' Contains kernel images and kernel modules</p></li></ol></li></ol> test@test[[File:~/orangepi-build$ '''ls output/debs/linux-*''' output/debs/linux-dtb-next-sun50iw9_x.x.x_arm64.deb output/debs/linux-headers-nextzero2w-sun50iw9_x.x.x_arm64.deb output/debs/linux-image-next-sun50iw9_x.x.x_arm64img249.debpng]]
</div></ol>
<ol start="9" style="list-style-type: decimal;">
<li>When the orangepi-bulid compilation system compiles the linux kernel source code<p>At this time, it will first synchronize press the linux kernel source code with direction keys on the linux kernel source code of keyboard to control the github server. Therefore, if you want little turtle to modify the linux kernel source codemove up, 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 codedown, otherwise it will prompt that the source code of the Linux kernel cannot be found''')left, otherwise the modifications will be restoredand right. The method is as follows</p><p>[[File:zero2w-img250.png]]</p></li></ol>
<blockquote>Set the IGNORE_UPDATES variable in '''userpatches/configspan id="how-to-install-ros-2-galactic-on-defaultubuntu20.conf''' to &quot;yes&quot;04"></blockquotespan>test@test:~/orangepi-build$ '''vim userpatches/config-default.conf'''
IGNORE_UPDATES=&quot;'''yes'''&quot;== How to install ROS 2 Galactic on Ubuntu20.04 ===
<ol start="10" style="list-style-type: decimal;"><li><p>If the kernel The currently active version of ROS 2 is modifiedas follows, you can use the following method recommended version is '''Galactic Geochelone'''</p><p>[[File:zero2w-img251.png]]</p><p>[[File:zero2w-img252.png]]</p>{| class="wikitable" style="width:800px;" |-| <p>[http://docs.ros.org/ '''http://docs.ros.org''']</p><p>'''http://docs.ros.org/en/galactic/Releases.html'''</p>|}</li><li><p>The link to update the kernel and kernel module official installation documentation of the development board Linux systemROS 2 '''Galactic Geochelone''' is as follows:</p><ol {| class="wikitable" style="listwidth:800px;" |-style| <p>'''docs.ros.org/en/galactic/Installation.html'''</p><p>'''http://docs.ros.org/en/galactic/Installation/Ubuntu-type: lowerInstall-alpha;"Debians.html'''</p>|}</li><li>Upload <p>In the compiled deb package official installation documentation of the ROS 2 '''Galactic Geochelone''', Ubuntu Linux kernel to recommends using Ubuntu20.04, so please ensure that the Linux system of used by the development boardis the '''<span style="color:#FF0000">Ubuntu20.04 desktop system</span>'''. There are several ways to install ROS 2. The following demonstrates how to install ROS 2 '''Galactic Geochelone''' through '''Debian packages'''.</p></li><li><p>Use the '''install_ros.sh''' script to install ros2</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''install_ros.sh ros2'''</olp>|}</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>
test@test:~/orangepi-build$ '''cd output/debs'''
test@test:~/orangepi<p>ros2 is an extensible command-build/outputline tool for ROS 2.</debs$ '''scp \'''p>
'''linux-image-next-sun50iw9_x.x.x_arm64.deb root@192.168.1.xxx:/root'''
<ol start="2" style="list-style-typep>optional arguments: lower-alpha;"</p>:<li>Install the deb package of the new linux kernel just uploaded.</lip>-h, --help show this help message and exit</olp>
orangepi@orangepi:~$ '''sudo dpkg -i linux-image-next-sun50iw9_x.x.x_arm64.deb'''
<ol start="3" style="listp>Commands:</p>:<p>action Various action related sub-stylecommands</p>:<p>bag Various rosbag related sub-commands</p>:<p>component Various component related sub-typecommands</p>: lower<p>daemon Various daemon related sub-alpha;"commands</p>:<lip>Then restart the development board doctor Check ROS setup and check whether the kernelother 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 modifications have taken effect.sub-commands</lip>:<p>wtf Use `wtf` as alias to `doctor`</olp>
orangepi@orangepi:~$ '''sudo''' '''reboot'''
:<span idp>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="compilewikitable" style="width:800px;" |-rootfs"| <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</spanp>{| class="wikitable" style= Compile rootfs "width:800px;" |-| <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>{| class="wikitable" style="width:800px;" |-| <p>[http://docs.ros.org/en/galactic/Tutorials.html '''http://docs.ros.org/en/galactic/Tutorials.html''']</p>|}</li></ol>
# Run the build<span id="how-to-install-ros-2-humble-on-ubuntu22.sh script, remember to add sudo permissions04"></span>
test@test:~/orangepi-build$ '''sudo === How to install ROS 2 Humble on Ubuntu22./build.sh'''04 ===
<ol start="2" style="list-style-type: decimal;"><li>Select <p>Use the install_ros.sh script to '''install_ros.sh'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''Rootfs and all deb packagesinstall_ros.sh ros2''' and press Enter</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-img285line tool for ROS 2.png]]</p>
</div>
<ol start="3" style="list-style-type: decimal;">
<li>Then select the model of the development board</li></ol>
[[File<p>optional arguments:zero2w</p>:<p>-h, --img275.png]]help show this help message and exit</p>
<ol start="4" style="list-style-type: decimal;">
<li><p>Then select the branch type of the kernel source code. Different versions of the kernel source code maintain different rootfs types.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>In the current branch, you can see three options: debian11, ubuntu20.04, and ubuntu22.04.</p></li>
<li><p>In the next branch, you can see three options: debian11, debian12, and ubuntu22.04.</p></li></ol>
</li></ol>
[[File<p>Commands:zero2w</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-img276.png]]commands</p>:<p>topic Various topic related sub-commands</p>:<p>wtf Use `wtf` as alias to `doctor`</p>
<ol start="5" style="list-style-type: decimal;">
<li>Then select the type of rootfs</li></ol>
[[File:zero2w<p>Call `ros2 &lt;command&gt; -img286h` for more detailed usage.png]]</p>|}</li><ol startli><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>{| class="6wikitable" style="list-style-typewidth: decimal800px;"|-| <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>Then select Run the type of imagefollowing command to open rviz2</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"|-| <p>orangepi@orangepi:~$ '''source /opt/ros/humble/setup.bash'''<li/p><p>orangepi@orangepi:~$ '''Image with console interface (server)ros2 run rviz2 rviz2''' Represents the image of the server version, which is relatively small in size</p><p>[[File:zero2w-img254.png]]</p>|}</li><li><p>Reference documentation</p>{| class="wikitable" style="width:800px;" |-| <p>'''Image with desktop environmenthttp://docs.ros.org/en/humble/index.html''' Represents an image with a desktop, which is relatively large in size.</p><p>[http://docs.ros.org/en/galactic/li>Tutorials.html '''http://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html''']</olp>|}
</li></ol>
<div classspan id="figurehow-to-install-kernel-header-files"></span>
[[File:zero2w-img287.png]]== How to install kernel header files ==
</div><ol start{| class="7wikitable" style="listbackground-color:#ffffdc;width:800px;" |-| <big>'''Debian11 system with <span style-type="color: decimal;#FF0000">Linux6.1<li/span>If you are kernel will report GCC error when compiling the server version of the image, kernel module. So if you can also choose want to compile the Standard version kernel module, please use Debian12 or the Minimal versionUbuntu22. The Minimal version will have much less pre-installed software than the Standard version ('''please do not choose the Minimal version without special needs, because many things are not pre-installed by default04. Some functions may not be available''')</li></olbig>|}
<div ol style="list-style-type: decimal;"><li><p>The Linux image released by OPi comes with the deb package of the kernel header file by default, and the storage location is '''/opt/'''</p>{| class="figurewikitable" style="width:800px;">|-| [[File<p>orangepi@orangepi:zero2w~$ '''ls /opt/linux-headers*'''</p><p>/opt/linux-headers-img288xxx-sun50iw9_x.png]]x.x_arm64.deb</p>|}</divli><ol startli><p>Use the following command to install the deb package of the kernel header file</p>{| class="8wikitable" style="listwidth:800px;" |-| <p>orangepi@orangepi:~$ '''sudo dpkg -i /opt/linux-headers*.deb'''</p>|}</li><li><p>After installation, you can see the folder where the kernel header file is located under '''/usr/src'''.</p>{| class="wikitable" style-type="width: decimal800px;"|-| <p>orangepi@orangepi:~$ '''ls /usr/src'''</p><p>linux-headers-x.x.x</p>|}</li><li>If <p>Then you are compiling a desktop version can compile the source code of the hello kernel module that comes with the Linux image, you also need to select . The source code of the type of desktop environmenthello module is in '''/usr/src/hello'''. CurrentlyAfter entering this directory, only XFCE is maintained, so please select an XFCE type desktopthen use the make command to compile.</lip>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''cd /usr/src/hello/'''</p><p>orangepi@orangepi:/olusr/src/hello$ '''sudo make'''</p><p>make -C /lib/modules/5.4.125/build M=/usr/src/hello modules</p><p>make[[File1]:zero2wEntering directory '/usr/src/linux-img289headers-5.png4.125'</p>:<p>CC [M]/usr/src/hello/hello.o</p>:<p>Building modules, stage 2.</p>:<p>MODPOST 1 modules</p>:<p>CC [M]/usr/src/hello/hello.mod.o</p>:<p>LD [M] /usr/src/hello/hello.ko</p><p>make[[File1]:zero2wLeaving directory '/usr/src/linux-img290headers-5.png]]4.125'</p>|}</li>You can then select additional packages that need to be installed. Please press <li><p>After compilation, the Enter key here to skip directly'''hello.ko''' kernel module will be generated</p>{| class="wikitable" style="width:800px;" [[File|-| <p>orangepi@orangepi:zero2w-img291/usr/src/hello$ '''ls *.ko'''</p><p>hello.png]]ko</p>|}</li><ol startli><p>Use the '''insmod''' command to insert the '''hello.ko''' kernel module into the kernel</p>{| class="9wikitable" style="list-style-typewidth: decimal800px;"|-| <p>orangepi@orangepi:/usr/src/hello$ '''sudo insmod hello.ko'''</p>|}</li><li><p>Then use the compilation '''demsg''' command to view the output of rootfs will startthe '''hello.ko''' kernel module. Some of If you can see the following output, it means that the information prompted during compilation are as follows'''hello.ko''' kernel module is loaded correctly.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:/usr/src/hello$ '''dmesg | grep &quot;Hello&quot;'''</p><ol p>[ 2871.893988] '''Hello Orange Pi -- init'''</p>|}</li><li><p>Use the '''rmmod''' command to uninstall the '''hello.ko''' kernel module</p>{| class="wikitable" style="listwidth:800px;" |-style-type| <p>orangepi@orangepi:/usr/src/hello$ '''sudo rmmod hello'''</p><p>orangepi@orangepi: lower-alpha/usr/src/hello$ '''dmesg | grep &quot;Hello&quot;"'''</p><lip>Type of rootfs[ 2871.893988] Hello Orange Pi -- init</lip><p>[ 3173.800892] '''Hello Orange Pi -- exit'''</olp>|}
</li></ol>
[ o.k. ] local not found [ Creating new rootfs cache for '''bullseye''' ]<span id="testing-of-some-programming-languages-supported-by-linux-system"></span>
<ol start="2" style="list-style-type: lower-alpha;"><li>The storage path Testing of the compiled rootfs compressed package</li></ol>some programming languages supported by Linux system ==
[ o.k. ] Target directory [ '''orangepi<span id="debian-build/external/cachebullseye-system"></rootfs''' ]span>=== Debian Bullseye system ===
<ol start="3" style="list-style-type: lower-alpha;"><li>The name of the rootfs compressed package generated by compilation</li></ol> [ o.k. ] File name [ '''bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4''' ] <ol start="10" style="list-style-type: decimal;"><li><p>View 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 compiled rootfs compressed packagedevelopment board.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The version of a.gcc is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''bullseyegcc --xfceversion'''</p><p>gcc (Debian 10.2.1-arm646) 10.2.1 20210110</p><p>Copyright (C) 2020 Free Software Foundation, Inc.5250ec7002de9e81a41de169f1f89721</p><p>This is free software; see the source for copying conditions.tarThere is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.lz4</p>|}</li><li><p>Write the ''' It is a compressed package of rootfshello_world. The meaning of each field c''' program in the name isC language</lip>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.c'''</olp></lip>#include &lt;stdio.h&gt;</olp>
<blockquote>a) '''bullseye''' represents the type of Linux distribution of rootfs
b<p>int main(void) '''xfce''' indicates that the rootfs is the desktop version, and if it is cli, it indicates the server version.</p><p>{</p>:<p>printf(&quot;Hello World!\n&quot;);</p>
c) '''arm64''' represents the architecture type of rootfs
d) :<p>return 0;</p><p>}</p>|}</li><li><p>Then compile and run '''25250ec7002de9e81a41de169f1f89721hello_world.c''' 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</blockquotep><ol start{| class="2wikitable" style="list-style-typewidth: lower-alpha800px;">|-| <lip>orangepi@orangepi:~$ '''bullseye-xfcegcc -arm64o hello_world hello_world.5250ec7002de9e81a41de169f1f89721.tar.lz4.listc''' Lists the package names of all packages installed by rootfs</lip></olptestorangepi@testorangepi:~/orangepi-build$ '''ls external/cache/rootfs./hello_world'''</p><p>Hello World!</p>bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4|}</li></ol>bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4.current bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4.list</li><li><p>Debian Bullseye has Python3 installed by default</p><ol start="11" style="list-style-type: decimallower-alpha;"><li>If the required rootfs already exists under '''external<p>The specific version of Python is as follows</cache/rootfsp>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ ''', 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 python3'''external</cache/rootfsp><p>''' to check whether it already existsPython 3. There is a cached rootfs available9. If it is available2''' (default, Feb 28 2021, use it directly17:03:44)</p><p>[GCC 10. This can save a lot of download and compilation time2.1 20210110] on linux</lip><p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</olp> <span id="compile-linux-image"p>&gt;&gt;&gt;</spanp>== Compile linux image ==|}# Run the '''build.sh''' script, remember to add sudo permissions test@test:~/orangepi-build$ '''sudo ./build.sh''' <ol start{| class="2wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;"|-| <big><lip>Select '''Full OS image for flashingUse the Ctrl+D shortcut key to exit python's interactive mode.''' and press Enter</lip></olbig>|}<div class="figure"/li[[File:zero2w-img292<li><p>Write the '''hello_world.png]] py''' program in Python language</divp><ol start{| class="3wikitable" style="list-style-typewidth: decimal800px;">|-| <lip>Then select the model of the development boardorangepi@orangepi:~$ '''vim hello_world.py'''</lip><p>print('Hello World!')</olp[[File:zero2w-img275.png]]|}<ol start="4" style="list-style-type: decimal;"/li><li><p>Then select the branch type The result of the kernel source code. Different versions of the kernel source code maintain different rootfs typesrunning '''hello_world.py''' is as follows</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li>|-| <p>In the current branch, you can see three optionsorangepi@orangepi: debian11, ubuntu20.04, and ubuntu22.04~$ '''python3 hello_world.py'''</p></li><li><p>In the next branch, you can see three options: debian11, debian12, and ubuntu22.04.Hello World!</p></li></ol>|}
</li></ol>
 [[File:zero2w-img276.png]] <ol start="5" style="list-style-type: decimal;"/li><li><p>If you select the next branch, you will also be prompted to select the memory size, Debian Bullseye does not install Java compilation tools and you do not need to select the current branchoperating environment by default.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>If You can use the development board you purchased has a memory size of 1.5GB, please select the first optionfollowing command to install openjdk.The latest version in Debian Bullseye is openjdk-17</p></li><li><p>If the development board you purchased has 1GB or 2GB or 4GB memory size, please choose the second option.</p>{| class="wikitable" style="width:800px;" |-| <p>[[Fileorangepi@orangepi:zero2w~$ '''sudo apt install -y openjdk-17-img277.png]]jdk'''</p></li></ol>|}
</li>
<li><p>Then select After installation, you can check the type of rootfsJava version.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''java --version'''</lip>|}</olli[[File:zero2w-img286<li><p>Write the Java version of '''hello_world.png]]java'''</p><ol start{| class="7wikitable" style="list-style-typewidth: decimal800px;"|-| <p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><lip>{</p>Then select the type of image:<p>public static void main(String[] args)</p>:<ol style="list-style-typep>{</p>:: lower-alpha<p>System.out.println(&quot;Hello World!&quot;);"</p>:<p>}</p><p>}</p>|}</li><li><p>Then compile and run '''Image with console interface (server)hello_world.java''' Represents the image of the server version, which is relatively small in size.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''javac hello_world.java'''</lip><li><p>orangepi@orangepi:~$ '''Image with desktop environmentjava hello_world'''Represents an image with a desktop, which is relatively large in size.</p><p>Hello World!</p>|}</li></ol>
</li></ol>
<div classspan id="figuredebian-bookworm-system"></span>
[[File:zero2w-img287.png]]=== Debian Bookworm system ===
</div><ol start="8" style="list-style-type: decimal;"><li>If you are compiling <p>Debian Bookworm is installed with the server version of the imagegcc compilation tool chain by default, you which can also choose to directly compile C language programs in the Standard version or Linux system of the Minimal versiondevelopment board. </p><ol style="list-style-type: lower-alpha;"><li><p>The Minimal version will have much less preof a.gcc is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''gcc --installed software than the Standard version ('''please do </p><p>gcc (Debian 12.2.0-14) 12.2.0</p><p>Copyright (C) 2022 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not choose even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>|}</li><li><p>Write the Minimal version without special needs, because many things are not pre'''hello_world.c''' program in C language</p>{| class="wikitable" style="width:800px;" |-installed by default| <p>orangepi@orangepi:~$ '''vim hello_world. Some functions may not be availablec''')</lip><p>#include &lt;stdio.h&gt;</olp>
<div class="figure">
[[File<p>int main(void)</p><p>{</p>:zero2w-img288.png]]<p>printf(&quot;Hello World!\n&quot;);</p>
</div>
<ol start="9" 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></ol>
[[File:zero2w-img289.png]]<p>return 0;</p><p>}</p>[[File:zero2w-img290.png]]|}</li>You can then select additional packages that need to be installed. Please press the Enter key here to skip directly<li><p>Then compile and run '''hello_world.c'''</p> [[File:zero2w-img291.png]] <ol start{| class="10wikitable" style="list-style-typewidth: decimal800px;">|-| <lip>Then the compilation of the linux image will beginorangepi@orangepi:~$ '''gcc -o hello_world hello_world. The general process of compilation is as followsc'''</lip></olpa. Initialize the compilation environment of Ubuntu PC and install the software packages required for the compilation process. b. Download the source code of u-boot and linux kernel (if already cached, only update the code) c. Compile u-boot source code and generate u-boot deb package d. Compile linux source code and generate linux-related deb packages e. Make the deb package of linux firmware f. Make the deb package of orangepi-config tool g@orangepi:~$ '''. Create a deb package with board-level support/hello_world'''</p><p>Hello World!</p>h. If you compile the desktop version image, you will also create a desktop-related deb package. i. Check whether rootfs has been cached. If not, re-create rootfs. If it has been cached, decompress it directly and use it. j. Install the deb package generated previously into rootfs k. Make some specific settings for different development boards and different types of images, such as pre-installing additional software packages, modifying system configurations, etc. l. Then create the image file and format the partition. The default type is ext4. m. Then copy the configured rootfs to the mirror partition. n. Then update initramfs o. Finally, write the bin file of u-boot into the image through the dd command.|}</li></ol><ol start="11" style="list-style-type: decimal;"/li><li><p>After compiling the image, the following message will be displayedDebian Bookworm has Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The storage path specific version of the compiled imagePython is as follows</li></olp></li></ol> [ o.k. ] Done building [ '''output/images/orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop/orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop.img''' ] <ol start{| class="2" style="list-style-type: lower-alpha;"><li>Compilation time</li></ol> '''[ o.k. ] Runtime [ 19 min ]''' <ol start="3wikitable" style="list-style-typewidth: lower-alpha800px;"><li>Repeat the command to compile the image. Use the following command to start compiling the image directly without selecting it through the graphical interface.</li></ol> [ o.k. ] Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=image RELEASE=bullseye BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_CONFIGURE=yes''' ] <span id="instructions-for-using-the-orange-pi-os-arch-system"></span> = '''Instructions for using the Orange Pi OS Arch system''' = <span id="orange-pi-os-arch-system-function-adaptation-status"></span>== Orange Pi OS Arch system function adaptation status == {| class="wikitable"
|-
| <p>orangepi@orangepi:~$ '''Motherboard functionspython3'''</p><p>Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux</p><p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</p><p>&gt;&gt;&gt;</p>|}{| '''OPi OS Arch'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big><p>'''HDMI videoUse the Ctrl+D shortcut key to exit python's interactive mode.'''</p></big>| }</li><li><p>Write the '''OKhello_world.py'''program in Python language</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''vim hello_world.py''HDMI Audio'</p><p>print('Hello World!')</p>| }</li><li><p>The result of running '''OKhello_world.py'''is as follows</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''Type-C USB2python3 hello_world.0 x 2py'''</p><p>Hello World!</p>|}</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 can use the following command to install openjdk. The latest version in Debian Bookworm is openjdk-17</p>{| '''OK'''class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''TF Card Startupsudo apt install -y openjdk-17-jdk'''</p>|}</li><li><p>After installation, you can check the Java version.</p>{| '''OK'''class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''WIFIjava --version'''</p>| }</li><li><p>Write the Java version of '''OKhello_world.java'''</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''Bluetoothvim hello_world.java'''</p><p>public class hello_world</p><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println(&quot;Hello World!&quot;);</p>:<p>}</p><p>}</p>| }</li><li><p>Then compile and run '''OKhello_world.java'''</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''LED Lightjavac hello_world.java'''</p>| <p>orangepi@orangepi:~$ '''OKjava hello_world'''</p><p>Hello World!</p>|}</li></ol></li></ol> <span id="ubuntu-focal-system"></span> === Ubuntu Focal system === | '''40pin GPIO'''<ol style="list-style-type: decimal;">| '''OK'''<li><p>Ubuntu Focal is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.</p>|<ol style="list-style-type: lower-alpha;">| '''40pin I2C'''<li><p>The version of a.gcc is as follows</p>{| '''OK'''class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''40pin SPIgcc --version'''</p><p>gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0</p><p>Copyright (C) 2019 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>| }</li><li><p>Write the '''OKhello_world.c'''program in C language</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''40pin UARTvim 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 '''OKhello_world.c'''</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''40pin PWMgcc -o hello_world hello_world.c'''</p>| <p>orangepi@orangepi:~$ '''OK./hello_world'''</p><p>Hello World!</p>|}</li></ol></li><li><p>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:~$ '''Temperature Sensorpython3'''</p><p>Python 3.8.10 (default, Nov 14 2022, 12:59:47)</p><p>[GCC 9.4.0] on linux</p><p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</p><p>&gt;&gt;&gt;</p>| '''OK'''}{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big><p>'''Use the Ctrl+D shortcut key to exit python'Hardware watchdogs interactive mode.'''</p></big>| '''OK'''}|-</li>| <li><p>Write the '''Mali GPUhello_world.py'''program in Python language</p>{| '''NO'''class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''Video codecvim hello_world.py'''</p>| '''NO'<p>print('Hello World!')</p>
|}
</li><li><p>The result of running '''hello_world.py''' is as follows</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''24pin expansion board functionpython3 hello_world.py'''</p><p>Hello World!</p>| '''OPi OS Arch'''}</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:~$ '''100M network portsudo apt install -y openjdk-17-jdk'''</p>|}</li><li><p>After installation, you can check the Java version.</p>{| '''OK'''class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''100M Ethernet port lightjava --version'''</p><p>openjdk 17.0.2 2022-01-18</p><p>OpenJDK Runtime Environment (build 17.0.2+8-Ubuntu-120.04)</p><p>OpenJDK 64-Bit Server VM (build 17.0.2+8-Ubuntu-120.04, mixed mode, sharing)</p>| }</li><li><p>Write the Java version of '''OKhello_world.java'''</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''USB2vim hello_world.0 HOST x 2java'''</p><p>public class hello_world</p><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println(&quot;Hello World!&quot;);</p>:<p>}</p><p>}</p>| }</li><li><p>Then compile and run '''OKhello_world.java'''</p>{| class="wikitable" style="width:800px;"
|-
| '''Infrared reception'''| <p>orangepi@orangepi:~$ '''OKjavac hello_world.java'''</p>|-| <p>orangepi@orangepi:~$ '''Headphone audio playbackjava hello_world'''</p>| '''OK'''<p>Hello World!</p>|-}| '''On</li></off button'''ol>| '''OK'''|-| '''LRADC''' '''Custom buttons x 2'''| '''OK'''|-| '''TV-OUT'''| '''NO'''|}</li></ol>
<span id="orangeubuntu-pi-os-archjammy-system-user-guide-instructions"></span>== Orange Pi OS Arch System User Guide Instructions ==
First of all, please note that the OPi OS Arch system does not have a default orangepi user and password, so you cannot directly log in remotely through the serial port and ssh after the system is started after burning (not even the root user). This is different from === Ubuntu and Debian systems. When the OPi OS Arch system is started for the first time, you need to connect an HDMI display and then initialize the Jammy 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:===
<ol style="list-style-type: decimal;">
<li><p>Ubuntu Jammy is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>After burning The version of a.gcc is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''gcc --version'''</p><p>gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) '''11.3.0'''</p><p>Copyright (C) 2021 Free Software Foundation, Inc.</p><p>This is free software; see the system, when you start it 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 first time and enter the desktop, you will see the user wizard '''hello_world.c''' program shown in the figure below.C language</p><div {| class="figurewikitable" style="width:800px;"|-| <p>orangepi@orangepi:~$ '''vim hello_world.c'''</p><p>#include &lt;stdio.h&gt;</p>
[[File:zero2w-img293.png]]
</divp>int main(void)</lip><lip>{</p>First you need to select the language you want:</p>printf(&quot;Hello World!\n&quot;);<div class="figure"/p>
[[File:zero2w-img294.png]]
:<p>return 0;</p><p>}</divp>|}</li><li><p>After selecting the language, the user wizard will immediately switch to the corresponding language interface, as shown below in ChineseThen compile and run '''hello_world.c'''</p><div {| class="figurewikitable" style="width:800px;">|-| [[File<p>orangepi@orangepi:zero2w~$ '''gcc -img295o hello_world hello_world.png]]c'''</p><p>orangepi@orangepi:~$ '''./hello_world'''</p><p>Hello World!</p>|}</divli></ol></li><li><p>Then select the areaUbuntu Jammy has Python3 installed by default</p><div classol style="figurelist-style-type: lower-alpha;"><li><p>The specific version of Python3 is as follows</p>[[File{| class="wikitable" style="width:zero2w800px;" |-img296| <p>orangepi@orangepi:~$ '''python3'''</p><p>Python 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.png]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>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p></divbig>|}</li><li><p>Then select Write the keyboard model'''hello_world.py''' program in Python language</p><div {| class="figurewikitable" style="width:800px;">|-| [[File<p>orangepi@orangepi:zero2w-img297~$ '''vim hello_world.png]]py'''</p><p>print('Hello World!')</divp>|}</li><li><p>Then create a new username and set a passwordThe result of running '''hello_world.py''' is as follows</p><div {| class="figurewikitable">style="width:800px;" |-| [[File<p>orangepi@orangepi:zero2w-img298~$ '''python3 hello_world.png]]py'''</p><p>Hello World!</p>|}</divli></ol></li><li><p>Then make sure there is no problem with the selection, Ubuntu Jammy does not install Java compilation tools and then click operating environment by default.</p><ol style="list-style-type: lower-alpha;"><li><p>You can use the following command to install openjdk-18</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''buttonsudo apt install -y openjdk-18-jdk'''</p>|}</li><li><div p>After installation, you can check the Java version.</p>{| class="figurewikitable">style="width:800px;" |-| [[File<p>orangepi@orangepi:zero2w~$ '''java --img299version'''</p><p>openjdk 18.png]]0.2-ea 2022-07-19</p><p>OpenJDK Runtime Environment (build 18.0.2-ea+9-Ubuntu-222.04)</p><p>OpenJDK 64-Bit Server VM (build 18.0.2-ea+9-Ubuntu-222.04, mixed mode, sharing)</divp>|}</li><li><p>Then wait for Write the installation to completeJava version of '''hello_world.java'''</p><div {| class="figurewikitable"style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p>:<p>public static void main(String[[File] args)</p>:<p>{</p>::zero2w-img300<p>System.out.png]]println(&quot;Hello World!&quot;);</p>:<p>}</p><p>}</divp>|}</li><li><p>After the installation is complete, you need to click the Then compile and run '''Finishhello_world.java''' button to restart the system.</p><div {| class="figurewikitable" style="width:800px;">|-| [[File<p>orangepi@orangepi:zero2w-img301~$ '''javac hello_world.png]]java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p>|}</li></ol></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 span id="method-of Start on startup''' in the lower right corner, otherwise you need -uploading-files-to manually close -the Orange Pi Hello program every time you start it.-development-board-linux-system"></p><div class="figure"span>
[[File:zero2w-img302.png]]== Method of uploading files to the development board Linux system ==
</div><p>At this point, you can use the newly created username and password span id="method-to log in -upload-files-to -the OPi OS -development-board-linux-system through the serial port or ssh.</p-in-ubuntu-pc"></li></olspan>=== Method to upload files to the development board Linux system in Ubuntu PC ===
<span id="how-to-setupload-dtfiles-overlaysusing-scp-command"></span>==== How to set DT overlays upload files using scp command ====
<ol style="list-style-type: decimal;"><li><p>Use the scp command to upload files to the Linux system of the development board in Ubuntu PC. The multiplexing functions such specific command is as I2Cfollows</SPIp><ol style="list-style-type: lower-alpha;"><li><p>'''file_path: '''Needs to be replaced with the path of the file to be uploaded</UARTp></PWM in li><li><p>'''orangepi: '''This is the user name of the 40-pin development board are turned off by default in the kernel's dtsLinux system. It can also be replaced with something else, and such as root.</p></li><li><p>'''192.168.xx.xx:''' This is the corresponding DT overlays need IP address of the development board. Please modify it according to be manually turned on before they can be usedthe actual situation.</p></li> <li><p>'''/home/orangepi:''' The method to open DT overlays path in OPi OS Arch the development board Linux system is as followscan also be modified to other paths.</p>{| class="wikitable" style="width:800px;" |-| # First open the <p>test@test:~$ '''scp file_path orangepi@192.168.xx.xx:/boothome/extlinuxorangepi/extlinux.conf''' configuration file</p>|}</li></ol></li><li><p>If you want to upload a folder, you need to add the -r parameter</p>{| class="wikitable" style="width:800px;" |-| [<p>test@test:~$ '''scp <span style="color:#FF0000">-r</span> dir_path orangepi@192.168.xx.xx:/home/orangepi/'''</p>|}</li><li><p>There are more usages of scp, please use the following command to view the man manual</p></li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''man scp'''|}</ol><span id="how-to-upload-files-using-filezilla"></span> ==== How to upload files using filezilla ==== <ol style="list-style-type: decimal;"><li><p>First install filezilla in Ubuntu PC</p>{| class="wikitable" style="width:800px;" |-pc | <p>test@test:~]$ '''sudo vim apt install -y filezilla'''</bootp>|}</extlinuxli><li><p>Then use the following command to open filezilla</extlinux.confp>{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''filezilla'''</p>|}</li><li><p>The interface after opening filezilla is as shown below. At this time, the remote site on the right is empty.</p><div class="figure"> [[File:zero2w-img255.png]]
<ol start="2" style="list-style-type: decimal;"/div></li><li>Then open <p>The method of connecting the corresponding configuration by adding '''FDTOVERLAYS''' '''/dtbs/allwinner/overlay/xxx.dtbo''' development board is as shown in '''/boot/extlinux/extlinux.conf'''the figure below</lip></olli>
'''Note that xxx.dtbo in FDTOVERLAYS /dtbs/allwinner/overlay/xxx.dtbo needs to be replaced with the specific dtbo configuration, please do not copy it.'''<div class="figure">
[orangepi@orangepi[File:zero2w-pc ~img256.png]]$ '''sudo vim /boot/extlinux/extlinux.conf'''
LABEL Orange Pi</div></ol><ol start="5" style="list-style-type: decimal;"><li><p>Then choose to '''save the password''' and click '''OK'''</p><p>[[File:zero2w-img257.png]]</p></li><li><p>Then select '''Always trust this host''' and click '''OK'''</p></li>
KERNEL /Image<div class="figure">
FDT /dtbs/allwinner/sun50i-h616-orangepi[[File:zero2w-zero2wimg258.dtbpng]]
'''FDTOVERLAYS </dtbsdiv></allwinner/overlayol><ol start="7" style="list-style-type: decimal;"><li>After the connection is successful, you can see the directory structure of the development board's Linux file system on the right side of the filezilla software.</xxx.dtbo''' #Configuration that needs to be addedli>
<ol startdiv class="3figure" style="list-style-type: decimal;"><li><p>The storage path of xxx.dtbo in the OPi OS Arch image is as follows. Please note that not all dtbo under this path can be used.</p><p>'''/boot/dtbs/allwinner/overlay/'''</p></li><li><p>The DT overlays configuration that can be used by the development board is as follows</p></li></ol>
{| class="wikitable"|-| '''Functions on the development board'''| '''Corresponding DT overlays configuration'''|-| '''40pin - i2c0'''| '''sun50i-h616-pi-i2c0.dtbo'''|-| '''40pin - i2c1'''| '''sun50i-h616-pi-i2c1.dtbo'''|-| '''40pin - i2c2'''| '''sun50i-h616-pi-i2c2.dtbo'''|-| '''40pin - uart2'''| '''sun50i-h616-pi-uart2.dtbo'''|-| '''40pin - uart3'''| '''sun50i-h616-pi-uart3.dtbo'''|-| '''40pin - uart4'''| '''sun50i-h616-pi-uart4.dtbo'''|-| '''40pin - uart5'''| '''sun50i-h616-ph-uart5.dtbo'''|-| '''40pin - pwm1'''| '''sun50i-h616-pi-pwm1.dtbo'''|-| '''40pin - pwm2'''| '''sun50i-h616-pi-pwm2.dtbo'''|-| '''40pin - pwm3'''| '''sun50i-h616-pi-pwm3.dtbo'''|-| '''40pin - pwm4'''| '''sun50i-h616-pi-pwm4.dtbo'''|-| '''40pin - spi1 cs0'''| '''sun50i-h616-spi1-cs0-spidev.dtbo'''|-| '''40pin - spi1 cs1'''| '''sun50i-h616-spi1-cs1-spidev.dtbo'''|-| '''40pin - spi1 cs0 cs1'''| '''sun50i-h616-spi1-cs0-cs1-spidev.dtbo'''|-| '''设Set USB0 to Host mode'''| '''sun50i-h616-usb0-host.dtbo'''|-| '''Turn off the green LED light'''| '''sun50i-h616-[[File:zero2w-disable-led.dtbo'''|-| '''How to close the UART0 debugging serial port'''| '''sun50i-h616-disable-uart0img259.dtbo'''|}png]]
</div></ol><ol start="58" style="list-style-type: decimal;"><li>If you need Then select the path to be uploaded to open multiple configurations at the same timedevelopment board on the right side of the filezilla software, just add select the file to be uploaded in Ubuntu PC on the paths left side of multiple configurations directly after '''FDTOVERLAYS.''' For examplethe filezilla software, right-click the configuration of opening i2c1 mouse, and uart5 at then click the upload option to start uploading the same time is as followsfile to the development board.</li></ol>
[orangepi@orangepi-pc ~]$ '''sudo vim /boot/extlinux/extlinux.conf'''<div class="figure">
LABEL Orange Pi[[File:zero2w-img260.png]]
KERNEL </Imagediv></ol><ol start="9" style="list-style-type: decimal;"><li><p>After the upload is completed, you can go to the corresponding path in the development board Linux system to view the uploaded file.</p></li><li><p>The method of uploading a folder is the same as the method of uploading a file, so I won't go into details here.</p></li></ol>
FDT /dtbs/allwinner/sun50i<span id="method-to-upload-files-from-windows-pc-to-development-h616board-orangepilinux-zero2w.dtbsystem"></span>
'''FDTOVERLAYS === Method to upload files from Windows PC to development board Linux system === <span id="how-to-upload-files-using-filezilla-1"></dtbsspan>==== How to upload files using filezilla ==== # First download the installation file of the Windows version of the filezilla software. The download link is as follows ::{| class="wikitable" style="width:800px;" |-| [https:/allwinner/overlay/sun50ifilezilla-h616-pi-i2c1project.dtbo org/dtbsdownload.php?type=client '''https:/allwinner/overlayfilezilla-project.org/sun50i-h616-ph-uart5download.dtbophp?type=client''']|}
<ol start="6" style="list::[[File:zero2w-style-type: decimal;"><li>After setting, you need to restart the system for the configuration to take effectimg261.</li></ol>png]]
[orangepi@orangepi-pc ~]$ '''sudo reboot'''<div class="figure">
<span id="how::[[File:zero2w-to-install-software"></span>== How to install software ==img262.png]]
You can use the pacman </div><ol start="2" style="list-style-type: decimal;"><li><p>The downloaded installation package management tool to install software that is not available in OPi OS. For exampleas shown below, the command then double-click to install it directly</p>{| class="wikitable" style="width:800px;" |-| <p>'''FileZilla_Server_1.5.1_win64-setup.exe'''</p>|}During the vim editor is as follows. If you want to install other softwareinstallation process, you only need to replace vim with please select '''Decline''' on the package name of the software you want to install.following installation interface, and then select '''Next&gt;'''
[orangepi@orangepi-pc ~]$ '''sudo pacman -Syy vim'''<div class="figure">
<span id="android[[File:zero2w-12-tv-system-usage-instructions"></span>img263.png]]
</div></li></ol><ol start= '''Android 12 TV system usage instructions''' "3" style="list-style-type: decimal;"><li>The interface after opening filezilla is as shown below. At this time, the remote site on the right is empty.</li>
<span iddiv class="supported-android-versionsfigure"></span>== Supported Android versions ==
{| class="wikitable"|[[File:zero2w-| Android Version| Kernel version|-| '''Android 12 TV Version'''| '''linux5img264.4'''|}png]]
<span id/div></ol><ol start="android4" style="list-12style-tv-function-adaptation-statustype: decimal;"><li>The method of connecting the development board is as shown in the figure below:</spanli>== Android 12 TV function adaptation status ==
{| <div class="wikitablefigure"> |[[File:zero2w-img256.png]]| '''Motherboard functions'''| '''Android12 TV'''</div></ol>|<ol start="5" style="list-style-type: decimal;">| <li>Then choose to '''HDMI videosave the password'''| and click '''OK'''</li> <div class="figure"> |[[File:zero2w-img265.png]] </div></ol><ol start="6" style="list-style-type: decimal;">| <li>Then select '''HDMI AudioAlways trust this host'''| and click '''OK'''</li> |<div class="figure"> [[File:zero2w-img266.png]] </div></ol><ol start="7" style="list-style-type: decimal;">| <li>After the connection is successful, you can see the directory structure of the development board's Linux file system on the right side of the filezilla software.</li> <div class="figure"> [[File:zero2w-img267.png]] </div></ol><ol start="8" style="list-style-type: decimal;"><li>Then select the path to be uploaded to the development board on the right side of the filezilla software, select the file to be uploaded on the Windows PC on the left side of the filezilla software, right-click the mouse, and then click the upload option to start uploading the file to the development board.</li> <div class="figure"> [[File:zero2w-img268.png]] </div></ol><ol start="9" style="list-style-type: decimal;"><li><p>After the upload is completed, you can go to the corresponding path in the development board Linux system to view the uploaded file.</p></li><li><p>The method of uploading a folder is the same as the method of uploading a file, so I won''Typet go into details here.</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-C USB2type: decimal;"><li><p>The power on/off logo will only be displayed on the desktop version of the system by default.0 x 2'''</p></li>| <li><p>Set the '''OKbootlogo'''|-| variable to '''TF card startupfalse'''| in '''OK/boot/orangepiEnv.txt'''to turn off the switch logo.</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''WIFIsudo vim /boot/orangepiEnv.txt'''</p><p>verbosity=1</p><p>'''<span style="color:#FF0000">bootlogo=false</span>'''</p>| }</li><li><p>Set the '''OKbootlogo'''variable to '''true''' in '''/boot/orangepiEnv.txt''' to enable the power on/off logo.</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''Bluetoothsudo vim /boot/orangepiEnv.txt'''</p>| <p>verbosity=1</p><p>'''OK<span style="color:#FF0000">bootlogo=true</span>'''</p>|-}| '''USB Camera'''</li><li><p>The location of the boot logo picture in the Linux system is</p>{| '''OK'''class="wikitable" style="width:800px;"
|-
| <p>'''LED Light/usr/share/plymouth/themes/orangepi/watermark.png'''</p>|}</li><li><p>After replacing the boot logo image, you need to run the following command to take effect</p>{| '''OK'''class="wikitable" style="width:800px;"
|-
| '''40pin GPIO'''| '''OK'''|-| '''40pin I2C'''| '''OK'''|-| '''40pin SPI1'''| '''OK'''|-| '''40pin UART'''| '''OK'''|-| '''40pin PWM'''| '''OK'''|-| '''Temperature Sensor'''| '''OK'''|-| '''Hardware watchdog'''| <p>orangepi@orangepi:~$ '''OK'''|sudo update-| '''Mali GPU'''| '''OK'''|initramfs -| '''Video codec'''| '''OKu'''</p>
|}
</li></ol>
 
<span id="how-to-turn-on-the-power-button-in-linux5.4"></span>
 
== How to turn on the power button in Linux5.4 ==
 
There is no power on/off button on the main board of the development board. We can expand it through a 24pin expansion board. The location of the power on/off button on the expansion board is as follows:
 
[[File:zero2w-img269.png]]
The power on/off button of the Linux 6.1 image is turned on by default, but the power on/off button of the Linux 5.4 kernel image is turned off by default and needs to be turned on manually for normal use. The steps are as follows: <ol style="list-style-type: decimal;"><li><p>First run '''orangepi-config'''. Ordinary users remember to add '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''24pin Expansion board functionsudo 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;'Android12 TV''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 '''100M network port&lt;Reboot&gt;'''to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol> <span id="how-to-shut-down-and-restart-the-development-board"></span> == How to shut down and restart the development board ==| <ol style="list-style-type: decimal;"><li><p>During the running of the Linux system, if you directly unplug the power supply, it may cause the file system to lose some data. It is recommended to use the '''OKpoweroff'''command to shut down the Linux system of the development board before powering off, and then unplug the power supply.</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''100M Ethernet port lightsudo poweroff'''</p>| '''OK'''}{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big><p>'''USB2Note that after turning off the development board, you need to unplug and replug the power supply before it can be turned on.0 HOST x 2'''</p></big>|}</li><li><p>In addition to using the poweroff command to shut down, you can also use the power on/off button on the expansion board to shut down.</p><p>[[File:zero2w-img269.png]]</p>{| '''OK'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big><p>'''Infrared receptionNote that Linux 5.4 requires manual configuration of the power on/off button before it can be used. For the opening method, please refer to [[Orange Pi Zero 2W#How to turn on the power button in Linux5.4|the method of opening the power button in Linux5.4]].'''</p></big>| }</li><li><p>Use the '''OKreboot'''command to restart the Linux system in the development board</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''Headphone audio playback''sudo'| '''OK'''|-| reboot'''On</off button'''| '''OK'''|-| '''LRADC''' '''Custom buttons x 2'''| '''OK, The default setting is the volume up and down keys.'''|-| '''TV-OUT'''| '''OK'''p>
|}
</li></ol>
 
<span id="linux-sdkorangepi-build-usage-instructions"></span>
 
= '''Linux SDK——orangepi-build usage instructions''' =
<span id="onboardcompilation-ledsystem-light-display-instructionsrequirements"></span>== Onboard LED light Compilation system requirements == The Linux SDK, '''orangepi-build''', only supports running on X64 computers with '''<span style="color:#FF0000">Ubuntu 22.04</span>''' installed. Therefore, before downloading orangepi-build, please first ensure that the Ubuntu version installed on your computer is Ubuntu 22.04. The command to check the Ubuntu version installed on the computer is as follows. If the Release field does not display instructions ='''<span style="color:#FF0000">22.04</span>''', it means that the Ubuntu version currently used does not meet the requirements. Please change the system before performing the following operations.
{| class="wikitable" style="width:800px;"
|-
|| test@test:~$ '''green light'''| '''red light'''|-| '''u-boot startup phase'''| '''Off'''| '''on'''|lsb_release -| '''Kernel boot to enter the system'''| '''on'''| '''ona'''|}
<span id="how-to-return-to-the-previous-interface-in-android"></span>== How to return to the previous interface in Android ==No LSB modules are available.
We generally use the mouse and keyboard to control the Android system of the development board. When entering certain interfaces and need to return to the previous interface or desktop, we can only return by right-clicking the mouse, and the keyboard cannot return.Distributor ID: Ubuntu
If you have purchased the infrared remote control (other remote controls do not work) and a 24pin expansion board that come with the development board, after connecting the 24pin expansion board to the development board, you can also use the return key on the remote control to return to the previous menuDescription: Ubuntu 22. The location of the return key is as shown below. Shown:04 LTS
[[FileRelease:zero2w-img303'''<span style="color:#FF0000">22.png]]04</span>'''
<span id="how-to-use-adb"></span>Codename: '''jammy'''== How to use ADB ==|}
<span id="useIf 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-networkbuild on the WSL virtual machine, because orangepi-connectionbuild has not been tested in the WSL virtual machine, so there is no guarantee that orangepi-adbbuild can be used normally in WSL. In addition, please do not compile the Linux system on the development board. Use orangepi-debugging"></span>=== Use network connection adb debugging ===build. The installation image download address of Ubuntu 22.04 amd64 version is:
{| class="wikitable" style="width:800px;" |-| [https://repo.huaweicloud.com/ubuntu-releases/21.04/ubuntu-21.04-desktop-amd64.iso '''Using network adb does not require a USB Typc C interface data cable to connect the computer and the development boardhttps://mirrors.tuna. 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 boardtsinghua.edu.cn/ubuntu-releases/22.04/ubuntu-22. Next To be used04-desktop-amd64.iso''']|}
# Make sure After installing Ubuntu 22.04 on your computer or virtual machine, please first set the '''servicesoftware source of Ubuntu 22.adb.tcp04 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.port''' of the Android system is set The steps to 5555 port numberreplace Tsinghua Source are as follows:
apollo<ol style="list-p2style-type:/ # '''getprop | grep &quotlower-alpha;adb"><li>For the method of replacing Tsinghua Source, please refer to the instructions on this page.tcp&quot;'''</li>
{| class="wikitable" style="width:800px;" |-| [servicehttps://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/ '''https://mirrors.adbtuna.tcptsinghua.portedu.cn/help/ubuntu/''']|}</ol><ol start="2" style="list-style-type: [5555]lower-alpha;"><li>Note that the Ubuntu version needs to be switched to 22.04.</li>
[[File:zero2w-img271.png]]</ol><ol start="23" style="list-style-type: decimallower-alpha;"><li>If The contents of the '''service/etc/apt/sources.adb.tcp.portlist''' is not set, you can use the following command in the serial port file that need to set the port number of the network adbbe replaced are:</li><{| class="wikitable" style="width:800px;" |-| test@test:~$ '''sudo mv /etc/apt/sources.list cat /etc/apt/ol>sources.list.bak'''
apollo-p2test@test:/ # ~$ '''setprop service.adb.tcp.port 5555'''<br sudo vim /etc/>apollo-p2:apt/ # '''stop adbdsources.list'''
apollo-p2:/ # '''start adbd#'''The source code image is commented by default to improve apt update speed. You can uncomment it yourself if necessary.
<ol start="3" style="list-style-typedeb https: decimal;"><li>Install adb tool on Ubuntu PC</li></ol>mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
test@test:~$ '''sudo apt-get update#'''deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
test@testdeb https:~$ '''sudo apt//mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-get install -y adb'''updates main restricted universe multiverse
<ol start="4" style="list'''#''' deb-style-typesrc https: decimal;"><li>Then connect network adb on Ubuntu PC</li></ol>mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
test@testdeb https:~$ '''adb connect 192//mirrors.168tuna.1tsinghua.xxx:5555''' '''(Need to be modified to the IP address of the development board)'''edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
* daemon not running; starting now at tcp'''#''' deb-src https:5037//mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
* daemon started successfullydeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
connected to 192'''#''' deb-src https://mirrors.168tuna.1tsinghua.xxx:5555edu.cn/ubuntu/ jammy-security main restricted universe multiverse
test@test:~$ '''adb devices'''
List of devices attached'''#''' Pre-release software source, not recommended to be enabled
192'''#''' deb https://mirrors.168tuna.1tsinghua.xxx:5555 deviceedu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
'''#''' deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse|}</ol><ol start="54" style="list-style-type: decimallower-alpha;"><li>Then After the replacement, you can log in need to update the package information and ensure that no errors are reported.</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''sudo apt-get update'''|}</ol><ol start="5" style="list-style-type: lower-alpha;"><li>'''<span style="color:#FF0000">In addition, since the android system through adb shell source code of the kernel and Uboot are stored on Ubuntu PCGitHub, it is very important to ensure that the computer can download the code from GitHub normally when compiling the image.</span>'''</li></ol>
test@test:~$ '''adb shell'''<span id="obtain-the-source-code-of-linux-sdk"></span>
apollo-p2:/ #== Obtain the source code of linux sdk ==
<span id="usedownload-dataorangepi-cablebuild-tofrom-connect-adb-debugginggithub"></span>=== Use data cable to connect adb debugging Download orangepi-build from github ===
# Prepare a USB Type C interface data cable, plug one end of Linux sdk refers to the USB interface into the USB interface orangepi-build set 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 codes. Orangepi-build is modified based on the right below for the location armbian build compilation system. Multiple versions of USB0)Linux images can be compiled using orangepi-build. In this case, Use the development board is powered by the computer's USB interface, so please ensure that the computer's USB interface can provide the most sufficient power following command to drive download the development board. [[File:zero2w-img304.png]] [[File:zero2w-img305.png]] <ol start="2" style="list-styleorangepi-typebuild code: decimal;"><li>Install adb tool on Ubuntu PC</li></ol>
{| class="wikitable" style="width:800px;"
|-
|
test@test:~$ '''sudo apt-get update'''
test@test:~$ '''sudo apt-get install -y adbgit'''
<ol starttest@test:~$ '''git clone https://github.com/orangepi-xunlong/orangepi-build.git -b next'''|}{| class="3wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;">|-| <libig>Check whether '''Note that when using the H618 Soc development board, you need to download the source code of the ADB device is recognized<span style="color:#FF0000">next</lispan>branch of orangepi-build. The above git clone command needs to specify the branch of the orangepi-build source code as next.'''</olbig>
test@test:~$ '''adb devices'''<div class="figure">
List of devices attached[[File:zero2w-img272.png|center|800px]]
4c00146473c28651dd0 device</div>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''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.'''</big>|}
<ol start="4" style="listThe u-style-typeboot and linux kernel versions currently used by the H618 series development boards are as follows: decimal;"><li>Then you can log in to the android system through adb shell on Ubuntu PC</li></ol>
test@test{| class="wikitable" style="width:~$ 800px;text-align: center;"|-| '''branch'''| 'adb shell''u-boot Version'''| '''linux Kernel version'''apollo|-p2:/ $| '''current'''<span id="view| '''u-howboot v2018.05'''| '''linux5.4'''|-to| '''next'''| '''u-setboot v2021.07'''| '''linux6.1'''|} {| class="wikitable" style="background-hdmicolor:#ffffdc;width:800px;" |-display-resolution">| </spanbig>== View how '''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 set HDMI display resolution ==distinguish different kernel source code versions.'''
<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-img307We define the linux5.png]]</p></li><li><p>Then select '''Display &amp; Sound'''</p><p>[[File:zero2w-img308.png]]</p></li><li><p>Then select '''Advanced display settings'''</p><p>[[File:zero2w-img309.png]]</p></li><li><p>Then select '''HDMI output mode'''</p><p>[[File:zero2w-img310.png]]</p></li><li><p>Then you can see the list of resolutions supported 4 bsp kernel currently provided by Allwinner as the monitor. At this time, clicking the corresponding option will switch to the corresponding resolutioncurrent branch. Please note that different monitors may support different resolutions. If you connect it to a TV, you will generally see more resolution options than the picture below.</p><p>[[File:zero2w-img311.png]]</p></li><li><p>The HDMI output of the development board supports 4K displaylatest linux6. When connected to a 4K TV, you can see 1 LTS kernel is defined as the 4K resolution optionnext branch.'''</pbig><p>[[File:zero2w-img312.png]]</p></li></ol>|}
<span id="hdmi-to-vga-display-test-1"></span>=== HDMI to VGA display test ===After downloading, the following files and folders will be included:
<ol style="list-style-type: decimal;">
<li><p>First you need to prepare the following accessories</p>
<ol style="list-style-type: lower-alpha;">
<li>HDMI <p>'''build.sh''': Compile startup script</p></li><li><p>'''external''': Contains configuration files needed to VGA convertercompile the image, specific scripts, and source code of some programs, etc.</p></li><li><p>'''LICENSE''': GPL 2 license file</olp></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'''
[[File'''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:zero2w800px;" |-| <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 (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-img144build, when it finds that these things are not available locally, it will automatically download them from the corresponding places.png]]'''</big>|}
<ol startspan id="2" style="listdownload-the-cross-stylecompilation-type: lowertool-alpha;chain"><li>A VGA cable and a Mini HDMI male to HDMI female adapter</li></olspan>
[[File:zero2w=== Download the cross-img145.png]] [[File:zero2w-img146.png]]compilation tool chain ===
<ol start="3" style="listWhen orangepi-stylebuild is run for the first time, it will automatically download the cross-type: lowercompilation '''toolchain''' and put it in the '''toolchains''' folder. Every time you run orangepi-alpha;"><li>A monitor or TV that supports VGA interface</li></ol>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.
<!-- --><ol startdiv class="2figure" style="list-style-type: decimal;"><li>HDMI to VGA display test is as follows</li></ol>
[[File:zero2w-img313img273.png]]
'''When using HDMI to VGA display, the development board and the Android system </div>The mirror URL of the development board do not need to make any settings. You only need cross-compilation tool chain in China is the Mini HDMI interface open source software mirror site 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.'''Tsinghua University:
<span id{| class="wiwikitable" style="width:800px;" |-fi| [https://mirrors.tuna.tsinghua.edu.cn/armbian-connectionreleases/_toolchain/ '''https://mirrors.tuna.tsinghua.edu.cn/armbian-method"><releases/_toolchain/span>''']== WI-FI connection method ==|}
# Choose first After toolchains is downloaded, it will contain multiple versions of cross-compilation '''Settingstoolchain''':
[[File{| class="wikitable" style="width:zero2w800px;" |-img306.png]]| test@test:~/orangepi-build$ '''ls toolchains/'''
<ol start="gcc-arm-11.2" style="list-style2022.02-x86_64-aarch64-none-linux-type: decimal;"><li>Then select '''Network &amp; Internet'''</li></ol>gnu
[[File:zero2wgcc-img314linaro-4.9.4-2017.png]]01-x86_64_aarch64-linux-gnu
<ol start="3" style="listgcc-stylelinaro-type: decimal;"><li>Then turn on WI7.4.1-FI</li></ol>2019.02-x86_64_arm-linux-gnueabi
[[File:zero2wgcc-img315arm-11.2-2022.png]]02-x86_64-arm-none-linux-gnueabihf
<ol start="gcc-linaro-4.9.4" style="list-style2017.01-x86_64_arm-type: decimal;"><li>After turning on WIlinux-FI, you can see the searched signals under '''Available networks'''.</li></ol>gnueabi
[[File:zero2wgcc-img316linaro-aarch64-none-elf-4.8-2013.png]]11_linux
<ol start="5" style="listgcc-stylearm-type: decimal;"><li>After selecting the WI9.2-FI you want to connect to, the password input interface shown below will pop up2019.</li></ol>12-x86_64-aarch64-none-linux-gnu
<div class="figure">gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf
[[File:zero2wgcc-img317linaro-arm-linux-gnueabihf-4.8-2014.png]]04_linux
</div><ol start="6" style="listgcc-stylearm-type: decimal;"><li>Then use the keyboard to enter the password corresponding to the WI9.2-2019.12-FI, and then use the mouse to click the Enter button on the virtual keyboard to start connecting to the WIx86_64-FI.</li></ol>arm-none-linux-gnueabihf
<div class="figure">gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu
[[File:zero2wgcc-img318linaro-arm-none-eabi-4.8-2014.png]]04_linux|}
</div><ol start="7" style="list-style-type: decimal;"><li>The display after successful WIcross-FI connection compilation tool chain used to compile the H618 Linux kernel source code is as shown below</li></ol>:
[[File<ol style="list-style-type: lower-alpha;"><li>linux5.4</li>{| class="wikitable" style="width:800px;" |-| '''gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu'''|}</ol><ol start="2" style="list-style-type:zero2wlower-img319alpha;"><li>linux6.png]]1</li>{| class="wikitable" style="width:800px;" |-| '''gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu'''|}</ol>The cross-compilation tool chain used to compile the H618 u-boot source code is:
<span idol style="howlist-tostyle-usetype: lower-wi-fi-hotspotalpha;"><li>v2018.05</spanli>{| class="wikitable" style= How to use WI"width:800px;" |-FI hotspot == # First, please make sure that the Ethernet port is connected to the network cable and can access the Internet normally.| # Then select '''Settingsgcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabi'''|}[[File:zero2w-img306.png]]</ol><ol start="32" style="list-style-type: decimallower-alpha;"><li>Then select '''Network &amp; Internet'''v2021.07</li></ol> [[File:zero2w-img314.png]] <ol start{| class="4wikitable" style="list-style-typewidth: decimal800px;"><li>Then select |-| '''WIFI hotspotgcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu'''|}</liol><span id="orangepi-build-complete-directory-structure-description"></olspan>
[[File:zero2w-img320.png]] <ol start="5" style="list-style-type: decimal;"><li>Then open '''Hotspot Enable'''. You can also see the name and password of the generated hotspot in the picture below. Remember them and use them when connecting to the hotspot (if you need to modify the name and password of the hotspot, you need to close Hotspot Enable first. Then you can modify it)</li></ol> [[File:zero2w-img321.png]] <ol start="6" style="listorangepi-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.</li></ol> [[File:zero2w-img322.png]] <ol startbuild complete directory structure description ="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 '''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 the network port of the expansion board is connected to the router or switch</p></li><li><p>Then open '''Settings'''</p><p>[[File:zero2w-img324.png]]</p></li><li><p>Then select '''Network &amp; Internet'''</p><p>[[File:zero2w-img325.png]]</p></li><li><p>Then you can see the IP address of the development board's wired network port at the location shown in the picture below.</p><p>[[File:zero2w-img326.png]]</p></li></ol> <span id="bluetooth-connection-method"></span>== Bluetooth connection method == # Choose first '''Settings''' [[File:zero2w-img306.png]]
<ol 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/'''orange-pi-5.4-sun50iw9'''
|}
</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/'''orange-pi-6.1-sun50iw9'''
|}
</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/'''v2018.05-h618'''
|}
</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>b) v2021.07</li>
{| class="wikitable" style="width:800px;"
|-
|
https://github.com/orangepi-xunlong/u-boot-orangepi/tree/'''v2021.07-sunxi'''
|}
</ol>
</li></ol>
</li></ol>
<ol start="2" style="list-style-type: decimal;">
<li>Then select <p>When orangepi-build is run for the first time, it will download the cross-compilation tool chain, u-boot and linux kernel source code. After successfully compiling a linux image, the files and folders that can be seen in orangepi-build are:</p><ol style="list-style-type: lower-alpha;"><li><p>'''build.sh''': Compile startup script</p></li><li><p>'''external''': Contains the configuration files needed to 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>'''Bluetoothkernel''': 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</olp></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$ '''ls'''
[[File:zero2w'''build.sh &nbsp;&nbsp;&nbsp;&nbsp; external &nbsp;&nbsp;&nbsp;&nbsp; kernel &nbsp;&nbsp;&nbsp;&nbsp; LICENSE &nbsp;&nbsp;&nbsp;&nbsp; output &nbsp;&nbsp;&nbsp;&nbsp; README.md &nbsp;&nbsp;&nbsp;&nbsp; scripts &nbsp;&nbsp;&nbsp;&nbsp; toolchains &nbsp;&nbsp;&nbsp;&nbsp; u-img327.png]]boot &nbsp;&nbsp;&nbsp;&nbsp; userpatches'''|}</ol></li></ol>
<ol startspan id="3" style="listcompile-styleu-type: decimal;boot"><li>Then Open '''Bluetooth Enable'''</li></olspan>
[[File:zero2w== Compile u-img328.png]]boot ==
<ol start="4" style="list-style-type: decimal;"><li>Then click '''Pair new device'''# Run the build.sh script, remember to start scanning for surrounding Bluetooth devices</li></ol>add sudo permissions
[[File{| class="wikitable" style="width:zero2w800px;" |-img329| test@test:~/orangepi-build$ '''sudo ./build.png]]sh'''|}
<ol start="52" style="list-style-type: decimal;"><li>The searched Bluetooth devices will be displayed under Select '''Available devicesU-boot package'''and press Enter</li></ol>
[[File:zero2w-img330.png]]<div class="figure">
<ol start="6" style="list[[File:zero2w-style-type: decimal;"><li>Then click on the Bluetooth device you want to connect to start pairingimg274. When the following interface pops up, please use the mouse to select the '''Pair'''option</li></ol>png]]
[[File:zero2w-img331.png]] <ol start="7" style="list-style-type: decimal;"><li>What is tested here is the Bluetooth configuration process between the development board and the Android phone. At this time, the following confirmation interface will pop up on the phone. Click the pairing button on the phone to start the pairing process.</li></ol> [[File:zero2w-img332.png]] <ol start="8" style="list-style-type: decimal;"><li>After pairing is completed, open '''Paired devices''' and you will see the paired Bluetooth devices.</li></ol> [[File:zero2w-img333.png]] <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 '''Accept''' to start receiving the pictures sent by the mobile phone.</lidiv></ol> [[File:zero2w-img334.png]] <ol start="103" style="list-style-type: decimal;"><li>Pictures received by Then select the Bluetooth system model of the development board Android system can be viewed in '''Received files'''.</li></ol> [[File:zero2w-img335.png]] <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 . If you want to use USB0 to connect USB devices, you need to set USB0 to HOST mode. The method is as follows:
[[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>Run the following command to set USB0 to HOST mode:Version of u-boot source code</li></ol>{| class="wikitable" style="width:800px;" |-| apollo[ o.k. ] Compiling u-p2:/ # boot [ '''cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_hostv2021.07''']|}host_chose finished! apollo-p2:</ #ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>Run Version of the following command to switch back to Device modecross-compilation tool chain</li></ol>{| class="wikitable" style="width:800px;" apollo|-p2:/ # | [ o.k. ] Compiler version [ '''cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_deviceaarch64-linux-gnu-gcc 11''']|}device_chose finished! apollo-p2:</ #ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>Path to the compiled u-boot deb package</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Target directory [ '''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:800px;" |-| [ o.k. ] File name [ '''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb''' ]|}</ol><ol start="5" style="list-style-type: lower-alpha;"><li>Compilation time</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Runtime [ '''1 min''' ]|}</ol><ol start="6" style="list-style-type: lower-alpha;"><li>Repeat the command to view compile u-boot. Use the current mode of USB0 isfollowing command without selecting through the graphical interface. You can start compiling u-boot directly.</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=u-boot''' ]|}</ol></li></ol><ol start="7" style="list-style-type: decimal;"><li>View the compiled u-boot deb package</li>{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''ls output/debs/u-boot/'''
apollo'''linux-p2:/ # u-boot-next-orangepizero2w_x.x.x_arm64.deb'''cat |}</sys/devices/platform/soc@3000000/soc@3000000\ol><ol start="8" style="list-style-type:usbc0@0/otg_roledecimal;"><li>When the orangepi-bulid compilation system compiles the u-boot source code, it will first synchronize the u-boot source code with the u-boot source code of the github server. Therefore, if you want to modify the u-boot source code, you first need to turn off the download and update function of the source code. ('''You need to completely compile u-boot before you can turn off this function, otherwise it will prompt that the source code of u-boot cannot be found'''), otherwise the modifications will be restored. The method is as follows:</li>
usb_hostSet the IGNORE_UPDATES variable in u'''userpatches/config-default.conf''' to &quot;yes&quot;
<span id{| class="howwikitable" style="width:800px;" |-to| test@test:~/orangepi-usebuild$ '''vim userpatches/config-usb-camera"></span>== How to use USB camera ==default.conf'''
# 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......
console:/ # IGNORE_UPDATES=&quot;'''ls /dev<span style="color:#FF0000">yes</video0span>'''&quot;
......|}</dev/video0ol><ol start="39" style="list-style-type: decimal;"><li><p>Then make sure that When debugging u-boot code, you can use the adb connection between the Ubuntu PC and the development board is normal. For how following method to use adb, please refer to the instructions update u-boot in the section &quot;'''How to use ADB'''&quot;.linux image for testing</p></liol style="list-style-type: lower-alpha;"><li><p>Download First upload the USB camera test APP from compiled deb package of u-boot to the '''official tool''' on Linux system of the development board information download page</p>.</li></ol<div {| class="figurewikitable" style=">width:800px;" |-| test@test:~/orangepi-build$ '''cd output/debs/u-boot'''
[[Filetest@test:zero2w~/orangepi_build/output/debs/u-img336.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]'''|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Install the new u-boot deb package just uploaded</divli>{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''sudo dpkg -i''' '''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb'''|}</ol><ol start="3" style="list-style-type: lower-alpha;"><div li>Then run the nand-sata-install script</li>{| class="figurewikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''sudo nand-sata-install'''|}</ol><ol start="4"style="list-style-type: lower-alpha;"><li>Then select '''5 Install/Update the bootloader on SD/eMMC'''</li>
[[File:zero2w-img337img278.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><ol start="56" style="list-style-type: decimallower-alpha;"><li>Then use Press the adb command Enter key again to install start updating u-boot. After the USB camera test APP into update is completed, the Android system. Of course, you can also use a USB disk copy to install itfollowing information will be displayed.</li></ol>
[[File:zero2w-img280.png]]</ol><ol start="7" style="list-style-type: lower-alpha;"><li>Then you can restart the development board to test@test:~$ '''adb install usbcamerawhether the u-boot modification has taken effect.apk'''</li></ol></li></ol><span id="compile-the-linux-kernel"></span>
<ol start="6" style="list-style-type: decimal;"><li>After installation, you can see Compile the startup icon of the USB camera on the Android desktop.</li></ol>linux kernel ==
[[File:zero2w-img338# Run the '''build.png]]sh''' script, remember to add sudo permissions
<ol start::{| class="7wikitable" style="list-style-typewidth: decimal800px;"><li>Then double|-click to open the USB camera APP and you can see the output video of the USB camera| test@test:~/orangepi-build$ '''sudo .</li></ol>build.sh'''|}
<span idol start="android-system2" style="list-rootstyle-descriptiontype: decimal;"></spanli>== Android system ROOT description == Select '''The Android system released by Orange Pi has been ROOT and can be tested using the following method.''' # Download from the '''official tool''' on the development board data download page '''rootcheck.apkKernel package'''and press Enter</li>
<div class="figure">
[[File:zero2w-img336img281.png]]
</div><div class="figure"> [[File:zero2w-img339.png]] </divol><ol start="23" style="list-style-type: decimal;"><li><p>Then make sure that the adb connection between the Ubuntu PC and you will be prompted whether you need to display the development board is normalkernel configuration interface. For how If you do not need to use adbmodify the kernel configuration, please refer to the instructions in select the section &quot;'''How to use ADB'''&quot;first one.</p></li><li><p>Then use the adb command If you need to install rootcheck.apk into modify the Android system. Of coursekernel configuration, you can also use a USB disk copy to install itselect the second one.</p></li></ol> test@test:~$ '''adb install rootcheck.apk'''
[[File:zero2w-img282.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>After installation, you can see Then select the startup icon model of the ROOT test tool on the Android desktop.development board</li></ol>
[[File:zero2w-img340img275.png]]</ol><ol start="5" style="list-style-type: decimal;"><li>Then select the branch type of the kernel source code</li>
<ol start="5" style="list-style-type: decimal;"><li>:a. The display interface after opening the '''ROOT test tool''' for current branch will compile the first time is as shown below</li></ol>linux5.4 kernel source code
[[File:zero2w-img341:b. The next branch will compile the linux6.png]]1 kernel source code
::[[File:zero2w-img276.png]]
</ol>
<ol start="6" style="list-style-type: decimal;">
<li>Then If you can click choose to display the kernel configuration menu (the second option) in step 3), the kernel configuration interface opened through '''CHECK NOWmake menuconfig''' to start checking the ROOT status of will pop up. At this time, you can directly modify the Android systemkernel configuration. After the check is completedmodification, the display is as followssave and exit. You can see that Yes, compilation of the Android system has obtained ROOT permissionskernel source code will begin after exiting.</li></ol>
[[File:zero2w-img342img283.png]]
<span idol style="howlist-tostyle-use-miracastreceivertype: lower-alpha;"><li>If you do not need to modify the kernel configuration options, when running the build.sh script, pass '''KERNEL_CONFIGURE=no''' totemporarily block the pop-cast-up of thekernel configuration interface.</li>{| class="wikitable" style="width:800px;" |-mobile| test@test:~/orangepi-phonebuild$ '''sudo ./build.sh KERNEL_CONFIGURE=no'''|}</ol><ol start="2" style="list-screenstyle-totype: lower-alpha;"><li><p>b. You can also set '''KERNEL_CONFIGURE=no''' in theorangepi-developmentbuild/userpatches/config-board"default.confconfiguration file to permanently disable this function.</p></spanli>== How <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 use MiracastReceiver be unable to cast be displayed. Please increase the mobile phone screen Ubuntu PC terminal to the development board ==maximum size, and then rerun the build.sh script.</p></li>
[[File:zero2w-img284.png]]</ol></ol><ol start="7" 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 Part of connecting the development board to WIFI, please refer to '''information prompted when compiling the instructions in the WI-FI connection method.'''next branch kernel source code is explained as follows:</p></liol style="list-style-type: lower-alpha;"><li>Version of the linux kernel source code<p/li>Then open the {| class="wikitable" style="width:800px;" |-| [ o.k. ] Compiling current kernel [ '''MiracastReceiver6.1.31'''application in the Android system ]|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>The version of the development boardcross-compilation tool chain used</pli><p>[[File{| class="wikitable" style="width:zero2w800px;" |-img343| [ o.k.png]Compiler version [ '''aarch64-linux-gnu-gcc 11''' ]|}</pol></liol start="3" style="list-style-type: lower-alpha;"><li>The default configuration file used by the kernel and the path where it is stored are as follows<p/li>The interface after {| class="wikitable" style="width:800px;" |-| [ o.k. ] Using kernel config file [ '''MiracastReceiverorangepi-build/external/config/kernel/linux-6.1-sun50iw9-next.config''' is opened is as follows]|}</pol><div classol start="figure4" style="list-style-type: lower-alpha;"><li>The path to the kernel-related deb package generated by compilation</li>[[File{| class="wikitable" style="width:zero2w800px;" |-img344| [ o.k.png]Target directory [ '''output/debs/''' ]|}</divol></liol start="5" style="list-style-type: lower-alpha;"><li>The package name of the kernel image deb package generated by compilation<p/li>Then find the screen mirroring function in the phone settings{| class="wikitable" style="width:800px;" |-| [ o.k. Here we take ] File name [ '''Xiaomi 12S Pro mobile phonelinux-image-next-sun50iw9_x.x.x_arm64.deb''' 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><ol start="6" style="list-style-type: lower-alpha;"><pli>Compilation time</li>[[File{| class="wikitable" style="width:zero2w800px;" |-img345| [ o.k.png]Runtime [ '''10 min''' ]|}</pol></liol start="7" style="list-style-type: lower-alpha;"><li><p>After waiting for a period of timeFinally, you the compilation command to repeatedly compile the last selected kernel will be able to see displayed. Use the following command without selecting through the searched connectable devices on your mobile phonegraphical interface, and then we you can select the device corresponding to directly start compiling the development board to connectkernel source code.</pli><p>[[File{| class="wikitable" style="width:zero2w800px;" |-img346| [ o.k.png]Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=kernel KERNEL_CONFIGURE=no''' ]|}</pol></li></ol><ol start="8" style="list-style-type: decimal;"><li><p>Then View 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'''kernel-related deb package generated by compilation</p><ol style="list-style-type: lower-alpha;"><li><p>[[File:zero2w'''linux-dtb-next-img347sun50iw9_x.png]]x.x_arm64.deb''' Contains dtb files used by the kernel</p></li><li><p>Then you can see the content of the mobile phone screen on the HDMI screen connected to the development board'''linux-headers-next-sun50iw9_x.x.x_arm64.deb''' Contains kernel header files</p></li><li><p>[[File:zero2w'''linux-image-next-img348sun50iw9_x.x.png]]x_arm64.deb''' Contains kernel images and kernel modules</p></li><{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''ls output/debs/ol>linux-*'''
<span id="method-ofoutput/debs/linux-turningdtb-onnext-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 ==sun50iw9_x.x.x_arm64.deb
We can turn off or turn on the Android system of the development board through the power onoutput/off button or infrared remote controldebs/linux-headers-next-sun50iw9_x. 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 boardx.x_arm64.deb
[[Fileoutput/debs/linux-image-next-sun50iw9_x.x.x_arm64.deb|}</ol></li></ol><ol start="9" style="list-style-type:zero2wdecimal;"><li>When the orangepi-img107bulid 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.png]]Therefore, if you want to modify the linux kernel source code, you first need to turn off the update function of the source code ('''it needs to be completely compiled once This function can only be turned off after obtaining the Linux kernel source code, otherwise it will prompt that the source code of the Linux kernel cannot be found'''), otherwise the modifications will be restored. The method is as follows:</li>
The location of Set the power button on the 24pin expansion board is as shown IGNORE_UPDATES variable in the figure below:'''userpatches/config-default.conf''' to &quot;yes&quot;
[[File{| class="wikitable" style="width:zero2w800px;" |-img269| test@test:~/orangepi-build$ '''vim userpatches/config-default.png]]conf'''
The location IGNORE_UPDATES=&quot;'''<span style="color:#FF0000">yes</span>'''&quot;|}</ol><ol start="10" style="list-style-type: decimal;"><li><p>If the kernel is modified, you can use the following method to update the kernel and kernel module of the infrared remote control power button is as followsdevelopment board Linux system</p><ol style="list-style-type: lower-alpha;"><li>Upload the compiled deb package of the Linux kernel to the Linux system of the development board</li>{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''cd output/debs'''
[[Filetest@test:zero2w~/orangepi-img349.png]]build/output/debs$ '''scp \'''
When shutting down, we need to press and hold '''linux-image-next-sun50iw9_x.x.x_arm64.deb root@192.168.1.xxx:/root'''|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Install the power button or deb package of the power button on new linux kernel just uploaded.</li>{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''sudo dpkg -i linux-image-next-sun50iw9_x.x.x_arm64.deb'''|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>Then restart the infrared remote control, development board and then check whether the Android system will pop up the confirmation dialog box shown in the figure below, and then select kernel-related modifications have taken effect.</li>{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''sudo''' '''OKreboot''' to shut down the Android system.|}</ol></li></ol><span id="compile-rootfs"></span>
[[File:zero2w-img350.png]]== Compile rootfs ==
After shutting down# Run the build.sh script, press and hold the power button or the power button on the infrared remote control again remember to turn it on.add sudo permissions
<span id::{| class="pinwikitable" style="width:800px;" |-interface-gpio| test@test:~/orangepi-uart-spi-test"><build$ '''sudo ./span>build.sh'''== 40pin interface GPIO, UART, SPI test ==|}
<ol start="2" style="list-style-type: decimal;"><li>Select '''Note: The pin header on the 40pin interface is not soldered by default, Rootfs and you need to solder it yourself before it can be used.all deb packages'''and press Enter</li>
<span iddiv class="pin-gpio-port-test-methodfigure"></span>=== 40pin GPIO port test method ===
# First open wiringOP APP on the desktop [[File:zero2w-img351.png]] <ol start="2" style="list-style-type: decimal;"><li>Then click the '''GPIO_TEST''' button to open the GPIO test interface</li></ol> [[File:zero2w-img352img285.png]]
</div></ol>
<ol start="3" style="list-style-type: decimal;">
<li>The GPIO test interface is as shown in Then select the figure below. The two rows model of '''CheckBox''' buttons on the left 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.development board</li></ol> [[File:zero2w-img353.png]]
[[File:zero2w-img275.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>Then click 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 '''GPIO READALL''' buttoncurrent branch, you can see three options: debian11, ubuntu20.04, and ubuntu22.04.</p></li><li><p>In the output information is as shown belownext branch, you can see three options:debian11, debian12, and ubuntu22.04.</lip></olli>
<div class="figure"> [[File:zero2w-img354img276.png]]</ol></divli></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 Then select the high and low levels type of the GPIO port. First click the '''CheckBox''' button corresponding to pin 12. When the button is selected, pin 12 will be set to high level. After setting, you can use a multimeter to measure the value of the voltage of the pin. If it is '''3.3v''', it means the setting High level success.rootfs</li></ol>
[[File:zero2w-img355img286.png]]</ol><ol start="6" style="list-style-type: decimal;"><li><p>Then select the type of image</p><ol style="list-style-type: lower-alpha;"><li><p>'''Image with console interface (server)''' Represents the image of the server version, which is relatively small in size.</p></li><li><p>'''Image with desktop environment''' Represents an image with a desktop, which is relatively large in size.</p></li>
<ol startdiv class="6figure" style="list-style-type: decimal;"><li>Then click the '''GPIO READALL''' button and you can see that the current pin 12 mode is '''OUT''' and the pin level is high level.</li></ol>
[[File:zero2w-img356img287.png]]
</div></ol>
</li></ol>
<ol start="7" style="list-style-type: decimal;">
<li>Click If you are compiling the '''CheckBox''' button in server version of the picture below again to uncheck it, and pin 12 will be set to low level. After settingimage, you can use a multimeter also choose to measure compile the voltage value of Standard version or the pinMinimal version. If it is The Minimal version will have much less pre-installed software than the Standard version ('''0vplease do not choose the Minimal version without special needs, because many things are not pre-installed by default. Some functions may not be available''', it means the low level setting is successful.)</li> </oldiv class="figure">
[[File:zero2w-img357img288.png]]
</div>
</ol>
<ol start="8" style="list-style-type: decimal;">
<li>Then click If you are compiling a desktop version of the '''GPIO READALL''' button and image, you can see that also need to select the current pin 12 mode is OUT and the pin level type of desktop environment. Currently, only XFCE is low levelmaintained, so please select an XFCE type desktop.</li></ol>
[[File:zero2w-img358img289.png]]
<span id="pin[[File:zero2w-uart-test-method"></span>=== 40pin UART test method ===img290.png]]
# As You can then select additional packages that need to be seen from the table below, the default uarts available in the Android12 TV system are uart2 and uart5installed. Please note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial portpress the Enter key here to skip directly.
[[File:zero2w-img291.png]]</ol><ol start="9" style="list-style-type: decimal;"><li><p>Then the compilation of rootfs will start. Some of the information prompted during compilation are as follows:</p><ol style="list-style-type: lower-alpha;"><li>Type of rootfs</li>{| class="wikitable" style="width:800px;"
|-
| '''GPIO序号'''| [ o.k. ] local not found [ Creating new rootfs cache for '''GPIObullseye''']| '''功能'''}| '''引脚'''|| '''引脚'''</ol>| '''功能'''<ol start="2" style="list-style-type: lower-alpha;">| '''GPIO'''<li>The storage path of the compiled rootfs compressed package</li>{| '''GPIO序号'''class="wikitable" style="width:800px;"
|-
| style="text-align: left;"|| style="text-align: left;"|| '''3[ o.k.3V] Target directory [ '''| '''1orangepi-build/external/cache/rootfs''']|}| '''2'''</ol>| '''5V'''| <ol start="3" style="textlist-style-aligntype: leftlower-alpha;"|><li>The name of the rootfs compressed package generated by compilation</li>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| [ o.k. ] File name [ '''264bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4''']| }</ol></li></ol><ol start="10" style="list-style-type: decimal;"><li><p>View the compiled rootfs compressed package</p><ol style="list-style-type: lower-alpha;"><li>'''PI8bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4'''It is a compressed package of rootfs. The meaning of each field in the name is</li> | :a) '''TWI1-SDAbullseye'''represents the type of Linux distribution of rootfs| :b) '''3xfce'''indicates that the rootfs is the desktop version, and if it is cli, it indicates the server version.|| :c) '''4arm64'''represents the architecture type of rootfs| :d) '''5V25250ec7002de9e81a41de169f1f89721'''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="textlist-style-aligntype: leftlower-alpha;"|><li>'''bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4.list''' Lists the package names of all packages installed by rootfs</li>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| test@test:~/orangepi-build$ '''263ls 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 '''PI7external/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 '''TWI1-SCLexternal/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> | '''5'''<span id="compile-linux-image"></span> == Compile linux image ==|| # Run the '''6build.sh'''script, remember to add sudo permissions| '''GND'''::{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| test@test:~/orangepi-build$ '''269sudo ./build.sh'''| } <ol start="2" style="list-style-type: decimal;"><li>Select '''PI13Full OS image for flashing'''and press Enter</li> <div class="figure"> [[File:zero2w-img292.png]] </div></ol><ol start="3" style="list-style-type: decimal;"><li>Then select the model of the development board</li> | '''PWM3'''[[File:zero2w-img275.png]]</ol><ol start="4" style="list-style-type: decimal;"><li><p>Then select the branch type of the kernel source code. Different versions of the kernel source code maintain different rootfs types.</p><ol style="list-style-type: lower-alpha;"><li><p>In the current branch, you can see three options: debian11, ubuntu20.04, and ubuntu22.04.</p></li><li><p>In the next branch, you can see three options: debian11, debian12, and ubuntu22.04.</p></li> [[File:zero2w-img276.png]]</ol></li></ol><ol start="5" style="list-style-type: decimal;"><li><p>If you select the next branch, you will also be prompted to select the memory size, and you do not need to select the current branch.</p><ol style="list-style-type: lower-alpha;">| '''7'''<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>| '''8'''<p>[[File:zero2w-img277.png]]</p></li></ol>| '''UART0_TX'''</li>| '''PH0'''<li><p>Then select the type of rootfs</p></li>| '''224'''|[[File:zero2w-img286.png]]| </ol><ol start="7" style="textlist-style-aligntype: leftdecimal;"|><li><p>Then select the type of image</p>| <ol style="textlist-alignstyle-type: leftlower-alpha;"|>| <li><p>'''GNDImage with console interface (server)'''Represents the image of the server version, which is relatively small in size.</p></li>| <li><p>'''9Image with desktop environment'''Represents an image with a desktop, which is relatively large in size.</p></li> <div class="figure"> [[File:zero2w-img287.png]] |</div></ol></li></ol><ol start="8" style="list-style-type: decimal;">| <li>If you are compiling the server version of the image, you can also choose to compile the Standard version or the Minimal version. The Minimal version will have much less pre-installed software than the Standard version ('''10please do not choose the Minimal version without special needs, because many things are not pre-installed by default. Some functions may not be available''')</li> | '''UART0_RX'''<div class="figure"> [[File:zero2w-img288.png]] </div></ol><ol start="9" style="list-style-type: decimal;">| '''PH1'''<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>| '''225'''|[[File:zero2w-img289.png]] | '''226'''[[File:zero2w-img290.png]]| '''PH2'''| '''UART5_TX'''You can then select additional packages that need to be installed. Please press the Enter key here to skip directly.| '''11'''|[[File:zero2w-img291.png]]| '''12'''</ol>| <ol start="10" style="textlist-style-aligntype: leftdecimal;"|><li>Then the compilation of the linux image will begin. The general process of compilation is as follows</li> ::a. Initialize the compilation environment of Ubuntu PC and install the software packages required for the compilation process. ::b. Download the source code of u-boot and linux kernel (if already cached, only update the code) ::c. Compile u-boot source code and generate u-boot deb package ::d. Compile linux source code and generate linux-related deb packages ::e. Make the deb package of linux firmware ::f. Make the deb package of orangepi-config tool ::g. Create a deb package with board-level support ::h. If you compile the desktop version image, you will also create a desktop-related deb package. ::i. Check whether rootfs has been cached. If not, re-create rootfs. If it has been cached, decompress it directly and use it. | '''PI1'''::j. Install the deb package generated previously into rootfs| '''257'''|::k. Make some specific settings for different development boards and different types of images, such as pre-installing additional software packages, modifying system configurations, etc. ::l. Then create the image file and format the partition. The default type is ext4.| '''227'''| '''PH3'''::m. Then copy the configured rootfs to the mirror partition.| '''UART5_RX'''| '''13'''::n. Then update initramfs|| '''14'''::o. Finally, write the bin file of u-boot into the image through the dd command.| '''GND'''</ol>| <ol start="11" style="textlist-style-aligntype: leftdecimal;"|><li><p>After compiling the image, the following message will be displayed</p>| <ol style="textlist-alignstyle-type: leftlower-alpha;"><li>The storage path of the compiled image</li>{|class="wikitable" style="width:800px;"
|-
| [ o.k. ] Done building [ '''261output/images/orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop/orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop.img''']| '''PI5'''}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Compilation time</li>{| '''UART2_TX'''class="wikitable" style="width:800px;" | '''15'''-|| '''16[ o.k. ] Runtime [ 19 min ]'''| '''PWM4'''}</ol><ol start="3" style="list-style-type: lower-alpha;">| '''PI14'''<li>Repeat the command to compile the image. Use the following command to start compiling the image directly without selecting it through the graphical interface.</li>{| '''270'''class="wikitable" style="width:800px;"
|-
| style="text-align: left;"|| style="text-align: left;"|| [ o.k. ] Repeat Build Options [ '''3sudo .3V/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> = '''17Instructions for using the Orange Pi OS Arch system'''= <span id="orange-pi-os-arch-system-function-adaptation-status"></span>|== Orange Pi OS Arch system function adaptation status ==| '''18'''{| class="wikitable" style="width:800px;text-align: leftcenter;"|| '''PH4'''| '''228'''
|-
| '''231Motherboard functions'''| '''PH7OPi OS Arch'''| '''SPI1_MOSI'''| '''19'''|| '''20'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''232HDMI video'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''UART2_RX'''| '''PI6'''| '''262OK'''
|-
| '''230HDMI Audio'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229OK'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''25'''|| '''26'''| '''SPI1_CS1'''| '''PH9Type-C USB2.0 x 2'''| '''233OK'''
|-
| '''266TF Card Startup'''| '''PI10'''| '''TWI2-SDA'''| '''27'''|| '''28'''| '''TWI2-SCL'''| '''PI9'''| '''265OK'''
|-
| '''256WIFI'''| '''PI0OK'''| style="text-align: left;"|| '''29'''|| '''30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''271Bluetooth'''| '''PI15'''| style="text-align: left;"|| '''31'''|| '''32'''| '''PWM1'''| '''PI11'''| '''267OK'''
|-
| '''268LED Light'''| '''PI12OK'''| '''PWM2'''| '''33'''|| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''25840pin GPIO'''| '''PI2OK'''| style="text-align: left;"| '''40pin I2C'''| '''OK'''|-| '''40pin SPI'''| '''OK'''|-| '''40pin UART'''| '''35OK'''|-| '''40pin PWM'''| '''36OK'''| style="text-align: left;"| '''Temperature Sensor'''|'''OK'''|-| '''PC12Hardware watchdog'''| '''76OK'''
|-
| '''272Mali GPU'''| '''PI16'''| <span style="text-aligncolor: left;#FF0000"|| '''37'''|| '''38'''| style="text-align: left;"|| '''PI4'''| '''260>NO</span>'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''GNDVideo codec'''| '''39'''|| '''40'''| <span style="text-aligncolor: left;#FF0000"|| '''PI3'''| '''259>NO</span>'''
|}
<ol start{| class="2wikitable" style="list-stylewidth:800px;text-typealign: decimalcenter;"><li>The device node corresponding to uart2 is |-| '''24pin expansion board function'''| '''OPi OS Arch'''|-| '''100M network port'''| '''OK'''|-| '''100M Ethernet port light'''| '''OK'''|-| '''USB2.0 HOST x 2'''| '''OK'''|-| '''Infrared reception'''| '''OK'''|-| '''Headphone audio playback'''| '''/dev/ttyAS2OK''', and the device node corresponding to uart5 is|-| '''On/dev/ttyAS5off button'''</li></ol>| '''OK'''apollo|-p2:/ # ls /dev/ttyAS*| '''LRADC''' '''Custom buttons x 2'''/dev/ttyAS0 /dev/ttyAS1 | '''/dev/ttyAS2 /dev/ttyAS5OK'''|-| '''TV-OUT'''| '''<ol start="3" span style="list-style-typecolor: decimal;#FF0000"><li>First open wiringOP APP on the desktopNO</li></olspan>''' [[File:zero2w-img351.png]]|}
<ol startspan id="4" style="listorange-pi-os-arch-system-user-styleguide-type: decimal;instructions"><li>Then click the '''UART_TEST'''button to open the UART test interface</li></olspan>
[[File:zero2w-img359.png]]== Orange Pi OS Arch System User Guide Instructions ==
<ol start="5" style="list-style-type: decimal;"><li>The 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 test interface of wiringOP and ssh after the system is as shown in started after burning (not even the figure below</li></ol>root user). This is different from Ubuntu and Debian systems.
[[FileWhen 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:zero2w-img360.png]]
<ol start="6" style="list-style-type: decimallower-alpha;"><li><p>Then select After burning 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 system, when you want to set in start it for the edit box, first time and then click the '''OPEN''' button to open the uart node. After enter the opening is successfuldesktop, you will see the '''OPEN''' button becomes unselectable, and user wizard program shown in the '''CLOSE''' button and '''SEND''' button become selectablefigure below.</p></li></oldiv class="figure">
[[File:zero2w-img362img293.png]]
<ol start="8" style="list-style-type: decimal;"><li><p>Then use Dupont wire to short the rx and tx pins of uart</pdiv></li><li><p>Then First you can enter a paragraph of characters in need to select the send edit box below and click the '''SEND''' button to start sending.language you want</p></li></oldiv class="figure">
[[File:zero2w-img363img294.png]]
<ol start="10" style="list-style-type: decimal;"/div></li><li>If everything is normal<p>After selecting the language, the received string user wizard will be displayed immediately switch to the corresponding language interface, as shown below in the receiving boxChinese</lip></oldiv class="figure">
[[File:zero2w-img364img295.png]]
<span id="pin-spi-test-method"/div></li><li><p>Then select the area</spanp><div class=== 40pin SPI test method ==="figure">
# 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[[File:zero2w-img296.png]]
{| </div></li><li><p>Then select the keyboard model</p><div class="figure"> [[File:zero2w-img297.png]] </div></li><li><p>Then create a new username and set a password</p><div class="wikitablefigure">|[[File:zero2w-img298.png]] </div></li>| <li><p>Then make sure there is no problem with the selection, and then click the install '''GPIO serial numberbutton'''</p><div class="figure"> [[File:zero2w-img299.png]] </div></li><li><p>Then wait for the installation to complete</p><div class="figure"> [[File:zero2w-img300.png]] </div></li>| <li><p>After the installation is complete, you need to click the '''GPIOFinish'''button to restart the system.</p>| <div class="figure"> [[File:zero2w-img301.png]] </div></li><li><p>The Orange Pi Hello program will automatically start after restarting. At this time, you need to remove the check '''Functionmark of Start on startup'''in the lower right corner, otherwise you need to manually close the Orange Pi Hello program every time you start it.</p>| '''<div class="figure"> [[File:zero2w-img302.png]] </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></ol> <span id="how-to-set-dt-overlays"></span>== How to set DT overlays == The multiplexing functions such as I2C/SPI/UART/PWM in the 40-pindevelopment 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. |The method to open DT overlays in OPi OS Arch system is as follows:| '''pin'''| # First open the '''Function/boot/extlinux/extlinux.conf'''configuration file| '''GPIO'''::{| '''GPIO serial number'''class="wikitable" style="width:800px;"
|-
| style[orangepi@orangepi-pc ~]$ '''sudo vim /boot/extlinux/extlinux.conf'''|} <ol start="text-align: left;2"|| style="textlist-alignstyle-type: leftdecimal;"|>| <li>Then open the corresponding configuration by adding '''3.3VFDTOVERLAYS'''| '''1/dtbs/allwinner/overlay/xxx.dtbo'''|| in '''2/boot/extlinux/extlinux.conf'''</li> {| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''5VNote that xxx.dtbo in FDTOVERLAYS /dtbs/allwinner/overlay/xxx.dtbo needs to be replaced with the specific dtbo configuration, please do not copy it.'''</big>|}{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| [orangepi@orangepi-pc ~]$ '''264sudo vim /boot/extlinux/extlinux.conf'''| '''PI8'''| '''TWI1LABEL Orange Pi KERNEL /Image FDT /dtbs/allwinner/sun50i-h616-orangepi-SDA'''zero2w.dtb | '''3FDTOVERLAYS /dtbs/allwinner/overlay/<span style="color:#FF0000">xxx.dtbo</span>'''#Configuration that needs to be added|}| '''4'''</ol>| '''5V'''| <ol start="3" style="textlist-style-aligntype: leftdecimal;"|><li><p>The storage path of xxx.dtbo in the OPi OS Arch image is as follows. Please note that not all dtbo under this path can be used.</p>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| '''263'''| <p>'''PI7/boot/dtbs/allwinner/overlay/'''</p>| '''TWI1-SCL'''}| '''5'''</li>|<li><p>The DT overlays configuration that can be used by the development board is as follows</p></li>| '''6'''| '''GND'''{| styleclass="text-align: left;wikitable"|| style="width:800px;text-align: leftcenter;"|
|-
| '''269Functions on the development board'''| '''PI13'''| '''PWM3'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224Corresponding DT overlays configuration'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''GND40pin - i2c0'''| '''9'''|| '''10'''| '''UART0_RX'''| '''PH1'''| '''225sun50i-h616-pi-i2c0.dtbo'''
|-
| '''22640pin - i2c1'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''12'''| style="textsun50i-h616-pi-align: left;"|| '''PI1'''| '''257i2c1.dtbo'''
|-
| '''22740pin - i2c2'''| '''PH3'''| '''UART5_RX'''| '''13'''|| '''14''sun50i-h616-pi-i2c2.dtbo'| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''26140pin - uart2'''| '''PI5'''| '''UART2_TX'''| '''15'''|| '''16'''| '''PWM4'''| '''PI14'''| '''270sun50i-h616-pi-uart2.dtbo'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''3.3V40pin - uart3'''| '''17'''|| '''18'''| style="textsun50i-h616-pi-align: left;"|| '''PH4'''| '''228uart3.dtbo'''
|-
| '''23140pin - uart4'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|| '''20''sun50i-h616-pi-uart4.dtbo'| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''23240pin - uart5'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''UART2_RX'''| '''PI6'''| '''262sun50i-h616-ph-uart5.dtbo'''
|-
| '''23040pin - pwm1'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229sun50i-h616-pi-pwm1.dtbo'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''GND40pin - pwm2'''| '''25'''|| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233sun50i-h616-pi-pwm2.dtbo'''
|-
| '''26640pin - pwm3'''| '''PI10'''| '''TWI2sun50i-h616-SDA'''| '''27'''|| '''28'''| '''TWI2pi-SCL'''| '''PI9'''| '''265pwm3.dtbo'''
|-
| '''25640pin - pwm4'''| '''PI0'''| style="textsun50i-h616-pi-align: left;"|| '''29'''|| '''30'''| ''pwm4.dtbo'GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''27140pin - spi1 cs0'''| '''PI15'''| style="textsun50i-h616-spi1-cs0-align: left;"|| '''31'''|| '''32'''| '''PWM1'''| '''PI11'''| '''267spidev.dtbo'''
|-
| '''26840pin - spi1 cs1'''| '''PI12sun50i-h616-spi1-cs1-spidev.dtbo'''|-| '''PWM240pin - spi1 cs0 cs1'''| '''33sun50i-h616-spi1-cs0-cs1-spidev.dtbo'''|-| '''34设Set USB0 to Host mode'''| '''GNDsun50i-h616-usb0-host.dtbo'''| style="text-align: left;"|'''Turn off the green LED light'''| style="text'''sun50i-h616-zero2w-disable-align: left;"|led.dtbo'''
|-
| '''258How to close the UART0 debugging serial port'''| '''PI2'''| style="textsun50i-h616-align: left;"|| '''35'''|| '''36'''| style="textdisable-align: left;"|| '''PC12'''| '''76uart0.dtbo'''
|}
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>If you need to open multiple configurations at the same time, just add the paths of multiple configurations directly after '''FDTOVERLAYS.''' For example, the configuration of opening i2c1 and uart5 at the same time is as follows</li>
{| class="wikitable" style="width:800px;"
|-
|
[orangepi@orangepi-pc ~]$ '''sudo vim /boot/extlinux/extlinux.conf'''
<ol start="2" style="list-style-type: decimal;"><li>The device node corresponding to SPI1 CS0 is '''/dev/spidev1.0''', and the device node corresponding to SPI1 CS1 is '''/dev/spidev1.1'''</li></ol>LABEL Orange Pi
apollo-p2:KERNEL / # '''ls /dev/spidev1.*'''Image
'''FDT /devdtbs/spidev1.0 /devallwinner/spidev1sun50i-h616-orangepi-zero2w.1'''dtb
'''FDTOVERLAYS <span style="color:#FF0000">/dtbs/allwinner/overlay/sun50i-h616-pi-i2c1.dtbo /dtbs/allwinner/overlay/sun50i-h616-ph-uart5.dtbo</span>'''|}</ol><ol start="36" style="list-style-type: decimal;"><li>Here is a demonstration After setting, you need to test restart the SPI1 interface through system for the configuration to take effect.</li>{| class="wikitable" style="width:800px;" |-| [orangepi@orangepi-pc ~]$ '''w25qxxsudo reboot''' module. First, connect the w25qxx module to the SPI1 interface.|}</liol><span id="how-to-install-software"></olspan>
'''It doesn't matter if there is no w25qxx module, because there is a SPIFlash on the development board connected == How 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.'''install software ==
<ol start="4" style="list-style-type: decimal;"><li>Then open wiringOP APP on You can use the desktop</li></ol>pacman package management tool to install software that is not available in OPi OS. For example, the command to install the vim editor is as follows. If you want to install other software, you only need to replace vim with the package name of the software you want to install.
{| class="wikitable" style="width:800px;" |-| [[File:zero2worangepi@orangepi-img351.png]pc ~]$ '''sudo pacman -Syy vim'''|}
<ol startspan id="5" style="listandroid-12-tv-system-styleusage-type: decimal;instructions"><li>Then click the '''SPI_TEST''' button to open the SPI test interface</li></olspan>
[[File:zero2w-img365.png]]= '''Android 12 TV system usage instructions''' =
<ol startspan id="6" style="listsupported-styleandroid-type: decimal;versions"><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'''</pspan><div class="figure">= Supported Android versions ==
[[File{| class="wikitable" style="width:zero2w800px;text-img366align: center;"|-| Android Version| Kernel version|-| '''Android 12 TV Version'''| '''linux5.png]]4'''|}
</divspan id="android-12-tv-function-adaptation-status"></lispan><li><p>Then click the '''OPEN''' button to initialize the SPI</p></li></ol>== Android 12 TV function adaptation status ==
[[File:zero2w-img367.png]] <ol start{| class="8wikitable" style="list-stylewidth:800px;text-typealign: decimalcenter;"><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 |-| '''TRANSFERMotherboard functions''' button</li></ol> [[File:zero2w-img368.png]] <ol start="9" style="list-style-type: decimal;"><li>Finally, the APP will display the read ID information of the onboard SPI Flash.</li></ol> [[File:zero2w-img369.png]] <ol start="10" style="list-style-type: decimal;"><li>If the w25qxx module connected to 40pin SPI1 is read, the ID information of the onboard SPI Flash is also similar.</li></ol> <span id="pin-i2c-test-method"></span>=== 40pin I2C test method === # As can be seen from the table below, the | '''Android12 TV system has i2c1 and i2c2 turned on by default. {| class="wikitable"'''
|-
| '''GPIO serial numberHDMI video'''| '''GPIO'''| '''Function'''| '''pin'''|| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO serial numberOK'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''1'''|| '''2HDMI Audio'''| '''5VOK'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''264Type-C USB2.0 x 2'''| '''PI8OK'''| '''TWI1-SDA'''| '''3TF card startup'''|| '''4'OK''| '''5V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''263WIFI'''| '''PI7OK'''| '''TWI1-SCL'''| '''5'''|| '''6'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''269Bluetooth'''| '''PI13'''| '''PWM3'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224OK'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''9'''|| '''10'''| '''UART0_RX'''| '''PH1USB Camera'''| '''225OK'''
|-
| '''226LED Light'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''12'''| style="text-align: left;"|| '''PI1'''| '''257OK'''
|-
| '''22740pin GPIO'''| '''PH3OK'''| '''UART5_RX'''| '''13'''|| '''14'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''26140pin I2C'''| '''PI5'''| '''UART2_TX'''| '''15'''|| '''16'''| '''PWM4'''| '''PI14'''| '''270OK'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''17'''|| '''18'''| style="text-align: left;"|| '''PH440pin SPI1'''| '''228OK'''
|-
| '''23140pin UART'''| '''PH7OK'''| '''SPI1_MOSI'''| '''19'''|| '''20'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''23240pin PWM'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''UART2_RX'''| '''PI6'''| '''262OK'''
|-
| '''230Temperature Sensor'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229OK'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''GNDHardware watchdog'''| '''25OK'''|-| '''26'''| '''SPI1_CS1'''| '''PH9Mali GPU'''| '''233OK'''
|-
| '''266Video codec'''| '''PI10OK'''| '''TWI2-SDA'''}| '''27'''|| '''28'''{| '''TWI2class="wikitable" style="width:800px;text-SCL'''| '''PI9'''| '''265'''align: center;"
|-
| '''25624pin Expansion board function'''| '''PI0Android12 TV'''| style="text-align: left;"|| '''29'''|| '''30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''271100M network port'''| '''PI15'''| style="text-align: left;"|| '''31'''|| '''32'''| '''PWM1'''| '''PI11'''| '''267OK'''
|-
| '''268100M Ethernet port light'''| '''PI12OK'''| '''PWM2'''| '''33'''|| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''258USB2.0 HOST x 2'''| '''PI2OK'''| style="text-align: left;"|'''Infrared reception'''| '''35OK'''|-| '''36Headphone audio playback'''| '''OK'''| style="text-align: left;"|| '''PC12On/off button'''| '''76OK'''
|-
| '''272LRADC'''| '''PI16'''| style="text-align: left;"|| '''37'''|| '''38'''| style="text-align: left;"|| '''PI4Custom buttons x 2'''| '''260OK, The default setting is the volume up and down keys.'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''39'''|| '''40'''| style="textTV-align: left;"|| '''PI3OUT'''| '''259OK'''
|}
<ol startspan id="2" style="listonboard-styleled-type: decimal;"><li>The device node corresponding to i2c1 is '''/dev/i2clight-1''', and the device node corresponding to i2c2 is '''/dev/i2cdisplay-2'''</liinstructions"></olspan>== Onboard LED light display instructions ==
apollo{| class="wikitable" style="width:800px;text-p2align:/ # center;"|-|| '''green light'''| '''red light'''|-| '''u-boot startup phase'''| '''Off'''| '''on''ls /dev/i2c'|-*| '''Kernel boot to enter the system'''| '''on'''| '''on'''|}
'''/dev/i2c<span id="how-to-return-to-the-previous-interface-1 /dev/i2cin-2''' android"></dev/i2c-5span>== How to return to the previous interface in Android ==
<ol start="3" style="listWe 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-style-type: decimal;"><li>First open wiringOP APP on clicking the mouse, and the desktop</li></ol>keyboard cannot return.
[[FileIf you have purchased the infrared remote control (other remote controls do not work) and a 24pin expansion board that come with the development board, after connecting the 24pin expansion board to the development board, you can also use the return key on the remote control to return to the previous menu. The location of the return key is as shown below. Shown:zero2w-img351.png]]
<ol start="4" style="list[[File:zero2w-style-type: decimal;"><li>Then click the '''I2C_TEST''' button to open the i2c test interface</li></ol>img303.png]]
[[File:zero2w<span id="how-img370.png]]to-use-adb"></span>== How to use ADB ==
<ol startspan id="5" style="listuse-network-connection-styleadb-type: decimal;debugging"><li>The i2c test interface of wiringOP is shown in the figure below</li></olspan>=== Use network connection adb debugging ===
[[File{| class="wikitable" style="background-color:#ffffdc;width:zero2w800px;" |-img371| <big>'''Using network adb does not require a USB Typc C interface data cable to connect the computer and the development board. Instead, it communicates through the network, so first make sure that the development board's wired or wireless network is connected, and then obtain the IP address of the development board. Next To be used.png]]'''</big>|}
<ol start="6" style="list-style-type: decimal;"><li>Then click # Make sure the device node selection box in '''service.adb.tcp.port''' of the upper left corner Android system is set to select the i2c you want to test</li></ol>5555 port number
[[File:zero2w:{| class="wikitable" style="width:800px;" |-| apollo-img372p2:/ # '''getprop | grep &quot;adb.png]]tcp&quot;'''
<ol start="7" style="list-style-type[service.adb.tcp.port]: decimal;">[5555]<li>Then connect an i2c device to the 40pin i2c pin. Here we take the ds1307 rtc module as an example.</li></ol>|}
[[File<ol start="2" style="list-style-type: decimal;"><li>If '''service.adb.tcp.port''' is not set, you can use the following command in the serial port to set the port number of the network adb</li>{| class="wikitable" style="width:zero2w800px;" |-img178| apollo-p2:/ # '''setprop service.adb.tcp.png]]port 5555'''
<ol start="8" style="list-style-type: decimal;"><li><p>The i2c address of the ds1307 rtc module is 0x68. After connecting the lines, we can use the '''i2cdetect -y 1''' or '''i2cdetect -y 2''' command on the serial port command line to check whether the i2c address of the ds1307 rtc module can be scanned. If you can see the address 0x68, it means that the ds1307 rtc module is wired correctly.</p><p>apollo-p2:/ # '''i2cdetect -y 1'''</p><p>'''Or'''</p><p>apollo-p2:/ # '''i2cdetect -y 2stop adbd'''</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>
apollo-p2:/ # '''start adbd'''|}</ol><span idol start="pin3" style="list-pwmstyle-testtype: decimal;"><li>Install adb tool on Ubuntu PC</spanli>{| class="wikitable" style== 40pin PWM "width:800px;" |-| test@test ===:~$ '''sudo apt-get update'''
# As can be seen from the table below, the available pwm are pwm1, pwm2, pwm3 and pwm4. {| class="wikitable"|-| test@test:~$ '''GPIO serial numbersudo apt-get install -y adb'''| '''GPIO'''}| '''Function'''</ol>| '''pin'''<ol start="4" style="list-style-type: decimal;">|<li>Then connect network adb on Ubuntu PC</li>{| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO serial number'''class="wikitable" style="width:800px;"
|-
| style="text-align: left;"|| style="text-aligntest@test: left;"|| ~$ '''3adb connect 192.168.3V1.xxx:5555'''| '''1(Need to be modified to the IP address of the development board)'''|| <p>* daemon not running; starting now at tcp:5037</p> <p>* daemon started successfully</p> connected to 192.168.1.xxx:5555  test@test:~$ '''2adb devices''' List of devices attached 192.168.1.xxx:5555 device| '''5V'''}</ol>| <ol start="5" style="textlist-alignstyle-type: leftdecimal;"|><li>Then you can log in to the android system through adb shell on Ubuntu PC</li>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| test@test:~$ '''264adb shell''' apollo-p2:/ #| '''PI8'''}</ol>| '''TWI1<span id="use-data-cable-to-connect-adb-SDA'''debugging"></span> === Use data cable to connect adb debugging === | '''3'# Prepare a USB Type C interface data cable, plug one end of the USB interface into the USB interface of the computer, and plug one end of the USB Type C interface into the USB0 interface of the development board (see the description of the picture on the right below for the location of USB0). In this case, the development board is powered by the computer's USB interface, so please ensure that the computer's USB interface can provide the most sufficient power to drive the development board.|| '''4'''::[[File:zero2w-img304.png]] [[File:zero2w-img305.png]]| '''5V'''| <ol start="2" style="textlist-alignstyle-type: leftdecimal;"|><li>Install adb tool on Ubuntu PC</li>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| test@test:~$ '''263sudo apt-get update'''| '''PI7'''| test@test:~$ '''TWI1sudo apt-SCLget install -y adb'''| '''5'''}|</ol>| '''6'''| '''GND'''| <ol start="3" style="textlist-style-aligntype: leftdecimal;"|><li>Check whether the ADB device is recognized</li>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| test@test:~$ '''269adb devices'''| '''PI13'''| '''PWM3'''List of devices attached | '''7'''4c00146473c28651dd0 device|}| '''8'''</ol>| '''UART0_TX'''<ol start="4" style="list-style-type: decimal;">| '''PH0'''<li>Then you can log in to the android system through adb shell on Ubuntu PC</li>{| '''224'''class="wikitable" style="width:800px;"
|-
| styletest@test:~$ '''adb shell''' apollo-p2:/ $|}</ol><span id="textview-how-to-set-hdmi-display-align: left;resolution"|></span> == View how to set HDMI display resolution == | <ol style="textlist-style-aligntype: leftdecimal;"|>| <li><p>Enter first '''GNDSettings'''</p>| <p>[[File:zero2w-img306.png]]</p></li><li><p>Then select '''9Device Preferences'''</p>|<p>[[File:zero2w-img307.png]]</p></li>| <li><p>Then select '''10Display &amp; Sound'''</p><p>[[File:zero2w-img308.png]]</p></li>| <li><p>Then select '''UART0_RXAdvanced display settings'''</p><p>[[File:zero2w-img309.png]]</p></li>| <li><p>Then select '''PH1HDMI output mode'''</p>| '''225'''<p>[[File:zero2w-img310.png]]</p></li><li><p>Then you can see the list of resolutions supported by the monitor. At this time, clicking the corresponding option will switch to the corresponding resolution. Please note that different monitors may support different resolutions. If you connect it to a TV, you will generally see more resolution options than the picture below.</p><p>[[File:zero2w-img311.png]]</p></li><li><p>The HDMI output of the development board supports 4K display. When connected to a 4K TV, you can see the 4K resolution option.</p><p>[[File:zero2w-img312.png]]</p></li></ol> <span id="hdmi-to-vga-display-test-1"></span>=== HDMI to VGA display test === <ol style="list-style-type: decimal;"><li><p>First you need to prepare the following accessories</p><ol style="list-style-type: lower-alpha;"><li>HDMI to VGA converter</li> [[File:zero2w-img144.png]]</ol>|<ol start="2" style="list-style-type: lower-alpha;"><li>A VGA cable and a Mini HDMI male to HDMI female adapter</li> | '''226'''[[File:zero2w-img145.png]] [[File:zero2w-img146.png]]| '''PH2'''</ol>| '''UART5_TX'''<ol start="3" style="list-style-type: lower-alpha;">| '''11'''<li>A monitor or TV that supports VGA interface</li></ol>|</li></ol>| '''12'''| <ol start="2" style="textlist-style-aligntype: leftdecimal;"|><li>HDMI to VGA display test is as follows</li> [[File:zero2w-img313.png]]| '''PI1'''{| '''257'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big>'''227When using HDMI to VGA display, the development board and the Android system of the development board do not need to make any settings. You only need the Mini HDMI interface of the development board to display normally. So if there is a problem with the test, please check whether there is a problem with the HDMI to VGA converter, VGA cable and monitor.'''</big>| '''PH3'''}</ol><span id="wi-fi-connection-method"></span> == WI-FI connection method ==| '''UART5_RX'''| # Choose first '''13Settings'''|| '''14'''::[[File:zero2w-img306.png]]| '''GND'''| style<ol start="text-align: left;2"|| style="textlist-style-aligntype: leftdecimal;"|>|-| <li>Then select '''261Network &amp; Internet'''</li>| '''PI5'''| '''UART2_TX'''[[File:zero2w-img314.png]]| '''15'''</ol>|<ol start="3" style="list-style-type: decimal;">| '''16'''<li>Then turn on WI-FI</li>| '''PWM4'''| '''PI14'''| '''270'''[[File:zero2w-img315.png]]|-</ol>| style<ol start="text-align: left;4"|| style="textlist-style-aligntype: leftdecimal;"|>| <li>After turning on WI-FI, you can see the searched signals under '''3.3VAvailable networks'''.</li>| '''17'''|[[File:zero2w-img316.png]]| '''18'''</ol>| <ol start="5" style="textlist-alignstyle-type: leftdecimal;"|>| '''PH4'''| '''228'''|<li>After selecting the WI-FI you want to connect to, the password input interface shown below will pop up.</li>| '''231'''| '''PH7'''<div class="figure">| '''SPI1_MOSI'''| '''19'''[[File:zero2w-img317.png]]|| '''20'''</div></ol>| '''GND'''| <ol start="6" style="textlist-alignstyle-type: leftdecimal;"|><li>Then use the keyboard to enter the password corresponding to the WI-FI, and then use the mouse to click the Enter button on the virtual keyboard to start connecting to the WI-FI.</li> <div class="figure"> [[File:zero2w-img318.png]] </div></ol>| <ol start="7" style="textlist-alignstyle-type: leftdecimal;"|>|<li>The display after successful WI-FI connection is as shown below</li>| '''232'''| '''PH8'''| '''SPI1_MISO'''[[File:zero2w-img319.png]]| '''21'''</ol>|<span id="how-to-use-wi-fi-hotspot"></span>| '''22'''| '''UART2_RX'''| '''PI6'''| '''262'''|== How to use WI-FI hotspot ==| '''230'''| '''PH6'''# First, please make sure that the Ethernet port is connected to the network cable and can access the Internet normally.| # Then select '''SPI1_CLKSettings'''| '''23'''|::[[File:zero2w-img306.png]]| '''24'''| '''SPI1_CS0'''<ol start="3" style="list-style-type: decimal;">| <li>Then select '''PH5Network &amp; Internet'''</li>| '''229'''|[[File:zero2w-img314.png]]</ol>| style<ol start="text-align: left;4"|| style="textlist-alignstyle-type: leftdecimal;"|>| <li>Then select '''GNDWIFI hotspot'''</li>| '''25'''|[[File:zero2w-img320.png]]| '''26'''</ol>| '''SPI1_CS1'''<ol start="5" style="list-style-type: decimal;">| <li>Then open '''PH9Hotspot Enable'''. You can also see the name and password of the generated hotspot in the picture below. Remember them and use them when connecting to the hotspot (if you need to modify the name and password of the hotspot, you need to close Hotspot Enable first. Then you can modify it)</li>| '''233'''|[[File:zero2w-img321.png]]| '''266'''</ol>| '''PI10'''| '''TWI2<ol start="6" style="list-style-SDA'''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 ('''27here AndroidAP_7132'''|| ) shown under the '''28Hotspot name'''| '''TWI2in the picture above in the WI-SCLFI list searched by the mobile phone. Then you can click AndroidAP_7132 to connect to the hotspot. The password can be seen under the '''| '''PI9Hotspot password'''in the picture above.</li>| '''265'''|[[File:zero2w-img322.png]]| '''256'''</ol>| '''PI0'''| <ol start="7" style="textlist-style-aligntype: leftdecimal;"|>| <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 '''29WI-FI Hotspot'''of the development board can be used normally.</li>|| '''30'''[[File:zero2w-img323.png]]| '''GND'''</ol>| style<span id="texthow-to-check-the-ip-address-of-the-ethernet-align: left;port"|></span> | style="text-align= 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]]| '''271'''| '''PI15'''| <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 '''31Settings'''</p>|<p>[[File:zero2w-img324.png]]</p></li>| <li><p>Then select '''32Network &amp; Internet'''</p>| '''PWM1''<p>[[File:zero2w-img325.png]]</p></li><li><p>Then you can see the IP address of the development board's wired network port at the location shown in the picture below.</p>| '''PI11'''<p>[[File:zero2w-img326.png]]</p></li></ol>| '''267'''|<span id="bluetooth-connection-method"></span>| '''268'''| '''PI12'''== Bluetooth connection method ==| '''PWM2'''| # Choose first '''33Settings'''|| '''34'''::[[File:zero2w-img306.png]]| '''GND'''| style<ol start="text-align: left;2"|| style="textlist-style-aligntype: leftdecimal;"||->| <li>Then select '''258Bluetooth'''</li>| '''PI2'''| [[File:zero2w-img327.png]]</ol><ol start="3" style="textlist-style-aligntype: leftdecimal;"|>| <li>Then Open '''35Bluetooth Enable'''</li> |[[File:zero2w-img328.png]]| '''36'''</ol>| <ol start="4" style="textlist-alignstyle-type: leftdecimal;"|>| <li>Then click '''PC12Pair new device'''to start scanning for surrounding Bluetooth devices</li>| '''76'''|[[File:zero2w-img329.png]]| '''272'''</ol>| '''PI16'''| style<ol start="text-align: left;5"|| '''37'''|| '''38'''| style="textlist-alignstyle-type: leftdecimal;"|>| <li>The searched Bluetooth devices will be displayed under '''PI4Available devices'''</li>| '''260'''|[[File:zero2w-img330.png]]| style</ol><ol start="text-align: left;6"|| style="textlist-style-aligntype: leftdecimal;"|>| <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 '''GNDPair'''option</li>| '''39'''|[[File:zero2w-img331.png]]| '''40'''</ol>| <ol start="7" style="textlist-alignstyle-type: leftdecimal;"|>| '''PI3'''| '''259'''|}<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="28" style="list-style-type: decimal;"><li>First click After pairing is completed, open '''Paired devices''' and you will see the wiringOP icon to open wiringOP APPpaired Bluetooth devices.</li></ol>
[[File:zero2w-img351img333.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 '''Accept''' to start receiving the pictures sent by the mobile phone.</li>
[[File:zero2w-img334.png]]</ol><ol start="310" style="list-style-type: decimal;"><li>Then click Pictures received by the Bluetooth system of the development board Android system can be viewed in '''PWM_TESTReceived files''' button on the main interface of wiringOP to enter the PWM test interface.</li></ol>
[[File:zero2w-img380img335.png]]</ol><span id="how-to-set-usb0-to-host-mode-1"></span>
<ol start="4" style="list-style-type: decimal;"><li>The PWM test interface is as follows</li></ol>How to set USB0 to HOST mode ==
<div class="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-img381img160.png]]
</div><ol start="5" style="list-style-type: decimal;"><li>Then USB0 of the Android12 TV system released by Orange Pi is set which PWM you want to use in the Channel. The Device mode by default , so when there is PWM1. If you want no need to use USB0 Device mode (ADB function needs to set ensure that USB0 is in Device mode), it is recommended to PWM2use USB0 for power supply, just enter 2 in the Channel. PWM3 and PWM4 and so onthat USB1 can be directly used to connect USB devices .</li></ol>
[[FileIf you want to use USB0 to connect USB devices, you need to set USB0 to HOST mode. The method is as follows:zero2w-img382.png]]
<ol start="6" style="list-style-type: decimallower-alpha;"><li>Then you can Run the following command to set the PWM period. The default configuration is USB0 to HOST mode:</li>{| class="wikitable" style="width:800px;" |-| apollo-p2:/ # '''50000ns'''. The converted PWM frequency is ''cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_host'20KHz'''</li></ol>
[[File:zero2w-img383.png]]host_chose finished!
apollo-p2:/ #|}</ol><ol start="72" style="list-style-type: decimallower-alpha;"><li>Then click Run the following command to switch back to Device mode</li>{| class="wikitable" style="width:800px;" |-| apollo-p2:/ # '''EXPORTcat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_device'''button to export PWM</li></ol>
[[File:zero2w-img384.png]]device_chose finished!
apollo-p2:/ #|}</ol><ol start="83" style="list-style-type: decimallower-alpha;"><li>Then drag the progress bar below The command to change view the PWM duty cycle, and then check current mode of USB0 is</li>{| class="wikitable" style="width:800px;" |-| apollo-p2:/ # '''Enablecat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/otg_role''' to output the PWM waveform.</li></ol>
[[File:zero2wusb_host|}</ol><span id="how-img385.png]]to-use-usb-camera"></span>
<ol start="9" style="list-style-type: decimal;"><li>Then How to use an oscilloscope to measure the corresponding pins in the 40pin development board and you can see the following waveform.</li></ol>USB camera ==
[[File:zero2w-img386.png]]# 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
<span id::{| class="howwikitable" style="width:800px;" |-to-compile-android-12-source-code"><| console:/ # '''ls /dev/span>video0'''
= '''How to compile Android 12 source code''' =/dev/video0|}
<span idol start="download-the3" style="list-sourcestyle-code-of-android-12type: decimal;"><li><p>Then make sure that the adb connection between the Ubuntu PC and the development board is normal. For how to use adb, please refer to the instructions in the section &quot;[[Orange Pi Zero 2W#How to use ADB|'''How to use ADB''']]&quot;.</spanp></li>== <li><p>Download the source code of Android 12 ==USB camera test APP from the '''official tool''' on the development board information download page</p></li>
<ol stylediv class="list-style-type: decimal;figure"><li><p>First download the compressed package of the Android 12 source code and the compressed package of the files modified by Orange Pi Zero2w from Google Cloud Drive</p><ol style="list-style-type: lower-alpha;"><li>Google Cloud Drive</li></ol></li></ol>
[[File:zero2w-img387img336.png]]
<ol start="2" style/div><div class="list-style-type: decimal;figure"><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></ol>
test@test[[File:~$ '''md5sum zero2w-c H618-Android12-Src.tar.gzimg337.md5sum'''png]]
H618</div></ol><ol start="5" style="list-Android12style-Srctype: decimal;"><li>Then use the adb command to install the USB camera test APP into the Android system.tarOf course, you can also use a USB disk copy to install it.gzaa</li>{| class="wikitable" style="width: 800px;" |-| test@test:~$ '''OKadb install usbcamera.apk'''|}H618</ol><ol start="6" style="list-Android12style-Srctype: decimal;"><li>After installation, you can see the startup icon of the USB camera on the Android desktop.tar.gzab: '''OK'''</li>
[[File:zero2w-img338.png]]</ol><ol start="7" style="list-style-type: decimal;"><li>Then double-click to open the USB camera APP and you can see the output video of the USB camera.....</li></ol>
<ol startspan id="3" style="listandroid-system-styleroot-type: decimal;description"><li>Then you need to merge multiple compressed files into one, and then extract the Android source code. The command looks like this:</li></olspan>
test@test:~$ '''cat H618-Android12-Src.tar.gza* &gt; H618-Android12-Src.tar.gz'''== Android system ROOT description ==
test@test{| class="wikitable" style="background-color:#ffffdc;width:~$ 800px;" |-| <big>'''tar -xvf H618-Android12-Src.tarThe Android system released by Orange Pi has been ROOT and can be tested using the following method.gz'''</big>|}
<ol start="4" style="list-style-type: decimal;"><li>Then unzip # Download from the compressed package of '''official tool''' on the files modified by Orange Pi Zero2w</li></ol>development board data download page '''rootcheck.apk'''
test@test:~$ '''tar zxf opizero2w_android12_patches.tar.gz'''<div class="figure">
test@test:~$ '''ls''':[[File:zero2w-img336.png]]
'''opizero2w_android12_patches''' opizero2w_android12_patches.tar.gz</div><div class="figure">
<ol start="5" style="list::[[File:zero2w-style-type: decimal;"><li>Then copy the files modified by Orange Pi Zero2w to the Android source code</li></ol>img339.png]]
</div><ol start="2" style="list-style-type: decimal;"><li><p>Then make sure that the adb connection between the Ubuntu PC and the development board is normal. For how to use adb, please refer to the instructions in the section &quot;[[Orange Pi Zero 2W#How to use ADB|'''How to use ADB''']]&quot;.</p></li><li><p>Then use the adb command to install rootcheck.apk into the Android system. Of course, you can also use a USB disk copy to install it.</p></li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''cp -rf opizero2w_android12_patchesadb install rootcheck.apk'''|}</* H618ol><ol start="4" style="list-Android12style-Srctype: decimal;"><li>After installation, you can see the startup icon of the ROOT test tool on the Android desktop.</'''li>
[[File:zero2w-img340.png]]<span id/ol><ol start="compile-the5" style="list-sourcestyle-code-of-android-12type: decimal;"><li>The display interface after opening the '''ROOT test tool''' for the first time is as shown below</spanli>== Compile the source code of Android 12 ==
[[File:zero2w-img341.png]]</ol><ol start="6" style="list-style-type: decimal;"><li>Then you can click '''CHECK NOW'''Android12 is compiled on an x86_64 computer with Ubuntu 22.04 installed. Other versions to start checking the ROOT status of Ubuntu the Android system package dependencies may have some differences. The image download address of After the check is completed, the Ubuntu 22.04 amd64 version display is as follows:'''. You can see that the Android system has obtained ROOT permissions.</li>
[https[File://repozero2w-img342.huaweicloud.compng]]</ubuntuol><span id="how-to-use-miracastreceiver-to-cast-releases/22.04/ubuntuthe-22.04.2mobile-desktopphone-amd64.iso '''https://repo.huaweicloud.com/ubuntuscreen-releases/22.04/ubuntuto-22.04.2the-desktopdevelopment-amd64.iso''']board"></span>
'''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, == How to use MiracastReceiver to cast the better.'''mobile phone screen to the development board ==
# <ol style="list-style-type: decimal;"><li><p>First install , please make sure that both the development board and the software packages needed mobile phone are connected to compile Android12 source codethe same WIFI hotspot. For the method of connecting the development board to WIFI, please refer to [[Orange Pi Zero 2W#WI-FI connection method|'''the instructions in the WI-FI connection method.''']]</p></li><li><p>Then open the '''MiracastReceiver'''application in the Android 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">
test@test[[File:~$ '''sudo aptzero2w-get update'''img344.png]]
test@test:~$ </div></li><li><p>Then find the screen mirroring function in the phone settings. Here we take '''Xiaomi 12S Pro mobile phone'''sudo aptas 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-get install 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-y git gnupg flex bison gperf build-essential \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: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>
'''zip curl zlib1g<span id="method-dev gccof-multilib g++turning-multilib libc6on-devand-i386 \'''off-the-machine-through-buttons-or-infrared-remote-control"></span>
'''lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev ccache \'''== Method of turning on and off the machine through buttons or infrared remote control ==
'''libgl1-mesa-dev libxml2-utils xsltproc unzip u-boot-tools python-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-python3 \'''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.
'''libssl[[File:zero2w-dev libncurses5 clang gawk'''img107.png]]
<ol start="2" style="list-style-type: decimal;"><li><p>Then compile The location of the power button on the code 24pin expansion board is as shown in the longan folder, which mainly contains u-boot and linux kernel</p><ol style="list-style-typefigure below: lower-alpha;"><li>First run '''./build.sh config''' to set compilation options</li></ol></li></ol>
test@test[[File:~$ '''cd H618zero2w-Android12-Src/longan'''img269.png]]
test@testThe location of the infrared remote control power button is as follows:~/H618-Android12-Src/longan$ '''./build.sh config'''
Welcome to mkscript setup progress[[File:zero2w-img349.png]]
All available platform: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 '''OK''' to shut down the Android system.
0[[File:zero2w-img350. androidpng]]
1After shutting down, press and hold the power button or the power button on the infrared remote control again to turn it on. linux
Choice [android]: '''0'''<span id="pin-interface-gpio-uart-spi-test"></span>== 40pin interface GPIO, UART, SPI test ==
All available ic{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note: The pin header on the 40pin interface is not soldered by default, and you need to solder it yourself before it can be used.'''</big>|}
0. h618<span id="pin-gpio-port-test-method"></span>=== 40pin GPIO port test method ===
Choice [h618]: '''0'''# First open wiringOP APP on the desktop
All available board::[[File:zero2w-img351.png]]
0. ft<ol start="2" style="list-style-type: decimal;"><li>Then click the '''GPIO_TEST''' button to open the GPIO test interface</li>
1[[File:zero2w-img352. p1png]]</ol><ol start="3" style="list-style-type: decimal;"><li>The GPIO test interface is as shown in the figure below. The two rows of '''CheckBox''' buttons on the left have a one-to-one correspondence with the 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>
2[[File:zero2w-img353. p2png]]</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>
3. p7<div class="figure">
4[[File:zero2w-img354. p7lpng]]
</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. perf1The following takes pin 12 - corresponding to GPIO PI01 - corresponding to wPi serial number 6 - as an example to demonstrate how to set the high and low levels of the GPIO port. First click the '''CheckBox''' button corresponding to pin 12. When the button is selected, pin 12 will be set to high level. After setting, you can use a multimeter to measure the value of the voltage of the pin. If it is '''3.3v''', it means the setting High level success.</li>
[[File:zero2w-img355.png]]</ol><ol start="6" style="list-style-type: decimal;"><li>Then click the '''GPIO READALL''' button and you can see that the current pin 12 mode is '''OUT''' and the pin level is high level. perf2</li>
[[File:zero2w-img356.png]]</ol><ol start="7" style="list-style-type: decimal;"><li>Click the '''CheckBox''' button in the picture below again to uncheck it, and pin 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. perf3</li>
[[File:zero2w-img357.png]]</ol><ol start="8" style="list-style-type: decimal;"><li>Then click the '''GPIO READALL''' button and you can see that the current pin 12 mode is OUT and the pin level is low level. qa</li>
Choice [p2[File:zero2w-img358.png]]: '''2'''</ol><span id="pin-uart-test-method"></span>
All available flash:=== 40pin UART test method ===
0# As can be seen from the table below, the default uarts available in the Android12 TV system are uart2 and uart5. Please note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial port.
1<div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''GPIO NO. nor'''| '''GPIO'''| '''Function'''Choice [default]: | '''0Pin'''|-All available kern_ver| style="text-align:left;"|| style="text-align: left;"|0| '''3. linux3V'''| '''1'''|-5.4| '''264'''| '''PI8'''Choice [linux| '''TWI1-5.4]: SDA'''| ''0'3'''|-All available arch:| '''263'''| '''PI7'''0. arm| '''TWI1-SCL'''| '''5'''1. arm64|-| '''269'''Choice [arm64]: | '''1PI13'''| '''PWM3'''| '''......7'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''*** Default configuration is based on | '''9''sun50iw9p1smp_h618_android_defconfig'|-| '''<span style="color:#FF0000">226</span>'''| '''<span style="color:#FF0000">PH2</span>'''| '''<span style="color:# configuration written to .configFF0000">UART5_TX</span>'''| '''<span style="color:#FF0000">11</span>'''|-make[1]| '''<span style="color: Leaving directory #FF0000">227</span>'''| '''<span style="color:#FF0000">PH3</homespan>'''| '''<span style="color:#FF0000">UART5_RX</testspan>'''| '''<span style="color:#FF0000">13</H618span>'''|-Android12-Src| '''<span style="color:#FF0000">261</longanspan>'''| '''<span style="color:#FF0000">PI5</outspan>'''| '''<span style="color:#FF0000">UART2_TX</kernelspan>'''| '''<span style="color:#FF0000">15</buildspan>'''|-| 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'''make| '''PI15'''| style="text-align: Leaving directory left;"|| '''31'''|-| '''268'''| '''PI12'''| '''PWM2'''| '''33'''/home/test/H618|-| '''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-Android12right: 20px;text-Src/longan/kernel/linuxalign: center;"|-5| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''4'''| '''5V'''| style="text-align: left;"|INFO| style="text-align: clean buildserverleft;"||-INFO| '''6'''| '''GND'''| style="text-align: prepare_buildserverleft;"|| style="text-align: left;"||-| '''8'''| '''UART0_TX'''| '''PH0'''| '''224'''|-| '''10'''| '''UART0_RX'''| '''PH1'''| '''225'''|-| '''12'''| style="text-align: left;"|| '''PI1'''| '''257'''|-<ol start| '''14'''| '''GND'''| style="2text-align: left;" || style="listtext-align: left;"||-| '''16'''| '''PWM4'''| '''PI14'''| '''270'''|-| '''18'''| style="text-align: left;"|| '''PH4'''| '''228'''|-type| '''20'''| '''GND'''| style="text-align: lowerleft;"|| style="text-alphaalign: left;"||-| '''<span style="color:#FF0000">22</span>'''| '''<span style="color:#FF0000">UART2_RX<li/span>Then run the '''.| '''<span style="color:#FF0000">PI6</build.shspan>'''| ''' script to start compilation.</lispan style="color:#FF0000">262</olspan>'''|-| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''28'''| '''TWI2-SCL'''| '''PI9'''| '''265'''|-| '''30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''32'''| '''PWM1'''| '''PI11'''| '''267'''|-| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''36'''| style="text-align: left;"|| '''PC12'''| '''76'''|-test@test| '''38'''| style="text-align:~/H618left;"|| '''PI4'''| '''260'''|-Android12| '''40'''| style="text-Src/longan$ align: left;"|| '''PI3'''| '''./build.sh259'''|}</div> <ol start="32" style="list-style-type: lower-alphadecimal;"><li>After compilation The device node corresponding to uart2 is completed'''/dev/ttyAS2''', you will see and the following outputdevice node corresponding to uart5 is'''/dev/ttyAS5'''</li></ol>{| class="wikitable" style="width:800px;" sun50iw9p1 compile Kernel successful|-| INFO<p>apollo-p2: Prepare toolchain .../ # ls /dev/ttyAS*</p><p>/dev/ttyAS0 &nbsp;&nbsp;&nbsp;&nbsp; /dev/ttyAS1 &nbsp;&nbsp;&nbsp;&nbsp; '''......<span style="color:#FF0000">/dev/ttyAS2 &nbsp;&nbsp;&nbsp;&nbsp; /dev/ttyAS5</span>'''</p>|}INFO: build kernel OK.</ol> INFO<ol start="3" style="list-style-type: build rootfs ...decimal;"> INFO: skip make rootfs for android<li>First open wiringOP APP on the desktop</li>
INFO[[File: zero2w-img351.png]]</ol><ol start="4" style="list-style--------------------------------------type: decimal;"><li>Then click the '''UART_TEST'''button to open the UART test interface</li>
INFO[[File: build lichee OKzero2w-img359.png]]</ol><ol start="5" style="list-style-type: decimal;"><li>The serial port test interface of wiringOP is as shown in the figure below</li>
INFO[[File: zero2w----------------------------------------img360.png]]</ol><ol start="36" style="list-style-type: decimal;"><li><p>Then use select the following command to compile the Android source code and generate '''/dev/ttyAS2''' or'''/dev/ttyAS5''' node in the final Android imageselection box</lip></olp>[[File:zero2w-img361.png]]</p></litest@test:~$ <li><p>Enter the baud rate you want to set in the edit box, and then click the '''cd H618-Android12-SrcOPEN''' test@test:~/H618-Android12-Src$ button to open the uart node. After the opening is successful, the '''OPEN'''source build/envsetup.shbutton becomes unselectable, and the ''' test@test:~/H618-Android12-Src$ CLOSE'''lunch apollo_p2-userdebugbutton and ''' test@test:~/H618-Android12-Src$ '''make -j8SEND'''button become selectable.</p></li> test@test[[File:~/H618zero2w-Android12-Src$ '''pack'''img362.png]]</ol><ol start="48" style="list-style-type: decimal;"><li><p>The storage path Then use Dupont wire to short the rx and tx pins of the Android image generated by compilation is:uart</p></li><li><p>Then you can enter a paragraph of characters in the send edit box below and click the '''longan/out/h618_android12_p2_uart0.imgSEND'''button to start sending.</p></li> [[File:zero2w-img363.png]]</ol> <span idol start="10" style="appendixlist-style-type: decimal;"><li>If everything is normal, the received string will be displayed in the receiving box</spanli= '''Appendix''' =[[File:zero2w-img364.png]]</ol><span id="userpin-manualspi-updatetest-historymethod"></span> ===40pin SPI test method = User manual update history == # As can be seen from the table below, the spi available for the 40pin interface is spi1, and there are two chip select pins cs0 and cs1 <div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''GPIO NO.'''| '''GPIO'''| '''Function'''| '''Pin'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''1'''|-| '''264'''| '''PI8'''| '''TWI1-SDA'''| '''3'''|-| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|-| '''269'''| '''PI13'''| '''PWM3'''| '''7'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''9'''|-| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-| '''261'''| '''PI5'''| '''UART2_TX'''| '''15'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''17'''|-| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|-| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''25'''|-| '''266'''| '''PI10'''| '''TWI2-SDA'''| '''27'''|-| '''256'''| '''PI0'''| style="text-align: left;"|| '''29'''|-| '''271'''| '''PI15'''| style="text-align: left;"|| '''31'''|-| '''268'''| '''PI12'''| '''PWM2'''| '''33'''|-| '''258'''| '''PI2'''| style="text-align: left;"|| '''35'''|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''6'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''8'''| '''UART0_TX'''| '''PH0'''| '''224'''|-| '''10'''| '''UART0_RX'''| '''PH1'''| '''225'''|-| '''12'''| style="text-align: left;"|| '''PI1'''| '''257'''|-| '''14'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''16'''| '''PWM4'''| '''PI14'''| '''270'''|-| '''18'''| style="text-align: left;"|| '''PH4'''| '''228'''|-| '''20'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''22'''| '''UART2_RX'''| '''PI6'''| '''262'''|-| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''28'''| '''TWI2-SCL'''| '''PI9'''| '''265'''|-| '''30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''32'''| '''PWM1'''| '''PI11'''| '''267'''|-| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''36'''| style="text-align: left;"|| '''PC12'''| '''76'''|}</div> <ol start="2" style="list-style-type: decimal;"><li>The device node corresponding to SPI1 CS0 is '''/dev/spidev1.0''', and the device node corresponding to SPI1 CS1 is '''/dev/spidev1.1'''</li>{| class="wikitable" style="width:800px;" |-| apollo-p2:/ # '''ls /dev/spidev1.*''' '''<span style="color:#FF0000">/dev/spidev1.0 &nbsp;&nbsp;&nbsp;&nbsp; /dev/spidev1.1</span>'''|}</ol><ol start="3" style="list-style-type: decimal;"><li>Here is a demonstration to test the SPI1 interface through the '''w25qxx''' module. First, connect the w25qxx module to the SPI1 interface.</li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''It doesn't matter if there is no w25qxx module, because there is a SPIFlash on the development board connected to SPI0, and the configuration of SPI0 is also turned on by default in Android, so we can also directly use the onboard SPIFlash for testing.'''</big>|}</ol><ol start="4" style="list-style-type: decimal;"><li>Then open wiringOP APP on the desktop</li> [[File:zero2w-img351.png]]</ol><ol start="5" style="list-style-type: decimal;"><li>Then click the '''SPI_TEST''' button to open the SPI test interface</li> [[File:zero2w-img365.png]]</ol><ol start="6" style="list-style-type: decimal;"><li><p>Then select the spi device node in the upper left corner. If you test the onboard SPIFlash directly, just keep the default '''/dev/spidev0.0'''. If the '''w25qxx''' module is connected to the 40pin spi1 cs0, then please select'''/dev/spidev1.0''', if the w25qxx module is connected to the 40pin spi1 cs1, then please select '''/dev/spidev1.1'''</p><div class="figure"> [[File:zero2w-img366.png]] </div></li><li><p>Then click the '''OPEN''' button to initialize the SPI</p></li> [[File:zero2w-img367.png]]</ol><ol start="8" style="list-style-type: decimal;"><li>Then fill in the bytes that need to be sent, such as reading the ID information of the onboard SPIFlash, filling in the address 0x9f in data[0], and then click the '''TRANSFER''' button</li> [[File:zero2w-img368.png]]</ol><ol start="9" style="list-style-type: decimal;"><li>Finally, the APP will display the read ID information of the onboard SPI Flash.</li> [[File:zero2w-img369.png]]</ol><ol start="10" style="list-style-type: decimal;"><li>If the w25qxx module connected to 40pin SPI1 is read, the ID information of the onboard SPI Flash is also similar.</li></ol> <span id="pin-i2c-test-method"></span> === 40pin I2C test method === # As can be seen from the table below, the Android12 TV system has i2c1 and i2c2 turned on by default. <div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''GPIO NO.'''| '''GPIO'''| '''Function'''| '''Pin'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''1'''|-| '''<span style="color:#FF0000">264</span>'''| '''<span style="color:#FF0000">PI8</span>'''| '''<span style="color:#FF0000">TWI1-SDA</span>'''| '''<span style="color:#FF0000">3</span>'''|-| '''<span style="color:#FF0000">263</span>'''| '''<span style="color:#FF0000">PI7</span>'''| '''<span style="color:#FF0000">TWI1-SCL</span>'''| '''<span style="color:#FF0000">5</span>'''|-| '''269'''| '''PI13'''| '''PWM3'''| '''7'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''9'''|-| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-| '''261'''| '''PI5'''| '''UART2_TX'''| '''15'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''17'''|-| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|-| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''25'''|-| '''<span style="color:#FF0000">266</span>'''| '''<span style="color:#FF0000">PI10</span>'''| '''<span style="color:#FF0000">TWI2-SDA</span>'''| '''<span style="color:#FF0000">27</span>'''|-| '''256'''| '''PI0'''| style="text-align: left;"|| '''29'''|-| '''271'''| '''PI15'''| style="text-align: left;"|| '''31'''|-| '''268'''| '''PI12'''| '''PWM2'''| '''33'''|-| '''258'''| '''PI2'''| style="text-align: left;"|| '''35'''|-| '''272'''| '''PI16'''| style="text-align: left;"|| '''37'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''39'''|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''6'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''8'''| '''UART0_TX'''| '''PH0'''| '''224'''|-| '''10'''| '''UART0_RX'''| '''PH1'''| '''225'''|-| '''12'''| style="text-align: left;"|| '''PI1'''| '''257'''|-| '''14'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''16'''| '''PWM4'''| '''PI14'''| '''270'''|-| '''18'''| style="text-align: left;"|| '''PH4'''| '''228'''|-| '''20'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''22'''| '''UART2_RX'''| '''PI6'''| '''262'''|-| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''<span style="color:#FF0000">28</span>'''| '''<span style="color:#FF0000">TWI2-SCL</span>'''| '''<span style="color:#FF0000">PI9</span>'''| '''<span style="color:#FF0000">265</span>'''|-| '''30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''32'''| '''PWM1'''| '''PI11'''| '''267'''|-| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''36'''| style="text-align: left;"|| '''PC12'''| '''76'''|-| '''38'''| style="text-align: left;"|| '''PI4'''| '''260'''|-| '''40'''| style="text-align: left;"|| '''PI3'''| '''259'''|}</div> <ol start="2" style="list-style-type: decimal;"><li>The device node corresponding to i2c1 is '''/dev/i2c-1''', and the device node corresponding to i2c2 is '''/dev/i2c-2'''</li>{| class="wikitable" style="width:800px;" |-| apollo-p2:/ # '''ls /dev/i2c-*''' '''<span style="color:#FF0000">/dev/i2c-1 &nbsp;&nbsp;&nbsp;&nbsp; /dev/i2c-2</span>''' &nbsp;&nbsp;&nbsp;&nbsp; /dev/i2c-5|}</ol><ol start="3" style="list-style-type: decimal;"><li>First open wiringOP APP on the desktop</li> [[File:zero2w-img351.png]]</ol><ol start="4" style="list-style-type: decimal;"><li>Then click the '''I2C_TEST''' button to open the i2c test interface</li> [[File:zero2w-img370.png]]</ol><ol start="5" style="list-style-type: decimal;"><li>The i2c test interface of wiringOP is shown in the figure below</li> [[File:zero2w-img371.png]]</ol><ol start="6" style="list-style-type: decimal;"><li>Then click the device node selection box in the upper left corner to select the i2c you want to test</li> [[File:zero2w-img372.png]]</ol><ol start="7" style="list-style-type: decimal;"><li>Then connect an i2c device to the 40pin i2c pin. Here we take the ds1307 rtc module as an example.</li> [[File:zero2w-img178.png]]</ol><ol start="8" style="list-style-type: decimal;"><li><p>The i2c address of the ds1307 rtc module is 0x68. After connecting the lines, we can use the '''i2cdetect -y 1''' or '''i2cdetect -y 2''' command on the serial port command line to check whether the i2c address of the ds1307 rtc module can be scanned. If you can see the address 0x68, it means that the ds1307 rtc module is wired correctly.</p>{| class="wikitable" style="width:800px;" |-| <p>apollo-p2:/ # '''i2cdetect -y 1'''</p><p>'''Or'''</p><p>apollo-p2:/ # '''i2cdetect -y 2'''</p>|}<p>[[File:zero2w-img373.png]]</p></li><li><p>Then set the i2c address to 0x68 in wiringOP, and then click the '''OPEN''' button to open i2c</p><p>[[File:zero2w-img374.png]]</p></li><li><p>After clicking the '''OPEN''' button to open i2c, the display is as follows</p><p>[[File:zero2w-img375.png]]</p></li><li><p>Then we test writing a value to the register of the rtc module, for example, writing 0x55 to the 0x1c address</p><ol style="list-style-type: lower-alpha;"><li><p>We first set the address of the register to be written to 0x1c</p><p>[[File:zero2w-img376.png]]</p></li><li><p>Then set the value to be written to 0x55</p><p>[[File:zero2w-img377.png]]</p></li><li><p>Then click the '''WRITE BYTE''' button to perform the writing action</p><p>[[File:zero2w-img378.png]]</p></li></ol></li><li><p>Then click the '''READ BYTE''' button to read the value of the 0x1c register. If it displays 0x55, it means that the i2c read and write test has passed.</p><p>[[File:zero2w-img379.png]]</p></li></ol> <span id="pin-pwm-test"></span> === 40pin PWM test === # As can be seen from the table below, the available pwm are pwm1, pwm2, pwm3 and pwm4. <div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''GPIO NO.'''| '''GPIO'''| '''Function'''| '''Pin'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''1'''|-| '''264'''| '''PI8'''| '''TWI1-SDA'''| '''3'''|-| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|-| '''<span style="color:#FF0000">269</span>'''| '''<span style="color:#FF0000">PI13</span>'''| '''<span style="color:#FF0000">PWM3</span>'''| '''<span style="color:#FF0000">7</span>'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''9'''|-| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-| '''261'''| '''PI5'''| '''UART2_TX'''| '''15'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''17'''|-| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|-| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''25'''|-| '''266'''| '''PI10'''| '''TWI2-SDA'''| '''27'''|-| '''256'''| '''PI0'''| style="text-align: left;"|| '''29'''|-| '''271'''| '''PI15'''| style="text-align: left;"|| '''31'''|-| '''<span style="color:#FF0000">268</span>'''| '''<span style="color:#FF0000">PI12</span>'''| '''<span style="color:#FF0000">PWM2</span>'''| '''<span style="color:#FF0000">33</span>'''|-| '''258'''| '''PI2'''| style="text-align: left;"|| '''35'''|-| '''272'''| '''PI16'''| style="text-align: left;"|| '''37'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''39'''|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''6'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''8'''| '''UART0_TX'''| '''PH0'''| '''224'''|-| '''10'''| '''UART0_RX'''| '''PH1'''| '''225'''|-| '''12'''| style="text-align: left;"|| '''PI1'''| '''257'''|-| '''14'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''<span style="color:#FF0000">16</span>'''| '''<span style="color:#FF0000">PWM4</span>'''| '''<span style="color:#FF0000">PI14</span>'''| '''<span style="color:#FF0000">270</span>'''|-| '''18'''| style="text-align: left;"|| '''PH4'''| '''228'''|-| '''20'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''22'''| '''UART2_RX'''| '''PI6'''| '''262'''|-| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''28'''| '''TWI2-SCL'''| '''PI9'''| '''265'''|-| '''30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''<span style="color:#FF0000">32</span>'''| '''<span style="color:#FF0000">PWM1</span>'''| '''<span style="color:#FF0000">PI11</span>'''| '''<span style="color:#FF0000">267</span>'''|-| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''36'''| style="text-align: left;"|| '''PC12'''| '''76'''|-| '''38'''| style="text-align: left;"|| '''PI4'''| '''260'''|-| '''40'''| style="text-align: left;"|| '''PI3'''| '''259'''|}</div> <ol start="2" style="list-style-type: decimal;"><li>First click the wiringOP icon to open wiringOP APP</li> [[File:zero2w-img351.png]]</ol><ol start="3" style="list-style-type: decimal;"><li>Then click the '''PWM_TEST''' button on the main interface of wiringOP to enter the PWM test interface</li> [[File:zero2w-img380.png]]</ol><ol start="4" style="list-style-type: decimal;"><li>The PWM test interface is as follows</li> <div class="figure"> [[File:zero2w-img381.png]] </div></ol><ol start="5" style="list-style-type: decimal;"><li>Then set which PWM you want to use in the Channel. The default is PWM1. If you want to set it to PWM2, just enter 2 in the Channel. PWM3 and PWM4 and so on.</li> [[File:zero2w-img382.png]]</ol><ol start="6" style="list-style-type: decimal;"><li>Then you can set the PWM period. The default configuration is '''50000ns'''. The converted PWM frequency is '''20KHz'''</li> [[File:zero2w-img383.png]]</ol><ol start="7" style="list-style-type: decimal;"><li>Then click the '''EXPORT'''button to export PWM</li> [[File:zero2w-img384.png]]</ol><ol start="8" style="list-style-type: decimal;"><li>Then drag the progress bar below to change the PWM duty cycle, and then check '''Enable''' to output the PWM waveform.</li> [[File:zero2w-img385.png]]</ol><ol start="9" style="list-style-type: decimal;"><li>Then use an oscilloscope to measure the corresponding pins in the 40pin development board and you can see the following waveform.</li> [[File:zero2w-img386.png]]</ol><span id="how-to-compile-android-12-source-code"></span> = '''How to compile Android 12 source code''' = <span id="download-the-source-code-of-android-12"></span>== Download the source code of Android 12 == <ol style="list-style-type: decimal;"><li><p>First download the compressed package of the Android 12 source code and the compressed package of the files modified by Orange Pi Zero2w from Google Cloud Drive</p><ol style="list-style-type: lower-alpha;"><li>Google Cloud Drive</li> [[File:zero2w-img387.png]]</ol></li></ol><ol start="2" style="list-style-type: decimal;"><li>After downloading the compressed package of Android 12 source code, please check whether the MD5 checksum is correct. If it is incorrect, please download the source code again. Here's how to check the MD5 checksum:</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''md5sum -c H618-Android12-Src.tar.gz.md5sum''' H618-Android12-Src.tar.gzaa: '''<span style="color:#FF0000">OK</span>''' H618-Android12-Src.tar.gzab: '''<span style="color:#FF0000">OK</span>''' ......|}</ol><ol start="3" style="list-style-type: decimal;"><li>Then you need to merge multiple compressed files into one, and then extract the Android source code. The command looks like this:</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''cat H618-Android12-Src.tar.gz<span style="color:#FF0000">a</span>* &gt; H618-Android12-Src.tar.gz''' test@test:~$ '''tar -xvf H618-Android12-Src.tar.gz'''|}</ol><ol start="4" style="list-style-type: decimal;"><li>Then unzip the compressed package of the files modified by Orange Pi Zero2w</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''tar zxf opizero2w_android12_patches.tar.gz''' test@test:~$ '''ls''' '''opizero2w_android12_patches''' opizero2w_android12_patches.tar.gz|}</ol><ol start="5" style="list-style-type: decimal;"><li>Then copy the files modified by Orange Pi Zero2w to the Android source code</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''cp -rf opizero2w_android12_patches/* H618-Android12-Src/'''|}</ol><span id="compile-the-source-code-of-android-12"></span> == Compile the source code of Android 12 == {| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Android12 is compiled on an x86_64 computer with <span style="color:#FF0000">Ubuntu 22.04</span> installed. Other versions of Ubuntu system package dependencies may have some differences. The image download address of the Ubuntu 22.04 <span style="color:#FF0000">amd64</span> version is as follows:''' [https://repo.huaweicloud.com/ubuntu-releases/22.04/ubuntu-22.04.2-desktop-amd64.iso '''https://repo.huaweicloud.com/ubuntu-releases/22.04/ubuntu-22.04.2-desktop-amd64.iso'''] '''The x86_64 computer hardware configuration for compiling Android12 source code recommends a memory of 16GB or more, and a hard disk space of 200GB or more is recommended. The more CPU cores, the better.'''</big>|} # First install the software packages needed to compile Android12 source code ::{| class="wikitable" style="width:800px;" |-| test@test:~$ '''sudo apt-get update''' test@test:~$ '''sudo apt-get install -y git gnupg flex bison gperf build-essential \''' '''zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \''' '''lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev ccache \''' '''libgl1-mesa-dev libxml2-utils xsltproc unzip u-boot-tools python-is-python3 \''' '''libssl-dev libncurses5 clang gawk'''|} <ol start="2" style="list-style-type: decimal;"><li><p>Then compile the code in the longan folder, which mainly contains u-boot and linux kernel</p><ol style="list-style-type: lower-alpha;"><li>First run '''./build.sh config''' to set compilation options</li>{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''cd H618-Android12-Src/longan'''</p><p>test@test:~/H618-Android12-Src/longan$ '''./build.sh config'''</p>  <p>Welcome to mkscript setup progress</p><p>All available platform:</p>:<p>0. android</p>:<p>1. linux</p><p>Choice [android]: '''<span style="color:#FF0000">0</span>'''</p><p>All available ic:</p>:<p>0. h618</p><p>Choice [h618]: '''<span style="color:#FF0000">0</span>'''</p><p>All available board:</p>:<p>0. ft</p>:<p>1. p1</p>:<p>2. p2</p>:<p>3. p7</p>:<p>4. p7l</p>:<p>5. perf1</p>:<p>6. perf2</p>:<p>7. perf3</p>:<p>8. qa</p><p>Choice [p2]: '''<span style="color:#FF0000">2</span>'''</p><p>All available flash:</p>:<p>0. default</p>:<p>1. nor</p><p>Choice [default]: '''<span style="color:#FF0000">0</span>'''</p><p>All available kern_ver:</p>:<p>0. linux-5.4</p><p>Choice [linux-5.4]: '''<span style="color:#FF0000">0</span>'''</p><p>All available arch:</p>:<p>0. arm</p>:<p>1. arm64</p><p>Choice [arm64]: '''<span style="color:#FF0000">1</span>'''</p><p>'''......'''</p><p>*** Default configuration is based on 'sun50iw9p1smp_h618_android_defconfig'</p><p>#</p><p># configuration written to .config</p><p>#</p><p>make[1]: Leaving directory '/home/test/H618-Android12-Src/longan/out/kernel/build'</p><p>make: Leaving directory '/home/test/H618-Android12-Src/longan/kernel/linux-5.4'</p><p>INFO: clean buildserver</p><p>INFO: prepare_buildserver</p>|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Then run the '''./build.sh''' script to start compilation.</li>{| class="wikitable" style="width:800px;" |-| test@test:~/H618-Android12-Src/longan$ '''./build.sh'''|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>After compilation is completed, you will see the following output</li>{| class="wikitable" style="width:800px;" |-| sun50iw9p1 compile Kernel successful INFO: Prepare toolchain ... '''......''' INFO: build kernel OK. INFO: build rootfs ... INFO: skip make rootfs for android INFO: ---------------------------------------- INFO: build lichee OK. INFO: ----------------------------------------|}</ol></li></ol><ol start="3" style="list-style-type: decimal;"><li>Then use the following command to compile the Android source code and generate the final Android image</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''cd H618-Android12-Src''' test@test:~/H618-Android12-Src$ '''source build/envsetup.sh''' test@test:~/H618-Android12-Src$ '''lunch apollo_p2-userdebug''' test@test:~/H618-Android12-Src$ '''make -j8''' test@test:~/H618-Android12-Src$ '''pack'''|}</ol><ol start="4" style="list-style-type: decimal;"><li><p>The storage path of the Android image generated by compilation is:</p>{| class="wikitable" style="width:800px;" |-| <p>'''longan/out/h618_android12_p2_uart0.img'''</p>|}</li></ol> <span id="appendix"></span> = '''Appendix''' = <span id="user-manual-update-history"></span>== User manual update history == {| class="wikitable" style="width:800px;text-align: center;"|-| '''Version'''| '''Date'''| '''Release Notes'''|-| v1.0| 2023-09-14| initial version|} <span id="image-update-history"></span>== Image update history == {| class="wikitable" style="width:800px;"|-| style="text-align: center;"| '''Date''' | style="text-align: center;"| '''Release Notes'''|-| style="text-align: center;"| 2023-09-14| orangepizero2w_1.0.0_debian_bullseye_server_linux5.4.125.7z orangepizero2w_1.0.0_ubuntu_focal_server_linux5.4.125.7z orangepizero2w_1.0.0_ubuntu_focal_desktop_xfce_linux5.4.125.7z orangepizero2w_1.0.0_debian_bullseye_desktop_xfce_linux5.4.125.7z  orangepizero2w_1.0.0_ubuntu_jammy_server_linux6.1.31.7z orangepizero2w_1.0.0_debian_bookworm_server_linux6.1.31.7z orangepizero2w_1.0.0_debian_bullseye_server_linux6.1.31.7z orangepizero2w_1.0.0_ubuntu_jammy_desktop_xfce_linux6.1.31.7z orangepizero2w_1.0.0_debian_bookworm_desktop_xfce_linux6.1.31.7z orangepizero2w_1.0.0_debian_bullseye_desktop_xfce_linux6.1.31.7z  OrangePi_Zero2w_Android12_v1.0.tar.gz
{| class="wikitable"
|-
| '''Version'''
| '''Date'''
| '''Release Notes'''
|-
| v1.0
| 2023-09-14
| initial version
|}
 
<span id="image-update-history"></span>
== Image update history ==
 
{| class="wikitable"
|-
| '''Date'''
 
| '''Release Notes'''
|-
| 202 3-09-14
|
orangepizero2w_1.0.0_debian_bullseye_server_linux5.4.125.7z
 
orangepizero2w_1.0.0_ubuntu_focal_server_linux5.4.125.7z
 
orangepizero2w_1.0.0_ubuntu_focal_desktop_xfce_linux5.4.125.7z
 
orangepizero2w_1.0.0_debian_bullseye_desktop_xfce_linux5.4.125.7z
 
orangepizero2w_1.0.0_ubuntu_jammy_server_linux6.1.31.7z
 
orangepizero2w_1.0.0_debian_bookworm_server_linux6.1.31.7z
 
orangepizero2w_1.0.0_debian_bullseye_server_linux6.1.31.7z
 
orangepizero2w_1.0.0_ubuntu_jammy_desktop_xfce_linux6.1.31.7z
 
orangepizero2w_1.0.0_debian_bookworm_desktop_xfce_linux6.1.31.7z
 
orangepizero2w_1.0.0_debian_bullseye_desktop_xfce_linux6.1.31.7z
 
OrangePi_Zero2w_Android12_v1.0.tar.gz
Opios-arch-aarch64-xfce-opizero2w-23.09-linux6.1.31.img.xz