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;"
<li><p>Then use the '''nmcli''' command to connect to the scanned WIFI hotspot, where:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>'''wifi_name''' needs to be replaced with the name of the WIFI > hotspot you want to connect to</p></li><li><p>'''wifi_passwd''' needs to be replaced with the password of the > WIFI hotspot you want to connect to.</p>
{| class="wikitable" style="width:800px;"
|-
<ol style="list-style-type: decimal;">
<li><p>First log in to the Linux system, there are three ways:</p>
<p>a. If the development board is connected to a network cable, you can remotely log in to '''[[\lOrange Pi Zero 2W#SSH remote login development board|the Linux system through ssh]].'''</p>
<p>b. If the development board is connected to the debugging serial port, you can use the serial port terminal to log in to the Linux system (please use MobaXterm for the serial port software, the graphical interface cannot be displayed using minicom)</p>
<p>c. If the development board is connected to an HDMI display, you can log in to the Linux system through the HDMI display terminal.</p></li>
<li><p>Then enter the nmtui command in the command line to open the wifi connection interface</p>
{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo nmtui'''</p>|}</li>
<li><p>Enter the nmtui command to open the interface as shown below</p>
<p>[[File:zero2w-img109.png]]</p></li>
</div></li>
<li><p>You can check the IP address of the wifi through the '''ip a s wlan0''' command</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''ip a s wlan0'''</p>
<p>11: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000</p>
:<p>link/ether 24:8c:d3:aa:76:bb brd ff:ff:ff:ff:ff:ff</p>:<p>inet '''<span style="color:#FF0000">192.168.1.11</span>'''/24 brd 192.168.1.255 scope global dynamic noprefixroute wlan0</p>::<p>valid_lft 259069sec preferred_lft 259069sec</p>:<p>inet6 240e:3b7:3240:c4a0:c401:a445:5002:ccdd/64 scope global dynamic noprefixroute</p>::<p>valid_lft 259071sec preferred_lft 172671sec</p>:<p>inet6 fe80::42f1:6019:a80e:4c31/64 scope link noprefixroute</p>::<p>valid_lft forever preferred_lft forever</p>|}</li>
<li><p>Use the '''ping''' command to test the connectivity of the wifi network. The '''ping''' command can be interrupted by pressing the '''Ctrl+C''' shortcut key.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''ping www.orangepi.org -I wlan0'''</p>
<p>PING www.orangepi.org (182.92.236.130) from 192.168.1.49 wlan0: 56(84) bytes of data.</p>
<p>--- www.orangepi.org ping statistics ---</p>
<p>5 packets transmitted, 5 received, 0% packet loss, time 4006ms</p>
<p>rtt min/avg/max/mdev = 41.321/44.864/48.834/2.484 ms</p>|}</li></ol>
<span id="test-method-for-desktop-image"></span>
==== Test method for desktop image ====
=== Method to create WIFI hotspot through create_ap ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''create_ap is a script that helps quickly create WIFI hotspots on Linux, and supports bridge and NAT modes. It can automatically combine hostapd, dnsmasq and iptables to complete the setting of WIFI hotspots, avoiding users from complicated configurations. The github address is as follows: '''
[https://github.com/oblique/create_ap '''https://github.com/oblique/create_ap''']</big>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''The Linux image released by OPi has been pre-installed with the create_ap script. You can use the create_ap command to create a WIFI hotspot. The basic command format of create_ap is as follows: '''
'''create_ap [options] <wifi-interface> [<interface-with-internet>] [<access-point-name> [<passphrase>]]'''
'''* options: You can use this parameter to specify the encryption method, frequency band of WIFI hotspot, bandwidth mode, network sharing method, etc. You can get the options through create_ap -h.'''
'''* access-point-name: Hotspot name'''
'''* passphrase: hotspot password'''</big>|}
<span id="create_ap-method-to-create-wifi-hotspot-in-nat-mode"></span>
<ol style="list-style-type: decimal;">
<li><p>Enter the following command to create a WIFI hotspot with the name '''orangepi''' and password '''orangepi''' in NAT mode</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that in the following command, Debian12 needs to modify eth0 to end0'''</p></li></olbig>|}{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''sudo create_ap -m nat wlan0 eth0 orangepi orangepi --no-virt'''
|}
</li></ol>
<ol start="2" style="list-style-type: decimal;">
<li><p>If the following information is output, it means that the WIFI hotspot is successfully created.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo create_ap -m nat wlan0 eth0 orangepi orangepi --no-virt'''</p>
<p>Config dir: /tmp/create_ap.wlan0.conf.TQkJtsz1</p>
<p>wlan0: STA ce:bd:9a:dd:a5:86 RADIUS: starting accounting session D4FBF7E5C604F169</p>
<p>wlan0: STA ce:bd:9a:dd:a5:86 WPA: pairwise key handshake completed (RSN)</p>
<p>wlan0: EAPOL-4WAY-HS-COMPLETED ce:bd:9a:dd:a5:86</p>|}</li>
<li><p>At this time, take out your mobile phone and find the WIFI hotspot named '''orangepi''' created by the development board in the searched WIFI list. Then you can click '''orangepi''' to connect to the hotspot. The password is '''orangepi''' set above.</p>
<div class="figure">
</div></li>
<li><p>In NAT mode, the wireless device connected to the development board's hotspot requests an IP address from the development board's DHCP service, so there will be two different network segments. For example, the development board's IP here is 192.168.1.X</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that in the following command, Debian12 needs to modify eth0 to end0.'''</p></big>|}{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepi:~$ '''sudo ifconfig eth0'''</p>
<p>eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500</p>
::<p>inet '''<span style="color:#FF0000">192.168.1.150</span>''' netmask 255.255.255.0 broadcast 192.168.1.255</p>::<p>inet6 fe80::938f:8776:5783:afa2 prefixlen 64 scopeid 0x20<link></p>::<p>ether 4a:a0:c8:25:42:82 txqueuelen 1000 (Ethernet)</p>::<p>RX packets 25370 bytes 2709590 (2.7 MB)</p>::<p>RX errors 0 dropped 50 overruns 0 frame 0</p>::<p>TX packets 3798 bytes 1519493 (1.5 MB)</p>::<p>TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0</p>::<p>device interrupt 83</p>|}
<p>The DHCP service of the development board will assign the IP address of '''192.168.12.0/24''' to the device connected to the hotspot by default. At this time, click on the connected WIFI hotspot '''orangepi''', and then you can see that the IP address of the mobile phone is '''192.168.12.X'''.</p>
<div class="figure">
</div></li>
<li><p>If you want to specify a different network segment for the connected device, you can specify it through the -g parameter. For example, use the -g parameter to specify the network segment of the access point AP as 192.168.2.1.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| </li></olbig> '''Note that in the following command, Debian12 needs to modify eth0 to end0.'''</big>|}{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''sudo create_ap -m nat wlan0 eth0 orangepi orangepi -g 192.168.2.1 --no-virt'''|}
At this time, after connecting to the hotspot through the mobile phone, click on the connected WIFI hotspot '''orangepi''', and then you can see that the IP address of the mobile phone is '''192.168.2.X'''
</div>
</li></ol>
<ol start="7" style="list-style-type: decimal;">
<li><p>Without specifying the '''--freq-band''' parameter, the hotspot created by default is in the 2.4G frequency band. If you want to create a hotspot in the 5G frequency band, you can specify it through the '''--freq-band 5''' parameter. The specific command is as follows</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that in the following command, Debian12 needs to modify eth0 to end0'''</p></li></olbig>|}{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''sudo create_ap -m nat wlan0 eth0 orangepi orangepi --freq-band 5 --no-virt'''
|}
</li></ol>
<ol start="8" style="list-style-type: decimal;">
<li><p>If you need to hide the SSID, you can specify the '''--hidden''' parameter. The specific command is as follows</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that in the following command, Debian12 needs to modify eth0 to end0.'''</p></li></olbig>|}{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''sudo create_ap -m nat wlan0 eth0 orangepi orangepi --hidden --no-virt'''
|}
At this time, the mobile phone cannot search for WIFI hotspots. You need to manually specify the WIFI hotspot name and enter the password to connect to the WIFI hotspot.
</div>
</li></ol>
<span id="create_ap-method-to-create-wifi-hotspot-in-bridge-mode"></span>
==== create_ap method to create WIFI hotspot in bridge mode ====
<ol style="list-style-type: decimal;">
<li><p>Enter the following command to create a WIFI hotspot with the name '''orangepi''' and password '''orangepi''' in bridge mode</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that in the following command, Debian12 needs to modify eth0 to end0.'''</p></li></olbig>|}{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''sudo create_ap -m bridge wlan0 eth0 orangepi orangepi --no-virt'''
|}
</li></ol>
<ol start="2" style="list-style-type: decimal;">
<li><p>If the following information is output, it means that the WIFI hotspot is successfully created.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo create_ap -m bridge wlan0 eth0 orangepi orangepi --no-virt'''</p>
<p>Config dir: /tmp/create_ap.wlan0.conf.zAcFlYTx</p>
<p>wlan0: STA ce:bd:9a:dd:a5:86 RADIUS: starting accounting session 937BF40E51897A7B</p>
<p>wlan0: STA ce:bd:9a:dd:a5:86 WPA: pairwise key handshake completed (RSN)</p>
<p>wlan0: EAPOL-4WAY-HS-COMPLETED ce:bd:9a:dd:a5:86</p>|}</li>
<li><p>At this time, take out your mobile phone and find the WIFI hotspot named '''orangepi''' created by the development board in the searched WIFI list. Then you can click '''orangepi''' to connect to the hotspot. The password is '''orangepi''' set above.</p>
<div class="figure">
</div></li>
<li><p>In bridge mode, the wireless device connected to the hotspot of the development board also requests an IP address from the DHCP service of the main router (the router to which the development board is connected). For example, the IP of the development board here is '''192.168.1.X'''</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo ifconfig eth0'''</p>
<p>eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500</p>
::<p>inet '''<span style="color:#FF0000">192.168.1.150</span>''' netmask 255.255.255.0 broadcast 192.168.1.255</p>::<p>inet6 fe80::938f:8776:5783:afa2 prefixlen 64 scopeid 0x20<link></p>::<p>ether 4a:a0:c8:25:42:82 txqueuelen 1000 (Ethernet)</p>::<p>RX packets 25370 bytes 2709590 (2.7 MB)</p>::<p>RX errors 0 dropped 50 overruns 0 frame 0</p>::<p>TX packets 3798 bytes 1519493 (1.5 MB)</p>::<p>TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0</p>::<p>device interrupt 83</p>|}
<p>The IP of the device connected to the WIFI hotspot is also assigned by the main router, so the mobile phone connected to the WIFI hotspot and the development board are in the same network segment. At this time, click on the connected WIFI hotspot '''orangepi''', and then you can see the IP address of the mobile phone. Also '''192.168.1.X'''.</p>
<div class="figure">
</div></li>
<li><p>Without specifying the '''--freq-band''' parameter, the hotspot created by default is in the 2.4G frequency band. If you want to create a hotspot in the 5G frequency band, you can specify it through the '''--freq-band''' parameter. The specific command is as follows</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that in the following command, Debian12 needs to modify eth0 to end0.'''</p></li></olbig>|}{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''sudo create_ap -m bridge wlan0 eth0 orangepi orangepi --freq-band 5 --no-virt'''
|}
</li></ol>
<ol start="7" style="list-style-type: decimal;">
<li><p>If you need to hide the SSID, you can specify the '''--hidden''' parameter. The specific command is as follows</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that in the following command, Debian12 needs to modify eth0 to end0.'''</p></li></olbig>|}{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''sudo create_ap -m bridge wlan0 eth0 orangepi orangepi --hidden --no-virt'''|}
At this time, the mobile phone cannot search for WIFI hotspots. You need to manually specify the WIFI hotspot name and enter the password to connect to the WIFI hotspot.
</div>
</li></ol>
<span id="how-to-set-a-static-ip-address"></span>
=== How to set a static IP address ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Please do not set a static IP address by modifying the /etc/network/interfaces configuration file.'''</big>|}
<span id="use-the-nmtui-command-to-set-a-static-ip-address"></span>
<ol style="list-style-type: decimal;">
<li><p>First run the '''nmtui''' command</p>
{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo nmtui'''</p>|}</li>
<li><p>Then select '''Edit a connection''' and press the Enter key</p>
<p>[[File:zero2w-img124.png]]</p></li>
<li><p>Then press Enter. After pressing Enter, the following setting interface will pop up.</p>
<p>[[File:zero2w-img131.png]]</p></li>
<li><p>Then you can set the IP address (Addresses), gateway (Gateway) and DNS server address as shown in the figure below (there are many other setting options, please explore by yourself), <span style="color:#FF0000">please set according to your specific needs. The values set in the image below are just an example</span></p>
<p>[[File:zero2w-img132.png]]</p></li>
<li><p>After setting, move the cursor to '''<OK>''' in the lower right corner, and then press Enter to confirm.</p>
<p>[[File:zero2w-img138.png]] [[File:zero2w-img139.png]]</p></li>
<li><p>Then through '''ip a s eth0''' you can see that the IP address of the network port has become the static IP address set previously.</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that in the following command, Debian12 needs to modify eth0 to end0.'''</p></big>|}{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepi:~$ '''ip a s eth0'''</p>
<p>3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000</p>
:<p>link/ether 5e:ac:14:a5:92:b3 brd ff:ff:ff:ff:ff:ff</p>:<p>inet '''<span style="color:#FF0000">192.168.1.177</span>'''/24 brd 192.168.1.255 scope global noprefixroute eth0</p>::<p>valid_lft forever preferred_lft forever</p>:<p>inet6 241e:3b8:3240:c3a0:e269:8305:dc08:135e/64 scope global dynamic noprefixroute</p>::<p>valid_lft 259149sec preferred_lft 172749sec</p>:<p>inet6 fe80::957d:bbbe:4928:3604/64 scope link noprefixroute</p>::<p>valid_lft forever preferred_lft forever</p>|}</li>
<li><p>Then you can test the network connectivity to check whether the IP address is configured OK. The '''ping''' command can be interrupted by using the '''Ctrl+C''' shortcut key.</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that in the following command, Debian12 needs to modify eth0 to end0.'''</p></big>|}{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepi:~$ '''ping 192.168.1.177 -I eth0'''</p>
<p>PING 192.168.1.47 (192.168.1.47) from 192.168.1.188 eth0: 56(84) bytes of data.</p>
<p>--- 192.168.1.47 ping statistics ---</p>
<p>5 packets transmitted, 5 received, 0% packet loss, time 4042ms</p>
<p>rtt min/avg/max/mdev = 0.233/0.262/0.275/0.015 ms</p>|}</li></ol>
<span id="use-nmcli-command-to-set-static-ip-address"></span>
==== Use nmcli command to set static IP address ====
<li><p>Then you can view the name of the network device through the '''nmcli con show''' command, as shown below</p>
<ol style="list-style-type: lower-alpha;">
<li><p>'''orangepi''' is the name of the WIFI network interface (the > names are not necessarily the same)</p></li>
<li><p>'''Wired connection 1''' is the name of the Ethernet interface</p>
</li>
<li><p>中Then enter the following command, where</p>
<ol style="list-style-type: lower-alpha;">
<li><p>'''"Wired connection 1"''' means setting the static IP address > of the Ethernet port. If you need to set the static IP address > of WIFI, please change it to the name corresponding to the > WIFI network interface (can be obtained through the '''nmcli > con show''' command)</p></li><li><p>'''ipv4.addresses''' is followed by the static IP address to be > set, which can be modified to the value you want to set.</p></li>
<li><p>'''ipv4.gateway''' represents the address of the gateway</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo nmcli con mod "Wired connection 1" \<br />
ipv4.addresses "192.168.1.110" \'''</p>
<p>'''ipv4.gateway "192.168.1.1" \'''</p>
<p>'''ipv4.dns "8.8.8.8" \'''</p>
<p>'''ipv4.method "manual"'''</p>|}</li></ol>
</li>
<li><p>Then restart the linux system</p>
{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo reboot'''</p>|}</li>
<li><p>Then re-enter the Linux system and use the '''ip addr show eth0''' command to see that the IP address has been set to the desired value.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''ip addr show eth0'''</p>
<p>3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000</p>
:<p>link/ether 5e:ae:14:a5:91:b3 brd ff:ff:ff:ff:ff:ff</p>:<p>inet '''<span style="color:#FF0000">192.168.1.110</span>'''/32 brd 192.168.1.110 scope global noprefixroute eth0</p>::<p>valid_lft forever preferred_lft forever</p>:<p>inet6 240e:3b7:3240:c3a0:97de:1d01:b290:fe3a/64 scope global dynamic noprefixroute</p>::<p>valid_lft 259183sec preferred_lft 172783sec</p>:<p>inet6 fe80::3312:861a:a589:d3c/64 scope link noprefixroute</p>::<p>valid_lft forever preferred_lft forever</p>|}</li></ol>
<span id="how-to-set-up-the-linux-system-to-automatically-connect-to-the-network-for-the-first-time"></span>
=== How to set up the Linux system to automatically connect to the network for the first time ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''The development board has an Ethernet port. If you want to remotely log in to the Linux system of the development board through the Ethernet port, you only need to plug in a network cable that can access the Internet normally. After starting the Linux system, it will automatically connect to the Ethernet port through DHCP. Assign an IP address, and then we can obtain the IP address of the Ethernet port through the HDMI screen, serial port, or view the router's background, and then log in to the Linux system remotely.'''
'''The development board also has wireless WIFI. If you want to remotely log in to the Linux system of the development board through WIFI, you need to remotely log in to the Linux system through ssh through the IP address of the Ethernet port and then use commands to connect to WIFI, or use commands on the HDMI screen or serial port. Connect to WIFI.'''
'''But if there is no HDMI screen and serial port module, although there is a network cable, the IP address of the development board cannot be viewed through the router background. Or if there is no HDMI screen, serial port module and network cable, and only WIFI can be connected, you can use the method introduced in this section to automatically connect to WIFI and set the static IP address of WIFI or automatically set the static IP address of the Ethernet port.'''</big>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''To use the method in this section, you first need to prepare a Linux system machine. For example, a computer or virtual machine with Ubuntu system installed.'''
'''To use the method in this section, Why do you first need to prepare a Linux system machine? Because the root file system of the Linux system of the development board burned in the TF card is in ext4 format. For example, The Linux system machine can mount it normally and then modify the configuration file in it.'''</big>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''If you want to modify it in a computer or virtual machine with Ubuntu Windows system installed, you can use the software Paragon ExtFS for Windows. Since this software requires payment, and there is currently no similar free software that is easy to use, I will not demonstrate it in detail here.'''
<ol style="list-style-type: decimal;">
<li><p>First burn the Linux image of the development board you want to use into a TF card, and then use a card reader to insert the TF card with the Linux image of the development board into a machine with a Linux system (such as a machine with Ubuntu system Computer, the following uses Ubuntu computer as an example for demonstration)</p></li>
<li><p>When the TF card is inserted into the Ubuntu computer, the Ubuntu computer will generally automatically mount the Linux root file system partition in the TF card. From the following command, we can know that '''/media/test/opi_root''' is the Linux root file in the TF card. System mounting path</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''df -h | grep "media"'''</p>
<p>/dev/sdd1 1.4G 1.2G 167M 88% '''<span style="color:#FF0000">/media/test/opi_root</span>'''</p>
<p>test@test:~$ '''ls /media/test/opi_root'''</p>
<p>bin boot dev etc home lib lost+found media mnt opt proc root run <br> sbin selinux srv sys tmp usr var</p>|}</li>
<li><p>Then enter the '''/boot''' directory of the Linux system burned in the TF card</p>
{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''cd /media/test/opi_root/boot/'''</p>|}</li>
<li><p>Then copy the '''orangepi_first_run.txt.template''' to '''orangepi_first_run.txt'''. Through the orangepi_first_run.txt configuration file, you can set the development board to automatically connect to a WIFI hotspot when the Linux system starts for the first time. You can also set the WIFI or Ethernet port Static IP address.</p>
{| class="wikitable" style="width:800px;" |-| <p>test@test:/media/test/opi_root/boot$ '''sudo cp orangepi_first_run.txt.template orangepi_first_run.txt'''</p>|}</li>
<li><p>You can open the orangepi_first_run.txt file through the following command, and then you can view and modify the contents.</p>
{| class="wikitable" style="width:800px;" |-| <p>test@test:/media/test/opi_root/boot$ '''sudo vim orangepi_first_run.txt'''</p>|}</li>
<li><p>Variable usage instructions in the orangepi_first_run.txt file</p>
<ol style="list-style-type: lower-alpha;">
<li><p>'''FR_general_delete_this_file_after_completion''' The variable is > used to set whether to delete the orangepi_first_run.txt file > after the first startup. The default is 1, which means > deletion. If set to 0, orangepi_first_run.txt will be renamed > after the first startup.orangepi_first_run.txt.old, Generally, > just keep the default value</p></li><li><p>'''FR_net_change_defaults''' The variable is used to set whether > to change the default network settings. This must be set to 1, > otherwise all network settings will not take effect.</p></li><li><p>'''FR_net_ethernet_enabled''' The variable is used to control > whether to enable the configuration of the Ethernet port. If > you need to set the static IP address of the Ethernet port, > please set it to 1</p></li><li><p>'''FR_net_wifi_enabled''' The variable is used to control whether > to enable WIFI configuration. If you need to set the > development board to automatically connect to WIFI hotspots, > you must set it to 1. Also please note that if this variable > is set to 1, the Ethernet port settings will be invalid. That > is to say, the WIFI and Ethernet ports cannot be set at the > same time (why, because it is not necessary...)</p></li><li><p>'''FR_net_wifi_ssid''' Variable is used to set the name of the > WIFI hotspot you want to connect to</p></li><li><p>'''FR_net_wifi_key''' Variable is used to set the password of the > WIFI hotspot you want to connect to</p></li><li><p>'''FR_net_use_static''' Variables are used to set whether the > static IP address of the WIFI or Ethernet port needs to be > set.</p></li><li><p>'''FR_net_static_ip''' The variable is used to set the static IP > address. Please set it according to your actual situation.</p></li><li><p>'''FR_net_static_gateway''' Variables are used to set the gateway. > Please set according to your actual situation.</p></li></ol>
</li>
<li><p>Here are some specific setting examples:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>For example, if you want the Linux system of the development > board to automatically connect to the WIFI hotspot after it is > started for the first time, you can set it like this: </p><ol style="list-style-type: lower-alphanone;"><li><p>a) Set '''FR_net_change_defaults''' to 1</p></li><li><p>b) Set '''FR_net_wifi_enabled''' to '''1'''</p></li><li><p>c) Set '''FR_net_wifi_ssid''' to the name of the WIFI hotspot you > want to connect to</p></li><li><p>d) Set '''FR_net_wifi_key''' to the password of the WIFI hotspot > you want to connect to</p></li></ol>
</li>
<li><p>For example, you want the Linux system of the development board > to automatically connect to the WIFI hotspot after the first > startup, and set the WIFI IP address to a specific static IP > address (so that when the Linux system starts, you can > directly use the set static IP address to ssh remotely Log in > to the development board, there is no need to check the IP > address of the development board through the router > background), you can set it like this:</p><ol style="list-style-type: lower-alphanone;"><li><p>a) Set '''FR_net_change_defaults''' to '''1'''</p></li><li><p>b) Set '''FR_net_wifi_enabled''' to '''1'''</p></li><li><p>c) Set '''FR_net_wifi_ssid''' to the name of the WIFI hotspot you > want to connect to</p></li><li><p>d) Set '''FR_net_wifi_key''' to the password of the WIFI hotspot > you want to connect to</p></li><li><p>e) Set '''FR_net_use_static''' to '''1'''</p></li><li><p>f) Set '''FR_net_static_ip''' to the desired IP address</p></li><li><p>g) Set '''R_net_static_gateway''' to the corresponding gateway > address</p></li></ol>
</li>
<li><p>For example, if you want the development board's Linux system > to automatically set the IP address of the Ethernet port to > the desired static IP address after it is started for the > first time, you can set it like this</p><ol style="list-style-type: lower-alphanone;"><li><p>a) Set '''FR_net_change_default''' to '''1'''</p></li><li><p>b) Set '''FR_net_ethernet_enabled''' to '''1'''</p></li><li><p>c) Set '''FR_net_use_static''' to '''1'''</p></li><li><p>d) Set '''FR_net_static_ip''' to the desired IP address</p></li><li><p>e) Set '''FR_net_static_gateway''' to the corresponding gateway > address</p></li></ol>
</li></ol>
</li>
<li><p>After modifying the orangepi_first_run.txt file, you can exit the /boot directory of the development board Linux system in the TF card, uninstall the TF card, and then insert the TF card into the development board to start.</p></li>
<li><p>If a static IP address is not set, you still need to check the IP address through the router background. If a static IP address is set, you can ping the set static IP address on the computer. If you can ping, it means that the system has started normally, and The network has been set up correctly, and then you can use the set IP address to ssh to remotely log in to the Linux system of the development board.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''After the development board's Linux system is started for the first time, orangepi_first_run.txt will be deleted or renamed to orangepi_first_run.txt.old. At this time, even if the orangepi_first_run.txt configuration file is reset, and then the development board's Linux system is restarted, orangepi_first_run. The configuration in txt will not take effect again, because this configuration will only take effect when the Linux system is started for the first time after burning it. Please pay special attention to this point.'''</big>|}</li></ol><span id="ssh-remote-login-development-board"></span>
== SSH remote login development board ==
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Linux systems enable ssh remote login by default and allow root users to log in to the system. Before ssh login, you first need to ensure that the Ethernet or wifi network is connected, and then use the ip addr command or obtain the IP address of the development board by checking the router'''</big>|}
<span id="ssh-remote-login-development-board-under-ubuntu"></span>
# 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">
<span id="hdmi-test"></span>
== HDMI test ==
</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-alphanone;"><li><p>a) -d Option to specify the device node of the USB camera</p></li><li><p>b) --no-banner Used to remove watermarks from photos</p></li><li><p>c) -r option is used to specify the resolution of the photo</p></li><li><p>d) -S Option to skip previous frames</p></li><li><p>e) ./image.jpg Used to set the name and path of the generated > 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'''
| '''UART5_TX'''
| '''11'''
|-
| '''227'''
| '''UART5_RX'''
| '''13'''
| '''261'''
| '''PI5'''
| '''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'''
| 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.224''' [[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.10''' <ol style="list-style-type: decimal;"><li><p>Download the code of wiringOP</p><p>orangepi@orangepi:~$ | '''sudo apt updateUART0_RX'''</p><p>orangepi@orangepi:~$ | '''sudo apt install -y gitPH1'''</p><p>orangepi@orangepi:~$ | '''git clone https://github.com/orangepi-xunlong/wiringOP.git -b next225'''</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:~$ '12''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| style="pintext-interface-gpio-i2c-uart-spi-and-pwm-testingalign: left;"></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.PI1''' <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 out257'''</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 014'''</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 1GND'''</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| style="howtext-to-set-the-pull-down-resistor-of-40-pin-gpio-portalign: left;"></span>|=== How to set the pull-down resistor of 40 Pin GPIO port === <ol | style="listtext-style-typealign: decimalleft;">|<li><p>The following uses pin No. 7—corresponding to GPIO PI13—corresponding to wPi serial number 2—as an example to demonstrate how to set the 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 in16'''</p></li><li><p>After setting to input mode, execute the following command to set the GPIO port to pull-up mode.</p><p>root@orangepi:~/wiringOP# '''gpio mode 2 up| '''</p></li><li><p>Then enter the following command to read the level of the GPIO port. If the level is 1, it means that the pull-up mode is set successfully.</p><p>root@orangepi:~PWM4/wiringOP# ''UART4_RX'gpio read 2'''</p><p>| '''1PI14'''</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 2270'''</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序号18'''| '''GPIO'''| '''Function'''style="text-align: left;"| '''pin'''|| '''pin'''| '''Function'''| '''GPIOPH4'''| '''GPIO序号228'''
|-
| '''20'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-| '''22'''| '''TWI0_SDA/UART2_RX'''| '''PI6'''| '''262'''|-| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''28'''| '''TWI2-SCL/UART3_TX'''| '''3.3VPI9'''| '''1265'''|-| '''230'''| '''5VGND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26432'''| '''PI8PWM1'''| '''TWI1-SDAPI11'''| '''3267'''|| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|| '''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;"|
|-
| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''1240'''
| style="text-align: left;"|
| '''PI1PI3'''| '''257259'''|}</div></ol><ol start="3" style="list-style-type: decimal;"><li>There are a total of 28 GPIO ports in the 40pin interface. The high-level voltage of all GPIO ports is '''<span style="color:#FF0000">3.3v</span>'''</li></ol> <span id="how-to-install-wiringop"></span> == How to install wiringOP == {| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big>'''227Note 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.'''| '''PH3The storage path of the compiled wiringOP deb package in orangepi-build is: '''| '''UART5_RX<span style="color:blue">orangepi-build/external/cache/debs/arm64/wiringpi_x.xx.deb</span>'''| '''13After 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>'''14WiringOP 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>| '''GND'''} | <ol style="textlist-style-aligntype: leftdecimal;"|><li><p>Download the code of wiringOP</p>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| '''261'''| <p>orangepi@orangepi:~$ '''PI5'''| sudo apt update'''TWI0_SCL</UART2_TX'''p>| <p>orangepi@orangepi:~$ '''15sudo apt install -y git'''</p>|| <p>orangepi@orangepi:~$ '''16'git clone https://github.com/orangepi-xunlong/wiringOP.git -b next''| '''PWM4</UART4_RX'''p>| '''PI14'''}{| '''270'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|-
| <p>orangepi@orangepi:~$ '''231cd wiringOP'''</p>| <p>orangepi@orangepi:~/wiringOP$ '''PH7sudo ./build clean'''</p>| <p>orangepi@orangepi:~/wiringOP$ '''SPI1_MOSIsudo ./build'''</p>| '''19'''}</li>|<li><p>The output of the test gpio readall command is as follows</p>| '''20'''<p>[[File:zero2w-img170.png]]</p></li></ol>| '''GND'''| style<span id="textpin-interface-gpio-i2c-uart-spi-and-align: left;pwm-testing"|></span> == 40pin interface GPIO, I2C, UART, SPI and PWM testing == {| class="wikitable" style="textbackground-aligncolor:#ffffdc;width: left800px;"|
|-
| '''232'''| <big>'''PH8'''| '''SPI1_MISONote: 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>| '''21'''}|| '''22'''| '''TWI0_SDA<span id="pin-gpio-port-test"></UART2_RX'''span>| '''PI6'''=== 40pin GPIO port test ===| '''262'''|<ol style="list-style-type: decimal;">| '''230'''<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>| '''PH6'''<p>[[File:zero2w-img171.png]]</p></li>| '''SPI1_CLK'''| '''23'''<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>{|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''class="wikitable" style="width:800px;"
|-
| style="text-align<p>root@orangepi: left;"|| ~/wiringOP# '''gpio mode <span style="text-aligncolor: left;#FF0000"|| '''GND'''| '''25>2</span> out'''</p>|}| '''26'''| '''SPI1_CS1'''</li>| '''PH9'''<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>{| '''233'''class="wikitable" style="width:800px;"
|-
| '''266'''| <p>root@orangepi:~/wiringOP# '''PI10gpio write 2 <span style="color:#FF0000">0</span>'''| '''TWI2-SDA</UART3_RX'''p>| '''27'''}|| '''28'''</li>| '''TWI2-SCL<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.</UART3_TX'''p>{| '''PI9'''| '''265'''class="wikitable" style="width:800px;"
|-
| <p>root@orangepi:~/wiringOP# '''256gpio write 2 <span style="color:#FF0000">1</span>'''</p>| '''PI0'''}</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> | style<span id="texthow-align: left;to-set-the-pull-down-resistor-of-40-pin-gpio-port"|></span>| '''29'''|=== How to set the pull-down resistor of 40 Pin GPIO port ===| '''30'''| '''GND'''| <ol style="textlist-style-aligntype: leftdecimal;"|><li><p>The following uses pin No. 7—corresponding to GPIO PI13—corresponding to wPi serial number 2—as an example to demonstrate how to set the pull-up and pull-down resistors of the GPIO port.</p><p>[[File:zero2w-img171.png]]</p></li><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>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| <p>root@orangepi:~/wiringOP# '''271gpio 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>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP# '''PI15gpio mode <span style="color:#FF0000">2</span> up'''</p>|}</li><li><p>Then enter the following command to read the level of the GPIO port. If the level is 1, it means that the pull-up mode is set successfully.</p>{| class="wikitable" style="text-alignwidth: left800px;"|-| <p>root@orangepi:~/wiringOP# '''31gpio read <span style="color:#FF0000">2</span>'''</p>|| <p>'''32<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# '''PWM1gpio mode <span style="color:#FF0000">2</span> down'''</p>|}</li><li><p>Then enter the following command to read the level of the GPIO port. If the level is 0, it means that the pull-down mode is set successfully.</p>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP# '''PI11gpio read <span style="color:#FF0000">2</span>'''</p>| <p>'''267<span style="color:#FF0000">0</span>'''</p>|}</li></ol> <span id="pin-spi-test"></span> === 40pin SPI test === # As can be seen from the table below, the spi available for the 40pin interface is spi1, and there are two chip select pins cs0 and cs1 <div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''268GPIO NO.'''| '''PI12GPIO'''| '''PWM2Function'''| '''33pin'''|| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''PC123.3V'''| '''761'''|-| '''264'''| '''PI8'''| '''TWI1-SDA'''| '''3'''|-| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''
|-
| '''272269'''| '''PI16PI13'''| style="text-align: left;"|| '''37'''|| '''38'''| style="text-align: left;"|| '''PI4PWM3/UART4_TX'''| '''2607'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''399'''|| '''40'''| style="text-align: left;"|| '''PI3'''| '''259'''|} <ol 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><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 the SPI you want to open.</p></li></ol></li></ol> {| class="wikitable"
|-
| '''dtbo configuration226'''| '''illustratePH2'''| '''UART5_TX'''| '''11'''
|-
| '''spi1-cs0-cs1-spidev227'''| '''Open cs0 and cs1 of spi1 at the same timePH3'''| '''UART5_RX'''| '''13'''
|-
| '''spi1-cs0-spidev261'''| '''Only open cs0 of spi1PI5'''|-| '''spi1-cs1-spidev'''| '''Only open cs1 of spi1'''|} [[File:zero2w-img172.png]] <ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select '''<Save>''' to save<TWI0_SCL/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="2" style="list-style-type: decimal;"><li><p>Then check whether there is a '''spidev1.x''' device node in the Linux system. If it exists, it means that the SPI1 configuration has taken effect.</p><p>orangepi@orangepi:~$ '''ls /dev/spidev1*'''</p><p>/dev/spidev1.0 /dev/spidev1.1</p><p>'''Note that only when you open spi1-cs0-cs1-spidev, you will see the device nodes of the two spi.'''</p></li><li><p>Next, start the spi loopback test. Do not short-circuit the mosi and miso pins of SPI1 first. The output result of running spidev_test is as follows. You can see that the data of TX and RX are inconsistent.</p><p>orangepi@orangepi:~$ '''sudo spidev_test -v -D /dev/spidev1.0'''</p><p>spi mode: 0x0</p><p>bits per word: 8</p><p>max speed: 500000 Hz (500 KHz)</p><p>TX | FF FF FF FF FF FF '''40 00 00 00 00 95''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p><p>RX | FF FF FF FF FF FF '''FF FF FF FF FF FF''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF | ............................….</p></li><li><p>Then short-circuit the two pins of SPI1 mosi (pin 19 in the 40pin interface) and miso (pin 21 in the 40pin interface) and then run spidev_test. The output is as follows. You can see the sending and receiving The data is the same, indicating that the loopback test passed.</p><p>orangepi@orangepi:~$ '''sudo spidev_test -v -D /dev/spidev1.0'''</p><p>spi mode: 0x0</p><p>bits per word: 8</p><p>max speed: 500000 Hz (500 KHz)</p><p>TX | FF FF FF FF FF FF '''40 00 00 00 00 95''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p><p>RX | FF FF FF FF FF FF '''40 00 00 00 00 95''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p></li></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 {| class="wikitable"|-| '''GPIO序号'''| '''GPIO'''| '''Function'''| '''pin'''|| '''pin'''| '''Function'''| '''GPIOUART2_TX'''| '''GPIO NO.15'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''117'''|-| '''<span style="color:#FF0000">231</span>'''| '''<span style="color:#FF0000">PH7</span>'''| '''<span style="color:#FF0000">SPI1_MOSI</span>'''| '''<span style="color:#FF0000">19</span>'''|-| '''<span style="color:#FF0000">232</span>'''| '''<span style="color:#FF0000">PH8</span>'''| '''<span style="color:#FF0000">SPI1_MISO</span>'''| '''<span style="color:#FF0000">21</span>'''|-| '''<span style="color:#FF0000">230</span>'''| '''<span style="color:#FF0000">PH6</span>'''| '''<span style="color:#FF0000">SPI1_CLK</span>'''| '''<span style="color:#FF0000">23</span>'''|-| style="text-align: left;"|| style="text-align: left;"|| '''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;"|| 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;"|
|-
| '''6'''
| '''GND'''
| style="text-align: left;"|
|-
| '''8'''
| '''UART0_TX'''
| '''224'''
|-
| '''10'''
| '''UART0_RX'''
| '''225'''
|-
| '''PI1'''
| '''257'''
|-
| '''14'''
| '''GND'''
| style="text-align: left;"|
|-
| '''16'''
| '''PWM4/UART4_RX'''
| '''270'''
|-
| '''18'''
| style="text-align: left;"|
| '''228'''
|-
| '''20'''
| '''GND'''
| style="text-align: left;"|
|-
| '''22'''
| '''TWI0_SDA/UART2_RX'''
| '''262'''
|-
| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''<span style="color:#FF0000">24</span>'''| '''<span style="color:#FF0000">SPI1_CS0</span>'''| '''<span style="color:#FF0000">PH5</span>'''| '''<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;"|
|-
| '''PI11'''
| '''267'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
|-
| '''36'''
| style="text-align: left;"|
| '''76'''
|-
| '''38'''
| style="text-align: left;"|
| '''260'''
|-
| '''40'''
| style="text-align: left;"|
| '''259'''
|}
</div>
<ol start="2" style="list-style-type: decimal;"><li><p>i2c In Linux systems, spi1 is turned off by default in Linux systems and needs to be turned on manually to use before itcan be used. The opening steps are as follows: </p>
<ol style="list-style-type: lower-alpha;">
<li><p>First run '''orangepi-config'''. Ordinary users remember to add > '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li>
<li><p>Then select '''System'''</p>
<p>[[File:zero2w-img80.png]]</p></li>
<li><p>Then select '''Hardware'''</p>
<p>[[File:zero2w-img81.png]]</p></li>
<li><p>Then use the keyboard's arrow keys to locate the position shown > in the picture figure below, and then use the '''space''' to select the > corresponding i2c dtbo configuration in of the picture belowSPI you want to open.</p></li></ol></li></ol>
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''Multiplexing function in 40pindtbo configuration'''| '''Corresponding dtbo configurationillustrate'''
|-
| '''40pin spi1- i2c0cs0-cs1-spidev'''| '''pi-i2c0Open cs0 and cs1 of spi1 at the same time'''
|-
| '''40pin spi1- i2c1cs0-spidev'''| '''pi-i2c1Only open cs0 of spi1'''
|-
| '''40pin spi1- i2c2cs1-spidev'''| '''pi-i2c2Only open cs1 of spi1'''
|}
[[File:zero2w-img173img172.png]]</ol>
<ol start="5" style="list-style-type: lower-alpha;">
<li><p>Then select <span class="mark">'''<Save></span> ''' to save</p>
<p>[[File:zero2w-img83.png]]</p></li>
<li><p>Then select '''<Back>'''</p>
<p>[[File:zero2w-img84.png]]</p></li>
<li><p>Then select '''<Reboot>''' to restart the system to make the > configuration take effect.</p>
<p>[[File:zero2w-img85.png]]</p></li></ol>
</li></ol>
<ol start="2" style="list-style-type: decimal;">
<li><p>Then check whether there is a '''spidev1.x''' device node in the Linux system. If it exists, it means that the SPI1 configuration has taken effect.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''ls /dev/spidev1*'''</p>
<p>/dev/spidev1.0 /dev/spidev1.1</p>
|}
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|
<big><p>'''Note that only when you open spi1-cs0-cs1-spidev, you will see the device nodes of the two spi.'''</p></big>
|}
</li>
<li><p>Next, start the spi loopback test. Do not short-circuit the mosi and miso pins of SPI1 first. The output result of running spidev_test is as follows. You can see that the data of TX and RX are inconsistent.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo spidev_test -v -D /dev/spidev1.0'''</p>
<p>spi mode: 0x0</p>
<p>bits per word: 8</p>
<p>max speed: 500000 Hz (500 KHz)</p>
<p>TX | FF FF FF FF FF FF '''<span style="color:#FF0000">40 00 00 00 00 95</span>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p>
<p>RX | FF FF FF FF FF FF '''<span style="color:#FF0000">FF FF FF FF FF FF</span>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF | ............................….</p>
|}
</li>
<li><p>Then short-circuit the two pins of SPI1 mosi (pin 19 in the 40pin interface) and miso (pin 21 in the 40pin interface) and then run spidev_test. The output is as follows. You can see the sending and receiving The data is the same, indicating that the loopback test passed.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo spidev_test -v -D /dev/spidev1.0'''</p>
<p>spi mode: 0x0</p>
<p>bits per word: 8</p>
<p>max speed: 500000 Hz (500 KHz)</p>
<p>TX | FF FF FF FF FF FF '''<span style="color:#FF0000">40 00 00 00 00 95</span>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p>
<p>RX | FF FF FF FF FF FF '''<span style="color:#FF0000">40 00 00 00 00 95</span>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p>
|}
</li></ol>
<!-- --><ol startspan id="3" style="listpin-stylei2c-type: decimal;test"><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></olspan>
<!-- --><ol start="4" div style="list-style-typedisplay: decimalflex;"><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="figurewikitable"> [[File:zero2w-img174.png]] </div></li></ol> <span idstyle="pinwidth:390px;margin-uartright: 20px;text-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="wikitablealign: center;"|-| '''GPIO NO.'''| '''GPIO'''| '''Function'''| '''pin'''|
| '''pin'''
|-
| 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>'''| '''3'''|| '''4'''| '''5V'''| <span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"|>3</span>'''
|-
| '''<span style="color:#FF0000">263</span>'''| '''PI7<span style="color:#FF0000">v</span>'''| '''<span style="color:#FF0000">TWI1-SCL</span>'''| '''5'''|| '''6'''| '''GND'''| <span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"|>5</span>'''
|-
| '''269'''
| '''PWM3/UART4_TX'''
| '''7'''
|-
| style="text-align: left;"|
| '''GND'''
| '''9'''
|-
| '''226'''
| '''UART5_TX'''
| '''11'''
|-
| '''227'''
| '''UART5_RX'''
| '''13'''
|-| '''14'''| '''GND'''| <span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"||-| '''>261</span>'''| '''<span style="color:#FF0000">PI5</span>'''| '''<span style="color:#FF0000">TWI0_SCL</span>/UART2_TX'''| '''<span style="color:#FF0000">15'''|| '''16'''| '''PWM4</UART4_RX'''| '''PI14'''| '''270span>'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|-
| '''231'''
| '''SPI1_MOSI'''
| '''19'''
|-
| '''232'''
| '''SPI1_MISO'''
| '''21'''
|-
| '''230'''
| '''SPI1_CLK'''
| '''23'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|-
| '''<span style="color:#FF0000">266</span>'''| '''<span style="color:#FF0000">PI10</span>'''| '''<span style="color:#FF0000">TWI2-SDA</span>/UART3_RX'''| '''<span style="color:#FF0000">27'''|| '''28'''| '''TWI2-SCL</UART3_TX'''| '''PI9'''| '''265span>'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
| '''PI2'''
| style="text-align: left;"|
| '''35'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|}
|-
| '''Multiplexing function in 40pinpin'''| '''Corresponding dtbo configurationFunction'''| '''GPIO'''| '''GPIO NO.'''
|-
| '''40pin - uart22'''| '''pi-uart25V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - uart34'''| '''pi-uart35V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - uart46'''| '''pi-uart4GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - uart58'''| '''ph-uart5UART0_TX'''|} [[File:zero2w-img175.png]] <ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select '''<Save>PH0''' 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 '224''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.10'''| '''GPIOUART0_RX'''| '''FunctionPH1'''| '''Pin'''|| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.225'''
|-
| '''12'''
| style="text-align: left;"|
| '''PI1'''
| '''257'''
|-
| '''14'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''16'''
| '''PWM4/UART4_RX'''
| '''PI14'''
| '''270'''
|-
| '''18'''
| style="text-align: left;"|
| '''PH4'''
| '''228'''
|-
| '''26420'''| '''PI8'''| '''TWI1-SDA'''| '''3'''|| '''4'''| '''5VGND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''263<span style="color:#FF0000">22</span>'''| '''PI7<span style="color:#FF0000">TWI0_SDA</span>/UART2_RX'''| '''TWI1<span style="color:#FF0000">PI6</span>'''| '''<span style="color:#FF0000">262</span>'''|-| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''<span style="color:#FF0000">28</span>'''| '''<span style="color:#FF0000">TWI2-SCL</span>/UART3_TX'''| '''5<span style="color:#FF0000">PI9</span>'''|'''<span style="color:#FF0000">265</span>'''|-| '''630'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26932'''| '''PI13PWM1'''| '''PWM3/UART4_TXPI11'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224267'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''1236'''
| style="text-align: left;"|
| '''PI1PC12'''| '''25776'''
|-
| '''22738'''| '''PH3'''style="text-align: left;"|| '''UART5_RXPI4'''| '''13260'''|-| '''1440'''| '''GND'''| style="text-align: left;"|
| style="text-align: left;"|
| '''PI3'''
| '''259'''
|}
</div>
<ol start="2" style="list-style-type: decimal;">
<li><p>i2c is turned off by default in Linux systems and needs to be turned on manually to use it. The opening steps are as follows: </p>
<ol style="list-style-type: lower-alpha;">
<li><p>First run '''orangepi-config'''. Ordinary users remember to add '''sudo''' permissions.</p>
{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''261sudo orangepi-config'''</p>| }</li><li><p>Then select '''PI5System'''</p>| '''TWI0_SCL<p>[[File:zero2w-img80.png]]</p></UART2_TX'''li>| <li><p>Then select '''15Hardware'''</p>|<p>[[File:zero2w-img81.png]]</p></li>| <li><p>Then use the keyboard's arrow keys to locate the position shown in the picture below, and then use the ''16'space''| '''PWM4to select the corresponding i2c configuration in the picture below.</p></UART4_RX'''li>| '''PI14'''{| '''270'''class="wikitable" style="width:800px;text-align: center;"
|-
|-
| '''23140pin - i2c0'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|| '''20'''| '''GNDpi-i2c0'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''23240pin - i2c1'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''TWI0_SDA/UART2_RX'''| '''PI6'''| '''262pi-i2c1'''
|-
| '''23040pin - i2c2'''| '''PH6pi-i2c2'''| } [[File:zero2w-img173.png]]</ol><ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select <span class="mark"><Save></span> to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''SPI1_CLK<Back>'''</p>| <p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''23<Reboot>'''to restart the system to make the configuration take effect.</p>|<p>[[File:zero2w-img85.png]]</p></li></ol>| '''24'''</li></ol>| '''SPI1_CS0'''<ol start="3" style="list-style-type: decimal;">| '''PH5'''<li><p>After starting the Linux system, first confirm that there is an open i2c device node under /dev</p>{| '''229'''class="wikitable" style="width:800px;"
|-
|-
| <big><p>'''266Sometimes 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>'''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>'''PI10In the above output'''</p><ol style="list-style-type: none;"><li><p>a) 5002000 is the register base address of the i2c0 bus, and i2c-0 shown behind it is its corresponding i2c device node</p></li><li><p>b) 5002400 is the register base address of the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li><li><p>c) 5002800 is the register base address of the i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p></li></ol></li></ol>| }</li></ol><ol start="4" style="list-style-type: decimal;"><li><p>Then start testing i2c, first install i2c-tools</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''TWI2sudo apt-SDAget update'''</UART3_RXp><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 '''27i2cdetect -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>'''28Note 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.'''TWI2</p></big>|}<div class="figure"> [[File:zero2w-SCLimg174.png]] </UART3_TXdiv></li></ol> <span id="pin-uart-test"></span> === 40pin UART test === # As can be seen from the table below, the available uarts are uart2, uart3, uart4 and uart5. Please note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial port. <div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''GPIO NO.'''| '''GPIO'''| '''PI9Function'''| '''265pin'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-
| '''271264'''| '''PI15PI8'''| style="text'''TWI1-align: left;"SDA'''| '''3'''|-| '''263'''|'''PI7'''| '''31TWI1-SCL'''| '''5'''|-| '''32269'''| '''PWM1PI13'''| '''PI11PWM3/UART4_TX'''| '''2677'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''9'''
|-
| '''226'''
| '''PH2'''
| '''UART5_TX'''
| '''11'''
|-
| '''227'''
| '''PH3'''
| '''UART5_RX'''
| '''13'''
|-
| '''258261'''| '''PI2PI5'''| style="text-align: left;"|| '''35'''|| '''36'''| style="text-align: left;"|| '''PC12TWI0_SCL/UART2_TX'''| '''7615'''
|-
| 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;"|
| style="text-align: left;"|
|}
{| 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/UART4_RX'''
| '''PI14'''
| '''270'''
|-
| '''18'''
| style="text-align: left;"|
| '''PH4'''
| '''228'''
|-
| '''20'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''22'''
| '''TWI0_SDA/UART2_RX'''
| '''PI6'''
| '''262'''
|-
| '''24'''
| '''SPI1_CS0'''
| '''PH5'''
| '''229'''
|-
| '''26'''
| '''SPI1_CS1'''
| '''PH9'''
| '''233'''
|-
| '''28'''
| '''TWI2-SCL/UART3_TX'''
| '''PI9'''
| '''265'''
|-
| '''30'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''32'''
| '''PWM1'''
| '''PI11'''
| '''267'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''36'''
| style="text-align: left;"|
| '''PC12'''
| '''76'''
|-
| '''38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| '''40'''
| style="text-align: left;"|
| '''PI3'''
| '''259'''
|}
</div>
<ol start="2" style="list-style-type: decimal;"><li><p>pwm In Linux systems, uart is turned off by default in Linux systems and needs to be turned on manually to use before itcan be used. The opening steps are as follows:</p><ol style="list-style-type: lower-alpha;"><li><p>First run '''orangepi-config'''. Ordinary users remember to add > '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li><li><p>Then select '''System'''</p><p>[[File:zero2w-img80.png]]</p></li><li><p>Then select '''Hardware'''</p><p>[[File:zero2w-img81.png]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown > in the figure picture below, and then use the '''space''' to select the > configuration corresponding to the pwm serial port you want to open.</p><p>[[File:zero2w-img176.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.</p><p>[[File:zero2w-img85.png]]</p></li></ol></li><li><p>After restarting, you can start the PWM test</p><p>'''Please execute the following commands under the root user.'''</p><ol style="list-style-type: lower-alpha;"><li><p>Enter the following command on the command line to make pwm1 > output a 50Hz square wave</p><p>root@orangepi:~# '''echo 1 > /sys/class/pwm/pwmchip0/export'''</p><p>root@orangepi:~# '''echo 20000000 > /sys/class/pwm/pwmchip0/pwm1/period'''</p><p>root@orangepi:~# '''echo 1000000 > /sys/class/pwm/pwmchip0/pwm1/duty_cycle'''</p><p>root@orangepi:~# '''echo 1 > /sys/class/pwm/pwmchip0/pwm1/enable'''</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> root@orangepi:~# '''echo 2 > /sys/class/pwm/pwmchip0/export''' root@orangepi:~# '''echo 20000000 > /sys/class/pwm/pwmchip0/pwm2/period''' root@orangepi:~# '''echo 1000000 > /sys/class/pwm/pwmchip0/pwm2/duty_cycle''' root@orangepi:~# '''echo 1 > /sys/class/pwm/pwmchip0/pwm2/enable''' <ol start="3" style="list-style-type: lower-alpha;"><li>Enter the following command on the command line to make pwm3 output > a 50Hz square wave</li></ol> root@orangepi:~# '''echo 3 > /sys/class/pwm/pwmchip0/export''' root@orangepi:~# '''echo 20000000 > /sys/class/pwm/pwmchip0/pwm3/period''' root@orangepi:~# '''echo 1000000 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle''' root@orangepi:~# '''echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable''' <ol start="4" style="list-style-type: lower-alpha;"><li>Enter the following command on the command line to make pwm4 output > a 50Hz square wave</li></ol> root@orangepi:~# '''echo 4 > /sys/class/pwm/pwmchip0/export''' root@orangepi:~# '''echo 20000000 > /sys/class/pwm/pwmchip0/pwm4/period''' root@orangepi:~# '''echo 1000000 > /sys/class/pwm/pwmchip0/pwm4/duty_cycle''' root@orangepi:~# '''echo 1 > /sys/class/pwm/pwmchip0/pwm4/enable''' <div class="figure"> [[File:zero2w-img177.png]] </div><span id="how-to-install-and-use-wiringop-python"></span>== How to install and use wiringOP-Python == '''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.''' '''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 program''' '''Also please note that all the following commands are operated under the root user.''' <span id="how-to-install-wiringop-python"></span>=== How to install wiringOP-Python === <ol style="list-style-type: decimal;"><li><p>First install dependency packages</p><p>root@orangepi:~# '''sudo apt-get update'''</p><p>root@orangepi:~# '''sudo apt-get -y install git swig python3-dev python3-setuptools'''</p></li><li><p>Then use the following command to download the source code of wiringOP-Python</p></li></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.'''
|-
| '''GPIO NO.227'''| '''GPIOPH3'''| '''FunctionUART5_RX'''| '''Pin13'''|-| '''Pin261'''| '''FunctionPI5'''| '''GPIOTWI0_SCL/UART2_TX'''| '''GPIO NO.15'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''117'''|| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''264231'''| '''PI8PH7'''| '''TWI1-SDASPI1_MOSI'''| '''319'''|| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''263232'''| '''PI7PH8'''| '''TWI1-SCLSPI1_MISO'''| '''521'''|| '''6'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''269230'''| '''PI13PH6'''| '''PWM3/UART4_TXSPI1_CLK'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''22423'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''925'''|-| '''10266'''| '''UART0_RXPI10'''| '''PH1TWI2-SDA/UART3_RX'''| '''22527'''
|-
| '''226256'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''12PI0'''
| style="text-align: left;"|
| '''PI1'''| '''25729'''
|-
| '''227271'''| '''PH3PI15'''| '''UART5_RX'''| '''13'''|| '''14'''| '''GND'''| style="text-align: left;"|
| style="text-align: left;"|
| '''31'''
|-
| '''261<span style="color:#FF0000">268</span>'''| '''PI5<span style="color:#FF0000">PI12</span>'''| '''TWI0_SCL<span style="color:#FF0000">PWM2</UART2_TX'''| '''15'''|| '''16span>'''| '''PWM4<span style="color:#FF0000">33</UART4_RX'''| '''PI14'''| '''270span>'''
|-
| '''258'''
| '''PI2'''
| style="text-align: left;"|
| '''35'''
|-
| '''272'''
| '''PI16'''
| style="text-align: left;"|
| '''3.3V'''| '''17'''|| '''18'''| style="text-align: left;"|| '''PH4'''| '''22837'''
|-
| 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'''|-| '''23114'''| '''PH7GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''<span style="color:#FF0000">16</span>'''| '''SPI1_MOSI<span style="color:#FF0000">PWM4</span>/UART4_RX'''| '''<span style="color:#FF0000">PI14</span>'''| '''<span style="color:#FF0000">270</span>'''|-| '''18'''| style="text-align: left;"|| '''PH4'''| '''19228'''|-| '''20'''| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''22'''
| '''TWI0_SDA/UART2_RX'''
| '''262'''
|-
| '''24'''
| '''SPI1_CS0'''
| '''229'''
|-
| '''SPI1_CS1'''
| '''PH9'''
| '''233'''
|-
| '''28'''
| '''TWI2-SCL/UART3_TX'''
| '''265'''
|-
| '''30'''
| '''GND'''
| style="text-align: left;"|
|-
| '''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><p>[[File:zero2w-img176.png]]</lip></olli></li><p>Then select '''<Save>''' to save</olp> {| class="wikitable"|<p>[[File:zero2w-img83.png]]</p></li>| <li><p>Then select '''dtbo configuration<Back>'''</p><p>[[File:zero2w-img84.png]]</p></li>| <li><p>Then select '''illustrate<Reboot>'''to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol></li><li><p>After restarting, you can start the PWM test</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big><p>'''spi1-cs0-cs1-spidevPlease execute the following commands under the root user.'''</p></big>| '''Open cs0 and cs1 of spi1 at }<ol style="list-style-type: lower-alpha;"><li><p>Enter the following command on the same time'''command line to make pwm1 output a 50Hz square wave</p>{| class="wikitable" style="width:800px;"
|-
| <p>root@orangepi:~# '''spi1-cs0-spidevecho 1 > /sys/class/pwm/pwmchip0/export'''</p>| <p>root@orangepi:~# '''Only open cs0 of spi1echo 20000000 > /sys/class/pwm/pwmchip0/pwm1/period'''</p>|-| <p>root@orangepi:~# '''spi1-cs1-spidevecho 1000000 > /sys/class/pwm/pwmchip0/pwm1/duty_cycle'''</p>| <p>root@orangepi:~# '''Only open cs1 of spi1echo 1 > /sys/class/pwm/pwmchip0/pwm1/enable'''</p>
|}
</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 1 > /sys/class/pwm/pwmchip0/pwm4/enable'''|}
<span id="pinhow-i2cto-testinstall-1wiringop-python"></span>=== 40pin I2C test How to install wiringOP-Python ===
<ol style="list-style-type: decimal;"><li><p>First install dependency packages</p>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~# As can be seen from '''sudo apt-get update'''</p><p>root@orangepi:~# '''sudo apt-get -y install git swig python3-dev python3-setuptools'''</p>|}</li><li><p>Then use the following command to download the table below, source code of wiringOP-Python</p></li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note that the i2c available for following git clone--recursive command will automatically download the 40pin interface source code of wiringOP, because wiringOP-Python depends on wiringOP. Please make sure there are i2c0, i2c1 and i2c2no errors during the download process due to network problems.'''
'''If there is a problem downloading the code from GitHub, you can directly use the wiringOP-Python source code that comes with the Linux image. The storage location is: /usr/src/wiringOP-Python'''</big>|}{| class="wikitable" style="width:800px;"
|-
| root@orangepi:~# '''GPIO NOgit clone --recursive https://github.com/orangepi-xunlong/wiringOP-Python -b next'''| root@orangepi:~# '''GPIOcd wiringOP-Python'''| '''Function'''| root@orangepi:~/wiringOP-Python# '''Pingit submodule update --init --remote'''|}| '''Pin'''</ol>| '''Function'''<ol start="3" style="list-style-type: decimal;">| '''GPIO'''<li><p>Then use the following command to compile wiringOP-Python and install it into the Linux system of the development board</p>{| '''GPIO NO.'''class="wikitable" style="width:800px;"
|-
|-
| root@orangepi:~/wiringOP-Python# '''264python3 -c "import wiringpi; help(wiringpi)"'''| '''PI8'''| '''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--SDA'''modify| '''3'''|: # the SWIG interface file instead.| '''4'''}| '''5V'''</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;"><li>First use the python3 command to enter the command line mode of > python3</li>{|class="wikitable" style="width:800px;"
|-
| '''263'''| root@orangepi:~# '''PI7python3'''| '''TWI1-SCL'''}| '''5'''</ol>|| '''6'''| '''GND'''| <ol start="2" style="textlist-alignstyle-type: leftlower-alpha;"|><li>Then import the python module of wiringpi</li>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| >>> '''269import wiringpi;'''| '''PI13'''}| '''PWM3</UART4_TX'''ol>| '''7'''<ol start="3" style="list-style-type: lower-alpha;">|<li>Finally, enter the following command to view the help information of > wiringOP-Python. Press the q key to exit the help information > interface.</li>{| '''8'''| '''UART0_TX'''| '''PH0'''| '''224'''class="wikitable" style="width:800px;"
|-
| style="text-align: left>>"|| style="text-align: left>"|| '''GNDhelp(wiringpi)'''| '''9'''|Help on module wiringpi: NAME :wiringpi DESCRIPTION : # This file was automatically generated by SWIG (http://www.swig.org). | '''10''': # Version 4.0.2| '''UART0_RX'''| '''PH1''': #| '''225'''|: # 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) :| '''226'''GPIO(pinmode=0) :| '''PH2''' >>>| '''UART5_TX'''}</ol></li></ol><span id="pin-gpio-port-test-1"></span>| '''11'''|=== 40pin GPIO port test ===| '''12'''{| class="wikitable" style="textbackground-aligncolor:#ffffdc;width: left800px;"|| '''PI1'''| '''257'''
|-
| <big>'''227Like wiringOP, wiringOP-Python can also determine which GPIO pin to operate by specifying the wPi number. Because there is no command to view the wPi number in wiringOP-Python, you can only view the board's wPi number and physics through the gpio command in wiringOP Correspondence of pins.'''</big> [[File:zero2w-img170.png| '''PH3'''center]]| '''UART5_RX'''} <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>| '''13'''<p>[[File:zero2w-img171.png]]</p></li>|<li><p>The steps for testing directly with commands are as follows:</p>| '''14'''<ol style="list-style-type: lower-alpha;">| <li><p>First set the GPIO port to output mode, where the first parameter of the '''GNDpinMode'''function is the serial number of the wPi corresponding to the pin, and the second parameter is the GPIO mode.</p>{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| <p>root@orangepi:~/wiringOP-Python# '''261python3 -c "import wiringpi; \'''</p>| <p>'''PI5from wiringpi import GPIO; wiringpi.wiringPiSetup() ; \'''</p>| <p>'''TWI0_SCLwiringpi.pinMode(<span style="color:#FF0000">2, GPIO.OUTPUT</UART2_TX'''| '''15span>) ; "'''</p>|}| '''16'''</li>| '''PWM4<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.</UART4_RX'''| '''PI14'''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.digitalWrite(2, <span style="color:#FF0000">GPIO.LOW</span>)"'''</p>| }</li><li><p>Then set the GPIO port to output a high level. After setting, 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;"|| '''PH4'''| '''228'''
|-
| <p>root@orangepi:~/wiringOP-Python# '''231python3 -c "import wiringpi; \'''</p>| <p>'''PH7from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\'''</p>| <p>'''SPI1_MOSIwiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.HIGH</span>)"'''</p>| '''19'''}|</li></ol>| '''20'''</li>| '''GND'''<li><p>The steps for testing in the command line of python3 are as follows:</p>| <ol style="textlist-style-aligntype: leftlower-alpha;"|><li><p>First use the python3 command to enter the command line mode of python3</p>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| '''232'''| <p>root@orangepi:~# '''PH8python3'''</p>| '''SPI1_MISO'''}| '''21'''|</li>| '''22'''| '''TWI0_SDA<li><p>Then import the python module of wiringpi</UART2_RX'''| '''PI6'''p>{| '''262'''class="wikitable" style="width:800px;"
|-
| '''230'''| <p>>>> '''PH6import wiringpi'''</p>| <p>>>> '''SPI1_CLKfrom wiringpi import GPIO'''</p>| '''23'''|| '''24'''}| '''SPI1_CS0'''</li>| <li><p>Then set the GPIO port to output mode, where the first parameter of the '''PH5pinMode'''function is the serial number of the wPi corresponding to the pin, and the second parameter is the GPIO mode.</p>{| '''229'''class="wikitable" style="width:800px;"
|-
| <p>>>> '''wiringpi.wiringPiSetup()'''</p><p>0</p><p>>>> '''wiringpi.pinMode(<span style="color:#FF0000">2, GPIO.OUTPUT</span>)'''</p>|}</li><li><p>Then set the GPIO port to output a low level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 0v, it means the low level is set successfully.</p>{| class="wikitable" style="textwidth:800px;" |-align| <p>>>> '''wiringpi.digitalWrite(2, <span style="color: left;#FF0000">GPIO.LOW</span>)'''</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>{| class="wikitable" style="text-alignwidth: left800px;"|-| <p>>>> '''GNDwiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.HIGH</span>)'''</p>| }</li></ol></li><li><p>For wiringOP-Python to set the GPIO high and low levels in the python code, you can refer to the '''blink.py'''test program in the examples. The '25''blink.py''' test program will set the voltage of all GPIO ports in the 40 Pin of the development board to continuously change high and low.</p>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP-Python# '''26cd examples'''</p>| <p>root@orangepi:~/wiringOP-Python/examples# '''SPI1_CS1ls blink.py'''</p>| <p>'''PH9blink.py'''</p>| <p>root@orangepi:~/wiringOP-Python/examples'''233# 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;"
|-
| '''266GPIO NO.'''| '''PI10GPIO'''| '''TWI2-SDA/UART3_RXFunction'''| '''27'''|| '''28'''| '''TWI2-SCL/UART3_TX'''| '''PI9'''| '''265Pin'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-
| '''271264'''| '''PI15PI8'''| style="text'''TWI1-align: left;"SDA'''| '''3'''|-| '''263'''|'''PI7'''| '''31TWI1-SCL'''| '''5'''|-| '''32269'''| '''PWM1PI13'''| '''PI11PWM3/UART4_TX'''| '''2677'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''9'''
|-
| '''226'''
| '''PH2'''
| '''UART5_TX'''
| '''11'''
|-
| '''227'''
| '''PH3'''
| '''UART5_RX'''
| '''13'''
|-
| '''261'''
| '''PI5'''
| '''TWI0_SCL/UART2_TX'''
| '''15'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''PC123.3V'''| '''7617'''|-| '''<span style="color:#FF0000">231</span>'''| '''<span style="color:#FF0000">PH7</span>'''| '''<span style="color:#FF0000">SPI1_MOSI</span>'''| '''<span style="color:#FF0000">19</span>'''|-| '''<span style="color:#FF0000">232</span>'''| '''<span style="color:#FF0000">PH8</span>'''| '''<span style="color:#FF0000">SPI1_MISO</span>'''| '''<span style="color:#FF0000">21</span>'''|-| '''<span style="color:#FF0000">230</span>'''| '''<span style="color:#FF0000">PH6</span>'''| '''<span style="color:#FF0000">SPI1_CLK</span>'''| '''<span style="color:#FF0000">23</span>'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''PI4GND'''| '''26025'''|-| '''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'''
|}
|-
| '''Multiplexing function in 40pinPin'''| '''Corresponding dtbo configurationFunction'''| '''GPIO'''| '''GPIO NO.'''
|-
| '''40pin - i2c02'''| '''pi-i2c05V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - i2c14'''| '''pi-i2c15V'''|-| '''40pin - i2c2'''| '''pi-i2c2'''|} [[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-styletext-typealign: decimalleft;">|<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-*6'''</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.GND'''</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="listtext-style-typealign: lower-alphaleft;"><li><p>'''First run the following command to check the corresponding relationship of i2c'''</p>|<p>orangepi@orangepizero2w:~$ '''ls /sys/devices/platform/soc*/*/i2c-* | grep "i2c-[0-9]"'''</p><p>/sys/devices/platform/soc/5002000.i2c/i2c-0:</p><p>/sys/devices/platform/soc/5002400.i2c/i2c-3:</p><p>/sys/devices/platform/soc/5002800.i2c/i2c-4:</p><p>/sys/devices/platform/soc/5002c00.i2c/i2c-5:</p><p>/sys/devices/platform/soc/6000000.hdmi/i2c-2:</p><p>/sys/devices/platform/soc/7081400.i2c/i2c-1:</p></li><li><p>'''In the above output'''</p></li></ol> <!-- --><ol start="4" style="listtext-style-typealign: lower-alphaleft;">|<li><p>002000 is the register base address of the i2c0 bus, and i2c|-0 shown behind it is its corresponding i2c device node</p></li><li><p>5002400 is the register base address of the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li><li><p>5002800 is the register base address of the i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p></li></ol> <!-- --><ol start="4" style="list-style-type: decimal;"><li><p>Then start testing i2c, first install i2c-tools</p><p>orangepi@orangepi:~$ | '''sudo apt-get update8'''</p><p>orangepi@orangepi:~$ '''sudo''' | '''apt-get install -y i2c-toolsUART0_TX'''</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 xPH0'''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.224'''</p></li></ol> [[File:zero2w|-img179.png]] <ol start="7" style="list-style-type: decimal;"><li><p>Then you can run the | '''ds1307.py10''' test program in | '''examplesUART0_RX''' 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.PH1'''</p><p>root@orangepi:~/wiringOP-Python# | '''cd examples225'''</p><p>root@orangepi:~/wiringOP-Python/examples# '''python3 ds1307.py -|-device \'''</p><p>| '''"/dev/i2c-x"12'''</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| style="pintext-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="wikitablealign: left;"|-| '''GPIO NO.PI1'''| '''GPIO257'''|-| '''Function14'''| '''PinGND'''|style="text-align: left;"|| style="text-align: left;"||-| '''Pin16'''| '''FunctionPWM4/UART4_RX'''| '''GPIOPI14'''| '''GPIO NO.270'''
|-
| '''18'''
| style="text-align: left;"|
|-
| '''26420'''| '''PI8'''| '''TWI1-SDA'''| '''3'''|| '''4'''| '''5VGND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26322'''| '''PI7TWI0_SDA/UART2_RX'''| '''TWI1PI6'''| '''262'''|-| '''<span style="color:#FF0000">24</span>'''| '''<span style="color:#FF0000">SPI1_CS0</span>'''| '''<span style="color:#FF0000">PH5</span>'''| '''<span style="color:#FF0000">229</span>'''|-| '''<span style="color:#FF0000">26</span>'''| '''<span style="color:#FF0000">SPI1_CS1</span>'''| '''<span style="color:#FF0000">PH9</span>'''| '''<span style="color:#FF0000">233</span>'''|-| '''28'''| '''TWI2-SCL/UART3_TX'''| '''5PI9'''|'''265'''|-| '''630'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26932'''| '''PI13PWM1'''| '''PWM3/UART4_TXPI11'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224267'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''1236'''
| style="text-align: left;"|
| '''PI1PC12'''| '''25776'''
|-
| '''22738'''| '''PH3'''| '''UART5_RX'''| '''13'''|| '''14'''| '''GND'''| style="text-align: left;"|
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| '''26140'''| '''PI5'''| '''TWI0_SCL/UART2_TX'''| '''15'''|| '''16'''| '''PWM4/UART4_RX'''| '''PI14'''| '''270'''|-
| style="text-align: left;"|
|-
| <p>orangepi@orangepi:~$ '''231sudo orangepi-config'''</p>| }</li><li><p>Then select '''PH7System'''</p>| '''SPI1_MOSI'''<p>[[File:zero2w-img80.png]]</p></li>| <li><p>Then select '''19Hardware'''</p>|<p>[[File:zero2w-img81.png]]</p></li>| <li><p>Then use the keyboard's arrow keys to locate the position shown in the figure below, and then use the '''20space'''to select the dtbo configuration of the SPI you want to open.</p></li>| '''GND'''{| styleclass="text-align: left;wikitable"|| style="width:800px;text-align: leftcenter;"|
|-
| '''232dtbo configuration'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''TWI0_SDA/UART2_RX'''| '''PI6'''| '''262illustrate'''
|-
| '''230spi1-cs0-cs1-spidev'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229Open cs0 and cs1 of spi1 at the same time'''
|-
|-
| '''266spi1-cs1-spidev'''| '''PI10Only open cs1 of spi1'''| }</ol><ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select '''TWI2-SDA/UART3_RX<Save>'''to save</p><p>[[File:zero2w-img83.png]]</p></li>| <li><p>Then select '''27<Back>'''</p>|<p>[[File:zero2w-img84.png]]</p></li>| <li><p>Then select '''28<Reboot>'''to restart the system to make the configuration take effect.</p>| '''TWI2<p>[[File:zero2w-SCLimg85.png]]</p></UART3_TX'''li></ol></li></ol><!-- --><ol start="3" style="list-style-type: decimal;">| <li><p>Then check whether there is a '''PI9spidev1.x'''device node in the Linux system. If it exists, it means that the SPI1 configuration has taken effect.</p>{| '''265'''class="wikitable" style="width:800px;"
|-
| '''256'''| '''PI0'''| style="text-align<p>orangepi@orangepi: left;"|| ~$ '''29ls /dev/spidev1*'''</p>|<p>/dev/spidev1.0 /dev/spidev1.1</p>| '''30'''| '''GND'''}{| styleclass="text-align: left;wikitable"|| style="textbackground-aligncolor:#ffffdc;width: left800px;"|
|-
| <big><p>'''271Note that only when you open spi1-cs0-cs1-spidev, you will see the device nodes of the two spi.'''</p></big>| }</li><li><p>Then you can use the '''spidev_test.py'PI15''program in examples to test the SPI loopback function. The '''spidev_test.py''' program needs to specify the following two parameters:</p>| <ol style="textlist-alignstyle-type: leftlower-alpha;"|>| <li><p>'''31--channel''': Specify the channel number of SPI</p></li>|| <li><p>'''32--port''': Specify the port number of the SPI</p></li></ol>| '''PWM1'''</li>| '''PI11'''<li><p>Without shorting the mosi and miso pins of SPI1, the output result of running spidev_test.py is as follows. You can see that the data of TX and RX are inconsistent.</p>{| '''267'''class="wikitable" style="width:800px;"
|-
| <p>root@orangepi:~/wiringOP-Python# '''268cd examples'''</p> | root@orangepi:~/wiringOP-Python/examples# '''PI12python3 spidev_test.py \'''| '''PWM2--channel 1 --port 0''' spi mode: 0x0 max speed: 500000 Hz (500 KHz) Opening device /dev/spidev1.1 TX | FF FF FF FF FF FF '''33<span style="color:#FF0000">40 00 00 00 00 95</span>'''FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…||RX | FF FF FF FF FF FF '''34<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 |.............….|| '''GND'''}</li></ol>| <ol start="6" style="textlist-alignstyle-type: leftdecimal;"|><li><p>Then use Dupont wire to short-circuit the txd (pin 19 in the 40pin interface) and rxd (pin 21 in the 40pin interface) of SPI1 and then run spidev_test.py. The output is as follows, you can see If the data sent and received are the same, it means that the SPI1 loopback test is normal.</p>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| <p>root@orangepi:~/wiringOP-Python# '''258cd examples'''</p>| '''PI2'''| style="textroot@orangepi:~/wiringOP-align: left;"|| Python/examples# '''35python3 spidev_test.py \'''|| '''36'''| style="text-align: left;"|| '''PC12'''| '''76'''|-| '''272channel 1 --port 0'''| '''PI16'''| style="text-alignspi mode: left;"|0x0| '''37'''|max speed: 500000 Hz (500 KHz)| '''38'''| style="text-align: left;"|Opening device /dev/spidev1.1| '''PI4'''TX | FF FF FF FF FF FF '''260'''|-| <span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"|| >40 00 00 00 00 95</span>'''GND'''FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…| '''39'''|RX | FF FF FF FF FF FF '''40'''| <span style="text-aligncolor: left;#FF0000"|| >40 00 00 00 00 95</span>'''PI3'''FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…| '''259'''
|}
</li></ol>
<span id="pin-i2c-test-1"></span>
=== 40pin I2C test ===
<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;"|| '''Multiplexing function in 40pin3.3V'''| '''Corresponding dtbo configuration1'''
|-
| '''40pin <span style="color:#FF0000">264</span>'''| '''<span style="color:#FF0000">PI8</span>'''| '''<span style="color:#FF0000">TWI1- uart2SDA</span>'''| '''pi-uart2<span style="color:#FF0000">3</span>'''
|-
| '''40pin <span style="color:#FF0000">263</span>'''| '''<span style="color:#FF0000">v</span>'''| '''<span style="color:#FF0000">TWI1- uart3SCL</span>'''| '''pi-uart3<span style="color:#FF0000">5</span>'''
|-
| '''40pin - uart4269'''| '''pi-uart4PI13'''| '''PWM3/UART4_TX'''| '''7'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''40pin - uart5GND'''| '''ph-uart59'''|}- [[File:zero2w-img175.png]] <ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select | '''<Save>226''' to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select | '''<Back>PH2'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select | '''<Reboot>UART5_TX''' to restart the system to make the > configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol>| '''11''' <!|-- --><ol start="3" style="list-style-type: decimal;">| '''227'''<li><p>After entering the Linux system, first confirm whether there is a uart5 device node under | '''PH3''<span class="mark">/dev</span>'| '''UART5_RX'''</p><p>| '''注意, linux5.4系统为/dev/ttyASx.13'''|-| '''</pspan style="color:#FF0000">261<p/span>orangepi@orangepi:~$ '''ls /dev/ttyS*| '''</p><pspan style="color:#FF0000">/dev/ttySxPI5</p></lispan>'''| '''<lispan style="color:#FF0000"><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.TWI0_SCL</pspan></li><li><p>Use the UART2_TX'''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.</pspan style="color:#FF0000">15<p/span>'''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|-| style="text-align:~$ '''gpio serial /dev/ttySx # linux-6left;"|| style="text-align: left;"|| '''3.1 test command3V'''</p><p>orangepi@orangepi:~$ | '''gpio serial /dev/ttyASx # linux-5.4 test command17'''</p><p>Out: 0: |-> 0</p><p>Out: 1: -> 1</p>| '''231'''<p>Out: 2: -> 2</p>| '''PH7'''<p>Out: 3: -> 3^C</p></li><li><p>Finally, you can run the | '''serialTest.pySPI1_MOSI''' program in examples to test the loopback function of the serial port. If you can see the following print, it means that the serial port loopback test is normal.</p><p>| '''Note that the x in /dev/ttySx or /dev/ttyASx in the command needs to be replaced with the serial number of the corresponding uart device node.19'''</p><p>root@orangepi:~/wiringOP|-Python# | '''cd examples232'''</p><p>root@orangepi:~/wiringOP-Python/examples# | '''python3 serialTest.py --device "/dev/ttySx" # linux6.1 usePH8'''</p><p>root@orangepi:~/wiringOP-Python/examples# | '''SPI1_MISO'''python3 serialTest.py --device "/dev/ttyASx" # linux5.4 use| '''21'''</p><p>Out: 0: |-> 0</p><p>Out: 1: -> 1</p>| '''230'''| '''PH6'''<p>Out: 2: -> 2</p>| '''SPI1_CLK'''| '''23'''<p>Out: 3: |-> 3</p><p>Out| style="text-align: left;"|| style="text-align: 4:^C</p><p>exit</p></li></ol>left;"|| '''GND'''<span id="hardware-watchdog| '''25'''|-test| '''<span style="color:#FF0000">266</span>'''== Hardware watchdog test == The watchdog_test program is pre-installed in the Linux system released by Orange Pi and can be tested directly. The method to run the watchdog_test program is as follows: | '''<ol span style="list-style-typecolor: lower-alpha;#FF0000">PI10<li/span>'''| '''<p>The second parameter 10 represents the counting time of the watchdog. If the dog is not fed within this time, the system will restart.</pspan style="color:#FF0000">TWI2-SDA</lispan>/UART3_RX'''| '''<li><pspan style="color:#FF0000">We can feed the dog by pressing any key on the keyboard (except ESC). After feeding the dog, the program will print a line "keep alive" to indicate that the dog feeding is successful.27</pspan>'''<p>orangepi@orangepi:~$ |-| '''sudo watchdog_test 10256'''</p><p>open success</p>| '''PI0'''<p>options is 33152,identity is sunxi| style="text-wdt</p><p>put_usr return,if 0,successalign:0</p>left;"|<p>The old reset time is: 16</p>| '''29'''<p>return ENOTTY,if |-1,success:0</p><p>return ENOTTY,if | '''271'''| '''PI15'''| style="text-1,successalign:0</p>left;"|<p>put_user return,if 0,success:0</p>| '''31'''<p>put_usr return,if 0,success:0</p>|-<p>keep alive</p>| '''268'''<p>keep alive</p>| '''PI12'''<p>keep alive</p></li></ol>| '''PWM2'''| '''33'''<span id="check|-the-chipid-of-h618-chip"></span>== Check the chipid of H618 chip == The command to view the H618 chip chipid is as follows. The chipid of each chip is different, so you can use chipid to distinguish multiple development boards. orangepi@orangepi:~$ | '''258'''cat /sys/class/sunxi_info/sys_info | grep "chipid"'''PI2''' sunxi_chipid : 338020004c0048080147478824681ed1 <span id| style="pythontext-related-instructionsalign: left;"></span>|== Python related instructions ==| '''35'''|-| '''272'''| '''PI16'''<span id| style="howtext-to-compile-and-install-python-source-codealign: left;"></span>=== How to compile and install Python source code ===|| '''If the Python version in the Ubuntu or Debian system software repository you are using does not meet the development requirements and you want to use the latest version of Python, you can use the following method to download the Python source code package to compile and install the latest version of Python.37'''|-'''The following demonstration is to compile and install the latest version of Python 3.9. If you want to compile and install other versions of Python, the method is the same (you need to download the source code corresponding to the Python you want to install).''' <ol | style="listtext-align: left;"|| style="text-typealign: decimalleft;">|<li><p>First install the dependency packages needed to compile Python</p><p>orangepi@orangepi:~$ '| '''sudo apt-get updateGND'''</p><p>orangepi@orangepi:~$ | '''sudo apt-get install -y build-essential zlib1g-dev \39'''</p><p>'''libncurses5|}{| class="wikitable" style="width:390px;margin-dev libgdbmright: 20px;text-dev libnss3align: center;"|-dev libssl-dev libsqlite3-dev \| '''Pin'''</p><p>| '''libreadline-dev libffi-dev curl libbz2-devFunction'''</p></li><li><p>Then download the latest version of Python3| '''GPIO'''| '''GPIO NO.9 source code and unzip it</p>'''|-<p>orangepi@orangepi:~$ | '''wget \2'''</p><p>[https://www.python.org/ftp/python/3.9.10/Python-3.9.10.tgz | '''5V'''https://www.python.org/ftp/python/3.9.10/Python| style="text-3.9.10.tgzalign: left;"|| style="text-align: left;"||-| '''4''']</p><p>orangepi@orangepi:~$ | ''''tar xvf Python-3.9.10.tgz5V'''</p></li><li><p>Then run the configuration command</p>| style="text-align: left;"|<p>orangepi@orangepi| style="text-align:~$ left;"||-| '''cd Python-3.9.106'''</p><p>orangepi@orangepi:~$ | '''./configure --enable-optimizationsGND'''</p></li><li><p>Then compile and install Python3.9. The compilation time takes about half an hour.</p>| style="text-align: left;"|<p>orangepi@orangepi| style="text-align:~$ left;"||-| '''make -j48'''</p><p>orangepi@orangepi:~$ | '''sudo make altinstallUART0_TX'''</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:~$ | '''PH0'python3.9 --version''| '''224'''</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 pipUART0_RX'''| '''PH1'''</p></li></ol>| '''225'''<span id="how-to-replace-pip-source-in-python"></span>=== How to replace pip source in Python ===|-| '''The default source used by Linux system pip is the official source of Python. However, accessing the official source of Python in China is very slow, and the installation of Python software packages often fails due to network reasons. So when using pip to install the Python library, please remember to change the pip source.12''' <ol | style="list-styletext-typealign: decimalleft;">|<li><p>First install | '''python3-pipPI1'''</p><p>orangepi@orangepi:~$ | '''sudo apt-get update257'''</p><p>orangepi@orangepi:~$ |-| '''sudo apt-get install -y python3-pip14'''</p></li><li><p>How to permanently change the pip source under Linux</p>| '''GND'''<ol | style="listtext-align: left;"|| style="text-typealign: lower-alphaleft;">||-<li><p>First create a new | '''~/.pip16''' directory, then add the > | '''pip.confPWM4/UART4_RX''' configuration file, and set the pip source in it > to Tsinghua source.</p><p>orangepi@orangepi:~$ | '''mkdir -p ~/.pipPI14'''</p><p>orangepi@orangepi:~$ | '''cat <<EOF > ~/.pip/pip.conf270'''</p><p>|-| '''[global]18'''</p><p>| style="text-align: left;"|| '''timeout = 6000PH4'''</p><p>| '''index-url = https://pypi.tuna.tsinghua.edu.cn/simple228'''</p><p>|-| ''''trusted-host = pypi.tuna.tsinghua.edu.cn20'''</p><p>| '''EOFGND'''</p></li><li><p>Then use pip3 to install the Python library very quickly</p></li></ol>| style="text-align: left;"|</li>| style="text-align: left;"||-| '''<lispan style="color:#FF0000">22<p/span>How to temporarily change the pip source under Linux, where '''<packagename>| ''' needs to be replaced with a specific package name</pspan style="color:#FF0000">TWI0_SDA<p/span>orangepi@orangepi:~$ /UART2_RX'''pip3 install <packagename> -i \| '''</pspan style="color:#FF0000">PI6<p/span>'''https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn'| '''</pspan style="color:#FF0000">262</li></olspan>''' <span id="how-to-install|-docker"></span>== How to install Docker == The Linux image provided by Orange Pi has Docker pre-installed, but the Docker service is not turned on by default. Use the | '''enable_docker.sh24''' 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.| '''SPI1_CS0'''orangepi@orangepi:~$ | '''enable_docker.shPH5''' You can use the following command to test docker. If | '''hello-world229''' can be run, docker can be used normally.|-orangepi@orangepi:~$ | '''docker run hello-world26''' Unable to find image | '''SPI1_CS1''hello-world:latest' locally latest: Pulling from library/hello-world 256ab8fe8778: Pull complete Digest: sha256:7f0a9f93b4aa3022c3a4c147a449ef11e0941a1fd0bf4a8e6c9408b2600777c5 Status: Downloaded newer image for hello-world:latest| '''PH9'''| '''Hello from Docker!233'''|-| '''<span style="color:#FF0000">28</span>'''| '''<span style="color:#FF0000">TWI2-SCL</span>/UART3_TX'''| '''<span style="color:#FF0000">PI9</span>'''| '''<span style="color:#FF0000">265</span>'''|-| '''30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''32'''| '''PWM1'''| '''PI11'''| '''267'''|-| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''36'''| style="text-align: left;"|| '''PC12'''| '''76'''|-| '''38'''| style="text-align: left;"|| '''PI4'''| '''260'''|-| '''40'''| style="text-align: left;"|| '''PI3'''| '''259'''|}</div>
<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 '''This message shows that your installation appears orangepi-config'''. Ordinary users remember to be working correctlyadd '''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 below, and then use the '''space''' to select the corresponding i2c configuration in the picture below.</p></li>
{| class="wikitable" style="width:800px;text-align: center;"|-| '''.….Multiplexing function in 40pin'''| '''Corresponding dtbo configuration'''|-| '''40pin - i2c0'''| '''pi-i2c0'''|-| '''40pin - i2c1'''| '''pi-i2c1'''|-| '''40pin - i2c2'''| '''pi-i2c2'''|}
<ol style="list-style-type: lower-alpha;"><li><p>'''Note: You need to log out and log in again to First run the system following command to take effect. You can also restart check the system.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>'''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 In the official documentation or corresponding books.above output''' <span id="installation-via-docker"></spanp>=== Installation via docker === <ol style="list-style-type: decimalnone;"><li><p>First, please install docker and ensure that docker can run normally. For a) 5002000 is the installation steps register base address of dockerthe i2c0 bus, please refer to the instructions in the [[\l|'''How to Install Docker''']] section.and i2c-0 shown behind it is its corresponding i2c device node</p></li><li><p>Then you can search for b) 5002400 is the docker image register base address of Home Assistant</p><p>orangepi@orangepi:~$ '''docker search homeassistant'''the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li><li><p>Then use c) 5002800 is the following command to download register base address of the Docker image of Home Assistant to your local computer. The image size is about 1GBi2c2 bus, and the download time will be relatively long. Please be patient and wait for the download to complete.i2c-4 shown behind it is its corresponding i2c device node</p><p/li>orangepi@orangepi:~$ '''docker pull homeassistant/home-assistant'''</pol><p/li>Using default tag: latest</pol>|}<p/li>latest: Pulling from homeassistant/home-assistant</pol><pol start="4" style="list-style-type: decimal;">be307f383ecc: Downloading</pli><p>5fbc4c07ac88: Download completeThen start testing i2c, first install i2c-tools</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''...... (Omit some output)sudo apt-get update'''</p><p>3cc6a1510c9forangepi@orangepi: Pull complete~$ '''sudo''' '''apt-get install -y i2c-tools'''</p>|}<p/li>7a4e4d5b979f: Pull complete</pli><p>Digest: sha256:81d381f5008c082a37da97d8b08dd8b358dae7ecf49e62ce3ef1eeaefc4381bbThen connect an i2c device to the i2c pin of the 40pin connector. Here we take the DS1307 RTC module as an example.</p><p>Status[[File: Downloaded newer image for homeassistant/homezero2w-assistant:latest</p><p>dockerimg178.io/homeassistant/home-assistant:latestpng]]</p></li><li><p>Then you can use the following '''i2cdetect -y x'''command to view . If the docker image address of Home Assistant you just downloadedthe connected i2c device can be detected, it means that the i2c device is connected correctly.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''<p>orangepi@orangepi:~$ '''docker images homeassistant/homeNote that x in the i2cdetect -assistanty x command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p><p>REPOSITORY TAG IMAGE ID CREATED SIZE'''</pbig><p>homeassistant/home|} [[File:zero2w-assistant latest bfa0ab9e1cf5 2 months ago '''1img179.17GB'''png]]</pli></liol><ol start="7" style="list-style-type: decimal;"><li><p>At this point Then you can run the Home Assistant docker container</p><p>orangepi@orangepi:~$ '''docker run -d \ds1307.py''' test program in '''examples'''to read the RTC time</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that the x in i2c--name homeassistant \x in the following command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP-Python# '''--privileged \cd examples'''</p><p>root@orangepi:~/wiringOP-Python/examples# '''python3 ds1307.py --restart=unless-stopped device \'''</p><p>'''"/dev/i2c-e TZ=Asia/Shanghai \x"'''</p><p>'''Thu 2022-v /home/orangepi/home06-assistant16 04:35:/config \'''46</p><p>'''Thu 2022-06-network=host \'''16 04:35:47</p><p>'''homeassistant/homeThu 2022-06-assistant16 04:latest'''35:48</p></li><li><p>Then enter【the IP address of the development board: 8123】in the browser to see the Home Assistant interface^C</p><p>'''It takes a while for the Home Assistant container to start. If the interface below does not display normally, please wait a few seconds before refreshing it. If the following interface is not displayed normally after waiting for more than a minute, it means there is a problem with the Home Assistant installation. At this time, you need to check whether there is a problem with the previous installation and setting process.'''exit</p>|}<div class="figure"/li></ol>
</div></listyle="display: flex;"><li><p>Then follow the interface prompts to set according to your own preferences, and then click Next</p><div ::{| class="figurewikitable"> [[File:zero2w-img182.png]] </div></li><li><p>Then click Next</p><div classstyle="figure"> [[Filewidth:zero2w390px;margin-img183right: 20px;text-align: center;"|-| '''GPIO NO.png]]'''| '''GPIO'''</div></li>| '''Function'''| '''Pin'''<li><p>Then click Finish</p>|-<div class| style="figuretext-align: left;">|| style="text-align: left;"|[[File:zero2w-img184| '''3.png]]3V'''| '''1'''</div></li><li><p>The main interface finally displayed by Home Assistant is as shown below</p>|-<p>[[File:zero2w-img185.png]]</p></li>| '''264'''<li><p>Method to stop Home Assistant container</p>| '''PI8'''<ol style="list| '''TWI1-style-type: lower-alpha;">SDA'''<li><p>The command to view the docker container is as follows</p><p>orangepi@orangepi:~$ | '''docker ps -a3'''</p></li><li><p>The command to stop the Home Assistant container is as follows</p>|-| '''263'''<p>orangepi@orangepi:~$ | '''docker stop homeassistantPI7'''</p></li><li><p>The command to delete the Home Assistant container is as follows</p>| '''TWI1-SCL'''<p>orangepi@orangepi:~$ | '''docker rm homeassistant5'''</p></li></ol></li></ol>|-| '''269'''| '''PI13'''<span id="installation-via-python"><| '''PWM3/span>=== Installation via python ===UART4_TX'''| '''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]]"7'''|-<ol | style="listtext-align: left;"|| style="text-typealign: decimalleft;">|<li><p>First install dependency packages</p><p>orangepi@orangepi:~$ | '''sudo apt-get updateGND'''</p><p>orangepi@orangepi:~$ | '''sudo apt-get install -y python3 python3-dev python3-venv \9'''</p><p>|-| '''python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \226'''</p><p>| '''libopenjp2-7 libtiff5 libturbojpeg0-dev tzdataPH2'''</p><p>| '''If it is debian12, please use the following command:UART5_TX'''</p><p>orangepi@orangepi:~$ | '''sudo apt-get update11'''</p><p>orangepi@orangepi:~$ '|-| '''sudo apt-get install -y python3 python3-dev python3-venv \227'''</p><p>| '''python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \PH3'''</p><p>| '''libopenjp2-7 libturbojpeg0-dev tzdataUART5_RX'''</p></li><li><p>Then you need to compile and install Python3.9. For the method, please refer to the [[\l|'''Python source code compilation and installation method13''']] section.</p><p>|-| '''The default Python version of Debian Bullseye is Python3.9, so there is no need to compile and install it.261'''| '''PI5'''</p><p>| '''The default Python version of Ubuntu Jammy is Python3.10, so there is no need to compile and install it.TWI0_SCL/UART2_TX'''</p><p>| '''The default Python version of Debian Bookworm is Python3.11, so there is no need to compile and install it.15'''</p></li><li><p>Then create a Python virtual environment</p>|-<p>'''Debian Bookworm is python3.11, please remember to replace the corresponding command.'''</p>| style="text-align: left;"|<p>orangepi@orangepi| style="text-align:~$ left;"|| '''sudo mkdir /srv/homeassistant3.3V'''</p><p>orangepi@orangepi:~$ | '''sudo chown orangepi:orangepi /srv/homeassistant17'''</p><p>orangepi@orangepi:~$ |-| '''cd /srv/homeassistant231'''</p><p>orangepi@orangepi:~$ | '''python3.9 -m venv .PH7'''</p><p>orangepi@orangepi:~$ | '''source bin/activateSPI1_MOSI'''</p><p>(homeassistant) orangepi@orangepi:/srv/homeassistant$</p></li>| '''19'''<li><p>Then install the required Python packages</p>|-<p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ | '''python3 -m pip install wheel232'''</p></li><li><p>Then you can install Home Assistant Core</p>| '''PH8'''<p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ | '''pip3 install homeassistantSPI1_MISO'''</p></li><li><p>Then enter the following command to run Home Assistant Core</p>| '''21'''|-<p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ | '''hass230'''</p></li><li><p>Then enter【| '''development board IP address: 8123PH6'''】 in the browser to see the Home Assistant interface</p><p>| '''SPI1_CLK'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.''| '''23'''</p><div class|-| style="figuretext-align: left;">| [[File:zero2w-img180.png]] </div></li></ol> <span id| style="opencvtext-installation-methodalign: left;"></span>|== OpenCV installation method ==| '''GND'''| '''25'''<span id="use|-apt-to-install-opencv"></span>=== Use apt to install OpenCV ===| '''266'''| '''PI10'''| '''TWI2-SDA/UART3_RX'''<ol style="list-style-type: decimal;"><li><p>The installation command is as follows</p><p>orangepi@orangepi:~$ | '''sudo apt-get update27'''</p><p>orangepi@orangepi:~$ |-| '''sudo apt-get install -y libopencv-dev python3-opencv256'''</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>| '''PI0'''<ol | style="listtext-style-typealign: lower-alphaleft;">|<li><p>The version of OpenCV in Ubuntu22.04 is as follows:</p><p>orangepi@orangepi:~$ | '''29'python3 -c "import cv2; print(cv2.__version__)"''|-| '''271'''</p><p>| '''4.5.4PI15'''</p></li><li><p>The version of OpenCV in Ubuntu20.04 is as follows| style="text-align:</p>left;"|<p>orangepi@orangepi:~$ | '''python3 -c "import cv2; print(cv2.__version__)"31'''</p><p>|-| '''4.2.0268'''</p></li><li><p>The version of OpenCV in Debian11 is as follows:</p>| '''PI12'''<p>orangepi@orangepi:~$ | '''python3 -c "import cv2; print(cv2.__version__)"PWM2'''</p><p>| '''4.5.133'''</p></li><li><p>The version of OpenCV in Debian12 is as follows:</p><p>orangepi@orangepi:~$ |-| '''python3 -c "import cv2; print(cv2.__version__)"258'''</p><p>| ''''4.6.0PI2'''</p></li></ol></li></ol> <span id| style="settext-up-the-chinese-environment-and-install-the-chinese-input-methodalign: left;"></span>|== Set up the Chinese environment and install the Chinese input method ==| '''35'''|-| '''Note, before installing the Chinese input method, please make sure that the Linux system used by the development board is a desktop version.272'''| '''PI16'''<span id| style="debiantext-system-installation-methodalign: left;"></span>|=== Debian system installation method ===| '''37'''|-<ol | style="listtext-align: left;"|| style="text-typealign: decimalleft;">|<li><p>First set the default | '''localeGND''' to Chinese</p><ol | '''39'''|}{| class="wikitable" style="listwidth:390px;margin-styleright: 20px;text-typealign: lower-alphacenter;"><li><p>Enter the following command to start configuring |-| '''localePin'''</p><p>orangepi@orangepi:~$ | '''sudo dpkg-reconfigure localesFunction'''</p></li><li><p>Then select | '''GPIO'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>GPIO NO.''', and then return Car can be used)</p><p>[[File:zero2w|-img186.png]]</p></li><li><p>Then set the default | '''2'locale''| ' to '''zh_CN.UTF-85V'''</p><p>[[File| style="text-align:zero2wleft;"|| style="text-align: left;"||-img187.png]]</p></li><li><p>After exiting the interface, the | '''locale4''' setting will begin. > The output displayed on the command line is as follows:</p><p>orangepi@orangepi:~$ | '''sudo dpkg-reconfigure locales5V'''</p><p>Generating locales (this might take a while)...</p>| style="text-align: left;"|<p>en_US.UTF| style="text-8... done</p>align: left;"|<p>zh_CN.UTF|-8... done</p><p>Generation complete.</p></li></ol>| '''6'''</li><li><p>Then open | '''Input MethodGND'''</p><p>[[File| style="text-align:zero2wleft;"|| style="text-align: left;"||-img188.png]]</p></li><li><p>Then select | '''OK8'''</p><p>[[File:zero2w-img189.png]]</p></li><li><p>Then select | '''YesUART0_TX'''</p><p>[[File:zero2w-img190.png]]</p></li>| '''PH0'''<li><p>Then select | '''fcitx224'''</p><p>[[File:zero2w|-img191.png]]</p></li><li><p>Then select | '''10'''| '''OKUART0_RX'''</p><p>[[File:zero2w-img192.png]]</p></li>| '''PH1'''<li><p>| '''Then restart the Linux system to make the configuration take effect.225'''</p></li><li><p>Then open |-| '''Fcitx configuration12'''</p><p>[[File| style="text-align:zero2w-img193.png]]</p></li>left;"|<li><p>Then click the + sign as shown in the picture below</p>| '''PI1'''<p>[[File:zero2w-img194.png]]</p></li><li><p>Then search | '''Google Pinyin257''' and click |-| '''OK14'''| '''GND'''</p><div class| style="figuretext-align: left;">| [[File| style="text-align:zero2w-img195.png]]left;"||-</div></li><li><p>Then put | '''16'''Google Pinyin| ''' on top<PWM4/p><p>[[File:zero2w-img196.png]]</p>UART4_RX'''<p>[[File:zero2w-img197.png]]</p></li><li><p>Then open the | '''GeanyPI14'''| '''270''' 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>| '''18'''<p>[[File| style="text-align:zero2w-img199.png]]</p></li>left;"|<li><p>You can switch between Chinese and English input methods through the | '''Ctrl+SpacePH4''' 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/locale228''' to |-| '''zh_CN.UTF-820'''</p><p>orangepi@orangepi:~$ '| '''sudo vim /etc/default/localeGND'''</p><p># File generated by update| style="text-locale</p>align: left;"|<p>LC_MESSAGES| style="text-align: left;"||-| '''zh_CN.UTF-8'22'''</p><p>LANG=| '''zh_CN.UTF-8TWI0_SDA/UART2_RX'''</p><p>LANGUAGE=| '''zh_CN.UTF-8PI6'''</p></li><li><p>Then | '''restart the system262''' and you will see that the system is displayed in Chinese.</p><p>[[File:zero2w|-img200.png]]</p></li></ol>| '''24'''<span id="installation-method-of-ubuntu-20.04-system"></span>| '''SPI1_CS0'''=== Installation method of Ubuntu 20.04 system ===| '''PH5'''| '''229'''<ol style="list|-style-type: decimal;"><li><p>First open | '''Language Support26'''</p><p>[[File:zero2w-img201.png]]</p></li>| '''SPI1_CS1'''<li><p>Then find the | '''Chinese (China)PH9''' option</p><p>[[File:zero2w-img202.png]]</p></li>| '''233'''|-<li><p>Then please use the left button of the mouse to select | '''Chinese (China)28''' 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| '''TWI2-img203.png]]<SCL/p></li></ol>UART3_TX'''| '''PI9'''| '''Note that this step is not easy to drag, please be patient and try it a few times.265'''|-<ol start=| '''30'''| '''GND'''| style="4text-align: left;" || style="list-styletext-typealign: decimalleft;">|<li><p>Then select |-| '''Apply System-Wide32''' 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 systemPWM1''' system to | '''PI11'''| 'fcitx''267'''</p><p>[[File:zero2w|-img205.png]]</p></li><li><p>| '''Then restart the Linux system to make the configuration take effect34'''</p></li><li><p>After re-entering the system, please select | '''Do not ask me againGND''' 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| 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.png]]</p></li><li><p>Then we can open | '''Geany36''' to test the Chinese input method. The opening method is as shown in the figure below</p><p>[[File| style="text-align:zero2w-img208.png]]</p></li>left;"|<li><p>After opening | '''GeanyPC12''', the English input method is still the default. We can switch to the Chinese input method through the | '''Ctrl+Space76''' shortcut key, and then we can input Chinese.</p><p>[[File:zero2w|-img209.png]]</p></li></ol> <span id| '''38'''| style="installationtext-method-of-ubuntu-22.04-systemalign: left;"></span>|| '''PI4'''| '''260'''|-| '''40'''| style=== Installation method of Ubuntu 22.04 system ==="text-align: left;"|| '''PI3'''| '''259'''|}</div>
<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 open run '''orangepi-config'''. Ordinary users remember to add '''Language Supportsudo'''permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>[[Fileorangepi@orangepi:zero2w~$ '''sudo orangepi-img201.png]]config'''</p>|}</li><li><p>Then find the select '''Chinese (China)System''' option</p><p>[[File:zero2w-img210img80.png]]</p></li><li><p>Then please use the left button of the mouse to select '''Chinese (China)Hardware''' 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-img211img81.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></olli>
{| class="wikitable" style="width:800px;text-align: center;"|-| '''Note that this step is not easy to drag, please be patient and try it a few times.Multiplexing function in 40pin'''| '''Corresponding dtbo configuration'''|-| '''40pin - uart2'''| '''pi-uart2'''|-| '''40pin - uart3'''| '''pi-uart3'''|-| '''40pin - uart4'''| '''pi-uart4'''|-| '''40pin - uart5'''| '''ph-uart5'''|}
[[File:zero2w-img175.png]]</ol><ol start="45" style="list-style-type: decimallower-alpha;"><li><p>Then select '''Apply System-Wide<Save>''' to apply the Chinese settings to the entire systemsave</p><p>[[File:zero2w-img212img83.png]]</p></li><li><p>'''Then restart the Linux system to make the configuration take effect'''</p></li><li><p>After re-entering the system, please select '''Do not ask me again<Back>''' 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-img206img84.png]]</p></li><li><p>Then you can see that select '''<Reboot>''' to restart the system to make the desktop is displayed in Chineseconfiguration take effect.</p><p>[[File:zero2w-img207img85.png]]</p></li></ol></li><p/ol><!-- -->Then open the Fcitx5 configuration program</pol start="3" style="list-style-type: decimal;"><li><p>[[File:zero2w-img213.png]]After entering the Linux system, first confirm whether there is a uart5 device node under '''<span class="mark">/dev</pspan>'''</lip>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <libig><p>Then choose to use Pinyin input method'''注意, linux5.4系统为/dev/ttyASx.'''</p></big>|}<div {| class="figurewikitable" style="width:800px;"> [[File:zero2w|-img214.png]]| <p>orangepi@orangepi:~$ '''ls /div>dev/ttyS*'''</lip><lip>/dev/ttySx</p>The interface after selection is as shown below, then click OK|}</pli><li><p>[[File:zero2wThen start testing the uart interface. First use Dupont wire to short-img215circuit the rx and tx pins of the uart interface to be tested.png]]</p></li><li><p>Then we can open Use the '''Geanygpio''' command in wiringOP to test the Chinese input method. The opening method is loopback function of the serial port as shown in below. If you can see the following print, it means the figure belowserial port communication is normal.</p><p>[[File{| class="wikitable" style="background-color:#ffffdc;width:zero2w800px;" |-img208.png]]</p></li>| <libig><p>After opening '''Geany''', Note that the English input method is still last x in the default. We can switch gpio serial /dev/ttySx command needs to be replaced with the Chinese input method through serial number of the corresponding uart device node.'''Ctrl+Space''' shortcut key, and then we can enter Chinese.</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>[[Fileorangepi@orangepi:zero2w~$ '''gpio serial /dev/ttySx # linux-img2166.png]]1 test command'''</p><p>orangepi@orangepi:~$ '''gpio serial /li>dev/ttyASx # linux-5.4 test command'''</olp>
<span id="remotep>Out: 0: -> 0</p><p>Out: 1: -login> 1</p><p>Out: 2: -using> 2</p><p>Out: 3: -nomachine"> 3^C</p>|}</li><li><p>Finally, you can run the '''serialTest.py''' program in examples to test the loopback function of the serial port. If you can see the following print, it means that the serial port loopback test is normal.</spanp>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that the x in /dev/ttySx or /dev/ttyASx in the command needs to be replaced with the serial number of the corresponding uart device node.'''</p></big>|}{| class= Remote login using NoMachine =="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p><p>root@orangepi:~/wiringOP-Python/examples# '''python3 serialTest.py --device "/dev/ttySx" # linux6.1 use'''</p><p>root@orangepi:~/wiringOP-Python/examples# '''python3 serialTest.py --device "/dev/ttyASx" # linux5.4 use'''</p>
{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''Note that this download link may change.cat /sys/class/sunxi_info/sys_info | grep "chipid"'''
<span id="remotehow-loginto-usingcompile-vncand-install-python-source-code"></span>=== Remote login using VNC How to compile and install Python source code ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Before operating, please make sure that If the Python version in the Windwos computer and Ubuntu or Debian system software repository you are using does not meet the development board are in requirements and you want to use the same LANlatest version of Python, and that you can log in use the following method to download the Python source code package to compile and install the Ubuntu or Debian system latest version of the development board through ssh normallyPython.'''
'''There are many problems with VNC testing in Ubuntu20The following demonstration is to compile and install the latest version of Python 3.049. If you want to compile and install other versions of Python, please do not use this the methodis the same (you need to download the source code corresponding to the Python you want to install).'''</big>|}
<ol style="list-style-type: decimal;">
<li><p>First run install the '''set_vnc.sh''' script dependency packages needed to set up vnc, compile Python</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''remember to add sudo permissionapt-get update'''s</p><p>orangepi@orangepi:~$ '''sudo set_vnc.shapt-get install -y build-essential zlib1g-dev \'''</p><p>You will require a password to access your desktops.'''libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev \'''</p><p>Password: '''#Set the vnc password here, 8 characterslibreadline-dev libffi-dev curl libbz2-dev'''</p>|}</li><li><p>Then download the latest version of Python3.9 source code and unzip it</p>{| class="wikitable" style="width:800px;" |-| <p>Verifyorangepi@orangepi: ~$ '''#Set the vnc password here, 8 characterswget \'''</p><p>Would you like to enter a view-only password (y/n)? '''nhttps://www.python.org/ftp/python/3.9.10/Python-3.9.10.tgz'''</p><p>xauthorangepi@orangepi: file ~$ '''tar xvf Python-3.9.10.tgz'''</rootp>|}</.Xauthority does not existli><li><p>Then run the configuration command</p>{| class="wikitable" style="width:800px;" |-| <p>New orangepi@orangepi:~$ '''cd Python-3.9.10''X' desktop is orangepi:1</p><p>Creating default startup script /root/orangepi@orangepi:~$ '''.vnc/xstartupconfigure --enable-optimizations'''</p>|}</li><li><p>Starting applications specified in /root/Then compile and install Python3.9. The compilation time takes about half an hour.vnc/xstartup</p>{| class="wikitable" style="width:800px;" |-| <p>Log file is /root/.vnc/orangepi@orangepi:1.log~$ '''make -j4'''</p><p>Killing Xtightvnc process ID 3047orangepi@orangepi:~$ '''sudo make altinstall'''</p>|}</li><li><p>New 'X' desktop is orangepi:1After installation, you can use the following command to check the version number of the Python you just installed.</p>{| class="wikitable" style="width:800px;" |-| <p>Starting applications specified in /root/orangepi@orangepi:~$ '''python3.vnc/xstartup9 --version'''</p><p>Log file is /root/'''Python 3.vnc/orangepi:19.log10'''</p>|}</li><li><p>The steps to use MobaXterm software to connect to the development board Linux system desktop are as follows:Then update pip</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;">|-| <lip>First click Session, then select VNC, then fill in the IP > address and port of the development board, and finally click > OK to confirmorangepi@orangepi:~$ '''/usr/local/bin/python3.9 -m pip install --upgrade pip'''</li></olp>|}
</li></ol>
<div classspan id="figurehow-to-replace-pip-source-in-python"></span>
<ol style="list-style-type: decimal;">
<li><p>Use the following script to First install QT5 and QT Creator'''python3-pip'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''install_qt.shsudo apt-get install -y python3-pip'''</p>|}</li><li><p>After installation, How to permanently change the QT version number will be automatically printed.pip source under Linux</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The qt version that comes with Ubuntu20.04 is First create a new '''5.12~/.8pip'''</p><p>orangepi@orangepi:~$ directory, then add the '''install_qtpip.shconf'''configuration file, and set the pip source in it to Tsinghua source.</p><p>......</p>{| class="wikitable" style="width:800px;" |-<p>QMake version 3.1</p>| <p>Using Qt version '''5.12.8orangepi@orangepi:~$ ''' in /usr/lib/aarch64mkdir -linux-gnu</p><~/li><li><p>The QT version that comes with Ubuntu22.04 is '''5.15.3pip'''</p><p>orangepi@orangepi:~$ '''install_qtcat <<EOF > ~/.pip/pip.shconf'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version '''5.15.3[global]''' in /usr/lib/aarch64-linux-gnu</p></li><li><p>The QT version that comes with Debian11 is '''5.15.2timeout = 6000'''</p><p>orangepi@orangepi:~$ '''install_qt.sh'''<index-url = https://p><p>...pypi.tuna.tsinghua.</p><p>QMake version 3edu.1<cn/p><p>Using Qt version simple'''5.15.2''' in /usr/lib/aarch64-linux-gnu</p></li><li><p>The QT version that comes with Debian12 is '''5trusted-host = pypi.tuna.tsinghua.15edu.8cn'''</p><p>orangepi@orangepi:~$ '''install_qt.shEOF'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version '''5.15.8''' in /usr/lib/aarch64-linux-gnu</p></li></ol>|}
</li>
<li><p>Then you can see the QT Creator startup icon in '''Applications'''</p><p>[[File:zero2w-img230.png]]</p><p>You can also use pip3 to install the following command to open QT Creator</p><p>orangepi@orangepi:~$ '''qtcreator'''</p></li><li><p>The interface after QT Creator is opened is as follows</p><p>[[File:zero2w-img231.png]]</p></li><li><p>The version of QT Creator is as follows</p><ol style="list-style-type: lower-alpha;"><li><p>The default version of QT Creator in '''Ubuntu20.04''' is as > follows</p><p>[[File:zero2w-img232.png]]</p></li><li><p>The default version of QT Creator in '''Ubuntu22.04''' is as > follows</p><p>[[File:zero2w-img233.png]]</p></li><li><p>The default version of QT Creator in '''Debian11''' is as follows</p><p>[[File:zero2w-img234.png]]</p></li><li><p>The default version of QT Creator in '''Debian12''' is as follows</p><p>[[File:zero2w-img235.png]]Python library very quickly</p></li></ol>
</li>
<li><p>Then set up QT</p><ol style="list-style-type: lower-alpha;"><li><p>First open How to temporarily change the pip source under Linux, where '''Help'''-<packagename>'''About Plugins...'''.needs to be replaced with a specific package name</p><p>[[File{| class="wikitable" style="width:zero2w800px;" |-img236.png]]</p></li><li><p>Then remove the check mark of '''ClangCodeModel'''</p>| <p>[[Fileorangepi@orangepi:zero2w-img237.png]]</p></li><li><p>~$ '''After setting up, you need to restart QT Creatorpip3 install <packagename> -i \'''</p></li><li><p>Then make sure the GCC compiler used by QT Creator. If the > default is Clang, please change it to GCC.</p><p>'''Debian12 please skip this step.'''</p><p>[[Filehttps:zero2w-img238.png]]</p><p>[[File:zero2w-img239.png]]</p></li></ol></li><li><p>Then you can open a sample code</p><p>[[File:zero2w-img240pypi.png]]</p></li><li><p>After clicking on the sample code, the corresponding instruction document will automatically opentuna. You can read the instructions carefullytsinghua.</p><p>[[File:zero2w-img241edu.png]]</p></li><li><p>Then click '''Configure Project'''<cn/p><p>[[File:zero2wsimple -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: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.</p><p>[[File:zero2wtrusted-img244.png]]</p></li><li><p>References</p><p>[https://wikihost pypi.qttuna.io/Install_Qt_5_on_Ubuntu '''https://wikitsinghua.qtedu.io/Install_Qt_5_on_Ubuntucn''']</p><p>[https://download.qt.io/archive/qtcreator '''https://download.qt.io/archive/qtcreator''']</p>|}<p>[https://download.qt.io/archive/qt '''https://download.qt.io/archive/qt''']</p></li></ol>
<span id="roshow-installationto-methodinstall-docker"></span>== ROS installation method ==
Unable to find image '''httpshello-world://wiki.ros.org/Distributions''latest'locally
'''ERROR: error loading sources list<span style="color:#FF0000">Hello from Docker!</span>'''
'''The read operation timed out<span style="color:#FF0000">This message shows that your installation appears to be working correctly.</span>'''
<ol startspan id="6" style="listinstallation-stylevia-type: decimal;python"><li><p>Then open a command line terminal window on the '''desktop''', and then use the '''test_ros.sh''' script to start a small turtle routine to test whether ROS can be used normally.</p><p>orangepi@orangepi:~$ '''test_ros.sh'''</p></li><li><p>After running the '''test_ros.sh''' script, a small turtle as shown in the picture below will pop up.</p><p>[[File:zero2w-img248.png]]</p></li><li><p>Then please keep the terminal window you just opened at the top</p></li></olspan>
<ol style="list-style-type: decimal;">
<li><p>The currently active version of ROS 2 is as follows, the recommended version is '''Galactic Geochelone'''First install dependency packages</p><p>[[File{| class="wikitable" style="width:zero2w800px;" |-img251.png]]</p><p>[[File:zero2w-img252.png]]</p>| <p>[httporangepi@orangepi://docs.ros.org/ ~$ '''http://docs.ros.orgsudo apt-get update''']</p><p>orangepi@orangepi:~$ '''http://docs.ros.org/en/galactic/Releases.htmlsudo apt-get install -y python3 python3-dev python3-venv \'''</p></li><li><p>The link to the official installation documentation of ROS 2 '''Galactic Geochelonepython3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \''' is as follows:</p><p>'''docs.ros.org/en/galactic/Installation.htmllibopenjp2-7 libtiff5 libturbojpeg0-dev tzdata'''</p><p>'''http|}{| class="wikitable" style="background-color:#ffffdc;width://docs.ros.org/en/galactic/Installation/Ubuntu800px;" |-Install-Debians.html'''</p></li>| <libig><p>In the official installation documentation of ROS 2 '''Galactic Geochelone''', Ubuntu Linux recommends using Ubuntu20.04If it is debian12, so please ensure that the system used by use the development board is the '''Ubuntu20.04 desktop system'''. There are several ways to install ROS 2. The following demonstrates how to install ROS 2 '''Galactic Geochelone''' through '''Debian packagescommand:'''.</p></libig><li><p>Use the orangepi@orangepi:~$ '''install_ros.shsudo apt-get update''' script to install ros2</p><p>orangepi@orangepi:~$ '''install_ros.sh ros2sudo apt-get install -y python3 python3-dev python3-venv \'''</p></li><li><p>The '''install_ros.sh''' script will automatically run the '''ros2 python3-h''' command after installing ros2. If you can see the following print, it means that the ros2 installation is complete.</p><p>usage: ros2 [pip libffi-h] Call `ros2 <command> dev libssl-h` for more detailed usage. ...</p><p>ros2 is an extensible command-line tool for ROS 2.</p><p>optional arguments:</p><p>dev libjpeg-h, dev zlib1g-dev autoconf build-help show this help message and exitessential \'''</p><p>Commands:</p><p>action Various action related sub'''libopenjp2-commands</p><p>bag Various rosbag related sub7 libturbojpeg0-commands</p><p>component Various component related sub-commands</p><p>daemon Various daemon related sub-commands</p><p>doctor Check ROS setup and other potential issues</p><p>interface Show information about ROS interfaces</p><p>launch Run a launch file</p><p>lifecycle Various lifecycle related sub-commands</p><p>multicast Various multicast related sub-commands</p><p>node Various node related sub-commands</p><p>param Various param related sub-commands</p><p>pkg Various package related sub-commands</p><p>run Run a package specific executable</p><p>security Various security related sub-commands</p><p>service Various service related sub-commands</p><p>topic Various topic related sub-commandsdev tzdata'''</p><p>wtf Use `wtf` as alias to `doctor`</p>|}<p>Call `ros2 <command> -h` for more detailed usage.</p></li><li><p>Then you can use the '''test_rosneed to compile and install Python3.sh''' script to test whether ROS 2 is installed successfully9. If you can see For the following printmethod, it means ROS 2 can run normally.</p><p>orangepi@orangepi:~$ please refer to the [[Orange Pi Zero 2W#Python related instructions|'''test_ros.shPython source code compilation and installation method'''</p><p>[INFO] [1671174101] section.200091527] [talker]: Publishing: 'Hello World: 1'</p><p>[INFO] [1671174101.235661048] [listener]{| class="wikitable" style="background-color: I heard#ffffdc;width: [Hello World: 1]800px;" |-| </pbig><p>[INFO] [1671174102.199572327] [talker]: Publishing: 'Hello World: 2'</p><p>[INFO] [1671174102'The default Python version of Debian Bullseye is Python3.204196299] [listener]: I heard: [Hello World: 2]</p><p>[INFO] [16711741039, so there is no need to compile and install it.199580322] [talker]: Publishing: 'Hello World: 3''</p><p>[INFO] [1671174103.204019965] [listener]: I heard: [Hello World: 3]</p></li><li><p>Run the following command to open rviz2</p><p>orangepi@orangepi:~$ '''source /opt/ros/galactic/setupThe default Python version of Ubuntu Jammy is Python3.10, so there is no need to compile and install it.bash'''</p><p>orangepi@orangepi:~$ '''ros2 run rviz2 rviz2The default Python version of Debian Bookworm is Python3.11, so there is no need to compile and install it.'''</p><p>[[File:zero2w-img253.png]]</pbig>|}</li><li><p>For how to use ROS, please refer to the documentation of ROS 2.Then create a Python virtual environment</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>[http://docs.ros.org/en/galactic/Tutorials.html '''http://docsDebian Bookworm is python3.ros.org/en/galactic/Tutorials11, please remember to replace the corresponding command.html''']</p></li></olbig>|}<span id{| class="how-to-install-ros-2-humble-on-ubuntu22.04wikitable"></span>=== How to install ROS 2 Humble on Ubuntu22.04 === <ol style="list-style-typewidth: decimal800px;"><li>|-| <p>Use the install_ros.sh script to orangepi@orangepi:~$ '''install_ros.shsudo mkdir /srv/homeassistant'''</p><p>orangepi@orangepi:~$ '''install_ros.sh ros2sudo chown orangepi:orangepi /srv/homeassistant'''</p></li><li><p>The orangepi@orangepi:~$ '''install_ros.sh''' script will automatically run the '''ros2 -hcd /srv/homeassistant''' command after installing ros2. If you can see the following print, it means that the ros2 installation is complete.</p><p>usageorangepi@orangepi: ros2 [-h] Call `ros2 <command> -h` for more detailed usage~$ '''python3. ...</p><p>ros2 is an extensible command9 -line tool for ROS 2m venv .'''</p><p>optional argumentsorangepi@orangepi:<~$ '''source bin/p><p>-h, --help show this help message and exitactivate'''</p><p>Commands(homeassistant) orangepi@orangepi:</p><p>action Various action related sub-commands<srv/p><p>bag Various rosbag related sub-commandshomeassistant$</p><p>component Various component related sub-commands</p>|}<p>daemon Various daemon related sub-commands</pli><pli>doctor Check ROS setup and other potential issues</p><p>interface Show information about ROS interfacesThen install the required Python packages</p><p>launch Run a launch file</p>{| class="wikitable" style="width:800px;" <p>lifecycle Various lifecycle related sub|-commands</p><p>multicast Various multicast related sub-commands</p>| <p>node Various node related sub-commands<(homeassistant) orangepi@orangepi:/p><p>param Various param related sub-commands<srv/p><p>pkg Various package related subhomeassistant$ '''python3 -commandsm pip install wheel'''</p><p>run Run a package specific executable</p>|}<p>security Various security related sub-commands</p><p>service Various service related sub-commands</p><p>topic Various topic related sub-commands</p><p>wtf Use `wtf` as alias to `doctor`</p><p>Call `ros2 <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 successfully installed. If you can see the following print, it means ROS 2 can run normally.install Home Assistant Core</p>{| class="wikitable" style="width:800px;" |-| <p>(homeassistant) orangepi@orangepi:~/srv/homeassistant$ '''test_ros.sh'pip3 install homeassistant''</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 Then enter the following command to open rviz2run Home Assistant Core</p>{| class="wikitable" style="width:800px;" |-| <p>(homeassistant) orangepi@orangepi:~$ '''source /opt/ros/humblesrv/setup.bash'''</p><p>orangepi@orangepi:~homeassistant$ '''ros2 run rviz2 rviz2hass'''</p><p>[[File:zero2w-img254.png]]</p>|}</li><li><p>Reference documentation</p><p>Then enter【'''httpdevelopment board IP address://docs.ros.org/en/humble/index.html8123'''】 in the browser to see the Home Assistant interface</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>[http://docs.ros.org/en/galactic/Tutorials.html '''http://docsWhen you run the hass command for the first time, some libraries and dependency packages necessary for operation will be downloaded, installed and cached.rosThis process may take several minutes.org/en/humble/Installation/Ubuntu-Install-DebiansNote that you cannot see the Home Assistant interface in the browser at this time. Please wait for a while and then refresh it.html''']</p></libig>|}</oldiv class="figure">
<ol stylespan id="listopencv-styleinstallation-type: decimal;method"><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 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 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 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><p>orangepi@orangepi:/usr/src/hello$ '''sudo rmmod hello'''</p><p>orangepi@orangepi:/usr/src/hello$ '''dmesg | grep "Hello"'''</p><p>[ 2871.893988] Hello Orange Pi -- init</p><p>[ 3173.800892] '''Hello Orange Pi -- exit'''</p></li></olspan>
<span id="debianuse-bullseyeapt-systemto-install-opencv"></span>=== Debian Bullseye system Use apt to install OpenCV ===
<ol style="list-style-type: decimal;">
<li><p>Debian Bullseye The installation command is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.as follows</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>The version of a.gcc is as follows</p><p>orangepi@orangepi:~$ '''gcc |--version'''</p><p>gcc (Debian 10.2.1-6) 10.2.1 20210110</p><p>Copyright (C) 2020 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p></li><li><p>Write the '''hello_world.c''' program in C language</p>| <p>orangepi@orangepi:~$ '''vim hello_world.c'''</p><p>#include <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.csudo apt-get update'''</p><p>orangepi@orangepi:~$ '''gcc sudo apt-get install -o hello_world hello_world.cy libopencv-dev python3-opencv'''</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 print the version number of OpenCV. The output is normal, indicating that the OpenCV installation is successful.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The specific version of Python OpenCV in Ubuntu22.04 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3'''</p><p>'''Python 3.9.2''' (default, Feb 28 2021, 17:03:44)</p><p>[GCC 10.2.1 20210110] on linux</p><p>Type -c "help"import cv2;, print(cv2.__version__)"copyright", "credits" or "license" for more information.</p><p>>>>'''</p><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode4.5.4'''</p>|}</li><li><p>Write the '''hello_worldThe version of OpenCV in Ubuntu20.py''' program in Python language04 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_worldpython3 -c "import cv2; print(cv2.py__version__)"'''</p><p>print('Hello World!')'4.2.0'''</p>|}</li><li><p>The result version of running '''hello_world.py''' OpenCV in Debian11 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 hello_world-c "import cv2; print(cv2.py__version__)"'''</p><p>Hello World!'''4.5.1'''</p></li></ol>|}
</li>
<li><p>Debian Bullseye does not install Java compilation tools and operating environment by default.The version of OpenCV in Debian12 is as follows:</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>You can use the following command to install openjdk. The latest > version in Debian Bullseye is openjdk|-17</p>| <p>orangepi@orangepi:~$ '''sudo apt install python3 -y openjdk-17-jdk'''</p></li><li><p>After installation, you can check the Java versionc "import cv2; print(cv2.</p><p>orangepi@orangepi:~$ '''java --version__version__)"'''</p></li><li><p>Write the Java version of '''hello_world4.java6.0'''</p><p>orangepi@orangepi:~$ '''vim hello_world.java'''</p>|}<p>public class hello_world</p><pli>{</pol><p>public static void main(String[] args)</pli><p>{</pol><p>System.out.println("Hello World!");</p><pspan id="set-up-the-chinese-environment-and-install-the-chinese-input-method">}</pspan><p>}</p></li><li><p>Then compile == Set up the Chinese environment and run '''hello_world.java'''</p>install the Chinese input method == <p>orangepi@orangepi{| class="wikitable" style="background-color:#ffffdc;width:~$ '''javac hello_world.java'''</p>800px;" |-| <pbig>orangepi@orangepi:~$ '''java hello_worldNote, before installing the Chinese input method, please make sure that the Linux system used by the development board is a desktop version.'''</pbig><p>Hello World!</p></li></ol></li></ol>|} <span id="debian-bookwormsystem-systeminstallation-method"></span>=== Debian Bookworm system installation method ===
<ol style="list-style-type: decimal;">
<li><p>Debian Bookworm is installed with First set the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.'''locale''' to Chinese</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The version of a.gcc is as follows</p><p>orangepi@orangepi:~$ '''gcc --version'''</p><p>gcc (Debian 12.2.0-14) 12.2.0</p><p>Copyright (C) 2022 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p></li><li><p>Write Enter the following command to start configuring '''hello_world.clocale''' program in C language</p><p>orangepi@orangepi{| class="wikitable" style="width:~$ '''vim hello_world.c'''</p><p>#include <stdio.h></p><p>int main(void)</p><p>{</p><p>printf("Hello World!\n"800px;);</p>" <p>return 0;</p>|-<p>}</p></li><li><p>Then compile and run '''hello_world.c'''</p>| <p>orangepi@orangepi:~$ '''gcc sudo dpkg-o hello_world hello_world.creconfigure locales'''</p><p>orangepi@orangepi:~$ '''./hello_world'''</p><p>Hello World!</p></li></ol>|}
</li>
<li><p>Debian Bookworm has Python3 installed by defaultThen 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><ol style="listp>[[File:zero2w-styleimg186.png]]</p></li><li><p>Then set the default '''locale''' to '''zh_CN.UTF-type8'''</p><p>[[File: lowerzero2w-alpha;"img187.png]]</p></li><li><p>After exiting the interface, the '''locale''' setting will begin. The specific version of Python output displayed on the command line is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3sudo dpkg-reconfigure locales'''</p><p>Python 3Generating locales (this might take a while).11.2 (main, Mar 13 2023, 12.</p>:<p>en_US.UTF-8... done</p>:18<p>zh_CN.UTF-8... done</p><p>Generation complete.</p>|}</li></ol></li><li><p>Then open '''Input Method'''</p><p>[[File:29) zero2w-img188.png]]</p></li><li><p>Then select '''OK'''</p><p>[[GCC 12File:zero2w-img189.2png]]</p></li><li><p>Then select '''Yes'''</p><p>[[File:zero2w-img190.0png]] on linux</p></li><li><p>Then select '''fcitx'''</p><p>Type "help", "copyright", "credits" or "license" for more information[[File:zero2w-img191.png]]</p></li><li><p>Then select '''OK'''</p><p>>>>[[File:zero2w-img192.png]]</p></li><li><p>'''Use <span style="color:#FF0000">Then restart the Ctrl+D shortcut key Linux system to exit python's interactive modemake the configuration take effect.</span>'''</p></li><li><p>Write the Then open '''hello_world.pyFcitx configuration''' program </p><p>[[File:zero2w-img193.png]]</p></li><li><p>Then click the + sign as shown in Python languagethe picture below</p><p>orangepi@orangepi[[File:~$ zero2w-img194.png]]</p></li><li><p>Then search '''Google Pinyin''' and click '''OK'''vim hello_world</p><div class="figure"> [[File:zero2w-img195.pypng]] </div></li><li><p>Then put '''Google Pinyin''' on top</p><p>print([[File:zero2w-img196.png]]</p><p>[[File:zero2w-img197.png]]</p></li><li><p>Then open the '''Geany''Hello World!')editor to test the Chinese input method</p><p>[[File:zero2w-img198.png]]</p></li><li><p>The result of running 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 '''hello_worldCtrl+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.pyUTF-8''' is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 hello_worldsudo vim /etc/default/locale'''</p><p># File generated by update-locale</p><p>LC_MESSAGES='''<span style="color:#FF0000">zh_CN.pyUTF-8</span>'''</p><p>Hello World!LANG='''<span style="color:#FF0000">zh_CN.UTF-8</span>'''</p><p>LANGUAGE='''<span style="color:#FF0000">zh_CN.UTF-8</lispan>'''</olp>|}
</li>
<li><p>Debian Bookworm does not install Java compilation tools and operating environment by default.</p>Then '''<ol span style="list-style-typecolor: lower-alpha;#FF0000"><li><p>You can use restart the following command to install openjdk. The latest > version in Debian Bookworm is openjdk-17system</pspan><p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''</p></li><li><p>After installation, and you can check will see that the Java versionsystem is displayed in Chinese.</p><p>orangepi@orangepi[[File:~$ '''java -zero2w-version'''</p></li><li><p>Write the Java version of '''hello_worldimg200.java'''</p><p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p><p>public static void main(String[png]] args)</p><p>{</pli><p>System.out.println("Hello World!");</pol><p>}</p><p>}</p></li><li><p>Then compile and run '''hello_worldspan id="installation-method-of-ubuntu-20.java'''</p04-system"><p>orangepi@orangepi:~$ '''javac hello_world.java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p></li></ol></li></olspan>
<ol style="list-style-type: decimal;">
<li><p>Ubuntu Focal is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.First open '''Language Support'''</p><ol style="list-style-typep>[[File: lowerzero2w-alpha;"><li>img201.png]]</p>The version of a.gcc is as follows</pli><li><p>orangepi@orangepi:~$ Then find the '''gcc --versionChinese (China)'''option</p><p>gcc (Ubuntu 9.4.0[[File:zero2w-1ubuntu1~20img202.04.1) 9.4.0png]]</p></li><li><p>Copyright Then please use the left button of the mouse to select '''Chinese (CChina) 2019 Free Software Foundation''' and hold it down, Incthen drag it up to the starting position.After dragging, the display will be as shown below:</p><p>This is free software; see the source for copying conditions[[File:zero2w-img203. There is NOpng]]</p></li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <pbig>warranty; '''Note that this step is not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSEeasy to drag, please be patient and try it a few times.'''</pbig>|}</liol><ol start="4" style="list-style-type: decimal;"><li><p>Write the Then select '''hello_world.cApply System-Wide''' program in C languageto apply the Chinese settings to the entire system</p><p>orangepi@orangepi[[File:~$ zero2w-img204.png]]</p></li><li><p>Then set the '''Keyboard input method system''' system to '''vim hello_world.cfcitx'''</p><p>#include <stdio[[File:zero2w-img205.h>png]]</p></li><li><p>int main(void)'''<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>printf("Hello World!\n");[[File:zero2w-img206.png]]</p></li><li><p>return 0;Then you can see that the desktop is displayed in Chinese</p><p>}[[File:zero2w-img207.png]]</p></li><li><p>Then compile and run we can open '''hello_world.cGeany'''to test the Chinese input method. The opening method is as shown in the figure below</p><p>orangepi@orangepi[[File:~$ '''gcc zero2w-o hello_world hello_worldimg208.c'''png]]</p></li><li><p>orangepi@orangepi:~$ After opening '''Geany''', the English input method is still the default./hello_worldWe can switch to the Chinese input method through the '''Ctrl+Space'''shortcut key, and then we can input Chinese.</p><p>Hello World![[File:zero2w-img209.png]]</p></li></ol></li><lispan id="installation-method-of-ubuntu-22.04-system"><p/span> === Installation method of Ubuntu Focal has Python3 installed by default</p>22.04 system === <ol style="list-style-type: lower-alphadecimal;"><li><p>The specific version of Python3 is as follows</p><p>orangepi@orangepi:~$ First open '''python3Language Support'''</p><p>Python 3.8.10 (default, Nov 14 2022, 12[[File:59:47)</p><p>[GCC 9zero2w-img201.4.0png]] 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 Then find the '''hello_world.pyChinese (China)''' program in Python languageoption</p><p>orangepi@orangepi[[File:~$ '''vim hello_worldzero2w-img210.py'''</p><p>print('Hello World!')png]]</p></li><li><p>The result Then please use the left button of running the mouse to select '''hello_world.pyChinese (China)''' is and hold it down, then drag it up to the starting position. After dragging, the display will be as followsshown below:</p><p>orangepi@orangepi[[File:~$ '''python3 hello_worldzero2w-img211.py'''</p><p>Hello World!png]]</p></li></ol></li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <libig><p>Ubuntu Focal does '''Note that this step is not have Java compilation tools easy to drag, please be patient and running environment installed by defaulttry it a few times.'''</big>|}</pol><ol start="4" style="list-style-type: lower-alphadecimal;"><li><p>You can use Then select '''Apply System-Wide''' to apply the following command Chinese settings to install openjdk-17the entire system</p><p>orangepi@orangepi[[File:~$ '''sudo apt install zero2w-y openjdk-17-jdk'''img212.png]]</p></li><li><p>After installation, you can check '''<span style="color:#FF0000">Then restart the Linux system to make the Java version.configuration take effect</span>'''</p></li><li><p>orangepi@orangepi:~$ After re-entering the system, please select '''java --versionDo 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>openjdk 17[[File:zero2w-img206.0.2 2022-01-18png]]</p></li><li><p>OpenJDK Runtime Environment (build 17.0.2+8-Ubuntu-120.04)Then you can see that the desktop is displayed in Chinese</p><p>OpenJDK 64[[File:zero2w-Bit Server VM (build 17img207.0.2+8-Ubuntu-120.04, mixed mode, sharing)png]]</p></li><li><p>Write Then open the Java version of '''hello_world.java'''Fcitx5 configuration program</p><p>orangepi@orangepi[[File:~$ '''vim hello_worldzero2w-img213.java'''png]]</p><p/li>public class hello_world</pli><p>{Then choose to use Pinyin input method</p><pdiv class="figure">public static void main(String [[File:zero2w-img214.png]] args) </p><pdiv>{</pli><pli>System.out.println("Hello World!");</p><p>}The interface after selection is as shown below, then click OK</p><p>}[[File:zero2w-img215.png]]</p></li><li><p>Then compile and run we can open '''hello_world.javaGeany'''to test the Chinese input method. The opening method is as shown in the figure below</p><p>orangepi@orangepi[[File:~$ '''javac hello_worldzero2w-img208.java'''png]]</p></li><li><p>orangepi@orangepi:~$ After opening '''Geany''', the English input method is still the default. We can switch to the Chinese input method through the '''java hello_worldCtrl+Space'''shortcut key, and then we can enter Chinese.</p><p>Hello World![[File:zero2w-img216.png]]</p></li></ol> <span id="how-to-remotely-log-in-to-the-linux-system-desktop"></span> == How to remotely log in to the Linux system desktop == <span id="remote-login-using-nomachine"></lispan>=== Remote login using NoMachine === {| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Please ensure that the Ubuntu or Debian system installed on the development board is a <span style="color:#FF0000">desktop version</olspan>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:'''
'''https://knowledgebase.nomachine.com/DT10R00166'''<span id/big>|}{| class="ubuntuwikitable" style="background-jammycolor:#ffffdc;width:800px;" |-| <big>'''NoMachine supports Windows, Mac, Linux, iOS and Android platforms, so we can remotely log in and control the Orange Pi development board through NoMachine on a variety of devices. The following demonstrates how to remotely log in to the Linux system">desktop of the Orange Pi development board through NoMachine in Windows. For installation methods on other platforms, please refer to NoMachine's official documentation.'''</spanbig>|}{| class="wikitable" style== "background-color:#ffffdc;width:800px;" |-| <big>'''Before operating, please make sure that the Windwos computer and the development board are in the same LAN, and that you can log in to the Ubuntu Jammy or Debian system ===of the development board through ssh normally.'''</big>|}
<ol style="list-style-type: decimal;">
<li><p>Ubuntu Jammy is installed with First download the gcc compilation tool chain by defaultinstallation package of the NoMachine software Linux '''<span style="color:#FF0000">arm64</span>''' deb version, which can directly compile C language programs in and then install it into the Linux system of the development board.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The version of a.gcc Since H618 is as follows</p><p>orangepi@orangepi:~$ '''gcc --version'''</p><p>gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) '''11.3.0'''</p><p>Copyright (C) 2021 Free Software Foundation, Inc.</p><p>This is free software; see an ARMv8 architecture SOC and the source for copying conditions. There system we use is NO</p><p>warranty; not even for MERCHANTABILITY Ubuntu or FITNESS FOR A PARTICULAR PURPOSE.</p></li><li><p>Write Debian, we need to download the '''hello_world.cNoMachine for ARM ARMv8 DEB''' program in C language</p><p>orangepi@orangepi:~$ '''vim hello_worldinstallation package.c'''</p><p>#include <stdio.h></p><p>int main(void)</p><p>{</p><p>printf("Hello World!\n");</p><p>return 0;</p><p>}</p></li><li><p>Then compile and run '''hello_world.c'''</p><p>orangepi@orangepiThe download link is as follows:~$ '''gcc -o hello_world hello_world.c'''</p><p>orangepi@orangepi:~$ '''./hello_world'''</p><p>Hello World!</p></li></ol></li><li><p>Ubuntu Jammy has Python3 installed by default</p><ol {| class="wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;"><li><p>The specific version of Python3 is as follows</p>|-| <pbig>orangepi@orangepi:~$ '''python3'''</p><p>Python 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0] on linux</p><p>Type "help", "copyright"Note that this download link may change, "credits" or "license" please look for more information.</p><p>>>></p><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''<Armv8/p></li><li><p>Write Arm64 version of the '''hello_worlddeb package.py''' program in Python language</pbig><p>orangepi@orangepi:~$ '''vim hello_world.py'''</p>|}<p>print('Hello World!')</p></li><li><p>The result of running '''hello_world.py''' is as follows</p><p>orangepi@orangepi:~$ '''python3 hello_world.py'''</p><p>Hello World!</p></li></ol></li><li><p>Ubuntu Jammy does not install Java compilation tools and operating environment by default.</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>You can use the following command to install openjdk|-18</p><p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-18-jdk'''</p></li>| <li><p>After installation, you can check the Java version.</p><p>orangepi@orangepi[https:~$ '''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 18www.0nomachine.2-ea+9-Ubuntu-222.04, mixed mode, sharing)<com/p><download/li><li><p>Write the Java version of ''download&id=112&s=ARM 'hello_world.java'''</p><p>orangepi@orangepihttps:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{<downloads.nomachine.com/p><p>public static void main(String[] args)<download/p><p>{</p><p>System.out.println(?id=118"amp;Hello World!");</p><p>}</p><p>}</p></li><li><p>Then compile and run distro=ARM'''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>|}
[[File:zero2w-img217.png]]</ol><span idol start="2" style="methodlist-ofstyle-uploadingtype: lower-filesalpha;"><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-toNoMachine''' folder</p><p>[[File:zero2w-img219.png]]</p><p>Then download the arm64 version of thedeb 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;" |-linux| <p>orangepi@orangepi:~$ '''sudo dpkg -system"i nomachine_x.x.x_x_arm64_arm64.deb'''</p>|}</li></ol></li></spanol><ol start="2" style= Method "list-style-type: decimal;"><li>Then download the installation package of the Windows version of uploading files to the development board Linux system NoMachine software. The download address is as follows</li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <span big>'''Note that this download link may change.'''</big>|}{| class="wikitable" style="width:800px;" |-| '''https://downloads.nomachine.com/download/?id=9'''|} [[File:zero2w-img221.png]]</ol><ol start="method3" style="list-tostyle-upload-filestype: 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-linuximg223.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 systemin 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-ubuntu-pc"the next interface.</p></spanli>=== Method to upload files to <li><p>Finally you can see the desktop of the development board Linux system in Ubuntu PC ===</p><p>[[File:zero2w-img226.png]]</p></li></ol>
<span id="howremote-to-upload-fileslogin-using-scp-commandvnc"></span>==== How to upload files using scp command ====
'''<span idstyle="how-to-upload-files-using-filezillacolor:#FF0000">There are many problems with VNC testing in Ubuntu20.04, please do not use this method.</span>'''</big>==== How to upload files using filezilla ====|}
<ol style="list-style-type: decimal;">
<li><p>First install filezilla in Ubuntu PC</p><p>test@test:~$ run the '''set_vnc.sh''' script to set up vnc, '''remember to add sudo apt install -y filezillapermission'''s</p></li><li><p>Then use the following command to open filezilla</p>{| class="wikitable" style="width:800px;" |-| <p>testorangepi@testorangepi:~$ '''filezillasudo set_vnc.sh'''</p></li><li><p>The interface after opening filezilla is as shown below. At this time, the remote site on the right is emptyYou will require a password to access your desktops.</p><div class="figure">
<p>Password: '''<span style="color:#FF0000">#Set the vnc password here, 8 characters</divspan>'''</lip><lip>Verify: '''<pspan style="color:#FF0000">The method of connecting #Set the development board is as shown in the figure belowvnc password here, 8 characters</span>'''</p><p>Would you like to enter a view-only password (y/lin)? '''<span style="color:#FF0000">n</span>'''</olp><p>xauth: file /root/.Xauthority does not exist</p>
<div class="figure"p>Creating default startup script /root/.vnc/xstartup</p><p>Starting applications specified in /root/.vnc/xstartup</p><p>Log file is /root/.vnc/orangepi:1.log</p>
</div><ol start="7" style="list-style-type: decimal;"><li>After the connection is successful, you can see the directory structure of the development board's Linux file system on the right side of the filezilla software.</lip>Killing Xtightvnc process ID 3047</olp>
<div class="figure"p> [[File:zero2w-img260Starting applications specified in /root/.png]] vnc/xstartup</divp><ol start="9" style="list-style-type: decimal;"><li><p>After the upload Log file is completed, you can go to the corresponding path in the development board Linux system to view the uploaded file/root/.vnc/orangepi:1.log</p>|}</li><li><p>The method of uploading a folder is the same as the method of uploading a file, so I won't go into details here.</p></li></ol> <span id="method-steps to use MobaXterm software to-upload-files-from-windows-pc-connect to-the development-board-linux-Linux system">desktop are as follows:</spanp>=== Method to upload files from Windows PC to development board Linux system === <span idol style="howlist-tostyle-uploadtype: lower-files-using-filezilla-1alpha;"></spanli>==== How to upload files using filezilla ==== # First download click Session, then select VNC, then fill in the installation file IP address and port of the Windows version of the filezilla softwaredevelopment board, and finally click OK to confirm. The download link is as follows [https:<//filezilla-project.org/download.php?type=client '''https://filezilla-project.org/download.php?type=client'''] [[File:zero2w-img261.png]]li>
<div class="figure">
[[File:zero2w-img262img227.png]]
</div></ol><ol start="2" style="list-style-type: decimallower-alpha;"><li><p>The downloaded installation package is as shown below, then double-click to install it directlyThen enter the VNC password set earlier</p><p>'''FileZilla_Server_1.5.1_win64[[File:zero2w-setupimg228.exe'''png]]</p></li><li><p>After successful login, the interface is displayed as shown below, and then you can remotely operate the desktop of the development board Linux system.</p></olli>
<span id="howros-toinstallation-turn-on-the-power-button-in-linux5.4method"></span>== How to turn on the power button in Linux5.4 ==
# The power on/off button currently active version of the Linux 6.ROS 1 image is turned on by defaultas follows, but the power on/off button of the Linux 5.4 kernel image recommended version is turned off by default and needs to be turned on manually for normal use. The steps are as follows:'''Noetic Ninjemys'''
<ol start= "2" style="list-style-type: decimal;"><li><p>The link to the official installation documentation of ROS 1 '''Linux SDK——orangepiNoetic Ninjemys''' is as follows:</p>{| class="wikitable" style="width:800px;" |-build usage instructions| <p>[http://wiki.ros.org/noetic/Installation/Ubuntu '''http://wiki.ros.org/noetic/Installation/Ubuntu'' ']</p>|}</li><li><p>In the official installation documentation of ROS '''Noetic Ninjemys''', Ubuntu recommends using Ubuntu20.04, so please ensure that the system used by the development board is '''<span style="color:#FF0000">Ubuntu20.04 desktop system</span>'''.</p>{| class="wikitable" style="width:800px;" |-| <p>[http://wiki.ros.org/noetic/Installation '''http://wiki.ros.org/noetic/Installation''']</p><p>[[File:zero2w-img247.png]]</p>|}</li><li><p>Then use the script below to install ros1</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''install_ros.sh ros1'''</p>|}</li><li><p>Before using the ROS tool, you first need to initialize rosdep. Then when compiling the source code, you can quickly install some system dependencies and some core components in ROS.</p></li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''<span style="color:#FF0000">Note that when running the following command, you need to ensure that the development board can access github normally, otherwise an error will be reported due to network problems.</span>'''
updated cache in /home/orangepi/.ros/rosdep/sources.cache|}</ol><ol start="6" style="list-style-type: decimal;"><li><p>Then open a command line terminal window on the '''desktop''', and then use the '''test_ros.sh''' script to start a small turtle routine to testwhether ROS can be used normally.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@testorangepi:~$ '''sudo apt-get install -y gittest_ros.sh'''</p>|}</li><li><p>After running the '''test_ros.sh'''script, a small turtle as shown in the picture below will pop up.</p><p>[[File:zero2w-img248.png]]</p></li><li><p>Then please keep the terminal window you just opened at the top</p></li>
</div class></ol><ol start="figure9"style="list-style-type: decimal;"><li><p>At this time, press the direction keys on the keyboard to control the little turtle to move up, down, left, and right.</p><p>[[File:zero2w-img250.png]]</p></li></ol>
<ol style="list-style-type: decimal;"><li><p>The u-boot and linux kernel versions currently used by the H618 series development boards are active version of ROS 2 is as follows, the recommended version is '''Galactic Geochelone'''</p><p>[[File:zero2w-img251.png]]</p><p>[[File:zero2w-img252.png]]</p>{| class="wikitable" style="width:800px;"
|-
| <p>[http://docs.ros.org/ '''branchhttp://docs.ros.org''']</p>| <p>'''u-boot Versionhttp://docs.ros.org/en/galactic/Releases.html'''</p>| }</li><li><p>The link to the official installation documentation of ROS 2 '''linux Kernel versionGalactic Geochelone'''is as follows:</p>{| class="wikitable" style="width:800px;"
|-
| <p>'''currentdocs.ros.org/en/galactic/Installation.html'''</p>| <p>'''uhttp://docs.ros.org/en/galactic/Installation/Ubuntu-boot v2018Install-Debians.05html'''</p>| }</li><li><p>In the official installation documentation of ROS 2 '''Galactic Geochelone''', Ubuntu Linux recommends using Ubuntu20.04, so please ensure that the system used by the development board is the '''<span style="color:#FF0000">Ubuntu20.04 desktop system</span>'''linux5.4There are several ways to install ROS 2. The following demonstrates how to install ROS 2 '''Galactic Geochelone'''through '''Debian packages'''.</p></li><li><p>Use the '''install_ros.sh''' script to install ros2</p>{| class="wikitable" style="width:800px;"
|-
| '''next'''| '''u-boot v2021.07'''| <p>orangepi@orangepi:~$ '''linux6install_ros.1sh ros2'''</p>
|}
</li>
<li><p>The '''install_ros.sh''' script will automatically run the '''ros2 -h''' command after installing ros2. If you can see the following print, it means that the ros2 installation is complete.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>usage: ros2 [-h] Call `ros2 <command> -h` for more detailed usage. ...</p>
:<span id="downloadp>Call `ros2 <command> -the-cross-compilation-tool-chain">h` for more detailed usage.</spanp>=== Download the cross-compilation tool chain ===|}</li>When orangepi-build is run for the first time, it will automatically download <li><p>Then you can use the cross-compilation '''toolchaintest_ros.sh''' and put script to test whether ROS 2 is installed successfully. If you can see the following print, it in the means ROS 2 can run normally.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''toolchainstest_ros.sh''' folder</p><p>[INFO] [1671174101. Every time you run orangepi-build200091527] [talker]: Publishing: 'Hello World: 1's build</p><p>[INFO] [1671174101.235661048] [listener]: I heard: [Hello World: 1]</p><p>[INFO] [1671174102.sh script, it will check whether the cross-compilation toolchain in toolchains exists199572327] [talker]: Publishing: 'Hello World: 2'</p><p>[INFO] [1671174102. If If it does not exist, the download will be restarted204196299] [listener]: I heard: [Hello World: 2]</p><p>[INFO] [1671174103. If it exists, it will be used directly without repeated downloading199580322] [talker]: Publishing: 'Hello World: 3'</p><p>[INFO] [1671174103.204019965] [listener]: I heard: [Hello World: 3]</p>|}<div /li><li><p>Run the following command to open rviz2</p>{| class="figurewikitable" style="width:800px;"|-| <p>orangepi@orangepi:~$ '''source /opt/ros/galactic/setup.bash'''</p><p>orangepi@orangepi:~$ '''ros2 run rviz2 rviz2'''</p>|}<p>[[File:zero2w-img273img253.png]]</p></li><li><p>For how to use ROS, please refer to the documentation of ROS 2.</p>{| class="wikitable" style="width:800px;" |-| <p>[http://docs.ros.org/en/galactic/Tutorials.html '''http://docs.ros.org/en/galactic/Tutorials.html''']</p>|}</li></ol>
<span id="how-to-install-ros-2-humble-on-ubuntu22.04"></divspan>The mirror URL of the cross-compilation tool chain in China is the open source software mirror site of Tsinghua University:
:<p>Call `ros2 <command> -h` for more detailed usage.</p>|}</li><li><p>Then you can use the '''gcc-arm-11test_ros.2-2022.02-x86_64-aarch64-none-linux-gnush'''script to test whether ROS 2 is successfully installed. If you can see the following print, it means ROS 2 can run normally.</p> <ol start{| class="2wikitable" style="list-style-typewidth: lower-alpha800px;"|-| <p>orangepi@orangepi:~$ '''test_ros.sh'''</p><lip>linux6[INFO] [1671174101.200091527] [talker]: Publishing: 'Hello World: 1'</lip><p>[INFO] [1671174101.235661048] [listener]: I heard: [Hello World: 1]</olp> <p>[INFO] [1671174102.199572327] [talker]: Publishing: 'Hello World: 2''gcc-arm-11</p><p>[INFO] [1671174102.204196299] [listener]: I heard: [Hello World: 2-2022]</p><p>[INFO] [1671174103.02-x86_64-aarch64-none-linux-gnu'199580322] [talker]: Publishing: 'Hello World: 3'</p><p>[INFO] [1671174103.204019965] [listener]: I heard: [Hello World: 3]</p>|}</li>The cross-compilation tool chain used <li><p>Run the following command to compile the H618 uopen rviz2</p>{| class="wikitable" style="width:800px;" |-boot | <p>orangepi@orangepi:~$ '''source code is/opt/ros/humble/setup.bash'''</p><p>orangepi@orangepi:~$ '''ros2 run rviz2 rviz2'''</p><p>[[File:zero2w-img254.png]]</p>|}</li><ol li><p>Reference documentation</p>{| class="wikitable" style="list-style-typewidth: lower-alpha800px;"|-| <p>'''http://docs.ros.org/en/humble/index.html'''</p><lip>v2018[http://docs.ros.org/en/galactic/Tutorials.html '''http://docs.05ros.org/en/humble/Installation/Ubuntu-Install-Debians.html''']</p>|}</li></ol>
<ol style="list-style-type: decimal;">
<li><p>After downloadingThe Linux image released by OPi comes with the deb package of the kernel header file by default, and the storage location is '''/opt/'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''ls /opt/linux-build warehouse does not contain headers*'''</p><p>/opt/linux-headers-xxx-sun50iw9_x.x.x_arm64.deb</p>|}</li><li><p>Use the following command to install the source code deb package of the linux kernel, uheader file</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo dpkg -boot and crossi /opt/linux-compilation tool chainheaders*. The source code of deb'''</p>|}</li><li><p>After installation, you can see the folder where the linux kernel and u-boot header file is stored in an independent git warehouselocated under '''/usr/src'''.</p><ol {| class="wikitable" style="listwidth:800px;" |-style| <p>orangepi@orangepi:~$ '''ls /usr/src'''</p><p>linux-type: lowerheaders-alpha;"x.x.x</p>|}</li><li><p>The git warehouse where Then you can compile the linux kernel source code is stored is as follows. Please note of the hello kernel module that comes with the branch Linux image. The source code of the linux-orangepi warehouse hello module is switched in '''/usr/src/hello'''. After entering this directory, then use the make command tocompile.</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"|-| <p>orangepi@orangepi:~$ '''cd /usr/src/hello/'''</p><lip>orangepi@orangepi:/usr/src/hello$ '''sudo make'''</p><p>Linux5make -C /lib/modules/5.4.125/build M=/usr/src/hello modules</lip><p>make[1]: Entering directory '/usr/src/linux-headers-5.4.125'</olp>:<p>CC [M] /liusr/src/hello/hello.o</p>:<p>Building modules, stage 2.</olp>:<p>MODPOST 1 modules</lip>:<p>CC [M] /olusr/src/hello/hello.mod.o</p> https:<p>LD [M] /usr/src/hello/githubhello.comko</orangepi-xunlongp><p>make[1]: Leaving directory '/usr/src/linux-orangepiheaders-5.4.125'</treep>|}</li><li><p>After compilation, the '''orange-pi-5hello.4-sun50iw9ko'''kernel module will be generated</p> <ol start{| class="2wikitable" style="list-style-typewidth: lower-alpha800px;">|-| <lip>Linux6orangepi@orangepi:/usr/src/hello$ '''ls *.1ko'''</lip><p>hello.ko</olp>|}https:<//githubli><li><p>Use the '''insmod''' command to insert the '''hello.comko''' kernel module into the kernel</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi-xunlong@orangepi:/linux-orangepiusr/treesrc/hello$ '''orange-pi-6sudo insmod hello.1-sun50iw9ko'''</p>|}<ol start/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 correctly.</p>{| class="2wikitable" style="listwidth:800px;" |-style| <p>orangepi@orangepi:/usr/src/hello$ '''dmesg | grep "Hello"'''</p><p>[ 2871.893988] '''Hello Orange Pi -type: lower-alpha;"init'''</p>|}</li><li><p>The git warehouse where Use the '''rmmod''' command to uninstall the u-boot source code is stored is as follows'''hello. Please note that the branch of the u-boot-orangepi warehouse is switched toko''' kernel module</p><ol {| class="wikitable" style="listwidth:800px;" |-style-type| <p>orangepi@orangepi:/usr/src/hello$ '''sudo rmmod hello'''</p><p>orangepi@orangepi: lower-alpha/usr/src/hello$ '''dmesg | grep "Hello""'''</p><lip>v2018[ 2871.05893988] Hello Orange Pi -- init</lip><p>[ 3173.800892] '''Hello Orange Pi -- exit'''</olp>|}
</li></ol>
<ol start="2" style="list-style-type: decimal;"><li><p>When orangepi-build Debian Bullseye is run for the first time, it will download installed with the cross-gcc compilation tool chainby default, u-boot and linux kernel source code. After successfully compiling a linux image, the files and folders that which can be seen directly compile C language programs in orangepi-build are:the Linux system of the development board.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>'''buildThe version of a.sh''': Compile startup scriptgcc is as follows</p></li><li><p>'''external'''{| class="wikitable" style="width: Contains the configuration files needed to compile the image, scripts for specific functions, and the source code of some programs. The rootfs compressed package cached during the image compilation process is also stored in external.</p></li>800px;" |-| <li><p>orangepi@orangepi:~$ '''kernelgcc --version''': Store the source code of the linux kernel</p></li><li><p>'''LICENSE''': GPL gcc (Debian 10.2.1-6) 10.2 license file.1 20210110</p></li><li><p>'''READMECopyright (C) 2020 Free Software Foundation, Inc.md''': orangepi-build documentation</p></li><li><p>'''output''': Store compiled u-boot, linux and other deb packages, compilation logs, and compiled images and other filesThis is free software; see the source for copying conditions. There is NO</p></li><li><p>'''scripts''': Common script warranty; not even for compiling linux imagesMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>|}</li><li><p>Write the '''toolchainshello_world.c''': Store cross-compilation tool chainprogram in C language</p></li><li><p>'''u-boot'''{| class="wikitable" style="width: Store the source code of u800px;" |-boot</p></li><li>| <p>orangepi@orangepi:~$ '''userpatchesvim hello_world.c''': Store the configuration files needed to compile the script</p></li></ol></lip>#include <stdio.h></olp>
</li>
<li><p>If you select the next branch, you will also be prompted to select the memory size, Then compile and you do not need to select the current branchrun '''hello_world.c'''</p></li></ol> <blockquote>a. If the development board you purchased has a memory size of 1.5GB, please select the first option. b. If the development board you purchased has 1GB or 2GB or 4GB memory size, please choose the second option.</blockquote>[[File:zero2w-img277.png]] <ol start{| class="6wikitable" style="list-style-typewidth: decimal800px;"><li>|-| <p>Then it will start to compile uorangepi@orangepi:~$ '''gcc -booto hello_world hello_world. Some of the information prompted when compiling the next branch is as follows:c'''</p><ol style="list-style-typep>orangepi@orangepi: lower-alpha;"~$ '''./hello_world'''</p><lip>Version of u-boot source codeHello World!</li></olp>|}
</li></ol>
<ol style="list-style-type: lower-alpha;">
<li>First upload the compiled deb package <p>The specific version of uPython is as follows</p>{| class="wikitable" style="width:800px;" |-boot to the Linux system of the development board| <p>orangepi@orangepi:~$ '''python3'''</p><p>'''Python 3.9.2''' (default, Feb 28 2021, 17:03:44)</lip><p>[GCC 10.2.1 20210110] on linux</olp><p>Type "help", "copyright", "credits" or "license" for more information.</lip><p>>>></olp>|}test@test{| class="wikitable" style="background-color:#ffffdc;width:~/orangepi800px;" |-build$ | <big><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''cd output</p></debsbig>|}</u-bootli><li><p>Write the '''hello_world.py'''program in Python language</p>{| class="wikitable" style="width:800px;" |-| test<p>orangepi@testorangepi:~/orangepi_build/output/debs/u-boot$ '''scp \vim hello_world.py'''</p><p>print('Hello World!')</p>|}</li><li><p>The result of running '''linux-u-boot-next-orangepizero2w_xhello_world.x.x_arm64.deb [mailtopy''' is as follows</p>{| class="wikitable" style="width:root800px;" |-| <p>orangepi@192.168.1.xxxorangepi:/root root@192~$ '''python3 hello_world.168.1.xxx:/root]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="2" style="list-style-type: lower-alpha;"><li>Install <p>You can use the new ufollowing command to install openjdk. The latest version in Debian Bullseye is openjdk-17</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-boot deb package just uploadedjdk'''</p>|}</li><li><p>After installation, you can check the Java version.</olp>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo dpkg java --iversion''' </p>|}</li><li><p>Write the Java version of '''hello_world.java'''linux</p>{| class="wikitable" style="width:800px;" |-u-boot-next-orangepizero2w_x| <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.xout.x_arm64println("Hello World!");</p>:<p>}</p><p>}</p>|}</li><li><p>Then compile and run '''hello_world.debjava'''</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 startspan id="3" style="list-styledebian-type: lowerbookworm-alpha;system"><li>Then run the nand-sata-install script</li></olspan>
<ol startstyle="4list-style-type: decimal;" ><li><p>Debian Bookworm is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.</p><ol style="list-style-type: lower-alpha;"><li>Then select <p>The version of a.gcc is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''5 Installgcc --version'''</Update p><p>gcc (Debian 12.2.0-14) 12.2.0</p><p>Copyright (C) 2022 Free Software Foundation, Inc.</p><p>This is free software; see the bootloader on SDsource for copying conditions. There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</eMMCp>|}</li><li><p>Write the '''hello_world.c'''program in C language</lip>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.c'''</olp> [[File:zero2w-img278<p>#include <stdio.png]]h></p>
<ol style="list-style-type: decimal;">
<li><p>Ubuntu Focal is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.</p>
<ol style="list-style-type: lower-alpha;">
<li>If you do <p>The version of a.gcc is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''gcc --version'''</p><p>gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0</p><p>Copyright (C) 2019 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not need to modify even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>|}</li><li><p>Write the kernel configuration options, when running the build'''hello_world.sh script, pass c'''KERNEL_CONFIGUREprogram in C language</p>{| class=no"wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ ''' to temporarily block the pop-up of the kernel configuration interfacevim hello_world.c'''</lip><p>#include <stdio.h></olp>
:<p>return 0;<ol start/p><p>}</p>|}</li><li><p>Then compile and run '''hello_world.c'''</p>{| class="7wikitable" style="listwidth:800px;" |-style| <p>orangepi@orangepi:~$ '''gcc -typeo hello_world hello_world.c'''</p><p>orangepi@orangepi: decimal;"~$ '''./hello_world'''</p><p>Hello World!</p>|}</li></ol></li><li><p>Part of the information prompted when compiling the next branch kernel source code is explained as follows:Ubuntu Focal has Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li>Version <p>The specific version of the linux kernel source codePython3 is as follows</lip>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3'''</olp></lip>Python 3.8.10 (default, Nov 14 2022, 12:59:47)</olp> <p>[ oGCC 9.k4. 0] Compiling current kernel [ on linux</p><p>Type "help", "copyright", "credits" or "license" for more information.</p><p>>>></p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p></big>|}</li><li><p>Write the '''6hello_world.1py''' program in Python language</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.31py''' ]</p><p>print('Hello World!')</p>|}<ol start/li><li><p>The result of running '''hello_world.py''' is as follows</p>{| class="2wikitable" 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>The version of <p>You can use the crossfollowing command to install openjdk-17</p>{| class="wikitable" style="width:800px;" |-compilation tool chain used| <p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''</p>|}</li><li><p>After installation, you can check the Java version.</olp>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''java --version'''</p><p>openjdk 17.0.2 2022-01-18</p>[ o<p>OpenJDK Runtime Environment (build 17.0.2+8-Ubuntu-120.04)</p><p>OpenJDK 64-Bit Server VM (build 17.0.k2+8-Ubuntu-120. ] Compiler 04, mixed mode, sharing)</p>|}</li><li><p>Write the Java version [ of '''hello_world.java'''aarch64</p>{| class="wikitable" style="width:800px;" |-linux-gnu-gcc 11| <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>|}<ol start/li><li><p>Then compile and run '''hello_world.java'''</p>{| class="3wikitable" 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>The default configuration file used by the kernel and the path where it is stored are as follows</ol></li></ol>
<ol style="list-style-type: lower-alpha;">
<li><p>The specific version of Python3 is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''linux-dtb-next-sun50iw9_x.x.x_arm64.debpython3''' Contains dtb files used by the kernel</p><p>Python 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0] on linux</lip><lip>Type "help", "copyright", "credits" or "license" for more information.</p>'''linux-headers-next-sun50iw9_x.x.x_arm64.deb''' Contains kernel header files</p>>>></lip>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <libig><p>'''linux-image-next-sun50iw9_x.xUse the Ctrl+D shortcut key to exit python's interactive mode.x_arm64.deb''' Contains kernel images and kernel modules</p></libig>|}</olli></li></olp> test@test:~/orangepi-build$ Write the '''ls output/debs/linux-*hello_world.py''' outputprogram in Python language</debs/linux-dtb-next-sun50iw9_x.x.x_arm64.deb output/debs/linux-headers-next-sun50iw9_x.x.x_arm64.debp> output/debs/linux-image-next-sun50iw9_x.x.x_arm64.deb <ol start{| class="9wikitable" style="list-style-typewidth: decimal800px;">|-| <lip>When the orangepi-bulid compilation system compiles the linux kernel source code, it will first synchronize the linux kernel source code with the linux kernel source code of the github server@orangepi:~$ '''vim hello_world. Therefore, if you want to modify the linux kernel source code, you first need to turn off the update function of the source code (py'''it needs to be completely compiled once This function can only be turned off after obtaining the Linux kernel source code, otherwise it will prompt that the source code of the Linux kernel cannot be found'</p><p>print('Hello World!'), otherwise the modifications will be restored. The method is as follows:</lip>|}</olli> <blockquoteli><p>Set the IGNORE_UPDATES variable in The result of running '''userpatches/config-defaulthello_world.confpy''' to "yes"is as follows</p>{| class="wikitable" style="width:800px;" |-| </blockquotep>testorangepi@testorangepi:~/orangepi-build$ '''vim userpatches/config-defaultpython3 hello_world.confpy'''</p><p>Hello World!</p>IGNORE_UPDATES="'''yes'''"|}</li></ol><ol start="10" style="list-style-type: decimal;"/li><li><p>If the kernel is modified, you can use the following method to update the kernel Ubuntu Jammy does not install Java compilation tools and kernel module of the development board Linux systemoperating environment by default.</p>
<ol style="list-style-type: lower-alpha;">
<li>Upload the compiled deb package of <p>You can use the Linux kernel following command to the Linux system of the development boardinstall openjdk-18</lip>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-18-jdk'''</olp>|}</li><li><p>After installation, you can check the Java version.</olp>{| class="wikitable" style="width:800px;" test@test:~/orangepi|-build$ '''cd output/debs'''| test<p>orangepi@testorangepi:~/orangepi-build/output/debs$ '''scp \java --version'''</p> '''linux<p>openjdk 18.0.2-imageea 2022-next07-sun50iw9_x19</p><p>OpenJDK Runtime Environment (build 18.x0.x_arm642-ea+9-Ubuntu-222.deb root@19204)</p><p>OpenJDK 64-Bit Server VM (build 18.1680.12-ea+9-Ubuntu-222.xxx:04, mixed mode, sharing)</p>|}</rootli><li><p>Write the Java version of '''hello_world.java'''</p> <ol start{| class="2wikitable" style="list-style-typewidth: lower-alpha800px;"|-| <p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><lip>public class hello_world</p><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>::<p>Install the deb package of the new linux kernel just uploadedSystem.out.println("Hello World!");</p>:<p>}</lip><p>}</olp>|}</li>orangepi@orangepi:~$ <li><p>Then compile and run '''sudo dpkg -i linux-image-next-sun50iw9_xhello_world.x.x_arm64.debjava'''</p> <ol start{| class="3wikitable" style="list-style-typewidth: lower-alpha800px;"><li>Then restart the development board and check whether the kernel|-related modifications have taken effect.| </li></olp> orangepi@orangepi:~$ '''sudojavac hello_world.java''' </p><p>orangepi@orangepi:~$ '''rebootjava hello_world'''</p><p>Hello World!</p>|}</li></ol></li></ol>
<span id="compilemethod-rootfsof-uploading-files-to-the-development-board-linux-system"></span>== Compile rootfs ==
<ol startspan id="2" style="listhow-to-upload-files-using-stylescp-type: decimal;command"><li>Select '''Rootfs and all deb packages''' and press Enter</li></olspan>==== How to upload files using scp command ====
<ol style="list-style-type: lower-alpha;">
<li><p>In '''file_path: '''Needs to be replaced with the current branch, you can see three optionspath of the file to be uploaded</p></li><li><p>'''orangepi: debian11, ubuntu20'''This is the user name of the development board's Linux system.04It can also be replaced with something else, and ubuntu22.04such as root.</p></li><li><p>In '''192.168.xx.xx:''' This is the IP address of the next branch, you can see three options: debian11, debian12, and ubuntu22development board.04Please 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.</olp>{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''scp file_path orangepi@192.168.xx.xx:/home/orangepi/'''</p>|}
</li></ol>
</li>
<li><p>If you want to upload a folder, you need to add the -r parameter</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''scp <span style="color:#FF0000">-r</span> dir_path orangepi@192.168.xx.xx:/home/orangepi/'''</p>
|}
</li>
<li><p>There are more usages of scp, please use the following command to view the man manual</p></li>
{| class="wikitable" style="width:800px;"
|-
|
test@test:~$ '''man scp'''
|}
</ol>
<span id="how-to-upload-files-using-filezilla"></span>
==== How to upload files using filezilla ====
<ol style="list-style-type: decimal;">
<li><p>First install filezilla in Ubuntu PC</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''sudo apt install -y filezilla'''</p>
|}
</li>
<li><p>Then use the following command to open filezilla</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''filezilla'''</p>
|}
</li>
<li><p>The interface after opening filezilla is as shown below. At this time, the remote site on the right is empty.</p>
<div class="figure">
[[File:zero2w-img255.png]]
</div></li>
<li><p>The method of connecting the development board is as shown in the figure below</p></li>
<div class="figure">
[[File:zero2w-img276.png]] <ol start="5" style="list-style-type: decimal;"><li>Then select the type of rootfs</li></ol> [[File:zero2w-img286img256.png]]
</div></ol><ol start="65" style="list-style-type: decimal;"><li><p>Then select choose to '''save the type of imagepassword''' and click '''OK'''</p><ol style="list-style-typep>[[File: lowerzero2w-alpha;"><li><p>'''Image with console interface (server)''' Represents the image of the server version, which is relatively small in sizeimg257.png]]</p></li><li><p>Then select '''Always trust this host'''Image with desktop environmentand click '''OK''' Represents an image with a desktop, which is relatively large in size.</p></li></ol></li></ol>
<div class="figure">
[[File:zero2w-img287img258.png]]
</div></ol>
<ol start="7" style="list-style-type: decimal;">
<li>If you are compiling After the server version of the imageconnection is successful, you can also choose to compile see the Standard version or directory structure of the Minimal version. The Minimal version will have much less pre-installed software than development board's Linux file system on the Standard version ('''please do not choose right side of the Minimal version without special needs, because many things are not pre-installed by defaultfilezilla software. Some functions may not be available''')</li></ol>
<div class="figure">
[[File:zero2w-img288img259.png]]
</div></ol>
<ol start="8" style="list-style-type: decimal;">
<li>If you are compiling a desktop version Then select the path to be uploaded to the development board on the right side of the imagefilezilla software, you also need select the file to select be uploaded in Ubuntu PC on the type left side of desktop environment. Currentlythe filezilla software, only XFCE is maintainedright-click the mouse, so please select an XFCE type desktopand then click the upload option to start uploading the file to the development board.</li></ol>
[[File:zero2w-img290img260.png]]
::{| class="wikitable" style="width:800px;" |-| [ ohttps://filezilla-project.korg/download. ] Target directory [ php?type=client '''orangepi-buildhttps:/external/cachefilezilla-project.org/rootfsdownload.php?type=client''' ]|}
<blockquote/div><ol start="2" style="list-style-type: decimal;"><li><p>The downloaded installation package is as shown below, then double-click to install it directly</p>{| class="wikitable" style="width:800px;" |-| <p>a) '''bullseyeFileZilla_Server_1.5.1_win64-setup.exe''' represents </p>|}During the type of Linux distribution of rootfsinstallation process, please select '''Decline''' on the following installation interface, and then select '''Next>'''
<span id/div></ol><ol start="5" style="compilelist-linuxstyle-imagetype: decimal;"><li>Then choose to '''save the password''' and click '''OK'''</spanli>== Compile linux image ==
</div></ol><ol start="26" style="list-style-type: decimal;"><li>Select Then select '''Full OS image for flashingAlways trust this host''' and press Enterclick '''OK'''</li></ol>
<div class="figure">
[[File:zero2w-img292.png]] </div><ol start="3" style="list-style-type: decimal;"><li>Then select the model of the development board</li></ol> [[File:zero2w-img275.png]] <ol start="4" style="list-style-type: decimal;"><li><p>Then select the branch type of the kernel source code. Different versions of the kernel source code maintain different rootfs types.</p><ol style="list-style-type: lower-alpha;"><li><p>In the current branch, you can see three options: debian11, ubuntu20.04, and ubuntu22.04.</p></li><li><p>In the next branch, you can see three options: debian11, debian12, and ubuntu22.04.</p></li></ol></li></ol> [[File:zero2w-img276.png]] <ol start="5" style="list-style-type: decimal;"><li><p>If you select the next branch, you will also be prompted to select the memory size, and you do not need to select the current branch.</p><ol style="list-style-type: lower-alpha;"><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-img286img266.png]]
</div></ol>
<ol start="7" style="list-style-type: decimal;">
<li><p>Then select After the connection is successful, you can see the type directory structure of image</p><ol style="list-style-type: lower-alpha;"><li><p>'''Image with console interface (server)'the development board'' Represents s Linux file system on the image right side 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 sizefilezilla software.</p></li></ol></li></ol>
<div class="figure">
[[File:zero2w-img287img267.png]]
</div></ol>
<ol start="8" style="list-style-type: decimal;">
<li>If you are compiling Then select the server version path to be uploaded to the development board on the right side of the imagefilezilla software, you can also choose select the file to compile be uploaded on the Windows PC on the Standard version or left side of the Minimal version. The Minimal version will have much less prefilezilla software, right-installed software than click the mouse, and then click the upload option to start uploading the Standard version ('''please do not choose file to the Minimal version without special needs, because many things are not pre-installed by defaultdevelopment board. Some functions may not be available''')</li></ol>
<div class="figure">
[[File:zero2w-img288img268.png]]
</div></ol>
<ol start="9" style="list-style-type: decimal;">
<li>If you are compiling a desktop version of <p>After the imageupload is completed, you also need can go to the corresponding path in the development board Linux system to select view the type uploaded file.</p></li><li><p>The method of desktop environment. Currently, only XFCE uploading a folder is maintainedthe same as the method of uploading a file, so please select an XFCE type desktopI won't go into details here.</p></li></ol>
The Linux SDK, '''orangepi-build''', only supports running on X64 computers with '''<ol start="2" span style="list-style-typecolor: lower-alpha;#FF0000">Ubuntu 22.04<li/span>Compilation time''' 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 '''</lispan style="color:#FF0000">22.04</olspan>''', it means that the Ubuntu version currently used does not meet the requirements. Please change the system before performing the following operations. {| class="wikitable" style="width:800px;" |-| test@test:~$ '''lsb_release -a'''
Release: '''<span idstyle="instructions-for-using-the-orange-pi-os-arch-systemcolor:#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/''']| '''OK'''}</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 '''HDMI Audio/etc/apt/sources.list'''file that need to be replaced are:</li>{| '''OK'''class="wikitable" style="width:800px;"
|-
| test@test:~$ '''sudo mv /etc/apt/sources.list cat /etc/apt/sources.list.bak'''Type test@test:~$ '''sudo vim /etc/apt/sources.list''' '''#''' The source code image is commented by default to improve apt update speed. You can uncomment it yourself if necessary. deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse '''#''' deb-C USB2src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse deb https://mirrors.tuna.0 x 2tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse '''#'''deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse '''#''' deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse '''#''' deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse '''#''' Pre-release software source, not recommended to be enabled '''#''' deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse | '''OK#'''deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse|}</ol><ol start="4" style="list-style-type: lower-alpha;"><li>After the replacement, you need to update the package information and ensure that no errors are reported.</li>{| class="wikitable" style="width:800px;"
|-
| test@test:~$ '''TF Card Startupsudo 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:~$ '''WIFIsudo apt-get update'''| test@test:~$ '''OKsudo apt-get install -y git'''|-| test@test:~$ '''Bluetoothgit clone https://github.com/orangepi-xunlong/orangepi-build.git -b next'''| '''OK'''}{| 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>|} The u-boot and linux kernel versions currently used by the H618 series development boards are as follows: {| '''OK'''class="wikitable" style="width:800px;text-align: center;"
|-
| '''40pin I2Cbranch'''| '''OKu-boot Version'''| '''linux Kernel version'''
|-
| '''40pin SPIcurrent'''| '''OKu-boot v2018.05'''| '''linux5.4'''
|-
| '''40pin UARTnext'''| '''OKu-boot v2021.07'''| '''linux6.1'''|} {| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| '''40pin PWM'''| '''OK'''|-| '''Temperature Sensor'''| '''OK'''|-| '''Hardware watchdog'''| <big>'''OK'''|The branch mentioned here is not the same thing as the branch of orangepi-| '''Mali GPU'''| ''build source code, please don'NOt get confused. This branch is mainly used to distinguish different kernel source code versions.'''|-| '''Video codec'''| '''NOWe 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.'''</big>
|}
|-
| test@test:~/orangepi-build$ '''100M Ethernet port lightls'''| '''OKbuild.sh external LICENSE README.md scripts'''|}{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| '''USB2.0 HOST x 2'''| <big>'''OK'''|If you downloaded the orangepi-build code from github, after downloading, you may find that orangepi-build does not contain the source code of u-boot and linux kernel, and there is no cross-| '''Infrared reception'''| '''OK'''|compilation tool required to compile u-| '''Headphone audio playback'''| '''OK'''|boot and linux kernel. chain, this is normal, because these things are stored in other separate github repositories or some servers (their addresses will be detailed below). Orangepi-| '''On/off button'''| '''OK'''|build will specify the addresses of u-| '''LRADC''' '''Custom buttons x 2'''| '''OK'''|boot, Linux kernel and cross-| '''TVcompilation tool chain in the script and configuration file. When running orangepi-OUT'''| '''NObuild, when it finds that these things are not available locally, it will automatically download them from the corresponding places.'''</big>
|}
<span id="orangedownload-pithe-oscross-archcompilation-systemtool-user-guide-instructionschain"></span>== Orange Pi OS Arch System User Guide Instructions ==
When the OPi OS Arch system orangepi-build is started run for the first time, you need to connect an HDMI display it will automatically download the cross-compilation '''toolchain''' and then initialize put it in the system settings through '''toolchains''' folder. Every time you run orangepi-build's build.sh script, it will check whether the user wizard (including creating a new user name and setting a password)cross-compilation toolchain in toolchains exists. The setup steps of If If it does not exist, the user wizard are as follows:download will be restarted. If it exists, it will be used directly without repeated downloading.
<div class="figure">
[[File:zero2w-img293img273.png]] </div>The mirror URL of the cross-compilation tool chain in China is the open source software mirror site of Tsinghua University:
</divol style="list-style-type: lower-alpha;"></li>linux5.4</li><p>The Orange Pi Hello program will automatically start after restarting. At this time, you need to remove the check {| class="wikitable" style="width:800px;" |-| '''mark of Start on startupgcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu''' in the |}</ol><ol start="2" style="list-style-type: lower right corner, otherwise you need to manually close the Orange Pi Hello program every time you start it-alpha;"><li>linux6.1</pli><div {| class="figurewikitable" style="width:800px;"|-| '''gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu'''|}</ol>The cross-compilation tool chain used to compile the H618 u-boot source code is:
|-
| https://github.com/orangepi-xunlong/linux-orangepi/tree/'''Functions on the development boardorange-pi-5.4-sun50iw9'''| '''Corresponding DT overlays configuration'''}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>b) Linux6.1</li>{| class="wikitable" style="width:800px;"
|-
| https://github.com/orangepi-xunlong/linux-orangepi/tree/'''40pin orange-pi-6.1- i2c0sun50iw9'''| '''sun50i}</ol></li></ol><ol start="2" style="list-style-type: lower-alpha;"><li><p>The git warehouse where the u-boot source code is stored is as follows. Please note that the branch of the u-boot-orangepi warehouse is switched to</p><ol style="list-h616style-pitype: lower-i2c0alpha;"><li>a) v2018.dtbo'''05</li>{| class="wikitable" style="width:800px;"
|-
| https://github.com/orangepi-xunlong/u-boot-orangepi/tree/'''40pin v2018.05- i2c1h618'''| '''sun50i}</ol><ol start="2" style="list-h616style-pitype: lower-i2c1alpha;"><li>b) v2021.dtbo'''07</li>{| class="wikitable" style="width:800px;"
|-
| https://github.com/orangepi-xunlong/u-boot-orangepi/tree/'''40pin v2021.07- i2c2sunxi'''| }</ol></li></ol></li></ol><ol start="2" style="list-style-type: decimal;"><li><p>When orangepi-build is run for the first time, it will download the cross-compilation tool chain, u-boot and linux kernel source code. After successfully compiling a linux image, the files and folders that can be seen in orangepi-build are:</p><ol style="list-style-type: lower-alpha;"><li><p>'''build.sh''': Compile startup script</p></li><li><p>'''external''': Contains the configuration files needed to compile the image, scripts for specific functions, and the source code of some programs. The rootfs compressed package cached during the image compilation process is also stored in external.</p></li><li><p>'''kernel''': Store the source code of the linux kernel</p></li><li><p>'''sun50iLICENSE''': GPL 2 license file</p></li><li><p>'''README.md''': orangepi-h616build documentation</p></li><li><p>'''output''': Store compiled u-piboot, linux and other deb packages, compilation logs, and compiled images and other files</p></li><li><p>'''scripts''': Common script for compiling linux images</p></li><li><p>'''toolchains''': Store cross-compilation tool chain</p></li><li><p>'''u-i2c2.dtboboot''': Store the source code of u-boot</p></li><li><p>'''userpatches''': Store the configuration files needed to compile the script</p></li>{| class="wikitable" style="width:800px;"
|-
| test@test:~/orangepi-build$ '''40pin - uart2ls'''| '''sun50ibuild.sh external kernel LICENSE output README.md scripts toolchains u-h616boot userpatches'''|}</ol></li></ol> <span id="compile-piu-uart2boot"></span> == Compile u-boot == # Run the build.dtbo'''sh script, remember to add sudo permissions {| class="wikitable" style="width:800px;"
|-
| '''40pin test@test:~/orangepi- uart3build$ '''| '''sun50i-h616-pi-uart3sudo ./build.dtbosh'''|} <ol start="2" style="list-style-type: decimal;">| <li>Select '''40pin U- uart4boot package'''and press Enter</li>| '''sun50i<div class="figure"> [[File:zero2w-img274.png]] </div></ol><ol start="3" style="list-h616style-pitype: decimal;"><li>Then select the model of the development board</li> [[File:zero2w-uart4img275.dtbo'''png]]</ol>|<ol start="4" style="list-style-type: decimal;">| '''40pin <li><p>Then select the branch type of u- uart5'''boot</p>| '''sun50i<ol style="list-style-h616type: lower-phalpha;"><li><p>The current branch will compile the u-uart5boot v2018.05 version code that needs to be used by the linux5.dtbo'''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>| '''40pin <p>[[File:zero2w- pwm1'''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>| '''sun50i<ol style="list-style-h616type: lower-pialpha;"><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-pwm1img277.dtbo'''png]]</p></li></ol></li></ol>|<ol start="6" style="list-style-type: decimal;">| '''40pin <li><p>Then it will start to compile u- pwm2'''boot. Some of the information prompted when compiling the next branch is as follows:</p>| '''sun50i<ol style="list-style-h616type: lower-pialpha;"><li>Version of u-pwm2.dtbo'''boot source code</li>{| class="wikitable" style="width:800px;"
|-
| [ o.k. ] Compiling u-boot [ '''40pin - pwm3v2021.07''']| '''sun50i}</ol><ol start="2" style="list-style-h616type: lower-pialpha;"><li>Version of the cross-pwm3.dtbo'''compilation tool chain</li>{| class="wikitable" style="width:800px;"
|-
| [ o.k. ] Compiler version [ '''40pin aarch64- pwm4linux-gnu-gcc 11''']| '''sun50i}</ol><ol start="3" style="list-style-h616type: lower-pialpha;"><li>Path to the compiled u-pwm4.dtbo'''boot deb package</li>{| class="wikitable" style="width:800px;"
|-
| [ o.k. ] Target directory [ '''40pin orangepi-build/output/debs/u- spi1 cs0boot''']| '''sun50i}</ol><ol start="4" style="list-h616style-spi1type: lower-cs0alpha;"><li>The package name of the compiled u-spidev.dtbo'''boot deb package</li>{| class="wikitable" style="width:800px;"
|-
| [ o.k. ] File name [ '''40pin linux-u- spi1 cs1boot-next-orangepizero2w_x.x.x_arm64.deb''']| '''sun50i}</ol><ol start="5" style="list-h616style-spi1type: lower-cs1-spidev.dtbo'''alpha;"><li>Compilation time</li>{| class="wikitable" style="width:800px;"
|-
| [ o.k. ] Runtime [ '''40pin - spi1 cs0 cs11 min''']| '''sun50i}</ol><ol start="6" style="list-h616style-spi1type: lower-cs0alpha;"><li>Repeat the command to compile u-cs1boot. Use the following command without selecting through the graphical interface. You can start compiling u-spidevboot directly.dtbo'''</li>{| class="wikitable" style="width:800px;"
|-
| [ o.k. ] Repeat Build Options [ '''设Set USB0 to Host modesudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=u-boot''']| '''sun50i}</ol></li></ol><ol start="7" style="list-h616style-usb0type: decimal;"><li>View the compiled u-host.dtbo'''boot deb package</li>{| class="wikitable" style="width:800px;"
|-
| '''Turn off the green LED light'''| test@test:~/orangepi-build$ '''sun50ils output/debs/u-h616-zero2w-disable-led.dtboboot/'''|-| '''How to close the UART0 debugging serial port'''| '''sun50ilinux-u-h616boot-disablenext-uart0orangepizero2w_x.x.x_arm64.dtbodeb'''
|}
</ol>
<ol start="8" style="list-style-type: decimal;">
<li>When the orangepi-bulid compilation system compiles the u-boot source code, it will first synchronize the u-boot source code with the u-boot source code of the github server. Therefore, if you want to modify the u-boot source code, you first need to turn off the download and update function of the source code. ('''You need to completely compile u-boot before you can turn off this function, otherwise it will prompt that the source code of u-boot cannot be found'''), otherwise the modifications will be restored. The method is as follows:</li>
'''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb [mailto:root@192.168.1.xxx:/root root@192.168.1.xxx:/root]'''|}</ol><ol start="62" style="list-style-type: decimallower-alpha;"><li>After setting, you need to restart Install the system for new u-boot deb package just uploaded</li>{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''sudo dpkg -i''' '''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb'''|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>Then run the configuration to take effect.nand-sata-install script</li>{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''sudo nand-sata-install'''|}</ol><ol start="4" style="list-style-type: lower-alpha;"><li>Then select '''5 Install/Update the bootloader on SD/eMMC'''</li>
[orangepi@orangepi[File:zero2w-pc ~img278.png]$ '''sudo reboot''']</ol><ol start="5" style="list-style-type: lower-alpha;"><li>After pressing the Enter key, a Warning will pop up first.</li>
[[File:zero2w-img279.png]]</ol><ol start="6" style="list-style-type: lower-alpha;"><li>Press the Enter key again to start updating u-boot. After the update is completed, the following information will be displayed.</li> [[File:zero2w-img280.png]]</ol><ol start="7" style="list-style-type: lower-alpha;"><li>Then you can restart the development board to test whether the u-boot modification has taken effect.</li></ol></li></ol><span id="howcompile-tothe-installlinux-softwarekernel"></span> ==Compile the linux kernel = How = # Run the '''build.sh''' script, remember to install software add sudo permissions ::{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''sudo ./build.sh'''|} <ol start="2" style="list-style-type: decimal;"><li>Select '''Kernel package''' and press Enter</li> <div class="figure"> [[File:zero2w-img281.png]]
[orangepi@orangepi[File:zero2w-pc ~img282.png]$ '''sudo pacman ]</ol><ol start="4" style="list-style-Syy vim'''type: decimal;"><li>Then select the model of the development board</li>
[[File:zero2w-img275.png]]</ol><span idol start="5" style="android-12-tv-systemlist-usagestyle-instructionstype: decimal;"><li>Then select the branch type of the kernel source code</spanli>
<ol style="list-style-type: lower-alpha;"><li>If you do not need to modify the kernel configuration options, when running the build.sh script, pass '''KERNEL_CONFIGURE=no''' to temporarily block the pop-up of the kernel configuration interface.</li>{| class="wikitable" style="width:800px;"
|-
| test@test:~/orangepi-build$ '''Motherboard functionssudo ./build.sh KERNEL_CONFIGURE=no'''| }</ol><ol start="2" style="list-style-type: lower-alpha;"><li><p>b. You can also set '''Android12 TVKERNEL_CONFIGURE=no'''in the orangepi-build/userpatches/config-default.confconfiguration file to permanently disable this function.</p></li><li><p>If the following error is prompted when compiling the kernel, it is because the Ubuntu PC terminal interface is too small, causing the make menuconfig interface to be unable to be displayed. Please increase the Ubuntu PC terminal to the maximum size, and then rerun the build.sh script.</p></li> [[File:zero2w-img284.png]]</ol></ol><ol start="7" style="list-style-type: decimal;"><li><p>Part of the information prompted when compiling the next branch kernel source code is explained as follows:</p><ol style="list-style-type: lower-alpha;"><li>Version of the linux kernel source code</li>{| class="wikitable" style="width:800px;"
|-
| [ o.k. ] Compiling current kernel [ '''HDMI video6.1.31''']|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>The version of the cross-compilation tool chain used</li>{| '''OK'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] Compiler version [ '''HDMI Audioaarch64-linux-gnu-gcc 11''']|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>The default configuration file used by the kernel and the path where it is stored are as follows</li>{| '''OK'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] Using kernel config file [ '''Typeorangepi-build/external/config/kernel/linux-C USB26.0 x 21-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>{| '''OK'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] Target directory [ '''TF card startupoutput/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>{| '''OK'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] File name [ '''WIFIlinux-image-next-sun50iw9_x.x.x_arm64.deb''']|}</ol><ol start="6" style="list-style-type: lower-alpha;"><li>Compilation time</li>{| '''OK'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] Runtime [ '''Bluetooth10 min''']|}</ol><ol start="7" style="list-style-type: lower-alpha;"><li>Finally, the compilation command to repeatedly compile the last selected kernel will be displayed. Use the following command without selecting through the graphical interface, and you can directly start compiling the kernel source code.</li>{| '''OK'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] Repeat Build Options [ '''USB Camerasudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=kernel KERNEL_CONFIGURE=no''']| }</ol></li></ol><ol start="8" style="list-style-type: decimal;"><li><p>View the kernel-related deb package generated by compilation</p><ol style="list-style-type: lower-alpha;"><li><p>'''linux-dtb-next-sun50iw9_x.x.x_arm64.deb'''OKContains 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$ '''LED Lightls output/debs/linux-*''' output/debs/linux-dtb-next-sun50iw9_x.x.x_arm64.deb output/debs/linux-headers-next-sun50iw9_x.x.x_arm64.deb output/debs/linux-image-next-sun50iw9_x.x.x_arm64.deb| }</ol></li></ol><ol start="9" style="list-style-type: decimal;"><li>When the orangepi-bulid compilation system compiles the linux kernel source code, it will first synchronize the linux kernel source code with the linux kernel source code of the github server. Therefore, if you want to modify the linux kernel source code, you first need to turn off the update function of the source code ('''it needs to be completely compiled once This function can only be turned off after obtaining the Linux kernel source code, otherwise it will prompt that the source code of the Linux kernel cannot be found'''OK), otherwise the modifications will be restored. The method is as follows:</li> Set the IGNORE_UPDATES variable in '''userpatches/config-default.conf''' to "yes" {| class="wikitable" style="width:800px;"
|-
| test@test:~/orangepi-build$ '''40pin GPIOvim userpatches/config-default.conf'''| IGNORE_UPDATES="'''OK<span style="color:#FF0000">yes</span>'''"|}</ol><ol start="10" style="list-style-type: decimal;"><li><p>If the kernel is modified, you can use the following method to update the kernel and kernel module of the development board Linux system</p><ol style="list-style-type: lower-alpha;"><li>Upload the compiled deb package of the Linux kernel to the Linux system of the development board</li>{| class="wikitable" style="width:800px;"
|-
| test@test:~/orangepi-build$ '''cd output/debs''' test@test:~/orangepi-build/output/debs$ '''40pin I2Cscp \'''| '''OKlinux-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:~$ '''40pin SPI1sudo dpkg -i linux-image-next-sun50iw9_x.x.x_arm64.deb'''| '''OK'''}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>Then restart the development board and check whether the kernel-related modifications have taken effect.</li>{| class="wikitable" style="width:800px;"
|-
| '''40pin UART'''| '''OK'''|-| '''40pin PWM'''| '''OK'''|-| orangepi@orangepi:~$ '''Temperature Sensorsudo'''| '''OK'''|-| '''Hardware watchdog'''| '''OK'''|-| '''Mali GPU'''| '''OK'''|-| '''Video codec'''| '''OKreboot'''
|}
</ol>
</li></ol>
<span id="compile-rootfs"></span>
::{| 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 '''Rootfs and all deb packages''' and press Enter</spanli>== How to return to the previous interface in Android ==
[[File:zero2w-img275.png]]</ol><span idol start="4" style="howlist-style-totype: 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-usestyle-adbtype: lower-alpha;"><li><p>In the current branch, you can see three options: debian11, ubuntu20.04, and ubuntu22.04.</p></spanli>== How to use ADB ==<li><p>In the next branch, you can see three options: debian11, debian12, and ubuntu22.04.</p></li>
[[File:zero2w-img276.png]]</ol></li><span id/ol><ol start="5" style="use-networklist-connectionstyle-adb-debuggingtype: decimal;"><li>Then select the type of rootfs</spanli>=== Use network connection adb debugging ===
[[File:zero2w-img286.png]]</ol><ol start="6" style="list-style-type: decimal;"><li><p>Then select the type of image</p><ol style="list-style-type: lower-alpha;"><li><p>'''Using network adb does not require a USB Typc C Image with console interface data cable to connect (server)''' Represents the computer and the development board. Instead, it communicates through image of the networkserver version, so first make sure that the development board's wired or wireless network which is connected, and then obtain the IP address of the development board. Next To be usedrelatively 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="2figure" style="list-style-type: decimal;"><li>If '''service.adb.tcp.port''' is not set, you can use the following command in the serial port to set the port number of the network adb</li></ol>
[[File:zero2w-img291.png]]</ol><ol start="49" style="list-style-type: decimal;"><li><p>Then connect network adb on Ubuntu PCthe 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</olli>{| class="wikitable" style="width:800px;" |-| test@test:~$ [ o.k. ] local not found [ Creating new rootfs cache for '''bullseye'''adb connect 192]|}</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.168k.1.xxx:5555] Target directory [ ''' orangepi-build/external/cache/rootfs'''(Need to be modified to the IP address ]|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>The name of the development board)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>* daemon not running<ol start="10" style="list-style-type: decimal; starting now at tcp:5037"><li><p>View the compiled rootfs compressed package</p>* daemon started successfully<ol style="list-style-type: lower-alpha;"> connected to 192<li>'''bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.168tar.1lz4''' It is a compressed package of rootfs.xxxThe meaning of each field in the name is</li> :5555a) '''bullseye''' represents the type of Linux distribution of rootfs :b) '''xfce''' indicates that the rootfs is the desktop version, and if it is cli, it indicates the server version.
# Prepare a USB Type C interface data cable, plug one end of Run 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)'''build. In this case, the development board is powered by the computersh'''s USB interfacescript, so please ensure that the computer's USB interface can provide the most sufficient power remember to drive the development board.add sudo permissions
<ol start="2" style="list-style-type: decimal;">
<li>Install adb tool on Ubuntu PCSelect '''Full OS image for flashing''' and press Enter</li></ol>
</div></ol>
<ol start="3" style="list-style-type: decimal;">
<li>Check whether Then select the ADB device is recognizedmodel of the development board</li></ol> test@test:~$ '''adb devices''' List of devices attached 4c00146473c28651dd0 device
[[File:zero2w-img275.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>Then select the branch type of the kernel source code. Different versions of the kernel source code maintain different rootfs types.</p><ol style="list-style-type: lower-alpha;"><li><p>In the current branch, you can log in to see three options: debian11, ubuntu20.04, and ubuntu22.04.</p></li><li><p>In the android system through adb shell on Ubuntu PCnext branch, you can see three options: debian11, debian12, and ubuntu22.04.</lip></olli>
<span iddiv class="view-how-to-set-hdmi-display-resolutionfigure"></span>== View how to set HDMI display resolution ==
</li></ol>
<ol start="8" style="list-style-type: decimal;">
<li>If you are compiling the server version of the image, you can also choose to compile the Standard version or the Minimal version. The Minimal version will have much less pre-installed software than the Standard version ('''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''')</li>
::o. Finally, write the bin file of u-boot into the image through the dd command.</ol><ol start="11" style="list-style-type: decimal;"><li><p>After compiling the image, the following message will be displayed</p><ol style="list-style-type: lower-alpha;"><li>The storage path of the compiled image</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Done building [ '''output/images/orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop/orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop.img''' ]|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Compilation time</li>{| class="wikitable" style="width:800px;" |-| '''[o.k. ] Runtime [File19 min ]'''|}</ol><ol start="3" style="list-style-type:zero2wlower-img318alpha;"><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>{| class="wikitable" style="width:800px;" |-| [ o.k.png]Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=image RELEASE=bullseye BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_CONFIGURE=yes''' ]|}</ol></li></ol><span id="instructions-for-using-the-orange-pi-os-arch-system"></span>
<ol startspan id="3" style="listorange-pi-os-arch-system-user-styleguide-type: decimal;instructions"><li>Then select '''Network & Internet'''</li></olspan>
<ol start="5" style="list-style-type: decimallower-alpha;"><li>Then open '''Hotspot Enable'''. You can also see <p>After burning the name and password of the generated hotspot in the picture below. Remember them and use them system, when connecting to the hotspot (if you need to modify start it for the name first time and password of enter the hotspotdesktop, you need to close Hotspot Enable firstwill see the user wizard program shown in the figure below. Then you can modify it)</lip></oldiv class="figure">
[[File:zero2w-img321img293.png]]
<ol start="6" style="list-style-type: decimal;"/div></li><li>At this time, <p>First you can take out your mobile phone. If everything is normal, you can find need to select the WIFI hotspot with the same name ('''here AndroidAP_7132''') shown under the '''Hotspot name''' in the picture above in the WI-FI list searched by the mobile phone. Then language you can click AndroidAP_7132 to connect to the hotspot. The password can be seen under the '''Hotspot password''' in the picture above.want</lip></oldiv class="figure">
[[File:zero2w-img322img294.png]]
<ol start="7" style="list-style-type: decimal;"/div></li><li><p>After selecting the connection is successfullanguage, it will be displayed as shown below (the interface user wizard will be different on different mobile phones, immediately switch to the specific corresponding language interface is subject to the one displayed on your mobile phone). At this time, you can open a web page on your mobile phone to see if you can access the Internet. If the web page can be opened normally, it means that the '''WI-FI Hotspot''' of the development board can be used normally.as shown below in Chinese</lip></oldiv class="figure">
[[File:zero2w-img323img295.png]]
<span id="how-to-check-the-ip-address-of-the-ethernet-port"/div></spanli>== How to check <li><p>Then select the IP address of the Ethernet port =area</p><div class="figure">
<span id="bluetooth-connection-method"/div></li><li><p>Then create a new username and set a password</spanp><div class== Bluetooth connection method =="figure">
<ol startspan id="6" style="listhow-to-set-styledt-type: decimal;overlays"><li/span>Then click on the Bluetooth device you want == How to connect to start pairing. When the following interface pops up, please use the mouse to select the '''Pair'''option</li></ol>set DT overlays ==
'''FDTOVERLAYS /dtbs/allwinner/overlay/<span idstyle="how-color:#FF0000">xxx.dtbo</span>''' #Configuration that needs tobe added|}</ol><ol start="3" style="list-set-usb0-to-host-modestyle-1type: decimal;"><li><p>The storage path of xxx.dtbo in the OPi OS Arch image is as follows. Please note that not all dtbo under this path can be used.</spanp>{| class="wikitable" style= How to set USB0 to HOST mode =="width:800px;" |-| <p>'''/boot/dtbs/allwinner/overlay/'''</p>|}</li><li><p>The DT overlays configuration that can be used by the development board is as follows</p></li>
'''FDTOVERLAYS <span idstyle="howcolor:#FF0000">/dtbs/allwinner/overlay/sun50i-h616-pi-toi2c1.dtbo /dtbs/allwinner/overlay/sun50i-useh616-usbph-camera"uart5.dtbo</span>'''|}</spanol><ol start="6" style= How "list-style-type: decimal;"><li>After setting, you need to use USB camera restart the system for the configuration to take effect.</li>{| class="wikitable" style="width:800px;" |-# First insert the USB (UVC protocol) camera into the USB interface of the development board| [orangepi@orangepi-pc ~]$ '''sudo reboot'''|}</ol># If the USB camera is recognized normally, the corresponding video device node will be generated under <span id="how-to-install-software"></devspan>
<div classspan id="figureandroid-12-tv-system-usage-instructions"></span>
<span id="supported-android-versions"></divspan><div class="figure">= Supported Android versions ==
</div><ol startspan id="5" style="listandroid-12-tv-function-styleadaptation-type: decimal;status"><li/span>Then use the adb command to install the USB camera test APP into the == Android system. Of course, you can also use a USB disk copy to install it.</li></ol>12 TV function adaptation status ==
<span id="how-to-use-miracastreceiver-to-cast-the-mobile-phone-screen-tonetwork-theconnection-developmentadb-boarddebugging"></span>== How to use MiracastReceiver to cast the mobile phone screen to the development board = 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:~$ '''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.adb shell''' apollo-p2:/ #|}</ol><span id="pinuse-data-cable-gpioto-portconnect-testadb-methoddebugging"></span> === 40pin GPIO port test method Use data cable to connect adb debugging ===
# First open wiringOP APP 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 desktopright 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.
::[[File:zero2w-img304.png]] [[File:zero2w-img351img305.png]]
<ol start="2" style="list-style-type: decimal;">
<li>Then click the '''GPIO_TEST''' button to open the GPIO test interfaceInstall adb tool on Ubuntu PC</li></ol>{| class="wikitable" style="width:800px;" |-| [[Filetest@test:zero2w~$ '''sudo apt-img352.png]]get update'''
test@test:~$ '''sudo apt-get install -y adb'''
|}
</ol>
<ol start="3" style="list-style-type: decimal;">
<li>The GPIO test interface is as shown in Check whether the figure below. The two rows of '''CheckBox''' buttons on the left have a one-to-one correspondence with the 40pin pins. When the '''CheckBox''' button ADB device is checked, the corresponding GPIO pin will be set to '''OUT''' mode and the pin level is set to high levelrecognized</li>{| class="wikitable" style="width:800px; when unchecked, the GPIO pin level will be set to low level; when the GPIO is clicked When you click the '''GPIO READALL''" |-| test@test:~$ ' button, you can get information such as wPi number, GPIO mode, pin level, etc.; when you click the''adb devices'BLINK ALL GPIO''' button, all GPIO ports will cycle through outputting high and low levels. This function can be used to test all the 40pin pins. GPIO port.</li></ol>
4c00146473c28651dd0 device
|}
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then click you can log in to the android system through adb shell on Ubuntu PC</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''GPIO READALLadb shell''' button, and the output information is as shown below:</li></ol>
apollo-p2:/ $|}<div class/ol><span id="figureview-how-to-set-hdmi-display-resolution"></span>
<span id="hdmi-to-vga-display-test-1"></span>=== HDMI to VGA display test === <ol style="list-style-type: decimal;"><li><p>First you need to prepare the following accessories</p><ol style="list-style-type: lower-alpha;"><li>HDMI to VGA converter</li> [[File:zero2w-img144.png]]</ol><ol start="2" style="list-style-type: lower-alpha;"><li>A VGA cable and a Mini HDMI male to HDMI female adapter</li> [[File:zero2w-img145.png]] [[File:zero2w-img146.png]]</ol><ol start="3" style="list-style-type: lower-alpha;"><li>A monitor or TV that supports VGA interface</li></ol></li></ol> <ol start="2" style="list-style-type: decimal;"><li>HDMI to VGA display test is as follows</li> [[File:zero2w-img355img313.png]]
::[[File:zero2w-img357img306.png]]
<ol start="82" style="list-style-type: decimal;"><li>Then click the select '''GPIO READALLNetwork & Internet''' button and you can see that the current pin 12 mode is OUT and the pin level is low level.</li></ol>
[[File:zero2w-img358img314.png]]</ol><ol start="3" style="list-style-type: decimal;"><li>Then turn on WI-FI</li>
[[File:zero2w-img315.png]]</ol><span idol start="pin4" style="list-uartstyle-test-methodtype: decimal;"><li>After turning on WI-FI, you can see the searched signals under '''Available networks'''.</spanli>=== 40pin UART test method ===
|-
|-
| apollo-p2:/ # '''231cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_device'''| '''PH7'''| '''SPI1_MOSI'''device_chose finished!| '''19'''|apollo-p2:/ #| '''20'''}| '''GND'''</ol>| <ol start="3" style="textlist-alignstyle-type: leftlower-alpha;"|><li>The command to view the current mode of USB0 is</li>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| apollo-p2:/ # '''232cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/otg_role''' usb_host| '''PH8'''}</ol><span id="how-to-use-usb-camera"></span>| '''SPI1_MISO'''| '''21'''== How to use USB camera ==|| '''22'''# First insert the USB (UVC protocol) camera into the USB interface of the development board| '''UART2_RX'''# If the USB camera is recognized normally, the corresponding video device node will be generated under /dev| '''PI6'''::{| '''262'''class="wikitable" style="width:800px;"
|-
| console:/ # '''230ls /dev/video0''' /dev/video0| '''PH6'''} <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| '''SPI1_CLKHow to use ADB''']]".</p></li>| <li><p>Download the USB camera test APP from the '''23official 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]]|| '''24'''</div></ol>| '''SPI1_CS0'''<ol start="5" style="list-style-type: decimal;">| '''PH5'''<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>{| '''229'''class="wikitable" style="width:800px;"
|-
| test@test:~$ '''adb install usbcamera.apk'''|}</ol><ol start="6" style="textlist-style-aligntype: leftdecimal;"|><li>After installation, you can see the startup icon of the USB camera on the Android desktop.</li> [[File:zero2w-img338.png]]</ol>| <ol start="7" style="textlist-style-aligntype: leftdecimal;"|>| '''GND'''<li>Then double-click to open the USB camera APP and you can see the output video of the USB camera.</li></ol>| '''25'''|<span id="android-system-root-description"></span>| '''26'''| '''SPI1_CS1'''== Android system ROOT description ==| '''PH9'''{| '''233'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big>'''266The Android system released by Orange Pi has been ROOT and can be tested using the following method.'''</big>| } # Download from the '''PI10official tool'''| on the development board data download page '''TWI2-SDArootcheck.apk'''| '''27'''|<div class="figure"> ::[[File:zero2w-img336.png]] </div><div class="figure"> ::[[File:zero2w-img339.png]] | '''28'''</div>| '''TWI2<ol start="2" style="list-style-SCL'''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| '''PI9How to use ADB''']]".</p></li><li><p>Then use the adb command to install rootcheck.apk into the Android system. Of course, you can also use a USB disk copy to install it.</p></li>{| '''265'''class="wikitable" style="width:800px;"
|-
| '''256'''| '''PI0'''| style="text-aligntest@test: left;"|| ~$ '''29adb install rootcheck.apk'''|}| '''30'''| '''GND'''</ol>| style<ol start="text-align: left;4"|| style="text-align: left;"||list-| '''271'''| '''PI15'''| style="text-aligntype: leftdecimal;"|>| '''31'''<li>After installation, you can see the startup icon of the ROOT test tool on the Android desktop.</li>|| '''32'''| '''PWM1'''| '''PI11'''| '''267'''|[[File:zero2w-img340.png]]| '''268'''| '''PI12'''| '''PWM2'''| '''33'''|| '''34'''| '''GND'''</ol>| style<ol start="text-align: left;5"|| style="textlist-style-aligntype: leftdecimal;"||->| <li>The display interface after opening the '''258ROOT test tool'''for the first time is as shown below</li>| '''PI2'''| style[[File:zero2w-img341.png]]</ol><ol start="text-align: left;6"|| '''35'''|| '''36'''| style="textlist-style-aligntype: leftdecimal;"|>| <li>Then you can click '''PC12CHECK 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>| '''76'''|[[File:zero2w-img342.png]]| '''272'''| '''PI16'''</ol>| style<span id="texthow-to-use-miracastreceiver-to-cast-the-mobile-phone-align: left;screen-to-the-development-board"|></span>| '''37'''|== How to use MiracastReceiver to cast the mobile phone screen to the development board ==| '''38'''| <ol style="text-align: left;"|| '''PI4'''| '''260'''|list-| style="text-aligntype: leftdecimal;"|>| style="text<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-align: left;"|FI connection method| '''GNDthe instructions in the WI-FI connection method.''']]</p></li>| <li><p>Then open the '''39MiracastReceiver'''application in the Android system of the development board</p>|<p>[[File:zero2w-img343.png]]</p></li>| <li><p>The interface after '''40MiracastReceiver'''is opened is as follows</p>| style<div class="text-align: left;figure"|| '''PI3'''| '''259'''|}>
<span id="method-of-turning-on-and-off-the-machine-through-buttons-or-infrared-remote-control"></dev/ttyAS0 /dev/ttyAS1 '''/dev/ttyAS2 /dev/ttyAS5'''span>
::[[File:zero2w-img362img351.png]]
<ol start="82" style="list-style-type: decimal;"><li><p>Then use Dupont wire to short the rx and tx pins of uart</p></li><li><p>Then you can enter a paragraph of characters in the send edit box below and click the '''SENDGPIO_TEST''' button to start sending.</p>open the GPIO test interface</li></ol>
[[File:zero2w-img363img352.png]]</ol><ol start="3" style="list-style-type: decimal;"><li>The GPIO test interface is as shown in the figure below. The two rows of '''CheckBox''' buttons on the left have a one-to-one correspondence with the 40pin pins. When the '''CheckBox''' button is checked, the corresponding GPIO pin will be set to '''OUT''' mode and the pin level is set to high level; when unchecked, the GPIO pin level will be set to low level; when the GPIO is clicked When you click the '''GPIO READALL''' button, you can get information such as wPi number, GPIO mode, pin level, etc.; when you click the'''BLINK ALL GPIO''' button, all GPIO ports will cycle through outputting high and low levels. This function can be used to test all the 40pin pins. GPIO port.</li>
[[File:zero2w-img353.png]]</ol><ol start="104" style="list-style-type: decimal;"><li>If everything is normalThen click the '''GPIO READALL''' button, and the received string will be displayed in the receiving boxoutput information is as shown below:</li></ol>
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-
| '''264'''
| '''TWI1-SDA'''
| '''3'''
|-
| '''263'''
| '''TWI1-SCL'''
| '''5'''
|-
| '''269'''
| '''PWM3'''
| '''7'''
|-
| style="text-align: left;"|
| '''GND'''
| '''9'''
|-
| '''<span style="color:#FF0000">226</span>'''| '''<span style="color:#FF0000">PH2</span>'''| '''<span style="color:#FF0000">UART5_TX</span>'''| '''<span style="color:#FF0000">11</span>'''|-| '''12<span style="color:#FF0000">227</span>'''| '''<span style="color:#FF0000">PH3</span>'''| '''<span style="color:#FF0000">UART5_RX</span>'''| '''<span style="color:#FF0000">13</span>'''|-| '''<span style="color:#FF0000">261</span>'''| '''<span style="color:#FF0000">PI5</span>'''| '''<span style="color:#FF0000">UART2_TX</span>'''| '''<span style="color:#FF0000">15</span>'''|-| style="text-align: left;"|
| style="text-align: left;"|
| '''PI13.3V'''| '''25717'''
|-
| '''PH7'''
| '''SPI1_MOSI'''
| '''19'''
|-
| '''232'''
| '''SPI1_MISO'''
| '''21'''
|-
| '''230'''
| '''SPI1_CLK'''
| '''23'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|-
| '''266'''
| '''TWI2-SDA'''
| '''27'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
| '''268'''
| '''PI12'''
| '''PWM2'''
| '''33'''
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|-| '''36272'''| '''PI16'''| style="text-align: left;"|| '''37'''|-| style="text-align: left;"|
| style="text-align: left;"|
| '''PC12GND'''| '''7639'''
|}
|-
| '''GPIO serial number10'''| '''GPIOUART0_RX'''| '''FunctionPH1'''| '''pin'''|| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO serial number225'''
|-
| '''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'''
|-
| '''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">UART2_RX</span>'''| '''TWI1<span style="color:#FF0000">PI6</span>'''| '''<span style="color:#FF0000">262</span>'''|-| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''28'''| '''TWI2-SCL'''| '''5PI9'''|'''265'''|-| '''630'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26932'''| '''PI13PWM1'''| '''PWM3PI11'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224267'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''1236'''
| style="text-align: left;"|
| '''PI1PC12'''| '''25776'''
|-
| '''22738'''| '''PH3'''| '''UART5_RX'''| '''13'''|| '''14'''| '''GND'''| style="text-align: left;"|
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| '''26140'''| '''PI5'''| '''UART2_TX'''| '''15'''|| '''16'''| '''PWM4'''| '''PI14'''| '''270'''|-
| style="text-align: left;"|
|-
| <p>apollo-p2:/ # ls /dev/ttyAS*</p><p>/dev/ttyAS0 /dev/ttyAS1 '''231<span style="color:#FF0000">/dev/ttyAS2 /dev/ttyAS5</span>'''</p>| '''PH7'''}</ol><ol start="3" style="list-style-type: decimal;"><li>First open wiringOP APP on the desktop</li> [[File:zero2w-img351.png]]</ol>| '''SPI1_MOSI'''<ol start="4" style="list-style-type: decimal;">| <li>Then click the '''19UART_TEST'''button to open the UART test interface</li>|| '''20'''[[File:zero2w-img359.png]]| '''GND'''</ol>| <ol start="5" style="textlist-style-aligntype: leftdecimal;"|><li>The serial port test interface of wiringOP is as shown in the figure below</li> [[File:zero2w-img360.png]]</ol>| <ol start="6" style="textlist-style-aligntype: leftdecimal;"||->| <li><p>Then select the '''232/dev/ttyAS2'''| or'''PH8/dev/ttyAS5'''node in the selection box</p><p>[[File:zero2w-img361.png]]</p></li>| <li><p>Enter the baud rate you want to set in the edit box, and then click the '''SPI1_MISOOPEN'''| button to open the uart node. After the opening is successful, the '''21OPEN'''|| button becomes unselectable, and the '''22CLOSE'''| button and '''UART2_RXSEND'''button become selectable.</p></li> [[File:zero2w-img362.png]]</ol>| <ol start="8" style="list-style-type: decimal;"><li><p>Then use Dupont wire to short the rx and tx pins of uart</p></li><li><p>Then you can enter a paragraph of characters in the send edit box below and click the '''PI6SEND'''button to start sending.</p></li> [[File:zero2w-img363.png]]</ol><ol start="10" style="list-style-type: decimal;"><li>If everything is normal, the received string will be displayed in the receiving box</li> [[File:zero2w-img364.png]]</ol><span id="pin-spi-test-method"></span> === 40pin SPI test method === # As can be seen from the table below, the spi available for the 40pin interface is spi1, and there are two chip select pins cs0 and cs1 <div style="display: flex;">::{| '''262'''class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''230GPIO NO.'''| '''PH6GPIO'''| '''SPI1_CLKFunction'''| '''23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229Pin'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND3.3V'''| '''251'''|-| '''26264'''| '''SPI1_CS1PI8'''| '''PH9TWI1-SDA'''| '''2333'''
|-
| '''266263'''| '''PI10PI7'''| '''TWI2TWI1-SDASCL'''| '''275'''|-| '''28269'''| '''TWI2-SCLPI13'''| '''PI9PWM3'''| '''2657'''
|-
| style="text-align: left;"|
| '''29'''style="text-align: left;"|| '''30'''
| '''GND'''
| style="text'''9'''|-align: left;"| '''226'''| '''PH2'''| '''UART5_TX'''|'''11'''| style="text-align: left;"| '''227'''| '''PH3'''| '''UART5_RX'''|'''13'''
|-
| '''271261'''| '''PI15'''| style="text-align: left;"|| '''31'''|| '''32'''| '''PWM1PI5'''| '''PI11UART2_TX'''| '''26715'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|-
| '''258231'''| '''PI2PH7'''| '''SPI1_MOSI'''| '''19'''| style="text-align: left;"|'''232'''| '''35PH8'''|'''SPI1_MISO'''| '''3621'''| style="text-align: left;"| '''230'''|'''PH6'''| '''PC12SPI1_CLK'''| '''7623'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''PI4GND'''| '''26025'''|-| '''266'''| '''PI10'''| '''TWI2-SDA'''| '''27'''
|-
| '''256'''
| '''PI0'''
| style="text-align: left;"|
| '''29'''
|-
| '''271'''
| '''PI15'''
| style="text-align: left;"|
| '''GND31'''|-| '''268'''| '''PI12'''| '''39PWM2'''|'''33'''|-| '''258'''| '''40PI2'''
| style="text-align: left;"|
| '''PI3'''| '''25935'''
|}
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''| '''1'''|| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''264'''| '''PI8'''| '''TWI1-SDA'''| '''3'''|
| '''4'''
| '''5V'''
| style="text-align: left;"|
|-
| '''6'''
| '''GND'''
| style="text-align: left;"|
|-
| '''8'''
| '''UART0_TX'''
| '''224'''
|-
| '''10'''
| '''UART0_RX'''
| '''225'''
|-
| '''12'''
| style="text-align: left;"|
| '''257'''
|-
| '''14'''
| '''GND'''
| style="text-align: left;"|
|-
| '''16'''
| '''PWM4'''
| '''270'''
|-
| '''18'''
| style="text-align: left;"|
| '''228'''
|-
| '''20'''
| '''GND'''
| style="text-align: left;"|
|-
| '''22'''
| '''UART2_RX'''
| '''262'''
|-
| '''24'''
| '''SPI1_CS0'''
| '''229'''
|-
| '''26'''
| '''SPI1_CS1'''
| '''233'''
|-
| '''28'''
| '''TWI2-SCL'''
| '''265'''
|-
| '''30'''
| '''GND'''
| style="text-align: left;"|
|-
| '''32'''
| '''PWM1'''
| '''267'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
|-
| '''36'''
| style="text-align: left;"|
| '''PC12'''
| '''76'''
|}
</div>
<ol start="2" style="list-style-type: decimal;">
<li>First click The device node corresponding to SPI1 CS0 is '''/dev/spidev1.0''', and the wiringOP icon device node corresponding to open wiringOP APPSPI1 CS1 is '''/dev/spidev1.1'''</li></ol>{| class="wikitable" style="width:800px;" |-| [[Fileapollo-p2:zero2w-img351/ # '''ls /dev/spidev1.png]]*'''
'''<span style="color:#FF0000">/dev/spidev1.0 /dev/spidev1.1</span>'''
|}
</ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then click Here is a demonstration to test the SPI1 interface through the '''PWM_TESTw25qxx''' button on module. First, connect the main interface of wiringOP w25qxx module to enter the PWM test SPI1 interface.</li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''It doesn't matter if there is no w25qxx module, because there is a SPIFlash on the development board connected to SPI0, and the configuration of SPI0 is also turned on by default in Android, so we can also directly use the onboard SPIFlash for testing.'''</olbig>|}[[File:zero2w-img380.png]]</ol>
<ol start="4" style="list-style-type: decimal;">
<li>The PWM test interface is as followsThen open wiringOP APP on the desktop</li></ol>
<ol start="5" style="list-style-type: decimal;">
<li>Then set which PWM you want to use in click the Channel. The default is PWM1. If you want '''SPI_TEST''' button to set it to PWM2, just enter 2 in open the Channel. PWM3 and PWM4 and so on.SPI test interface</li></ol> [[File:zero2w-img382.png]]
[[File:zero2w-img365.png]]
</ol>
<ol start="6" style="list-style-type: decimal;">
<li><p>Then select the spi device node in the upper left corner. If you can set test the PWM periodonboard SPIFlash directly, just keep the default '''/dev/spidev0. The default configuration 0'''. If the '''w25qxx''' module is connected to the 40pin spi1 cs0, then please select'''50000ns/dev/spidev1.0'''. The converted PWM frequency , if the w25qxx module is connected to the 40pin spi1 cs1, then please select '''20KHz/dev/spidev1.1'''</lip></oldiv class="figure">
[[File:zero2w-img383img366.png]]
<ol start="7" style="list-style-type: decimal;"/div></li><li><p>Then click the '''EXPORTOPEN'''button to export PWMinitialize the SPI</lip></olli> [[File:zero2w-img384.png]]
[[File:zero2w-img367.png]]
</ol>
<ol start="8" style="list-style-type: decimal;">
<li>Then drag fill in the progress bar below bytes that need to change be sent, such as reading the ID information of the onboard SPIFlash, filling in the PWM duty cycleaddress 0x9f in data[0], and then check click the '''EnableTRANSFER''' to output the PWM waveform.button</li></ol> [[File:zero2w-img385.png]]
[[File:zero2w-img368.png]]
</ol>
<ol start="9" style="list-style-type: decimal;">
<li>Then use an oscilloscope to measure Finally, the corresponding pins in APP will display the 40pin development board and you can see read ID information of the following waveformonboard SPI Flash.</li></ol>
[[File:zero2w-img386img369.png]]</ol><ol start="10" style="list-style-type: decimal;"><li>If the w25qxx module connected to 40pin SPI1 is read, the ID information of the onboard SPI Flash is also similar.</li></ol>
<span id="howpin-toi2c-compiletest-android-12-source-codemethod"></span>
= '''How to compile Android 12 source code''' == 40pin I2C test method ===
<ol div style="listdisplay: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''GPIO NO.'''| '''GPIO'''| '''Function'''| '''Pin'''|-| style="text-typealign: decimalleft;">|| style="text-align: left;"|| '''3.3V'''| '''1'''|-| '''<li><pspan style="color:#FF0000">First download the compressed package of the Android 12 source code and the compressed package of the files modified by Orange Pi Zero2w from Google Cloud Drive264</pspan>'''| '''<ol span style="list-style-typecolor: lower-alpha;#FF0000">PI8<li/span>Google Cloud Drive'''| '''</lispan style="color:#FF0000">TWI1-SDA</olspan>'''| '''</lispan style="color:#FF0000">3</olspan>''' [[File:zero2w|-img387.png]] | '''<ol startspan style="2color:#FF0000" >263</span>'''| '''<span style="list-style-typecolor: decimal;#FF0000">PI7<li/span>After downloading the compressed package of Android 12 source code, please check whether the MD5 checksum is correct. If it is incorrect, please download the source code again. Here's how to check the MD5 checksum''| '''<span style="color:#FF0000">TWI1-SCL</lispan>'''| '''<span style="color:#FF0000">5</olspan>'''|-test@test:~$ | '''md5sum -c H618-Android12-Src.tar.gz.md5sum269'''| '''PI13'''H618-Android12-Src.tar.gzaa: | '''OKPWM3''' H618-Android12-Src.tar.gzab: | '''OK7'''|-...... <ol start| style="3text-align: left;" || style="list-styletext-typealign: decimalleft;">|| '''GND'''| '''9'''|-| '''226'''<li>Then you need to merge multiple compressed files into one, and then extract the Android source code. The command looks like this:</li></ol>| '''PH2'''| '''UART5_TX'''test@test:~$ | '''11'''cat H618|-Android12| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-Src.tar.gza* > H618-Android12-Src.tar.gz| '''261'''| '''PI5'''| '''UART2_TX'''test@test:~$ | '''tar -xvf H618-Android12-Src.tar.gz15'''|-<ol start| style="4text-align: left;" || style="listtext-style-typealign: decimalleft;">|| '''3.3V'''| '''17'''|-| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''<li>Then unzip the compressed package of the files modified by Orange Pi Zero2w</li></ol>| '''PH8'''| '''SPI1_MISO'''test@test:~$ | '''tar zxf opizero2w_android12_patches.tar.gz21'''|-test@test:~$ | '''230'''| '''lsPH6'''| '''SPI1_CLK'''| '''opizero2w_android12_patches23''' opizero2w_android12_patches.tar.gz|-<ol start| style="5text-align: left;" || style="list-styletext-typealign: decimalleft;">|| '''GND'''| '''25'''|-| '''<lispan style="color:#FF0000">Then copy the files modified by Orange Pi Zero2w to the Android source code266</lispan>'''| '''<span style="color:#FF0000">PI10</olspan>''' test@test:~$ | '''cp <span style="color:#FF0000">TWI2-rf opizero2w_android12_patches/* H618-Android12-SrcSDA</span>''' | '''<span idstyle="compile-the-source-code-of-android-12color:#FF0000">27</span>'''== Compile the source code of Android 12 ==|-| '''256'''| '''PI0''Android12 is compiled on an x86_64 computer with Ubuntu 22.04 installed. Other versions of Ubuntu system package dependencies may have some differences. The image download address of the Ubuntu 22.04 amd64 version is as follows'| style="text-align:left;"|| '''29'''|-[https://repo.huaweicloud.com/ubuntu-releases/22.04/ubuntu-22.04.2-desktop-amd64.iso | '''271'''| '''https://repo.huaweicloud.com/ubuntu-releases/22.04/ubuntu-22.04.2-desktop-amd64.isoPI15''']| style="text-align: left;"|| '''The x86_64 computer hardware configuration for compiling Android12 source code recommends a memory of 16GB or more, and a hard disk space of 200GB or more is recommended. The more CPU cores, the better.31'''|-# First install the software packages needed to compile Android12 source code| '''268'''| '''PI12'''test@test:~$ | '''sudo apt-get updatePWM2''' test@test:~$ | '''sudo apt-get install -y git gnupg flex bison gperf build-essential \33'''|-| '''zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \258''' | '''lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev ccache \PI2'''| style="text-align: left;"|| '''libgl1-mesa-dev libxml2-utils xsltproc unzip u-boot-tools python-is-python3 \35'''|-| '''libssl-dev libncurses5 clang gawk272'''| '''PI16'''<ol start="2" | style="list-styletext-typealign: decimalleft;">|| '''37'''<li><p>Then compile the code in the longan folder, which mainly contains u|-boot and linux kernel</p><ol | style="listtext-align: left;"|| style="text-typealign: lower-alphaleft;">|<li>First run | '''./build.sh configGND''' to set compilation options</li></ol></li></ol> test@test:~$ | '''cd H618-Android12-Src/longan39'''|}test@test{| class="wikitable" style="width:~/H618390px;margin-Android12right: 20px;text-Src/longan$ align: center;"|-| '''./build.sh configPin'''| '''Function'''Welcome to mkscript setup progress| '''GPIO'''| '''GPIO NO.'''All available platform:|-| '''2'''0. android| '''5V'''| style="text-align: left;"|1. linux| style="text-align: left;"||-Choice [android]: | '''04'''| '''5V'''All available ic| style="text-align:left;"|| style="text-align: left;"|0. h618|-| '''6'''Choice [h618]: | '''0GND'''| style="text-align: left;"|All available board| style="text-align:left;"||-0. ft| '''8'''| '''UART0_TX'''1. p1| '''PH0'''| '''224'''2. p2|-| '''10'''3. p7| '''UART0_RX'''| '''PH1'''4. p7l| '''225'''|-5. perf1| '''12'''| style="text-align: left;"|6. perf2| '''PI1'''| '''257'''7. perf3 8. qa|-| '''14'''Choice [p2]: | '''2GND'''| style="text-align: left;"|All available flash| style="text-align:left;"||-0. default| '''16'''| '''PWM4'''| '''PI14'''1. nor| '''270'''|-Choice [default]: | '''018''' All available kern_ver| style="text-align:left;"|| '''PH4'''0. linux| '''228'''|-5.4| '''20'''Choice [linux-5.4]: | '''0GND'''| style="text-align: left;"|All available arch| style="text-align:left;"||-0. arm| '''22'''| '''UART2_RX'''1. arm64| '''PI6'''Choice [arm64]: | '''1262'''|-| '''......24'''| '''SPI1_CS0'''*** Default configuration is based on | '''PH5''sun50iw9p1smp_h618_android_defconfig'| '''229'''#|-| '''26'''# configuration written to .config| '''SPI1_CS1'''| '''PH9'''#| '''233'''|-make[1]| '''<span style="color: Leaving directory #FF0000">28</span>''/home/test/H618'| '''<span style="color:#FF0000">TWI2-Android12-SrcSCL</longanspan>'''| '''<span style="color:#FF0000">PI9</outspan>'''| '''<span style="color:#FF0000">265</kernel/buildspan>'''|-| '''30'''make: Leaving directory | '''GND'''/home/test/H618| style="text-Android12align: left;"|| style="text-Src/longan/kernel/linuxalign: left;"||-5.4| '''32'''| '''PWM1'''| '''PI11'''INFO: clean buildserver| '''267'''|-INFO: prepare_buildserver| '''34'''| '''GND'''<ol start| style="2text-align: left;" || style="listtext-align: left;"||-| '''36'''| style="text-typealign: lower-alphaleft;">|<li>Then run the | '''./build.shPC12''' script to start compilation.</li></ol>| '''76'''test@test:~/H618|-Android12-Src/longan$ | '''./build.sh38''' <ol start="3" | style="list-styletext-typealign: lower-alphaleft;">|<li>After compilation is completed, you will see the following output</li></ol>| '''PI4'''| '''260'''sun50iw9p1 compile Kernel successful|-| '''40'''INFO| style="text-align: Prepare toolchain ...left;"|| '''PI3'''| '''......259'''|}</div>
[[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