8,367
edits
Changes
→Download orangepi-build from github
<div class="figure">
[[File:zero2w-img3.png|800px]]
</div>
<div class="figure">
[[File:zero2w-img4.png|800px]]
</div>
<div class="figure">
[[File:zero2w-img5.png|800px]]
</div>
<span id="orange-pi-zero-2w-24pin-expansion-board-interface-details"></span>
== Orange Pi Zero 2w 24pin expansion board interface details ==
<div class="figure">
[[File:zero2w-img6.png|800px]]
</div>
[[File:zero2w-img7.png|800px]]
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
# Then you can remotely log in to the Linux system through the ssh command
::{| class="wikitable" style="width:800px;" |-| test@test:~$ '''ssh [mailto:root@192.168.1.36 orangepi@192.168.1.]xxx''' (Need to be replaced with the IP address of the development board)
orangepi@192.168.1.xx's password: (iEnter (Enter your password here, the default password is orangepi)|}::{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note that when entering a password, <span style="color:#FF0000">the specific content of the entered password will not be displayed on the screen</span>. Please do not think that there is something wrong. Just press Enter after entering it.'''
'''Note that when entering a password, the specific content of the entered password will not be displayed on the screen. Please do not think that there is something wrong. Just press Enter after entering it.''' '''f If you are prompted to refuse the connection, as long as you are using the image provided by Orange Pi, <span style="color:#FF0000">please do not doubt whether the orangepi password is incorrect</span>, but look for other reasons.'''</big>|}
<ol start="3" style="list-style-type: decimal;">
<li><p>After successfully logging into the system, the display is as shown below</p>
<p>[[File:zero2w-img140.png]]</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''If ssh cannot log in to the Linux system normally, first check whether the IP address of the development board can be pinged. If there is no problem with pinging, you can log in to the Linux system through the serial port or HDMI display and enter the following command on the development board before trying again. Can it be connected?: '''</p></li></ol>
root@orangepi:~# '''reset_ssh.sh'''
'''If it still doesn't work, please try restarting the system.'''</big>
|}
</li></ol>
<span id="ssh-remote-login-development-board-under-windows"></span>
=== SSH remote login development board under Windows ===
<li><p>Open '''Session'''</p></li>
<li><p>Then select '''SSH''' in '''Session Setting'''</p></li>
<li><p>Then enter the IP address of the development board in '''Remote > host'''</p></li><li><p>Then enter the username '''root''' or '''orangepi''' of the linux > system in '''Specify username'''.</p></li>
<li><p>Finally click '''OK'''</p>
<div class="figure">
</li>
<li><p>You will then be prompted to enter a password. The default passwords for both root and orangepi users are orangepi.</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that when entering a password, <span style="color:#FF0000">the specific content of the entered password will not be displayed on the screen</span>. Please do not think that there is any malfunction. Just press Enter after entering the password.'''</p></big>|}
<div class="figure">
</div></li>
<li><p>After starting the Linux system, if there is image output on the HDMI display, it means that the HDMI interface is working normally.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| </li></olbig>'''Note that although many laptops have HDMI interfaces, the HDMI interface of the laptop generally only has the output function and does not have the HDMI in function, which means that the HDMI output of other devices cannot be displayed on the laptop screen'''
=== HDMI to VGA display test ===
<li><p>HDMI to VGA display test is as follows</p>
<p>[[File:zero2w-img147.png]]</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''When using HDMI to VGA display, the development board and the Linux 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.'''</p></big>|}</li></ol>
<span id="how-to-set-hdmi-resolution-in-linux5.4-system"></span>
=== How to set HDMI resolution in Linux5.4 system ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note: This method is only applicable to systems with Linux 5.4 kernel.'''</big>|}
<ol style="list-style-type: decimal;">
<li><p>There is a disp_mode variable in '''/boot/orangepiEnv.txt''' of the Linux system, which can be used to set the resolution of HDMI output. The default resolution of the Linux system is 1080p60</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo vim /boot/orangepiEnv.txt'''</p>
<p>verbosity=1</p>
<p>console=both</p>
<p>disp_mode='''<span style="color:#FF0000">1080p60</span>'''</p>
<p>fb0_width=1920</p>
<p>fb0_height=1080</p>|}</li><li><p>The disp_mode variable supports setting values as shown in the table below</p></li></ol>
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''disp_mode supported values'''
| '''60'''
|}
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note: Linux systems currently do not support 4K resolution.'''</big>|}</ol>
<ol start="3" style="list-style-type: decimal;">
<li><p>Change the value of the disp_mode variable to the resolution you want to output, then restart the system, and HDMI will output the set resolution.</p></li>
<li><p>The method of checking the HDMI output resolution is as follows. If the displayed resolution is the same as the set resolution, it means that the settings on the development board are correct.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo cat /sys/class/disp/disp/attr/sys'''</p>
|}
<p>[[File:zero2w-img148.png]]</p></li></ol>
<span id="how-to-modify-the-width-and-height-of-framebuffer-in-linux5.4-system"></span>
=== How to modify the width and height of Framebuffer in Linux5.4 system ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note: This method is only applicable to systems with Linux 5.4 kernel.'''</big>|}
There are two variables, fb0_width and fb0_height, in '''/boot/orangepiEnv.txt''' of the Linux system. You can use them to set the width and height of the Framebuffer. The Linux system defaults to fb0_width=1920 and fb0_height=1080.
{| class="wikitable" style="width:800px;"
|-
|
orangepi@orangepi:~$ '''sudo vim /boot/orangepiEnv.txt'''
disp_mode=1080p60
'''<span style="color:#FF0000">fb0_width=1920</span>'''
'''<span style="color:#FF0000">fb0_height=1080</span>'''|}
The reference values corresponding to different resolutions of fb0_width and fb0_height are as follows::
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''HDMI resolution'''
<span id="framebuffer-cursor-setting"></span>
=== Framebuffer cursor setting ===
<ol style="list-style-type: decimal;">
<li><p>The softcursor used by Framebuffer, the method to set the cursor to blink or not to blink is as follows</p>
{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~# '''echo <span style="color:#FF0000">1 </span> > /sys/class/graphics/fbcon/cursor_blink #Cursor flashes'''</p><p>root@orangepi:~# '''echo <span style="color:#FF0000">0 </span> > /sys/class/graphics/fbcon/cursor_blink #Cursor does not flash'''</p>|}</li>
<li><p>If you need to hide the cursor, you can add vt.global_cursor_default=0 to the '''extraargs''' variable in '''/boot/orangepiEnv.txt''' (the value of extraargs will be assigned to the '''bootargs''' environment variable and eventually passed to the kernel) (if '''<span class="mark">vt.global_cursor_default=1</span>''', it will be displayed cursor), then restart the system and you will see that the cursor has disappeared.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo vim /boot/orangepiEnv.txt'''</p>
<p>verbosity=1</p>
<p>fb0_width=1920</p>
<p>fb0_height=1080</p>
<p>'''<span style="color:#FF0000">extraargs=vt.global_cursor_default=0</span>'''</p>|}</li></ol>
<span id="how-to-use-bluetooth"></span>
== How to use Bluetooth ==
<ol style="list-style-type: decimal;">
<li><p>After entering the system, you can first check whether there is a Bluetooth device node through the '''hciconfig''' command. If it exists, it means that the Bluetooth initialization is normal.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo apt update && sudo apt install -y bluez'''</p>
<p>orangepi@orangepi:~$ '''hciconfig -a'''</p>
<p>hci0: Type: Primary Bus: UART</p>
:<p>BD Address: 3E:61:3D:19:0E:52 ACL MTU: 1021:8 SCO MTU: 240:3</p>:<p>UP RUNNING</p>:<p>RX bytes:925 acl:0 sco:0 events:72 errors:0</p>:<p>TX bytes:5498 acl:0 sco:0 commands:72 errors:0</p>:<p>Features: 0xbf 0xff 0x8d 0xfe 0xdb 0x3d 0x7b 0xc7</p>:<p>Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3</p>:<p>Link policy: RSWITCH SNIFF</p>:<p>Link mode: SLAVE ACCEPT</p>:<p>Name: 'orangepi'</p>:<p>Class: 0x3c0000</p>:<p>Service Classes: Rendering, Capturing, Object Transfer, Audio</p>:<p>Device Class: Miscellaneous,</p>:<p>HCI Version: 5.0 (0x9) Revision: 0x400</p>:<p>LMP Version: 5.0 (0x9) Subversion: 0x400</p>:<p>Manufacturer: Spreadtrum Communications Shanghai Ltd (492)</p>|}</li>
<li><p>Use '''bluetoothctl''' to scan for Bluetooth devices</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo bluetoothctl'''</p>
<p>[NEW] Controller 10:11:12:13:14:15 orangepizero2w [default]</p>
<p>Discovery stopped</p>
<p>[CHG] Controller 10:11:12:13:14:15 Discovering: no</p>
<p>[CHG] Device DC:72:9B:4C:F4:CF RSSI is nil</p>|}</li>
<li><p>After scanning the device you want to pair, you can pair it. For pairing, you need to use the MAC address of the device.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>[bluetooth]# '''pair DC:72:9B:4C:F4:CF''' '''#Pair using the MAC address of the scanned Bluetooth device'''</p>
<p>Attempting to pair with DC:72:9B:4C:F4:CF</p>
<p>'''Pairing successful #Prompt pairing successful'''</p>
<p>[CHG] Device DC:72:9B:4C:F4:CF ServicesResolved: no</p>
<p>[CHG] Device DC:72:9B:4C:F4:CF Connected: no</p>|}</li>
<li><p>After successful pairing, the Bluetooth interface of the mobile phone will appear as follows:</p>
<div class="figure">
</div></li>
<li><p>To connect to a Bluetooth device, you need to install the '''pulseaudio-module-bluetooth''' software package, and then start the '''pulseaudio''' service</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo apt update'''</p>
<p>orangepi@orangepi:~$ '''sudo''' '''apt -y install pulseaudio-module-bluetooth'''</p>
<p>orangepi@orangepi:~$ '''pulseaudio --start'''</p>|}</li>
<li><p>How to connect Bluetooth devices</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo bluetoothctl'''</p>
<p>Agent registered</p>
<p>[CHG] Device DC:72:9B:4C:F4:CF ServicesResolved: yes</p>
<p>[CHG] Controller 10:11:12:13:14:15 Discoverable: no</p>
<p>'''[orangepi]# #If this prompt appears, the connection is successful.'''</p>|}</li>
<li><p>After connecting the Bluetooth device, you can see the prompt that the audio for calls and media has been '''connected in the Bluetooth configuration interface of the Android phone'''.</p>
<div class="figure">
<span id="usb-interface-test"></span>
== USB interface test ==
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''The USB interface can be connected to a USB hub to expand the number of USB interfaces.'''</big>|}
<span id="usb-interface-extension-description"></span>
<ol style="list-style-type: lower-alpha;">
<li><p>First run '''orangepi-config'''. Ordinary users remember to add > '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li>
<li><p>Then select '''System'''</p>
<p>[[File:zero2w-img80.png]]</p></li>
<li><p>Then select '''Hardware'''</p>
<p>[[File:zero2w-img81.png]]</p></li>
<li><p>Then use the keyboard's arrow keys to locate the location shown in > the picture below, and then use the space to select '''usb0-host'''</p>
<p>[[File:zero2w-img161.png]]</p></li>
<li><p>Then select '''<Save>'''to save</p>
<li><p>Then select '''<Back>'''</p>
<p>[[File:zero2w-img84.png]]</p></li>
<li><p>Then select '''<Reboot>'''to restart the system to make the > configuration take effect.</p>
<p>[[File:zero2w-img85.png]]</p></li>
<li><p>After restarting, USB0 can use USB devices such as mouse and > keyboard normally.</p></li></ol>
<span id="connect-usb-mouse-or-keyboard-to-test"></span>
=== Connect USB mouse or keyboard to test ===
# Execute the following command. If you can see the output of sdX, it means the USB disk is successfully recognized.
::{| class="wikitable" style="width:800px;"|-|orangepi@orangepi:~$ '''cat /proc/partitions | grep "sd*"'''<br> <span style="margin-right: 30px;">major </span><span style="margin-right: 40px;">minor </span><span style="margin-right: 30px;">#blocks </span><span style="margin-right: 50px;">name</span><br> <span style="margin-right: 70px;">8 </span><span style="margin-right: 60px;">0 </span><span style="margin-right: 50px;">30044160 </span><span style="margin-right: 50px;color:#FF0000">'''sda'''</span><br> <span style="margin-right: 70px;">8 </span><span style="margin-right: 60px;">1 </span><span style="margin-right: 50px;">30043119 </span><span style="margin-right: 50px;color:#FF0000">'''sda1'''</span><br>|}
<ol start="3" style="list-style-type: decimal;">
<li>Use the mount command to mount the U disk to '''/mnt''', and then you can view the files in the U disk</li></ol>{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''sudo mount /dev/sda1 /mnt/'''
test.txt
|}</ol>
<ol start="4" style="list-style-type: decimal;">
<li>After mounting, you can check the capacity usage and mount point of the U disk through the '''df -h''' command.</li></ol>{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''df -h | grep "sd"'''
/dev/sda1 29G 208K 29G 1% /mnt|}</ol><span id="usb-ethernet-card-test"></span>
=== USB Ethernet card test ===
# The '''currently tested''' and usable USB Ethernet cards are as follows. Among them, the RTL8153 USB Gigabit network card can be used normally when inserted into the USB 2.0 Host interface of the development board for testing, but the speed cannot reach Gigabit. Please note this.
::{| class="wikitable" style="width:800px;text-align: center;"
|-
| serial number
<ol start="2" style="list-style-type: decimal;">
<li><p>First insert the USB network card into the USB interface of the development board, and then insert the network cable into the USB network card to ensure that the network cable can access the Internet normally. If you can see the following log information through the '''dmesg''' command, it means that the USB network card is recognized normally.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''dmesg | tail'''</p>
<p>[ 121.985016] usb 3-1: USB disconnect, device number 2</p>
<p>[ 127.763031] IPv6: ADDRCONF(NETDEV_UP): enx00e04c362017: link is not ready</p>
<p>[ 129.892465] r8152 3-1:1.0 enx00e04c362017: carrier on</p>
<p>[ 129.892583] IPv6: ADDRCONF(NETDEV_CHANGE): enx00e04c362017: link becomes ready</p>|}</li>
<li><p>Then you can see the device node of the USB network card and the automatically assigned IP address through the ifconfig command</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo ifconfig'''</p>
<p>'''enx00e04c362017''': flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500</p>
::<p>inet '''192.168.1.177''' netmask 255.255.255.0 broadcast 192.168.1.255</p>::<p>inet6 fe80::681f:d293:4bc5:e9fd prefixlen 64 scopeid 0x20<link></p>::<p>ether 00:e0:4c:36:20:17 txqueuelen 1000 (Ethernet)</p>::<p>RX packets 1849 bytes 134590 (134.5 KB)</p>::<p>RX errors 0 dropped 125 overruns 0 frame 0</p>::<p>TX packets 33 bytes 2834 (2.8 KB)</p>::<p>TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0</p>|}</li>
<li><p>The command to test network connectivity is as follows</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''ping www.baidu.com -I enx00e04c362017'''</p>
<p>PING www.a.shifen.com (14.215.177.38) from 192.168.1.12 eth0: 56(84) bytes of data.</p>
<p>--- www.a.shifen.com ping statistics ---</p>
<p>4 packets transmitted, 4 received, 0% packet loss, time 3002ms</p>
<p>rtt min/avg/max/mdev = 6.260/6.770/7.275/0.373 ms</p>|}</li></ol>
<span id="usb-camera-test"></span>
=== USB camera test ===
<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 > take pictures</p><ol style="list-style-type: lower-alpha;"><li><p>-d Option to specify the device node of the USB camera</p></li><li><p>--no-banner Used to remove watermarks from photos</p></li><li><p>-r option is used to specify the resolution of the photo</p></li><li><p>-S Option to skip previous frames</p></li><li><p>./image.jpg Used to set the name and path of the generated > photo</p><p>orangepi@orangepi:~$ '''sudo''' '''fswebcam -d /dev/video0 \'''</p><p>'''--no-banner -r 1280x720 -S 5 ./image.jpg'''</p></li></ol>|}
</li>
<li><p>After installing fswebcam, you can use the following command to take pictures</p><ol style="list-style-type: none;"><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 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 desktop version of Linux system, you can directly view > 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 "./input_uvc.so -d \'''</p>
<p>'''/dev/video0 -u -f 30" -o "./output_http.so -w ./www"'''</p>|}</li><li><p>Then enter ['''the IP address of the development board: 8080'''] > in the Ubuntu PC or Windows PC or mobile phone browser on the > same LAN as the development board to see the video output by > the camera.</p>
<div class="figure">
<span id="audio-test"></span>
== Audio test ==
<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: > audiocodec''' is the sound card device required for headphone > 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 > '''audiocodec''' is the sound card device required for headphone > 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>
==== 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 > the '''Playback''' software will be displayed in '''Playback''', > as shown in the figure below. Here you can set which audio > 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>
== 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 > the type of temperature sensor, the second command is used to view > 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 > the type of temperature sensor, the second command is used to view > 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 > the type of temperature sensor, the second command is used to view > 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 > the type of temperature sensor, and the second command is used to > 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: +'''<span style="color:#FF0000">47.4°C</span>''' (crit = +110.0°C)
gpu_thermal-virtual-0
Adapter: Virtual device
temp1: +'''<span style="color:#FF0000">48.7°C</span>''' (crit = +110.0°C)
ddr_thermal-virtual-0
Adapter: Virtual device
temp1: +'''<span style="color:#FF0000">47.8°C</span>''' (crit = +110.0°C)
ve_thermal-virtual-0
Adapter: Virtual device
temp1: +'''<span style="color:#FF0000">47.2°C</span>''' (crit = +110.0°C)|}
<span id="pin-interface-pin-description"></span>
== 40 Pin Interface pin description ==
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note: The pin header on the 40pin interface is not soldered by default, and you need to solder it yourself before it can be used.'''</big>|}
<ol style="list-style-type: decimal;">
</div></li>
<li><p>The functions of the 40 Pin interface pins on the development board are as shown in the table below</p></li></ol>
<div style="display: flex;">{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO序号GPIO NO.'''
| '''GPIO'''
| '''Function'''
| '''pin'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-
| '''264'''
| '''TWI1-SDA'''
| '''3'''
|-
| '''263'''
| '''TWI1-SCL'''
| '''5'''
|-
| '''269'''
| '''PWM3/UART4_TX'''
| '''7'''
|-
| style="text-align: left;"|
| '''GND'''
| '''9'''
| '''226'''
| '''PH2'''
| '''UART5_TX'''
| '''11'''
|-
| '''227'''
| '''UART5_RX'''
| '''13'''
|-
| '''261'''
| '''TWI0_SCL/UART2_TX'''
| '''15'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|-
| '''231'''
| '''SPI1_MOSI'''
| '''19'''
|-
| '''232'''
| '''SPI1_MISO'''
| '''21'''
|-
| '''230'''
| '''SPI1_CLK'''
| '''23'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|-
| '''266'''
| '''TWI2-SDA/UART3_RX'''
| '''27'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
| '''258'''
| '''PI2'''
| style="text-align: left;"|
| '''35'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|-| style="text-align: left;"|| style="text-align: left;"|| '''38GND'''| '''39'''|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''4'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''6'''
| '''GND'''
| style="text-align: left;"|
| '''PI3'''| '''259'''|} <ol start="3" style="list-styletext-typealign: decimalleft;">|<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.8''' | '''The storage path of the compiled wiringOP deb package in orangepi-build is: UART0_TX''' | '''orangepi-build/external/cache/debs/arm64/wiringpi_x.xx.debPH0''' '''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# 224'''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序号10'''| '''GPIOUART0_RX'''| '''FunctionPH1'''| '''pin'''|| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO序号225'''
|-
| '''12'''
| style="text-align: left;"|
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26416'''| '''PI8PWM4/UART4_RX'''| '''TWI1-SDAPI14'''| '''3270'''|-| '''4'''| '''5V18'''| style="text-align: left;"|
| style="text-align: left;"|
| '''PH4'''
| '''228'''
|-
| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|| '''620'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26922'''| '''PI13TWI0_SDA/UART2_RX'''| '''PI6'''| '''262'''|-| '''24'''| '''PWM3/UART4_TXSPI1_CS0'''| '''PH5'''| '''229'''|-| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''7233'''|-| '''828'''| '''UART0_TXTWI2-SCL/UART3_TX'''| '''PH0PI9'''| '''224265'''
|-
| '''30'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''32'''
| '''PWM1'''
| '''PI11'''
| '''267'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
| '''PI1'''style="text-align: left;"| '''257'''
|-
| '''22736'''| '''PH3'''| '''UART5_RX'''| '''13'''|| '''14'''| '''GND'''| style="text-align: left;"|
| style="text-align: left;"|
| '''PC12'''
| '''76'''
|-
| '''26138'''| '''PI5'''| '''TWI0_SCL/UART2_TX'''| '''15'''|| '''16'''| '''PWM4/UART4_RX'''| '''PI14'''| '''270'''|-
| style="text-align: left;"|
|-
| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|| '''20'''| '''GND40'''
| style="text-align: left;"|
|-
| <big>'''230Note 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.'''| '''PH6The storage path of the compiled wiringOP deb package in orangepi-build is: '''| '''SPI1_CLK<span style="color:blue">orangepi-build/external/cache/debs/arm64/wiringpi_x.xx.deb</span>'''| '''23After 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.'''</big> [[File:zero2w-img170.png|center]] | <big>'''24WiringOP 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.'''</big>| '''SPI1_CS0'''} <ol style="list-style-type: decimal;">| '''PH5'''<li><p>Download the code of wiringOP</p>{| '''229'''class="wikitable" style="width:800px;"
|-
|-
| '''266'''| <big><p>'''PI10Note that the source code needs to download the code of wiringOP next branch. Please don'''| t miss the -b next parameter.'''TWI2-SDA</UART3_RX'''p>| <p>'''27If 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>|}| '''28'''</li>| '''TWI2-SCL<li><p>Compile and install wiringOP</UART3_TX'''| '''PI9'''p>{| '''265'''class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''256cd wiringOP'''</p>| <p>orangepi@orangepi:~/wiringOP$ '''PI0sudo ./build clean'''</p>| style="text-align<p>orangepi@orangepi: left;"|| ~/wiringOP$ '''29sudo ./build'''</p>|}| '''30'''</li><li><p>The output of the test gpio readall command is as follows</p><p>[[File:zero2w-img170.png]]</p></li></ol>| '''GND'''| 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;"|
|-
| <big>'''271Note: 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>| '''PI15'''} <span id="pin-gpio-port-test"></span>=== 40pin GPIO port test === | <ol style="textlist-style-aligntype: leftdecimal;"|>| '''31'''<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>| '''32'''<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>{| '''PWM1'''| '''PI11'''| '''267'''class="wikitable" style="width:800px;"
|-
| '''268'''| <p>root@orangepi:~/wiringOP# '''PI12'''| '''PWM2'''| '''33gpio mode <span style="color:#FF0000">2</span> out'''</p>|}| '''34'''</li>| '''GND'''<li><p>Then set the GPIO port to output a low level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 0v, it means the low level is set successfully.</p>{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| '''258'''| ''<p>root@orangepi:~/wiringOP# 'PI2'''| gpio write 2 <span style="text-aligncolor: left;#FF0000"|| '''35>0</span>'''</p>|}</li>| '''36'''<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="text-alignwidth: left800px;"|| '''PC12'''| '''76'''
|-
|}
</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>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'''following uses pin No. Ordinary users remember 7—corresponding to add > '''sudo''' permissions.</p><p>orangepi@orangepi:~$ '''sudo orangepiGPIO PI13—corresponding to wPi serial number 2—as an example to demonstrate how to set the pull-config'''</p></li><li><p>Then select '''System'''</p><p>[[File:zero2wup and pull-img80down resistors of the GPIO port.png]]</p></li><li><p>Then select '''Hardware'''</p><p>[[File:zero2w-img81img171.png]]</p></li><li><p>Then use First, you need to set the keyboard's arrow keys GPIO port to locate the position shown > in the figure belowinput mode, and then use the '''space''' third parameter needs to select be the > dtbo configuration serial number of the SPI you want wPi corresponding to openthe input pin.</p></li></ol></li></ol> {| class="wikitable" style="width:800px;"
|-
| <p>root@orangepi:~/wiringOP# '''dtbo configurationgpio mode <span style="color:#FF0000">2</span> in'''</p>|}</li><li><p>After setting to input mode, execute the following command to set the GPIO port to pull-up mode.</p>{| '''illustrate'''class="wikitable" style="width:800px;"
|-
| <p>root@orangepi:~/wiringOP# '''spi1gpio 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-cs0up mode is set successfully.</p>{| class="wikitable" style="width:800px;" |-cs1-spidev| <p>root@orangepi:~/wiringOP# '''gpio read <span style="color:#FF0000">2</span>'''</p>| <p>'''Open cs0 and cs1 of spi1 at the same time<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# '''spi1-cs0-spidevgpio mode <span style="color:#FF0000">2</span> down'''</p>| '''Only open cs0 }</li><li><p>Then enter the following command to read the level of spi1'''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# '''spi1-cs1-spidevgpio read <span style="color:#FF0000">2</span>'''</p>| <p>'''Only open cs1 of spi1<span style="color:#FF0000">0</span>'''</p>
|}
</li></ol>
<span iddiv style="pin-i2c-testdisplay: flex;"></span>=== 40pin I2C test === # As can be seen from the table below, the i2c available for the 40pin interface are i2c0, i2c1 and i2c2 ::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO序号GPIO NO.'''
| '''GPIO'''
| '''Function'''
| '''pin'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-
| '''264'''
| '''TWI1-SDA'''
| '''3'''
|-
| '''263'''
| '''TWI1-SCL'''
| '''5'''
|-
| '''269'''
| '''PWM3/UART4_TX'''
| '''7'''
|-
| style="text-align: left;"|
| '''GND'''
| '''9'''
|-
| '''226'''
| '''UART5_TX'''
| '''11'''
|-
| '''227'''
| '''UART5_RX'''
| '''13'''
|-
| '''261'''
| '''TWI0_SCL/UART2_TX'''
| '''15'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|-
| '''<span style="color:#FF0000">231</span>'''| '''<span style="color:#FF0000">PH7</span>'''| '''<span style="color:#FF0000">SPI1_MOSI</span>'''| '''<span style="color:#FF0000">19</span>'''|-| '''20<span style="color:#FF0000">232</span>'''| '''GND<span style="color:#FF0000">PH8</span>'''| '''<span style="color:#FF0000">SPI1_MISO</span>'''| '''<span style="color:#FF0000">21</span>'''|-| '''<span style="color:#FF0000">230</span>'''| '''<span style="color:#FF0000">PH6</span>'''| '''<span style="color:#FF0000">SPI1_CLK</span>'''| '''<span style="color:#FF0000">23</span>'''|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''25'''
|-
| '''266'''
| '''PI10'''
| '''TWI2-SDA/UART3_RX'''
| '''27'''
|-
| '''256'''
| '''PI0'''
| style="text-align: left;"|
| '''29'''
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''40pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''6'''| '''GND'''| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''Multiplexing function in 40pin8'''| '''Corresponding dtbo configurationUART0_TX'''| '''PH0'''| '''224'''
|-
| '''40pin - i2c010'''| '''pi-i2c0UART0_RX'''| '''PH1'''| '''225'''
|-
| '''40pin 12'''| style="text- i2c1align: left;"|| '''PI1'''| '''pi-i2c1257'''
|-
| '''40pin - i2c214'''| '''pi-i2c2GND'''|} [[File:zero2w-img173.png]] <ol start="5" style="listtext-style-typealign: lower-alphaleft;"><li><p>Then select <span class="mark"><Save></span> to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''<Back>'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''<Reboot>''' to restart the system to make the > configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol> <!-- --><ol start="3" style="list-style-type: decimal;"><li><p>After starting the Linux system, first confirm that there is an open i2c device node under /dev</p><p>orangepi@orangepi:~$ '''ls /dev/i2c-*'''</p>|<p>'''/dev/i2c-*'''</p><p>'''Sometimes the i2c device node and the i2c bus serial number do not correspond one to one. For example, the i2c device node of the i2c1 bus may be /dev/i2c-3.'''</p><p>'''The method to accurately confirm the device node under /dev corresponding to the i2c bus is: '''</p></li></ol> <!-- --><ol style="list-style-type: lower-alpha;"><li><p>'''First run the following command to check the corresponding relationship of i2c'''</p><p>orangepi@orangepizero2w:~$ '''ls /sys/devices/platform/soc*/*/i2c-* | grep "i2c-[0-9]"'''</p><p>/sys/devices/platform/soc/5002000.i2c/i2c-0:</p><p>/sys/devices/platform/soc/5002400.i2c/i2c-3:</p><p>/sys/devices/platform/soc/5002800.i2c/i2c-4:</p><p>/sys/devices/platform/soc/5002c00.i2c/i2c-5:</p><p>/sys/devices/platform/soc/6000000.hdmi/i2c-2:</p><p>/sys/devices/platform/soc/7081400.i2c/i2c-1:</p></li><li><p>'''In the above output'''</p></li></ol> <!-- --><ol style="list-styletext-typealign: lower-alphaleft;"><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.16'''| '''GPIOPWM4/UART4_RX'''| '''FunctionPI14'''| '''pin'''|| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.270'''
|-
| '''18'''
| style="text-align: left;"|
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26422'''| '''PI8TWI0_SDA/UART2_RX'''| '''TWI1PI6'''| '''262'''|-| '''<span style="color:#FF0000">24</span>'''| '''<span style="color:#FF0000">SPI1_CS0</span>'''| '''<span style="color:#FF0000">PH5</span>'''| '''<span style="color:#FF0000">229</span>'''|-| '''<span style="color:#FF0000">26</span>'''| '''<span style="color:#FF0000">SPI1_CS1</span>'''| '''<span style="color:#FF0000">PH9</span>'''| '''<span style="color:#FF0000">233</span>'''|-| '''28'''| '''TWI2-SDASCL/UART3_TX'''| '''3PI9'''|'''265'''|-| '''430'''| '''5VGND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26332'''| '''PI7PWM1'''| '''TWI1-SCLPI11'''| '''5267'''|-| '''634'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26936'''| '''PI13'''| '''PWM3/UART4_TX'''style="text-align: left;"| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0PC12'''| '''22476'''
|-
| '''38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| '''40'''
| style="text-align: left;"|
| '''GNDPI3'''| '''9259'''|}</div> <ol style="list-style-type: decimal;"><li><p>In Linux systems, spi1 is turned off by default and needs to be turned on manually before it can be used. The opening steps are as follows:</p><ol style="list-style-type: lower-alpha;"><li><p>First run '''orangepi-config'''. Ordinary users remember to add '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''10sudo orangepi-config'''</p>| }</li><li><p>Then select '''UART0_RXSystem'''</p><p>[[File:zero2w-img80.png]]</p></li>| <li><p>Then select '''PH1Hardware'''</p><p>[[File:zero2w-img81.png]]</p></li>| <li><p>Then use the keyboard's arrow keys to locate the position shown in the figure below, and then use the '''225space'''to select the dtbo configuration of the SPI you want to open.</p></li> {| class="wikitable" style="width:800px;text-align: center;"
|-
| '''226dtbo configuration'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''12'''| style="text-align: left;"|| '''PI1'''| '''257illustrate'''
|-
| '''227'''| '''PH3spi1-cs0-cs1-spidev'''| '''UART5_RXOpen cs0 and cs1 of spi1 at the same time'''| '''13'''|| '''14'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''261spi1-cs0-spidev'''| '''PI5'''| '''TWI0_SCL/UART2_TX'''| '''15'''|| '''16'''| '''PWM4/UART4_RX'''| '''PI14'''| '''270Only open cs0 of spi1'''
|-
| style="text'''spi1-cs1-align: left;"spidev'''|'''Only open cs1 of spi1'''| } [[File:zero2w-img172.png]]</ol><ol start="5" style="textlist-alignstyle-type: leftlower-alpha;"|>| <li><p>Then select '''3.3V<Save>'''to save</p><p>[[File:zero2w-img83.png]]</p></li>| <li><p>Then select '''17<Back>'''</p>|<p>[[File:zero2w-img84.png]]</p></li>| <li><p>Then select '''18<Reboot>'''to restart the system to make the configuration take effect.</p>| <p>[[File:zero2w-img85.png]]</p></li></ol></li></ol><ol start="2" style="textlist-style-aligntype: leftdecimal;"|>| <li><p>Then check whether there is a '''PH4spidev1.x'''device node in the Linux system. If it exists, it means that the SPI1 configuration has taken effect.</p>{| '''228'''class="wikitable" style="width:800px;"
|-
| '''231'''| <p>orangepi@orangepi:~$ '''PH7ls /dev/spidev1*'''</p>| '''SPI1_MOSI'''| '''19'''<p>/dev/spidev1.0 /dev/spidev1.1</p>|}{| '''20'''| '''GND'''| styleclass="text-align: left;wikitable"|| style="textbackground-aligncolor:#ffffdc;width: left800px;"|
|-
| '''232'''| <big><p>'''PH8Note that only when you open spi1-cs0-cs1-spidev, you will see the device nodes of the two spi.'''</p></big>| '''SPI1_MISO'''}| '''21'''|| '''22'''</li>| '''TWI0_SDA<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.</UART2_RX'''p>{| '''PI6'''| '''262'''class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''230sudo 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 '''PH6<span style="color:#FF0000">40 00 00 00 00 95</span>'''FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p><p>RX | FF FF FF FF FF FF '''SPI1_CLK<span style="color:#FF0000">FF FF FF FF FF FF</span>'''FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF | ............................….</p>| }</li><li><p>Then short-circuit the two pins of SPI1 mosi (pin 19 in the 40pin interface) and miso (pin 21 in the 40pin interface) and then run spidev_test. The output is as follows. You can see the sending and receiving The data is the same, indicating that the loopback test passed.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo spidev_test -v -D /dev/spidev1.0'''</p><p>spi mode: 0x0</p><p>bits per word: 8</p><p>max speed: 500000 Hz (500 KHz)</p><p>TX | FF FF FF FF FF FF ''23'<span style="color:#FF0000">40 00 00 00 00 95</span>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p><p>RX | FF FF FF FF FF FF '''<span style="color:#FF0000">40 00 00 00 00 95</span>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p>|}</li></ol> <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="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''24GPIO NO.'''| '''SPI1_CS0GPIO'''| '''PH5Function'''| '''229pin'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND3.3V'''| '''251'''|-| '''26<span style="color:#FF0000">264</span>'''| '''SPI1_CS1<span style="color:#FF0000">PI8</span>'''| '''PH9<span style="color:#FF0000">TWI1-SDA</span>'''| '''233<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>'''
|-
| '''266269'''| '''PI10PI13'''| '''TWI2-SDAPWM3/UART3_RXUART4_TX'''| '''27'''|| '''28'''| '''TWI2-SCL/UART3_TX'''| '''PI9'''| '''2657'''
|-
| style="text-align: left;"|
| '''29'''style="text-align: left;"|| '''30'''
| '''GND'''
| style="text-align: left;"|| style="text-align: left;"|'''9'''
|-
| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-| '''<span style="color:#FF0000">261</span>'''| '''<span style="color:#FF0000">PI5</span>'''| '''<span style="color:#FF0000">TWI0_SCL</span>/UART2_TX'''| '''<span style="color:#FF0000">15</span>'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''17'''|-| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|-| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''25'''|-| '''<span style="color:#FF0000">266</span>'''| '''<span style="color:#FF0000">PI10</span>'''| '''<span style="color:#FF0000">TWI2-SDA</span>/UART3_RX'''| '''<span style="color:#FF0000">27</span>'''|-| '''256'''| '''PI0'''| style="text-align: left;"|| '''29'''|-| '''271'''| '''PI15'''| style="text-align: left;"|
| '''31'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''40pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''Multiplexing function in 40pin4'''| '''Corresponding dtbo configuration5V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - uart26'''| '''pi-uart2GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - uart38'''| '''pi-uart3UART0_TX'''| '''PH0'''| '''224'''
|-
| '''40pin - uart410'''| '''pi-uart4UART0_RX'''| '''PH1'''| '''225'''
|-
| '''40pin - uart512'''| '''ph-uart5'''|} [[File:zero2w-img175.png]] <ol start="5" style="listtext-style-typealign: lower-alphaleft;"><li><p>Then select '''<Save>''' to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''<Back>'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''<Reboot>''' to restart the system to make the > configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol> <!-- --><ol start="3" style="list-style-type: decimal;"><li><p>After entering the Linux system, first confirm whether there is a uart5 device node under '''/dev'''</p><p>'''Note that the linux5.4 system is /dev/ttyASx.'''</p><p>orangepi@orangepi:~$ '''ls /dev/ttyS*'''</p><p>/dev/ttySx</p></li><li><p>Then start testing the uart interface. First use Dupont wire to 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: -> 0</p><p>Out: 1: -> 1</p><p>Out: 2: -> 2</p><p>Out: 3: -> 3^C</p></li></ol> <span id="pwm-test-method"></span>=== PWM test method === # As can be seen from the following table, the available pwm are pwm1, pwm2, pwm3 and pwm4. {| class="wikitable"|-| '''GPIO NO.'''| '''GPIO'''| '''Function'''| '''Pin'''|| '''Pin'''| '''Function'''| '''GPIOPI1'''| '''GPIO NO.257'''
|-
| '''14'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-| '''3.3V16'''| '''1PWM4/UART4_RX'''|| '''2PI14'''| '''5V270'''| style="text-align: left;"|'''18'''
| style="text-align: left;"|
| '''PH4'''
| '''228'''
|-
| '''26420'''| '''PI8'''| '''TWI1-SDA'''| '''3'''|| '''4'''| '''5VGND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''263<span style="color:#FF0000">22</span>'''| '''PI7<span style="color:#FF0000">TWI0_SDA</span>/UART2_RX'''| '''TWI1<span style="color:#FF0000">PI6</span>'''| '''<span style="color:#FF0000">262</span>'''|-| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''<span style="color:#FF0000">28</span>'''| '''<span style="color:#FF0000">TWI2-SCL</span>/UART3_TX'''| '''5<span style="color:#FF0000">PI9</span>'''|'''<span style="color:#FF0000">265</span>'''|-| '''630'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26932'''| '''PI13PWM1'''| '''PWM3/UART4_TXPI11'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224267'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''1236'''
| style="text-align: left;"|
| '''PI1PC12'''| '''25776'''
|-
| '''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>i2c is turned off by default in Linux systems and needs to be turned on manually to use it. The opening steps are as follows: </p>
<ol style="list-style-type: lower-alpha;">
<li><p>First run '''orangepi-config'''. Ordinary users remember to add '''sudo''' permissions.</p>
{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''261sudo orangepi-config'''</p>| '''PI5'''}| '''TWI0_SCL</UART2_TX'''li>| <li><p>Then select '''15System'''</p>|<p>[[File:zero2w-img80.png]]</p></li>| <li><p>Then select '''16Hardware'''</p>| '''PWM4<p>[[File:zero2w-img81.png]]</p></UART4_RX'''li>| <li><p>Then use the keyboard's arrow keys to locate the position shown in the picture below, and then use the ''PI14'''| '''270space'''to select the corresponding i2c configuration in the picture below.</p></li>|-{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|| '''3.3V'''| '''17'''|| '''18'''| style="text-align: leftcenter;"|| '''PH4'''| '''228'''
|-
| '''231Multiplexing function in 40pin'''| '''PH7Corresponding dtbo configuration'''| '''SPI1_MOSI'''| '''19'''|| '''20'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''23240pin - i2c0'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''TWI0_SDA/UART2_RX'''| '''PI6'''| '''262pi-i2c0'''
|-
| '''23040pin - i2c1'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229pi-i2c1'''
|-
|-
| '''266'''| <p>orangepi@orangepi:~$ '''PI10ls /dev/i2c-*'''</p>| <p>'''TWI2/dev/i2c-SDA/UART3_RX'''| '''27*'''</p>|}{| '''28'''| '''TWI2class="wikitable" style="background-SCL/UART3_TX'''| '''PI9'''| '''265'''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> <ol style="list-style-type: lower-alpha;"><li><p>'''256First run the following command to check the corresponding relationship of i2c'''</p><p>orangepi@orangepizero2w:~$ '''ls /sys/devices/platform/soc*/*/i2c-* | grep "i2c-[0-9]"'''</p><p>/sys/devices/platform/soc/5002000.i2c/i2c-0:</p><p>/sys/devices/platform/soc/5002400.i2c/i2c-3:</p><p>/sys/devices/platform/soc/5002800.i2c/i2c-4:</p><p>/sys/devices/platform/soc/5002c00.i2c/i2c-5:</p><p>/sys/devices/platform/soc/6000000.hdmi/i2c-2:</p><p>/sys/devices/platform/soc/7081400.i2c/i2c-1:</p></li> <li><p>'''PI0In 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="textlist-style-type: decimal;"><li><p>Then start testing i2c, first install i2c-aligntools</p>{| class="wikitable" style="width: left800px;"|-|<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 '''29i2cdetect -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>'''30Note 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>'''GNDDifferent i2c device addresses are different. The 0x50 address in the picture below is just an example. Please refer to what you actually see.'''</p></big>| }<div class="figure"> [[File:zero2w-img174.png]] </div></li></ol> <span id="pin-uart-test"></span> === 40pin UART test === # As can be seen from the table below, the available uarts are uart2, uart3, uart4 and uart5. Please note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial port. <div style="text-aligndisplay: leftflex;"|>::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: leftcenter;"|
|-
| '''271GPIO NO.'''| '''PI15'''| style="text-align: left;"|| '''31'''|| '''32'''| '''PWM1GPIO'''| '''PI11Function'''| '''267pin'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-
| '''264'''
| '''PI8'''
| '''TWI1-SDA'''
| '''3'''
|-
| '''263'''
| '''PI7'''
| '''TWI1-SCL'''
| '''5'''
|-
| '''269'''
| '''PI13'''
| '''PWM3/UART4_TX'''
| '''7'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''PC12GND'''| '''769'''|-| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-| '''261'''| '''PI5'''| '''TWI0_SCL/UART2_TX'''| '''15'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''PI43.3V'''| '''26017'''|-| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|-| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''25'''|-| '''266'''| '''PI10'''| '''TWI2-SDA/UART3_RX'''| '''27'''|-| '''256'''| '''PI0'''| style="text-align: left;"|| '''29'''|-| '''271'''| '''PI15'''| style="text-align: left;"|| '''31'''|-| '''268'''| '''PI12'''| '''PWM2'''| '''33'''|-| '''258'''| '''PI2'''| style="text-align: left;"|| '''35'''|-| '''272'''| '''PI16'''| style="text-align: left;"|| '''37'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''40pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|
| style="text-align: left;"|
|-| '''PI34'''| '''2595V'''|} <ol startstyle="2text-align: left;" || style="listtext-style-typealign: decimalleft;">||-| '''6'''<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>| '''GND'''<ol | style="listtext-align: left;"|| style="text-typealign: lower-alphaleft;">||-<li><p>First run | '''orangepi-config8'''. Ordinary users remember to add > | '''sudoUART0_TX''' permissions.</p><p>orangepi@orangepi:~$ | '''sudo orangepi-configPH0'''</p></li><li><p>Then select | '''System224'''</p><p>[[File:zero2w|-img80.png]]</p></li><li><p>Then select | '''Hardware10'''</p><p>[[File:zero2w-img81.png]]</p></li>| '''UART0_RX'''<li><p>Then use the keyboard| '''PH1'''s arrow keys to locate the position shown > in the figure below, and then use the | '''space225''' to select the > configuration corresponding to the pwm you want to open.</p><p>[[File:zero2w|-img176.png]]</p></li><li><p>Then select | '''<Save>12''' to save</p><p>[[File| style="text-align:zero2w-img83.png]]</p></li>left;"|<li><p>Then select | '''<Back>PI1'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select | '''<Reboot>257''' to restart the system to make the > configuration take effect.</p><p>[[File:zero2w|-img85.png]]</p></li></ol></li>| '''14'''<li><p>After restarting, you can start the PWM test</p><p>| '''Please execute the following commands under the root user.GND'''</p><ol | style="listtext-align: left;"|| style="text-typealign: lower-alphaleft;">|<li><p>Enter the following command on the command line to make pwm1 > output a 50Hz square wave</p>|-<p>root@orangepi:~# | '''echo 1 > /sys/class/pwm/pwmchip0/export16'''</p><p>root@orangepi:~# | '''echo 20000000 > /sys/class/pwm/pwmchip0/pwm1PWM4/periodUART4_RX'''</p><p>root@orangepi:~# | '''echo 1000000 > /sys/class/pwm/pwmchip0/pwm1/duty_cyclePI14'''</p><p>root@orangepi:~# | '''echo 1 > /sys/class/pwm/pwmchip0/pwm1/enable270'''</p></li><li><p>Enter the following command on the command line to make pwm2 > output a 50Hz square wave</p></li></ol>|-</li></ol>| '''18'''| style="text-align: left;"|root@orangepi:~# | '''echo 2 > /sys/class/pwm/pwmchip0/exportPH4''' root@orangepi:~# | '''echo 20000000 > /sys/class/pwm/pwmchip0/pwm2/period228'''|-root@orangepi:~# | '''echo 1000000 > /sys/class/pwm/pwmchip0/pwm2/duty_cycle20''' root@orangepi:~# | '''echo 1 > /sys/class/pwm/pwmchip0/pwm2/enableGND''' <ol start| style="3text-align: left;" || style="listtext-style-typealign: lower-alphaleft;">|<li>Enter the following command on the command line to make pwm3 output > a 50Hz square wave</li></ol>|-| '''22'''root@orangepi:~# | '''echo 3 > TWI0_SDA/sys/class/pwm/pwmchip0/exportUART2_RX'''| '''PI6'''root@orangepi:~# | '''echo 20000000 > /sys/class/pwm/pwmchip0/pwm3/period262'''|-root@orangepi:~# | '''echo 1000000 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle24'''| '''SPI1_CS0'''root@orangepi:~# | '''echo 1 > /sys/class/pwm/pwmchip0/pwm3/enablePH5'''| '''229'''<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></ol>| '''26'''| '''SPI1_CS1'''root@orangepi:~# | '''echo 4 > /sys/class/pwm/pwmchip0/exportPH9''' root@orangepi:~# | '''echo 20000000 > /sys/class/pwm/pwmchip0/pwm4/period233'''|-root@orangepi:~# | '''echo 1000000 > /sys/class/pwm/pwmchip0/pwm4/duty_cycle28''' root@orangepi:~# | '''echo 1 > TWI2-SCL/sys/class/pwm/pwmchip0/pwm4/enableUART3_TX'''| '''PI9'''<div class="figure">| '''265''' [[File:zero2w|-img177.png]]| '''30'''</div>| '''GND'''<span id| style="howtext-to-install-and-use-wiringop-pythonalign: left;"></span>|| style== How to install and use wiringOP"text-Python ==align: left;"||-| '''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.32'''| '''PWM1'''| '''PI11'''| ''wiringOP-Python is the Python language version of wiringOP library, used to operate the development board's GPIO, I2C, SPI, UART and other hardware resources in the Python program267'''|-| '''Also please note that all the following commands are operated under the root user.34'''| '''GND'''<span id| style="howtext-toalign: left;"|| style="text-install-wiringop-pythonalign: left;"></span>|=== How to install wiringOP|-Python ===| '''36'''<ol | style="list-styletext-typealign: decimalleft;">|<li><p>First install dependency packages</p><p>root@orangepi:~# | '''sudo apt-get updatePC12'''</p><p>root@orangepi:~# | '''sudo apt-get -y install git swig python3-dev python3-setuptools76'''</p></li><li><p>Then use the following command to download the source code of wiringOP|-Python</p></li></ol> | '''Note that the following git clone--recursive command will automatically download the source code of wiringOP, because wiringOP-Python depends on wiringOP. Please make sure there are no errors during the download process due to network problems.38''' If there is a problem downloading the code from GitHub, you can directly use the wiringOP| style="text-Python source code that comes with the Linux image. The storage location isalign: left;"|| '''PI4'/usr/src/wiringOP-Python''| '''260'''|-root@orangepi:~# | '''40'''git clone | style="text--recursive httpsalign://github.com/orangepi-xunlong/wiringOP-Python -b nextleft;"|| '''PI3''' root@orangepi:~# | '''cd wiringOP-Python259'''|}</div>
# Do not make changes to this file unless you know what you As can be seen from the following table, the available pwm are doing--modifypwm1, pwm2, pwm3 and pwm4.
|-
| '''GPIO NO.261'''| '''GPIOPI5'''| '''FunctionTWI0_SCL/UART2_TX'''| '''Pin'''|| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.15'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''117'''|-| '''2231'''| '''5VPH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|-| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''25'''
|-
| '''266'''
| '''PI10'''
| '''TWI2-SDA/UART3_RX'''
| '''27'''
|-
| '''264256'''| '''PI8'''| '''TWI1-SDA'''| '''3'''|| '''4'''| '''5VPI0'''
| 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>'''
|-
| '''263258'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|| '''6'''| '''GNDPI2'''
| style="text-align: left;"|
| '''35'''
|-
| '''272'''
| '''PI16'''
| style="text-align: left;"|
|-
| 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'''
| '''225'''
|-
| '''12'''
| style="text-align: left;"|
| '''257'''
|-
| '''14'''
| '''GND'''
| style="text-align: left;"|
|-
| '''261'''| '''PI5'''| '''TWI0_SCL<span style="color:#FF0000">16</UART2_TX'''| '''15'''|| '''16span>'''| '''<span style="color:#FF0000">PWM4</span>/UART4_RX'''| '''<span style="color:#FF0000">PI14</span>'''| '''<span style="color:#FF0000">270</span>'''
|-
| '''18'''
| style="text-align: left;"|
| '''228'''
|-
| '''20'''
| '''GND'''
| style="text-align: left;"|
|-
| '''PI6'''
| '''262'''
|-
| '''24'''
| '''SPI1_CS0'''
| '''229'''
|-
| '''26'''
| '''SPI1_CS1'''
| '''233'''
|-
| '''28'''
| '''TWI2-SCL/UART3_TX'''
| '''265'''
|-
| '''30'''
| '''GND'''
| style="text-align: left;"|
|-
| '''271'''| '''PI15'''| <span style="text-aligncolor: left;#FF0000"|| '''31'''|| '''>32</span>'''| '''<span style="color:#FF0000">PWM1</span>'''| '''<span style="color:#FF0000">PI11</span>'''| '''<span style="color:#FF0000">267</span>'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
|-
| '''36'''
| style="text-align: left;"|
| '''76'''
|-
| '''38'''
| style="text-align: left;"|
| '''260'''
|-
| '''40'''
| style="text-align: left;"|
| '''259'''
|}
</div>
<ol start="2" style="list-style-type: decimal;">
<li><p>In Linux systems, spi1 pwm is turned off by default in Linux systems and needs to be turned on manually before to use it can be used. The opening steps are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First run '''orangepi-config'''. Ordinary users remember to add > '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li><li><p>Then select '''System'''</p><p>[[File:zero2w-img80.png]]</p></li>
<li><p>Then select '''Hardware'''</p>
<p>[[File:zero2w-img81.png]]</p></li>
<li><p>Then use the keyboard's arrow keys to locate the position shown > in the figure below, and then use the '''space''' to select the > dtbo configuration of corresponding to the SPI pwm you want to open.</p></lip>[[File:zero2w-img176.png]]</olp></li></ol> {| class="wikitable"|-| '''dtbo configuration'''| '''illustrate'''|-| '''spi1-cs0-cs1-spidev'''| '''Open cs0 and cs1 of spi1 at the same time'''|-| '''spi1-cs0-spidev'''| '''Only open cs0 of spi1'''|-| '''spi1-cs1-spidev'''| '''Only open cs1 of spi1'''|} <ol start="5" style="list-style-type: lower-alpha;">
<li><p>Then select '''<Save>''' to save</p>
<p>[[File:zero2w-img83.png]]</p></li>
<li><p>Then select '''<Back>'''</p>
<p>[[File:zero2w-img84.png]]</p></li>
<li><p>Then select '''<Reboot>''' to restart the system to make the > configuration take effect.</p>
<p>[[File:zero2w-img85.png]]</p></li></ol>
</li><!-- --li><ol p>After restarting, you can startthe PWM test</p>{| class="3wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;"><li><p>Then check whether there is a '''spidev1.x''' device node in the Linux system. If it exists, it means that the SPI1 configuration has taken effect.</p>|-<p>orangepi@orangepi:~$ '''ls /dev/spidev1*'''</p>| <p>/dev/spidev1.0 /dev/spidev1.1</pbig><p>'''Note that only when you open spi1-cs0-cs1-spidev, you will see Please execute the device nodes of following commands under the two spiroot user.'''</p></libig><li><p>Then you can use the '''spidev_test.py''' program in examples to test the SPI loopback function. The '''spidev_test.py''' program needs to specify the following two parameters:</p>|}
<ol style="list-style-type: lower-alpha;">
<li><p>Enter the following command on the command line to make pwm1 output a 50Hz square wave</p>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~# '''--channelecho 1 > /sys/class/pwm/pwmchip0/export''': Specify the channel number of SPI</p><p>root@orangepi:~# '''echo 20000000 > /lisys/class/pwm/pwmchip0/pwm1/period'''</p><li><p>root@orangepi:~# '''--portecho 1000000 > /sys/class/pwm/pwmchip0/pwm1/duty_cycle''': Specify the port number of the SPI</p><p>root@orangepi:~# '''echo 1 > /sys/class/pwm/li>pwmchip0/pwm1/enable'''</olp>|}
</li>
<li><p>Without shorting Enter the mosi and miso pins of SPI1, following command on the command line to make pwm2 output result of running spidev_test.py is as follows. You can see that the data of TX and RX are inconsistent.a 50Hz square wave</p><p/li>{| class="wikitable" style="width:800px;" |-| root@orangepi:~/wiringOP-Python# '''cd examplesecho 2 > /sys/class/pwm/pwmchip0/export'''</p></li></ol>
root@orangepi:~/wiringOP-Python/examples# '''python3 spidev_test.py \echo 20000000 > /sys/class/pwm/pwmchip0/pwm2/period'''
root@orangepi:~# '''--channel 1 --port 0echo 1000000 > /sys/class/pwm/pwmchip0/pwm2/duty_cycle'''
root@orangepi:~/wiringOP-Python/examples# '''python3 spidev_test.py \echo 1000000 > /sys/class/pwm/pwmchip0/pwm4/duty_cycle'''
root@orangepi:~# '''--channel echo 1 --port 0> /sys/class/pwm/pwmchip0/pwm4/enable'''|}
<ol style="list-style-type: decimal;"><li><p>First install dependency packages</p>{| class="wikitable" style="width:800px;"
|-
| <p>root@orangepi:~# '''GPIO NO.sudo apt-get update'''</p>| <p>root@orangepi:~# '''GPIOsudo apt-get -y install git swig python3-dev python3-setuptools'''</p>| '''Function'''}</li><li><p>Then use the following command to download the source code of wiringOP-Python</p></li>{| '''Pin'''class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''PinNote 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.'''| '''FunctionIf there is a problem downloading the code from GitHub, you can directly use the wiringOP-Python source code that comes with the Linux image. The storage location is: /usr/src/wiringOP-Python'''</big>| '''GPIO'''}{| '''GPIO NO.'''class="wikitable" style="width:800px;"
|-
|-
| '''264'''| <p>root@orangepi:~# '''PI8cd wiringOP-Python'''</p>| <p>root@orangepi:~/wiringOP-Python# '''TWI1python3 generate-SDAbindings.py > bindings.i'''</p>| <p>root@orangepi:~/wiringOP-Python# '''3sudo python3 setup.py install'''</p>|}| '''4'''</li>| <li><p>Then enter the following command. If helpful information is output, it means wiringOP-Python is successfully installed. Press the '''5Vq'''key to exit the help information interface.</p></li>{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| root@orangepi:~/wiringOP-Python# '''263python3 -c "import wiringpi; help(wiringpi)"'''| '''PI7'''| '''TWI1Help 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--SCL'''modify| '''5'''|: # the SWIG interface file instead.| '''6'''}| '''GND'''</ol>| <ol start="5" style="textlist-style-aligntype: leftdecimal;"|><li><p>The steps to test whether wiringOP-Python is installed successfully under the python command line are as follows:</p>| <ol style="textlist-style-aligntype: leftlower-alpha;"|>|-| '''269'''| '''PI13'''| '''PWM3<li>First use the python3 command to enter the command line mode of > python3</UART4_TX'''li>{| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224'''class="wikitable" style="width:800px;"
|-
| root@orangepi:~# '''python3'''|}</ol><ol start="2" style="textlist-alignstyle-type: leftlower-alpha;"|><li>Then import the python module of wiringpi</li>{| class="wikitable" style="text-alignwidth: left800px;"|| '''GND'''| '''9'''|| '''10'''| '''UART0_RX'''| '''PH1'''| '''225'''
|-
| '''226'''| >>> '''PH2'''| '''UART5_TXimport wiringpi;'''| '''11'''}|</ol>| '''12'''| <ol start="3" style="textlist-alignstyle-type: leftlower-alpha;"|>| '''PI1'''<li>Finally, enter the following command to view the help information of > wiringOP-Python. Press the q key to exit the help information > interface.</li>{| '''257'''class="wikitable" style="width:800px;"
|-
| >>> '''227help(wiringpi)''' 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) :| '''PH3'''GPIO(pinmode=0) :| '''UART5_RX'''| '''13''' >>>|}| '''14'''</ol>| '''GND'''</li></ol>| style<span id="textpin-gpio-port-test-align: left;1"|></span> === 40pin GPIO port test === {| class="wikitable" style="textbackground-aligncolor: left#ffffdc;width:800px;"|
|-
| '''261'''| <big>'''PI5Like 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.'''TWI0_SCL</UART2_TX'''big> [[File:zero2w-img170.png| '''15'''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>| '''16'''<p>[[File:zero2w-img171.png]]</p></li>| '''PWM4<li><p>The steps for testing directly with commands are as follows:</UART4_RX'''p><ol style="list-style-type: lower-alpha;">| <li><p>First set the GPIO port to output mode, where the first parameter of the '''PI14pinMode'''function is the serial number of the wPi corresponding to the pin, and the second parameter is the GPIO mode.</p>{| '''270'''class="wikitable" style="width:800px;"
|-
| style="text-align<p>root@orangepi: left;"|| style="text~/wiringOP-align: left;"|| Python# '''3.3Vpython3 -c "import wiringpi; \'''</p>| <p>'''17from wiringpi import GPIO; wiringpi.wiringPiSetup() ; \'''</p>|| <p>'''18wiringpi.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="wikitable" style="text-alignwidth: left800px;"|| '''PH4'''| '''228'''
|-
| '''231'''| <p>root@orangepi:~/wiringOP-Python# '''PH7python3 -c "import wiringpi; \'''</p>| <p>'''SPI1_MOSIfrom wiringpi import GPIO; wiringpi.wiringPiSetup() ;\'''</p>| <p>'''19wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.LOW</span>)"'''</p>|}| '''20'''</li>| '''GND'''<li><p>Then set the GPIO port to output a high level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 3.3v, it means the setting of the high level is successful.</p>{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| <p>root@orangepi:~/wiringOP-Python# '''232python3 -c "import wiringpi; \'''</p>| <p>'''PH8from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\'''</p>| <p>'''SPI1_MISOwiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.HIGH</span>)"'''</p>| '''21'''}|</li></ol>| '''22'''</li>| '''TWI0_SDA<li><p>The steps for testing in the command line of python3 are as follows:</UART2_RX'''p><ol style="list-style-type: lower-alpha;">| '''PI6'''<li><p>First use the python3 command to enter the command line mode of python3</p>{| '''262'''class="wikitable" style="width:800px;"
|-
| '''230'''| <p>root@orangepi:~# '''PH6python3'''</p>| '''SPI1_CLK'''}| '''23'''</li>|<li><p>Then import the python module of wiringpi</p>{| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''class="wikitable" style="width:800px;"
|-
| style="text-align: left<p>>>"|| style="text-align: left>"|| '''GNDimport wiringpi'''</p>| <p>>>> '''25from wiringpi import GPIO'''</p>|}| '''26'''</li>| <li><p>Then set the GPIO port to output mode, where the first parameter of the '''SPI1_CS1pinMode'''function is the serial number of the wPi corresponding to the pin, and the second parameter is the GPIO mode.</p>{| '''PH9'''| '''233'''class="wikitable" style="width:800px;"
|-
| '''266'''| <p>>>> '''PI10wiringpi.wiringPiSetup()'''</p>| '''TWI2-SDA<p>0</UART3_RX'''p>| <p>>>> '''27wiringpi.pinMode(<span style="color:#FF0000">2, GPIO.OUTPUT</span>)'''</p>|}| '''28'''</li>| '''TWI2-SCL<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.</UART3_TX'''p>{| '''PI9'''| '''265'''class="wikitable" style="width:800px;"
|-
| '''256'''| ''<p>>>> 'PI0'''| wiringpi.digitalWrite(2, <span style="text-aligncolor: left;#FF0000"|| '''29>GPIO.LOW</span>)'''</p>|}| '''30'''</li>| '''GND'''<li><p>Then set the GPIO port to output a high level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 3.3v, it means the setting of the high level is successful.</p>{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| <p>>>> '''271wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.HIGH</span>)'''</p>| }</li></ol></li><li><p>For wiringOP-Python to set the GPIO high and low levels in the python code, you can refer to the '''PI15blink.py'''test program in the examples. The '''blink.py''' test program will set the voltage of all GPIO ports in the 40 Pin of the development board to continuously change high and low.</p>{| class="wikitable" style="text-alignwidth: left800px;"|-| <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'''31# python3 blink.py'''</p>|}</li></ol> <span id="pin-spi-test-1"></span> === 40pin SPI test === # As can be seen from the table below, the spi available for the 40pin interface is spi1, and there are two chip select pins cs0 and cs1 <div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''32GPIO NO.'''| '''PWM1GPIO'''| '''PI11Function'''| '''267Pin'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-
| '''258264'''| '''PI2PI8'''| style="text'''TWI1-align: left;"|SDA'''| '''353'''|-| '''36263'''| style="text-align: left;"|'''PI7'''| '''PC12TWI1-SCL'''| '''765'''
|-
| '''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'''|-| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''4013'''| style="text-align: left;"|'''261'''| '''PI3PI5'''| '''259TWI0_SCL/UART2_TX'''|}'''15'''|-<ol start="2" | style="listtext-style-typealign: decimalleft;">|<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-alphaleft;">|<li><p>First run | '''3.3V'''orangepi-config| '''. Ordinary users remember to add > 17'''sudo|-| ''' permissions.</pspan style="color:#FF0000">231<p/span>orangepi@orangepi:~$ '''sudo orangepi-config| '''</pspan style="color:#FF0000">PH7</lispan>'''| '''<lispan style="color:#FF0000">SPI1_MOSI<p/span>Then select '''System| '''</p><p>[[Filespan style="color:zero2w-img80.png]]</p#FF0000">19</lispan>'''|-| '''<lispan style="color:#FF0000">232<p/span>Then select '''Hardware| '''</p><p>[[Filespan style="color:zero2w-img81.png]]</p#FF0000">PH8</li><li><pspan>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.</pspan style="color:#FF0000">SPI1_MISO</li></olspan>'''| '''</lispan style="color:#FF0000">21</olspan> {| class="wikitable"'''
|-
| '''Multiplexing function in 40pin<span style="color:#FF0000">230</span>'''| '''Corresponding dtbo configuration<span style="color:#FF0000">PH6</span>'''| '''<span style="color:#FF0000">SPI1_CLK</span>'''| '''<span style="color:#FF0000">23</span>'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''40pin - i2c0GND'''| '''pi-i2c025'''
|-
| '''40pin 266'''| '''PI10'''| '''TWI2- i2c1SDA/UART3_RX'''| '''pi-i2c127'''
|-
| '''40pin - i2c2256'''| '''pi-i2c2PI0'''|} [[File:zero2w-img173.png]] <ol start="5" style="listtext-style-typealign: lower-alphaleft;"><li><p>Then select <span class="mark"><Save></span> to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select <span class="mark"><Back></span></p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select <span class="mark"><Reboot></span> to restart the system to make the > configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol> <!-- --><ol start="3" style="list-style-type: decimal;"><li><p>After starting the Linux system, first confirm that there is an open i2c device node under <span class="mark">/dev</span></p><p>orangepi@orangepi:~$ '''ls /dev/i2c-*'''</p><p>'''/dev/i2c-*'''</p><p>'''Sometimes the i2c device node and the i2c bus serial number do not correspond one to one. For example, the i2c device node of the i2c1 bus may be /dev/i2c-3.'''</p><p>'''The method to accurately confirm the device node under /dev corresponding to the i2c bus is:'''</p></li></ol>|<!-- --><ol start="3" style="list-style-type: lower-alpha;"><li><p>'''First run the following command to check the corresponding relationship of i2c'''</p><p>orangepi@orangepizero2w:~$ '''ls /sys/devices/platform/soc*/*/i2c-* | grep "i2c-[0-9]"'''</p><p>/sys/devices/platform/soc/5002000.i2c/i2c-0:</p><p>/sys/devices/platform/soc/5002400.i2c/i2c-3:</p><p>/sys/devices/platform/soc/5002800.i2c/i2c-4:</p><p>/sys/devices/platform/soc/5002c00.i2c/i2c-5:</p><p>/sys/devices/platform/soc/6000000.hdmi/i2c-2:</p><p>/sys/devices/platform/soc/7081400.i2c/i2c-1:</p></li><li><p>29'''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>'''"/dev/i2c-x"'''</p><p>Thu 2022-06-16 04:35:46</p><p>Thu 2022-06-16 04:35:47</p><p>Thu 2022-06-16 04:35:48</p><p>^C</p><p>exit</p></li></ol> <span id="pin-uart-test-1"></span>=== 40pin UART test === # As can be seen from the table below, the available uarts are uart2, uart3, uart4 and uart5. Please note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial port. {| class="wikitable"
|-
| '''GPIO NO.271'''| '''GPIOPI15'''| style="text-align: left;"|| '''31'''|-| '''268'''| '''PI12'''| '''FunctionPWM2'''| '''Pin33'''|-| '''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;"|
|-
| '''4'''
| '''5V'''
| style="text-align: left;"|
|-
| '''6'''
| '''GND'''
| style="text-align: left;"|
|-
| '''8'''
| '''UART0_TX'''
| '''224'''
|-
| '''10'''
| '''UART0_RX'''
| '''225'''
|-
| '''12'''
| style="text-align: left;"|
| '''257'''
|-
| '''14'''
| '''GND'''
| style="text-align: left;"|
|-
| '''16'''
| '''PWM4/UART4_RX'''
| '''270'''
|-
| style="text-align: left;"|
| '''PH4'''
| '''228'''
|-
| '''20'''
| '''GND'''
| style="text-align: left;"|
|-
| '''22'''
| '''TWI0_SDA/UART2_RX'''
| '''262'''
|-
| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''<span style="color:#FF0000">24</span>'''| '''<span style="color:#FF0000">SPI1_CS0</span>'''| '''<span style="color:#FF0000">PH5</span>'''| '''<span style="color:#FF0000">229</span>'''
|-
| '''<span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"|| '''GND'''| '''25'''|| '''>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'''
| '''265'''
|-
| '''30'''
| '''GND'''
| style="text-align: left;"|
|-
| '''32'''
| '''PWM1'''
| '''267'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
|-
| '''36'''
| style="text-align: left;"|
| '''76'''
|-
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| '''40'''
| style="text-align: left;"|
| '''259'''
|}
</div>
<ol start="2" style="list-style-type: decimal;">
<li><p>In Linux systems, uart spi1 is turned off by default and needs to be turned on manually before it can be used. The opening steps are as follows:: </p>
<ol style="list-style-type: lower-alpha;">
<li><p>First run '''orangepi-config'''. Ordinary users remember to add > '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li>
<li><p>Then select '''System'''</p>
<p>[[File:zero2w-img80.png]]</p></li>
<li><p>Then select '''Hardware'''</p>
<p>[[File:zero2w-img81.png]]</p></li>
<li><p>Then use the keyboard's arrow keys to locate the position shown > in the picture figure below, and then use the '''space''' to select the > serial port dtbo configuration of the SPI you want to open.</p></li></ol></li></ol>
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''Multiplexing function in 40pindtbo configuration'''| '''Corresponding dtbo configurationillustrate'''
|-
| '''40pin spi1- uart2cs0-cs1-spidev'''| '''pi-uart2Open cs0 and cs1 of spi1 at the same time'''
|-
| '''40pin spi1- uart3cs0-spidev'''| '''pi-uart3Only open cs0 of spi1'''
|-
| '''40pin spi1- uart4'''| '''pics1-uart4spidev'''|-| '''40pin - uart5'''| '''ph-uart5Only open cs1 of spi1'''
|}
<ol start="5" style="list-style-type: lower-alpha;">
<li><p>Then select '''<Save>''' to save</p>
<li><p>Then select '''<Back>'''</p>
<p>[[File:zero2w-img84.png]]</p></li>
<li><p>Then select '''<Reboot>''' to restart the system to make the > configuration take effect.</p>
<p>[[File:zero2w-img85.png]]</p></li></ol>
</li></ol>
<!-- -->
<ol start="3" style="list-style-type: decimal;">
<li><p>After entering the Linux system, first confirm Then check whether there is a uart5 device node under '''<span class="mark">/dev</span>spidev1.x'''</p><p>'''注意device node in the Linux system. If it exists, linux5.4系统为/dev/ttyASxit means that the SPI1 configuration has taken effect.'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''ls /dev/ttySspidev1*'''</p><p>/dev/ttySxspidev1.0 /dev/spidev1.1</p></li>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <libig><p>Then start testing the uart interface. First use Dupont wire to short'''Note that only when you open spi1-cs0-cs1-circuit spidev, you will see the rx and tx pins device nodes of the uart interface to be testedtwo spi.'''</p></big>|}</li><li><p>Use Then you can use the '''gpiospidev_test.py''' command program in wiringOP examples to test the SPI loopback function of the serial port as shown below. If you can see the following print, it means the serial port communication is normalThe '''spidev_test.</p><p>py'''Note that the last x in the gpio serial /dev/ttySx command program needs to be replaced with specify the serial number of the corresponding uart device node.'''following two parameters:</p><p>orangepi@orangepiol style="list-style-type:~$ '''gpio serial /dev/ttySx # linuxlower-6.1 test command'''alpha;"></pli><p>orangepi@orangepi:~$ '''gpio serial /dev/ttyASx # linux-5.4 test command-channel''': Specify the channel number of SPI</p><p>Out: 0: -> 0</pli><pli>Out: 1: -> 1</p><p>Out'''--port''': 2: -> 2Specify the port number of the SPI</p><p/li>Out: 3: -> 3^C</pol></li><li><p>FinallyWithout shorting the mosi and miso pins of SPI1, you can run the '''serialTestoutput result of running spidev_test.py''' program in examples to test the loopback function of the serial portis as follows. If you You can see the following print, it means that the serial port loopback test is normaldata of TX and RX are inconsistent.</p><p>'''Note that the x in /dev/ttySx or /dev/ttyASx in the command needs to be replaced with the serial number of the corresponding uart device node.'''</p>{| class="wikitable" style="width:800px;" |-|
<p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p>
TX | FF FF FF FF FF FF '''<ol span style="list-style-typecolor: decimal;#FF0000"><li><p>First install the dependency packages needed to compile Python</p><p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y build-essential zlib1g-dev \'''</p><p>'''libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev \'''40 00 00 00 00 95</p><pspan>'''libreadline-dev libffi-dev curl libbz2-dev'''</p></li><li><p>Then download the latest version of Python3FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |.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>…|
RX | FF FF FF FF FF FF '''<span style="color:#FF0000">40 00 00 00 00 95</span>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…||}</li></ol><span id="how-to-replace-pippin-sourcei2c-intest-python1"></span>=== How to replace pip source in Python ===
<span iddiv style="how-to-install-dockerdisplay: flex;"></span>::{| class="wikitable" style= How to install Docker == The Linux image provided by Orange Pi has Docker pre"width:390px;margin-installed, but the Docker service is not turned on by default. Use the right: 20px;text-align: center;"|-| '''enable_dockerGPIO NO.sh''' script to enable the docker service, and then you can start using the docker command, and the docker service will be automatically started the next time you start the system. orangepi@orangepi:~$ | '''enable_docker.shGPIO''' You can use the following command to test docker. If | '''hello-worldFunction''' can be run, docker can be used normally. orangepi@orangepi:~$ | '''docker run hello-worldPin'''|-Unable to find image 'hello| style="text-worldalign:latest' locallyleft;"| latest: Pulling from library/hello| style="text-world 256ab8fe8778align: Pull complete Digest: sha256:7f0a9f93b4aa3022c3a4c147a449ef11e0941a1fd0bf4a8e6c9408b2600777c5 Status: Downloaded newer image for hello-world:latestleft;"|| '''Hello from Docker!3.3V''' | '''This message shows that your installation appears to be working correctly.1'''|-| '''.….<span style="color:#FF0000">264</span>''' When using the docker command, if you are prompted for | '''permission denied''', please add the current user to the docker user group so that you can run the docker command without sudo. orangepi@orangepi<span style="color:~$ '''sudo usermod -aG docker $USER#FF0000">PI8</span>''' '''Note: You need to log out and log in again to the system to take effect. You can also restart the system.| ''' <span idstyle="how-to-install-home-assistantcolor:#FF0000">TWI1-SDA</span>== How to install Home Assistant == '''Note that this article will only provide methods for installing Home Assistant in Ubuntu or Debian systems. For detailed usage of Home Assistant, please refer to the official documentation or corresponding books.'| ''' <span idstyle="installation-via-dockercolor:#FF0000">3</span>'''=== Installation via docker ===|-| '''<ol span style="list-style-typecolor: decimal;#FF0000">263<li/span><p>First, please install docker and ensure that docker can run normally. For the installation steps of docker, please refer to the instructions in the [[\l|'''How to Install Docker| ''']] section.</pspan style="color:#FF0000">v</lispan>'''| '''<lispan style="color:#FF0000"><p>Then you can search for the docker image of Home AssistantTWI1-SCL</p><pspan>orangepi@orangepi:~$ '''docker search homeassistant| '''</pspan style="color:#FF0000">5</lispan>'''<li><p>Then use the following command to download the Docker image of Home Assistant to your local computer. The image size is about 1GB, and the download time will be relatively long. Please be patient and wait for the download to complete.</p>|-<p>orangepi@orangepi:~$ | '''docker pull homeassistant/home-assistant269'''</p><p>Using default tag: latest</p>| '''PI13'''<p>latest: Pulling from homeassistant| '''PWM3/home-assistant</p>UART4_TX'''<p>be307f383ecc: Downloading</p><p>5fbc4c07ac88: Download complete</p><p>'''...... (Omit some output)| '''7'''</p><p>3cc6a1510c9f|-| style="text-align: Pull complete</p>left;"|<p>7a4e4d5b979f| style="text-align: Pull complete</p>left;"|<p>Digest: sha256:81d381f5008c082a37da97d8b08dd8b358dae7ecf49e62ce3ef1eeaefc4381bb</p>| '''GND'''| '''9'''<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 view the docker image of Home Assistant you just downloaded</p><p>orangepi@orangepi:~$ | '''226''docker images homeassistant/home-assistant'| '''PH2'''</p><p>REPOSITORY TAG IMAGE ID CREATED SIZE</p><p>homeassistant/home-assistant latest bfa0ab9e1cf5 2 months ago | '''1.17GBUART5_TX'''</p></li><li><p>At this point you can run the Home Assistant docker container</p>| '''11'''|-<p>orangepi@orangepi:~$ | '''docker run -d \227'''</p><p>| '''--name homeassistant \PH3'''</p><p>| '''--privileged \UART5_RX'''</p><p>| '''--restart=unless-stopped \13'''</p><p>'''|-e TZ=Asia/Shanghai \| '''</pspan style="color:#FF0000">261<p/span>'''-v /home/orangepi/home-assistant:/config \| '''</pspan style="color:#FF0000">PI5<p/span>'''--network=host \| '''</pspan style="color:#FF0000">TWI0_SCL<p/span>/UART2_TX'''homeassistant/home-assistant:latest| '''</pspan style="color:#FF0000">15</lispan>'''<li><p>Then enter【the IP address of the development board|-| style="text-align: 8123】in the browser to see the Home Assistant interface</p>left;"|<p>'''It takes a while for the Home Assistant container to start. If the interface below does not display normally, please wait a few seconds before refreshing it. If the following interface is not displayed normally after waiting for more than a minute, it means there is a problem with the Home Assistant installation. At this time, you need to check whether there is a problem with the previous installation and setting process| style="text-align: left;"|| '''3.3V'''</p><div class="figure">| '''17'''|-[[File:zero2w-img180.png]] </div></li><li><p>Then enter your | '''name, username231''' and | '''passwordPH7''' and click | '''Create AccountSPI1_MOSI'''</p><div class="figure">| '''19''' [[File:zero2w|-img181.png]]| '''232'''</div></li>| '''PH8'''<li><p>Then follow the interface prompts to set according to your own preferences, and then click Next</p>| '''SPI1_MISO'''<div class="figure">| '''21''' [[File:zero2w|-img182.png]]| '''230'''</div></li>| '''PH6'''<li><p>Then click Next</p>| '''SPI1_CLK'''<div class="figure">| '''23''' [[File:zero2w|-img183.png]] </div></li><li><p>Then click Finish</p><div class| style="figuretext-align: left;">| [[File:zero2w| style="text-img184.png]]align: left;"|| '''GND'''</div></li>| '''25'''|-| '''<lispan style="color:#FF0000"><p>The main interface finally displayed by Home Assistant is as shown below266</pspan>'''| '''<pspan style="color:#FF0000">[[File:zero2w-img185.png]]PI10</p></lispan>'''| '''<lispan style="color:#FF0000">TWI2-SDA<p/span>Method to stop Home Assistant container</p>UART3_RX'''| '''<ol span style="list-style-typecolor: lower-alpha;#FF0000"><li><p>The command to view the docker container is as follows27</pspan>'''|-<p>orangepi@orangepi:~$ | '''docker ps -a256'''</p></li><li><p>The command to stop the Home Assistant container is as follows</p>| '''PI0'''<p>orangepi@orangepi| style="text-align:~$ left;"|| '''docker stop homeassistant29'''</p></li><li><p>The command to delete the Home Assistant container is as follows</p>|-<p>orangepi@orangepi:~$ | '''docker rm homeassistant271'''</p></li></ol></li></ol>| '''PI15''' <span id| style="installationtext-via-pythonalign: left;"></span>=== Installation via python ===|| ''''Before installation, please change the source of pip to a domestic source to speed up the installation of Python packages. For the configuration method, see the instructions in the section "[[\l|How to Change the Pip Source of Python]]"31''' <ol style="list-style|-type: decimal;"><li><p>First install dependency packages</p><p>orangepi@orangepi:~$ | '''sudo apt-get update268'''</p><p>orangepi@orangepi:~$ | '''sudo apt-get install -y python3 python3-dev python3-venv \PI12'''</p><p>| '''python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \PWM2'''</p><p>| '''libopenjp2-7 libtiff5 libturbojpeg0-dev tzdata33'''</p><p>|-| '''If it is debian12, please use the following command:258'''</p><p>orangepi@orangepi:~$ | '''sudo apt-get updatePI2'''</p><p>orangepi@orangepi:~$ | style="text-align: left;"|| '''sudo apt-get install -y python3 python3-dev python3-venv \35'''</p><p>|-| '''python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \272'''</p><p>| '''libopenjp2-7 libturbojpeg0-dev tzdataPI16'''</p></li><li><p>Then you need to compile and install Python3.9. For the method, please refer to the [[\l| style="text-align: left;"||'''Python source code compilation and installation method37''']] section.</p><p>|-| style="text-align: left;"|| style="text-align: left;"|| ''''The default Python version of Debian Bullseye is Python3.9, so there is no need to compile and install it.GND'''</p><p>| '''The default Python version of Ubuntu Jammy is Python3.10, so there is no need to compile and install it.39'''</p><p>'''The default Python version of Debian Bookworm is Python3.11, so there is no need to compile and install it.|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''Pin'''</p></li><li><p>Then create a Python virtual environment</p><p>| '''Function'Debian Bookworm is python3.11, please remember to replace the corresponding command.'''</p><p>orangepi@orangepi:~$ | '''sudo mkdir /srv/homeassistantGPIO'''</p><p>orangepi@orangepi:~$ | '''sudo chown orangepi:orangepi /srv/homeassistantGPIO NO.'''</p><p>orangepi@orangepi:~$ |-| '''cd /srv/homeassistant2'''</p><p>orangepi@orangepi:~$ | '''python3.9 -m venv .5V'''</p><p>orangepi@orangepi| style="text-align: left;"|| style="text-align:~$ left;"||-| '''source bin/activate4'''</p><p>(homeassistant) orangepi@orangepi:/srv/homeassistant$</p></li><li><p>Then install the required Python packages</p><p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ | '''python3 -m pip install wheel5V'''</p></li><li><p>Then you can install Home Assistant Core</p><p>(homeassistant) orangepi@orangepi| style="text-align: left;"|| style="text-align:/srv/homeassistant$ left;"||-| '''pip3 install homeassistant6'''</p></li><li><p>Then enter the following command to run Home Assistant Core</p><p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ | '''hassGND'''</p></li><li><p>Then enter【'''development board IP address| style="text-align: left;"|| style="text-align: 8123'''】 in the browser to see the Home Assistant interface</p>left;"||-<p>| '''When you run the hass command for the first time, some libraries and dependency packages necessary for operation will be downloaded, installed and cached. This process may take several minutes. Note that you cannot see the Home Assistant interface in the browser at this time. Please wait for a while and then refresh it.8'''</p><div class="figure">| '''UART0_TX'''| '''PH0'''| '''224'''[[File:zero2w|-img180.png]]| '''10'''</div></li></ol>| '''UART0_RX'''| '''PH1'''<span id="opencv| '''225'''|-installation-method"></span>== OpenCV installation method ==| '''12''' <span id| style="usetext-apt-to-install-opencv"></span>=== Use apt to install OpenCV === <ol style="list-style-typealign: decimalleft;">|<li><p>The installation command is as follows</p>| '''PI1'''<p>orangepi@orangepi:~$ | '''sudo apt-get update257'''</p><p>orangepi@orangepi:~$ |-| '''sudo apt-get install -y libopencv-dev python3-opencv14'''</p></li><li><p>Then use the following command to print the version number of OpenCV. The output is normal, indicating that the OpenCV installation is successful.</p>| '''GND'''<ol | style="list-styletext-typealign: lower-alphaleft;">|<li><p>The version of OpenCV in Ubuntu22.04 is as follows| style="text-align:</p>left;"||-<p>orangepi@orangepi:~$ | '''python3 -c "import cv2; print(cv2.__version__)"16'''</p><p>| '''4.5.4PWM4/UART4_RX'''</p></li><li><p>The version of OpenCV in Ubuntu20.04 is as follows:</p><p>orangepi@orangepi:~$ | ''''python3 -c "import cv2; print(cv2.__version__)"PI14'''</p><p>| '''4.2.0270'''</p></li><li><p>The version of OpenCV in Debian11 is as follows:</p><p>orangepi@orangepi:~$ |-| '''18'''python3 | style="text-c "import cv2; print(cv2.__version__)"align: left;"|| '''</p><p>PH4'''4.5.1| '''228'''</p></li><li><p>The version of OpenCV in Debian12 is as follows:</p>|-<p>orangepi@orangepi:~$ | '''python3 -c "import cv2; print(cv2.__version__)"20'''</p><p>| '''4.6.0GND'''</p></li></ol></li></ol>| style="text-align: left;"|| style="text-align: left;"||-| '''<span idstyle="set-up-the-chinese-environment-and-install-the-chinese-input-method"color:#FF0000">22</span>== Set up the Chinese environment and install the Chinese input method == '''Note, before installing the Chinese input method, please make sure that the Linux system used by the development board is a desktop version.| ''' <span idstyle="debian-system-installation-methodcolor:#FF0000">TWI0_SDA</span>/UART2_RX'''=== Debian system installation method === | '''<ol span style="list-style-typecolor: decimal;#FF0000">PI6<li><p/span>First set the default '''locale| ''' to Chinese</p><ol span style="list-style-type: lower-alpha;color:#FF0000">262<li/span><p>Enter the following command to start configuring '''locale|-| '''24'''</p><p>orangepi@orangepi:~$ | '''sudo dpkg-reconfigure localesSPI1_CS0'''| '''PH5'''</p></li><li><p>Then select | '''zh_CN.UTF-8 UTF-8229''' in the pop|-up interface (use > the up and down keys on the keyboard to move up and down, use > the space bar to select, and finally use the Tab key to move > the cursor to | '''<OK>26''', and then return Car can be used)</p><p>[[File:zero2w-img186.png]]</p></li><li><p>Then set the default | '''localeSPI1_CS1''' to | '''zh_CN.UTF-8PH9'''</p><p>[[File:zero2w-img187.png]]</p></li><li><p>After exiting the interface, the | '''locale233''' setting will begin. > The output displayed on the command line is as follows:</p><p>orangepi@orangepi:~$ '''sudo dpkg|-reconfigure locales| '''<span style="color:#FF0000">28</pspan>'''| '''<pspan style="color:#FF0000">Generating locales (this might take a while)...TWI2-SCL</pspan><p>en_US.UTF-8... done</p>UART3_TX'''| '''<pspan style="color:#FF0000">zh_CN.UTF-8... donePI9</pspan>'''| '''<pspan style="color:#FF0000">Generation complete.265</p></li></olspan></li><li><p>Then open '''Input Method'''</p><p>[[File:zero2w|-img188.png]]</p></li><li><p>Then select | '''OK30'''</p><p>[[File:zero2w-img189.png]]</p></li><li><p>Then select '''Yes| '''GND'''</p><p>[[File| style="text-align:zero2w-img190.png]]</p></li>left;"|| style="text-align: left;"||-<li><p>Then select | '''fcitx32'''</p><p>[[File:zero2w-img191.png]]</p></li>| '''PWM1'''<li><p>Then select | '''OKPI11'''</p><p>[[File:zero2w-img192.png]]</p></li><li><p>'| '''Then restart the Linux system to make the configuration take effect.267'''</p></li><li><p>Then open |-| '''Fcitx configuration34'''| '''GND'''</p><p>[[File| style="text-align:zero2wleft;"|| style="text-align: left;"||-img193.png]]</p></li><li><p>Then click the + sign as shown in the picture below</p>| '''36'''<p>[[File| style="text-align:zero2wleft;"|| '''PC12'''| '''76'''|-img194.png]]</p></li><li><p>Then search '''Google Pinyin''' and click '''OK'''| '''38'''| style="text-align: left;"|| '''PI4'''| '''260'''|-| '''40'''| style="text-align: left;"|| '''PI3'''| '''259'''|}</p><div class="figure">
<ol start="2" style="list-style-type: decimal;"><li><p>i2c is turned off by default in Linux systems and needs to be turned on manually to use it. The opening steps are as follows:</p><ol style="list-style-type: lower-alpha;"><li><p>First run '''orangepi-config'''. Ordinary users remember to add '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li><li><p>Then select '''System'''</p><p>[[File:zero2w-img195img80.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>
<ol style="list-style-type: decimallower-alpha;"><li><p>First open '''Language SupportFirst run the following command to check the corresponding relationship of i2c'''</p><p>orangepi@orangepizero2w:~$ '''ls /sys/devices/platform/soc*/*/i2c-* | grep "i2c-[[File:zero2w0-img201.png]9]"'''</p><p>/sys/devices/platform/soc/5002000.i2c/i2c-0:</lip><li><p>Then find the '''Chinese (China)''' option/sys/devices/platform/soc/5002400.i2c/i2c-3:</p><p>[[File/sys/devices/platform/soc/5002800.i2c/i2c-4:zero2w-img202.png]]</p><p>/sys/devices/platform/lisoc/5002c00.i2c/i2c-5:</p><li><p>Then please use the left button of the mouse to select '''Chinese (China)''' and hold it down, then drag it up to the starting position/sys/devices/platform/soc/6000000. After dragging, the display will be as shown belowhdmi/i2c-2:</p><p>[[File/sys/devices/platform/soc/7081400.i2c/i2c-1:zero2w-img203.png]]</p></li></ol>
<li><p>'''In the above output'''</p><ol start="4" style="list-style-type: decimalnone;"><li><p>Then select '''Apply System-Wide''' to apply a) 5002000 is the Chinese settings to register base address of the entire systemi2c0 bus, and i2c-0 shown behind it is its corresponding i2c device node</p></li><li><p>[[File:zero2wb) 5002400 is the register base address of the i2c1 bus, and i2c-img204.png]]3 shown behind it is its corresponding i2c device node</p></li><li><p>Then set c) 5002800 is the register base address of the '''Keyboard input method system''' system to '''fcitx'''i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p></li></ol><p/li>[[File:zero2w-img205.png]]</pol>|}</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''Then restart the Linux system to make the configuration take effect' '''apt-get install -y i2c-tools'''</p>|}</li><li><p>After re-entering Then connect an i2c device to the system, please select '''Do not ask me again''' in i2c pin of the following interface, and then please decide according to your own preferences whether 40pin connector. Here we take the standard folder should also be updated to ChineseDS1307 RTC module as an example.</p><p>[[File:zero2w-img206img178.png]]</p></li><li><p>Then you use the '''i2cdetect -y x'''command. If the address of the connected i2c device can see be detected, it means that the desktop i2c device is displayed in Chineseconnected correctly.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''<p>'''Note that x in the i2cdetect -y x command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p>'''</big>|} [[File:zero2w-img207img179.png]]</pli></liol><ol start="7" style="list-style-type: decimal;"><li><p>Then we you can open run the '''Geanyds1307.py''' to test the Chinese input method. The opening method is as shown program in '''examples''' to read the figure belowRTC time</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>[[File:zero2w'''Note that the x in i2c-img208x in the following command needs to be replaced with the serial number of the device node corresponding to the i2c bus.png]]'''</p></libig>|}{| class="wikitable" style="width:800px;" |-| <lip>root@orangepi:~/wiringOP-Python# '''cd examples'''</p><p>After opening root@orangepi:~/wiringOP-Python/examples# '''Geanypython3 ds1307.py --device \''', the English input method is still the default. We can switch to the Chinese input method through the </p><p>'''Ctrl+Space"/dev/i2c-x"''' shortcut key, and then we can input Chinese.</p><p>[[FileThu 2022-06-16 04:35:46</p><p>Thu 2022-06-16 04:35:zero2w47</p><p>Thu 2022-06-img209.png]]16 04:35:48</p><p>^C</p><p>exit</p>|}</li></ol>
<span id="installationpin-methoduart-oftest-ubuntu-22.04-system1"></span>=== Installation method of Ubuntu 22.04 system ===
<ol startdiv style="4display: flex;">::{| class="wikitable" style="listwidth:390px;margin-styleright: 20px;text-typealign: decimalcenter;"><li><p>Then select |-| '''Apply System-WideGPIO NO.''' to apply the Chinese settings to the entire system</p><p>[[File:zero2w-img212.png]]</p></li><li><p>| '''Then restart the Linux system to make the configuration take effectGPIO'''</p></li><li><p>After re-entering the system, please select | '''Function'Do not ask me again''| ' in the following interface, and then please decide whether the standard folder should also be updated to Chinese according to your own preferences.</p>''Pin'''|-<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>| style="text-align: left;"|<p>[[File:zero2w-img207| '''3.png]]</p></li>3V'''<li><p>Then open the Fcitx5 configuration program</p>| '''1'''<p>[[File:zero2w|-img213.png]]</p></li><li><p>Then choose to use Pinyin input method</p>| '''264'''<div class="figure">| '''PI8''' [[File:zero2w| '''TWI1-img214.png]]SDA'''| '''3'''</div></li><li><p>The interface after selection is as shown below, then click OK</p>|-<p>[[File:zero2w-img215.png]]</p></li>| '''263'''<li><p>Then we can open | '''GeanyPI7''' to test the Chinese input method. The opening method is as shown in the figure below</p><p>[[File:zero2w| '''TWI1-SCL'''| '''5'''|-img208.png]]</p></li><li><p>After opening | '''269'''Geany| ''', the English input method is still the default. We can switch to the Chinese input method through the PI13'''Ctrl+Space| ''' shortcut key, and then we can enter Chinese.<PWM3/p>UART4_TX'''<p>[[File:zero2w| '''7'''|-img216.png]]</p></li></ol>| style="text-align: left;"|<span id| style="howtext-to-remotely-log-in-to-the-linux-system-desktopalign: left;"></span>|== How to remotely log in to the Linux system desktop ==| '''GND'''| '''9'''<span id="remote-login-using|-nomachine"></span>=== Remote login using NoMachine === | '''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 follows:226''' | '''https://knowledgebase.nomachine.com/DT10R00166PH2''' | '''NoMachine supports Windows, Mac, Linux, iOS and Android platforms, so we can remotely log in and control the Orange Pi development board through NoMachine on a variety of devices. The following demonstrates how to remotely log in to the Linux system desktop of the Orange Pi development board through NoMachine in Windows. For installation methods on other platforms, please refer to NoMachine's official documentation.UART5_TX''' | '''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.11''' <ol style="list|-style-type: decimal;"><li><p>First download the installation package of the NoMachine software Linux | '''arm64227''' deb version, and then install it into the Linux system of the development board</p><ol style="list-style-type: lower-alpha;">| '''PH3'''<li>Since H618 is an ARMv8 architecture SOC and the system we use is > Ubuntu or Debian, we need to download the | '''NoMachine for ARM > ARMv8 DEBUART5_RX''' installation package. The download link is as > follows:</li></ol></li></ol>| '''13'''|-| '''Note that this download link may change, please look for the Armv8/Arm64 version of the deb package.261''' [https://www.nomachine.com/download/download&id=112&s=ARM | '''https://downloads.nomachine.com/download/?id=118&distro=ARMPI5''']| '''TWI0_SCL/UART2_TX'''| '''15'''[[File:zero2w|-img217.png]] <ol start| style="2text-align: left;" || style="listtext-style-typealign: lower-alphaleft;">|| '''3.3V'''<li><p>In addition, you can also download the | '''NoMachine17''' installation > package from the official tool.</p><p>[[File:zero2w|-img218.png]]</p><p>First enter the | '''remote login software-NoMachine231''' folder</p><p>[[File:zero2w-img219.png]]</p>| '''PH7'''<p>Then download the arm64 version of the deb installation package</p>| '''SPI1_MOSI'''<p>[[File:zero2w| '''19'''|-img220.png]]</p></li><li><p>Then upload the downloaded | '''nomachine_x.x.x_x_arm64.deb232''' to the > Linux system of the development board</p></li><li><p>Then use the following command to install | '''PH8'''| '''NoMachineSPI1_MISO''' in the Linux > system of the development board</p><p>orangepi@orangepi:~$ | '''sudo dpkg -i nomachine_x.x.x_x_arm64_arm64.deb21'''</p></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></ol>| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''Note that this download link may change.23'''|-'''https| style="text-align://downloads.nomachine.com/download/?id=9''' [[File:zero2w-img221.png]]left;"|<ol start="3" | style="list-styletext-typealign: decimalleft;">|<li><p>Then install NoMachine in Windows. '| '''Please restart your computer after installation.GND'''</p></li><li><p>Then open | '''NoMachine25''' in Window</p><p>[[File:zero2w|-img222.png]]</p></li><li><p>After NoMachine is started, it will automatically scan other devices with NoMachine installed on the LAN. After entering the main interface 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 | '''OK266'''</p><p>[[File:zero2w| '''PI10'''| '''TWI2-img224.png]]<SDA/p></li>UART3_RX'''<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>| '''27'''<p>[[File:zero2w|-img225.png]]</p></li><li><p>Then click OK in the next interface.</p></li>| '''256'''| '''PI0'''<li><p>Finally you can see the desktop of the development board Linux system</p><p>[[File:zero2w-img226.png]]</p></li></ol>| style="text-align: left;"|| '''29'''<span id="remote-login-using|-vnc"></span>=== Remote login using VNC === '| '''271''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.PI15''' <ol | style="list-styletext-typealign: decimalleft;">|<li><p>First run the | '''set_vnc.sh31''' script to set up vnc, |-| '''remember to add sudo permission268'''s</p><p>orangepi@orangepi:~$ | '''sudo set_vnc.shPI12'''</p><p>You will require a password to access your desktops.</p><p>Password: | '''#Set the vnc password here, 8 charactersPWM2'''</p><p>Verify: | '''#Set the vnc password here, 8 characters33'''</p><p>Would you like to enter a view|-only password (y/n)? | '''258'''| '''nPI2'''</p><p>xauth| style="text-align: file /root/.Xauthority does not exist</p>left;"|<p>New | '''35''X' desktop is orangepi:1</p><p>Creating default startup script /root/.vnc/xstartup</p>|-<p>Starting applications specified in /root/.vnc/xstartup</p>| '''272'''<p>Log file is /root/.vnc/orangepi:1.log</p><p>Killing Xtightvnc process ID 3047</p><p>New | '''PI16'''| style="text-align: left;"|| '''37''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-styletext-typealign: lower-alphaleft;">|<li>First click Session, then select VNC, then fill in the IP > address and port of the development board, and finally click > OK to confirm.</li></ol></li></ol> <div class| style="figuretext-align: left;">|| '''GND'''[[File:zero2w-img227.png]]| '''39'''|}</div><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.png]]</p></li>| '''Pin'''<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></li></ol>| '''Function'''| '''GPIO'''[[File:zero2w-img229| '''GPIO NO.png]]''' <span id="qt-installation|-method"></span>== QT installation method ==| '''2'''| '''5V'''<ol | style="listtext-style-typealign: decimalleft;">|| style="text-align: left;"|<li><p>Use the following script to install QT5 and QT Creator</p>|-<p>orangepi@orangepi:~$ | '''install_qt.sh4'''</p></li><li><p>After installation, the QT version number will be automatically printed.</p>| '''5V'''<ol | style="listtext-align: left;"|| style="text-typealign: lower-alphaleft;">||-<li><p>The qt version that comes with Ubuntu20.04 is | '''6'5.12.8'''</p><p>orangepi@orangepi:~$ | '''install_qt.shGND'''</p><p>......</p>| style="text-align: left;"|| style="text-align: left;"|<p>QMake version 3.1</p>|-<p>Using Qt version | '''5.12.88''' in /usr/lib/aarch64-linux-gnu</p></li><li><p>The QT version that comes with Ubuntu22.04 is | '''5.15.3UART0_TX'''</p><p>orangepi@orangepi:~$ '| '''install_qt.shPH0'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version | '''5.15.3224''' in /usr/lib/aarch64-linux|-gnu</p></li><li><p>The QT version that comes with Debian11 is | '''5.15.210'''</p><p>orangepi@orangepi:~$ '| '''install_qt.shUART0_RX'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version | '''5.15.2PH1''' in /usr/lib/aarch64-linux-gnu</p></li><li><p>The QT version that comes with Debian12 is | '''5.15.8225'''</p><p>orangepi@orangepi|-| '''12'''| style="text-align:~$ left;"|| '''install_qt.shPI1'''</p><p>......</p>| '''257'''<p>QMake version 3.1</p>|-<p>Using Qt version | '''14''5.15.8'| '' in /usr/lib/aarch64-linux-gnu</p></li></ol></li><li><p>Then you can see the QT Creator startup icon in ''GND'Applications'''</p><p>[[File| style="text-align:zero2wleft;"|| style="text-img230.png]]</p>align: left;"|<p>You can also use the following command to open QT Creator</p>|-<p>orangepi@orangepi:~$ | '''qtcreator16'''</p><| '''PWM4/li>UART4_RX'''<li><p>The interface after QT Creator is opened is as follows</p>| '''PI14'''<p>[[File:zero2w-img231.png]]</p></li>| '''270'''|-<li><p>The version of QT Creator is as follows</p>| '''18'''<ol | style="list-styletext-typealign: lower-alphaleft;">|<li><p>The default version of QT Creator in | '''PH4'''| '''Ubuntu20.04228''' is as > follows</p><p>[[File:zero2w|-img232.png]]</p></li><li><p>The default version of QT Creator in | '''Ubuntu22.0420''' is as > follows</p><p>[[File:zero2w-img233.png]]</p></li><li><p>The default version of QT Creator in | '''Debian11GND''' is as follows</p><p>[[File| style="text-align:zero2w-img234.png]]</p></li>left;"|| style="text-align: left;"||-<li><p>The default version of QT Creator in | '''Debian1222''' is as follows</p><p>[[File:zero2w-img235.png]]<| '''TWI0_SDA/p></li></ol>UART2_RX'''</li>| '''PI6'''<li><p>Then set up QT</p>| '''262'''<ol style="list-style-type: lower|-alpha;"><li><p>First open | '''Help24'''->| '''About Plugins...SPI1_CS0'''.</p><p>[[File:zero2w-img236.png]]</p></li>| '''PH5'''<li><p>Then remove the check mark of | '''ClangCodeModel229'''</p><p>[[File:zero2w-img237.png]]</p></li>|-<li><p>| '''After setting up, you need to restart QT Creator26'''</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>| '''SPI1_CS1'''| '''PH9'''<p>| '''Debian12 please skip this step.233'''</p><p>[[File:zero2w|-img238.png]]</p><p>[[File:zero2w| '''28'''| '''TWI2-img239.png]]<SCL/p></li></ol>UART3_TX'''</li>| '''PI9'''<li><p>Then you can open a sample code</p>| '''265'''<p>[[File:zero2w|-img240.png]]</p></li><li><p>After clicking on the sample code, the corresponding instruction document will automatically open. You can read the instructions carefully.</p><p>[[File:zero2w-img241.png]]</p></li>| '''30'''<li><p>Then click | '''Configure ProjectGND'''</p><p>[[File| style="text-align:zero2w-img242.png]]</p></li><li><p>Then click the green triangle in the lower left corner to compile and run the sample code</p>;"|<p>[[File| style="text-align:zero2wleft;"||-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>| '''32'''<p>[[File:zero2w-img244.png]]</p></li><li><p>References</p><p>[https://wiki.qt.io/Install_Qt_5_on_Ubuntu | '''PWM1'''https://wiki.qt.io/Install_Qt_5_on_Ubuntu| '''PI11''']</p><p>[https://download.qt.io/archive/qtcreator | '''https://download.qt.io/archive/qtcreator267''']</p><p>[https://download.qt.io/archive/qt |-| '''34'''| '''https://download.qt.io/archive/qtGND''']</p></li></ol>| style="text-align: left;"|<span id| style="rostext-installation-methodalign: left;"></span>|== ROS installation method ==|-| '''36'''<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 NinjemysPC12'''| '''76'''[[File:zero2w-img245.png]] [[File:zero2w|-img246.png]] [http://docs.ros.org/ | '''http://docs.ros.org38''']| style="text-align: left;"|| '''https://wiki.ros.org/DistributionsPI4'''| '''260'''|-| '''40'''<ol start="2" | style="list-styletext-typealign: decimalleft;">|<li><p>The link to the official installation documentation of ROS 1 '| '''Noetic NinjemysPI3''' is as follows:</p><p>[http://wiki.ros.org/noetic/Installation/Ubuntu | '''http://wiki.ros.org/noetic/Installation/Ubuntu259''']|}</p></li><li><p>In the official installation documentation of ROS '''Noetic Ninjemys''', Ubuntu recommends using Ubuntu20.04, so please ensure that the system used by the development board is '''Ubuntu20.04 desktop system'''.</pdiv><p>[http://wiki.ros.org/noetic/Installation '''http://wiki.ros.org/noetic/Installation''']</p><p>[[File:zero2w-img247.png]]</p></li><li><p>Then use the script below to install ros1</p><p>orangepi@orangepi:~$ '''install_ros.sh ros1'''</p></li><li><p>Before using the ROS tool, you first need to initialize rosdep. Then when compiling the source code, you can quickly install some system dependencies and some core components in ROS.</p></li></ol> '''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.''' '''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.''' '''https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml''' '''Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml'''
<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 '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li><li><p>Then select '''ERRORSystem'''</p><p>[[File: error loading sources listzero2w-img80.png]]</p></li><li><p>Then select '''Hardware'''</p><p>[[File:zero2w-img81.png]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown in the picture below, and then use the '''space'''to select the serial port you want to open.</p></li>
{| class="wikitable" style="width:800px;text-align: center;"|-| '''The read operation timed outMultiplexing 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]]</ol><ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select '''<Save>''' to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''<Back>'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''<Reboot>''' to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol></li></ol><!-- --><ol start="3" style="list-style-type: decimal;"><li><p>After entering the Linux system, first confirm whether there is a uart5 device node under '''<span class="mark">/dev</span>'''</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''注意, linux5.4系统为/dev/ttyASx.'''</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''source 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></optli><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.</rosp>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that the last x in the gpio serial /noeticdev/setupttySx command needs to be replaced with the serial number of the corresponding uart device node.bash'''</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''gpio serial /dev/ttySx # linux-6.1 test command'''</p><p>orangepi@orangepi:~$ '''gpio serial /dev/ttyASx # linux-5.4 test command'''</p>
<ol startspan id="6" style="listhow-to-styleinstall-type: decimal;docker"><li/span><p>Then open a command line terminal window == How to install Docker == The Linux image provided by Orange Pi has Docker pre-installed, but the Docker service is not turned on by default. Use the '''desktop''', and then use the '''test_rosenable_docker.sh''' script to enable the docker service, and then you can start a small turtle routine to test whether ROS can using the docker command, and the docker service will be used normallyautomatically started the next time you start the system.</p><p>{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''test_rosenable_docker.sh'''</p></li><li><p>After running the '''test_ros.sh''' script, a small turtle as shown in the picture below will pop up.</p><p>[[File:zero2w-img248.png]]</p></li><li><p>Then please keep the terminal window you just opened at the top</p></li></ol>|}
'''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.<span style="color:#FF0000">Hello from Docker!</span>'''
'''<ol span style="list-style-typecolor: decimal;#FF0000"><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><p>orangepi@orangepi:~$ '''ls /opt/linux-headers*'''</p><p>/opt/linux-headers-xxx-sun50iw9_x.x.x_arm64.deb</p></li><li><p>Use the following command to install the deb package of the kernel header file</p><p>orangepi@orangepi:~$ '''sudo dpkg -i /opt/linux-headers*.deb'''</p></li><li><p>After This message shows that your installation, you can see the folder where the kernel header file is located under '''/usr/src'''.</p><p>orangepi@orangepi:~$ '''ls /usr/src'''</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/hello'''. After entering this directory, then use the make command appears to compile.</p><p>orangepi@orangepi:~$ '''cd /usr/src/hello/'''</p><p>orangepi@orangepi:/usr/src/hello$ '''sudo make'''</p><p>make -C /lib/modules/5.4.125/build M=/usr/src/hello modules</p><p>make[1]: Entering directory '/usr/src/linux-headers-5.4.125'</p><p>CC [M] /usr/src/hello/hello.o</p><p>Building modules, stage 2.</p><p>MODPOST 1 modules</p><p>CC [M] /usr/src/hello/hello.mod.o</p><p>LD [M] /usr/src/hello/hello.ko</p><p>make[1]: Leaving directory '/usr/src/linux-headers-5.4.125'</p></li><li><p>After compilation, the '''hello.ko''' kernel module will be generated</p><p>orangepi@orangepi:/usr/src/hello$ '''ls *.ko'''</p><p>hello.ko</p></li><li><p>Use the '''insmod''' command to insert the '''hello.ko''' kernel module into the kernel</p><p>orangepi@orangepi:/usr/src/hello$ '''sudo insmod hello.ko'''</p></li><li><p>Then use the '''demsg''' command to view the output of the '''hello.ko''' kernel module. If you can see the following output, it means that the '''hello.ko''' kernel module is loaded working correctly.</p><p>orangepi@orangepi:/usr/src/hello$ '''dmesg | grep "Hello"'''</p><p>[ 2871.893988] '''Hello Orange Pi -- init'''</p></li><li><p>Use the '''rmmod''' command to uninstall the '''hello.ko''' kernel module</p><pspan>orangepi@orangepi:/usr/src/hello$ '''sudo rmmod hello'''</p><p>orangepi@orangepi:/usr/src/hello$ '''dmesg | grep "Hello"'''</p><p>[ 2871.893988] Hello Orange Pi -- init</p><p>[ 3173.800892] '''Hello Orange Pi -- exit'''</p></li></ol>
<span id="debianinstallation-bullseyevia-systemdocker"></span>=== Debian Bullseye system Installation via docker ===
<ol style="list-style-type: decimal;">
<li><p>Debian Bullseye is installed with the gcc compilation tool chain by defaultFirst, which please install docker and ensure that docker can directly compile C language programs in run normally. For the Linux system installation steps of docker, please refer to the instructions in the development board.</p><ol style="list-style-type: lower-alpha;"><li><p>The version of a.gcc is as follows</p><p>orangepi@orangepi:~$ [[Orange Pi Zero 2W#How to install Docker|'''gcc --versionHow to Install Docker'''</p><p>gcc (Debian 10.2.1-6) 10.2.1 20210110</p><p>Copyright (C) 2020 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE]] section.</p></li><li><p>Write Then you can search for the '''hello_world.c''' program in C languagedocker image of Home Assistant</p><p>orangepi@orangepi{| class="wikitable" style="width:~$ '''vim hello_world.c'''</p><p>#include <800px;stdio.h></p>" <p>int main(void)</p><p>{</p><p>printf("Hello World!\n");</p><p>return 0;</p><p>}</p></li>|-<li><p>Then compile and run '''hello_world.c'''</p>| <p>orangepi@orangepi:~$ '''gcc -o hello_world hello_world.cdocker search homeassistant'''</p><p>orangepi@orangepi:~$ '''./hello_world'''</p><p>Hello World!</p></li></ol>|}
</li>
<li><p>Debian Bullseye has Python3 installed by defaultThen use the following command to download the Docker image of Home Assistant to your local computer. The image size is about 1GB, and the download time will be relatively long. Please be patient and wait for the download to complete.</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>The specific version of Python is as follows</p>|-| <p>orangepi@orangepi:~$ '''python3docker pull homeassistant/home-assistant'''</p><p>Using default tag: latest</p><p>latest: Pulling from homeassistant/home-assistant</p><p>be307f383ecc: Downloading</p><p>5fbc4c07ac88: Download complete</p><p>'''Python 3.9.2.... (Omit some output)''' (default, Feb 28 2021, 17</p><p>3cc6a1510c9f: Pull complete</p><p>7a4e4d5b979f: Pull complete</p><p>Digest: sha256:81d381f5008c082a37da97d8b08dd8b358dae7ecf49e62ce3ef1eeaefc4381bb</p><p>Status:03Downloaded newer image for homeassistant/home-assistant:44)latest</p><p>[GCC 10docker.2.1 20210110] on linuxio/homeassistant/home-assistant:latest</p>|}</li><li><p>Then you can use the following command to view the docker image of Home Assistant you just downloaded</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''docker images homeassistant/home-assistant'''</p><p>Type REPOSITORY "nbsp;help"nbsp; TAG IMAGE ID , "nbsp;copyrightCREATED "nbsp;, "nbsp;credits"nbsp; or "nbsp;license"nbsp; for more information.SIZE</p><p>homeassistant/home-assistant latest bfa0ab9e1cf5 2 months ago >nbsp;>nbsp;>nbsp;'''</pspan style="color:#FF0000">1.17GB<p/span>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p>|}</li><li><p>Write At this point you can run the '''hello_world.py''' program in Python languageHome Assistant docker container</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.pydocker run -d \'''</p>:<p>print('Hello World!')'--name homeassistant \'''</p>:<p>'''--privileged \'''</lip>:<p>'''--restart=unless-stopped \'''<li/p>:<p>The result of running '''hello_world.py-e TZ=Asia/Shanghai \''' is as follows</p>:<p>orangepi@orangepi:~$ '''python3 hello_world.py-v /home/orangepi/home-assistant:/config \'''</p>:<p>Hello World!'''--network=host \'''</p>:<p>'''homeassistant/li>home-assistant:latest'''</olp>|}
</li>
<li><p>Debian Bullseye does not install Java compilation tools and operating environment by default.Then enter【the IP address of the development board: 8123】in the browser to see the Home Assistant interface</p><ol {| class="wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;">|-| <libig><p>You can use '''It takes a while for the following command Home Assistant container to install openjdkstart. The latest > version in Debian Bullseye 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 openjdk-17</p><p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''</p></li><li><p>After a problem with the Home Assistant installation. At this time, you can need to check whether there is a problem with the Java versionprevious installation and setting process.</p><p>orangepi@orangepi:~$ '''java --version'''</p></libig><li><p>Write the Java version of '''hello_world.java'''</p><p>orangepi@orangepi:~$ '''vim hello_world.java'''</p>|}<p>public div class hello_world</p="figure"><p>{</p><p>public static void main(String[[File:zero2w-img180.png]] args)</p><p>{</p><p>System.out.println("Hello World!");</p><p>}</p><p>}</pdiv></li><li><p>Then compile and run enter your '''hello_world.javaname, username'''</p><p>orangepi@orangepi:~$ and '''javac hello_world.javapassword'''</p><p>orangepi@orangepi:~$ and click '''java hello_worldCreate Account'''</p><p>Hello World!</p></li></ol></li></oldiv class="figure">
<ol style="list-style-type: decimal;"/div></li><li><p>Ubuntu Focal The main interface finally displayed by Home Assistant is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development boardas shown below</p><p>[[File:zero2w-img185.png]]</p></li><li><p>Method to stop Home Assistant container</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The version of a.gcc command to view the docker container is as follows</p><p>orangepi@orangepi{| class="wikitable" style="width:~$ '''gcc --version'''</p>800px;" <p>gcc (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 '''hello_world.c''' program in C language</p>| <p>orangepi@orangepi:~$ '''vim hello_world.cdocker ps -a'''</p><p>#include <stdio.h></p><p>int main(void)</p><p>{</p><p>printf("Hello World!\n");</p><p>return 0;</p><p>|}</p></li><li><p>Then compile and run '''hello_world.c'''</p><p>orangepi@orangepi:~$ '''gcc -o hello_world hello_world.c'''</p><p>orangepi@orangepi:~$ '''./hello_world'''</p><p>Hello World!</p></li></ol>
</li>
<li><p>Ubuntu Focal has Python3 installed by defaultThe command to stop the Home Assistant container is as follows</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>The specific version of Python3 is as follows</p><p>orangepi@orangepi:~$ '''python3'''</p><p>Python 3.8.10 (default, Nov 14 2022, 12:59:47)</p><p>[GCC 9.4.0] on linux</p><p>Type "help", "copyright", "credits" or "license" for more information.</p><p>>>></p><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p></li><li><p>Write the '''hello_world.py''' program in Python language</p><p>orangepi@orangepi:~$ '''vim hello_world.py'''</p>|-<p>print('Hello World!')</p></li><li><p>The result of running '''hello_world.py''' is as follows</p>| <p>orangepi@orangepi:~$ '''python3 hello_world.pydocker stop homeassistant'''</p><p>Hello World!</p></li></ol>|}
</li>
<li><p>Ubuntu Focal does not have Java compilation tools and running environment installed by default.The command to delete the Home Assistant container is as follows</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>You can use the following command to install openjdk-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><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 '''hello_world.javadocker rm homeassistant'''</p><p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p><p>public static void main(String[] args)</p><p>{</p><p>System.out.println("Hello World!");</p><p>|}</p><p>}</p></li><li><p>Then compile and run '''hello_world.java'''</p><p>orangepi@orangepi:~$ '''javac hello_world.java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p></li></ol>
</li></ol>
<span id="ubuntuinstallation-jammyvia-systempython"></span> === Ubuntu Jammy system Installation via python ===
</li>
<li><p>Ubuntu Jammy has Then you need to compile and install Python3 installed by default.9. For the method, please refer to the [[Orange Pi Zero 2W#Python related instructions|'''Python source code compilation and installation method''']] section.</p><ol {| class="wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;">|-| <libig><p>'''The specific default Python version of Debian Bullseye is Python3 is as follows</p><p>orangepi@orangepi:~$ '''python3'''</p><p>Python 3.10.6 (main9, May 29 2023, 11:10:38) [GCC 11.3.0] on linux</p><p>Type "help", "copyright", "credits" or "license" for more information.</p><p>>>></p><p>'''Use the Ctrl+D shortcut key so there is no need to exit python's interactive modecompile and install it.'''</p></li><li><p>Write the '''hello_worldThe default Python version of Ubuntu Jammy is Python3.10, so there is no need to compile and install it.py''' program in Python language</p><p>orangepi@orangepi:~$ '''vim hello_world.py'''</p><p>print('Hello World!')</p></li><li><p>The result default Python version of running '''hello_worldDebian Bookworm is Python3.py''' 11, so there is as follows</p><p>orangepi@orangepi:~$ '''python3 hello_worldno need to compile and install it.py'''</p><p>Hello World!</p></li></olbig>|}
</li>
<li><p>Ubuntu Jammy does not install Java compilation tools and operating Then create a Python virtual environment by default.</p><ol {| class="wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;">|-| <libig><p>You can use '''Debian Bookworm is python3.11, please remember to replace the following corresponding command to install openjdk-18.'''</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-18-jdkmkdir /srv/homeassistant'''</p></li><li><p>After installation, you can check the Java version.orangepi@orangepi:~$ '''sudo chown orangepi:orangepi /srv/homeassistant'''</p><p>orangepi@orangepi:~$ '''java --versioncd /srv/homeassistant'''</p><p>openjdk 18orangepi@orangepi:~$ '''python3.09 -m venv .2-ea 2022-07-19'''</p><p>OpenJDK Runtime Environment (build 18.0.2-ea+9-Ubuntu-222.04)orangepi@orangepi:~$ '''source bin/activate'''</p><p>OpenJDK 64-Bit Server VM (build 18.0.2-ea+9-Ubuntu-222.04, mixed mode, sharinghomeassistant)orangepi@orangepi:/srv/homeassistant$</p>|}</li><li><p>Write Then install the Java version of '''hello_world.java'''required Python packages</p>{| class="wikitable" style="width:800px;" |-| <p>(homeassistant) orangepi@orangepi:~/srv/homeassistant$ '''vim hello_world.javapython3 -m pip install wheel'''</p><p>public class hello_world|}</pli><pli>{</p><p>public static void main(String[] args)Then you can install Home Assistant Core</p><p>{</p>| class="wikitable" style="width:800px;" |-| <p>System.out.println("Hello World!"homeassistant);orangepi@orangepi:/srv/homeassistant$ '''pip3 install homeassistant'''</p><p>|}</p><p>}</p></li><li><p>Then compile and enter the following command to run '''hello_world.java'''Home Assistant Core</p>{| class="wikitable" style="width:800px;" |-| <p>(homeassistant) orangepi@orangepi:~/srv/homeassistant$ '''javac hello_world.javahass'''</p>|}</li><li><p>orangepi@orangepi:~$ Then enter【'''java hello_worlddevelopment board IP address: 8123'''】 in the browser to see the Home Assistant interface</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>Hello World!'''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></libig>|}<div class="figure"> [[File:zero2w-img180.png]] </oldiv></li></ol>
<span id="methodopencv-ofinstallation-uploading-files-to-the-development-board-linux-systemmethod"></span>== Method of uploading files to the development board Linux system ==
<span id="howuse-apt-to-upload-files-using-scpinstall-commandopencv"></span>==== How Use apt to upload files using scp command =install OpenCV ===
<ol style="list-style-type: decimal;">
<li><p>Use The installation command is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y libopencv-dev python3-opencv'''</p>|}</li><li><p>Then use the scp following command to upload files to print the Linux system version number of the development board in Ubuntu PCOpenCV. The specific command output is normal, indicating that the OpenCV installation is as followssuccessful.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>'''file_pathThe version of OpenCV in Ubuntu22.04 is as follows: '''Needs to be replaced with the path of the file to > be uploaded</p></li><li>{| class="wikitable" style="width:800px;" |-| <p>'''orangepi@orangepi: ~$ '''This is the user name of the development board's python3 -c >quot; Linux system. It can also be replaced with something else, >import cv2; such as rootprint(cv2.</p></li><li><p>'''192.168.xx.xx:''' This is the IP address of the development __version__)>quot; board. Please modify it according to the actual situation.</p></li><li><p>'''/home/orangepi:''' The path in the development board Linux > system can also be modified to other paths.</p><p>test@test:~$ '''scp file_path orangepi@1924.1685.xx.xx:/home/orangepi/4'''</p></li></ol>|}
</li>
<li><p>If you want to upload a folder, you need to add the -r parameterThe version of OpenCV in Ubuntu20.04 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>testorangepi@testorangepi:~$ '''scp python3 -r dir_path orangepi@192c "import cv2; print(cv2.168__version__)"'''</p><p>'''4.xx2.xx0'''</p>|}</li><li><p>The version of OpenCV in Debian11 is as follows:</home/p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 -c "import cv2; print(cv2.__version__)"'''</p><p>'''4.5.1'''</p>|}</li><li><p>There are more usages The version of scp, please use the following command to view the man manualOpenCV in Debian12 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 -c "import cv2; print(cv2.__version__)"'''</p><p>'''4.6.0'''</p>|}</li></ol></li></ol>
<ol style="list-style-type: decimal;"><li><p>First set the default '''locale''' to Chinese</p><ol style="list-style-type: lower-alpha;"><li><p>Enter the following command to start configuring '''locale'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo dpkg-reconfigure locales'''</p>|}</li><li><p>Then select '''zh_CN.UTF-8 UTF-8''' in the pop-up interface (use the up and down keys on the keyboard to move up and down, use the space bar to select, and finally use the Tab key to move the cursor to '''<OK>''', and then return Car can be used)</p><p>[[File:zero2w-img186.png]]</p></li><li><p>Then set the default '''locale''' to '''zh_CN.UTF-8'''</p><p>[[File:zero2w-img187.png]]</divp></li><li><p>After exiting the interface, the '''locale''' setting will begin. The method of connecting output displayed on the development board command line is as shown in the figure belowfollows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo dpkg-reconfigure locales'''</p><p>Generating locales (this might take a while)...</p>:<p>en_US.UTF-8... done</p>:<p>zh_CN.UTF-8... done</p><p>Generation complete.</p>|}</li></ol></li><li><p>Then open '''Input Method'''</p><p>[[File:zero2w-img188.png]]</p></li><li><p>Then select '''OK'''</p><p>[[File:zero2w-img189.png]]</p></li><li><p>Then select '''Yes'''</p><p>[[File:zero2w-img190.png]]</p></li><li><p>Then select '''fcitx'''</p><p>[[File:zero2w-img191.png]]</p></li><li><p>Then select '''OK'''</p><p>[[File:zero2w-img192.png]]</p></li><div classli><p>'''<span style="figurecolor:#FF0000">Then restart the Linux system to make the configuration take effect.</span>'''</p></li><li><p>Then open '''Fcitx configuration'''</p><p>[[File:zero2w-img256img193.png]]</p></li><li><p>Then click the + sign as shown in the picture below</p><p>[[File:zero2w-img194.png]]</p></li><li><p>Then search '''Google Pinyin''' and click '''OK'''</p><div class="figure">
</div ></li><li><p>Then put '''Google Pinyin''' on top</p><p>[[File:zero2w-img196.png]]</p><p>[[File:zero2w-img197.png]]</p></li><li><p>Then open the '''Geany''' editor to test the Chinese input method</p><p>[[File:zero2w-img198.png]]</p></li><li><p>The Chinese input method test is as follows</p><p>[[File:zero2w-img199.png]]</p></li><li><p>You can switch between Chinese and English input methods through the '''Ctrl+Space''' shortcut key</p></li><li><p>If you need the entire system to be displayed in Chinese, you can set all variables in '''/etc/default/locale''' to '''zh_CN.UTF-8'''</p>{| class="figurewikitable"style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo vim /etc/default/locale'''</p><p># File generated by update-locale</p><p>LC_MESSAGES='''<span style="color:#FF0000">zh_CN.UTF-8</span>'''</p><p>LANG='''<span style="color:#FF0000">zh_CN.UTF-8</span>'''</p><p>LANGUAGE='''<span style="color:#FF0000">zh_CN.UTF-8</span>'''</p>|}</li><li><p>Then '''<span style="color:#FF0000">restart the system</span>''' and you will see that the system is displayed in Chinese.</p><p>[[File:zero2w-img200.png]]</p></li></ol>
<div ol style="list-style-type: decimal;"><li><p>First open '''Language Support'''</p><p>[[File:zero2w-img201.png]]</p></li><li><p>Then find the '''Chinese (China)''' option</p><p>[[File:zero2w-img202.png]]</p></li><li><p>Then please use the left button of the mouse to select '''Chinese (China)''' and hold it down, then drag it up to the starting position. After dragging, the display will be as shown below:</p><p>[[File:zero2w-img203.png]]</p></li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note that this step is not easy to drag, please be patient and try it a few times.'''</big>|}</ol><ol start="4" style="list-style-type: decimal;"><li><p>Then select '''Apply System-Wide''' to apply the Chinese settings to the entire system</p><p>[[File:zero2w-img204.png]]</p></li><li><p>Then set the '''Keyboard input method system''' system to '''fcitx'''</p><p>[[File:zero2w-img205.png]]</p></li><li><p>'''<span style="color:#FF0000">Then restart the Linux system to make the configuration take effect</span>'''</p></li><li><p>After re-entering the system, please select '''Do not ask me again''' in the following interface, and then please decide according to your own preferences whether the standard folder should also be updated to Chinese</p><p>[[File:zero2w-img206.png]]</p></li><li><p>Then you can see that the desktop is displayed in Chinese</p><p>[[File:zero2w-img207.png]]</p></li><li><p>Then we can open '''Geany''' to test the Chinese input method. The opening method is as shown in the figure"below</p><p>[[File:zero2w-img208.png]]</p></li><li><p>After opening '''Geany''', the English input method is still the default. We can switch to the Chinese input method through the '''Ctrl+Space''' shortcut key, and then we can input Chinese.</p><p>[[File:zero2w-img209.png]]</p></li></ol>
<ol style="list-style-type: decimal;">
<li><p>First open '''Language Support'''</p>
<p>[[File:zero2w-img201.png]]</p></li>
<li><p>Then find the '''Chinese (China)''' option</p>
<p>[[File:zero2w-img210.png]]</p></li>
<li><p>Then please use the left button of the mouse to select '''Chinese (China)''' and hold it down, then drag it up to the starting position. After dragging, the display will be as shown below:</p>
<p>[[File:zero2w-img211.png]]</p></li>
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|
<big>'''Note that this step is not easy to drag, please be patient and try it a few times.'''</big>
|}
</ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>Then select '''Apply System-Wide''' to apply the Chinese settings to the entire system</p>
<p>[[File:zero2w-img212.png]]</p></li>
<li><p>'''<span style="color:#FF0000">Then restart the Linux system to make the configuration take effect</span>'''</p></li>
<li><p>After re-entering the system, please select '''Do not ask me again''' in the following interface, and then please decide whether the standard folder should also be updated to Chinese according to your own preferences.</p>
<p>[[File:zero2w-img206.png]]</p></li>
<li><p>Then you can see that the desktop is displayed in Chinese</p>
<p>[[File:zero2w-img207.png]]</p></li>
<li><p>Then open the Fcitx5 configuration program</p>
<p>[[File:zero2w-img213.png]]</p></li>
<li><p>Then choose to use Pinyin input method</p>
<div class="figure">
[[File:zero2w-img260img214.png]]
</div></li><li><p>The interface after selection is as shown below, then click OK</p><ol start="9" style="listp>[[File:zero2w-style-type: decimal;"img215.png]]</p></li><li><p>After the upload is completed, you Then we can go open '''Geany''' to test the corresponding path Chinese input method. The opening method is as shown in the development board Linux system to view the uploaded filefigure below</p><p>[[File:zero2w-img208.png]]</p></li><li><p>The After opening '''Geany''', the English input method of uploading a folder is still the same as default. We can switch to the Chinese input method of uploading a filethrough the '''Ctrl+Space''' shortcut key, so I won't go into details hereand then we can enter Chinese.</p><p>[[File:zero2w-img216.png]]</p></li></ol>
<span id="methodhow-to-uploadremotely-fileslog-from-windows-pcin-to-development-boardthe-linux-system-desktop"></span>=== Method to upload files from Windows PC to development board Linux system ===
<div ol style="list-style-type: decimal;"><li><p>First download the installation package of the NoMachine software Linux '''<span style="color:#FF0000">arm64</span>''' deb version, and then install it into the Linux system of the development board</p><ol style="list-style-type: lower-alpha;"><li>Since H618 is an ARMv8 architecture SOC and the system we use is Ubuntu or Debian, we need to download the '''NoMachine for ARM ARMv8 DEB''' installation package. The download link is as follows:</li>{| class="figurewikitable" style="background-color:#ffffdc;width:800px;"|-| <big>'''Note that this download link may change, please look for the Armv8/Arm64 version of the deb package.'''</big>|}{| class="wikitable" style="width:800px;" |-| [https://www.nomachine.com/download/download&id=112&s=ARM '''https://downloads.nomachine.com/download/?id=118&distro=ARM''']|}
[[File:zero2w-img262img217.png]]</ol><ol start="2" style="list-style-type: lower-alpha;"><li><p>In addition, you can also download the '''NoMachine''' installation package from the official tool.</p><p>[[File:zero2w-img218.png]]</p><p>First enter the '''remote login software-NoMachine''' folder</p><p>[[File:zero2w-img219.png]]</p><p>Then download the arm64 version of the deb installation package</p><p>[[File:zero2w-img220.png]]</p></li><li><p>Then upload the downloaded '''nomachine_x.x.x_x_arm64.deb''' to the Linux system of the development board</p></li><li><p>Then use the following command to install '''NoMachine''' in the Linux system of the development board</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo dpkg -i nomachine_x.x.x_x_arm64_arm64.deb'''</p>|}</li></ol></li></divol>
<ol start="2" style="list-style-type: decimal;">
<li><p>The downloaded Then download the installation package of the Windows version of the NoMachine software. The download address is as shown below, then double-click to install it directlyfollows</pli>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <pbig>'''FileZilla_Server_1.5.1_win64-setupNote that this download link may change.exe'''</p></li></olbig>|}{| class="wikitable" style="width:800px;" |-| During the installation process, please select '''Decline''' on the following installation interface, and then select '''Next>https://downloads.nomachine.com/download/?id=9'''|}
[[File:zero2w-img221.png]]<div class/ol><ol start="3" style="list-style-type: decimal;"><li><p>Then install NoMachine in Windows. '''Please restart your computer after installation.'''</p></li><li><p>Then open '''NoMachine''' in Window</p><p>[[File:zero2w-img222.png]]</p></li><li><p>After NoMachine is started, it will automatically scan other devices with NoMachine installed on the LAN. After entering the main interface 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>
<div class="figure"p>New 'X' desktop is orangepi:1</p>
<p>Creating default startup script /divroot/.vnc/xstartup</p><ol start="6" style="list-style-type: decimal;"p>Starting applications specified in /root/.vnc/xstartup</p><lip>Then select '''Always trust this host''' and click '''OK'''<Log file is /root/.vnc/li>orangepi:1.log</olp>
<div class="figure"p>New 'X' desktop is orangepi:1</p>
<p>Starting applications specified in /root/.vnc/xstartup</p><p>Log file is /root/.vnc/divorangepi:1.log</p>|}</li><li><p>The steps to use MobaXterm software to connect to the development board Linux system desktop are as follows:</p><ol start="8" style="list-style-type: decimallower-alpha;"><li>Then First click Session, then select VNC, then fill in the path to be uploaded to IP address and port of 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 finally click the upload option OK to start uploading the file to the development boardconfirm.</li></ol>
<div class="figure">
[[File:zero2w-img268img227.png]]
</div></ol><ol start="92" style="list-style-type: decimallower-alpha;"><li><p>After Then enter the upload is completed, you can go to the corresponding path in the development board Linux system to view the uploaded fileVNC password set earlier</p><p>[[File:zero2w-img228.png]]</p></li><li><p>The method of uploading a folder After successful login, the interface is the same displayed as shown below, and then you can remotely operate the method desktop of uploading a file, so I won't go into details herethe development board Linux system.</p></li></ol>
[[File:zero2w-img229.png]]</ol></li></ol><span id="instructionsqt-forinstallation-using-the-logo-on-and-off-the-machinemethod"></span>== Instructions for using the logo on and off the machine ==
<ol style="list-style-type: decimal;">
<li><p>First run Use the following script to install QT5 and QT Creator</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''install_qt.sh'''</p>|}</li><li><p>After installation, the QT version number will be automatically printed.</p><ol style="list-style-type: lower-alpha;"><li><p>The qt version that comes with Ubuntu20.04 is '''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-configgnu</p>|}</li><li><p>The QT version that comes with Ubuntu22.04 is '''5. Ordinary users remember to add 15.3'''sudo</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ ''' permissionsinstall_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:~$ '''sudo 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-config@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 select you can see the QT Creator startup icon in '''SystemApplications'''</p><p>[[File:zero2w-img80img230.png]]</p><p>You can also use the following command to open QT Creator</lip><li>{| class="wikitable" style="width:800px;" |-| <p>Then select orangepi@orangepi:~$ '''Hardwareqtcreator'''</p>|}</li><li><p>The interface after QT Creator is opened is as follows</p><p>[[File:zero2w-img81img231.png]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown 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 the picture below, and then use the '''spaceUbuntu20.04''' to select the dtbo configuration of the SPI you want to open.is as follows</p><p>[[File:zero2w-img270img232.png]]</p></li><li><p>Then select The default version of QT Creator in '''<Save>Ubuntu22.04''' to saveis as follows</p><p>[[File:zero2w-img83img233.png]]</p></li><li><p>Then select The default version of QT Creator in '''<Back>Debian11'''is as follows</p><p>[[File:zero2w-img84img234.png]]</p></li><li><p>Then select The default version of QT Creator in '''<Reboot>Debian12''' to restart the system to make the configuration take effect.is as follows</p><p>[[File:zero2w-img85img235.png]]</p></li></ol></li><span id="how-to-shut-down-and-restart-the-development-board"li><p>Then set up QT</spanp>== How to shut down and restart the development board == <ol style="list-style-type: decimallower-alpha;"><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 First open '''Help'''->'''poweroffAbout Plugins...''' command to shut down the Linux system of the development board before powering off, and then unplug the power supply.</p><p>orangepi@orangepi[[File:~$ zero2w-img236.png]]</p></li><li><p>Then remove the check mark of '''sudo poweroffClangCodeModel'''</p><p>[[File:zero2w-img237.png]]</p></li><li><p>'''Note that after turning off the development board<span style="color:#FF0000">After setting up, you need to unplug and replug the power supply before it can be turned on.restart QT Creator</span>'''</p></li><li><p>In addition to using Then make sure the GCC compiler used by QT Creator. If the poweroff command default is Clang, please change it to shut down, you can also use the power onGCC.</off button on the expansion board to shut downp>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Debian12 please skip this step.'''</p></big>|}<p>[[File:zero2w-img269img238.png]]</p><p>'''Note that Linux 5[[File:zero2w-img239.4 requires manual configuration of the power onpng]]</p></li></ol></off button before it li><li><p>Then you can be usedopen a sample code</p><p>[[File:zero2w-img240. For png]]</p></li><li><p>After clicking on the opening methodsample code, please refer to the method of opening corresponding instruction document will automatically open. You can read the power button in Linux5instructions carefully.4</p><p>[[File:zero2w-img241.'''png]]</p></li><li><p>Use the Then click '''rebootConfigure Project''' command to restart </p><p>[[File:zero2w-img242.png]]</p></li><li><p>Then click the Linux system green triangle in the development boardlower left corner to compile and run the sample code</p><p>orangepi@orangepi[[File:~$ '''sudo''' '''reboot'''zero2w-img243.png]]</p></li><li><p>After waiting for a period of time, the interface shown in the figure below will pop up, which means that QT can compile and run normally.</olp> <span id="linuxp>[[File:zero2w-sdkorangepi-build-usage-instructions"img244.png]]</p></spanli> = '''Linux SDK——orangepi-build usage instructions''' = <span id="compilation-system-requirements"li><p>References</spanp>{| class="wikitable" style= Compilation system requirements =="width:800px;" |-| The Linux SDK, '''orangepi-build''', only supports running on X64 computers with '''Ubuntu 22<p>[https://wiki.qt.04io/Install_Qt_5_on_Ubuntu ''' installedhttps://wiki. Therefore, before downloading orangepi-build, please first ensure that the Ubuntu version installed on your computer is Ubuntu 22qt.04. The command to check the Ubuntu version installed on the computer is as follows. If the Release field does not display io/Install_Qt_5_on_Ubuntu'''22]</p><p>[https://download.04qt.io/archive/qtcreator ''', it means that the Ubuntu version currently used does not meet the requirementshttps://download. Please change the system before performing the following operationsqt. test@test:~$ '''lsb_release -aio/archive/qtcreator''']</p> No LSB modules are available<p>[https://download. Distributor ID: Ubuntu Description: Ubuntu 22qt.04 LTS Release: io/archive/qt '''22https://download.04qt.io/archive/qt''']</p>|}Codename: '''jammy'''</li></ol>
::[[httpsFile://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/ '''https://mirrors.tuna.tsinghua.eduzero2w-img245.cn/help/ubuntu/'''png]]
::{| class="wikitable" style="width:800px;" |-| [[Filehttp://docs.ros.org/ '''http:zero2w-img271//docs.ros.png]org''']
'''<span style="color:# deb-src httpsFF0000">ERROR:error loading sources list:<//mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiversespan>'''
updated cache in /home/orangepi/.ros/rosdep/sources.cache|}<div /ol><ol start="6" style="list-style-type: decimal;"><li><p>Then open a command line terminal window on the '''desktop''', and then use the '''test_ros.sh''' script to start a small turtle routine to test whether ROS can be used normally.</p>{| class="figurewikitable"style="width:800px;" |-| <p>orangepi@orangepi:~$ '''test_ros.sh'''</p>|}</li><li><p>After running the '''test_ros.sh''' script, a small turtle as shown in the picture below will pop up.</p><p>[[File:zero2w-img273img248.png]] </divp></li>The mirror URL of <li><p>Then please keep the cross-compilation tool chain in China is terminal window you just opened at the open source software mirror site of Tsinghua University:top</p></li>
:<p>Call `ros2 <command> -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.<ol /p>{| class="wikitable" style="listwidth:800px;" |-| <p>orangepi@orangepi:~$ '''test_ros.sh'''</p><p>[INFO] [1671174101.200091527] [talker]: Publishing: 'Hello World: 1'</p><p>[INFO] [1671174101.235661048] [listener]: I heard: [Hello World: 1]</p><p>[INFO] [1671174102.199572327] [talker]: Publishing: 'Hello World: 2'</p><p>[INFO] [1671174102.204196299] [listener]: I heard: [Hello World: 2]</p><p>[INFO] [1671174103.199580322] [talker]: Publishing: 'Hello World: 3'</p><p>[INFO] [1671174103.204019965] [listener]: I heard: [Hello World: 3]</p>|}</li><li><p>Run the following command to open rviz2</p>{| class="wikitable" style-type="width: lower-alpha800px;"|-| <p>orangepi@orangepi:~$ '''source /opt/ros/galactic/setup.bash'''</p><p>orangepi@orangepi:~$ '''ros2 run rviz2 rviz2'''</p>|}<lip>v2018[[File:zero2w-img253.05png]]</p></li><li><p>For how to use ROS, please refer to the documentation of ROS 2.</olp>{| class="wikitable" style="width:800px;" |-| <p>[http://docs.ros.org/en/galactic/Tutorials.html '''gcc-linaro-7http://docs.4ros.1-2019org/en/galactic/Tutorials.02-x86_64_arm-linux-gnueabihtml''']</p>|}</li></ol>
<ol startspan id="how-to-install-ros-2" style="list-stylehumble-type: loweron-alpha;ubuntu22.04"><li>v2021.07</li></olspan>
<ol style="list-style-type: decimal;">
<li><p>After downloading, the orangepi-build warehouse does not contain Use the source code of the linux kernel, u-boot and cross-compilation tool chaininstall_ros. The source code of the linux kernel and u-boot is stored in an independent git warehousesh script to '''install_ros.sh'''</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"|-| <p>orangepi@orangepi:~$ '''install_ros.sh ros2'''</p>|}</li><li><p>The git warehouse where '''install_ros.sh''' script will automatically run the linux kernel source code is stored is as follows'''ros2 -h''' command after installing ros2. Please note If you can see the following print, it means that the branch of the linux-orangepi warehouse ros2 installation is switched tocomplete.</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li>Linux5.4</li></ol>|-</li></ol>| </lip>usage: ros2 [-h] Call `ros2 <command> -h` for more detailed usage. ...</olp>
<ol start="p>ros2 is an extensible command-line tool for ROS 2" style="list-style-type: lower-alpha;"><li>Linux6.1</li></olp>
<ol start="2" style="listp>Commands:</p>:<p>action Various action related sub-commands</p>:<p>bag Various rosbag related sub-commands</p>:<p>component Various component related sub-commands</p>:<p>daemon Various daemon related sub-commands</p>:<p>doctor Check ROS setup and other potential issues</p>:<p>interface Show information about ROS interfaces</p>:<p>launch Run a launch file</p>:<p>lifecycle Various lifecycle related sub-stylecommands</p>:<p>multicast Various multicast related sub-typecommands</p>: lower<p>node Various node related sub-alpha;"commands</p>:<lip>v2021.07param Various param related sub-commands</lip>:<p>pkg Various package related sub-commands</p>:<p>run Run a package specific executable</p>:<p>security Various security related sub-commands</p>:<p>service Various service related sub-commands</p>:<p>topic Various topic related sub-commands</p>:<p>wtf Use `wtf` as alias to `doctor`</olp>
:<ol start="2" style="listp>Call `ros2 <command> -style-type: decimal;"h` for more detailed usage.</p>|}</li><li><p>When orangepi-build Then you can use the '''test_ros.sh''' script to test whether ROS 2 is run for successfully installed. If you can see the first timefollowing print, it will download the cross-compilation tool chain, u-boot and linux kernel source codemeans ROS 2 can run normally. After successfully compiling a linux image, the files and folders that can be seen in orangepi-build are:</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li>|-| <p>orangepi@orangepi:~$ '''buildtest_ros.sh''': Compile startup script</p></li><li><p>[INFO] [1671174101.200091527] [talker]: Publishing: 'Hello World: 1''external''': Contains the configuration files needed to compile the image, scripts for specific functions, and the source code of some programs. The rootfs compressed package cached during the image compilation process is also stored in external.</p><p>[INFO] [1671174101.235661048] [listener]: I heard: [Hello World: 1]</lip><li><p>[INFO] [1671174102.199572327] [talker]: Publishing: 'Hello World: 2''kernel''': Store the source code of the linux kernel</p><p>[INFO] [1671174102.204196299] [listener]: I heard: [Hello World: 2]</lip><li><p>[INFO] [1671174103.199580322] [talker]: Publishing: 'Hello World: 3''LICENSE''': GPL 2 license file</p></li><li><p>'''README[INFO] [1671174103.md'''204019965] [listener]: I heard: [Hello World: orangepi-build documentation3]</p>|}</li><li><p>Run the following command to open rviz2</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''outputsource /opt/ros/humble/setup.bash''': Store compiled u-boot, linux and other deb packages, compilation logs, and compiled images and other files</p></li><li><p>orangepi@orangepi:~$ '''scriptsros2 run rviz2 rviz2''': Common script for compiling linux images</p></li><li><p>'''toolchains'''[[File: Store crosszero2w-compilation tool chainimg254.png]]</p>|}</li><li><p>Reference documentation</p>{| class="wikitable" style="width:800px;" |-| <p>'''u-boothttp://docs.ros.org/en/humble/index.html''': Store the source code of u-boot</p></li><li><p>[http://docs.ros.org/en/galactic/Tutorials.html '''userpatcheshttp://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html''': Store the configuration files needed to compile the script]</p></li></ol>|}
</li></ol>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Debian11 system with <span idstyle="compile-u-bootcolor:#FF0000">Linux6.1</span> kernel will report GCC error when compiling kernel module. So if you want to compile the kernel module, please use Debian12 or Ubuntu22.04.'''</big>== Compile u-boot ==|}
<ol start="4" style="list-style-type: decimal;"><li><p>Then select Debian Bullseye is installed with the branch type gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of u-bootthe development board.</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 imageof a.gcc is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''gcc --version'''</lip><li><p>The next branch will compile the ugcc (Debian 10.2.1-boot v20216) 10.07 version code that needs to be used by the linux62.1 image20210110</p><p>Copyright (C) 2020 Free Software Foundation, Inc.</p><p>[[File:zero2w-img276This is free software; see the source for copying conditions.png]]There is NO</p></lip>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</olp>|}
</li>
<li><p>If you select Write the next branch, you will also be prompted to select the memory size, and you do not need to select the current branch'''hello_world.c''' program in C language</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.c'''</lip><p>#include <stdio.h></olp>
:<p>return 0;<ol start/p><p>}</p>|}</li><li><p>Then compile and run '''hello_world.c'''</p>{| class="6wikitable" style="listwidth:800px;" |-style| <p>orangepi@orangepi:~$ '''gcc -typeo hello_world hello_world.c'''</p><p>orangepi@orangepi: decimal;"~$ '''./hello_world'''</p><p>Hello World!</p>|}</li></ol></li><li><p>Then it will start to compile u-boot. Some of the information prompted when compiling the next branch is as follows:Debian Bullseye has Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li>Version <p>The specific version of uPython is as follows</p>{| class="wikitable" style="width:800px;" |-boot source code| </lip>orangepi@orangepi:~$ '''python3'''</olp></lip>'''Python 3.9.2''' (default, Feb 28 2021, 17:03:44)</olp> <p>[ oGCC 10.k2. 1 20210110] Compiling uon linux</p><p>Type "help", "copyright", "credits" or "license" for more information.</p><p>>>></p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-boot [ | <big><p>'''Use the Ctrl+D shortcut key to exit python'v2021s interactive mode.07''' ]</p></big>|}</li><ol startli><p>Write the '''hello_world.py''' program in Python language</p>{| class="2wikitable" style="list-style-typewidth: lower-alpha800px;"|-| <p>orangepi@orangepi:~$ '''vim hello_world.py'''</p><p>print('Hello World!')</p>|}</li>Version of the cross-compilation tool chain</li><p>The result of running '''hello_world.py''' is as follows</olp>{| class="wikitable" style="width:800px;" |-[ o.k. ] Compiler version [ | <p>orangepi@orangepi:~$ '''aarch64-linux-gnu-gcc 11python3 hello_world.py''' ]</p><p>Hello World!</p>|}</li></ol></li><li><p>Debian Bullseye does not install Java compilation tools and operating environment by default.</p><ol start="3" style="list-style-type: lower-alpha;"><li>Path <p>You can use the following command to the compiled uinstall openjdk. The latest version in Debian Bullseye is openjdk-17</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-boot deb packagejdk'''</p>|}</li><li><p>After installation, you can check the Java version.</olp>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Target directory [ <p>orangepi@orangepi:~$ '''orangepijava -build/output/debs/u-bootversion''' ]</p>|}<ol start/li><li><p>Write the Java version of '''hello_world.java'''</p>{| class="4wikitable" style="list-style-typewidth: lower-alpha800px;"|-| <p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><lip>The package name of the compiled u-boot deb package{</lip>:<p>public static void main(String[] args)</olp>:<p>{</p>[ o::<p>System.kout. ] File name [ println("Hello World!");</p>:<p>}</p><p>}</p>|}</li><li><p>Then compile and run '''linux-u-boot-next-orangepizero2w_xhello_world.x.x_arm64.debjava''' ]</p> <ol start{| class="5wikitable" style="list-style-typewidth: lower-alpha800px;"|-| <p>orangepi@orangepi:~$ '''javac hello_world.java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p>|}</li>Compilation time</ol></li></ol>
:<ol start="8" style="list-style-type: decimalp>return 0;"</p><lip>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:}</lip>|}</olli> <blockquoteli><p>Set the IGNORE_UPDATES variable in uThen compile and run '''userpatches/config-defaulthello_world.confc''' to "yes"</p>{| class="wikitable" style="width:800px;" |-| </blockquotep>testorangepi@testorangepi:~/orangepi-build$ '''vim userpatches/configgcc -defaulto hello_world hello_world.confc'''</p> ...... IGNORE_UPDATES="<p>orangepi@orangepi:~$ '''yes./hello_world'''" ...... <ol start="9" style="list-style-type: decimal;"/p><li><p>When debugging u-boot code, you can use the following method to update u-boot in the linux image for testingHello World!</p><ol style="list-style-type: lower-alpha;"><li>First upload the compiled deb package of u-boot to the Linux system of the development board.</li></ol>|}
</li></ol>
<ol style="list-style-type: lower-alpha;">
<li>If you do not need to modify the kernel configuration options, when running the build.sh script, pass '''KERNEL_CONFIGURE=no''' to temporarily block the pop-up of the kernel configuration interface.</lip>The specific version of Python is as follows</olp>{| class="wikitable" style="width:800px;" |-test| <p>orangepi@testorangepi:~/orangepi-build$ '''sudo ./build.sh KERNEL_CONFIGURE=nopython3'''</p><p>Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux</p><p>Type "help", "copyright", "credits" or "license" for more information.</p><ol startp>>>></p>|}{| class="2wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;">|-| <libig><p>b. You can also set '''KERNEL_CONFIGURE=noUse the Ctrl+D shortcut key to exit python's interactive mode.''' in the orangepi-build</userpatches/config-default.confconfiguration file to permanently disable this function.p></pbig>|}</li><li><p>If Write 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'''hello_world. Please increase the Ubuntu PC terminal to the maximum size, and then rerun the build.sh scriptpy''' program in Python language</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.py'''</p><p>print('Hello World!')</lip>|}</olli> [[File:zero2w-img284<li><p>The result of running '''hello_world.png]]py''' is as follows</p> <ol start{| class="7wikitable" style="list-style-typewidth: decimal800px;"|-| <p>orangepi@orangepi:~$ '''python3 hello_world.py'''</p><p>Hello World!</p>|}</li></ol></li><li><p>Part of the information prompted when compiling the next branch kernel source code is explained as follows:Debian Bookworm does not install Java compilation tools and operating environment by default.</p>
<ol style="list-style-type: lower-alpha;">
<li>Version <p>You can use the following command to install openjdk. The latest version in Debian Bookworm is openjdk-17</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''</p>|}</li><li><p>After installation, you can check the Java version.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''java --version'''</p>|}</li><li><p>Write the Java version of the linux kernel source code'''hello_world.java'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println("Hello World!");</p>:<p>}</p><p>}</p>|}</li><li><p>Then compile and run '''hello_world.java'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''javac hello_world.java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p>|}</li></ol>
</li></ol>
</li></ol>
<ol style="list-style-type: lower-alpha;">
<li>Upload <p>The specific version of Python3 is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3'''</p><p>Python 3.8.10 (default, Nov 14 2022, 12:59:47)</p><p>[GCC 9.4.0] on linux</p><p>Type "help", "copyright", "credits" or "license" for more information.</p><p>>>></p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Use the compiled deb package Ctrl+D shortcut key to exit python's interactive mode.'''</p></big>|}</li><li><p>Write the '''hello_world.py''' program in Python language</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.py'''</p><p>print('Hello World!')</p>|}</li><li><p>The result of running '''hello_world.py''' is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 hello_world.py'''</p><p>Hello World!</p>|}</li></ol></li><li><p>Ubuntu Focal does not have Java compilation tools and running environment installed by default.</p><ol style="list-style-type: lower-alpha;"><li><p>You can use the Linux kernel following command to install openjdk-17</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''</p>|}</li><li><p>After installation, you can check the Linux system Java version.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''java --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 the development board'''hello_world.java'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println("Hello World!");</p>:<p>}</p><p>}</p>|}</li><li><p>Then compile and run '''hello_world.java'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''javac hello_world.java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p>|}</li></ol>
</li></ol>
<ol start="2" style="list-style-type: decimal;"p>int main(void)</p><lip>Select '''Rootfs and all deb packages''' and press Enter{</lip>:<p>printf("Hello World!\n");</olp>
<ol style="list-style-type: lower-alpha;">
<li><p>In the current branchThe specific version of Python3 is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3'''</p><p>Python 3.10.6 (main, May 29 2023, you can see three options11:10: debian1138) [GCC 11.3.0] on linux</p><p>Type "help", ubuntu20.04"copyright", and ubuntu22"credits" or "license" for more information.04</p><p>>>></p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p></big>|}</li><li><p>In Write the next branch, you can see three options'''hello_world.py''' program in Python language</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi: debian11, debian12, and ubuntu22~$ '''vim hello_world.04py'''</p><p>print('Hello World!')</p>|}</li><li><p>The result of running '''hello_world.py''' is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 hello_world.py'''</lip><p>Hello World!</olp>|}
</li></ol>
<ol style="list-style-type: lower-alpha;">
<li><p>You can use the following command to install openjdk-18</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''Image with console interface (server)sudo apt install -y openjdk-18-jdk''' Represents </p>|}</li><li><p>After installation, you can check the image of the server Java version.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''java --version'''</p><p>openjdk 18.0.2-ea 2022-07-19</p><p>OpenJDK Runtime Environment (build 18.0.2-ea+9-Ubuntu-222.04)</p><p>OpenJDK 64-Bit Server VM (build 18.0.2-ea+9-Ubuntu-222.04, which is relatively small in size.mixed mode, sharing)</p>|}</li><li><p>Write the Java version of '''Image with desktop environmenthello_world.java''' Represents an image with a desktop, which is relatively large in size</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</lip>::<p>System.out.println("Hello World!");</olp>:<p>}</lip><p>}</olp>|}<div /li><li><p>Then compile and run '''hello_world.java'''</p>{| class="figurewikitable" style=">width:800px;" |-| [[File<p>orangepi@orangepi:zero2w-img287~$ '''javac hello_world.png]]java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p>|}</li></ol></li></ol>
</div><ol startspan id="7" style="listmethod-of-uploading-stylefiles-type: decimal;"><li>If you are compiling the server version of the image, you can also choose to compile -the Standard version or the Minimal version. The Minimal version will have much less pre-installed software than the Standard version ('''please do not choose the Minimal version without special needs, because many things are not predevelopment-board-linux-installed by default. Some functions may not be available''')</lisystem"></olspan>
</div><ol startspan id="8" style="listhow-to-upload-files-using-stylescp-type: decimal;command"><li/span>If you are compiling a desktop version of the image, you also need ==== How to select the type of desktop environment. Currently, only XFCE is maintained, so please select an XFCE type desktop.</li></ol>upload files using scp command ====
<ol style="list-style-type: lower-alpha;">
<li>Type <p>'''file_path: '''Needs to be replaced with the path of the file to be uploaded</p></li><li><p>'''orangepi: '''This is the user name of the development board's Linux system. It can also be replaced with something else, such as root.</p></li><li><p>'''192.168.xx.xx:''' This is the IP address of rootfsthe development board. Please modify it according to the actual situation.</p></li><li><p>'''/home/orangepi:''' The path in the development board Linux system can also be modified to other paths.</p>{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''scp file_path orangepi@192.168.xx.xx:/home/orangepi/'''</olp>|}
</li></ol>
</li>
<li><p>If you want to upload a folder, you need to add the -r parameter</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''scp <span style="color:#FF0000">-r</span> dir_path orangepi@192.168.xx.xx:/home/orangepi/'''</p>
|}
</li>
<li><p>There are more usages of scp, please use the following command to view the man manual</p></li>
{| class="wikitable" style="width:800px;"
|-
|
test@test:~$ '''man scp'''
|}
</ol>
<span id="how-to-upload-files-using-filezilla"></span>
<ol startdiv class="10figure" style="list-style-type: decimal;"><li><p>View the compiled rootfs compressed package</p><ol style="list-style-type: lower-alpha;"><li>'''bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4''' It is a compressed package of rootfs. The meaning of each field in the name is</li></ol></li></ol>
<ol startdiv class="11figure" style="list-style-type: decimal;"><li>If the required rootfs already exists under '''external/cache/rootfs''', then compiling the rootfs again will directly skip the compilation process and will not restart the compilation. When compiling the image, it will also go to '''external/cache/rootfs''' to check whether it already exists. There is a cached rootfs available. If it is available, use it directly. This can save a lot of download and compilation time.</li></ol>
[[File:zero2w-img260.png]] </div><span id/ol><ol start="compile9" style="list-linuxstyle-imagetype: decimal;"><li><p>After the upload is completed, you can go to the corresponding path in the development board Linux system to view the uploaded file.</p></spanli>== Compile linux image ==<li><p>The method of uploading a folder is the same as the method of uploading a file, so I won't go into details here.</p></li></ol>
<ol startspan id="2" style="listhow-to-upload-files-using-stylefilezilla-type: decimal;1"><li>Select '''Full OS image for flashing''' and press Enter</li></olspan>==== How to upload files using filezilla ====
::{| class="wikitable" style="width:800px;" |-| [[Filehttps://filezilla-project.org/download.php?type=client '''https:zero2w//filezilla-img292project.png]org/download.php?type=client''']|}
<ol startdiv class="5figure" style="list-style-type: decimal;"><li><p>If you select the next branch, you will also be prompted to select the memory size, and you do not need to select the current branch.</p><ol style="list-style-type: lower-alpha;"><li><p>If the development board you purchased has a memory size of 1.5GB, please select the first option.</p></li><li><p>If the development board you purchased has 1GB or 2GB or 4GB memory size, please choose the second option.</p><p>[[File:zero2w-img277.png]]</p></li></ol></li><li><p>Then select the type of rootfs</p></li></ol>
[[File:zero2w-img286img263.png]]
</li></ol>
<ol start="3" style="list-style-type: decimal;">
<li>The interface after opening filezilla is as shown below. At this time, the remote site on the right is empty.</li>
<div class="figure">
[[File:zero2w-img287img264.png]]
</div></ol><ol start="84" style="list-style-type: decimal;"><li>If you are compiling the server version The method of connecting the image, you can also choose to compile development board is as shown in the Standard version or the Minimal version. The Minimal version will have much less pre-installed software than the Standard version ('''please do not choose the Minimal version without special needs, because many things are not pre-installed by default. Some functions may not be available''')figure below:</li></ol>
<div class="figure">
[[File:zero2w-img288img256.png]]
</div></ol><ol start="95" style="list-style-type: decimal;"><li>If you are compiling a desktop version of the image, you also need Then choose to select '''save the type of desktop environment. Currently, only XFCE is maintained, so please select an XFCE type desktop.password''' and click '''OK'''</li></ol>
[[File:zero2w-img290img265.png]]
<ol start="11" style="list-style-type: decimal;"><li><p>After compiling the image, the following message will be displayedFirst run '''orangepi-config'''. Ordinary users remember to add '''sudo''' permissions.</p><ol {| class="wikitable" style="listwidth:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-styleconfig'''</p>|}</li><li><p>Then select '''System'''</p><p>[[File:zero2w-typeimg80.png]]</p></li><li><p>Then select '''Hardware'''</p><p>[[File: lowerzero2w-alpha;"img81.png]]</p></li><li>The storage path <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 compiled imageSPI you want to open.</p><p>[[File:zero2w-img270.png]]</p></li><li><p>Then select '''<Save>''' to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''<Back>'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''<Reboot>''' to restart the system to make the configuration take effect.</olp><p>[[File:zero2w-img85.png]]</p></li></ol>
<ol style="list-style-type: decimal;"><li><p>During the running of the Linux system, if you directly unplug the power supply, it may cause the file system to lose some data. It is recommended to use the '''poweroff''' command to shut down the Linux system of the development board before powering off, and then unplug the power supply.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo poweroff'''</p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that after turning off the development board, you need to unplug and replug the power supply before it can be turned on.'''</p></big>|}</li><li><p>In addition to using the poweroff command to shut down, you can also use the power on/off button on the expansion board to shut down.</p><p>[[File:zero2w-img269.png]]</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that Linux 5.4 requires manual configuration of the power on/off button before it can be used. For the opening method, please refer to [ o[Orange Pi Zero 2W#How to turn on the power button in Linux5.k4|the method of opening the power button in Linux5. 4] Runtime [ 19 min ].'''</p></big>|}</li><li><p>Use the '''reboot''' command to restart the Linux system in the development board</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo''' '''reboot'''</p>|}</li></ol>
<ol startspan id="3" style="listlinux-sdkorangepi-stylebuild-type: lowerusage-alpha;instructions"><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></olspan>
<span id="instructionscompilation-forsystem-usingrequirements"></span>== 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 '''<span style="color:#FF0000">22.04</span>''', it means that the Ubuntu version currently used does not meet the requirements. Please change thesystem before performing the following operations. {| class="wikitable" style="width:800px;" |-orange| test@test:~$ '''lsb_release -pi-os-arch-systema''' No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04 LTS Release: '''<span style="color:#FF0000">22.04</span>'''
{| class="wikitable" style="width:800px;"
|-
| [https://repo.huaweicloud.com/ubuntu-releases/21.04/ubuntu-21.04-desktop-amd64.iso '''Motherboard functionshttps://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/22.04/ubuntu-22.04-desktop-amd64.iso''']| '''OPi OS Arch'''} After installing Ubuntu 22.04 on your computer or virtual machine, please first set the software source of Ubuntu 22.04 to Tsinghua source (or other domestic sources that you think is fast), otherwise it is easy to make errors due to network reasons when installing the software later. The steps to replace Tsinghua Source are as follows: <ol style="list-style-type: lower-alpha;"><li>For the method of replacing Tsinghua Source, please refer to the instructions on this page.</li> {| class="wikitable" style="width:800px;"
|-
| [https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/ '''HDMI videohttps://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/''']| }</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Note that the Ubuntu version needs to be switched to 22.04.</li> [[File:zero2w-img271.png]]</ol><ol start="3" style="list-style-type: lower-alpha;"><li>The contents of the '''OK/etc/apt/sources.list'''file that need to be replaced are:</li>{| class="wikitable" style="width:800px;"
|-
| test@test:~$ '''sudo mv /etc/apt/sources.list cat /etc/apt/sources.list.bak''' test@test:~$ '''sudo vim /etc/apt/sources.list''' '''HDMI Audio#'''The source code image is commented by default to improve apt update speed. You can uncomment it yourself if necessary. deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse | '''OK#'''deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse |deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse| '''#'''Typedeb-C USB2src https://mirrors.tuna.tsinghua.edu.0 x 2cn/ubuntu/ jammy-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse '''#''' deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse | '''OK#'''deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse |'''#''' Pre-release software source, not recommended to be enabled | '''TF Card Startup#'''deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse | '''OK#'''deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse|}</ol><ol start="4" style="list-style-type: lower-alpha;"><li>After the replacement, you need to update the package information and ensure that no errors are reported.</li>{| class="wikitable" style="width:800px;"
|-
| test@test:~$ '''WIFIsudo apt-get update'''| }</ol><ol start="5" style="list-style-type: lower-alpha;"><li>'''OK<span style="color:#FF0000">In addition, since the source code of the kernel and Uboot are stored on GitHub, it is very important to ensure that the computer can download the code from GitHub normally when compiling the image.</span>'''</li></ol> <span id="obtain-the-source-code-of-linux-sdk"></span> == Obtain the source code of linux sdk == <span id="download-orangepi-build-from-github"></span>=== Download orangepi-build from github === Linux sdk refers to the orangepi-build set of codes. Orangepi-build is modified based on the armbian build compilation system. Multiple versions of Linux images can be compiled using orangepi-build. Use the following command to download the orangepi-build code: {| class="wikitable" style="width:800px;"
|-
| test@test:~$ '''Bluetoothsudo apt-get update'''| test@test:~$ '''sudo apt-get install -y git''' test@test:~$ '''OKgit clone https://github.com/orangepi-xunlong/orangepi-build.git -b next'''|}{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big>'''LED LightNote that when using the H618 Soc development board, you need to download the source code of the <span style="color:#FF0000">next</span> branch of orangepi-build. The above git clone command needs to specify the branch of the orangepi-build source code as next.'''</big> <div class="figure"> [[File:zero2w-img272.png| '''OK'''center|800px]] </div>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big>'''40pin GPIOWhen 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>| '''OK'''} |The u-boot and linux kernel versions currently used by the H618 series development boards are as follows:| '''40pin I2C'''{| '''OK'''class="wikitable" style="width:800px;text-align: center;"
|-
| '''40pin SPIbranch'''| '''OKu-boot Version'''| '''linux Kernel version'''
|-
| '''40pin UARTcurrent'''| '''OKu-boot v2018.05'''| '''linux5.4'''
|-
| '''40pin PWMnext'''| '''OK'''|-| '''Temperature Sensor'''| '''OK'''|u-| '''Hardware watchdog'''| '''OK'''|-| '''Mali GPU'''| '''NO'''|-| '''Video codecboot v2021.07'''| '''NOlinux6.1'''
|}
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| '''24pin expansion board function'''| ''<big>'OPi OS Arch'''|The branch mentioned here is not the same thing as the branch of orangepi-| build source code, please don'''100M network port'''| '''OKt get confused. This branch is mainly used to distinguish different kernel source code versions.'''|-| '''100M Ethernet port light'''| '''OK'''|-| '''USB2We define the linux5.4 bsp kernel currently provided by Allwinner as the current branch. The latest linux6.1 LTS kernel is defined as the next branch.0 HOST x 2'''| '''OK'''|-| '''Infrared reception'''| '''OK'''|-| '''Headphone audio playback'''| '''OK'''|-| '''On</off button'''| '''OK'''|-| '''LRADC''' '''Custom buttons x 2'''| '''OK'''|-| '''TV-OUT'''| '''NO'''big>
|}
<div class="figure">
[[File:zero2w-img294img273.png]]
</div></li><li><p>After selecting The mirror URL of the language, the user wizard will immediately switch to cross-compilation tool chain in China is the corresponding language interface, as shown below in Chinese</p><div class="figure">open source software mirror site of Tsinghua University:
{| class="wikitable" style="width:800px;" |-| [[Filehttps:zero2w//mirrors.tuna.tsinghua.edu.cn/armbian-img295releases/_toolchain/ '''https://mirrors.tuna.tsinghua.edu.png]cn/armbian-releases/_toolchain/''']|}
<span idol style="howlist-tostyle-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-setstyle-dttype: lower-overlaysalpha;"><li>linux6.1</spanli>{| class="wikitable" style= How "width:800px;" |-| '''gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu'''|}</ol>The cross-compilation tool chain used to set DT overlays ==compile the H618 u-boot source code is:
{| class="wikitable" style="width:800px;"
|-
| '''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 test@test:~/orangepi- pwm3'''| build$ '''sun50i-h616-pi-pwm3sudo .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-zero2w-disable-led.dtbo'''|-| '''How to close the UART0 debugging serial port'''| '''sun50i-h616-disable-uart0/build.dtbosh'''
|}
<ol start="52" 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 Select '''FDTOVERLAYS.U-boot package''' For example, the configuration of opening i2c1 and uart5 at the same time is as followspress Enter</li></ol>
[[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>After setting, you need to restart the system for the configuration to take effect.</lip></ol> [orangepi@orangepi-pc ~]$ '''sudo reboot''' <span id="how-Then it will start tocompile u-install-software"></span>== How to install software == You can use the pacman package management tool to install software that is not available in OPi OSboot. For example, Some of the command to install information prompted when compiling the vim editor next branch 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. [orangepi@orangepi-pc ~]$ '''sudo pacman -Syy vim''':</p><span idol style="android-12-tvlist-systemstyle-usagetype: lower-instructionsalpha;"></spanli> = '''Android 12 TV system usage instructions''' = <span id="supportedVersion of u-android-versions">boot source code</spanli>== Supported Android versions == {| class="wikitable" style="width:800px;"
|-
| Android [ o.k. ] Compiling u-boot [ '''v2021.07''' ]|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Versionof the cross-compilation tool chain</li>{| Kernel versionclass="wikitable" style="width:800px;"
|-
| '''Android 12 TV Version'''| [ o.k. ] Compiler version [ '''linux5.4aarch64-linux-gnu-gcc 11''']
|}
</ol><span idol start="android3" style="list-12style-tvtype: lower-function-adaptation-statusalpha;"><li>Path to the compiled u-boot deb package</spanli>== Android 12 TV function adaptation status == {| class="wikitable" style="width:800px;"
|-
| [ o.k. ] Target directory [ '''Motherboard functionsorangepi-build/output/debs/u-boot''']| '''Android12 TV'''}</ol>|<ol start="4" style="list-style-type: lower-alpha;">| '''HDMI video'''<li>The package name of the compiled u-boot deb package</li>{| '''OK'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] File name [ '''HDMI Audiolinux-u-boot-next-orangepizero2w_x.x.x_arm64.deb''']|}</ol><ol start="5" style="list-style-type: lower-alpha;"><li>Compilation time</li>{| '''OK'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] Runtime [ '''Type-C USB2.0 x 21 min''']|}</ol><ol start="6" style="list-style-type: lower-alpha;"><li>Repeat the command to compile u-boot. Use the following command without selecting through the graphical interface. You can start compiling u-boot directly.</li>{| '''OK'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] Repeat Build Options [ '''TF card startupsudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=u-boot''']| '''OK'''}</ol></li></ol><ol start="7" style="list-style-type: decimal;"><li>View the compiled u-boot deb package</li>{| class="wikitable" style="width:800px;"
|-
| test@test:~/orangepi-build$ '''ls output/debs/u-boot/''' '''WIFIlinux-u-boot-next-orangepizero2w_x.x.x_arm64.deb'''| }</ol><ol start="8" style="list-style-type: decimal;"><li>When the orangepi-bulid compilation system compiles the u-boot source code, it will first synchronize the u-boot source code with the u-boot source code of the github server. Therefore, if you want to modify the u-boot source code, you first need to turn off the download and update function of the source code. ('''OKYou need to completely compile u-boot before you can turn off this function, otherwise it will prompt that the source code of u-boot cannot be found'''), otherwise the modifications will be restored. The method is as follows:</li> Set the IGNORE_UPDATES variable in u'''userpatches/config-default.conf''' to "yes" {| class="wikitable" style="width:800px;"
|-
| test@test:~/orangepi-build$ '''Bluetoothvim userpatches/config-default.conf'''| ...... IGNORE_UPDATES="'''OK<span style="color:#FF0000">yes</span>'''" ......|}</ol><ol start="9" style="list-style-type: decimal;"><li><p>When debugging u-boot code, you can use the following method to update u-boot in the linux image for testing</p><ol style="list-style-type: lower-alpha;"><li>First upload the compiled deb package of u-boot to the Linux system of the development board.</li>{| class="wikitable" style="width:800px;"
|-
| test@test:~/orangepi-build$ '''cd output/debs/u-boot''' test@test:~/orangepi_build/output/debs/u-boot$ '''USB Camerascp \'''| '''OKlinux-u-boot-next-orangepizero2w_x.x.x_arm64.deb [mailto:root@192.168.1.xxx:/root root@192.168.1.xxx:/root]'''|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Install the new u-boot deb package just uploaded</li>{| class="wikitable" style="width:800px;"
|-
| orangepi@orangepi:~$ '''LED Lightsudo dpkg -i'''| '''OKlinux-u-boot-next-orangepizero2w_x.x.x_arm64.deb'''|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>Then run the nand-sata-install script</li>{| class="wikitable" style="width:800px;"
|-
| '''40pin GPIO'''| '''OK'''|-| '''40pin I2C'''| '''OK'''|-| '''40pin SPI1'''| '''OK'''|-| '''40pin UART'''| '''OK'''|-| '''40pin PWM'''| '''OK'''|-| '''Temperature Sensor'''| '''OK'''|-| '''Hardware watchdog'''| orangepi@orangepi:~$ '''OK'''|sudo nand-| '''Mali GPU'''| '''OK'''|sata-| '''Video codec'''| '''OKinstall'''
|}
</ol>
<ol start="4" style="list-style-type: lower-alpha;">
<li>Then select '''5 Install/Update the bootloader on SD/eMMC'''</li>
::{| class="wikitable" style="width:800px;"
|-
|| '''green light'''| '''red light'''|-| '''u-boot startup phase'''| '''Off'''| '''on'''|test@test:~/orangepi-| '''Kernel boot to enter the system'''| '''on'''| build$ '''onsudo ./build.sh'''
|}
<span idol start="how2" style="list-tostyle-return-to-the-previous-interface-in-androidtype: decimal;"><li>Select '''Kernel package''' and press Enter</spanli>== How to return to the previous interface in Android ==
[[File:zero2w-img275.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>Then you can log in to select the android system through adb shell on Ubuntu PCbranch type of the kernel source code</li></ol>
::[[File:zero2w-img276.png]]<span id/ol><ol start="use-data-cable-to-connect6" style="list-adbstyle-debuggingtype: decimal;"><li>If you choose to display the kernel configuration menu (the second option) in step 3), the kernel configuration interface opened through '''make menuconfig''' will pop up. At this time, you can directly modify the kernel configuration. After modification, save and exit. Yes, compilation of the kernel source code will begin after exiting.</spanli>=== Use data cable to connect adb debugging ===
<ol style="list-style-type: lower-alpha;">
<li>HDMI to VGA converterVersion of the linux kernel source code</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-| [o.k. ] Compiling current kernel [File:zero2w-img144'''6.1.png]31''' ]|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>A VGA cable and a Mini HDMI male to HDMI female adapterThe version of the cross-compilation tool chain used</li></ol>{| class="wikitable" style="width:800px;" |-| [[File:zero2w-img145o.k.png]] Compiler version [[File:zero2w'''aarch64-linux-gnu-img146.png]gcc 11''' ]|}</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>A monitor or TV that supports VGA interfaceThe default configuration file used by the kernel and the path where it is stored are as follows</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Using kernel config file [ '''orangepi-build/external/config/kernel/linux-6.1-sun50iw9-next.config''' ]|}</ol><ol start="4" style="list-style-type: lower-alpha;"><!li>The path to the kernel-related deb package generated by compilation</li>{| class="wikitable" style="width:800px;" |- | [ o.k. ] Target directory [ '''output/debs/''' ]|}</ol><ol start="5" style="list-style-type: lower-alpha;"><li>The package name of the kernel image deb package generated by compilation</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] File name [ '''linux-image-next-sun50iw9_x.x.x_arm64.deb''' ]|}</ol><ol start="26" style="list-style-type: decimallower-alpha;"><li>Compilation time</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Runtime [ '''10 min''' ]|}</ol><ol start="7" style="list-style-type: lower-alpha;"><li>HDMI Finally, the compilation command to VGA display test is as followsrepeatedly compile the last selected kernel will be displayed. Use the following command without selecting through the graphical interface, and you can directly start compiling the kernel source code.</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=kernel KERNEL_CONFIGURE=no''' ]|}</ol></li></ol><ol start="8" style="list-style-type: decimal;"><li><p>View the kernel-related deb package generated by compilation</p><olstyle="list-style-type: lower-alpha;"><li><p>'''linux-dtb-next-sun50iw9_x.x.x_arm64.deb''' Contains dtb files used by the kernel</p></li><li><p>'''linux-headers-next-sun50iw9_x.x.x_arm64.deb''' Contains kernel header files</p></li><li><p>'''linux-image-next-sun50iw9_x.x.x_arm64.deb''' Contains kernel images and kernel modules</p></li>{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''ls output/debs/linux-*'''
IGNORE_UPDATES="'''<span style="color:#FF0000">yes</span>'''"|}</ol><ol start="210" style="list-style-type: decimal;"><li>Then select '''Network &<p>If the kernel is modified, you can use the following method to update the kernel and kernel module of the development board Linux system</p><ol style="list-style-type: lower-alpha; Internet'''"></li>Upload the compiled deb package of the Linux kernel to the Linux system of the development board</olli>{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''cd output/debs'''
'''linux-image-next-sun50iw9_x.x.x_arm64.deb root@192.168.1.xxx:/root'''|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Install the deb package of the new linux kernel just uploaded.</li>{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''sudo dpkg -i linux-image-next-sun50iw9_x.x.x_arm64.deb'''|}</ol><ol start="3" style="list-style-type: decimallower-alpha;"><li>Then turn on WIrestart the development board and check whether the kernel-FIrelated modifications have taken effect.</li>{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''sudo''' '''reboot'''|}</ol></li></ol><span id="compile-rootfs"></span>
<ol start="52" style="list-style-type: decimal;"><li>After selecting the WI-FI you want to connect to, the password input interface shown below will pop up.Select '''Rootfs and all deb packages''' and press Enter</li></ol>
<div class="figure">
[[File:zero2w-img317img285.png]]
</div></ol><ol start="63" style="list-style-type: decimal;"><li>Then use the keyboard to enter the password corresponding to the WI-FI, and then use the mouse to click the Enter button on select the virtual keyboard to start connecting to model of the WI-FI.development board</li></ol>
[[File:zero2w-img275.png]]<div class/ol><ol start="figure4" style="list-style-type: decimal;"><li><p>Then select the branch type of the kernel source code. Different versions of the kernel source code maintain different rootfs types.</p><ol style="list-style-type: lower-alpha;"><li><p>In the current branch, you can see three options: debian11, ubuntu20.04, and ubuntu22.04.</p></li><li><p>In the next branch, you can see three options: debian11, debian12, and ubuntu22.04.</p></li>
[[File:zero2w-img318img276.png]]</ol></li></ol><ol start="5" style="list-style-type: decimal;"><li>Then select the type of rootfs</li>
[[File:zero2w-img286.png]]</divol><ol start="76" style="list-style-type: decimal;"><li>The display after successful WI<p>Then select the type of image</p><ol style="list-FI connection style-type: lower-alpha;"><li><p>'''Image with console interface (server)''' Represents the image of the server version, which is as shown belowrelatively small in size.</p></li><li><p>'''Image with desktop environment''' Represents an image with a desktop, which is relatively large in size.</olp></li>
[[File:zero2w-img320img290.png]]
[[File:zero2w-img321img291.png]]</ol><ol start="9" style="list-style-type: decimal;"><li><p>Then the compilation of rootfs will start. Some of the information prompted during compilation are as follows:</p><ol style="list-style-type: lower-alpha;"><li>Type of rootfs</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] local not found [ Creating new rootfs cache for '''bullseye''' ]|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>The storage path of the compiled rootfs compressed package</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Target directory [ '''orangepi-build/external/cache/rootfs''' ]|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>The name of the rootfs compressed package generated by compilation</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] File name [ '''bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4''' ]|}</ol></li></ol><ol start="10" style="list-style-type: decimal;"><li><p>View the compiled rootfs compressed package</p><ol style="list-style-type: lower-alpha;"><li>'''bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4''' It is a compressed package of rootfs. The meaning of each field in the name is</li>
<ol startspan id="2" style="listcompile-stylelinux-type: decimal;image"><li><p>Then make sure the network port of the expansion board is connected to the router or switch</p></li><li><p>Then open '''Settings'''</p><p>[[File:zero2w-img324.png]]</p></li><li><p>Then select '''Network & Internet'''</p><p>[[File:zero2w-img325.png]]</p></li><li><p>Then you can see the IP address of the development board's wired network port at the location shown in the picture below.</p><p>[[File:zero2w-img326.png]]</p></li></olspan>
# Choose first Run the '''Settingsbuild.sh'''script, remember to add sudo permissions
<ol start="2" style="list-style-type: decimal;">
<li>Then select Select '''BluetoothFull OS image for flashing'''and press Enter</li> </oldiv class="figure">
[[File:zero2w-img327img292.png]]
</div></ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then Open '''Bluetooth Enable'''select the model of the development board</li></ol> [[File:zero2w-img328.png]]
[[File:zero2w-img275.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>Then click '''Pair new device'''to start scanning for surrounding Bluetooth devicesselect the branch type of the kernel source code. Different versions of the kernel source code maintain different rootfs types.</p><ol style="list-style-type: lower-alpha;"><li><p>In the current branch, you can see three options: debian11, ubuntu20.04, and ubuntu22.04.</olp></li> [[File<li><p>In the next branch, you can see three options:zero2w-img329debian11, debian12, and ubuntu22.04.png]]</p></li>
[[File:zero2w-img276.png]]
</ol>
</li></ol>
<ol start="5" style="list-style-type: decimal;">
<li>The searched Bluetooth devices <p>If you select the next branch, you will also be displayed under '''Available devices'''prompted to select the memory size, and you do not need to select the current branch.</p><ol style="list-style-type: lower-alpha;"><li><p>If the development board you purchased has a memory size of 1.5GB, please select the first option.</p></li><li><p>If the development board you purchased has 1GB or 2GB or 4GB memory size, please choose the second option.</p><p>[[File:zero2w-img277.png]]</p></li></ol></li><li><p>Then select the type of rootfs</p></li>
[[File:zero2w-img330img286.png]]</ol><ol start="7" style="list-style-type: decimal;"><li><p>Then select the type of image</p><ol style="list-style-type: lower-alpha;"><li><p>'''Image with console interface (server)''' Represents the image of the server version, which is relatively small in size.</p></li><li><p>'''Image with desktop environment'''Represents an image with a desktop, which is relatively large in size.</p></li>
<ol startdiv class="6figure" style="list-style-type: decimal;"><li>Then click on the Bluetooth device you want to connect to start pairing. When the following interface pops up, please use the mouse to select the '''Pair'''option</li></ol>
[[File:zero2w-img331img287.png]]
</div></ol></li></ol><ol start="78" style="list-style-type: decimal;"><li>What is tested here is the Bluetooth configuration process between If you are compiling the development board and server version of the Android phone. At this timeimage, you can also choose to compile the following confirmation interface will pop up on Standard version or the phoneMinimal version. Click The Minimal version will have much less pre-installed software than the pairing button on Standard version ('''please do not choose the phone to start the pairing processMinimal version without special needs, because many things are not pre-installed by default.Some functions may not be available''')</li></ol>
</div></ol>
<ol start="9" style="list-style-type: decimal;">
<li>At this time, If you can use the Bluetooth are compiling a desktop version of your mobile phone to send a picture to the development board. After sendingimage, you can see also need to select the following confirmation interface in the Android system type of the development boarddesktop environment. Currently, only XFCE is maintained, and then click '''Accept''' to start receiving the pictures sent by the mobile phoneso please select an XFCE type desktop.</li></ol>
[[File:zero2w-img334img289.png]]
[[File:zero2w-img291.png]]</ol><span idol start="how-to-set-usb0-to-host10" style="list-modestyle-1type: decimal;"><li>Then the compilation of the linux image will begin. The general process of compilation is as follows</spanli>== How to set USB0 to HOST mode ==
<span id="orange-pi-os-arch-system-function-adaptation-status"></dev/video0span>== Orange Pi OS Arch system function adaptation status ==
<div class="figure">
[[File:zero2w-img344img295.png]]
</div></li>
<li><p>Then find the screen mirroring function in the phone settings. Here we take '''Xiaomi 12S Pro mobile phone''' as an example. Please research other brands of mobile phones by yourself. As shown in the picture below, click the button in the red box to open the screen mirroring function of the phone.</p><p>[[File:zero2w-img345.png]]</p></li><li><p>After waiting for a period of time, you will be able to see the searched connectable devices on your mobile phone, and then we can select the device corresponding to the development board to connect.area</p><p>[[File:zero2w-img346.png]]</p></li><li><p>Then the selection box shown in the div class="figure below will pop up in the '''MiracastReceiver''' application interface of the development board. Here we can select '''Accept'''</p><p>[[File:zero2w-img347.png]]</p></li><li><p>Then you can see the content of the mobile phone screen on the HDMI screen connected to the development board</p><p>[[File:zero2w-img348.png]]</p></li></ol">
[[File:zero2w-img107img297.png]]
[[File:zero2w-img269img298.png]]
[[File:zero2w-img349img299.png]]
[[File:zero2w-img350img300.png]]
</div></li><li><p>After shutting downthe installation is complete, press and hold you need to click the power '''Finish''' button or the power button on to restart the infrared remote control again to turn it onsystem.</p><div class="figure">
</div></li><li><p>The Orange Pi Hello program will automatically start after restarting. At this time, you need to remove the check '''Note: The pin header mark of Start on startup''' in the 40pin interface is not soldered by defaultlower right corner, and otherwise you need to solder it yourself before manually close the Orange Pi Hello program every time you start it can be used.'''</p><div class="figure">
::{| class="wikitable" style="width:800px;" |-| [[File:zero2worangepi@orangepi-img353pc ~]$ '''sudo vim /boot/extlinux/extlinux.png]]conf'''|}
<ol start="42" style="list-style-type: decimal;"><li>Then click open the corresponding configuration by adding '''GPIO READALLFDTOVERLAYS''' '''/dtbs/allwinner/overlay/xxx.dtbo''' in '''/boot/extlinux/extlinux.conf''' button, and the output information is as shown below:</li></ol>
'''FDTOVERLAYS /dtbs/allwinner/overlay/<span style="color:#FF0000">xxx.dtbo</span>''' #Configuration that needs to be added|}</ol><ol start="73" style="list-style-type: decimal;"><li>Click the '''CheckBox''' button <p>The storage path of xxx.dtbo in the picture below again to uncheck it, and pin 12 will be set to low levelOPi OS Arch image is as follows. After setting, you Please note that not all dtbo under this path can use a multimeter to measure the voltage value of the pinbe used. If it is </p>{| class="wikitable" style="width:800px;" |-| <p>'''0v/boot/dtbs/allwinner/overlay/''', it means </p>|}</li><li><p>The DT overlays configuration that can be used by the low level setting development board is successful.as follows</lip></olli>
|-
| '''GPIO序号Functions on the development board'''| '''GPIO'''| '''功能'''| '''引脚'''|| '''引脚'''| '''功能'''| '''GPIO'''| '''GPIO序号Corresponding DT overlays configuration'''
|-
|-
| '''26440pin - i2c1'''| '''PI8'''| '''TWI1sun50i-h616-pi-SDAi2c1.dtbo'''| '''3'''|| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''26340pin - i2c2'''| '''PI7sun50i-h616-pi-i2c2.dtbo'''| '''TWI1-SCL'''| '''540pin - uart2'''|| '''6'''| '''GNDsun50i-h616-pi-uart2.dtbo'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''26940pin - uart3'''| '''PI13'''| '''PWM3'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224sun50i-h616-pi-uart3.dtbo'''
|-
|-
| '''22640pin - uart5'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''12'''| style="textsun50i-h616-ph-align: left;"|| '''PI1'''| '''257uart5.dtbo'''
|-
| '''22740pin - pwm1'''| '''PH3'''| '''UART5_RX'''| '''13'''|| '''14''sun50i-h616-pi-pwm1.dtbo'| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''26140pin - pwm2'''| '''PI5'''| '''UART2_TX'''| '''15'''|| '''16'''| '''PWM4'''| '''PI14'''| '''270sun50i-h616-pi-pwm2.dtbo'''
|-
|-
| '''23140pin - pwm4'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|| '''20''sun50i-h616-pi-pwm4.dtbo'| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''23240pin - spi1 cs0'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''UART2_RX'''| '''PI6'''| '''262sun50i-h616-spi1-cs0-spidev.dtbo'''
|-
| '''23040pin - spi1 cs1'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229sun50i-h616-spi1-cs1-spidev.dtbo'''
|-
|-
| '''266设Set USB0 to Host mode'''| '''PI10'''| '''TWI2sun50i-h616-SDA'''| '''27'''|| '''28'''| '''TWI2usb0-SCL'''| '''PI9'''| '''265host.dtbo'''
|-
| '''256Turn off the green LED light'''| '''PI0'''| style="textsun50i-h616-zero2w-disable-align: left;"|| '''29'''|| '''30'''| ''led.dtbo'GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''271How to close the UART0 debugging serial port'''| '''PI15sun50i-h616-disable-uart0.dtbo'''| }</ol><ol start="5" style="textlist-style-aligntype: leftdecimal;"|>| <li>If you need to open multiple configurations at the same time, just add the paths of multiple configurations directly after '''31FDTOVERLAYS.'''For example, the configuration of opening i2c1 and uart5 at the same time is as follows</li>{|| '''32'''| '''PWM1'''| '''PI11'''| '''267'''class="wikitable" style="width:800px;"
|-
| [orangepi@orangepi-pc ~]$ '''268sudo vim /boot/extlinux/extlinux.conf'''| '''PI12'''| '''PWM2'''LABEL Orange Pi KERNEL /Image | '''33'''FDT /dtbs/allwinner/sun50i-h616-orangepi-zero2w.dtb|| '''34FDTOVERLAYS <span style="color:#FF0000">/dtbs/allwinner/overlay/sun50i-h616-pi-i2c1.dtbo /dtbs/allwinner/overlay/sun50i-h616-ph-uart5.dtbo</span>'''| '''GND'''}</ol>| <ol start="6" style="textlist-style-aligntype: leftdecimal;"|><li>After setting, you need to restart the system for the configuration to take effect.</li>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| '''258'''| '''PI2'''| style="text-align: left;"|| '''35'''|| '''36'''| style="text-align: left;"|| '''PC12'''| '''76'''|[orangepi@orangepi-| '''272'''| '''PI16'''| style="text-align: left;"|| '''37'''|| '''38'''| style="text-align: left;"|| '''PI4'''| '''260'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''39'''|| '''40'''| style="text-align: left;"|| '''PI3'''| pc ~]$ '''259sudo reboot'''
|}
</ol>
<span id="how-to-install-software"></span>
<ol startspan id="3" style="listandroid-12-tv-system-styleusage-type: decimal;instructions"><li>First open wiringOP APP on the desktop</li></olspan>
<ol startspan id="4" style="listsupported-styleandroid-type: decimal;versions"><li>Then click the '''UART_TEST'''button to open the UART test interface</li></olspan>== Supported Android versions ==
<ol startspan id="5" style="listandroid-12-tv-function-styleadaptation-type: decimal;status"><li>The serial port test interface of wiringOP is as shown in the figure below</li></olspan>== Android 12 TV function adaptation status ==
|-
| '''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;"|
|-
| '''264'''| '''PI8'''| '''TWI1Type-SDA'''| '''3C USB2.0 x 2'''|| '''4OK'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''263TF card startup'''| '''PI7OK'''| '''TWI1-SCL'''| '''5'''|| '''6'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''269WIFI'''| '''PI13OK'''| '''PWM3'''| '''7'''|| '''8'''| '''UART0_TX'''-| '''PH0Bluetooth'''| '''224OK'''
|-
|-
| '''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'''
|-
|-
| '''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'''
|-
|-
| '''266Mali GPU'''| '''PI10'''| '''TWI2-SDA'''| '''27'''|| '''28'''| '''TWI2-SCL'''| '''PI9'''| '''265OK'''
|-
| '''256Video codec'''| '''PI0OK'''| } {| class="wikitable" style="width:800px;text-align: leftcenter;"|-| '''24pin Expansion board function'''| '''Android12 TV'''|-| '''29100M network port'''|'''OK'''|-| '''100M Ethernet port light'''| '''30OK'''|-| '''GNDUSB2.0 HOST x 2'''| '''OK'''| style="text-align: left;"|'''Infrared reception'''| '''OK'''| style="text-align: left;"| '''Headphone audio playback'''|'''OK'''
|-
| '''271On/off button'''| '''PI15'''| style="text-align: left;"|| '''31'''|| '''32'''| '''PWM1'''| '''PI11'''| '''267OK'''
|-
| '''268LRADC'''| '''PI12'''| '''PWM2'''| '''33Custom buttons x 2'''|| '''34OK, The default setting is the volume up and down keys.'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''258'''| '''PI2'''| style="textTV-align: left;"|| '''35'''|| '''36'''| style="text-align: left;"|| '''PC12OUT'''| '''76OK'''
|}
<ol startspan id="2" style="listonboard-led-light-styledisplay-type: decimal;instructions"><li>The device node corresponding to SPI1 CS0 is '''/dev/spidev1.0''', and the device node corresponding to SPI1 CS1 is '''/dev/spidev1.1'''</li></olspan>== Onboard LED light display instructions ==
<ol startspan id="5" style="listuse-network-connection-styleadb-type: decimal;debugging"><li>Then click the '''SPI_TEST''' button to open the SPI test interface</li></olspan>=== Use network connection adb debugging ===
192.168.1.xxx:5555 device|}</ol><ol start="5" style="list-style-type: decimal;"><li>Then you can log in to the android system through adb shell on Ubuntu PC</li>{| class="wikitable" style="width:800px;"
|-
| test@test:~$ '''GPIO serial numberadb shell''' apollo-p2:/ #| '''GPIO'''}</ol><span id="use-data-cable-to-connect-adb-debugging"></span> === Use data cable to connect adb debugging === | '''Function'# Prepare a USB Type C interface data cable, plug one end of the USB interface into the USB interface of the computer, and plug one end of the USB Type C interface into the USB0 interface of the development board (see the description of the picture on the right below for the location of USB0). In this case, the development board is powered by the computer's USB interface, so please ensure that the computer's USB interface can provide the most sufficient power to drive the development board.| '''pin'''|::[[File:zero2w-img304.png]] [[File:zero2w-img305.png]]| '''pin'''| '''Function'''<ol start="2" style="list-style-type: decimal;">| '''GPIO'''<li>Install adb tool on Ubuntu PC</li>{| '''GPIO serial number'''class="wikitable" style="width:800px;"
|-
|-
| test@test:~$ '''264adb devices'''| '''PI8'''| '''TWI1-SDA'''List of devices attached| '''3'''|4c00146473c28651dd0 device| '''4'''}| '''5V'''</ol>| <ol start="4" style="textlist-alignstyle-type: leftdecimal;"|><li>Then you can log in to the android system through adb shell on Ubuntu PC</li>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| test@test:~$ '''263adb shell''' apollo-p2:/ $| }</ol><span id="view-how-to-set-hdmi-display-resolution"></span> == View how to set HDMI display resolution == <ol style="list-style-type: decimal;"><li><p>Enter first '''PI7Settings'''</p><p>[[File:zero2w-img306.png]]</p></li>| <li><p>Then select '''TWI1-SCLDevice Preferences'''</p>| <p>[[File:zero2w-img307.png]]</p></li><li><p>Then select '''5Display & Sound'''</p>|<p>[[File:zero2w-img308.png]]</p></li>| <li><p>Then select '''6Advanced display settings'''</p><p>[[File:zero2w-img309.png]]</p></li>| <li><p>Then select '''GNDHDMI output mode'''</p><p>[[File:zero2w-img310.png]]</p></li><li><p>Then you can see the list of resolutions supported by the monitor. At this time, clicking the corresponding option will switch to the corresponding resolution. Please note that different monitors may support different resolutions. If you connect it to a TV, you will generally see more resolution options than the picture below.</p><p>[[File:zero2w-img311.png]]</p></li><li><p>The HDMI output of the development board supports 4K display. When connected to a 4K TV, you can see the 4K resolution option.</p><p>[[File:zero2w-img312.png]]</p></li></ol> <span id="hdmi-to-vga-display-test-1"></span>=== HDMI to VGA display test === | <ol style="textlist-style-aligntype: leftdecimal;"|><li><p>First you need to prepare the following accessories</p>| <ol style="textlist-style-aligntype: leftlower-alpha;"|><li>HDMI to VGA converter</li> [[File:zero2w-img144.png]]</ol><ol start="2" style="list-style-type: lower-alpha;"><li>A VGA cable and a Mini HDMI male to HDMI female adapter</li> [[File:zero2w-img145.png]] [[File:zero2w-img146.png]]</ol>|<ol start="3" style="list-style-type: lower-alpha;">| '''269'''<li>A monitor or TV that supports VGA interface</li></ol>| '''PI13'''</li></ol>| '''PWM3'''| '''7'''<ol start="2" style="list-style-type: decimal;">|<li>HDMI to VGA display test is as follows</li>| '''8'''| '''UART0_TX'''[[File:zero2w-img313.png]]| '''PH0'''{| '''224'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
[[File:zero2w-img331.png]]</ol><ol start="27" style="list-style-type: decimal;"><li>The device node corresponding to i2c1 What is tested here is '''/dev/i2c-1'''the Bluetooth configuration process between the development board and the Android phone. At this time, and the device node corresponding following confirmation interface will pop up on the phone. Click the pairing button on the phone to i2c2 is '''/dev/i2c-2'''start the pairing process.</li></ol>
[[File:zero2w-img333.png]]</ol><ol start="9" style="list-style-type: decimal;"><li>At this time, you can use the Bluetooth of your mobile phone to send a picture to the development board. After sending, you can see the following confirmation interface in the Android system of the development board, and then click '''/dev/i2c-1 /dev/i2c-2Accept''' to start receiving the pictures sent by the mobile phone.</dev/i2c-5li>
[[File:zero2w-img334.png]]</ol><ol start="310" style="list-style-type: decimal;"><li>First open wiringOP APP on Pictures received by the desktopBluetooth system of the development board Android system can be viewed in '''Received files'''.</li></ol>
[[File:zero2w-img351img335.png]]</ol><span id="how-to-set-usb0-to-host-mode-1"></span>
apollo-p2:/ #|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>The command to view the current mode of USB0 is</li>{| class="wikitable" style="width:800px;" |-| apollo-p2:/ # '''cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/otg_role''' usb_host|}</ol><span id="pinhow-pwmto-testuse-usb-camera"></span> === 40pin PWM test =How to use USB camera == # As can be seen from First insert the USB (UVC protocol) camera into the USB interface of the development board# If the table belowUSB camera is recognized normally, the available pwm are pwm1, pwm2, pwm3 and pwm4.corresponding video device node will be generated under /dev
::{| class="wikitable" style="width:800px;"
|-
| console:/ # '''GPIO serial numberls /dev/video0''' /dev/video0| '''GPIO'''} <ol start="3" style="list-style-type: decimal;"><li><p>Then make sure that the adb connection between the Ubuntu PC and the development board is normal. For how to use adb, please refer to the instructions in the section "[[Orange Pi Zero 2W#How to use ADB| '''FunctionHow to use ADB''']]".</p></li>| <li><p>Download the USB camera test APP from the '''pinofficial tool'''on the development board information download page</p></li> <div class="figure"> [[File:zero2w-img336.png]] </div><div class="figure"> [[File:zero2w-img337.png]]|| '''pin'''</div></ol>| '''Function'''<ol start="5" style="list-style-type: decimal;">| '''GPIO'''<li>Then use the adb command to install the USB camera test APP into the Android system. Of course, you can also use a USB disk copy to install it.</li>{| '''GPIO serial number'''class="wikitable" style="width:800px;"
|-
| test@test:~$ '''adb install usbcamera.apk'''|}</ol><ol start="6" style="textlist-alignstyle-type: leftdecimal;"|><li>After installation, you can see the startup icon of the USB camera on the Android desktop.</li> [[File:zero2w-img338.png]]</ol>| <ol start="7" style="textlist-alignstyle-type: leftdecimal;"|>| '''3<li>Then double-click to open the USB camera APP and you can see the output video of the USB camera.3V'''</li></ol> | '''1'''<span id="android-system-root-description"></span>|| '''2'''== Android system ROOT description ==| '''5V'''{| styleclass="text-align: left;wikitable"|| style="textbackground-aligncolor: left#ffffdc;width:800px;"|
|-
| <big>'''264The Android system released by Orange Pi has been ROOT and can be tested using the following method.'''</big>| } # Download from the '''PI8official tool'''| on the development board data download page '''TWI1-SDArootcheck.apk'''| '''3'''|<div class="figure"> ::[[File:zero2w-img336.png]] </div><div class="figure"> ::[[File:zero2w-img339.png]] </div><ol start="2" style="list-style-type: decimal;"><li><p>Then make sure that the adb connection between the Ubuntu PC and the development board is normal. For how to use adb, please refer to the instructions in the section "[[Orange Pi Zero 2W#How to use ADB| '''4How to use ADB''']]".</p></li>| '''5V'''<li><p>Then use the adb command to install rootcheck.apk into the Android system. Of course, you can also use a USB disk copy to install it.</p></li>{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| test@test:~$ '''263adb install rootcheck.apk'''| '''PI7'''}</ol><ol start="4" style="list-style-type: decimal;"><li>After installation, you can see the startup icon of the ROOT test tool on the Android desktop.</li> [[File:zero2w-img340.png]]</ol>| '''TWI1<ol start="5" style="list-style-SCL'''type: decimal;">| <li>The display interface after opening the '''5ROOT test tool'''for the first time is as shown below</li> [[File:zero2w-img341.png]]|</ol>| '''<ol start="6'''" style="list-style-type: decimal;">| <li>Then you can click '''GNDCHECK NOW'''to start checking the ROOT status of the Android system. After the check is completed, the display is as follows. You can see that the Android system has obtained ROOT permissions.</li> | style[[File:zero2w-img342.png]]</ol><span id="texthow-to-use-align: left;miracastreceiver-to-cast-the-mobile-phone-screen-to-the-development-board"|></span> == How to use MiracastReceiver to cast the mobile phone screen to the development board == | <ol style="textlist-alignstyle-type: leftdecimal;"|>|<li><p>First, please make sure that both the development board and the mobile phone are connected to the same WIFI hotspot. For the method of connecting the development board to WIFI, please refer to [[Orange Pi Zero 2W#WI-FI connection method| '''269the instructions in the WI-FI connection method.''']]</p></li>| <li><p>Then open the '''PI13MiracastReceiver'''application in the Android system of the development board</p>| <p>[[File:zero2w-img343.png]]</p></li><li><p>The interface after '''PWM3MiracastReceiver'''is opened is as follows</p>| <div class="figure"> [[File:zero2w-img344.png]] </div></li><li><p>Then find the screen mirroring function in the phone settings. Here we take '''7Xiaomi 12S Pro mobile phone'''as an example. Please research other brands of mobile phones by yourself. As shown in the picture below, click the button in the red box to open the screen mirroring function of the phone.</p>|<p>[[File:zero2w-img345.png]]</p></li><li><p>After waiting for a period of time, you will be able to see the searched connectable devices on your mobile phone, and then we can select the device corresponding to the development board to connect.</p><p>[[File:zero2w-img346.png]]</p></li>| <li><p>Then the selection box shown in the figure below will pop up in the '''8MiracastReceiver'''| application interface of the development board. Here we can select '''UART0_TXAccept'''</p><p>[[File:zero2w-img347.png]]</p></li><li><p>Then you can see the content of the mobile phone screen on the HDMI screen connected to the development board</p><p>[[File:zero2w-img348.png]]</p></li></ol> <span id="method-of-turning-on-and-off-the-machine-through-buttons-or-infrared-remote-control"></span> == Method of turning on and off the machine through buttons or infrared remote control == We can turn off or turn on the Android system of the development board through the power on/off button or infrared remote control. However, it should be noted that there is no power on/off button and infrared receiver on the main board of the development board, and it needs to be expanded through a 24pin expansion board. [[File:zero2w-img107.png]] The location of the power button on the 24pin expansion board is as shown in the figure below: [[File:zero2w-img269.png]]| The location of the infrared remote control power button is as follows: [[File:zero2w-img349.png]] When shutting down, we need to press and hold the power button or the power button on the infrared remote control, and then the Android system will pop up the confirmation dialog box shown in the figure below, and then select '''PH0OK'''to shut down the Android system. [[File:zero2w-img350.png]] After shutting down, press and hold the power button or the power button on the infrared remote control again to turn it on. <span id="pin-interface-gpio-uart-spi-test"></span>== 40pin interface GPIO, UART, SPI test == {| '''224'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big>'''Note: The pin header on the 40pin interface is not soldered by default, and you need to solder it yourself before it can be used.'''</big>|} <span id="pin-gpio-port-test-method"></span>=== 40pin GPIO port test method === # First open wiringOP APP on the desktop ::[[File:zero2w-img351.png]] <ol start="2" style="textlist-style-type: decimal;"><li>Then click the '''GPIO_TEST''' button to open the GPIO test interface</li> [[File:zero2w-img352.png]]</ol><ol start="3" style="list-style-aligntype: decimal;"><li>The GPIO test interface is as shown in the figure below. The two rows of '''CheckBox''' buttons on the lefthave 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> [[File:zero2w-img353.png]]</ol><ol start="4" style="list-style-type: decimal;"><li>Then click the '''GPIO READALL''' button, and the output information is as shown below:</li> <div class="figure"> [[File:zero2w-img354.png]] </div></ol><ol start="5" style="list-style-type: decimal;"><li>There are a total of 28 GPIO ports available in the 40-pin development board. The following takes pin 12 - corresponding to GPIO PI01 - corresponding to wPi serial number 6 - as an example to demonstrate how to set the high and low levels of the GPIO port. First click the '''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.</li> [[File:zero2w-img356.png]]</ol>| <ol start="7" style="textlist-style-aligntype: leftdecimal;"|>| <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 '''GND0v''', it means the low level setting is successful.</li> [[File:zero2w-img357.png]]| </ol><ol start="8" style="list-style-type: decimal;"><li>Then click the '''9GPIO READALL'''button and you can see that the current pin 12 mode is OUT and the pin level is low level.</li> [[File:zero2w-img358.png]]</ol><span id="pin-uart-test-method"></span> === 40pin UART test method === # As can be seen from the table below, the default uarts available in the Android12 TV system are uart2 and uart5. Please note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial port. <div style="display: flex;">::{|class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''10GPIO NO.'''| '''UART0_RXGPIO'''| '''PH1Function'''| '''225Pin'''
|-
| style="text-align: left;"|
| style="text-align: left;"|| '''3.3V'''| '''1'''|-| '''264'''| '''PI8'''| '''TWI1-SDA'''| '''3'''|-| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|-| '''269'''| '''PI13'''| '''PI1PWM3'''| '''2577'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''9'''
|-
| '''261<span style="color:#FF0000">226</span>'''| '''<span style="color:#FF0000">PH2</span>'''| '''<span style="color:#FF0000">UART5_TX</span>'''| '''<span style="color:#FF0000">11</span>'''|-| '''<span style="color:#FF0000">227</span>'''| '''PI5<span style="color:#FF0000">PH3</span>'''| '''UART2_TX<span style="color:#FF0000">UART5_RX</span>'''| '''15<span style="color:#FF0000">13</span>'''|-| '''16<span style="color:#FF0000">261</span>'''| '''PWM4<span style="color:#FF0000">PI5</span>'''| '''PI14<span style="color:#FF0000">UART2_TX</span>'''| '''270<span style="color:#FF0000">15</span>'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|-
| '''231'''
| '''SPI1_MOSI'''
| '''19'''
|-
| '''232'''
| '''SPI1_MISO'''
| '''21'''
|-
| '''230'''
| '''SPI1_CLK'''
| '''23'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
| '''PI10'''
| '''TWI2-SDA'''
| '''27'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''40Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|
| style="text-align: left;"|
|-| '''PI34'''| '''2595V'''|} <ol startstyle="2text-align: left;" || style="list-styletext-typealign: decimalleft;">|<li>First click the wiringOP icon to open wiringOP APP</li></ol>|-| '''6'''[[File:zero2w-img351.png]]| '''GND''' <ol start| style="3text-align: left;" || style="listtext-style-typealign: decimalleft;">||-<li>Then click the | '''PWM_TEST8''' button on the main interface of wiringOP to enter the PWM test interface</li></ol>| '''UART0_TX'''[[File:zero2w-img380.png]]| '''PH0'''| '''224'''<ol start="4" style="list-style|-type: decimal;"><li>The PWM test interface is as follows</li></ol>| '''10'''| '''UART0_RX'''<div class="figure">| '''PH1'''| '''225'''[[File:zero2w|-img381.png]]| '''12'''</div><ol start="5" | style="list-styletext-typealign: decimalleft;">|<li>Then set which PWM you want to use in the Channel. The default is PWM1. If you want to set it to PWM2, just enter 2 in the Channel. PWM3 and PWM4 and so on.</li></ol>| '''PI1'''| '''257'''[[File:zero2w|-img382.png]]| '''14'''| '''GND'''<ol start| style="6text-align: left;" || style="list-styletext-typealign: decimalleft;">||-| '''16'''<li>Then you can set the PWM period. The default configuration is | '''50000nsPWM4'''. The converted PWM frequency is | '''20KHzPI14'''</li></ol>| '''270'''[[File:zero2w|-img383.png]]| '''18'''<ol start="7" | style="list-styletext-typealign: decimalleft;">|<li>Then click the | '''EXPORTPH4'''button to export PWM</li></ol>| '''228'''[[File:zero2w|-img384.png]]| '''20'''<ol start| '''GND'''| style="8text-align: left;" || style="listtext-align: left;"||-| '''<span style-type="color: decimal;#FF0000">22<li/span>Then drag the progress bar below to change the PWM duty cycle, and then check '''Enable| ''' to output the PWM waveform.</lispan style="color:#FF0000">UART2_RX</olspan>''' [[File:zero2w-img385.png]] | '''<ol start="9" span style="list-style-typecolor: decimal;#FF0000"><li>Then use an oscilloscope to measure the corresponding pins in the 40pin development board and you can see the following waveform.PI6</li></olspan>''' [[File:zero2w-img386.png]] | '''<span idstyle="how-to-compile-android-12-source-codecolor:#FF0000">262</span>'''|-| '''24'''| '''SPI1_CS0'''= | '''How to compile Android 12 source codePH5''' =| '''229'''<span id="download|-the| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-source| '''28'''| '''TWI2-code-of-androidSCL'''| '''PI9'''| '''265'''|-12"></span>== Download the source code of Android 12 ==| '''30'''| '''GND'''<ol | style="list-styletext-typealign: decimalleft;">|<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-styletext-typealign: lower-alphaleft;">||-| '''32'''<li>Google Cloud Drive</li></ol>| '''PWM1'''</li></ol>| '''PI11'''| '''267'''[[File:zero2w|-img387.png]]| '''34'''| '''GND'''<ol start| style="2text-align: left;" || style="listtext-align: left;"||-| '''36'''| style="text-typealign: decimalleft;">|| '''PC12'''<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| '''76'''s how to check the MD5 checksum:</li></ol>|-test@test:~$ | '''md5sum -c H618-Android12-Src.tar.gz.md5sum38''' H618| style="text-Android12-Src.tar.gzaaalign: left;"|| '''OKPI4'''| '''260'''H618|-Android12| '''40'''| style="text-Src.tar.gzabalign: left;"|| '''OKPI3'''| '''259'''......|}</div>
<ol start="2" style="list-style-type: decimal;">
<li>The device node corresponding to uart2 is '''/dev/ttyAS2''', and the device node corresponding to uart5 is'''/dev/ttyAS5'''</li>
{| class="wikitable" style="width:800px;"
|-
|
<p>apollo-p2:/ # ls /dev/ttyAS*</p>
<p>/dev/ttyAS0 /dev/ttyAS1 '''<span style="color:#FF0000">/dev/ttyAS2 /dev/ttyAS5</span>'''</p>
|}
</ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then you need to merge multiple compressed files into one, and then extract First open wiringOP APP on the Android source code. The command looks like this:desktop</li></ol> test@test:~$ '''cat H618-Android12-Src.tar.gza* > H618-Android12-Src.tar.gz''' test@test:~$ '''tar -xvf H618-Android12-Src.tar.gz'''
[[File:zero2w-img351.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then unzip click the compressed package of the files modified by Orange Pi Zero2w</li></ol> test@test:~$ '''tar zxf opizero2w_android12_patches.tar.gzUART_TEST''' button to open the UART test@test:~$ '''ls''' '''opizero2w_android12_patches''' opizero2w_android12_patches.tar.gzinterface</li>
[[File:zero2w-img359.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>Then copy The serial port test interface of wiringOP is as shown in the files modified by Orange Pi Zero2w to the Android source codefigure below</li></ol>
[[File:zero2w-img362.png]]</ol><span idol start="compile8" style="list-style-type: decimal;"><li><p>Then use Dupont wire to short the-source-code-rx and tx pins of-android-12"uart</p></spanli>== Compile <li><p>Then you can enter a paragraph of characters in the send edit box below and click the source code of Android 12 =='''SEND''' button to start sending.</p></li>
[https[File://repo.huaweicloud.com/ubuntuzero2w-releases/22img364.04png]]</ubuntuol><span id="pin-22.04.2spi-desktoptest-amd64.iso '''https:method"><//repo.huaweicloud.com/ubuntu-releases/22.04/ubuntu-22.04.2-desktop-amd64.iso''']span>
# First install As can be seen from the software packages needed to compile Android12 source codetable below, the spi available for the 40pin interface is spi1, and there are two chip select pins cs0 and cs1
=== 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 /dev/i2c-2</span>''' /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>* > 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
Opios-arch-aarch64-xfce-opizero2w-23.09-linux6.1.31.img.xz