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;"
=== 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;" |-| </libig></ol> '''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'''
'''Note that although many laptops have When you want to connect the HDMI interfaces, of the development board to the HDMI interface of the your laptop, please first confirm that your laptop generally only has supports the output HDMI in function and '''</big>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''When HDMI does not have display, please first check whether the HDMI cable is plugged in function, which means tightly. After confirming that the HDMI output of other devices cannot be displayed on the laptop wiring is OK, you can try a different screento see if there is any display.'''</big>|}</li></ol><span id="hdmi-to-vga-display-test"></span>
=== 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>
<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'''
| '''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;"|
| style="text-align: left;"|
| '''GND'''
| '''25'''
|-
| '''266'''
| '''TWI2-SDA/UART3_RX'''
| '''27'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''40pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''GPIO序号4'''| '''GPIO5V'''| '''Function'''| '''pin'''|| '''pin'''style="text-align: left;"| '''Function'''| '''GPIO'''style="text-align: left;"| '''GPIO序号'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''8'''
| '''UART0_TX'''
| '''224'''
|-
| '''10'''
| '''UART0_RX'''
| '''225'''
|-
| '''12'''
| style="text-align: left;"|
| '''257'''
|-
| '''14'''
| '''GND'''
| style="text-align: left;"|
|-
| '''16'''
| '''PWM4/UART4_RX'''
| '''270'''
|-
| '''18'''
| style="text-align: left;"|
| '''228'''
|-
| '''20'''
| '''GND'''
| style="text-align: left;"|
|-
| '''22'''
| '''TWI0_SDA/UART2_RX'''
| '''262'''
|-
| '''24'''
| '''SPI1_CS0'''
| '''229'''
|-
| '''26'''
| '''SPI1_CS1'''
| '''233'''
|-
| '''28'''
| '''TWI2-SCL/UART3_TX'''
| '''265'''
|-
| '''30'''
| '''GND'''
| style="text-align: left;"|
|-
| '''32'''
| '''PWM1'''
| '''267'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
|-
| '''36'''
| style="text-align: left;"|
| '''76'''
|-
| '''38'''
| style="text-align: left;"|
| '''260'''
|-
| '''40'''
| style="text-align: left;"|
| '''259'''
|}
</div>
</ol>
<ol start="3" style="list-style-type: decimal;">
<li>There are a total of 28 GPIO ports in the 40pin interface. The high-level voltage of all GPIO ports is '''<span style="color:#FF0000">3.3v</span>'''</li></ol>
<ol stylespan id="listhow-style-type: decimal;"><li><p>In Linux systems, spi1 is turned off by default and needs to be turned on manually before it can be used. The opening steps are as follows:</p><ol style="list-styleinstall-type: lower-alpha;wiringop"><li><p>First run '''orangepi-config'''. Ordinary users remember to add > '''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></olspan>
== How to install wiringOP == {| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| '''dtbo configuration'''| '''illustrate<big>'''|Note that wiringOP is already pre-| '''spi1-cs0installed in the linux image released by Orange Pi. Unless the wiringOP code is updated, there is no need to re-cs1-spidev'''| '''Open cs0 download, compile and cs1 of spi1 at the same timeinstall, you can just use it directly.'''|-| '''spi1-cs0-spidev'''| '''Only open cs0 The storage path of spi1'''|-| '''spi1the compiled wiringOP deb package in orangepi-cs1-spidev'''| 'build is: ''Only open cs1 of spi1'''|}
<ol style="list-style-type: decimal;"><li><p>Download the code of wiringOP</p>{| class="wikitable" style="width:800px;"
|-
| '''GPIO序号'''| <p>orangepi@orangepi:~$ '''GPIOsudo apt update'''</p>| <p>orangepi@orangepi:~$ '''Functionsudo apt install -y git'''</p>| <p>orangepi@orangepi:~$ '''pin'''|| '''pingit clone https://github.com/orangepi-xunlong/wiringOP.git -b next'''</p>| '''Function'''}{| '''GPIO'''| '''GPIO NO.'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|-
| <p>orangepi@orangepi:~$ '''264cd wiringOP'''</p>| <p>orangepi@orangepi:~/wiringOP$ '''PI8sudo ./build clean'''</p>| <p>orangepi@orangepi:~/wiringOP$ '''TWI1-SDAsudo ./build'''</p>| '''3'''}</li>|<li><p>The output of the test gpio readall command is as follows</p>| '''4'''<p>[[File:zero2w-img170.png]]</p></li></ol>| '''5V'''| style<span id="textpin-interface-gpio-i2c-uart-spi-align: left;and-pwm-testing"|></span> == 40pin interface GPIO, I2C, UART, SPI and PWM testing == {| class="wikitable" style="textbackground-aligncolor: left#ffffdc;width:800px;"|
|-
| '''263'''| <big>'''PI7Note: The pin header on the 40pin interface is not soldered by default, and you need to solder it yourself before it can be used.'''</big>| '''TWI1-SCL'''}| '''5'''|<span id="pin-gpio-port-test"></span>| '''6'''=== 40pin GPIO port test ===| '''GND'''| <ol style="textlist-alignstyle-type: leftdecimal;"|><li><p>The following uses pin No. 7 - corresponding to GPIO PI13 - corresponding to wPi serial number 2 - as an example to demonstrate how to set the high and low levels of the GPIO port.</p><p>[[File:zero2w-img171.png]]</p></li><li><p>First set the GPIO port to output mode, and the third parameter needs to be the serial number of the wPi corresponding to the input pin.</p>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| '''269'''| <p>root@orangepi:~/wiringOP# '''PI13'''| gpio mode <span style="color:#FF0000">2</span> out'''PWM3</UART4_TX'''p>| '''7'''}|</li>| '''8'''| '''UART0_TX'''<li><p>Then set the GPIO port to output a low level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 0v, it means the low level is set successfully.</p>{| '''PH0'''| '''224'''class="wikitable" style="width:800px;"
|-
| style="text-align<p>root@orangepi: left;"|| ~/wiringOP# '''gpio write 2 <span style="text-aligncolor: left;#FF0000"|| '''GND'''| '''9>0</span>'''</p>|}| '''10'''| '''UART0_RX'''</li>| '''PH1'''<li><p>Then set the GPIO port to output a high level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 3.3v, it means the setting of the high level is successful.</p>{| '''225'''class="wikitable" style="width:800px;"
|-
| <p>root@orangepi:~/wiringOP# '''226gpio write 2 <span style="color:#FF0000">1</span>'''</p>| '''PH2'''}</li><li><p>The setting method for other pins is similar. You only need to modify the serial number of wPi to the serial number corresponding to the pin.</p></li></ol> | '''UART5_TX'''<span id="how-to-set-the-pull-down-resistor-of-40-pin-gpio-port"></span>| '''11'''|=== How to set the pull-down resistor of 40 Pin GPIO port ===| '''12'''| <ol style="textlist-style-aligntype: leftdecimal;"|><li><p>The following uses pin No. 7—corresponding to GPIO PI13—corresponding to wPi serial number 2—as an example to demonstrate how to set the pull-up and pull-down resistors of the GPIO port.</p><p>[[File:zero2w-img171.png]]</p></li>| '''PI1'''<li><p>First, you need to set the GPIO port to input mode, and the third parameter needs to be the serial number of the wPi corresponding to the input pin.</p>{| '''257'''class="wikitable" style="width:800px;"
|-
| '''227'''| <p>root@orangepi:~/wiringOP# '''PH3gpio mode <span style="color:#FF0000">2</span> in'''</p>| '''UART5_RX'''}| '''13'''</li>|| '''14'''| '''GND'''<li><p>After setting to input mode, execute the following command to set the GPIO port to pull-up mode.</p>{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| <p>root@orangepi:~/wiringOP# '''261gpio mode <span style="color:#FF0000">2</span> up'''</p>|}</li><li><p>Then enter the following command to read the level of the GPIO port. If the level is 1, it means that the pull-up mode is set successfully.</p>{| class="wikitable" style="width:800px;" | -| <p>root@orangepi:~/wiringOP# '''gpio read <span style="color:#FF0000">2</span>'''</p><p>'''PI5<span style="color:#FF0000">1</span>'''</p>|}</li><li><p>Then execute the following command to set the GPIO port to pull-down mode</p>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP# '''TWI0_SCLgpio mode <span style="color:#FF0000">2</UART2_TXspan> down'''</p>|}</li><li><p>Then enter the following command to read the level of the GPIO port. If the level is 0, it means that the pull-down mode is set successfully.</p>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP# '''gpio read <span style="color:#FF0000">2</span>'''</p><p>'''15<span style="color:#FF0000">0</span>'''</p>|}</li></ol> <span id="pin-spi-test"></span> === 40pin SPI test === # As can be seen from the table below, the spi available for the 40pin interface is spi1, and there are two chip select pins cs0 and cs1 <div style="display: flex;">::{|class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''16GPIO NO.'''| '''PWM4/UART4_RXGPIO'''| '''PI14Function'''| '''270pin'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''17'''|| '''18'''| style="text-align: left;"|| '''PH4'''| '''2281'''
|-
| '''231264'''| '''PH7PI8'''| '''SPI1_MOSI'''| '''19TWI1-SDA'''|| '''203'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''232263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|-| '''269'''| '''PI13'''| '''PWM3/UART4_TX'''| '''7'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''9'''|-| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-| '''261'''| '''PI5'''| '''TWI0_SCL/UART2_TX'''| '''15'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''17'''|-| '''<span style="color:#FF0000">231</span>'''| '''PH8<span style="color:#FF0000">PH7</span>'''| '''SPI1_MISO<span style="color:#FF0000">SPI1_MOSI</span>'''| '''21<span style="color:#FF0000">19</span>'''|-| '''22<span style="color:#FF0000">232</span>'''| '''TWI0_SDA<span style="color:#FF0000">PH8</UART2_RXspan>'''| '''PI6<span style="color:#FF0000">SPI1_MISO</span>'''| '''262<span style="color:#FF0000">21</span>'''
|-
| '''<span style="color:#FF0000">230</span>'''| '''<span style="color:#FF0000">PH6</span>'''| '''<span style="color:#FF0000">SPI1_CLK</span>'''| '''<span style="color:#FF0000">23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229</span>'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|-
| '''266'''
| '''TWI2-SDA/UART3_RX'''
| '''27'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|}
|-
| '''Multiplexing function in 40pinpin'''| '''Corresponding dtbo configurationFunction'''| '''GPIO'''| '''GPIO NO.'''
|-
| '''40pin - i2c02'''| '''pi-i2c05V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - i2c1'''| '''pi-i2c1'''|-| '''40pin - i2c24'''| '''pi-i2c25V'''|} [[File:zero2w-img173.png]] <ol start="5" style="list-styletext-typealign: lower-alphaleft;">|<li><p>Then select <span class="mark"><Save></span> to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''<Back>'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''<Reboot>''' to restart the system to make the > configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol> <!-- --><ol start="3" style="list-style-type: decimal;"><li><p>After starting the Linux system, first confirm that there is an open i2c device node under /dev</p><p>orangepi@orangepi:~$ '''ls /dev/i2c-*'''</p><p>'''/dev/i2c-*'''</p><p>'''Sometimes the i2c device node and the i2c bus serial number do not correspond one to one. For example, the i2c device node of the i2c1 bus may be /dev/i2c-3.'''</p><p>'''The method to accurately confirm the device node under /dev corresponding to the i2c bus is: '''</p></li></ol> <!-- --><ol style="list-style-type: lower-alpha;"><li><p>'''First run the following command to check the corresponding relationship of i2c'''</p><p>orangepi@orangepizero2w:~$ '''ls /sys/devices/platform/soc*/*/i2c-* | grep "i2c-[0-9]"'''</p><p>/sys/devices/platform/soc/5002000.i2c/i2c-0:</p><p>/sys/devices/platform/soc/5002400.i2c/i2c-3:</p><p>/sys/devices/platform/soc/5002800.i2c/i2c-4:</p><p>/sys/devices/platform/soc/5002c00.i2c/i2c-5:</p><p>/sys/devices/platform/soc/6000000.hdmi/i2c-2:</p><p>/sys/devices/platform/soc/7081400.i2c/i2c-1:</p></li><li><p>'''In the above output'''</p></li></ol> <!-- --><ol style="list-style-type: lower-alpha;"><li><p>5002000 is the register base address of the i2c0 bus, and i2c-0 shown behind it is its corresponding i2c device node</p></li><li><p>5002400 is the register base address of the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li><li><p>5002800 is the register base address of the i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p></li></ol> <!-- --><ol start="4" style="list-styletext-typealign: decimalleft;"><li><p>Then start testing i2c, first install i2c-tools</p><p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y i2c-tools'''</p></li><li><p>Then connect an i2c device to the i2c pin of the 40pin connector</p></li><li><p>Then use the '''i2cdetect -y x''' x command. If the address of the connected i2c device can be detected, it means that i2c can be used normally.</p><p>'''Note that x in the i2cdetect -y x command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p><p>'''Different i2c device addresses are different. The 0x50 address in the picture below is just an example. Please refer to what you actually see.'''</p><div class="figure"> [[File:zero2w-img174.png]] </div></li></ol> <span id="pin-uart-test"></span>=== 40pin UART test === # As can be seen from the table below, the available uarts are uart2, uart3, uart4 and uart5. Please note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial port. {| class="wikitable"|-| '''GPIO NO.'''| '''GPIO'''| '''Function'''| '''pin'''|| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''
|-
| '''6'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''| '''1'''|| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''264'''| '''PI8'''| '''TWI1-SDA'''| '''3'''|| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|| '''6'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''269'''| '''PI13'''| '''PWM3/UART4_TX'''| '''7'''|| '''8'''
| '''UART0_TX'''
| '''PH0'''
| '''224'''
|-
| '''10'''
| '''UART0_RX'''
| '''225'''
|-
| '''12'''
| style="text-align: left;"|
| '''257'''
|-
| '''14'''
| '''GND'''
| style="text-align: left;"|
|-
| '''16'''
| '''PWM4/UART4_RX'''
| '''270'''
|-
| '''18'''
| style="text-align: left;"|
| '''228'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''22'''
| '''TWI0_SDA/UART2_RX'''
| '''262'''
|-
| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''<span style="color:#FF0000">24</span>'''| '''<span style="color:#FF0000">SPI1_CS0</span>'''| '''<span style="color:#FF0000">PH5</span>'''| '''<span style="color:#FF0000">229</span>'''
|-
| '''<span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"|| '''GND'''| '''25'''|| '''>26</span>'''| '''<span style="color:#FF0000">SPI1_CS1</span>'''| '''<span style="color:#FF0000">PH9</span>'''| '''<span style="color:#FF0000">233</span>'''
|-
| '''28'''
| '''TWI2-SCL/UART3_TX'''
| '''265'''
|-
| '''30'''
| '''GND'''
| style="text-align: left;"|
|-
| '''32'''
| '''PWM1'''
| '''267'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
|-
| '''36'''
| style="text-align: left;"|
| '''76'''
|-
| '''38'''
| style="text-align: left;"|
| '''260'''
|-
| '''40'''
| style="text-align: left;"|
|}
</div>
<ol start="2" style="list-style-type: decimal;"><li><p>In Linux systems, uart spi1 is turned off by default and needs to be turned on manually before it can be used. The opening steps are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First run '''orangepi-config'''. Ordinary users remember to add > '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li>
<li><p>Then select '''System'''</p>
<p>[[File:zero2w-img80.png]]</p></li>
<li><p>Then select '''Hardware'''</p>
<p>[[File:zero2w-img81.png]]</p></li>
<li><p>Then use the keyboard's arrow keys to locate the position shown > in the picture figure below, and then use the '''space''' to select the > serial port dtbo configuration of the SPI you want to open.</p></li></ol></li></ol>
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''Multiplexing function in 40pindtbo configuration'''| '''Corresponding dtbo configurationillustrate'''
|-
| '''40pin spi1- uart2cs0-cs1-spidev'''| '''pi-uart2Open cs0 and cs1 of spi1 at the same time'''
|-
| '''40pin spi1- uart3cs0-spidev'''| '''pi-uart3Only open cs0 of spi1'''
|-
| '''40pin spi1- uart4'''| '''pics1-uart4spidev'''|-| '''40pin - uart5'''| '''ph-uart5Only open cs1 of spi1'''
|}
[[File:zero2w-img175img172.png]]</ol>
<ol start="5" style="list-style-type: lower-alpha;">
<li><p>Then select '''<Save>''' to save</p>
<li><p>Then select '''<Back>'''</p>
<p>[[File:zero2w-img84.png]]</p></li>
<li><p>Then select '''<Reboot>''' to restart the system to make the > configuration take effect.</p>
<p>[[File:zero2w-img85.png]]</p></li></ol>
</li></ol>
<ol start="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>
<span id="pin-i2c-test"></span>
# As can be seen from the following tablebelow, the i2c available pwm for the 40pin interface are pwm1, pwm2i2c0, pwm3 i2c1 and pwm4.i2c2
<div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO NO.'''
| '''GPIO'''
| '''Function'''
| '''Pin'''|| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.pin'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-| '''2<span style="color:#FF0000">264</span>'''| '''5V<span style="color:#FF0000">PI8</span>'''| '''<span style="color:#FF0000">TWI1-SDA</span>'''| '''<span style="color:#FF0000">3</span>'''|-| '''<span style="color:#FF0000">263</span>'''| '''<span style="color:#FF0000">v</span>'''| '''<span style="color:#FF0000">TWI1-SCL</span>'''| '''<span style="color:#FF0000">5</span>'''|-| '''269'''| '''PI13'''| '''PWM3/UART4_TX'''| '''7'''|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''9'''
|-
| '''11'''
|-
| '''227'''
| '''UART5_RX'''
| '''13'''
|-
| '''<span style="color:#FF0000">261</span>'''| '''<span style="color:#FF0000">PI5</span>'''| '''<span style="color:#FF0000">TWI0_SCL</span>/UART2_TX'''| '''<span style="color:#FF0000">15'''|| '''16'''| '''PWM4</UART4_RX'''| '''PI14'''| '''270span>'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
| '''PH7'''
| '''SPI1_MOSI'''
| '''19'''
|-
| '''232'''
| '''SPI1_MISO'''
| '''21'''
|-
| '''230'''
| '''SPI1_CLK'''
| '''23'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|-
| '''<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'''
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''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'''|-| '''4012'''
| style="text-align: left;"|
| '''PI3PI1'''| '''259257'''|}-| '''14'''<ol start="2" | '''GND'''| style="list-styletext-typealign: decimalleft;">|<li><p>pwm is turned off by default in Linux systems and needs to be turned on manually to use it. The opening steps are as follows:</p><ol | style="listtext-style-typealign: lower-alphaleft;">||-<li><p>First run | '''orangepi-config16'''. Ordinary users remember to add > | '''sudoPWM4/UART4_RX''' permissions.</p><p>orangepi@orangepi:~$ | '''sudo orangepi-configPI14'''</p></li><li><p>Then select | '''System270'''</p><p>[[File:zero2w|-img80.png]]</p></li><li><p>Then select | '''Hardware18'''</p><p>[[File| style="text-align:zero2w-img81.png]]</p></li>left;"|<li><p>Then use the keyboard| '''PH4'''s arrow keys to locate the position shown > in the figure below, and then use the | '''space228''' to select the > configuration corresponding to the pwm you want to open.</p><p>[[File:zero2w|-img176.png]]</p></li><li><p>Then select | '''<Save>20''' to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select | '''GND'''<| style="text-align: left;Back>"|| style="text-align: left;"||-| '''</p><p>[[Filespan style="color:zero2w-img84.png]]</p#FF0000">22</li><li><pspan>Then select '''<Reboot>| ''' to restart the system to make the > configuration take effect.</p><p>[[Filespan style="color:zero2w-img85.png]]</p#FF0000">TWI0_SDA</lispan></ol>UART2_RX'''| '''</li><li><pspan style="color:#FF0000">After restarting, you can start the PWM testPI6</p><pspan>'''Please execute the following commands under the root user.| '''</p><ol span style="list-style-typecolor: lower-alpha;#FF0000"><li><p>Enter the following command on the command line to make pwm1 > output a 50Hz square wave262</pspan>'''|-| '''24'''| '''SPI1_CS0'''| '''PH5'''<p>root@orangepi:~# | '''229'''|-| '''echo 1 > /sys/class/pwm/pwmchip0/export26'''</p><p>root@orangepi:~# | '''echo 20000000 > /sys/class/pwm/pwmchip0/pwm1/periodSPI1_CS1'''</p><p>root@orangepi:~# | '''echo 1000000 > /sys/class/pwm/pwmchip0/pwm1/duty_cyclePH9'''</p><p>root@orangepi:~# | '''233'''echo 1 > /sys/class/pwm/pwmchip0/pwm1/enable|-| '''</pspan style="color:#FF0000">28</lispan>'''| '''<lispan style="color:#FF0000"><p>Enter the following command on the command line to make pwm2 > output a 50Hz square waveTWI2-SCL</pspan></li></ol>UART3_TX'''| '''</lispan style="color:#FF0000">PI9</olspan> root@orangepi:~# '''echo 2 > /sys/class/pwm/pwmchip0/export| ''' root@orangepi<span style="color:~# '''echo 20000000 > FF0000">265</sys/class/pwm/pwmchip0/pwm2/periodspan>'''|-root@orangepi:~# | '''echo 1000000 > /sys/class/pwm/pwmchip0/pwm2/duty_cycle30''' root@orangepi:~# | '''echo 1 > /sys/class/pwm/pwmchip0/pwm2/enableGND''' <ol start| style="3text-align: left;" || style="listtext-style-typealign: lower-alphaleft;">|<li>Enter the following command on the command line to make pwm3 output > a 50Hz square wave</li></ol>|-| '''32'''root@orangepi:~# | '''echo 3 > /sys/class/pwm/pwmchip0/exportPWM1'''| '''PI11'''root@orangepi:~# | '''echo 20000000 > /sys/class/pwm/pwmchip0/pwm3/period267'''|-root@orangepi:~# | '''echo 1000000 > /sys/class/pwm/pwmchip0/pwm3/duty_cycle34''' root@orangepi:~# | '''echo 1 > /sys/class/pwm/pwmchip0/pwm3/enableGND''' <ol start| style="4text-align: left;" || style="list-styletext-typealign: lower-alphaleft;">|<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/export36'''| style="text-align: left;"|root@orangepi:~# | '''echo 20000000 > /sys/class/pwm/pwmchip0/pwm4/periodPC12''' root@orangepi:~# | '''echo 1000000 > /sys/class/pwm/pwmchip0/pwm4/duty_cycle76'''|-root@orangepi:~# | '''echo 1 > /sys/class/pwm/pwmchip0/pwm4/enable38''' <div class| style="figuretext-align: left;">|| '''PI4'''| '''260'''[[File:zero2w|-img177.png]]| '''40'''</div><span id| style="howtext-to-install-and-use-wiringop-pythonalign: left;">|| '''PI3'''| '''259'''|}</spandiv>== How to install and use wiringOP-Python ==
{| class="wikitable" style="width:800px;text-align: center;"|-| '''Multiplexing function in 40pin'''| '''Corresponding dtbo configuration'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''40pin - i2c0'''| '''pi-i2c0'''|-| '''40pin - i2c1'''| '''pi-i2c1'''|-| '''40pin - i2c2'''| '''pi-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 '''<Back>'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''<Reboot>'Also please note '' to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol></li></ol><ol start="3" style="list-style-type: decimal;"><li><p>After starting the Linux system, first confirm that all there is an open i2c device node under /dev</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''ls /dev/i2c-*'''</p><p>'''/dev/i2c-*'''</p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Sometimes the following commands are operated 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 root user.i2c bus is: '''</p></big>
<ol style="list-style-type: decimallower-alpha;"><li><p>'''First install dependency packagesrun the following command to check the corresponding relationship of i2c'''</p><p>rootorangepi@orangepiorangepizero2w:~# $ '''sudo aptls /sys/devices/platform/soc*/*/i2c-* | grep "i2c-[0-get update9]"'''</p><p>root@orangepi/sys/devices/platform/soc/5002000.i2c/i2c-0:~# '''sudo apt</p><p>/sys/devices/platform/soc/5002400.i2c/i2c-get -y install git swig python3-dev python3-setuptools'''3:</p><p>/sys/devices/platform/lisoc/5002800.i2c/i2c-4:</p><lip>/sys/devices/platform/soc/5002c00.i2c/i2c-5:</p><p>Then use the following command to download the source code of wiringOP/sys/devices/platform/soc/6000000.hdmi/i2c-Python2:</p><p>/sys/devices/platform/soc/7081400.i2c/i2c-1:</lip></olli>
|-
| '''GPIO NO.226'''| '''GPIOPH2'''| '''FunctionUART5_TX'''| '''Pin11'''|-| '''Pin227'''| '''FunctionPH3'''| '''GPIOUART5_RX'''| '''GPIO NO.13'''|-| '''261'''| '''PI5'''| '''TWI0_SCL/UART2_TX'''| '''15'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''117'''|-| '''2231'''| '''5VPH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|-| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''25'''
|-
| '''264266'''| '''PI8PI10'''| '''TWI1TWI2-SDA/UART3_RX'''| '''327'''|-| '''256'''| '''PI0'''| style="text-align: left;"|| '''29'''|-| '''271'''| '''PI15'''| style="text-align: left;"|| '''31'''|-| '''268'''| '''PI12'''| '''PWM2'''| '''33'''|-| '''258'''| '''PI2'''| style="text-align: left;"|| '''35'''|-| '''272'''| '''PI16'''| style="text-align: left;"|| '''37'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''39'''|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''4'''| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''6'''
| '''GND'''
| style="text-align: left;"|
|-
| '''8'''
| '''UART0_TX'''
| '''224'''
|-
| '''10'''
| '''UART0_RX'''
| '''225'''
|-
| '''12'''
| style="text-align: left;"|
| '''257'''
|-
| '''14'''
| '''GND'''
| style="text-align: left;"|
|-
| '''PWM4/UART4_RX'''
| '''PI14'''
| '''270'''
|-
| '''18'''
| style="text-align: left;"|
| '''228'''
|-
| '''20'''
| '''GND'''
| style="text-align: left;"|
|-
| '''22'''
| '''TWI0_SDA/UART2_RX'''
| '''262'''
|-
| '''24'''
| '''SPI1_CS0'''
| '''229'''
|-
| '''26'''
| '''SPI1_CS1'''
| '''233'''
|-
| '''28'''
| '''TWI2-SCL/UART3_TX'''
| '''265'''
|-
| '''30'''
| '''GND'''
| style="text-align: left;"|
|-
| '''32'''
| '''PWM1'''
| '''267'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
|-
| '''36'''
| style="text-align: left;"|
| '''76'''
|-
| '''38'''
| style="text-align: left;"|
| '''260'''
|-
| style="text-align: left;"|
| '''PI3'''
| '''259'''
|}
</div>
<ol start="2" style="list-style-type: decimal;">
<li><p>In Linux systems, spi1 uart is turned off by default and needs to be turned on manually before it can be used. The opening steps are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First run '''orangepi-config'''. Ordinary users remember to add > '''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 > dtbo configuration of the SPI serial port you want to open.</p></li></ol></li></ol>
{| class="wikitable"style="width:800px;text-align: center;"|-| '''Multiplexing function in 40pin'''| '''Corresponding dtbo configuration'''
|-
| '''dtbo configuration40pin - uart2'''| '''illustratepi-uart2'''
|-
| '''spi140pin -cs0-cs1-spidevuart3'''| '''Open cs0 and cs1 of spi1 at the same timepi-uart3'''
|-
| '''spi140pin -cs0-spidevuart4'''| '''Only open cs0 of spi1pi-uart4'''
|-
| '''spi140pin -cs1-spidevuart5'''| '''Only open cs1 of spi1ph-uart5'''
|}
[[File:zero2w-img175.png]]
</ol>
<ol start="5" style="list-style-type: lower-alpha;">
<li><p>Then select '''<Save>''' to save</p>
<li><p>Then select '''<Back>'''</p>
<p>[[File:zero2w-img84.png]]</p></li>
<li><p>Then select '''<Reboot>''' to restart the system to make the > configuration take effect.</p>
<p>[[File:zero2w-img85.png]]</p></li></ol>
</li></ol>
<!-- -->
<ol start="3" style="list-style-type: decimal;">
<li><p>Then check After entering the Linux system, first confirm whether there is a '''spidev1.x''' uart5 device node in the Linux system. If it exists, it means that the SPI1 configuration has taken effect.</p><p>orangepi@orangepi:~$ under '''ls /dev/spidev1*'''</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <p>/dev/spidev1.0 /dev/spidev1.1</pbig><p>'''Note that only when you open spi1-cs0-cs1-spidev, you will see the device nodes of the two spilinux5.4 system is /dev/ttyASx.'''</p></libig><li><p>Then you can use the '''spidev_test.py''' program in examples to test the SPI loopback function. The '''spidev_test.py''' program needs to specify the following two parameters:</p>|}<ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li>|-| <p>orangepi@orangepi:~$ '''--channells /dev/ttyS*''': Specify the channel number of SPI</p></li><li><p>'''--port''': Specify the port number of the SPI</p><dev/li>ttySx</olp>|}
</li>
<li><p>Without shorting Then start testing the mosi uart interface. First use Dupont wire to short-circuit the rx and miso tx pins of SPI1, the output result uart interface to be tested.</p></li><li><p>Use the '''gpio''' command in wiringOP to test the loopback function of running spidev_test.py is the serial port as followsshown below. You If you can see the following print, it means the serial port communication is normal.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that the data last x in the gpio serial /dev/ttySx command needs to be replaced with the serial number of TX and RX are inconsistentthe corresponding uart device node.'''</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>rootorangepi@orangepi:~/wiringOP-Python# $ '''cd examplesgpio serial /dev/ttySx # linux-6.1 test command'''</p><p>orangepi@orangepi:~$ '''gpio serial /li>dev/ttyASx # linux-5.4 test command'''</olp>
<div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO NO.'''
| '''Function'''
| '''Pin'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-
| '''264'''
| '''TWI1-SDA'''
| '''3'''
|-
| '''263'''
| '''TWI1-SCL'''
| '''5'''
|-| '''6'''| '''GND'''| <span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"||-| '''>269</span>'''| '''<span style="color:#FF0000">PI13</span>'''| '''<span style="color:#FF0000">PWM3</span>/UART4_TX'''| '''<span style="color:#FF0000">7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224</span>'''|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''9'''
|-
| '''226'''
| '''UART5_TX'''
| '''11'''
|-
| '''227'''
| '''UART5_RX'''
| '''13'''
|-
| '''261'''
| '''TWI0_SCL/UART2_TX'''
| '''15'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|-
| '''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'''
| '''PI0'''
| style="text-align: left;"|
| '''29'''
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|-
| '''<span style="color:#FF0000">268</span>'''| '''<span style="color:#FF0000">PI12</span>'''| '''<span style="color:#FF0000">PWM2</span>'''| '''33'''|| '''34'''| '''GND'''| <span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"|>33</span>'''
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|-
| '''272'''
| 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 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'''|- i2c1| '''14'''| '''piGND'''| style="text-i2c1align: left;"|| style="text-align: left;"||-| '''<span style="color:#FF0000">16</span>'''| '''<span style="color:#FF0000">PWM4</span>/UART4_RX'''| '''<span style="color:#FF0000">PI14</span>'''| '''<span style="color:#FF0000">270</span>'''
|-
| '''40pin - i2c2'''| '''pi-i2c218'''|} [[File:zero2w-img173.png]] <ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select <span class="mark"><Save></span> to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select <span class="mark"><Back></span></p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select <span class="mark"><Reboot></span> to restart the system to make the > configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol> <!-- --><ol start="3" style="list-style-type: decimal;"><li><p>After starting the Linux system, first confirm that there is an open i2c device node under <span class="mark">/dev</span></p><p>orangepi@orangepi:~$ '''ls /dev/i2c-*'''</p><p>'''/dev/i2c-*'''</p><p>'''Sometimes the i2c device node and the i2c bus serial number do not correspond one to one. For example, the i2c device node of the i2c1 bus may be /dev/i2c-3.'''</p><p>'''The method to accurately confirm the device node under /dev corresponding to the i2c bus is:'''</p></li></ol> <!-- --><ol start="3" style="list-style-type: lower-alpha;"><li><p>'''First run the following command to check the corresponding relationship of i2c'''</p><p>orangepi@orangepizero2w:~$ '''ls /sys/devices/platform/soc*/*/i2c-* | grep "i2c-[0-9]"'''</p><p>/sys/devices/platform/soc/5002000.i2c/i2c-0:</p><p>/sys/devices/platform/soc/5002400.i2c/i2c-3:</p><p>/sys/devices/platform/soc/5002800.i2c/i2c-4:</p><p>/sys/devices/platform/soc/5002c00.i2c/i2c-5:</p><p>/sys/devices/platform/soc/6000000.hdmi/i2c-2:</p><p>/sys/devices/platform/soc/7081400.i2c/i2c-1:</p></li><li><p>'''In the above output'''</p></li></ol> <!-- --><ol start="4" style="list-style-type: lower-alpha;"><li><p>002000 is the register base address of the i2c0 bus, and i2c-0 shown behind it is its corresponding i2c device node</p></li><li><p>5002400 is the register base address of the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li><li><p>5002800 is the register base address of the i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p></li></ol> <!-- --><ol start="4" style="list-styletext-typealign: decimalleft;"><li><p>Then start testing i2c, first install i2c-tools</p><p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo''' '''apt-get install -y i2c-tools'''</p></li><li><p>Then connect an i2c device to the i2c pin of the 40pin connector. Here we take the DS1307 RTC module as an example.</p><p>[[File:zero2w-img178.png]]</p></li><li><p>Then use the '''i2cdetect -y x'''command. If the address of the connected i2c device can be detected, it means that the i2c device is connected correctly.</p><p>'''Note that x in the i2cdetect -y x command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p></li></ol> [[File:zero2w-img179.png]] <ol start="7" style="list-style-type: decimal;"><li><p>Then you can run the '''ds1307.py''' test program in '''examples''' to read the RTC time</p><p>'''Note that the x in i2c-x in the following command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p><p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p><p>root@orangepi:~/wiringOP-Python/examples# '''python3 ds1307.py --device \'''</p><p>'''"/dev/i2c-x"'''</p><p>Thu 2022-06-16 04:35:46</p><p>Thu 2022-06-16 04:35:47</p><p>Thu 2022-06-16 04:35:48</p><p>^C</p><p>exit</p></li></ol> <span id="pin-uart-test-1"></span>=== 40pin UART test === # As can be seen from the table below, the available uarts are uart2, uart3, uart4 and uart5. Please note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial port. {| class="wikitable"|-| '''GPIO NO.'''| '''GPIO'''| '''Function'''| '''Pin'''|| '''Pin'''| '''Function'''| '''GPIOPH4'''| '''GPIO NO.228'''
|-
| '''20'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26422'''| '''PI8TWI0_SDA/UART2_RX'''| '''TWI1PI6'''| '''262'''|-SDA| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''3229'''|-| '''426'''| '''5VSPI1_CS1'''| '''PH9'''| '''233'''| style="text-align: left;"|'''28'''| style="text'''TWI2-align: left;"SCL/UART3_TX'''|'''PI9'''| '''265'''
|-
| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|| '''630'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''269<span style="color:#FF0000">32</span>'''| '''PI13<span style="color:#FF0000">PWM1</span>'''| '''PWM3<span style="color:#FF0000">PI11</UART4_TXspan>'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224<span style="color:#FF0000">267</span>'''
|-
| '''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><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 '''SPI1_MOSIspace'''to select the configuration corresponding to the pwm you want to open.</p>| <p>[[File:zero2w-img176.png]]</p></li><li><p>Then select '''19<Save>'''to save</p>|<p>[[File:zero2w-img83.png]]</p></li>| <li><p>Then select '''20<Back>'''</p>| <p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''GND<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>{| styleclass="text-align: left;wikitable"|| style="textbackground-aligncolor:#ffffdc;width: left800px;"|
|-
| '''232'''| <big><p>'''PH8Please execute the following commands under the root user.'''</p></big>| '''SPI1_MISO'''}| '''21'''|<ol style="list-style-type: lower-alpha;">| '''22'''| '''TWI0_SDA<li><p>Enter the following command on the command line to make pwm1 output a 50Hz square wave</UART2_RX'''| '''PI6'''p>{| '''262'''class="wikitable" style="width:800px;"
|-
| <p>root@orangepi:~# '''230echo 1 > /sys/class/pwm/pwmchip0/export'''</p>| <p>root@orangepi:~# '''PH6echo 20000000 > /sys/class/pwm/pwmchip0/pwm1/period'''</p>| <p>root@orangepi:~# '''SPI1_CLKecho 1000000 > /sys/class/pwm/pwmchip0/pwm1/duty_cycle'''</p>| <p>root@orangepi:~# '''23echo 1 > /sys/class/pwm/pwmchip0/pwm1/enable'''</p>|}| '''24'''| '''SPI1_CS0'''</li>| '''PH5'''<li><p>Enter the following command on the command line to make pwm2 output a 50Hz square wave</p></li>{| '''229'''class="wikitable" style="width:800px;"
|-
|-
| root@orangepi:~# '''266echo 3 > /sys/class/pwm/pwmchip0/export'''| root@orangepi:~# '''PI10echo 20000000 > /sys/class/pwm/pwmchip0/pwm3/period'''| root@orangepi:~# '''TWI2-SDAecho 1000000 > /sys/class/pwm/pwmchip0/pwm3/UART3_RXduty_cycle'''| root@orangepi:~# '''27echo 1 > /sys/class/pwm/pwmchip0/pwm3/enable'''|}| '''28'''</ol>| '''TWI2<ol start="4" style="list-style-type: lower-SCLalpha;"><li>Enter the following command on the command line to make pwm4 output a 50Hz square wave</UART3_TX'''li>{| '''PI9'''| '''265'''class="wikitable" style="width:800px;"
|-
| root@orangepi:~# '''256echo 4 > /sys/class/pwm/pwmchip0/export'''| root@orangepi:~# '''PI0echo 20000000 > /sys/class/pwm/pwmchip0/pwm4/period'''| style="text-alignroot@orangepi: left;"|| ~# '''29echo 1000000 > /sys/class/pwm/pwmchip0/pwm4/duty_cycle'''|| root@orangepi:~# '''30echo 1 > /sys/class/pwm/pwmchip0/pwm4/enable'''| '''GND'''} <div class="figure"> [[File:zero2w-img177.png]] </div></ol></li></ol>| style<span id="texthow-to-install-and-use-wiringop-align: left;python"|></span> == How to install and use wiringOP-Python == {| class="wikitable" style="textbackground-aligncolor:#ffffdc;width: left800px;"|
|-
| <big>'''271Note: The pin header on the 40pin interface is not soldered by default, and you need to solder it yourself before it can be used.'''</big>| '''PI15'''}{| class="wikitable" style="textbackground-aligncolor: left#ffffdc;width:800px;"|| '''31'''|| '''32'''| '''PWM1'''| '''PI11'''| '''267'''
|-
| <big>'''wiringOP-Python is the Python language version of wiringOP library, used to operate the development board'268s GPIO, I2C, SPI, UART and other hardware resources in the Python program'''| '''PI12Also please note that all the following commands are operated under the root user.'''</big>| '''PWM2'''}| '''33'''|<span id="how-to-install-wiringop-python"></span>| '''34'''=== How to install wiringOP-Python ===| '''GND'''| <ol style="textlist-style-aligntype: leftdecimal;"|><li><p>First install dependency packages</p>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| '''258'''| <p>root@orangepi:~# '''PI2sudo apt-get update'''</p>| style="text-align<p>root@orangepi: left;"|| ~# '''35sudo apt-get -y install git swig python3-dev python3-setuptools'''</p>|}</li>| '''36'''<li><p>Then use the following command to download the source code of wiringOP-Python</p></li>{| class="wikitable" style="textbackground-aligncolor:#ffffdc;width: left800px;"|| '''PC12'''| '''76'''
|-
| <big>'''272Note 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.'''| '''PI16'''| style="textIf there is a problem downloading the code from GitHub, you can directly use the wiringOP-alignPython source code that comes with the Linux image. The storage location is: left;"|| '''37/usr/src/wiringOP-Python'''</big>|}{| '''38'''| class="wikitable" style="text-alignwidth: left800px;"|| '''PI4'''| '''260'''
|-
root@orangepi:~/wiringOP-Python# '''git submodule update --init --remote'''|}</ol><ol start="3" style="list-style-type: decimal;"><li><p>Then use the following command to compile wiringOP-Python and install it into the Linux system of the development board</p>{| class="wikitable" style="width:800px;"
|-
| <p>root@orangepi:~# '''cd wiringOP-Python'''</p><p>root@orangepi:~/wiringOP-Python# ''Multiplexing function in 40pin'python3 generate-bindings.py > bindings.i'''</p><p>root@orangepi:~/wiringOP-Python# '''sudo python3 setup.py install'''</p>| }</li><li><p>Then enter the following command. If helpful information is output, it means wiringOP-Python is successfully installed. Press the '''Corresponding dtbo configurationq'''key to exit the help information interface.</p></li>{| class="wikitable" style="width:800px;"
|-
| '''40pin - uart2'''| '''piroot@orangepi:~/wiringOP-uart2Python# '''|python3 -| '''40pin - uart3c "import wiringpi; help(wiringpi)"'''| '''pi-uart3'''|-| '''40pin - uart4'''Help on module wiringpi:| '''pi-uart4'''|-| '''40pin - uart5'''NAME| '''ph-uart5'''|}:wiringpi
: # the SWIG interface file instead.
|}
</ol>
<ol start="5" style="list-style-type: decimal;">
<li><p>The steps to test whether wiringOP-Python is installed successfully under the python command line are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The second parameter 10 represents First use the python3 command to enter the counting time command line mode of the watchdog. If the dog is not fed within this time, the system will restart.</p>> python3</li><li><p>We can feed the dog by pressing any key on the keyboard (except ESC). After feeding the dog, the program will print a line "{| class="wikitable" style="width:800px;keep alive" to indicate that the dog feeding is successful.</p>" |-| <p>orangepiroot@orangepi:~$ # '''sudo watchdog_test 10python3'''</p><p>open success|}</pol><p>options is 33152,identity is sunxiol start="2" style="list-style-type: lower-wdt</palpha;"><pli>put_usr return,if 0,success:0Then import the python module of wiringpi</pli><p>The old reset time is{| class="wikitable" style="width: 16800px;" |-| >>> '''import wiringpi;'''|}</pol><p>return ENOTTY,if ol start="3" style="list-style-1,successtype:0</plower-alpha;"><pli>return ENOTTYFinally,if enter the following command to view the help information of > wiringOP-1,success:0Python. Press the q key to exit the help information > interface.</pli><p>put_user return,if 0,success{| class="wikitable" style="width:0</p>800px;" |-| <p>put_usr return,if 0,success:0</p>>>> '''help(wiringpi)'''<p>keep alive</p><p>keep alive</p>Help on module wiringpi:<p>keep alive</p></li></ol>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''This message shows that your installation appears Like wiringOP, wiringOP-Python can also determine which GPIO pin to be working correctlyoperate 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>
<ol style="list-style-type: decimal;">
<li><p>First, please install docker and ensure that docker can run normallyThe following uses pin No. For 7 - corresponding to GPIO PI13 - corresponding to wPi serial number 2 - as an example to demonstrate how to set the installation steps high and low levels of docker, please refer to the instructions in the GPIO port.</p><p>[[\l|'''How to Install Docker'''File:zero2w-img171.png]] section.</p></li><li><p>Then you can search The steps for the docker image of Home Assistanttesting directly with commands are as follows:</p><p>orangepi@orangepiol style="list-style-type:~$ '''docker search homeassistant'''</p></lilower-alpha;"><li><p>Then use First set the following command GPIO port to download output mode, where the first parameter of the '''pinMode''' function is the Docker image serial number of Home Assistant the wPi corresponding to your local computer. The image size is about 1GBthe pin, and the download time will be relatively long. Please be patient and wait for second parameter is the download to completeGPIO mode.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepiroot@orangepi:~$ /wiringOP-Python# '''docker pull homeassistant/homepython3 -assistantc "import wiringpi; \'''</p><p>Using default tag: latest'''from wiringpi import GPIO; wiringpi.wiringPiSetup() ; \'''</p><p>latest'''wiringpi.pinMode(<span style="color: Pulling from homeassistant#FF0000">2, GPIO.OUTPUT</home-assistantspan>) ; "'''</p>|}</li><li><p>be307f383ecc: DownloadingThen set the GPIO port to output a low level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 0v, it means the low level is set successfully.</p>{| class="wikitable" style="width:800px;" |-| <p>5fbc4c07ac88root@orangepi: Download complete~/wiringOP-Python# '''python3 -c "import wiringpi; \'''</p><p>'''from wiringpi import GPIO; wiringpi...... wiringPiSetup(Omit some output);\'''</p><p>3cc6a1510c9f'''wiringpi.digitalWrite(2, <span style="color: Pull complete</p#FF0000"><p>7a4e4d5b979f: Pull completeGPIO.LOW</pspan><p>Digest: sha256:81d381f5008c082a37da97d8b08dd8b358dae7ecf49e62ce3ef1eeaefc4381bb)"'''</p><p>Status: Downloaded newer image for homeassistant/home-assistant:latest</p>|}<p>docker.io/homeassistant/home-assistant:latest</p></li><li><p>Then set the GPIO port to output a high level. After setting, you can use a multimeter to measure the voltage value of the following command to view pin. If it is 3.3v, it means the docker image setting of Home Assistant you just downloadedthe high level is successful.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepiroot@orangepi:~$ /wiringOP-Python# '''docker images homeassistant/homepython3 -assistantc "import wiringpi; \'''</p><p>REPOSITORY TAG IMAGE ID CREATED SIZE'''from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\'''</p><p>homeassistant/home-assistant latest bfa0ab9e1cf5 2 months ago '''1wiringpi.17GBdigitalWrite(2, <span style="color:#FF0000">GPIO.HIGH</span>)"'''</p>|}</li></ol></li><li><p>At this point you can run The steps for testing in the command line of python3 are as follows:</p><ol style="list-style-type: lower-alpha;"><li><p>First use the python3 command to enter the Home Assistant docker containercommand line mode of python3</p>{| class="wikitable" style="width:800px;" |-| <p>orangepiroot@orangepi:~$ # '''docker run -d \python3'''</p>|}</li><li><p>'''--name homeassistant \'''Then import the python module of wiringpi</p>{| class="wikitable" style="width:800px;" |-| <p>>>> '''--privileged \import wiringpi'''</p><p>>>> '''--restart=unless-stopped \from wiringpi import GPIO'''</p>|}</li><li><p>Then set the GPIO port to output mode, where the first parameter of the '''-e TZ=Asia/Shanghai \pinMode'''function is the serial number of the wPi corresponding to the pin, and the second parameter is the GPIO mode.</p>{| class="wikitable" style="width:800px;" |-| <p>>>> '''-v /home/orangepi/home-assistant:/config \wiringpi.wiringPiSetup()'''</p><p>'''--network=host \'''0</p><p>>>> '''homeassistantwiringpi.pinMode(<span style="color:#FF0000">2, GPIO.OUTPUT</home-assistant:latestspan>)'''</p>|}</li><li><p>Then enter【the IP address set the GPIO port to output a low level. After setting, you can use a multimeter to measure the voltage value of the development board: 8123】in pin. If it is 0v, it means the browser to see the Home Assistant interfacelow level is set successfully.</p>{| class="wikitable" style="width:800px;" |-| <p>>>> '''It takes a while for wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.LOW</span>)'''</p>|}</li><li><p>Then set the Home Assistant container GPIO port to startoutput a high level. If the interface below does not display normallyAfter setting, please wait you can use a few seconds before refreshing itmultimeter to measure the voltage value of the pin. If the following interface it is not displayed normally after waiting for more than a minute3.3v, it means there is a problem with the Home Assistant installation. At this time, you need to check whether there setting of the high level is a problem with the previous installation and setting processsuccessful.'''</p><div {| class="figurewikitable" style=">width:800px;" |-| [[File<p>>>> '''wiringpi.digitalWrite(2, <span style="color:zero2w-img180#FF0000">GPIO.png]]HIGH</span>)'''</p>|}</divli></ol></li><li><p>Then enter your For wiringOP-Python to set the GPIO high and low levels in the python code, you can refer to the '''name, usernameblink.py''' and test program in the examples. The '''passwordblink.py''' test program will set the voltage of all GPIO ports in the 40 Pin of the development board to continuously change high and click '''Create Account'''low.</p><div {| class="figurewikitable" style="width:800px;"> [[File:zero2w|-img181.png]]| <p>root@orangepi:~/div>wiringOP-Python# '''cd examples'''</lip><lip>root@orangepi:~/wiringOP-Python/examples# '''ls blink.py'''</p><p>Then follow the interface prompts to set according to your own preferences, and then click Next'''blink.py'''</p><div class="figure"p> [[Fileroot@orangepi:zero2w~/wiringOP-img182Python/examples'''# python3 blink.png]] py'''</divp>|}</li><li><p>Then click Next</p><div class="figure"ol> [[File:zero2w-img183.png]]
</div></li><li><pspan id="pin-spi-test-1">Then click Finish</p><div class="figure"span>
<span iddiv style="installation-via-pythondisplay: flex;"></span>::{| class="wikitable" style== Installation via python === '''Before installation, please change the source of pip to a domestic source to speed up the installation of Python packages. For the configuration method, see the instructions in the section ""width:390px;[[\l|How to Change the Pip Source of Python]]"margin-right: 20px;''' <ol style="list-styletext-typealign: decimalcenter;"><li><p>First install dependency packages</p>|-<p>orangepi@orangepi:~$ | '''sudo apt-get updateGPIO NO.'''</p><p>orangepi@orangepi:~$ | '''sudo apt-get install -y python3 python3-dev python3-venv \GPIO'''</p><p>| '''python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \Function'''</p><p>| '''Pin'libopenjp2-7 libtiff5 libturbojpeg0-dev tzdata'''</p><p>'''If it is debian12, please use the following command|-| style="text-align:'''</p>left;"|<p>orangepi@orangepi| style="text-align:~$ left;"|| '''sudo apt-get update3.3V'''</p><p>orangepi@orangepi:~$ | '''sudo apt-get install -y python3 python3-dev python3-venv \1'''</p><p>|-| '''python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \264'''</p><p>| '''libopenjp2-7 libturbojpeg0-dev tzdataPI8'''| '''TWI1-SDA'''</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 method3''']] section.</p><p>|-| '''The default Python version of Debian Bullseye is Python3.9, so there is no need to compile and install it.263'''</p><p>| ''''The default Python version of Ubuntu Jammy is Python3.10, so there is no need to compile and install it.PI7'''</p><p>| '''The default Python version of Debian Bookworm is Python3.11, so there is no need to compile and install it.TWI1-SCL'''</p></li><li><p>Then create a Python virtual environment</p><p>| '''Debian Bookworm is python3.11, please remember to replace the corresponding command.5'''</p><p>orangepi@orangepi:~$ |-| '''sudo mkdir /srv/homeassistant269'''</p><p>orangepi@orangepi:~$ | '''sudo chown orangepi:orangepi /srv/homeassistantPI13'''</p><p>orangepi@orangepi:~$ '| '''cd /srvPWM3/homeassistantUART4_TX'''</p><p>orangepi@orangepi:~$ | '''python3.9 -m venv .7'''</p><p>orangepi@orangepi|-| style="text-align:~$ 'left;"|| style="text-align: left;"|| ''source bin/activate'GND'''</p><p>(homeassistant) orangepi@orangepi:/srv/homeassistant$</p></li>| '''9'''<li><p>Then install the required Python packages</p>|-<p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ | '''python3 -m pip install wheel226'''</p></li><li><p>Then you can install Home Assistant Core</p>| '''PH2'''<p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ | '''pip3 install homeassistantUART5_TX'''</p></li><li><p>Then enter the following command to run Home Assistant Core</p>| '''11'''|-<p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ | '''hass227'''</p></li><li><p>Then enter【| '''development board IP address: 8123PH3'''】 in the browser to see the Home Assistant interface</p><p>| '''When you run the hass command for the first time, some libraries and dependency packages necessary for operation will be downloaded, installed and cached. 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.UART5_RX'''</p><div class="figure">| '''13''' [[File:zero2w|-img180.png]]| '''261'''| '''PI5'''<| '''TWI0_SCL/div></li></ol>UART2_TX'''| '''15'''|-<span id| style="opencvtext-installation-methodalign: left;"></span>|| style== OpenCV installation method =="text-align: left;"|| '''3.3V'''| '''17'''|-| '''<span idstyle="use-apt-to-install-opencvcolor:#FF0000">231</span>'''=== Use apt to install OpenCV === | '''<ol span style="list-style-typecolor: decimal;#FF0000"><li><p>The installation command is as followsPH7</pspan><p>orangepi@orangepi:~$ '''sudo apt-get update| '''</pspan style="color:#FF0000">SPI1_MOSI<p/span>orangepi@orangepi:~$ '''sudo apt-get install -y libopencv-dev python3-opencv| '''</p></li><li><pspan style="color:#FF0000">Then use the following command to print the version number of OpenCV. The output is normal, indicating that the OpenCV installation is successful.19</pspan>'''|-| '''<ol span style="list-style-typecolor: lower-alpha;#FF0000"><li><p>The version of OpenCV in Ubuntu22.04 is as follows:232</p><pspan>orangepi@orangepi:~$ '''python3 -c "import cv2; print(cv2.__version__)"| '''</pspan style="color:#FF0000">PH8<p/span>'''4.5.4| '''</pspan style="color:#FF0000">SPI1_MISO</lispan>'''| '''<lispan style="color:#FF0000">21<p/span>The version of OpenCV in Ubuntu20.04 is as follows:</p><p>orangepi@orangepi:~$ '''python3 '|-c "import cv2; print(cv2.__version__)"| '''</pspan style="color:#FF0000">230<p/span>'''4.2.0| '''</pspan style="color:#FF0000">PH6</lispan>'''| '''<lispan style="color:#FF0000"><p>The version of OpenCV in Debian11 is as follows:SPI1_CLK</pspan><p>orangepi@orangepi:~$ '''python3 -c "import cv2; print(cv2.__version__)"| '''</pspan style="color:#FF0000">23<p/span>'''4.5.1|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''</p></li><li><p>The version of OpenCV in Debian12 is as follows:</p><p>orangepi@orangepi:~$ | '''python3 -c "import cv2; print(cv2.__version__)"25'''</p><p>|-| '''266'4.6.0''| '''PI10'''| '''<TWI2-SDA/p></li></ol>UART3_RX'''</li></ol>| '''27''' <span id="set|-up-the-chinese-environment-and-install-the-chinese-input-method"></span>== Set up the Chinese environment and install the Chinese input method ==| '''256'''| '''Note, before installing the Chinese input method, please make sure that the Linux system used by the development board is a desktop version.PI0''' <span id| style="debiantext-system-installation-methodalign: left;"></span>|=== Debian system installation method ===| '''29''' <ol style="list-style|-type: decimal;"><li><p>First set the default | '''locale271'''| '''PI15''' to Chinese</p><ol | style="list-styletext-typealign: lower-alphaleft;">|<li><p>Enter the following command to start configuring | '''locale31'''</p><p>orangepi@orangepi:~$ |-| '''sudo dpkg-reconfigure locales268'''</p></li><li><p>Then select | '''zh_CN.UTF-8 UTF-8PI12''' 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>PWM2''', and then return Car can be used)</p><p>[[File:zero2w| '''33'''|-img186.png]]</p></li><li><p>Then set the default | '''locale258''' to | '''zh_CN.UTF-8PI2'''</p><p>[[File| style="text-align:zero2w-img187.png]]</p></li>left;"|<li><p>After exiting the interface, the | '''locale35''' setting will begin. > The output displayed on the command line is as follows:</p><p>orangepi@orangepi:~$ |-| '''sudo dpkg-reconfigure locales272'''</p><p>Generating locales (this might take a while)...</p>| '''PI16'''<p>en_US.UTF| style="text-8... done</p>align: left;"|| '''37'''<p>zh_CN.UTF|-8... done</p><p>Generation complete.</p></li></ol>| style="text-align: left;"|</li><li><p>Then open | style="text-align: left;"|| '''Input MethodGND'''</p><p>[[File:zero2w-img188.png]]</p></li><li><p>Then select | '''OK39'''</p><p>[[File|}{| class="wikitable" style="width:390px;margin-right:zero2w20px;text-img189.png]]</p></li>align: center;"<li><p>Then select |-| '''YesPin'''</p><p>[[File:zero2w-img190.png]]</p></li><li><p>Then select | '''fcitxFunction'''</p><p>[[File:zero2w-img191.png]]</p></li>| '''GPIO'''<li><p>Then select | '''OKGPIO NO.'''</p><p>[[File:zero2w|-img192.png]]</p></li><li><p>| '''Then restart the Linux system to make the configuration take effect.2'''</p></li><li><p>Then open | '''Fcitx configuration5V'''</p><p>[[File| style="text-align:zero2wleft;"|| style="text-img193.png]]</p></li>align: left;"|<li><p>Then click the + sign as shown in the picture below</p>|-<p>[[File:zero2w-img194.png]]</p></li><li><p>Then search | '''Google Pinyin4''' and click | '''OK5V'''</p><div class| style="figuretext-align: left;">|| style="text-align: left;"|[[File:zero2w|-img195.png]]| '''6'''</div></li><li><p>Then put '| '''Google PinyinGND''' on top</p><p>[[File| style="text-align:zero2w-img196.png]]</p>left;"|<p>[[File| style="text-align:zero2wleft;"||-img197.png]]</p></li><li><p>Then open the | '''Geany8''' editor to test the Chinese input method</p><p>[[File:zero2w-img198.png]]</p></li>| '''UART0_TX'''<li><p>The Chinese input method test is as follows</p>| '''PH0'''<p>[[File:zero2w-img199.png]]</p></li><li><p>You can switch between Chinese and English input methods through the | '''Ctrl+Space224''' 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/locale10''' to | '''zh_CN.UTF-8UART0_RX'''</p><p>orangepi@orangepi:~$ | '''sudo vim /etc/default/localePH1'''</p><p># File generated by update-locale</p>| '''225'''|-<p>LC_MESSAGES=| '''zh_CN.UTF-812'''</p><p>LANG| style="text-align: left;"|| '''zh_CN.UTF-8'PI1'''</p><p>LANGUAGE=| '''zh_CN.UTF-8257'''</p></li><li><p>Then |-| '''restart the system14''' and you will see that the system is displayed in Chinese.</p><p>[[File:zero2w-img200.png]]</p></li></ol>| '''GND''' <span id| style="installationtext-method-of-ubuntu-20.04-systemalign: left;"></span>|=== Installation method of Ubuntu 20.04 system === <ol | style="list-styletext-typealign: decimalleft;">|<li><p>First open |-| '''Language Support16'''</p><p>[[File:zero2w-img201.png]]<| '''PWM4/p></li>UART4_RX'''<li><p>Then find the | '''Chinese (China)PI14'''| '''270''' option</p><p>[[File:zero2w|-img202.png]]</p></li><li><p>Then please use the left button of the mouse to select | '''Chinese (China)18''' and hold it down, then drag it up to the starting position. After dragging, the display will be as shown below| style="text-align:</p><p>[[File:zero2w-img203.png]]</p></li></ol>left;"|| '''Note that this step is not easy to drag, please be patient and try it a few times.PH4''' <ol start="4" style="list| '''228'''|-style-type: decimal;"><li><p>Then select | '''Apply System-Wide20''' to apply the Chinese settings to the entire system</p><p>[[File:zero2w-img204.png]]</p></li><li><p>Then set the '''Keyboard input method system''' system to | '''fcitxGND'''</p><p>[[File| style="text-align:zero2wleft;"|| style="text-align: left;"||-img205.png]]</p></li><li><p>| '''Then restart the Linux system to make the configuration take effect22'''| '''<TWI0_SDA/p></li>UART2_RX'''<li><p>After re-entering the system, please select | '''Do not ask me againPI6''' in the following interface, and then please decide according to your own preferences whether the standard folder should also be updated to Chinese</p>| '''262'''|-| '''<p>[[File:zero2w-img206.png]]</pspan style="color:#FF0000">24</lispan>'''| '''<li><pspan style="color:#FF0000">Then you can see that the desktop is displayed in ChineseSPI1_CS0</pspan>'''| '''<p>[[Filespan style="color:zero2w-img207.png]]</p#FF0000">PH5</lispan><li><p>Then we can open '''Geany| ''' to test the Chinese input method. The opening method is as shown in the figure below</p><p>[[Filespan style="color:zero2w-img208.png]]</p#FF0000">229</li><li><pspan>After opening '''Geany|-| ''', the English input method is still the default. We can switch to the Chinese input method through the <span style="color:#FF0000">26</span>'''Ctrl+Space| ''' shortcut key, and then we can input Chinese.</p><p>[[Filespan style="color:zero2w-img209.png]]</p#FF0000">SPI1_CS1</li></olspan>''' | '''<span idstyle="installation-method-of-ubuntu-22.04-systemcolor:#FF0000">PH9</span>'''=== Installation method of Ubuntu 22.04 system === <ol style| '''<span style="list-style-typecolor: decimal;#FF0000">233<li><p/span>First open '''Language Support|-| '''28'''</p><p>[[File:zero2w| '''TWI2-img201.png]]<SCL/p></li>UART3_TX'''<li><p>Then find the | '''Chinese (China)PI9''' option</p><p>[[File:zero2w| '''265'''|-img210.png]]</p></li><li><p>Then please use the left button of the mouse to select | '''Chinese (China)30''' and hold it down, then drag it up to the starting position. After dragging, the display will be as shown below:</p><p>[[File:zero2w-img211.png]]</p></li></ol> '| ''''Note that this step is not easy to drag, please be patient and try it a few times.GND''' <ol start="4" | style="listtext-style-typealign: decimalleft;">|<li><p>Then select | style="text-align: left;"||-| '''Apply System-Wide32''' to apply the Chinese settings to the entire system</p><p>[[File:zero2w-img212.png]]</p></li>| '''PWM1'''<li><p>| '''Then restart the Linux system to make the configuration take effectPI11'''</p></li><li><p>After re-entering the system, please select | '''Do not ask me again267''' in the following interface, and then please decide whether the standard folder should also be updated to Chinese according to your own preferences.</p><p>[[File:zero2w|-img206.png]]</p></li><li><p>Then you can see that the desktop is displayed in Chinese</p>| '''34'''<p>[[File:zero2w-img207.png]]</p></li>| '''GND'''<li><p>Then open the Fcitx5 configuration program</p><p>[[File| style="text-align:zero2w-img213.png]]</p></li>left;"|<li><p>Then choose to use Pinyin input method</p><div class| style="figuretext-align: left;">| [[File:zero2w|-img214.png]]| '''36'''</div></li><li><p>The interface after selection is as shown below, then click OK</p><p>[[File| style="text-align:zero2w-img215.png]]</p></li>left;"|| '''PC12'''<li><p>Then we can open | '''Geany76''' to test the Chinese input method. The opening method is as shown in the figure below</p><p>[[File:zero2w|-img208.png]]</p></li><li><p>After opening | '''Geany38''', the English input method is still the default. We can switch to the Chinese input method through the | style="text-align: left;"|| '''Ctrl+SpacePI4''' shortcut key, and then we can enter Chinese.</p><p>[[File:zero2w| '''260'''|-img216.png]]</p></li></ol>| '''40'''<span id| style="howtext-to-remotely-log-in-to-the-linux-system-desktopalign: left;"></span>|| '''PI3'''== How to remotely log in to the Linux system desktop ==| '''259'''|}<span id="remote-login-using-nomachine"></spandiv>=== Remote login using NoMachine ===
<ol style="list-style-type: lower-alpha;">
<li>Since H618 is an ARMv8 architecture SOC and the system we use is > Ubuntu or Debian, we need <p>First run '''orangepi-config'''. Ordinary users remember to download the add '''NoMachine for ARM > ARMv8 DEBsudo''' installation packagepermissions. The download link is as ></p>{| class="wikitable" style="width:800px; follows" |-| <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'''</olp><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.</olp></li>
{| class="wikitable" style="width:800px;text-align: center;"|-| '''dtbo configuration'''| '''illustrate'''|-| '''spi1-cs0-cs1-spidev'''Note that this download link may change, please look for the Armv8/Arm64 version | '''Open cs0 and cs1 of spi1 at the deb package.same time'''|-[https://www.nomachine.com/download/download&id=112&s=ARM | '''spi1-cs0-spidev'''| '''https://downloads.nomachine.com/download/?id=118&distro=ARMOnly open cs0 of spi1''']|-[[File:zero2w| '''spi1-cs1-img217.png]]spidev'''| '''Only open cs1 of spi1'''|}</ol><ol start="25" style="list-style-type: lower-alpha;"><li><p>In addition, you can also download the Then select '''NoMachine<Save>''' installation > package from the official tool.to save</p><p>[[File:zero2w-img218img83.png]]</p></li><li><p>First enter the Then select '''remote login software-NoMachine<Back>''' folder</p><p>[[File:zero2w-img219img84.png]]</p></li><li><p>Then download select '''<Reboot>''' to restart the arm64 version of system to make the deb installation packageconfiguration take effect.</p><p>[[File:zero2w-img220img85.png]]</p></li></ol></li></ol><!-- --><ol start="3" style="list-style-type: decimal;"><li><p>Then upload the downloaded check whether there is a '''nomachine_xspidev1.x''' device node in the Linux system.x_x_arm64If it exists, it means that the SPI1 configuration has taken effect.deb</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>''' to Note that only when you open spi1-cs0-cs1-spidev, you will see the > Linux system device nodes of the development boardtwo spi.'''</p></big>|}</li><li><p>Then you can use the following command '''spidev_test.py''' program in examples to install test the SPI loopback function. The '''NoMachinespidev_test.py''' in program needs to specify the Linux >following two parameters:</p><ol style="list-style-type: lower-alpha; system "><li><p>'''--channel''': Specify the channel number of the development boardSPI</p></li><li><p>orangepi@orangepi:~$ '''sudo dpkg -i nomachine_x.x.x_x_arm64_arm64.deb-port''': Specify the port number of the SPI</p></li></ol></li><li><p>Without shorting the mosi and miso pins of SPI1, the output result of running spidev_test.py is as follows. You can see that the data of TX and RX are inconsistent.</p>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p> root@orangepi:~/wiringOP-Python/examples# '''python3 spidev_test.py \'''
TX | FF FF FF FF FF FF '''<ol start="3" span style="list-style-typecolor: decimal;#FF0000">40 00 00 00 00 95<li/span><p>Then install NoMachine in Windows. '''Please restart your computer after installationFF 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 '''</pspan style="color:#FF0000">FF FF FF FF FF FF</lispan><li><p>Then open '''NoMachine''' in Window</p><p>[[File:zero2w-img222FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF |............png]]</p></li><li><p>After NoMachine is started, it will automatically scan other devices with NoMachine installed on the LAN. After entering the main interface of NoMachine, you can see that the development board is already in the list of connectable devices, and then click on the location shown in the red box in the picture below You can now log in to the Linux system desktop of the development board….</p>||}<p>[[File:zero2w-img223.png]]</p></li><li><p>Then click '''OK'''</pol><p>[[Fileol start="6" style="list-style-type:zero2w-img224.png]]</p></lidecimal;"><li><p>Then enter use Dupont wire to short-circuit the username and password of the development board Linux system txd (pin 19 in the corresponding positions 40pin interface) and rxd (pin 21 in the figure below, 40pin interface) of SPI1 and then click OK to start logging inrun spidev_test.</p><p>[[File:zero2w-img225py.png]]</p></li><li><p>Then click OK in the next interface.</p></li><li><p>Finally The output is as follows, you can see If the data sent and received are the desktop of same, it means that the development board Linux systemSPI1 loopback test is normal.</p>{| class="wikitable" style="width:800px;" |-| <p>[[Fileroot@orangepi:zero2w~/wiringOP-img226.png]]Python# '''cd examples'''</p></li></ol>
'''Before operating, please make sure that the Windwos computer and the development board are in the same LAN, and that you can log in to the Ubuntu or Debian system of the development board through ssh normally.--channel 1 --port 0'''
RX | FF FF FF FF FF FF '''</div><ol start="2" span style="list-style-typecolor: lower-alpha;#FF0000"><li><p>Then enter the VNC password set earlier40 00 00 00 00 95</pspan>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…||}<p>[[File:zero2w-img228.png]]</pli></liol><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.</pspan id="pin-i2c-test-1"></li></olspan>
<ol div style="list-style-typedisplay: decimalflex;"><li><p>Use the following script to install QT5 and QT Creator</p><p>orangepi@orangepi:~$ '''install_qt:{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''GPIO NO.sh'''</p></li><li><p>After installation, the QT version number will be automatically printed.</p>| '''GPIO'''| '''Function'''| '''Pin'''|-<ol | style="list-styletext-typealign: lower-alphaleft;">|<li><p>The qt version that comes with Ubuntu20.04 is | style="text-align: left;"|| '''5.123.83V'''</p><p>orangepi@orangepi:~$ | '''install_qt.sh1'''</p>|-| '''<pspan style="color:#FF0000">......264</pspan>'''| '''<p>QMake version 3.1span style="color:#FF0000">PI8</p><pspan>Using Qt version '''5.12.8| ''' in /usr/lib/aarch64-linux-gnu</pspan style="color:#FF0000">TWI1-SDA</lispan>'''| '''<lispan style="color:#FF0000">3<p/span>The QT version that comes with Ubuntu22.04 is '''5.15.3|-| '''</pspan style="color:#FF0000">263<p/span>orangepi@orangepi:~$ '''install_qt.sh| '''</pspan style="color:#FF0000">v<p>......</p/span>'''| '''<pspan style="color:#FF0000">QMake version 3.1TWI1-SCL</pspan><p>Using Qt version '''5.15.3| ''' in /usr/lib/aarch64-linux-gnu</pspan style="color:#FF0000">5</lispan>'''<li><p>The QT version that comes with Debian11 is |-| '''5.15.2269'''</p><p>orangepi@orangepi:~$ | '''PI13'''install_qt.sh| '''<PWM3/p>UART4_TX'''<p>......</p><p>QMake version 3.1</p><p>Using Qt version | '''7'5.15.2''' in /usr/lib/aarch64|-linux| style="text-gnu</p></li>align: left;"|<li><p>The QT version that comes with Debian12 is '| style="text-align: left;"|| ''5.15.8'GND'''</p><p>orangepi@orangepi:~$ | '''install_qt.sh9'''</p><p>......</p><p>QMake version 3.1</p>|-| '''226'''<p>Using Qt version | '''5.15.8PH2''' in /usr/lib/aarch64-linux-gnu</p></li></ol></li><li><p>Then you can see the QT Creator startup icon in | '''ApplicationsUART5_TX'''</p><p>[[File:zero2w| '''11'''|-img230.png]]</p><p>You can also use the following command to open QT Creator</p>| '''227'''<p>orangepi@orangepi:~$ | '''qtcreatorPH3'''| '''UART5_RX'''</p></li><li><p>The interface after QT Creator is opened is as follows</p>| '''13'''<p>[[File:zero2w|-img231.png]]| '''</pspan style="color:#FF0000">261</lispan>'''| '''<lispan style="color:#FF0000"><p>The version of QT Creator is as followsPI5</pspan>'''| '''<ol span style="list-style-typecolor: lower-alpha;#FF0000"><li>TWI0_SCL<p/span>The default version of QT Creator in /UART2_TX'''Ubuntu20.04| ''' is as > follows</p><p>[[Filespan style="color:zero2w-img232.png]]</p#FF0000">15</li><li><pspan>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 | style="text-align: left;"|| style="text-align: left;"|| '''Debian113.3V'''| '''17''' is as follows</p><p>[[File:zero2w|-img234.png]]</p></li><li><p>The default version of QT Creator in | '''Debian12231''' is as follows</p><p>[[File:zero2w-img235.png]]</p></li></ol>| '''PH7'''</li><li><p>Then set up QT</p><ol style="list-style-type: lower-alpha;">| '''SPI1_MOSI'''<li><p>First open | '''Help19'''|->| '''About Plugins...232'''.</p><p>[[File:zero2w-img236.png]]</p></li><li><p>Then remove the check mark of | '''ClangCodeModelPH8'''</p><p>[[File:zero2w-img237.png]]</p></li>| '''SPI1_MISO'''<li><p>| '''After setting up, you need to restart QT Creator21'''</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.230'''</p><p>[[File:zero2w-img238.png]]</p>| '''PH6'''| '''SPI1_CLK'''| '''23'''<p>[[File:zero2w|-img239.png]]</p></li></ol></li>| style="text-align: left;"|| style="text-align: left;"|<li><p>Then you can open a sample code</p>| '''GND'''| '''25'''|-| '''<pspan style="color:#FF0000">[[File:zero2w-img240.png]]266</p></lispan>'''| '''<lispan style="color:#FF0000"><p>After clicking on the sample code, the corresponding instruction document will automatically open. You can read the instructions carefully.PI10</pspan>'''| '''<pspan style="color:#FF0000">[[File:zero2wTWI2-img241.png]]SDA</pspan></li><li><p>Then click UART3_RX'''Configure Project| '''</pspan style="color:#FF0000">27<p/span>[[File:zero2w'''|-img242.png]]</p></li><li><p>Then click the green triangle in the lower left corner to compile and run the sample code</p>| '''256'''<p>[[File| '''PI0'''| style="text-align:zero2wleft;"|| '''29'''|-img243.png]]</p></li><li><p>After waiting for a period of time, the interface shown in the figure below will pop up, which means that QT can compile and run normally.</p>| '''271'''<p>[[File:zero2w-img244.png]]</p></li>| '''PI15'''<li><p>References</p>| style="text-align: left;"|<p>[https://wiki.qt.io/Install_Qt_5_on_Ubuntu | '''https://wiki.qt.io/Install_Qt_5_on_Ubuntu31''']</p><p>[https://download.qt.io/archive/qtcreator |-| '''https://download.qt.io/archive/qtcreator268'''| '''PI12''']</p><p>[https://download.qt.io/archive/qt | '''PWM2'https://download.qt.io/archive/qt''| '''33''']</p></li></ol> <span id="ros|-installation-method"></span>== ROS installation method ==| '''258'''| '''PI2'''<span id| style="howtext-to-install-ros-1-noetic-on-ubuntu20.04align: left;"></span>=== How to install ROS 1 Noetic on Ubuntu20.04 === # The currently active version of ROS 1 is as follows, the recommended version is || '''Noetic Ninjemys35''' [[File:zero2w|-img245.png]]| '''272'''[[File:zero2w-img246.png]] [http://docs.ros.org/ | ''''http://docs.ros.orgPI16''']| style="text-align: left;"|| '''https://wiki.ros.org/Distributions''37'''|-<ol start| style="2text-align: left;" || style="list-styletext-typealign: decimalleft;">|<li><p>The link to the official installation documentation of ROS 1 | '''GND'Noetic Ninjemys''' is as follows:</p><p>[http://wiki.ros.org/noetic/Installation/Ubuntu | '''http://wiki.ros.org/noetic/Installation/Ubuntu39''']</p></li><li><p>In the official installation documentation of ROS |}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''Noetic NinjemysPin''', Ubuntu recommends using Ubuntu20.04, so please ensure that the system used by the development board is | '''Ubuntu20.04 desktop systemFunction'''.</p><p>[http://wiki.ros.org/noetic/Installation | '''http://wiki.ros.org/noetic/InstallationGPIO''']</p><p>[[File:zero2w-img247| '''GPIO NO.png]]</p></li>'''<li><p>Then use the script below to install ros1</p>|-<p>orangepi@orangepi:~$ | '''2'install_ros.sh ros1'''</p></li><li><p>Before using the ROS tool, you first need to initialize rosdep. Then when compiling the source code, you can quickly install some system dependencies and some core components in ROS.</p></li></ol> | '''Note that when running the following command, you need to ensure that the development board can access github normally, otherwise an error will be reported due to network problems.5V''' | style="text-align: left;"|| style="text-align: left;"||-| '''The install_ros.sh script will try to modify /etc/hosts and automatically run the following commands. However, this method cannot guarantee that github can be accessed normally every time. If install_ros.sh prompts the following error after installing ros1, please find other ways to allow the linux system of the development board to access github normally, and then manually run the following Order.4''' | ''''https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml5V'''| style="text-align: left;"|'''Hit https| style="text-align://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml'''left;"||-| '''ERROR: error loading sources list:6''' | '''The read operation timed outGND''' orangepi@orangepi| style="text-align:~$ 'left;"|| style="text-align: left;"||-| '''source /opt/ros/noetic/setup.bash8'''| '''UART0_TX'''orangepi@orangepi:~$ | '''sudo rosdep initPH0'''| '''224'''Wrote /etc/ros/rosdep/sources.list.d/20|-default.list| '''10'''Recommended: please run rosdep update orangepi@orangepi:~$ | '''rosdep updateUART0_RX'''| '''PH1'''reading in sources list data from /etc/ros/rosdep/sources.list.d| '''225'''Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx|-homebrew.yaml| '''12'''Hit https| style="text-align://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yamlleft;"|| '''PI1'''| '''257'''Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml|-Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml| '''14'''| '''GND'''Hit https| style="text-align://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yamlleft;"|| style="text-align: left;"|Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index|-v4.yaml| '''16'''| '''PWM4/UART4_RX'''Skip end-of-life distro "ardent"| '''PI14'''| '''270'''Skip end|-of-life distro "bouncy"| '''18'''Skip end| style="text-of-life distro "crystal"align: left;"|| '''PH4'''Skip end-of-life distro "dashing"| '''228''' Skip end-of|-life distro "eloquent"| '''20'''Add distro "foxy"| '''GND''' Add distro "galactic" Skip end| style="text-of-life distro "groovy"align: left;"| Add distro "humble" Skip end| style="text-of-life distro "align: left;hydro""|Skip end-of|-life distro "indigo"| '''<span style="color:#FF0000">22</span>'''Skip end-of-life distro "jade" Skip end-of-life distro "kinetic"| '''<span style="color:#FF0000">TWI0_SDA</span>/UART2_RX''' Skip end-of-life distro "lunar" Add distro "melodic" Add distro "noetic" Add distro "rolling" updated cache in /home/orangepi/.ros/rosdep/sources.cache <ol start| '''<span style="6color:#FF0000" >PI6</span>'''| '''<span style="list-style-typecolor: decimal;#FF0000"><li>262<p/span>Then open a command line terminal window on the '''desktop|-| ''', and then use the 24'''test_ros.sh| '''SPI1_CS0''' script to start a small turtle routine to test whether ROS can be used normally.</p><p>orangepi@orangepi:~$ | '''test_ros.shPH5'''</p></li><li><p>After running the | '''test_ros.sh229''' script, a small turtle as shown in the picture below will pop up.</p><p>[[File:zero2w|-img248.png]]</p></li><li><p>Then please keep the terminal window you just opened at the top</p></li></ol>| '''26'''| '''SPI1_CS1'''| '''PH9'''<div class="figure"> [[File:zero2w-img249.png]]| '''233'''|-| '''</div><ol start="9" span style="list-style-typecolor: decimal;#FF0000">28<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/span>'''| '''<pspan style="color:#FF0000">[[File:zero2wTWI2-img250.png]]SCL</pspan></li>UART3_TX'''| '''<span style="color:#FF0000">PI9</olspan>'''| '''<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>
<span idol start="how2" style="list-style-type: decimal;"><li><p>i2c is turned off by default in Linux systems and needs to be turned on manually touse it. The opening steps are as follows:</p><ol style="list-installstyle-rostype: lower-2alpha;"><li><p>First run '''orangepi-config'''. Ordinary users remember to add '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-galacticconfig'''</p>|}</li><li><p>Then select '''System'''</p><p>[[File:zero2w-onimg80.png]]</p></li><li><p>Then select '''Hardware'''</p><p>[[File:zero2w-ubuntu20img81.04"png]]</p></spanli>=== How <li><p>Then use the keyboard's arrow keys to locate the position shown in the picture below, and then use the '''space''' to install ROS 2 Galactic on Ubuntu20select the corresponding i2c configuration in the picture below.04 ===</p></li>
<ol style="list-style-type: decimallower-alpha;"><li><p>Use the install_ros.sh script to '''install_ros.shFirst run the following command to check the corresponding relationship of i2c'''</p><p>orangepi@orangepiorangepizero2w:~$ '''install_ros.sh ros2'''<ls /sys/devices/platform/soc*/p><*/li><li><p>The '''install_ros.sh''' script will automatically run the '''ros2 i2c-* | grep "i2c-h''' command after installing ros2. If you can see the following print, it means that the ros2 installation is complete.</p><p>usage: ros2 [0-h9] Call `ros2 <quot;command> -h` for more detailed usage. ...'''</p><p>ros2 is an extensible command-line tool for ROS 2.</p><p>optional arguments:<sys/p><p>-h, --help show this help message and exit<devices/p><p>Commands:<platform/p><p>action Various action related sub-commands<soc/p><p>bag Various rosbag related sub-commands<5002000.i2c/p><p>component Various component related subi2c-commands</p><p>daemon Various daemon related sub-commands0:</p><p>doctor Check ROS setup and other potential issues</p><p>interface Show information about ROS interfaces<sys/p><p>launch Run a launch file<devices/p><p>lifecycle Various lifecycle related sub-commands<platform/p><p>multicast Various multicast related sub-commands<soc/p><p>node Various node related sub-commands<5002400.i2c/p><p>param Various param related subi2c-commands</p><p>pkg Various package related sub-commands3:</p><p>run Run a package specific executable</p><p>security Various security related sub-commands<sys/p><p>service Various service related sub-commands<devices/p><p>topic Various topic related sub-commands<platform/p><p>wtf Use `wtf` as alias to `doctor`<soc/p><p>Call `ros2 <command> -h` for more detailed usage5002800.<i2c/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.i2c-4:</p><p>orangepi@orangepi:~$ '''test_ros.sh'''</p><p>[INFO] [1671174101.200091527] [talker]: Publishing: 'Hello World: 1'<sys/p><p>[INFO] [1671174101.235661048] [listener]: I heard: [Hello World: 1]<devices/p><p>[INFO] [1671174102.199572327] [talker]: Publishing: 'Hello World: 2'<platform/p><p>[INFO] [1671174102.204196299] [listener]: I heard: [Hello World: 2]<soc/p><p>[INFO] [16711741035002c00.199580322] [talker]: Publishing: 'Hello World: 3'<i2c/p><p>[INFO] [1671174103.204019965] [listener]i2c-5: I heard: [Hello World: 3]</p></li><li><p>Run the following command to open rviz2</p><p>orangepi@orangepi:~$ '''source sys/optdevices/rosplatform/humblesoc/setup6000000.bash'''<hdmi/p><p>orangepi@orangepi:~$ '''ros2 run rviz2 rviz2'''</p><p>[[File:zero2wi2c-img254.png]]</p></li><li><p>Reference documentation</p><p>'''http2://docs.ros.org/en/humble/index.html'''</p><p>[http:/sys/docs.ros.orgdevices/enplatform/galacticsoc/Tutorials7081400.html '''http:/i2c/docs.ros.org/en/humble/Installation/Ubuntui2c-Install-Debians.html''']1:</p></li></ol>
<li><p>'''Debian11 system with Linux6In the above output'''</p><ol style="list-style-type: none;"><li><p>a) 5002000 is the register base address of the i2c0 bus, and i2c-0 shown behind it is its corresponding i2c device node</p></li><li><p>b) 5002400 is the register base address of the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li><li><p>c) 5002800 is the register base address of the i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p></li></ol></li></ol>|}</li></ol><ol start="4" style="list-style-type: decimal;"><li><p>Then start testing i2c, first install i2c-tools</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo''' '''apt-get install -y i2c-tools'''</p>|}</li><li><p>Then connect an i2c device to the i2c pin of the 40pin connector.1 kernel will report GCC error when compiling kernel Here we take the DS1307 RTC moduleas an example. So if you want to compile </p><p>[[File:zero2w-img178.png]]</p></li><li><p>Then use the '''i2cdetect -y x'''command. If the address of the kernel moduleconnected i2c device can be detected, please use Debian12 or Ubuntu22it means that the i2c device is connected correctly.04</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''<p>'''Note that x in the i2cdetect -y x command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p>'''</big>|}
[[File:zero2w-img179.png]]</li></ol><ol start="7" style="list-style-type: decimal;"><li><p>The Linux image released by OPi comes with the deb package of Then you can run the kernel header file by default, and the storage location is '''/opt/ds1307.py'''</p><p>orangepi@orangepi:~$ test program in '''ls /opt/linux-headers*examples'''</p><p>/opt/linux-headers-xxx-sun50iw9_x.x.x_arm64.deb</p></li><li><p>Use the following command to install read the deb package of the kernel header fileRTC time</p><p>orangepi@orangepi{| class="wikitable" style="background-color:#ffffdc;width:~$ '''sudo dpkg 800px;" |-i /opt/linux-headers*.deb'''</p></li>| <libig><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-headersNote that the x in i2c-x.x.x</p></li><li><p>Then you can compile in the source code of the hello kernel module that comes following command needs to be replaced with the Linux image. The source code serial number of the hello module is in '''/usr/src/hello'''. After entering this directory, then use device node corresponding to the make command to compilei2c bus.</p><p>orangepi@orangepi:~$ '''cd /usr/src/hello/'''</p><p>orangepi@orangepi:/usr/src/hello$ '''sudo make'''</pbig><p>make -C /lib/modules/5.4.125/build M|}{| class="wikitable" style=/usr/src/hello modules</p><p>make[1]"width: Entering directory '/usr/src/linux-headers-5.4.125'</p>800px;" <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>orangepiroot@orangepi:~/usr/src/hello$ wiringOP-Python# '''ls *.ko'''</p><p>hello.ko</p></li><li><p>Use the '''insmod''' command to insert the ''cd examples'hello.ko''' kernel module into the kernel</p><p>orangepiroot@orangepi:~/usrwiringOP-Python/src/hello$ examples# '''sudo insmod hellopython3 ds1307.kopy --device \'''</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/dev/i2c-x"'''</p><p>[ 2871.893988] '''Hello Orange Pi Thu 2022-06- init'''16 04:35:46</p></li><li><p>Use the '''rmmod''' command to uninstall the '''hello.ko''' kernel moduleThu 2022-06-16 04:35:47</p><p>orangepi@orangepiThu 2022-06-16 04:35:/usr/src/hello$ '''sudo rmmod hello'''48</p><p>orangepi@orangepi:/usr/src/hello$ '''dmesg | grep "Hello"'''^C</p><p>[ 2871.893988] Hello Orange Pi -- initexit</p>|}<p/li>[ 3173.800892] '''Hello Orange Pi -- exit'''</pol> </lispan id="pin-uart-test-1"></olspan>
<ol div style="list-style-typedisplay: decimalflex;"><li><p>Debian Bullseye is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.</p><ol style::{| class="list-wikitable" style="width:390px;margin-typeright: lower20px;text-alphaalign: center;"><li><p>The version of a.gcc is as follows</p>|-<p>orangepi@orangepi:~$ | '''gcc --versionGPIO NO.'''</p><p>gcc (Debian 10.2.1-6) 10.2.1 20210110</p>| '''GPIO'''<p>Copyright (C) 2020 Free Software Foundation, Inc.</p>| '''Function'''| '''Pin'''|-<p>This is free software; see the source for copying conditions. There is NO</p>| style="text-align: left;"|<p>warranty| style="text-align: left; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE"|| '''3.</p></li>3V'''<li><p>Write the | '''hello_world.c1''' program in C language</p><p>orangepi@orangepi:~$ |-| '''vim hello_world.c264'''</p><p>#include <stdio.h></p>| '''PI8'''<p>int main(void)</p>| '''TWI1-SDA'''<p>{</p>| '''3'''|-<p>printf("Hello World!\n");</p>| '''263'''<p>return 0;</p><p>}</p></li><li><p>Then compile and run | '''hello_world.cPI7'''</p><p>orangepi@orangepi:~$ | '''gcc TWI1-o hello_world hello_world.cSCL'''</p><p>orangepi@orangepi:~$ | '''./hello_world5'''</p><p>Hello World!</p></li></ol>|-<| '''269'''| '''PI13'''| '''PWM3/li>UART4_TX'''<li><p>Debian Bullseye has Python3 installed by default</p>| '''7'''|-<ol | style="listtext-align: left;"|| style="text-typealign: lower-alphaleft;">|<li><p>The specific version of Python is as follows</p>| '''GND'''<p>orangepi@orangepi:~$ | '''python39'''</p><p>|-| '''226'Python 3.9.2''| '''PH2'''| '''UART5_TX''' (default, Feb 28 2021, 17:03:44)</p><p>[GCC 10.2.1 20210110] on linux</p>| '''11'''<p>Type "help", "copyright", "credits" or "license" for more information.</p>|-<p>>>></p><p>| '''227''Use the Ctrl+D shortcut key to exit python's interactive mode.| '''</p></li><li><p>Write the PH3'''hello_world.py| '''UART5_RX''' program in Python language</p><p>orangepi@orangepi:~$ | '''vim hello_world.py13'''</p><p>print(|-| '''261''Hello World!')</p></li><li><p>The result of running | '''hello_world.pyPI5''' is as follows</p><p>orangepi@orangepi:~$ | '''python3 hello_world.pyTWI0_SCL/UART2_TX'''</p><p>Hello World!</p></li></ol>| '''15'''</li>|-<li><p>Debian Bullseye does not install Java compilation tools and operating environment by default.</p>| style="text-align: left;"|<ol | style="list-styletext-typealign: lower-alphaleft;">|<li><p>You can use the following command to install openjdk. The latest > version in Debian Bullseye is openjdk-17</p>| '''3.3V'''<p>orangepi@orangepi:~$ | '''sudo apt install -y openjdk-17'''|-jdk| '''231'''</p></li><li><p>After installation, you can check the Java version.</p>| '''PH7'''<p>orangepi@orangepi:~$ | '''java --versionSPI1_MOSI'''</p></li><li><p>Write the Java version of | '''hello_world.java19'''</p><p>orangepi@orangepi:~$ |-| '''vim hello_world.java232'''</p><p>public class hello_world</p>| '''PH8'''<p>{</p>| '''SPI1_MISO'''<p>public static void main(String[] args)</p>| '''21'''|-<p>{</p>| '''230'''<p>System.out.println("Hello World!");</p>| '''PH6'''<p>}</p>| '''SPI1_CLK'''<p>}</p></li>| '''23'''<li><p>Then compile and run '''hello_world.java'''</p>|-<p>orangepi@orangepi| style="text-align: left;"|| style="text-align:~$ left;"|| '''javac hello_world.javaGND'''</p><p>orangepi@orangepi:~$ | '''java hello_world25'''</p><p>Hello World!</p></li></ol>|-| '''266'''| '''PI10'''<| '''TWI2-SDA/li></ol>UART3_RX'''| '''27'''|-| '''256'''| '''PI0'''<span id| style="debiantext-bookworm-systemalign: left;"></span>|=== Debian Bookworm system ===| '''29'''|-<ol style="list-| '''271'''| '''PI15'''| style="text-typealign: decimalleft;">|| '''31'''|-<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>| '''268'''| '''PI12'''<ol style="list-style-type: lower-alpha;"><li><p>The version of a.gcc is as follows</p>| '''PWM2'''<p>orangepi@orangepi:~$ | '''gcc --version33'''</p><p>gcc (Debian 12.2.0|-14) 12.2.0</p><p>Copyright (C) 2022 Free Software Foundation, Inc.</p>| '''258'''| '''PI2'''<p>This is free software| style="text-align: left; see the source for copying conditions. There is NO</p>"|<p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p></li>| '''35'''|-<li><p>Write the | '''hello_world.c272''' program in C language</p><p>orangepi@orangepi:~$ | '''vim hello_world.cPI16'''</p><p>#include <| style="text-align: left;stdio.h></p>"|<p>int main(void)</p>| '''37'''<p>{</p>|-<p>printf("| style="text-align: left;Hello World!\n""|| style="text-align: left;);</p>"|<p>return 0;</p><p>}</p></li><li><p>Then compile and run | '''GND''hello_world.c'| ''</p><p>orangepi@orangepi:~$ '39'''gcc |}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-o hello_world hello_world.c| '''Pin'''| '''Function'''| '''GPIO'''</p><p>orangepi@orangepi:~$ | '''GPIO NO./hello_world'''</p><p>Hello World!</p></li></ol>|-</li>| '''2'''<li><p>Debian Bookworm has Python3 installed by default</p>| '''5V'''<ol | style="listtext-align: left;"|| style="text-typealign: lower-alphaleft;">||-<li><p>The specific version of Python is as follows</p>| '''4'''<p>orangepi@orangepi:~$ | '''python35V'''</p><p>Python 3.11.2 (main, Mar 13 2023, 12| style="text-align: left;"|| style="text-align:18:29) [GCC 12.2.0] on linux</p>left;"|<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.6'''</p></li><li><p>Write the | '''hello_world.pyGND''' program in Python language</p><p>orangepi@orangepi| style="text-align:~$ ''left;"|| style="text-align: left;"||-| '''vim hello_world.py8'''</p><p>print(| '''UART0_TX''Hello World!')</p></li><li><p>The result of running | '''hello_world.pyPH0''' is as follows</p><p>orangepi@orangepi:~$ | '''python3 hello_world.py224'''</p><p>Hello World!</p></li></ol>|-| '''10'''</li>| '''UART0_RX'''<li><p>Debian Bookworm does not install Java compilation tools and operating environment by default.</p>| '''PH1'''| '''225'''<ol style="list|-style| '''12'''| style="text-typealign: lower-alphaleft;">|| '''PI1'''<li><p>You can use the following command to install openjdk. The latest > version in Debian Bookworm is openjdk| '''257'''|-17</p><p>orangepi@orangepi:~$ | '''sudo apt install -y openjdk-17-jdk14'''</p></li><li><p>After installation, you can check the Java version.</p><p>orangepi@orangepi:~$ | '''GND'''java | style="text-align: left;"|| style="text-align: left;"||-version'''</p></li><li><p>Write the Java version of | '''hello_world.java16'''</p><p>orangepi@orangepi:~$ | '''vim hello_world.javaPWM4/UART4_RX'''| '''PI14'''</p><p>public class hello_world</p>| '''270'''<p>{</p>|-<p>public static void main(String[] args)</p>| '''18'''<p>{</p>| style="text-align: left;"|<p>System.out.println("Hello World!");</p>| '''PH4'''| '''228'''<p>}</p>|-<p>}</p></li><li><p>Then compile and run | '''hello_world.java20'''</p><p>orangepi@orangepi:~$ | '''javac hello_world.javaGND'''</p><p>orangepi@orangepi| style="text-align: left;"|| style="text-align:~$ left;"||-| '''22'''java hello_world| '''<TWI0_SDA/p><p>Hello World!</p></li></ol>UART2_RX'''</li></ol>| '''PI6'''| '''262'''<span id="ubuntu-focal|-system"></span>=== Ubuntu Focal system ===| '''24'''| '''SPI1_CS0'''<ol style="list-style| '''PH5'''| '''229'''|-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>| '''26'''| '''SPI1_CS1'''<ol style="list-style-type: lower-alpha;"><li><p>The version of a.gcc is as follows</p><p>orangepi@orangepi:~$ | '''gcc --versionPH9'''| '''233'''</p><p>gcc (Ubuntu 9.4.0|-1ubuntu1~20.04.1) 9.4.0</p><p>Copyright (C) 2019 Free Software Foundation, Inc.</p>| '''28'''<p>This is free software; see the source for copying conditions. There is NO<| '''TWI2-SCL/p>UART3_TX'''<p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p></li><li><p>Write the | '''hello_world.cPI9''' program in C language</p><p>orangepi@orangepi:~$ | '''vim hello_world.c265'''|-| '''30'''</p><p>#include <stdio.h></p>| '''GND'''<p>int main(void)</p>| style="text-align: left;"|<p>{</p>| style="text-align: left;"|<p>printf("Hello World!\n");</p><p>return 0;</p><p>}</p></li>|-<li><p>Then compile and run | '''hello_world.c32'''</p><p>orangepi@orangepi:~$ | '''gcc -o hello_world hello_world.cPWM1'''</p><p>orangepi@orangepi:~$ | '''./hello_worldPI11'''</p><p>Hello World!</p></li></ol>| '''267'''|-</li>| '''34'''<li><p>Ubuntu Focal has Python3 installed by default</p>| '''GND'''<ol | style="listtext-align: left;"|| style="text-typealign: lower-alphaleft;">||-<li><p>The specific version of Python3 is as follows</p>| '''36'''<p>orangepi@orangepi| style="text-align:~$ left;"|| '''python3PC12'''</p><p>Python 3.8.10 (default, Nov 14 2022, 12:59:47)</p>| '''76'''|-<p>[GCC 9.4.0] on linux</p>| '''38'''<p>Type "| style="text-align: left;help", "copyright", "credits" or "license" for more information.</p>"|| '''PI4'''<p>>>></p><p>| '''260'''Use the Ctrl+D shortcut key to exit python|-| 's interactive mode.''40'</p></li>''| style="text-align: left;"|<li><p>Write the | '''hello_world.pyPI3''' program in Python language</p><p>orangepi@orangepi:~$ | '''vim hello_world.py259'''|}</pdiv> <pol start="2" style="list-style-type: decimal;">print('Hello World!')</pli></li><li><pp>In Linux systems, uart is turned off by default and needs to be turned on manually before it can be used. The result of running '''hello_world.py''' is opening steps are as follows</p><p>orangepi@orangepi:~$ '''python3 hello_world.py'''</p><p>Hello World!</p></li></ol></li><li><p>Ubuntu Focal does not have Java compilation tools and running environment installed by default.</p><ol style="list-style-type: lower-alpha;"><li><p>You can use the following command to install openjdk-17</p><p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''</p></li><li><p>After installation, you can check the Java version.</p><p>orangepi@orangepi:~$ '''java --version'''</p><p>openjdk 17.0.2 2022-01-18</p><p>OpenJDK Runtime Environment (build 17.0.2+8-Ubuntu-120.04)</p><p>OpenJDK 64-Bit Server VM (build 17.0.2+8-Ubuntu-120.04, mixed mode, sharing)</p></li><li><p>Write the Java version of '''hello_world.java'''</p><p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p><p>public static void main(String[] args)</p><p>{</p><p>System.out.println("Hello World!");</p><p>}</p><p>}</p></li><li><p>Then compile and run '''hello_world.java'''</p><p>orangepi@orangepi:~$ '''javac hello_world.java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p></li></ol></li></ol> <span id="ubuntu-jammy-system"></span>=== Ubuntu Jammy system === <ol style="list-style-type: decimal;"><li><p>Ubuntu Jammy is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.</p><ol style="list-style-type: lower-alpha;"><li><p>The version of a.gcc 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 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.c'''</p><p>orangepi@orangepi:~$ '''gcc -o hello_world hello_world.c'''</p><p>orangepi@orangepi:~$ '''./hello_world'''</p><p>Hello World!</p></li></ol></li><li><p>Ubuntu Jammy has Python3 installed by default</p><ol style="list-style-type: lower-alpha;"><li><p>The specific version of Python3 is as follows</p><p>orangepi@orangepi:~$ '''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", "credits" or "license" for more information.</p><p>>>></p><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p></li><li><p>Write the '''hello_world.py''' program in Python language</p><p>orangepi@orangepi:~$ '''vim hello_world.py'''</p><p>print('Hello World!')</p></li><li><p>The result of running '''hello_world.py''' is as follows</p><p>orangepi@orangepi:~$ '''python3 hello_world.py'''</p><p>Hello World!</p></li></ol></li><li><p>Ubuntu Jammy does not install Java compilation tools and operating environment by default.: </p>
<ol style="list-style-type: lower-alpha;">
<li><p>You can use the following command First run '''orangepi-config'''. Ordinary users remember to install openjdk-18add '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-18orangepi-jdkconfig'''</p>|}</li><li><p>After installation, you can check the Java version.</p><p>orangepi@orangepi:~$ Then select '''java --versionSystem'''</p><p>openjdk 18.0.2-ea 2022-07-19</p><p>OpenJDK Runtime Environment (build 18.0.2-ea+9-Ubuntu[[File:zero2w-222img80.04)</p><p>OpenJDK 64-Bit Server VM (build 18.0.2-ea+9-Ubuntu-222.04, mixed mode, sharing)png]]</p></li><li><p>Write the Java version of Then select '''hello_world.javaHardware'''</p><p>orangepi@orangepi[[File:~$ '''vim hello_worldzero2w-img81.java'''</p><p>public class hello_world</p><p>{</p><p>public static void main(String[png]] args)</p><p>{</p><p>System.out.println("Hello World!");</p><p>}</p><p>}</p></li><li><p>Then compile use the keyboard's arrow keys to locate the position shown in the picture below, and run then use the '''hello_world.javaspace'''</p><p>orangepi@orangepi:~$ '''javac hello_worldto select the serial port you want to open.java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p></li></ol></li></ol>
[[File:zero2w-img175.png]]</ol><span idol start="5" style="methodlist-style-type: lower-alpha;"><li><p>Then select '''<Save>''' tosave</p><p>[[File:zero2w-upload-filesimg83.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 theconfiguration take effect.</p><p>[[File:zero2w-developmentimg85.png]]</p></li></ol></li></ol><!-board-linux-system-in><ol start="3" style="list-ubuntustyle-pctype: decimal;"><li><p>After entering the Linux system, first confirm whether there is a uart5 device node under '''<span class="mark">/dev</span>'''</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''注意, linux5.4系统为/dev/ttyASx.'''</p></big>|}{| class="wikitable" style= Method "width:800px;" |-| <p>orangepi@orangepi:~$ '''ls /dev/ttyS*'''</p><p>/dev/ttySx</p>|}</li><li><p>Then start testing the uart interface. First use Dupont wire to upload files short-circuit the rx and tx pins of the uart interface to be tested.</p></li><li><p>Use the development board Linux system '''gpio''' command in Ubuntu PC wiringOP to test the loopback function of the serial port as shown below. If you can see the following print, it means the serial port communication is normal.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that the last x in the gpio serial /dev/ttySx command needs to be replaced with the serial number of the corresponding uart device node.'''</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''gpio serial /dev/ttySx # linux-6.1 test command'''</p><p>orangepi@orangepi:~$ '''gpio serial /dev/ttyASx # linux-5.4 test command'''</p>
</li>
<li><p>Finally, you can run the '''serialTest.py''' program in examples to test the loopback function of the serial port. If you want to upload a foldercan see the following print, you need to add it means that the -r parameterserial port loopback test is normal.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>test@test:~$ '''scp -r dir_path orangepi@192.168.xx.xx:Note that the x in /dev/homettySx or /orangepidev/ttyASx in the command needs to be replaced with the serial number of the corresponding uart device node.'''</p></libig>|}{| class="wikitable" style="width:800px;" |-| <lip>root@orangepi:~/wiringOP-Python# '''cd examples'''</p><p>There are more usages of scp, please root@orangepi:~/wiringOP-Python/examples# '''python3 serialTest.py --device "/dev/ttySx" # linux6.1 use the following command to view the man manual'''</p><p>root@orangepi:~/wiringOP-Python/examples# '''python3 serialTest.py --device "/dev/li>ttyASx" # linux5.4 use'''</olp>
<span id="howp>Out: 0: -to> 0</p><p>Out: 1: -upload> 1</p><p>Out: 2: -files> 2</p><p>Out: 3: -using-filezilla"> 3</p><p>Out: 4:^C</p><p>exit</spanp>==== How to upload files using filezilla ====|}</li></ol>
<ol stylespan id="listhardware-stylewatchdog-type: decimal;test"><li><p>First install filezilla in Ubuntu PC</p><p>test@test:~$ '''sudo apt install -y filezilla'''</p></li><li><p>Then use the following command to open filezilla</p><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"span>
</div><ol startspan id="5" style="listcheck-the-chipid-of-styleh618-type: decimal;chip"><li><p>Then choose to '''save the password''' and click '''OK'''</p><p>[[File:zero2w-img257.png]]</p></li><li><p>Then select '''Always trust this host''' and click '''OK'''</p></li></olspan>
<div classspan id="figurehow-to-compile-and-install-python-source-code"></span>=== How to compile and install Python source code ===
<span idol style="methodlist-style-type: decimal;"><li><p>First install the dependency packages needed tocompile Python</p>{| class="wikitable" style="width:800px;" |-upload| <p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-filesget install -fromy build-windowsessential zlib1g-pcdev \'''</p><p>'''libncurses5-todev libgdbm-developmentdev libnss3-boarddev libssl-linuxdev libsqlite3-system">dev \'''</spanp>=== Method to upload files from Windows PC to development board Linux system === <span id="howp>'''libreadline-todev libffi-uploaddev curl libbz2-files-using-filezilla-1">dev'''</spanp>==== How to upload files using filezilla ====|}</li># First <li><p>Then download the installation file of the Windows latest version of the filezilla softwarePython3. The download link is as follows9 source code and unzip it</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''wget \'''</p>[<p>'''https://filezilla-projectwww.python.org/downloadftp/python/3.9.10/Python-3.9.10.php?type=client tgz'''https</p><p>orangepi@orangepi:~$ '''tar xvf Python-3.9.10.tgz'''</p>|}</li><li><p>Then run the configuration command</filezillap>{| class="wikitable" style="width:800px;" |-project| <p>orangepi@orangepi:~$ '''cd Python-3.org9.10'''</p><p>orangepi@orangepi:~$ '''./configure --enable-optimizations'''</p>|}</downloadli><li><p>Then compile and install Python3.9. The compilation time takes about half an hour.php?type</p>{| class="wikitable" style=client"width:800px;" |-| <p>orangepi@orangepi:~$ '''make -j4']''</p><p>orangepi@orangepi:~$ '''sudo make altinstall'''</p>|}</li>[[File<li><p>After installation, you can use the following command to check the version number of the Python you just installed.</p>{| class="wikitable" style="width:zero2w800px;" |-img261| <p>orangepi@orangepi:~$ '''python3.png]]9 --version'''</p><p>'''Python 3.9.10'''</p>|}</li><div li><p>Then update pip</p>{| class="figurewikitable" style="width:800px;">|-| [[File<p>orangepi@orangepi:zero2w~$ '''/usr/local/bin/python3.9 -m pip install --img262.png]]upgrade pip'''</p>|}</li></ol>
</div><ol startspan id="2" style="listhow-to-replace-stylepip-type: decimal;"><li><p>The downloaded installation package is as shown below, then doublesource-click to install it directly</p><p>'''FileZilla_Server_1.5.1_win64in-setup.exe'''</p></lipython"></olspan>
<div classspan id="figurehow-to-install-docker"></span>
'''<div classspan style="figurecolor:#FF0000">Hello from Docker!</span>'''
<ol style="list-style-type: decimal;">
<li><p>During First, please install docker and ensure that docker can run normally. For the running installation steps of the Linux systemdocker, if you directly unplug please refer to the power supply, it may cause instructions in the file system [[Orange Pi Zero 2W#How to install Docker|'''How to lose some dataInstall Docker''']] section. It is recommended to use </p></li><li><p>Then you can search for the docker image of Home Assistant</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''poweroffdocker search homeassistant''' </p>|}</li><li><p>Then use the following command to shut down download the Linux system Docker image of Home Assistant to your local computer. The image size is about 1GB, and the development board before powering off, download time will be relatively long. Please be patient and then unplug wait for the power supplydownload to complete.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo poweroffdocker pull homeassistant/home-assistant'''</p><p>Using default tag: latest</p><p>latest: Pulling from homeassistant/home-assistant</p><p>be307f383ecc: Downloading</p><p>5fbc4c07ac88: Download complete</p><p>'''Note that after turning off the development board, you need to unplug and replug the power supply before it can be turned on...... (Omit some output)'''</p><p>3cc6a1510c9f: Pull complete</p><p>7a4e4d5b979f: Pull complete</p><p>Digest: sha256:81d381f5008c082a37da97d8b08dd8b358dae7ecf49e62ce3ef1eeaefc4381bb</p><p>Status: Downloaded newer image for homeassistant/home-assistant:latest</p><p>docker.io/homeassistant/home-assistant:latest</p>|}</li><li><p>In addition to using the poweroff command to shut down, Then you can also use the power on/off button on following command to view the expansion board to shut down.docker image of Home Assistant you just downloaded</p>{| class="wikitable" style="width:800px;" |-| <p>[[Fileorangepi@orangepi:zero2w~$ '''docker images homeassistant/home-img269.png]]assistant'''</p><p>REPOSITORY TAG IMAGE ID CREATED SIZE</p><p>homeassistant/home-assistant latest bfa0ab9e1cf5 2 months ago '''Note that Linux 5<span style="color:#FF0000">1.4 requires manual configuration of the power on17GB</off button before it can be used. For the opening method, please refer to the method of opening the power button in Linux5.4.span>'''</p>|}</li><li><p>Use At this point you can run the Home Assistant docker container</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''docker run -d \'''</p>:<p>'''--name homeassistant \'''</p>:<p>''reboot'--privileged \'' command to '</p>:<p>'''--restart the Linux system in the development board=unless-stopped \'''</p>:<p>'''-e TZ=Asia/Shanghai \'''</p>:<p>'''-v /home/orangepi@orangepi/home-assistant:/config \'''</p>:~$ <p>'''sudo--network=host \''' </p>:<p>'''reboothomeassistant/home-assistant:latest'''</p>|}</li><li><p>Then enter【the IP address of the development board: 8123】in the browser to see the Home Assistant interface</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''It takes a while for the Home Assistant container to start. If the interface below does not display normally, please wait a few seconds before refreshing it. If the following interface is not displayed normally after waiting for more than a minute, it means there is a problem with the Home Assistant installation. At this time, you need to check whether there is a problem with the previous installation and setting process.'''</olp></big>|}<div class="figure">
</div></li>
<li><p>The main interface finally displayed by Home Assistant is as shown below</p>
<p>[[File:zero2w-img185.png]]</p></li>
<li><p>Method to stop Home Assistant container</p>
<ol style="list-style-type: lower-alpha;">
<li>For <p>The command to view the docker container is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''docker ps -a'''</p>|}</li><li><p>The command to stop the method of replacing Tsinghua Source, please refer Home Assistant container is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''docker stop homeassistant'''</p>|}</li><li><p>The command to delete the instructions on this page.Home Assistant container is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''docker rm homeassistant'''</p>|}</li></ol></li></ol>
<ol start="3" style="list-style-type: lower-alphadecimal;"><li>The contents of the <p>First install dependency packages</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y python3 python3-dev python3-venv \'''</etcp><p>'''python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \'''</aptp><p>'''libopenjp2-7 libtiff5 libturbojpeg0-dev tzdata'''</sources.listp>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>''' file that need to be replaced areIf it is debian12, please use the following command:'''</lip></olbig><p>orangepi@orangepi:~$ '''sudo apt-get update'''</p>test<p>orangepi@testorangepi:~$ '''sudo mv apt-get install -y python3 python3-dev python3-venv \'''</p><p>'''python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \'''</etcp><p>'''libopenjp2-7 libturbojpeg0-dev tzdata'''</aptp>|}</li><li><p>Then you need to compile and install Python3.9. For the method, please refer to the [[Orange Pi Zero 2W#Python related instructions|'''Python source code compilation and installation method''']] section.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''The default Python version of Debian Bullseye is Python3.9, so there is no need to compile and install it.'''</p><p>'''The default Python version of Ubuntu Jammy is Python3.10, so there is no need to compile and install it.'''</sourcesp><p>'''The default Python version of Debian Bookworm is Python3.11, so there is no need to compile and install it.list cat '''</p></etcbig>|}</aptli><li><p>Then create a Python virtual environment</sourcesp>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Debian Bookworm is python3.list11, please remember to replace the corresponding command.bak'''</p></big>|}test{| class="wikitable" style="width:800px;" |-| <p>orangepi@testorangepi:~$ '''sudo vim mkdir /srv/etchomeassistant'''</aptp><p>orangepi@orangepi:~$ '''sudo chown orangepi:orangepi /srv/sources.listhomeassistant'''</p><p>orangepi@orangepi:~$ '''cd /srv/homeassistant'''</p># The source code image is commented by default to improve apt update speed<p>orangepi@orangepi:~$ '''python3. You can uncomment it yourself if necessary9 -m venv .'''</p><p>orangepi@orangepi:~$ '''source bin/activate'''</p><p>(homeassistant) orangepi@orangepi:/srv/homeassistant$</p>|}</li><li><p>Then install the required Python packages</p>{| class="wikitable" style="width:800px;" |-| deb https<p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ '''python3 -m pip install wheel'''</mirrors.tuna.tsinghua.edu.cnp>|}</ubuntuli><li><p>Then you can install Home Assistant Core</ jammy main restricted universe multiversep>{| class="wikitable" style="width:800px;" # deb|-src https| <p>(homeassistant) orangepi@orangepi:/srv/mirrors.tuna.tsinghua.edu.cnhomeassistant$ '''pip3 install homeassistant'''</ubuntup>|}</ jammy main restricted universe multiverseli><li><p>Then enter the following command to run Home Assistant Core</p>deb https{| class="wikitable" style="width:800px;" |-| <p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ '''hass'''</p>|}</li><li><p>Then enter【'''development board IP address: 8123'''】 in the browser to see the Home Assistant interface</mirrorsp>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''When you run the hass command for the first time, some libraries and dependency packages necessary for operation will be downloaded, installed and cached.tunaThis process may take several minutes.tsinghuaNote that you cannot see the Home Assistant interface in the browser at this time.eduPlease wait for a while and then refresh it.cn'''</ubuntup></ jammy-updates main restricted universe multiversebig>|}<div class="figure">
<ol startspan id="5" style="listdebian-stylesystem-type: lowerinstallation-alpha;method"><li>'''In addition, since the source code of the kernel and Uboot are stored on GitHub, it is very important to ensure that the computer can download the code from GitHub normally when compiling the image.'''</li></olspan>=== Debian system installation method ===
<span idol style="obtainlist-style-type: decimal;"><li><p>First set thedefault '''locale''' to Chinese</p><ol style="list-sourcestyle-code-of-linuxtype: lower-sdkalpha;"><li><p>Enter the following command to start configuring '''locale'''</spanp>{| class="wikitable" style= Obtain "width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo dpkg-reconfigure locales'''</p>|}</li><li><p>Then select '''zh_CN.UTF-8 UTF-8''' in the pop-up interface (use the up and down keys on the keyboard to move up and down, use the space bar to select, and finally use the Tab key to move the cursor to '''<OK>''', and then return Car can be used)</p><p>[[File:zero2w-img186.png]]</p></li><li><p>Then set the source code of linux sdk ==default '''locale''' to '''zh_CN.UTF-8'''</p><p>[[File:zero2w-img187.png]]</p></li><span idli><p>After exiting the interface, the '''locale''' setting will begin. The output displayed on the command line is as follows:</p>{| class="wikitable" style="downloadwidth:800px;" |-| <p>orangepi@orangepi:~$ '''sudo dpkg-buildreconfigure locales'''</p><p>Generating locales (this might take a while)...</p>:<p>en_US.UTF-8... done</p>:<p>zh_CN.UTF-8... done</p><p>Generation complete.</p>|}</li></ol></li><li><p>Then open '''Input Method'''</p><p>[[File:zero2w-fromimg188.png]]</p></li><li><p>Then select '''OK'''</p><p>[[File:zero2w-github"img189.png]]</p></li><li><p>Then select '''Yes'''</spanp>=== Download orangepi<p>[[File:zero2w-build from github ===img190.png]]</p></li><li><p>Then select '''fcitx'''</p>Linux sdk refers to the orangepi<p>[[File:zero2w-build set of codesimg191. Orangepipng]]</p></li><li><p>Then select '''OK'''</p><p>[[File:zero2w-build is modified based on img192.png]]</p></li><li><p>'''<span style="color:#FF0000">Then restart the armbian build compilation Linux systemto make the configuration take effect. Multiple versions of Linux images can be compiled using orangepi</span>'''</p></li><li><p>Then open '''Fcitx configuration'''</p><p>[[File:zero2w-buildimg193. Use png]]</p></li><li><p>Then click the following command to download + sign as shown in the orangepipicture below</p><p>[[File:zero2w-build code:img194.png]]</p></li><li><p>Then search '''Google Pinyin''' and click '''OK'''</p><div class="figure">
</div></li><li><p>Then put '''Google Pinyin''' on top</p><p>[[File:zero2w-img196.png]]</p><p>[[File:zero2w-img197.png]]</p></li><li><p>Then open the '''Geany''' editor to test the Chinese input method</p><p>[[File:zero2w-img198.png]]</p></li><li><p>The Chinese input method testis as follows</p><p>[[File:zero2w-img199.png]]</p></li><li><p>You can switch between Chinese and English input methods through the '''Ctrl+Space''' shortcut key</p></li><li><p>If you need the entire system to be displayed in Chinese, you can set all variables in '''/etc/default/locale''' to '''zh_CN.UTF-8'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@testorangepi:~$ '''sudo aptvim /etc/default/locale'''</p><p># File generated by update-get install locale</p><p>LC_MESSAGES='''<span style="color:#FF0000">zh_CN.UTF-y git8</span>'''</p><p>LANG='''<span style="color:#FF0000">zh_CN.UTF-8</span>'''</p><p>LANGUAGE='''<span style="color:#FF0000">zh_CN.UTF-8</span>'''</p>|}</li><li><p>Then '''<span style="color:#FF0000">restart the system</span>''' and you will see that the system is displayed in Chinese.</p><p>[[File:zero2w-img200.png]]</p></li></ol>
<div ol style="list-style-type: decimal;"><li><p>First open '''Language Support'''</p><p>[[File:zero2w-img201.png]]</p></li><li><p>Then find the '''Chinese (China)''' option</p><p>[[File:zero2w-img202.png]]</p></li><li><p>Then please use the left button of the mouse to select '''Chinese (China)''' and hold it down, then drag it up to the starting position. After dragging, the display will be as shown below:</p><p>[[File:zero2w-img203.png]]</p></li>{| class="figurewikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note that this step is not easy to drag, please be patient and try it a few times.'''</big>|}</ol><ol start="4" style="list-style-type: decimal;"><li><p>Then select '''Apply System-Wide''' to apply the Chinese settings to the entire system</p><p>[[File:zero2w-img272img204.png]]</p></li><li><p>Then set the '''Keyboard input method system''' system to '''fcitx'''</p><p>[[File:zero2w-img205.png]]</p></divli><li><p>'''When downloading <span style="color:#FF0000">Then restart the Linux system to make the orangepiconfiguration take effect</span>'''</p></li><li><p>After re-build code through entering the git clone commandsystem, you do please select '''Do not need to enter ask me again''' in the user name following interface, and password of then please decide according to your own preferences whether the github account (standard folder should also be updated to Chinese</p><p>[[File:zero2w-img206.png]]</p></li><li><p>Then you can see that the same desktop is true for downloading other codes displayed in this manual)Chinese</p><p>[[File:zero2w-img207. If after entering the git clone command, Ubuntu PC prompts you png]]</p></li><li><p>Then we can open '''Geany''' to enter test the user name of the github accountChinese input method. The name and password are usually entered incorrectly opening method is as shown in the address of the orangepifigure below</p><p>[[File:zero2w-build warehouse behind git cloneimg208. Please carefully check whether there are any errors in png]]</p></li><li><p>After opening '''Geany''', the spelling of English input method is still the command, rather than thinking that we have forgotten default. We can switch to provide the username and password of Chinese input method through the github account.'''Ctrl+Space''' shortcut key, and then we can input Chinese.</p><p>[[File:zero2w-img209.png]]</p></li></ol> <span id="installation-method-of-ubuntu-22.04-system"></span>
<ol style="list-style-type: decimal;"><li><p>First open '''Language Support'''</p><p>[[File:zero2w-img201.png]]</p></li><li><p>Then find the '''Chinese (China)''' option</p><p>[[File:zero2w-img210.png]]</p></li><li><p>Then please use the left button of the mouse to select '''Chinese (China)''' and hold it down, then drag it up to the starting position. After dragging, the display will be as shown below:</p><p>[[File:zero2w-img211.png]]</p></li>{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| '''branch'''| '''u-boot Version'''| '''linux Kernel version'''|-| '''current'''| '''u-boot v2018.05'''| '''linux5.4'''|-| '''next'''| '''u-boot v2021.07'''| <big>'''linux6Note that this step is not easy to drag, please be patient and try it a few times.1'''</big>
|}
</ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>Then select '''Apply System-Wide''' to apply the Chinese settings to the entire system</p>
<p>[[File:zero2w-img212.png]]</p></li>
<li><p>'''<span style="color:#FF0000">Then restart the Linux system to make the configuration take effect</span>'''</p></li>
<li><p>After re-entering the system, please select '''Do not ask me again''' in the following interface, and then please decide whether the standard folder should also be updated to Chinese according to your own preferences.</p>
<p>[[File:zero2w-img206.png]]</p></li>
<li><p>Then you can see that the desktop is displayed in Chinese</p>
<p>[[File:zero2w-img207.png]]</p></li>
<li><p>Then open the Fcitx5 configuration program</p>
<p>[[File:zero2w-img213.png]]</p></li>
<li><p>Then choose to use Pinyin input method</p>
<div class="figure">
{| 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 idstyle="download-the-cross-compilation-tool-chaincolor:#FF0000">desktop version</span>=== Download 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 cross-compilation tool chain ===use of NoMachine. The document link is as follows:'''
<ol style="list-style-type: decimal;">
<li><p>First download the installation package of the NoMachine software Linux '''<span style="color:#FF0000">arm64</span>''' deb version, and then install it into the Linux system of the development board</p>
<ol style="list-style-type: lower-alpha;">
<li>linux5Since H618 is an ARMv8 architecture SOC and the system we use is Ubuntu or Debian, we need to download the '''NoMachine for ARM ARMv8 DEB''' installation package.4The download link is as follows:</li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note that this download link may change, please look for the Armv8/Arm64 version of the deb package.'''</olbig>|}{| class="wikitable" style="width:800px;" |-| [https://www.nomachine.com/download/download&id=112&s=ARM '''https://downloads.nomachine.com/download/?id=118&distro=ARM''']|}
[[File:zero2w-img217.png]]</ol><ol start="2" style="list-style-type: lower-alpha;"><li><p>In addition, you can also download the '''NoMachine''' installation package from the official tool.</p><p>[[File:zero2w-img218.png]]</p><p>First enter the '''remote login software-NoMachine'''gccfolder</p><p>[[File:zero2w-armimg219.png]]</p><p>Then download the arm64 version of the deb installation package</p><p>[[File:zero2w-11img220.2png]]</p></li><li><p>Then upload the downloaded '''nomachine_x.x.x_x_arm64.deb''' to the Linux system of the development board</p></li><li><p>Then use the following command to install '''NoMachine''' in the Linux system of the development board</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo dpkg -2022i nomachine_x.x.02x_x_arm64_arm64.deb'''</p>|}</li></ol></li></ol><ol start="2" style="list-x86_64style-aarch64type: decimal;"><li>Then download the installation package of the Windows version of the NoMachine software. The download address is as follows</li>{| class="wikitable" style="background-nonecolor:#ffffdc;width:800px;" |-linux| <big>'''Note that this download link may change.'''</big>|}{| class="wikitable" style="width:800px;" |-gnu| '''https://downloads.nomachine.com/download/?id=9'''|}
[[File:zero2w-img221.png]]</ol><ol start="23" style="list-style-type: lower-alphadecimal;"><li>linux6<p>Then install NoMachine in Windows. '''Please restart your computer after installation.'''</p></li><li><p>Then open '''NoMachine''' in Window</p><p>[[File:zero2w-img222.png]]</p></li><li><p>After NoMachine is started, it will automatically scan other devices with NoMachine installed on the LAN. After entering the main interface of NoMachine, you can see that the development board is already in the list of connectable devices, and then click on the location shown in the red box in the picture below You can now log in to the Linux system desktop of the development board.</p><p>[[File:zero2w-img223.png]]</p></li><li><p>Then click '''OK'''</p><p>[[File:zero2w-img224.png]]</p></li><li><p>Then enter the username and password of the development board Linux system in the corresponding positions in the figure below, and then click OK to start logging in.</p><p>[[File:zero2w-img225.1png]]</p></li><li><p>Then click OK in the next interface.</p></li><li><p>Finally you can see the desktop of the development board Linux system</p><p>[[File:zero2w-img226.png]]</p></li></ol>
'''gcc-linaro-7<span style="color:#FF0000">There are many problems with VNC testing in Ubuntu20.404, please do not use this method.1-2019.02-x86_64_arm-linux-gnueabi</span>'''</big>|}
<ol start="2" style="list-style-type: lower-alphadecimal;"><li>v2021<p>First run the '''set_vnc.sh''' script to set up vnc, '''remember to add sudo permission'''s</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo set_vnc.07sh'''</lip><p>You will require a password to access your desktops.</olp>
<p>Password: '''<span idstyle="orangepi-build-complete-directory-structure-descriptioncolor:#FF0000">#Set the vnc password here, 8 characters</span>'''</p><p>Verify: '''<span style=== orangepi"color:#FF0000">#Set the vnc password here, 8 characters</span>'''</p><p>Would you like to enter a view-build complete directory structure description ==only password (y/n)? '''<span style="color:#FF0000">n</span>'''</p><p>xauth: file /root/.Xauthority does not exist</p>
<ol start="2" style="list-style-type: lower-alpha;"p>Creating default startup script /root/.vnc/xstartup</p><lip>Linux6Starting applications specified in /root/.1vnc/xstartup</lip><p>Log file is /root/.vnc/orangepi:1.log</olp>
<ol start="2" style="list-style-typep>New 'X' desktop is orangepi: lower-alpha;"><li>v2021.07</li>1</olp>
<ol start="2" style="list-style-typep>Starting applications specified in /root/.vnc/xstartup</p><p>Log file is /root/.vnc/orangepi: decimal;"1.log</p>|}</li><li><p>When orangepi-build is run for the first time, it will download The steps to use MobaXterm software to connect to 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 development board Linux system desktop areas follows:</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 imageFirst click Session, scripts for specific functionsthen select VNC, and the source code of some programs. The rootfs compressed package cached during the image compilation process is also stored then fill in external.</p></li><li><p>'''kernel''': Store the source code IP address and port of the linux kernel</p></li><li><p>'''LICENSE''': GPL 2 license file</p></li><li><p>'''README.md''': orangepi-build documentation</p></li><li><p>'''output''': Store compiled u-boot, linux and other deb packages, compilation logsdevelopment board, and compiled images and other files</p></li><li><p>'''scripts''': Common script for compiling linux images</p></li><li><p>'''toolchains''': Store cross-compilation tool chain</p></li><li><p>'''u-boot''': Store the source code of u-boot</p></li><li><p>'''userpatches''': Store the configuration files needed finally click OK to compile the script</p></li></ol>confirm.</li></ol>
<span id/div></ol><ol start="2" style="compilelist-style-utype: lower-bootalpha;"><li><p>Then enter the VNC password set earlier</spanp>== Compile u<p>[[File:zero2w-boot ==img228.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></li>
<ol start="2" style="list-style-type: decimal;"><li>Select '''U-boot package''' and press Enter</lip>Use the following script to install QT5 and QT Creator</olp> <div {| class="figure"> [[File:zero2w-img274.png]] </div><ol start="3wikitable" style="list-style-typewidth: decimal800px;">|-| <lip>Then select the model of the development boardorangepi@orangepi:~$ '''install_qt.sh'''</li></olp> [[File:zero2w-img275.png]]|}<ol start="4" style="list-style-type: decimal;"/li><li><p>Then select After installation, the branch type of u-bootQT version number will be automatically printed.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The current branch will compile the uqt version that comes with Ubuntu20.04 is '''5.12.8'''</p>{| class="wikitable" style="width:800px;" |-boot v2018| <p>orangepi@orangepi:~$ '''install_qt.05 sh'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version code that needs to be used by the linux5'''<span style="color:#FF0000">5.4 image12.8</span>''' in /usr/lib/aarch64-linux-gnu</p>|}</li><li><p>The next branch will compile the uQT version that comes with Ubuntu22.04 is '''5.15.3'''</p>{| class="wikitable" style="width:800px;" |-boot v2021| <p>orangepi@orangepi:~$ '''install_qt.sh'''</p><p>.....07 .</p><p>QMake version code that needs to be used by the linux63.1 image</p><p>Using Qt version '''<span style="color:#FF0000">5.15.3</span>''' in /usr/lib/aarch64-linux-gnu</p>|}</li><li><p>The QT version that comes with Debian11 is '''5.15.2'''</p>[[File{| class="wikitable" style="width:zero2w800px;" |-img276| <p>orangepi@orangepi:~$ '''install_qt.png]]sh'''</p><p>......</lip><p>QMake version 3.1</p><p>Using Qt version '''<span style="color:#FF0000">5.15.2</span>''' in /usr/lib/aarch64-linux-gnu</olp>|}
</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 branchThe QT version that comes with Debian12 is '''5.15.8'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''install_qt.sh'''</lip><p>......</olp> <blockquotep>aQMake version 3. If the development board you purchased has a memory size of 1</p><p>Using Qt version '''<span style="color:#FF0000">5.5GB, please select the first option15.8</span>''' in /usr/lib/aarch64-linux-gnu</p>|}b. If the development board </li></ol></li><li><p>Then you purchased has 1GB or 2GB or 4GB memory size, please choose can see the second optionQT Creator startup icon in '''Applications'''</p><p>[[File:zero2w-img230.png]]</p><p>You can also use the following command to open QT Creator</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''qtcreator'''</p>|}</blockquoteli><li><p>The interface after QT Creator is opened is as follows</p><p>[[File:zero2w-img277img231.png]]</p></li><li><p>The version of QT Creator is as follows</p><ol start="6" style="list-style-type: decimallower-alpha;"><li><p>Then it will start to compile uThe 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-bootimg233. Some png]]</p></li><li><p>The default version of the information prompted when compiling the next branch QT Creator in '''Debian11''' is as follows</p><p>[[File:zero2w-img234.png]]</p></li><li><p>The default version of QT Creator in '''Debian12''' is as follows</p><p>[[File:zero2w-img235.png]]</p></li></ol></li><li><p>Then set up QT</p><ol style="list-style-type: lower-alpha;"><li>Version <p>First open '''Help'''->'''About Plugins...'''.</p><p>[[File:zero2w-img236.png]]</p></li><li><p>Then remove the check mark of u'''ClangCodeModel'''</p><p>[[File:zero2w-img237.png]]</p></li><li><p>'''<span style="color:#FF0000">After setting up, you need to restart QT Creator</span>'''</p></li><li><p>Then make sure the GCC compiler used by QT Creator. If the default is Clang, please change it to GCC.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Debian12 please skip this step.'''</p></big>|}<p>[[File:zero2w-img238.png]]</p><p>[[File:zero2w-boot source img239.png]]</p></li></ol></li><li><p>Then you can open a sample code</p><p>[[File:zero2w-img240.png]]</p></li><li><p>After clicking on the sample code, the corresponding instruction document will automatically open. You can read the instructions carefully.</p><p>[[File:zero2w-img241.png]]</p></olli><li><p>Then click '''Configure Project'''</p><p>[[File:zero2w-img242.png]]</p></li><li><p>Then click the green triangle in the lower left corner to compile and run the 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:zero2w-img244.png]]</p></li><li><p>References</p>{| class="wikitable" style="width:800px;" |-| <p>[https://wiki.qt.io/Install_Qt_5_on_Ubuntu '''https://wiki.qt.io/Install_Qt_5_on_Ubuntu''']</p><p>[https://download.qt.io/archive/qtcreator '''https://download.qt.io/archive/qtcreator''']</p><p>[https://download.qt.io/archive/qt '''https://download.qt.io/archive/qt''']</p>|}
</li></ol>
<ol startspan id="3" style="listhow-to-install-ros-1-stylenoetic-type: loweron-alpha;ubuntu20.04"><li/span>Path === How to the compiled u-boot deb package</li></ol>install ROS 1 Noetic on Ubuntu20.04 ===
::[[ o.k. ] File name [ '''linux:zero2w-u-boot-next-orangepizero2w_ximg246.x.x_arm64.deb''' png]]
<ol start="62" style="list-style-type: lowerdecimal;"><li><p>The link to the official installation documentation of ROS 1 '''Noetic Ninjemys''' is as follows:</p>{| class="wikitable" style="width:800px;" |-alpha| <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>Repeat <li><p>Then use the command script below to compile uinstall ros1</p>{| class="wikitable" style="width:800px;" |-boot| <p>orangepi@orangepi:~$ '''install_ros. Use sh ros1'''</p>|}</li><li><p>Before using the following command without selecting through ROS tool, you first need to initialize rosdep. Then when compiling the graphical interface. You source code, you can start compiling u-boot directlyquickly install some system dependencies and some core components in ROS.</p></li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''<span style="color:#FF0000">Note that when running the following command, you need to ensure that the development board can access github normally, otherwise an error will be reported due to network problems.</olspan>'''
'''linux-u-boot-next-orangepizero2w_xhttps://raw.xgithubusercontent.x_arm64com/ros/rosdistro/master/rosdep/osx-homebrew.debyaml'''
::'''<span style="color:#FF0000">The read operation timed out</span>'''</big>|}{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''source /opt/ros/noetic/setup......bash'''
Wrote /etc/ros/rosdep/sources.list.d/20-default....list
orangepi@orangepi:~$ '''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb [mailto:root@192.168.1.xxx:/root root@192.168.1.xxx:/root]rosdep update'''
updated cache in /home/orangepi/.ros/rosdep/sources.cache
|}
</ol>
<ol start="6" style="list-style-type: decimal;">
<li>If you choose to display <p>Then open a command line terminal window on the kernel configuration menu (the second option) in step 3)'''desktop''', and then use the kernel configuration interface opened through '''make menuconfigtest_ros.sh''' will pop upscript to start a small turtle routine to test whether ROS can be used normally. At this time, you can directly modify the kernel configuration</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''test_ros. sh'''</p>|}</li><li><p>After modification, save and exitrunning the '''test_ros. Yessh''' script, compilation of a small turtle as shown in the kernel source code picture below will begin after exitingpop up.</p><p>[[File:zero2w-img248.png]]</p></li><li><p>Then please keep the terminal window you just opened at the top</p></olli>
<ol startspan id="2" style="listhow-to-install-styleros-type: lower2-alpha;"><li><p>b. You can also set '''KERNEL_CONFIGURE=no''' in the orangepigalactic-build/userpatches/configon-defaultubuntu20.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></li04"></olspan>
<ol start="7" style="list-style-type: decimal;"><li><p>Part The currently active version of the information prompted when compiling the next branch kernel source code ROS 2 is explained as follows, the recommended version is '''Galactic Geochelone'''</p><p>[[File:zero2w-img251.png]]</p><ol p>[[File:zero2w-img252.png]]</p>{| class="wikitable" style="listwidth:800px;" |-| <p>[http://docs.ros.org/ '''http://docs.ros.org''']</p><p>'''http://docs.ros.org/en/galactic/Releases.html'''</p>|}</li><li><p>The link to the official installation documentation of ROS 2 '''Galactic Geochelone''' is as follows:</p>{| class="wikitable" style="width:800px;" |-type| <p>'''docs.ros.org/en/galactic/Installation.html'''</p><p>'''http: lower//docs.ros.org/en/galactic/Installation/Ubuntu-Install-alpha;"Debians.html'''</p>|}</li><li>Version <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 linux kernel source codedevelopment board is the '''<span style="color:#FF0000">Ubuntu20.04 desktop system</span>'''. There are several ways to install ROS 2. The following demonstrates how to install ROS 2 '''Galactic Geochelone''' through '''Debian packages'''.</p></li><li><p>Use the '''install_ros.sh''' script to install ros2</olp>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''install_ros.sh ros2'''</p>|}</li><li><p>The '''install_ros.sh''' script will automatically run the '''ros2 -h''' command after installing ros2. If you can see the following print, it means that the ros2 installation is complete.</olp>{| class="wikitable" style="width:800px;" |-| <p>usage: ros2 [-h] Call `ros2 <command> -h` for more detailed usage. ...</p>
<ol start="2" style="list-style-type: lower-alpha;"><lip>The version of the crossros2 is an extensible command-compilation line tool chain used</li>for ROS 2.</olp>
<ol start="3" style="list-style-typep>optional arguments: lower-alpha;"</p>:<lip>The default configuration file used by the kernel -h, --help show this help message and the path where it is stored are as follows</li>exit</olp>
<ol start="4" style="listp>Commands:</p>:<p>action Various action related sub-commands</p>:<p>bag Various rosbag related sub-stylecommands</p>:<p>component Various component related sub-commands</p>:<p>daemon Various daemon related sub-typecommands</p>:<p>doctor Check ROS setup and other potential issues</p>:<p>interface Show information about ROS interfaces</p>: lower<p>launch Run a launch file</p>:<p>lifecycle Various lifecycle related sub-alpha;"commands</p>:<lip>The path to the kernelmulticast Various multicast related sub-commands</p>:<p>node Various node related sub-commands</p>:<p>param Various param related deb sub-commands</p>:<p>pkg Various package generated by compilationrelated sub-commands</lip>:<p>run Run a package specific executable</p>:<p>security Various security related sub-commands</p>:<p>service Various service related sub-commands</p>:<p>topic Various topic related sub-commands</p>:<p>wtf Use `wtf` as alias to `doctor`</olp>
:<ol start="5" style="listp>Call `ros2 <command> -style-type: lower-alpha;"h` for more detailed usage.</p>|}</li>The package name of the kernel image deb package generated by compilation</li></olp> [ o.k. ] File name [ Then you can use the '''linux-image-next-sun50iw9_xtest_ros.x.x_arm64.debsh''' ]script to test whether ROS 2 is installed successfully. If you can see the following print, it means ROS 2 can run normally.</p> <ol start{| class="6wikitable" style="list-style-typewidth: lower-alpha800px;">|-| <lip>Compilation timeorangepi@orangepi:~$ '''test_ros.sh'''</lip></olp> [ o.kINFO] [1671174101. 200091527] Runtime [ talker]: Publishing: 'Hello World: 1''10 min''' ]</p><ol start="7" style="list-style-typep>[INFO] [1671174101.235661048] [listener]: I heard: [Hello World: lower-alpha;"1]</p><lip>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[INFO] [1671174102.199572327] [talker]: Publishing: 'Hello World: 2'</lip><p>[INFO] [1671174102.204196299] [listener]: I heard: [Hello World: 2]</olp> <p>[INFO] [ o.k1671174103. 199580322] Repeat Build Options [ talker]: Publishing: 'Hello World: 3''sudo .</buildp><p>[INFO] [1671174103.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=kernel KERNEL_CONFIGURE=no''' 204019965] [listener]: I heard: [Hello World: 3]</p>|}<ol start="8" style="list-style-type: decimal;"/li><li><p>View Run the kernel-related deb package generated by compilationfollowing command to open rviz2</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li>|-| <p>orangepi@orangepi:~$ '''linux-dtb-next-sun50iw9_xsource /opt/ros/galactic/setup.x.x_arm64.debbash''' Contains dtb files used by the kernel</p></li><li><p>orangepi@orangepi:~$ '''linux-headers-next-sun50iw9_x.x.x_arm64.debros2 run rviz2 rviz2''' Contains kernel header files</p>|}<p>[[File:zero2w-img253.png]]</p></li><li><p>For how to use ROS, please refer to the documentation of ROS 2.</p>{| class="wikitable" style="width:800px;" |-| <p>[http://docs.ros.org/en/galactic/Tutorials.html '''linux-image-next-sun50iw9_xhttp://docs.xros.x_arm64org/en/galactic/Tutorials.debhtml''' Contains kernel images and kernel modules]</p></li></ol>|}
</li></ol>
<ol start="9" style="list-style-type: decimal;"p><li>When the orangepiros2 is an extensible command-bulid compilation system compiles the linux kernel source code, it will first synchronize the linux kernel source code with the linux kernel source code of the github server. Therefore, if you want to modify the linux kernel source code, you first need to turn off the update function of the source code ('''it needs to be completely compiled once This function can only be turned off after obtaining the Linux kernel source code, otherwise it will prompt that the source code of the Linux kernel cannot be found'''), otherwise the modifications will be restoredline tool for ROS 2. The method is as follows:</li></olp>
:<p>Call `ros2 <command> -h` for more detailed usage.</p>|}</li><li><p>Then you can use the '''linuxtest_ros.sh''' script to test whether ROS 2 is successfully installed. If you can see the following print, it means ROS 2 can run normally.</p>{| class="wikitable" style="width:800px;" |-image| <p>orangepi@orangepi:~$ '''test_ros.sh'''</p><p>[INFO] [1671174101.200091527] [talker]: Publishing: 'Hello World: 1'</p><p>[INFO] [1671174101.235661048] [listener]: I heard: [Hello World: 1]</p><p>[INFO] [1671174102.199572327] [talker]: Publishing: 'Hello World: 2'</p><p>[INFO] [1671174102.204196299] [listener]: I heard: [Hello World: 2]</p><p>[INFO] [1671174103.199580322] [talker]: Publishing: 'Hello World: 3'</p><p>[INFO] [1671174103.204019965] [listener]: I heard: [Hello World: 3]</p>|}</li><li><p>Run the following command to open rviz2</p>{| class="wikitable" style="width:800px;" |-next| <p>orangepi@orangepi:~$ '''source /opt/ros/humble/setup.bash'''</p><p>orangepi@orangepi:~$ '''ros2 run rviz2 rviz2'''</p><p>[[File:zero2w-sun50iw9_ximg254.xpng]]</p>|}</li><li><p>Reference documentation</p>{| class="wikitable" style="width:800px;" |-| <p>'''http://docs.x_arm64ros.deb root@192org/en/humble/index.html'''</p><p>[http://docs.168ros.1org/en/galactic/Tutorials.xxxhtml '''http:/root/docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html''']</p>|}</li></ol>
<ol startspan id="2" style="listhow-to-install-stylekernel-type: lowerheader-alpha;files"><li>Install the deb package of the new linux kernel just uploaded.</li></olspan>
<ol style="list-style-type: decimal;"><li><p>The Linux image released by OPi comes with the deb package of the kernel header file by default, and the storage location is '''/opt/'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudols /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>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''rebootsudo dpkg -i /opt/linux-headers*.deb'''</p>|}<span id/li><li><p>After installation, you can see the folder where the kernel header file is located under '''/usr/src'''.</p>{| class="compilewikitable" style="width:800px;" |-rootfs"| <p>orangepi@orangepi:~$ '''ls /usr/src'''</p><p>linux-headers-x.x.x</spanp>== Compile rootfs ==|}</li># Run <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 buildhello module is in '''/usr/src/hello'''.sh scriptAfter entering this directory, remember then use the make command to add sudo permissionscompile.</p>{| class="wikitable" style="width:800px;" |-| test<p>orangepi@testorangepi:~$ '''cd /usr/src/hello/'''</p><p>orangepi@orangepi-build:/usr/src/hello$ '''sudo make'''</p><p>make -C /lib/modules/5.4.125/buildM=/usr/src/hello modules</p><p>make[1]: Entering directory '/usr/src/linux-headers-5.sh4.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>|}<ol start/li><li><p>After compilation, the '''hello.ko''' kernel module will be generated</p>{| class="2wikitable" style="listwidth:800px;" |-| <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>{| class="wikitable" style-type="width: decimal800px;"|-| <p>orangepi@orangepi:/usr/src/hello$ '''sudo insmod hello.ko'''</p>|}</li>Select <li><p>Then use the '''Rootfs and all deb packagesdemsg''' 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="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:/usr/src/hello$ '''dmesg | grep "Hello"''' and press Enter</lip><p>[ 2871.893988] '''Hello Orange Pi -- init'''</olp>|}<div /li><li><p>Use the '''rmmod''' command to uninstall the '''hello.ko''' kernel module</p>{| class="figurewikitable" style="width:800px;" |-| <p>orangepi@orangepi:/usr/src/hello$ '''sudo rmmod hello'''</p><p>orangepi@orangepi:/usr/src/hello$ '''dmesg | grep "Hello"'''</p><p>[ 2871.893988] Hello Orange Pi -- init</p><p>[ 3173.800892] '''Hello Orange Pi -- exit'''</p>|}</li></ol>
<ol start="4" style="list-style-type: decimal;"><li><p>Then select Debian Bullseye is installed with the branch type of gcc compilation tool chain by default, which can directly compile C language programs in the kernel source code. Different versions Linux system of the kernel source code maintain different rootfs typesdevelopment board.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>In the current branch, you can see three optionsThe version of a.gcc is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi: debian11~$ '''gcc --version'''</p><p>gcc (Debian 10.2.1-6) 10.2.1 20210110</p><p>Copyright (C) 2020 Free Software Foundation, ubuntu20Inc.04, and ubuntu22</p><p>This is free software; see the source for copying conditions.04There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>|}</li><li><p>In Write the next branch, you can see three options: debian11, debian12, and ubuntu22.04'''hello_world.c''' program in C language</p>{| class="wikitable" style="width:800px;" |-| </lip>orangepi@orangepi:~$ '''vim hello_world.c'''</olp></lip>#include <stdio.h></olp>
<ol start="5" style="list-style-type: decimal;"p>int main(void)</p><lip>Then select the type of rootfs{</lip>:<p>printf("Hello World!\n");</olp>
:<ol start="6" style="list-style-type: decimalp>return 0;"</p><p>}</p>|}</li><li><p>Then select the type of imagecompile and run '''hello_world.c'''</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li>|-| <p>orangepi@orangepi:~$ '''Image with console interface (server)gcc -o hello_world hello_world.c''' Represents the image of the server version, which is relatively small in size.</p></li><li><p>orangepi@orangepi:~$ '''Image with desktop environment./hello_world''' Represents an image with a desktop, which is relatively large in size.</p></lip>Hello World!</olp>|}
</li></ol>
<ol style="list-style-type: lower-alpha;">
<li><p>The specific version of Python 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 "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 '''hello_world.py''' program in Python language</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.py'''</p><p>print('Hello World!')</p>|}</li><li><p>The result of rootfsrunning '''hello_world.py''' is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 hello_world.py'''</lip><p>Hello World!</olp>|}
</li></ol>
<ol style="list-style-type: lower-alpha;">
<li><p>You can use the following command to install openjdk. The latest version in Debian Bullseye is openjdk-17</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''bullseyesudo apt install -y openjdk-xfce17-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4jdk''' It is a compressed package of rootfs. The meaning of each field in the name is</lip>|}</olli></li><p>After installation, you can check the Java version.</olp>{| class="wikitable" style="width:800px;" |-| <blockquotep>a) orangepi@orangepi:~$ '''bullseyejava --version''' represents </p>|}</li><li><p>Write the type of Linux distribution Java version of rootfs b) '''xfcehello_world.java''' indicates that the rootfs is the desktop version, and if it is cli, it indicates the server version.</p>{| class="wikitable" style="width:800px;" |-| c) <p>orangepi@orangepi:~$ '''arm64vim hello_world.java''' represents the architecture type of rootfs</p><p>public class hello_world</p><p>{</p>d:<p>public static void main(String[] args) </p>:<p>{</p>::<p>System.out.println("Hello World!");</p>:<p>}</p><p>}</p>|}</li><li><p>Then compile and run '''25250ec7002de9e81a41de169f1f89721hello_world.java''' is the MD5 hash value generated by the package names of all software packages installed by rootfs. As long as the list of software packages installed by rootfs is not modified, this value will not change. The compilation script will use this MD5 hash value. Determine whether rootfs needs to be recompiled</blockquotep><ol start{| class="2wikitable" style="list-style-typewidth: lower-alpha800px;">|-| <lip>orangepi@orangepi:~$ '''bullseye-xfce-arm64javac hello_world.5250ec7002de9e81a41de169f1f89721.tar.lz4.listjava''' Lists the package names of all packages installed by rootfs</lip></olp> testorangepi@testorangepi:~/orangepi-build$ '''ls external/cache/rootfs/java hello_world'''</p><p>Hello World!</p>|}</li></ol>bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4</li></ol>
<ol startstyle="11list-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: decimallower-alpha;"><li>If the required rootfs already exists under <p>The version of a.gcc is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''external/cache/rootfsgcc --version'''</p><p>gcc (Debian 12.2.0-14) 12.2.0</p><p>Copyright (C) 2022 Free Software Foundation, then compiling Inc.</p><p>This is free software; see the rootfs again will directly skip the compilation process and will source for copying conditions. There is NO</p><p>warranty; not restart even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>|}</li><li><p>Write the compilation'''hello_world. When compiling the image, it will also go to c'''externalprogram in C language</cache/rootfsp>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ ''' to check whether it already exists. There is a cached rootfs available. If it is available, use it directly. This can save a lot of download and compilation timevim hello_world.c'''</lip><p>#include <stdio.h></olp>
:<ol start="2" style="list-style-type: decimalp>return 0;"</p><p>}</p>|}</li><li>Select <p>Then compile and run '''Full OS image for flashinghello_world.c''' and press Enter</li></olp> <div {| class="figurewikitable">style="width:800px;" |-| [[File<p>orangepi@orangepi:zero2w~$ '''gcc -img292o hello_world hello_world.png]] c'''</divp><ol start="3" style="list-style-typep>orangepi@orangepi: decimal;"~$ '''./hello_world'''</p><lip>Hello World!</p>Then select the model of the development board|}</li></ol> [[File:zero2w-img275.png]] <ol start="4" style="list-style-type: decimal;"/li><li><p>Then select the branch type of the kernel source code. Different versions of the kernel source code maintain different rootfs types.Debian Bookworm has Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li><p>In the current branchThe specific version of Python is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3'''</p><p>Python 3.11.2 (main, Mar 13 2023, you can see three options12:18: debian1129) [GCC 12.2.0] on linux</p><p>Type "help", ubuntu20.04"copyright", and ubuntu22"credits" or "license" for more information.04</p><p>>>></p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p></big>|}</li><li><p>In Write the next branch, you can see three options'''hello_world.py''' program in Python language</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi: debian11, debian12, and ubuntu22~$ '''vim hello_world.04py'''</p><p>print('Hello World!')</p>|}</li><li><p>The result of running '''hello_world.py''' is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 hello_world.py'''</lip><p>Hello World!</olp>|}
</li></ol>
</li>
<li><p>Then select the type of rootfs</p></li></ol> [[File:zero2w-img286Debian Bookworm does not install Java compilation tools and operating environment by default.png]] <ol start="7" style="list-style-type: decimal;"><li><p>Then select the type of image</p>
<ol style="list-style-type: lower-alpha;">
<li><p>You can use the following command to install openjdk. The latest version in Debian Bookworm is openjdk-17</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''Image with console interface (server)sudo apt install -y openjdk-17-jdk''' Represents </p>|}</li><li><p>After installation, you can check the image of Java version.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''java --version'''</p>|}</li><li><p>Write the server Java version, which is relatively small in sizeof '''hello_world.java'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println("Hello World!");</p>:<p>}</p><p>}</p>|}</li><li><p>Then compile and run '''Image with desktop environmenthello_world.java'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''Represents an image with a desktop, which is relatively large in sizejavac hello_world.java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p>|}</li></ol>
</li></ol>
<div classspan id="figureubuntu-focal-system"></span>
<ol style="list-style-type: lower-alpha;">
<li><p>The storage path specific version of the compiled imagePython3 is as follows</li></olp></li></ol> [ o.k. ] Done building [ '''output/images/orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop/orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop.img''' ] <ol start{| class="2" style="list-style-type: lower-alpha;"><li>Compilation time</li></ol> '''[ o.k. ] Runtime [ 19 min ]''' <ol start="3wikitable" style="list-style-typewidth: lower-alpha800px;"><li>Repeat the command to compile the image. Use the following command to start compiling the image directly without selecting it through the graphical interface.</li></ol> [ o.k. ] Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=image RELEASE=bullseye BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_CONFIGURE=yes''' ] <span id="instructions-for-using-the-orange-pi-os-arch-system"></span> = '''Instructions for using the Orange Pi OS Arch system''' = <span id="orange-pi-os-arch-system-function-adaptation-status"></span>== Orange Pi OS Arch system function adaptation status == {| class="wikitable"
|-
| <p>orangepi@orangepi:~$ '''Motherboard functionspython3'''</p><p>Python 3.8.10 (default, Nov 14 2022, 12:59:47)</p><p>[GCC 9.4.0] on linux</p><p>Type "help", "copyright", "credits" or "license" for more information.</p><p>>>></p>| '''OPi OS Arch'''}{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big><p>'''HDMI videoUse the Ctrl+D shortcut key to exit python's interactive mode.'''</p></big>| }</li><li><p>Write the '''OKhello_world.py'''program in Python language</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''vim hello_world.py''HDMI Audio'</p><p>print('Hello World!')</p>| }</li><li><p>The result of running '''OKhello_world.py'''is as follows</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''Type-C USB2python3 hello_world.0 x 2py'''</p><p>Hello World!</p>| '''OK'''}</li></ol></li><li><p>Ubuntu Focal does not have Java compilation tools and running environment installed by default.</p><ol style="list-style-type: lower-alpha;"><li><p>You can use the following command to install openjdk-17</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''TF Card Startupsudo apt install -y openjdk-17-jdk'''</p>|}</li><li><p>After installation, you can check the Java version.</p>{| '''OK'''class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''WIFIjava --version'''</p><p>openjdk 17.0.2 2022-01-18</p><p>OpenJDK Runtime Environment (build 17.0.2+8-Ubuntu-120.04)</p><p>OpenJDK 64-Bit Server VM (build 17.0.2+8-Ubuntu-120.04, mixed mode, sharing)</p>| }</li><li><p>Write the Java version of '''OKhello_world.java'''</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''Bluetoothvim hello_world.java'''</p><p>public class hello_world</p><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println("Hello World!");</p>:<p>}</p><p>}</p>| }</li><li><p>Then compile and run '''OKhello_world.java'''</p>{| class="wikitable" style="width:800px;"
|-
| '''LED Light'''| '''OK'''|-| '''40pin GPIO'''| <p>orangepi@orangepi:~$ '''OKjavac hello_world.java'''</p>|-| <p>orangepi@orangepi:~$ '''40pin I2Cjava hello_world'''</p>| '''OK'''|-| '''40pin SPI'''| '''OK'''|-| '''40pin UART'''| '''OK'''|-| '''40pin PWM'''| '''OK'''|-| '''Temperature Sensor'''| '''OK'''|-| '''Hardware watchdog'''| '''OK'''|-| '''Mali GPU'''| '''NO'''|-| '''Video codec'''| '''NO'''<p>Hello World!</p>
|}
</li></ol>
</li></ol>
<span id="ubuntu-jammy-system"></span>
=== Ubuntu Jammy system ===
<ol style="list-style-type: decimal;"><li><p>Ubuntu Jammy is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.</p><ol style="list-style-type: lower-alpha;"><li><p>The version of a.gcc is as follows</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''gcc --version'''</p><p>gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) '''24pin expansion board function11.3.0'''</p><p>Copyright (C) 2021 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>| }</li><li><p>Write the '''OPi OS Archhello_world.c'''program in C language</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''100M network portvim 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 '''OKhello_world.c'''</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''100M Ethernet port lightgcc -o hello_world hello_world.c'''</p>| <p>orangepi@orangepi:~$ '''OK./hello_world'''</p><p>Hello World!</p>|}</li></ol></li><li><p>Ubuntu Jammy has Python3 installed by default</p><ol style="list-style-type: lower-alpha;"><li><p>The specific version of Python3 is as follows</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''USB2.0 HOST x 2python3'''</p><p>Python 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0] on linux</p><p>Type "help", "copyright", "credits" or "license" for more information.</p><p>>>></p>| '''OK'''}{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big><p>'''Infrared receptionUse the Ctrl+D shortcut key to exit python's interactive mode.'''</p></big>| }</li><li><p>Write the '''OKhello_world.py'''program in Python language</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''vim hello_world.py''Headphone audio playback'</p><p>print('Hello World!')</p>| }</li><li><p>The result of running '''OKhello_world.py'''is as follows</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''On/off buttonpython3 hello_world.py'''</p><p>Hello World!</p>| '''OK'''}</li></ol></li><li><p>Ubuntu Jammy does not install Java compilation tools and operating environment by default.</p><ol style="list-style-type: lower-alpha;"><li><p>You can use the following command to install openjdk-18</p>{| class="wikitable" style="width:800px;"
|-
| '''LRADC''' '''Custom buttons x 2'''| <p>orangepi@orangepi:~$ '''OK'''|sudo apt install -y openjdk-| '''TV18-OUT'''| '''NOjdk'''</p>
|}
</li>
<li><p>After installation, you can check the Java version.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''java --version'''</p>
<p>openjdk 18.0.2-ea 2022-07-19</p>
<p>OpenJDK Runtime Environment (build 18.0.2-ea+9-Ubuntu-222.04)</p>
<p>OpenJDK 64-Bit Server VM (build 18.0.2-ea+9-Ubuntu-222.04, mixed mode, sharing)</p>
|}
</li>
<li><p>Write the Java version of '''hello_world.java'''</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''vim hello_world.java'''</p>
<p>public class hello_world</p>
<p>{</p>
:<p>public static void main(String[] args)</p>
:<p>{</p>
::<p>System.out.println("Hello World!");</p>
:<p>}</p>
<p>}</p>
|}
</li>
<li><p>Then compile and run '''hello_world.java'''</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''javac hello_world.java'''</p>
<p>orangepi@orangepi:~$ '''java hello_world'''</p>
<p>Hello World!</p>
|}
</li></ol>
</li></ol>
<span id="method-of-uploading-files-to-the-development-board-linux-system"></span>
== Method of uploading files to the development board Linux system ==
<span id="orangemethod-pito-osupload-archfiles-to-the-development-board-linux-system-userin-guideubuntu-instructionspc"></span>== Orange Pi OS Arch System User Guide Instructions == First of all, please note that Method to upload files to the OPi OS Arch development board Linux system does not have a default orangepi user and password, so you cannot directly log in remotely through the serial port and ssh after the system is started after burning (not even the root user). This is different from Ubuntu and Debian systems.PC ===
<ol style="list-style-type: decimal;">
<li><p>Use the scp command to upload files to the Linux system of the development board in Ubuntu PC. The specific command is as follows</p>
<ol style="list-style-type: lower-alpha;">
<li><p>After burning '''file_path: '''Needs to be replaced with the path of the file to be uploaded</p></li><li><p>'''orangepi: '''This is the user name of the development board's Linux system. It can also be replaced with something else, when you start such as root.</p></li><li><p>'''192.168.xx.xx:''' This is the IP address of the development board. Please modify it for according to the first time and enter actual situation.</p></li><li><p>'''/home/orangepi:''' The path in the desktopdevelopment board Linux system can also be modified to other paths.</p>{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''scp file_path orangepi@192.168.xx.xx:/home/orangepi/'''</p>|}</li></ol></li><li><p>If you want to upload a folder, you will see need to add the user wizard program shown in the figure below-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><div /li>{| class="figurewikitable" style="width:800px;" |-| test@test:~$ '''man scp'''|}</ol><span id="how-to-upload-files-using-filezilla"></span>
<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'''</divp>|}</li><li><p>First you need Then use the following command to select 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 language you wantright is empty.</p>
<div class="figure">
[[File:zero2w-img294img255.png]]
</div></li>
<li><p>After selecting The method of connecting the language, the user wizard will immediately switch to the corresponding language interface, development board is as shown in the figure below in Chinese</p></li>
<div class="figure">
[[File:zero2w-img295img256.png]] </div></ol><ol start="5" style="list-style-type: decimal;"><li><p>Then choose to '''save the password''' and click '''OK'''</p><p>[[File:zero2w-img257.png]]</p></li><li><p>Then select '''Always trust this host''' and click '''OK'''</p></li>
<div class="figure">
[[File:zero2w-img296img258.png]] </div></ol><ol start="7" style="list-style-type: decimal;"><li>After the connection is successful, you can see the directory structure of the development board's Linux file system on the right side of the filezilla software.</li>
<div class="figure">
[[File:zero2w-img297img259.png]]
</div></liol><liol start="8" style="list-style-type: decimal;"><pli>Then create a new username select the path to be uploaded to the development board on the right side of the filezilla software, select the file to be uploaded in Ubuntu PC on the left side of the filezilla software, right-click the mouse, and set a passwordthen click the upload option to start uploading the file to the development board.</pli><div class="figure"> [[File:zero2w-img298.png]]
<div class="figure">
[[File:zero2w-img299img260.png]]
</div></liol><ol start="9" style="list-style-type: decimal;"><li><p>Then wait for After the installation upload is completed, you can go to completethe corresponding path in the development board Linux system to view the uploaded file.</p></li><div class="figure"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="how-to-upload-files-using-filezilla-1"></span>==== How to upload files using filezilla ==== # First download the installation file of the Windows version of the filezilla software. The download link is as follows ::{| class="wikitable" style="width:800px;" |-| [https://filezilla-project.org/download.php?type=client '''https://filezilla-project.org/download.php?type=client''']|} ::[[File:zero2w-img301img261.png]]
<div class="figure">
::[[File:zero2w-img302img262.png]]
</div>
<ol start="2" style="list-style-type: decimal;"><li><p>At this pointThe downloaded installation package is as shown below, you can use the newly created username and password to log in then double-click to the OPi OS system through the serial port or ssh.install it directly</p>{| class="wikitable" style="width:800px;" |-| <p>'''FileZilla_Server_1.5.1_win64-setup.exe'''</lip>|}During the installation process, please select '''Decline''' on the following installation interface, and then select '''Next>''' </oldiv class="figure">
<ol startdiv class="2figure" style="list-style-type: decimal;"><li>Then open the corresponding configuration by adding '''FDTOVERLAYS''' '''/dtbs/allwinner/overlay/xxx.dtbo''' in '''/boot/extlinux/extlinux.conf'''</li></ol>
<ol startdiv class="5figure" style="list-style-type: decimal;"><li>If you need to open multiple configurations at the same time, just add the paths of multiple configurations directly after '''FDTOVERLAYS.''' For example, the configuration of opening i2c1 and uart5 at the same time is as follows</li></ol>
[orangepi@orangepi[File:zero2w-pc ~img267.png]]$ '''sudo vim /boot/extlinux/extlinux.conf'''
<ol startspan id="6" style="listinstructions-for-styleusing-type: decimal;"><li>After setting, you need to restart the system for -logo-on-and-off-the configuration to take effect.</li-machine"></olspan>
<span idol style="howlist-style-type: decimal;"><li><p>The power on/off logo will only be displayed on the desktop version of the system by default.</p></li><li><p>Set the '''bootlogo''' variable to '''false''' in '''/boot/orangepiEnv.txt''' toturn off the switch logo.</p>{| class="wikitable" style="width:800px;" |-install| <p>orangepi@orangepi:~$ '''sudo vim /boot/orangepiEnv.txt'''</p><p>verbosity=1</p><p>'''<span style="color:#FF0000">bootlogo=false</span>'''</p>|}</li><li><p>Set the '''bootlogo''' variable to '''true''' in '''/boot/orangepiEnv.txt''' to enable the power on/off logo.</p>{| class="wikitable" style="width:800px;" |-software| <p>orangepi@orangepi:~$ '''sudo vim /boot/orangepiEnv.txt'''</p><p>verbosity=1</p><p>'''<span style="color:#FF0000">bootlogo=true</span>'''</p>|}</li><li><p>The location of the boot logo picture in the Linux system is</p>{| class="wikitable" style= How "width:800px;" |-| <p>'''/usr/share/plymouth/themes/orangepi/watermark.png'''</p>|}</li><li><p>After replacing the boot logo image, you need to install software run the following command to take effect</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo update-initramfs -u'''</p>|}</li></ol>
<ol style="list-style-type: decimal;"><li><p>First run '''orangepi-config'''. Ordinary users remember to add '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;"
|-
| Android Version| Kernel version|-| <p>orangepi@orangepi:~$ '''Android 12 TV Version'''| '''linux5.4sudo orangepi-config'''</p>
|}
</li>
<li><p>Then select '''System'''</p>
<p>[[File:zero2w-img80.png]]</p></li>
<li><p>Then select '''Hardware'''</p>
<p>[[File:zero2w-img81.png]]</p></li>
<li><p>Then use the keyboard's arrow keys to locate the position shown in the picture below, and then use the '''space''' to select the dtbo configuration of the SPI you want to open.</p>
<p>[[File:zero2w-img270.png]]</p></li>
<li><p>Then select '''<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>
<span id="how-to-shut-down-and-restart-the-development-board"></span>
<ol style="list-style-type: decimal;"><li><p>During the running of the Linux system, if you directly unplug the power supply, it may cause the file system to lose some data. It is recommended to use the '''poweroff''' command to shut down the Linux system of the development board before powering off, and then unplug the power supply.</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''Motherboard functionssudo poweroff'''</p>| '''Android12 TV'''}{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big><p>'''HDMI videoNote that after turning off the development board, you need to unplug and replug the power supply before it can be turned on.'''</p></big>|}</li><li><p>In addition to using the poweroff command to shut down, you can also use the power on/off button on the expansion board to shut down.</p><p>[[File:zero2w-img269.png]]</p>{| '''OK'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big><p>'''HDMI AudioNote that Linux 5.4 requires manual configuration of the power on/off button before it can be used. For the opening method, please refer to [[Orange Pi Zero 2W#How to turn on the power button in Linux5.4|the method of opening the power button in Linux5.4]].'''</p></big>| }</li><li><p>Use the '''OKreboot'''command to restart the Linux system in the development board</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''sudo''' '''Typereboot'''</p>|}</li></ol> <span id="linux-C USB2sdkorangepi-build-usage-instructions"></span> = '''Linux SDK——orangepi-build usage instructions''' = <span id="compilation-system-requirements"></span>== Compilation system requirements == The Linux SDK, '''orangepi-build''', only supports running on X64 computers with '''<span style="color:#FF0000">Ubuntu 22.0 x 204</span>'''| installed. Therefore, before downloading orangepi-build, please first ensure that the Ubuntu version installed on your computer is Ubuntu 22.04. The command to check the Ubuntu version installed on the computer is as follows. If the Release field does not display '''OK<span style="color:#FF0000">22.04</span>''', it means that the Ubuntu version currently used does not meet the requirements. Please change the system before performing the following operations. {| class="wikitable" style="width:800px;"
|-
| test@test:~$ '''TF card startuplsb_release -a'''| No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04 LTS Release: '''OK<span style="color:#FF0000">22.04</span>'''|-| Codename: '''WIFIjammy'''| } If the computer is installed with a Windows system and does not have Ubuntu 22.04 installed on it, you can consider using'''VirtualBox''' or '''OKVMware'''to install an Ubuntu 22.04 virtual machine in the Windows system. But please note, do not compile orangepi-build on the WSL virtual machine, because orangepi-build has not been tested in the WSL virtual machine, so there is no guarantee that orangepi-build can be used normally in WSL. In addition, please do not compile the Linux system on the development board. Use orangepi-build. The installation image download address of Ubuntu 22.04 amd64 version is: {| class="wikitable" style="width:800px;"
|-
| '''Bluetooth'''| '''OK'''|-| '''USB Camera'''| '''OK'''|[https://repo.huaweicloud.com/ubuntu-| '''LED Light'''| '''OK'''|releases/21.04/ubuntu-| '''40pin GPIO'''| '''OK'''|-| '''40pin I2C'''| '''OK'''|-| '''40pin SPI1'''| '''OK'''|21.04-| '''40pin UART'''| '''OK'''|desktop-| '''40pin PWM'''| amd64.iso '''OK'''|https://mirrors.tuna.tsinghua.edu.cn/ubuntu-| '''Temperature Sensor'''| '''OK'''|releases/22.04/ubuntu-| '''Hardware watchdog'''| '''OK'''|22.04-| '''Mali GPU'''| '''OK'''|desktop-| '''Video codec'''| '''OKamd64.iso''']
|}
After installing Ubuntu 22.04 on your computer or virtual machine, please first set the software source of Ubuntu 22.04 to Tsinghua source (or other domestic sources that you think is fast), otherwise it is easy to make errors due to network reasons when installing the software later. The steps to replace Tsinghua Source are as follows: <ol style="list-style-type: lower-alpha;"><li>For the method of replacing Tsinghua Source, please refer to the instructions on this page.</li> {| class="wikitable" style="width:800px;"
|-
| [https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/ '''24pin Expansion board functionhttps://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/''']| }</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Note that the Ubuntu version needs to be switched to 22.04.</li> [[File:zero2w-img271.png]]</ol><ol start="3" style="list-style-type: lower-alpha;"><li>The contents of the '''Android12 TV/etc/apt/sources.list'''file that need to be replaced are:</li>{| class="wikitable" style="width:800px;"
|-
| '''100M network port'''| test@test:~$ '''OK'''|-| '''100M Ethernet port light'''| '''OK'''|-| '''USB2sudo mv /etc/apt/sources.0 HOST x 2'''| '''OK'''|-| '''Infrared reception'''| '''OK'''|-| '''Headphone audio playback'''| '''OK'''|-| '''Onlist cat /etc/apt/off button'''| '''OK'''|-| '''LRADC''' '''Custom buttons x 2'''| '''OK, The default setting is the volume up and down keyssources.list.bak'''|-| '''TV-OUT'''| '''OK'''|}
'''# Make sure the '''servicedeb-src https://mirrors.adbtuna.tcptsinghua.port''' of the Android system is set to 5555 port numberedu.cn/ubuntu/ jammy-security main restricted universe multiverse
'''#''' 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:~$ '''sudo apt-get update'''
|}
</ol>
<ol start="5" style="list-style-type: lower-alpha;">
<li>'''<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>
test@test:~$ '''adb devicesgit clone https://github.com/orangepi-xunlong/orangepi-build.git -b next'''|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note that when using the H618 Soc development board, you need to download the source code of the <span style="color:#FF0000">next</span> branch of orangepi-build. The above git clone command needs to specify the branch of the orangepi-build source code as next.'''</big>
<ol start/div>|}{| class="5wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;">|-| <libig>Then '''When downloading the orangepi-build code through the git clone command, you can log do not need to enter the user name and password of the github account (the same is true for downloading other codes in to this manual). If after entering the android system through adb shell on git clone command, Ubuntu PCprompts 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.'''</li></olbig>|}
<ol style="list-style-type: lower-alpha;"><li><p>'''build.sh''': Compile startup script</p></li><li><p>'''external''': Contains configuration files needed to compile the image, specific scripts, and source code of some programs, etc.</p></li><li><p>'''LICENSE''': GPL 2 license file</p></li><li><p>'''README.md''': orangepi-build documentation</p></li><li><p>'''scripts''': Common script for compiling linux images</p></li></ol>{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''sudo apt-get updatels'''
<ol startspan id="3" style="listdownload-the-cross-compilation-styletool-type: decimal;chain"><li>Check whether the ADB device is recognized</li></olspan>
<ol start="3" style="list-style-type: decimallower-alpha;"><li>Then turn on WI-FIv2018.05</li></ol>{| class="wikitable" style="width:800px;" |-| [[File:zero2w'''gcc-linaro-7.4.1-img3152019.png]]02-x86_64_arm-linux-gnueabi'''|}</ol><ol start="42" style="list-style-type: decimallower-alpha;"><li>After turning on WIv2021.07</li>{| class="wikitable" style="width:800px;" |-FI, you can see the searched signals under | '''Available networksgcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu'''.|}</liol><span id="orangepi-build-complete-directory-structure-description"></olspan> [[File:zero2w-img316.png]]
<div classol style="figurelist-style-type: decimal;"> [[File:zero2w<li><p>After downloading, the orangepi-build warehouse does not contain the source code of the linux kernel, u-boot and cross-compilation tool chain. The source code of the linux kernel and u-img317boot is stored in an independent git warehouse.png]] </divp><ol start="6" style="list-style-type: decimallower-alpha;"><li>Then use <p>The git warehouse where the keyboard to enter linux kernel source code is stored is as follows. Please note that the password corresponding to branch of the WIlinux-FI, and then use the mouse orangepi warehouse is switched to click the Enter button on the virtual keyboard to start connecting to the WI</p><ol style="list-style-FItype: none;"><li>a) Linux5.4</li>{| class="wikitable" style="width:800px;" |-| https://github.com/orangepi-xunlong/linux-orangepi/tree/'''orange-pi-5.4-sun50iw9'''|}</ol><ol start="2" style="list-style-type: lower-alpha;"><div li>b) Linux6.1</li>{| class="figurewikitable">style="width:800px;" |-| [[Filehttps:zero2w//github.com/orangepi-img318xunlong/linux-orangepi/tree/'''orange-pi-6.png]]1-sun50iw9'''|}</divol></li></ol><ol start="72" style="list-style-type: decimallower-alpha;"><li><p>The display after successful WIgit warehouse where the u-FI connection boot source code is stored is as shown belowfollows. Please note that the branch of the u-boot-orangepi warehouse is switched to</p><ol style="list-style-type: lower-alpha;"><li>a) v2018.05</olli>{| class="wikitable" style="width:800px;" |-[[File| https:zero2w//github.com/orangepi-img319xunlong/u-boot-orangepi/tree/'''v2018.png]]05-h618'''|}</ol><span idol start="how2" style="list-tostyle-usetype: lower-wi-fi-hotspotalpha;"><li>b) v2021.07</spanli>{| class="wikitable" style= How to use WI"width:800px;" |-FI hotspot ==| # First, please make sure that the Ethernet port is connected to the network cable and can access the Internet normallyhttps://github.# Then select com/orangepi-xunlong/u-boot-orangepi/tree/'''Settingsv2021.07-sunxi'''|}[[File:zero2w-img306.png]]</ol></li></ol></li></ol><ol start="32" style="list-style-type: decimal;"><li>Then select <p>When orangepi-build is run for the first time, it will download the cross-compilation tool chain, u-boot and linux kernel source code. After successfully compiling a linux image, the files and folders that can be seen in orangepi-build are:</p><ol style="list-style-type: lower-alpha;"><li><p>'''Network & Internetbuild.sh''': Compile startup script</p></li><li><p>'''external''': Contains the configuration files needed to compile the image, scripts for specific functions, and the source code of some programs. The rootfs compressed package cached during the image compilation process is also stored in external.</p></li><li><p>'''kernel''': Store the source code of the linux kernel</p></li><li><p>'''LICENSE''': GPL 2 license file</p></li><li><p>'''README.md''': orangepi-build documentation</p></li><li><p>'''output''': Store compiled u-boot, linux and other deb packages, compilation logs, and compiled images and other files</p></li><li><p>'''scripts''': Common script for compiling linux images</p></li><li><p>'''toolchains''': Store cross-compilation tool chain</p></li><li><p>'''u-boot''': Store the source code of u-boot</p></li><li><p>'''userpatches''': Store the configuration files needed to compile the script</olp></li>{| class="wikitable" style="width:800px;" |-[[File| test@test:zero2w~/orangepi-img314.png]]build$ '''ls'''
<ol startdiv class="7figure" style="list-style-type: decimal;"><li>After the connection is successful, it will be displayed as shown below (the interface will be different on different mobile phones, the specific interface is subject to the one displayed on your mobile phone). At this time, you can open a web page on your mobile phone to see if you can access the Internet. If the web page can be opened normally, it means that the '''WI-FI Hotspot''' of the development board can be used normally.</li></ol>
[[File:zero2w-img323img274.png]]
<span id="how-to-check-the-ip-address-of-the-ethernet-port"/div></spanol>== How to check the IP address of the Ethernet port == # There is no wired network interface on the main board of the development board. We can expand the 100M Ethernet through a 24pin expansion board. [[File:zero2w-img107.png]] <ol start="23" style="list-style-type: decimal;"><li><p>Then make sure the network port of the expansion board is connected to the router or switch</p></li><li><p>Then open '''Settings'''</p><p>[[File:zero2w-img324.png]]</p></li><li><p>Then select '''Network & Internet'''</p><p>[[File:zero2w-img325.png]]</p></li><li><p>Then you can see the IP address model of the development board's wired network port at the location shown in the picture below.</p><p>[[File:zero2w-img326.png]]</p></li></ol> <span id="bluetooth-connection-method"></span>== Bluetooth connection method == # Choose first '''Settings''' [[File:zero2w-img306.png]] <ol start="2" style="list-style-type: decimal;"><li>Then select '''Bluetooth'''</li></ol> [[File:zero2w-img327.png]] <ol start="3" style="list-style-type: decimal;"><li>Then Open '''Bluetooth Enable'''</li></ol> [[File:zero2w-img328.png]] <ol start="4" style="list-style-type: decimal;"><li>Then click '''Pair new device'''to start scanning for surrounding Bluetooth devices</li></ol> [[File:zero2w-img329.png]] <ol start="5" style="list-style-type: decimal;"><li>The searched Bluetooth devices will be displayed under '''Available devices'''</li></ol> [[File:zero2w-img330.png]]
[[File:zero2w-img275.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>Then select the branch type of u-boot</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The current branch will compile the u-boot v2018.05 version code that needs to be used by the linux5.4 image.</p></li>
<li><p>The next branch will compile the u-boot v2021.07 version code that needs to be used by the linux6.1 image.</p>
<p>[[File:zero2w-img276.png]]</p></li></ol>
</li>
<li><p>If you select the next branch, you will also be prompted to select the memory size, and you do not need to select the current branch.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>If the development board you purchased has a memory size of 1.5GB, please select the first option.</p></li>
<li><p>If the development board you purchased has 1GB or 2GB or 4GB memory size, please choose the second option.</p>
<p>[[File:zero2w-img277.png]]</p></li></ol>
</li></ol>
<ol start="6" style="list-style-type: decimal;">
<li><p>Then click on the Bluetooth device you want it will start to connect to start pairingcompile u-boot. When Some of the following interface pops up, please use the mouse to select information prompted when compiling the next branch is as follows:</p><ol style="list-style-type: lower-alpha;"><li>Version of u-boot source code</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Compiling u-boot [ '''Pairv2021.07'''option]|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Version of the cross-compilation tool chain</olli>{| class="wikitable" style="width:800px;" |-| [o.k. ] Compiler version [File:zero2w'''aarch64-linux-gnu-img331.png]gcc 11''' ]|}</ol><ol start="73" style="list-style-type: decimallower-alpha;"><li>What is tested here is the Bluetooth configuration process between the development board and the Android phone. At this time, the following confirmation interface will pop up on the phone. Click the pairing button on the phone Path to start the pairing process.compiled u-boot deb package</li></ol>{| class="wikitable" style="width:800px;" |-| [o.k. ] Target directory [File:zero2w'''orangepi-build/output/debs/u-img332.png]boot''' ]|}</ol><ol start="84" style="list-style-type: decimallower-alpha;"><li>After pairing is completed, open The package name of the compiled u-boot deb package</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] File name [ '''Paired deviceslinux-u-boot-next-orangepizero2w_x.x.x_arm64.deb''' and you will see the paired Bluetooth devices.]|}</ol><ol start="5" style="list-style-type: lower-alpha;"><li>Compilation time</olli>{| class="wikitable" style="width:800px;" |-| [[File:zero2w-img333o.k.png]Runtime [ '''1 min''' ]|}</ol><ol start="96" style="list-style-type: decimallower-alpha;"><li>At this time, you can use Repeat the Bluetooth of your mobile phone command to send a picture to the development boardcompile u-boot. After sending, you can see Use the following confirmation command without selecting through the graphical interface in the Android system of the development board, and then click . You can start compiling u-boot directly.</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Repeat Build Options [ '''Acceptsudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=u-boot''' to start receiving the pictures sent by the mobile phone.]|}</ol></li></ol><ol start="7" style="list-style-type: decimal;"><li>View the compiled u-boot deb package</li>{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''ls output/debs/u-boot/'''
......
|}
</ol>
<ol start="9" style="list-style-type: decimal;">
<li><p>When debugging u-boot code, you can use the following method to update u-boot in the linux image for testing</p>
<ol style="list-style-type: lower-alpha;">
<li>Run First upload the following command compiled deb package of u-boot to set USB0 to HOST mode:the Linux system of the development board.</li><{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''cd output/debs/ol>u-boot'''
[[File:zero2w-img279.png]]</ol><ol start="26" style="list-style-type: lower-alpha;"><li>Run Press the Enter key again to start updating u-boot. After the update is completed, the following command to switch back to Device modeinformation will be displayed.</li></ol>
</div></ol>
<ol start="3" style="list-style-type: decimal;">
<li><p>Then make sure that you will be prompted whether you need to display the adb connection between kernel configuration interface. If you do not need to modify the Ubuntu PC and kernel configuration, select the development board is normalfirst one. For how If you need to use adbmodify the kernel configuration, please refer to select the instructions in the section "'''How to use ADB'''"second one.</p></li><li><p>Download the USB camera test APP from the '''official tool''' on the development board information download page</p></li></ol>
[[File:zero2w-img282.png]]<div class/ol><ol start="4" style="figurelist-style-type: decimal;"><li>Then select the model of the development board</li>
[[File:zero2w-img336img275.png]]</ol><ol start="5" style="list-style-type: decimal;"><li>Then select the branch type of the kernel source code</li>
::[[File:zero2w-img276.png]]</divol><ol start="56" style="list-style-type: decimal;"><li>Then use If you choose to display the adb command to install kernel configuration menu (the USB camera test APP into second option) in step 3), the Android systemkernel configuration interface opened through '''make menuconfig''' will pop up. Of courseAt this time, you can also use a USB disk copy to install itdirectly modify the kernel configuration. After modification, save and exit. Yes, compilation of the kernel source code will begin after exiting.</li></ol>
<ol start="6" style="list-style-type: decimallower-alpha;"><li>After installationIf you do not need to modify the kernel configuration options, you can see when running the build.sh script, pass '''KERNEL_CONFIGURE=no''' to temporarily block the startup icon pop-up of the USB camera on the Android desktopkernel configuration interface.</li>{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''sudo ./build.sh KERNEL_CONFIGURE=no'''|}</ol><ol start="2" style="list-style-type: lower-alpha;">[[File:zero2w<li><p>b. You can also set '''KERNEL_CONFIGURE=no''' in the orangepi-build/userpatches/config-img338default.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.png]]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>Then double-click to open <p>Part of the USB camera APP and you can see information prompted when compiling the output video next branch kernel source code is explained as follows:</p><ol style="list-style-type: lower-alpha;"><li>Version of the USB camera.linux kernel source code</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Compiling current kernel [ '''6.1.31''' ]|}</ol> <span idol start="android2" style="list-systemstyle-roottype: lower-descriptionalpha;"><li>The version of the cross-compilation tool chain used</spanli>{| class="wikitable" style= Android system ROOT description =="width:800px;" |-| [ o.k. ] Compiler version [ '''aarch64-linux-gnu-gcc 11''' ]|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>The Android system released default configuration file used by Orange Pi has been ROOT the kernel and can be tested using the following methodpath where it is stored are as follows</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Using kernel config file [ '''orangepi-build/external/config/kernel/linux-6.1-sun50iw9-next.config''']|}</ol><ol start="4" style="list-style-type: lower-alpha;"># Download from <li>The path to the kernel-related deb package generated by compilation</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Target directory [ '''official tooloutput/debs/''' on ]|}</ol><ol start="5" style="list-style-type: lower-alpha;"><li>The package name of the development board data download page kernel image deb package generated by compilation</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] File name [ '''rootchecklinux-image-next-sun50iw9_x.x.x_arm64.apkdeb''']|}<div class/ol><ol start="6" style="figurelist-style-type: lower-alpha;"><li>Compilation time</li>[[File{| class="wikitable" style="width:zero2w800px;" |-img336| [ o.k.png]Runtime [ '''10 min''' ]|}</divol><div classol start="7" style="figurelist-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>[[File{| class="wikitable" style="width:zero2w800px;" |-img339| [ o.k.png]Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=kernel KERNEL_CONFIGURE=no''' ]|}</divol></li></ol><ol start="28" style="list-style-type: decimal;"><li><p>Then make sure that View 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 "kernel-related deb package generated by compilation</p><ol style="list-style-type: lower-alpha;"><li><p>'''How to use ADBlinux-dtb-next-sun50iw9_x.x.x_arm64.deb'''".Contains dtb files used by the kernel</p></li><li><p>Then use the adb command to install rootcheck'''linux-headers-next-sun50iw9_x.apk into the Android systemx. Of course, you can also use a USB disk copy to install itx_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</olp></li>{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''ls output/debs/linux-*'''
'''linux-image-next-sun50iw9_x.x.x_arm64.deb root@192.168.1.xxx:/root'''|}</ol ><ol start="2" style="list-style-type: decimallower-alpha;"><li><p>First, please make sure that both Install the development board and deb package of the mobile phone are connected to the same WIFI hotspotnew linux kernel just uploaded. For the method of connecting the development board to WIFI, please refer to </li>{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''the instructions in the WIsudo dpkg -i linux-image-next-FI connection methodsun50iw9_x.x.x_arm64.deb'''|}</pol></liol start="3" style="list-style-type: lower-alpha;"><li><p>Then open the '''MiracastReceiver'''application in the Android system of restart the development boardand check whether the kernel-related modifications have taken effect.</pli><p>[[File{| class="wikitable" style="width:zero2w800px;" |-img343.png]]| orangepi@orangepi:~$ '''sudo''' '''reboot'''|}</pol></li><li><p>The interface after '''MiracastReceiver''' is opened is as follows</pol><div classspan id="figurecompile-rootfs"></span>
[[File:zero2w-img349img276.png]]</ol></li></ol><ol start="5" style="list-style-type: decimal;"><li>Then select the type of rootfs</li>
<span id/div></ol></li></ol><ol start="7" style="pin-interface-gpio-uartlist-spistyle-testtype: decimal;"></spanli>== 40pin interface GPIOIf you are compiling the server version of the image, UARTyou 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, SPI test ==because many things are not pre-installed by default. Some functions may not be available''')</li>
[[File:zero2w-img351img289.png]]
[[File:zero2w-img291.png]]</ol><ol start="39" style="list-style-type: decimal;"><li>The GPIO test interface is as shown in <p>Then the figure belowcompilation of rootfs will start. The two rows Some of '''CheckBox''' buttons on the left have a oneinformation prompted during compilation are as follows:</p><ol style="list-style-totype: lower-one correspondence with the 40pin pinsalpha;"><li>Type of rootfs</li>{| class="wikitable" style="width:800px;" |-| [ o.k. When the ] local not found [ Creating new rootfs cache for '''CheckBoxbullseye''' button is checked, ]|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>The storage path of the corresponding GPIO pin will be set to compiled rootfs compressed package</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Target directory [ '''OUTorangepi-build/external/cache/rootfs''' mode and the pin level is set to high level]|}</ol><ol start="3" style="list-style-type: lower-alpha; when unchecked, "><li>The name of the GPIO pin level will be set to low levelrootfs compressed package generated by compilation</li>{| class="wikitable" style="width:800px; when the GPIO is clicked When you click the " |-| [ o.k. ] File name [ '''GPIO READALLbullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4''' button, you can get information such as wPi number, GPIO mode, pin level, etc.]|}</ol></li></ol><ol start="10" style="list-style-type: decimal; when you click "><li><p>View thecompiled rootfs compressed package</p><ol style="list-style-type: lower-alpha;"><li>'''BLINK ALL GPIObullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4''' button, all GPIO ports will cycle through outputting high and low levelsIt is a compressed package of rootfs. This function can be used to test all The meaning of each field in the 40pin pins. GPIO port.name is</li></ol> [[File:zero2w-img353.png]]
:d) '''25250ec7002de9e81a41de169f1f89721''' is the MD5 hash value generated by the package names of all software packages installed by rootfs. As long as the list of software packages installed by rootfs is not modified, this value will not change. The compilation script will use this MD5 hash value. Determine whether rootfs needs to be recompiled</divol><ol start="52" style="list-style-type: decimallower-alpha;"><li>There are a total of 28 GPIO ports available in the 40-pin development board. The following takes pin 12 - corresponding to GPIO PI01 - corresponding to wPi serial number 6 - as an example to demonstrate how to set the high and low levels of the GPIO port. First click the '''CheckBox''' button corresponding to pin 12bullseye-xfce-arm64. When the button is selected, pin 12 will be set to high level5250ec7002de9e81a41de169f1f89721. After setting, you can use a multimeter to measure the value of the voltage of the pintar. If it is '''3lz4.3vlist''', it means Lists the setting High level success.package names of all packages installed by rootfs</li><{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''ls external/cache/rootfs/ol>'''
<ol startspan id="7" style="listcompile-stylelinux-type: decimal;image"><li>Click the '''CheckBox''' button in the picture below again to uncheck it, and pin 12 will be set to low level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is '''0v''', it means the low level setting is successful.</li></olspan>
<span idol start="pin2" style="list-uartstyle-test-methodtype: decimal;"><li>Select '''Full OS image for flashing''' and press Enter</spanli>=== 40pin UART test method ===
|-
| '''269[ o.k. ] Runtime [ 19 min ]'''| '''PI13'''}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>Repeat the command to compile the image. Use the following command to start compiling the image directly without selecting it through the graphical interface.</li>{| '''PWM3'''class="wikitable" style="width:800px;" | '''7'''-|| [ o.k. ] Repeat Build Options [ '''8sudo ./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> = '''UART0_TXInstructions for using the Orange Pi OS Arch system'''= <span id="orange-pi-os-arch-system-function-adaptation-status"></span>== Orange Pi OS Arch system function adaptation status ==| '''PH0'''{| '''224'''class="wikitable" style="width:800px;text-align: center;"
|-
|-
| '''226HDMI video'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''12'''| style="text-align: left;"|| '''PI1'''| '''257OK'''
|-
| '''227HDMI Audio'''| '''PH3OK'''| '''UART5_RX'''| '''13'''|| '''14'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''261Type-C USB2.0 x 2'''| '''PI5'''| '''UART2_TX'''| '''15'''|| '''16'''| '''PWM4'''| '''PI14'''| '''270OK'''
|-
|-
| '''231WIFI'''| '''PH7OK'''| '''SPI1_MOSI'''| '''19'''|| '''20'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''232Bluetooth'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''UART2_RX'''| '''PI6'''| '''262OK'''
|-
| '''230LED Light'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229OK'''
|-
|-
| '''26640pin I2C'''| '''PI10OK'''| '''TWI2-SDA'''| '''27'''|| '''28'''| '''TWI2-SCL'''| '''PI940pin SPI'''| '''265OK'''
|-
| '''25640pin UART'''| '''PI0OK'''| style="text-align: left;"|| '''29'''|| '''30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''27140pin PWM'''| '''PI15'''| style="text-align: left;"|| '''31'''|| '''32'''| '''PWM1'''| '''PI11'''| '''267OK'''
|-
| '''268Temperature Sensor'''| '''PI12OK'''| '''PWM2'''| '''33'''|| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''258Hardware watchdog'''| '''PI2'''| style="text-align: left;"|| '''35'''|| '''36'''| style="text-align: left;"|| '''PC12'''| '''76OK'''
|-
| '''272Mali GPU'''| '''PI16'''| <span style="text-aligncolor: left;#FF0000"|| '''37'''|| '''38'''| style="text-align: left;"|| '''PI4'''| '''260>NO</span>'''
|-
|}
<ol start="4" style="list-style-type: decimallower-alpha;"><li>Then click <p>After burning the system, when you start it for the '''UART_TEST'''button to open first time and enter the UART test interfacedesktop, you will see the user wizard program shown in the figure below.</lip></oldiv class="figure">
[[File:zero2w-img359img293.png]]
<ol start="5" style="list-style-type: decimal;"/div></li><li>The serial port test interface of wiringOP is as shown in <p>First you need to select the figure belowlanguage you want</lip></oldiv class="figure">
[[File:zero2w-img360img294.png]] </div></li><li><p>After selecting the language, the user wizard will immediately switch to the corresponding language interface, as shown below in Chinese</p><div class="figure"> [[File:zero2w-img295.png]] </div></li><li><p>Then select the area</p><div class="figure"> [[File:zero2w-img296.png]] </div></li><li><p>Then select the keyboard model</p><div class="figure">
|-
| [orangepi@orangepi-pc ~]$ '''264sudo vim /boot/extlinux/extlinux.conf'''| '''PI8'''} | '''TWI1<ol start="2" style="list-style-SDA'''type: decimal;">| <li>Then open the corresponding configuration by adding '''3FDTOVERLAYS'''|| '''4/dtbs/allwinner/overlay/xxx.dtbo'''| in '''5V/boot/extlinux/extlinux.conf'''</li> {| styleclass="text-align: left;wikitable"|| style="textbackground-aligncolor: left#ffffdc;width:800px;"|
|-
|-
| [orangepi@orangepi-pc ~]$ '''269sudo vim /boot/extlinux/extlinux.conf'''| '''PI13'''| '''PWM3'''LABEL Orange Pi KERNEL /Image FDT /dtbs/allwinner/sun50i-h616-orangepi-zero2w.dtb | '''7FDTOVERLAYS /dtbs/allwinner/overlay/<span style="color:#FF0000">xxx.dtbo</span>'''#Configuration that needs to be added|}| '''8'''</ol>| '''UART0_TX'''<ol start="3" style="list-style-type: decimal;">| '''PH0'''<li><p>The storage path of xxx.dtbo in the OPi OS Arch image is as follows. Please note that not all dtbo under this path can be used.</p>{| '''224'''class="wikitable" style="width:800px;"
|-
| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| <p>'''9/boot/dtbs/allwinner/overlay/'''</p>|}| '''10'''</li>| '''UART0_RX'''<li><p>The DT overlays configuration that can be used by the development board is as follows</p></li>| '''PH1'''{| '''225'''class="wikitable" style="width:800px;text-align: center;"
|-
| '''226Functions on the development board'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''12'''| style="text-align: left;"|| '''PI1'''| '''257Corresponding DT overlays configuration'''
|-
| '''22740pin - i2c0'''| '''PH3'''| '''UART5_RX'''| '''13'''|| '''14''sun50i-h616-pi-i2c0.dtbo'| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''26140pin - i2c1'''| '''PI5'''| '''UART2_TX'''| '''15'''|| '''16'''| '''PWM4'''| '''PI14'''| '''270sun50i-h616-pi-i2c1.dtbo'''
|-
|-
| '''23140pin - uart2'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|| '''20''sun50i-h616-pi-uart2.dtbo'| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''23240pin - uart3'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''UART2_RX'''| '''PI6'''| '''262sun50i-h616-pi-uart3.dtbo'''
|-
| '''23040pin - uart4'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229sun50i-h616-pi-uart4.dtbo'''
|-
|-
| '''26640pin - pwm1'''| '''PI10'''| '''TWI2sun50i-h616-SDA'''| '''27'''|| '''28'''| '''TWI2pi-SCL'''| '''PI9'''| '''265pwm1.dtbo'''
|-
| '''25640pin - pwm2'''| '''PI0sun50i-h616-pi-pwm2.dtbo'''| style="text-align: left;"|'''40pin - pwm3'''| '''29sun50i-h616-pi-pwm3.dtbo'''|-| '''3040pin - pwm4'''| '''GNDsun50i-h616-pi-pwm4.dtbo'''| style="text-align: left;"|'''40pin - spi1 cs0'''| style="text'''sun50i-align: left;"h616-spi1-cs0-spidev.dtbo'''|-| '''40pin - spi1 cs1'''| '''sun50i-h616-spi1-cs1-spidev.dtbo'''|-| '''40pin - spi1 cs0 cs1'''| '''sun50i-h616-spi1-cs0-cs1-spidev.dtbo'''
|-
| '''271设Set USB0 to Host mode'''| '''PI15'''| style="textsun50i-h616-usb0-align: left;"|| '''31'''|| '''32'''| '''PWM1'''| '''PI11'''| '''267host.dtbo'''
|-
| '''268Turn off the green LED light'''| '''PI12'''| '''PWM2'''| '''33'''|| '''34''sun50i-h616-zero2w-disable-led.dtbo'| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''258How to close the UART0 debugging serial port'''| '''PI2'''| style="textsun50i-h616-align: left;"|| '''35'''|| '''36'''| style="textdisable-align: left;"|| '''PC12'''| '''76uart0.dtbo'''
|}
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>If you need to open multiple configurations at the same time, just add the paths of multiple configurations directly after '''FDTOVERLAYS.''' For example, the configuration of opening i2c1 and uart5 at the same time is as follows</li>
{| class="wikitable" style="width:800px;"
|-
|
[orangepi@orangepi-pc ~]$ '''sudo vim /boot/extlinux/extlinux.conf'''
'''FDTOVERLAYS <span style="color:#FF0000">/dtbs/allwinner/overlay/sun50i-h616-pi-i2c1.dtbo /dtbs/allwinner/overlay/sun50i-h616-ph-uart5.dtbo</span>'''
|}
</ol>
<ol start="6" style="list-style-type: decimal;">
<li><p>Then select the spi device node in the upper left corner. If After setting, you test need to restart the onboard SPIFlash directly, just keep system for the default '''/dev/spidev0configuration to take effect.0'''. If the '''w25qxx''' module is connected to the 40pin spi1 cs0, then please select'''</dev/spidev1.0''', if the w25qxx module is connected to the 40pin spi1 cs1, then please select li>{| class="wikitable" style="width:800px;" |-| [orangepi@orangepi-pc ~]$ '''/dev/spidev1.1sudo reboot'''|}</pol><div classspan id="figurehow-to-install-software"></span>
{| class="wikitable" style="width:800px;" |-| [[File:zero2worangepi@orangepi-img367.png]pc ~]$ '''sudo pacman -Syy vim'''|}
<ol startspan id="8" style="listandroid-12-tv-system-styleusage-type: decimal;instructions"><li>Then fill in the bytes that need to be sent, such as reading the ID information of the onboard SPIFlash, filling in the address 0x9f in data[0], and then click the '''TRANSFER''' button</li></olspan>
<ol startspan id="9" style="listsupported-styleandroid-type: decimal;versions"><li>Finally, the APP will display the read ID information of the onboard SPI Flash.</li></olspan>== Supported Android versions ==
<ol startspan id="10" style="listandroid-12-tv-function-styleadaptation-type: decimal;status"><li>If the w25qxx module connected to 40pin SPI1 is read, the ID information of the onboard SPI Flash is also similar.</li></olspan>== Android 12 TV function adaptation status ==
|-
| '''GPIO serial numberHDMI video'''| '''GPIO'''| '''Function'''| '''pin'''|| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO serial numberOK'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''1'''|| '''2HDMI Audio'''| '''5VOK'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''264'''| '''PI8'''| '''TWI1Type-SDA'''| '''3C USB2.0 x 2'''|| '''4OK'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''263TF card startup'''| '''PI7OK'''| '''TWI1-SCL'''| '''5'''|| '''6'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''269WIFI'''| '''PI13'''| '''PWM3'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224OK'''
|-
|-
| '''226LED Light'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''12'''| style="text-align: left;"|| '''PI1'''| '''257OK'''
|-
| '''22740pin GPIO'''| '''PH3OK'''| '''UART5_RX'''| '''13'''|| '''14'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''26140pin I2C'''| '''PI5'''| '''UART2_TX'''| '''15'''|| '''16'''| '''PWM4'''| '''PI14'''| '''270OK'''
|-
|-
| '''23140pin UART'''| '''PH7OK'''| '''SPI1_MOSI'''-| '''1940pin PWM'''|| '''20'OK''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''232Temperature Sensor'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''UART2_RX'''| '''PI6'''| '''262OK'''
|-
| '''230Hardware watchdog'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229OK'''
|-
|-
| '''266Video codec'''| '''PI10OK'''| '''TWI2-SDA'''}| '''27'''|| '''28'''{| '''TWI2class="wikitable" style="width:800px;text-SCL'''| '''PI9'''| '''265'''align: center;"
|-
| '''25624pin Expansion board function'''| '''PI0Android12 TV'''| style="text-align: left;"|'''100M network port'''| '''29OK'''|-| '''30100M Ethernet port light'''| '''GNDOK'''| style="text-align: left;"|'''USB2.0 HOST x 2'''| style="text-align: left;"|'''OK'''
|-
| '''271Infrared reception'''| '''PI15'''| style="text-align: left;"|| '''31'''|| '''32'''| '''PWM1'''| '''PI11'''| '''267OK'''
|-
| '''268Headphone audio playback'''| '''PI12OK'''| '''PWM2'''| '''33'''|| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''258On/off button'''| '''PI2'''| style="text-align: left;"|| '''35'''|| '''36'''| style="text-align: left;"|| '''PC12'''| '''76OK'''
|-
| '''272LRADC'''| '''PI16'''| style="text-align: left;"|| '''37'''|| '''38'''| style="text-align: left;"|| '''PI4Custom buttons x 2'''| '''260OK, The default setting is the volume up and down keys.'''
|-
|}
<ol startspan id="2onboard-led-light-display-instructions"></span>== Onboard LED light display instructions == {| class="wikitable" style="listwidth:800px;text-style-typealign: decimalcenter;"><li>The device node corresponding to i2c1 is |-|| '''green light'''| '''red light'''|-| '''u-boot startup phase'''| '''Off'''| '''on'''/dev/i2c|-1| ''', and Kernel boot to enter the device node corresponding to i2c2 is system'''| '''on'''| '''/dev/i2c-2on'''</li></ol>|}
[[File:zero2w-img351img303.png]]
<ol startspan id="4" style="listhow-to-styleuse-type: decimal;adb"><li/span>Then click the '''I2C_TEST''' button == How to open the i2c test interface</li></ol>use ADB ==
[[File:zero2w-img372service.adb.tcp.pngport]: [5555]|}
<ol start="72" style="list-style-type: decimal;"><li>Then connect an i2c device If '''service.adb.tcp.port''' is not set, you can use the following command in the serial port to set the 40pin i2c pin. Here we take port number of the ds1307 rtc module as an example.network adb</li><{| class="wikitable" style="width:800px;" |-| apollo-p2:/ol># '''setprop service.adb.tcp.port 5555'''
192.168.1.xxx:5555 device|}</ol><ol start="5" style="list-style-type: decimal;"><li>Then you can log in to the android system through adb shell on Ubuntu PC</li>{| class="wikitable" style="width:800px;"
|-
| test@test:~$ '''GPIO serial numberadb shell''' apollo-p2:/ #| '''GPIO'''}</ol><span id="use-data-cable-to-connect-adb-debugging"></span> === Use data cable to connect adb debugging === | '''Function'# Prepare a USB Type C interface data cable, plug one end of the USB interface into the USB interface of the computer, and plug one end of the USB Type C interface into the USB0 interface of the development board (see the description of the picture on the right below for the location of USB0). In this case, the development board is powered by the computer's USB interface, so please ensure that the computer's USB interface can provide the most sufficient power to drive the development board.| '''pin'''|::[[File:zero2w-img304.png]] [[File:zero2w-img305.png]]| '''pin'''| '''Function'''<ol start="2" style="list-style-type: decimal;">| '''GPIO'''<li>Install adb tool on Ubuntu PC</li>{| '''GPIO serial number'''class="wikitable" style="width:800px;"
|-
|-
| test@test:~$ '''264adb devices'''| '''PI8'''| '''TWI1-SDA'''List of devices attached| '''3'''|4c00146473c28651dd0 device| '''4'''}| '''5V'''</ol>| <ol start="4" style="textlist-alignstyle-type: leftdecimal;"|><li>Then you can log in to the android system through adb shell on Ubuntu PC</li>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| test@test:~$ '''263adb shell''' apollo-p2:/ $| }</ol><span id="view-how-to-set-hdmi-display-resolution"></span> == View how to set HDMI display resolution == <ol style="list-style-type: decimal;"><li><p>Enter first '''PI7Settings'''</p><p>[[File:zero2w-img306.png]]</p></li>| <li><p>Then select '''TWI1-SCLDevice Preferences'''</p><p>[[File:zero2w-img307.png]]</p></li>| <li><p>Then select '''5Display & Sound'''</p>|<p>[[File:zero2w-img308.png]]</p></li>| <li><p>Then select '''6Advanced display settings'''</p>| <p>[[File:zero2w-img309.png]]</p></li><li><p>Then select '''GNDHDMI output mode'''</p><p>[[File:zero2w-img310.png]]</p></li><li><p>Then you can see the list of resolutions supported by the monitor. At this time, clicking the corresponding option will switch to the corresponding resolution. Please note that different monitors may support different resolutions. If you connect it to a TV, you will generally see more resolution options than the picture below.</p><p>[[File:zero2w-img311.png]]</p></li><li><p>The HDMI output of the development board supports 4K display. When connected to a 4K TV, you can see the 4K resolution option.</p><p>[[File:zero2w-img312.png]]</p></li></ol> <span id="hdmi-to-vga-display-test-1"></span>=== HDMI to VGA display test === <ol style="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="textlist-alignstyle-type: leftdecimal;"|><li>HDMI to VGA display test is as follows</li> [[File:zero2w-img313.png]] {| class="wikitable" style="textbackground-aligncolor: left#ffffdc;width:800px;"|
|-
| <big>'''269When using HDMI to VGA display, the development board and the Android system of the development board do not need to make any settings. You only need the Mini HDMI interface of the development board to display normally. So if there is a problem with the test, please check whether there is a problem with the HDMI to VGA converter, VGA cable and monitor.'''</big>| '''PI13'''}</ol><span id="wi-fi-connection-method"></span> == WI-FI connection method == | # Choose first '''PWM3Settings'''| '''7'''|::[[File:zero2w-img306.png]]| '''8'''| '''UART0_TX'''<ol start="2" style="list-style-type: decimal;">| <li>Then select '''PH0Network & Internet'''</li>| '''224'''|[[File:zero2w-img314.png]]</ol>| <ol start="3" style="textlist-style-aligntype: leftdecimal;"|><li>Then turn on WI-FI</li> [[File:zero2w-img315.png]]</ol>| <ol start="4" style="textlist-alignstyle-type: leftdecimal;"|>| <li>After turning on WI-FI, you can see the searched signals under '''GNDAvailable networks'''.</li>| '''9'''|[[File:zero2w-img316.png]]| '''10'''</ol>| '''UART0_RX'''| '''PH1'''<ol start="5" style="list-style-type: decimal;">| '''225'''|<li>After selecting the WI-FI you want to connect to, the password input interface shown below will pop up.</li>| '''226'''| '''PH2'''<div class="figure">| '''UART5_TX'''| '''11'''[[File:zero2w-img317.png]]|| '''12'''</div></ol>| <ol start="6" style="textlist-style-aligntype: leftdecimal;"|>| '''PI1'''| '''257'''|<li>Then use the keyboard to enter the password corresponding to the WI-FI, and then use the mouse to click the Enter button on the virtual keyboard to start connecting to the WI-FI.</li>| '''227'''| '''PH3'''| '''UART5_RX'''<div class="figure">| '''13'''|[[File:zero2w-img318.png]]| '''14'''| '''GND'''</div></ol>| <ol start="7" style="textlist-style-aligntype: leftdecimal;"|><li>The display after successful WI-FI connection is as shown below</li> [[File:zero2w-img319.png]]</ol>| style<span id="texthow-align: left;to-use-wi-fi-hotspot"|></span> |== How to use WI-FI hotspot ==| '''261'''| '''PI5'''# First, please make sure that the Ethernet port is connected to the network cable and can access the Internet normally.| # Then select '''UART2_TXSettings'''| '''15'''|::[[File:zero2w-img306.png]]| '''16'''| '''PWM4'''<ol start="3" style="list-style-type: decimal;">| <li>Then select '''PI14Network & Internet'''</li>| '''270'''|[[File:zero2w-img314.png]]</ol>| style<ol start="text-align: left;4"|| style="textlist-alignstyle-type: leftdecimal;"|>| <li>Then select '''3.3VWIFI hotspot'''</li>| '''17'''|[[File:zero2w-img320.png]]| '''18'''</ol>| <ol start="5" style="textlist-style-aligntype: leftdecimal;"|>| <li>Then open '''PH4Hotspot Enable'''. You can also see the name and password of the generated hotspot in the picture below. Remember them and use them when connecting to the hotspot (if you need to modify the name and password of the hotspot, you need to close Hotspot Enable first. Then you can modify it)</li> [[File:zero2w-img321.png]]| '''228'''</ol>|<ol start="6" style="list-style-type: decimal;">| <li>At this time, you can take out your mobile phone. If everything is normal, you can find the WIFI hotspot with the same name ('''231here AndroidAP_7132'''| ) shown under the '''PH7Hotspot name'''| in the picture above in the WI-FI list searched by the mobile phone. Then you can click AndroidAP_7132 to connect to the hotspot. The password can be seen under the '''SPI1_MOSIHotspot password'''in the picture above.</li> | [[File:zero2w-img322.png]]</ol><ol start="7" style="list-style-type: decimal;"><li>After the connection is successful, it will be displayed as shown below (the interface will be different on different mobile phones, the specific interface is subject to the one displayed on your mobile phone). At this time, you can open a web page on your mobile phone to see if you can access the Internet. If the web page can be opened normally, it means that the '''19WI-FI Hotspot'''of the development board can be used normally.</li>|| '''20'''[[File:zero2w-img323.png]]| '''GND'''</ol>| style<span id="texthow-alignto-check-the-ip-address-of-the-ethernet-port"></span> == How to check the IP address of the Ethernet port == # There is no wired network interface on the main board of the development board. We can expand the 100M Ethernet through a 24pin expansion board. : left;:[[File:zero2w-img107.png]] <ol start="2"|| style="textlist-alignstyle-type: leftdecimal;"|>|-<li><p>Then make sure the network port of the expansion board is connected to the router or switch</p></li>| <li><p>Then open '''232Settings'''</p><p>[[File:zero2w-img324.png]]</p></li>| <li><p>Then select '''PH8Network & Internet'''</p>| '''SPI1_MISO''<p>[[File:zero2w-img325.png]]</p></li><li><p>Then you can see the IP address of the development board's wired network port at the location shown in the picture below.</p><p>[[File:zero2w-img326.png]]</p></li></ol> <span id="bluetooth-connection-method"></span> == Bluetooth connection method == | # Choose first '''21Settings'''|| ::[[File:zero2w-img306.png]] <ol start="2" style="list-style-type: decimal;"><li>Then select '''22Bluetooth'''</li> [[File:zero2w-img327.png]]</ol><ol start="3" style="list-style-type: decimal;">| <li>Then Open '''UART2_RXBluetooth Enable'''</li> [[File:zero2w-img328.png]]</ol><ol start="4" style="list-style-type: decimal;">| <li>Then click '''PI6Pair new device'''to start scanning for surrounding Bluetooth devices</li>| '''262'''|[[File:zero2w-img329.png]]| '''230'''</ol>| '''PH6'''<ol start="5" style="list-style-type: decimal;">| <li>The searched Bluetooth devices will be displayed under '''SPI1_CLKAvailable devices'''</li>| '''23'''|[[File:zero2w-img330.png]]| '''24'''</ol>| '''SPI1_CS0'''<ol start="6" style="list-style-type: decimal;">| <li>Then click on the Bluetooth device you want to connect to start pairing. When the following interface pops up, please use the mouse to select the '''PH5Pair'''option</li>| '''229'''|[[File:zero2w-img331.png]]</ol>| <ol start="7" style="textlist-style-aligntype: leftdecimal;"|><li>What is tested here is the Bluetooth configuration process between the development board and the Android phone. At this time, the following confirmation interface will pop up on the phone. Click the pairing button on the phone to start the pairing process.</li> [[File:zero2w-img332.png]]</ol>| <ol start="8" style="textlist-style-aligntype: leftdecimal;"|>| <li>After pairing is completed, open '''GNDPaired devices'''and you will see the paired Bluetooth devices.</li> [[File:zero2w-img333.png]]</ol>| <ol start="9" style="list-style-type: decimal;"><li>At this time, you can use the Bluetooth of your mobile phone to send a picture to the development board. After sending, you can see the following confirmation interface in the Android system of the development board, and then click '''25Accept'''to start receiving the pictures sent by the mobile phone.</li> [[File:zero2w-img334.png]]</ol>|<ol start="10" style="list-style-type: decimal;">| <li>Pictures received by the Bluetooth system of the development board Android system can be viewed in '''26Received files'''.</li>| '''SPI1_CS1'''| '''PH9'''[[File:zero2w-img335.png]]| '''233'''</ol>|<span id="how-to-set-usb0-to-host-mode-1"></span> | '''266'''== How to set USB0 to HOST mode == As shown in the figure below, there are two Type-C interfaces on the motherboard of the development board: USB0 and USB1. Both of these interfaces can be used to power the development board, and they can also be used as USB2.0 HOST interfaces. The difference between USB0 and USB1 is that in addition to being set to HOST mode, USB0 can also be set to Device mode, while USB1 only has HOST mode.| '''PI10'''| '''TWI2[[File:zero2w-SDA'''img160.png]] USB0 of the Android12 TV system released by Orange Pi is set to Device mode by default, so when there is no need to use USB0 Device mode (ADB function needs to ensure that USB0 is in Device mode), it is recommended to use USB0 for power supply, so that USB1 can be directly used to connect USB devices .| '''27'''|If you want to use USB0 to connect USB devices, you need to set USB0 to HOST mode. The method is as follows:| '''28'''| '''TWI2<ol style="list-style-type: lower-SCL'''alpha;">| '''PI9'''<li>Run the following command to set USB0 to HOST mode:</li>{| '''265'''class="wikitable" style="width:800px;"
|-
| apollo-p2:/ # '''256cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_host'''| '''PI0'''| style="texthost_chose finished! apollo-alignp2: left;"|/ #| '''29'''}|</ol>| '''30'''| '''GND'''| <ol start="2" style="textlist-alignstyle-type: leftlower-alpha;"|><li>Run the following command to switch back to Device mode</li>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| apollo-p2:/ # '''271cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_device''' device_chose finished! apollo-p2:/ #| '''PI15'''}</ol>| <ol start="3" style="textlist-alignstyle-type: leftlower-alpha;"|>| '''31'''<li>The command to view the current mode of USB0 is</li>{|| '''32'''| '''PWM1'''| '''PI11'''| '''267'''class="wikitable" style="width:800px;"
|-
| '''268'''| apollo-p2:/ # '''PI12'''| '''PWM2cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/otg_role'''| '''33'''|usb_host| '''34'''}| '''GND'''</ol>| style<span id="texthow-to-use-usb-align: left;camera"|></span> == How to use USB camera == # First insert the USB (UVC protocol) camera into the USB interface of the development board# If the USB camera is recognized normally, the corresponding video device node will be generated under /dev ::{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| '''258'''| '''PI2'''| style="text-alignconsole: left;"|| / # '''35'''|| ls /dev/video0'''36'''| style="text-align: left;"|| '''PC12'''| '''76'''|-| '''272'''| '''PI16'''| style="text-align: left;"|| '''37'''|| '''38'''| style="text-align: left;"|| '''PI4'''| '''260'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''39'''|| '''40'''| style="text-align: left;"|| '''PI3'''| '''259'''/dev/video0|} <ol start="2" style="list-style-type: decimal;"><li>First click the wiringOP icon to open wiringOP APP</li></ol> [[File:zero2w-img351.png]]
<ol start="3" style="list-style-type: decimal;">
<li><p>Then click make sure that the adb connection between the Ubuntu PC and the development board is normal. For how to use adb, please refer to the instructions in the section "[[Orange Pi Zero 2W#How to use ADB|'''How to use ADB''']]".</p></li><li><p>Download the USB camera test APP from the '''PWM_TESTofficial tool''' button on the main interface of wiringOP to enter the PWM test interfacedevelopment board information download page</lip></olli>
</div>
<div class="figure">
[[File:zero2w-img381img337.png]]
</div></ol>
<ol start="5" style="list-style-type: decimal;">
<li>Then set which PWM you want use the adb command to use in install the USB camera test APP into the ChannelAndroid system. The default is PWM1. If Of course, you want can also use a USB disk copy to set install it to PWM2, just enter 2 in the Channel. PWM3 and PWM4 and so on.</li></ol>{| class="wikitable" style="width:800px;" |-| [[Filetest@test:zero2w-img382~$ '''adb install usbcamera.png]]apk'''|}</ol>
<ol start="6" style="list-style-type: decimal;">
<li>Then After installation, you can set see the PWM period. The default configuration is '''50000ns'''startup icon of the USB camera on the Android desktop. The converted PWM frequency is '''20KHz'''</li></ol> [[File:zero2w-img383.png]]
[[File:zero2w-img338.png]]
</ol>
<ol start="7" style="list-style-type: decimal;">
<li>Then double-click to open the USB camera APP and you can see the output video of the '''EXPORT'''button to export PWMUSB camera.</li></ol>
</div><div class= '''How to compile Android 12 source code''' ="figure">
</div><ol start="2" style="list-style-type: decimal;"><li><p>First download Then make sure that the compressed package of adb connection between the Android 12 source code Ubuntu PC and the compressed package of development board is normal. For how to use adb, please refer to the instructions in the files modified by section "[[Orange Pi Zero2w from Google Cloud DriveZero 2W#How to use ADB|'''How to use ADB''']]".</p></li><li><p>Then use the adb command to install rootcheck.apk into the Android system. Of course, you can also use a USB disk copy to install it.</p></li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''adb install rootcheck.apk'''|}</ol><ol start="4" style="list-style-type: lower-alphadecimal;"><li>Google Cloud DriveAfter installation, you can see the startup icon of the ROOT test tool on the Android desktop.</li></ol></li></ol>
[[File:zero2w-img387img340.png]]</ol><ol start="5" style="list-style-type: decimal;"><li>The display interface after opening the '''ROOT test tool''' for the first time is as shown below</li>
[[File:zero2w-img341.png]]</ol><ol start="26" style="list-style-type: decimal;"><li>After downloading Then you can click '''CHECK NOW''' to start checking the compressed package ROOT status of the Android 12 source codesystem. After the check is completed, please check whether the MD5 checksum display is correctas follows. If it is incorrect, please download You can see that the source code againAndroid system has obtained ROOT permissions. Here's how to check the MD5 checksum:</li></ol>
[[File:zero2w-img344......png]]
<ol start="3" style="list/div></li><li><p>Then find the screen mirroring function in the phone settings. Here we take '''Xiaomi 12S Pro mobile phone''' as an example. Please research other brands of mobile phones by yourself. As shown in the picture below, click the button in the red box to open the screen mirroring function of the phone.</p><p>[[File:zero2w-style-type: decimal;"img345.png]]</p></li><li>Then <p>After waiting for a period of time, you need will be able to merge multiple compressed files into onesee the searched connectable devices on your mobile phone, and then extract we can select the device corresponding to the Android source codedevelopment board to connect. The command looks like this</p><p>[[File:zero2w-img346.png]]</p></li><li><p>Then the selection box shown in the figure below will pop up in the '''MiracastReceiver''' application interface of the development board. Here we can select '''Accept'''</p><p>[[File:zero2w-img347.png]]</p></li><li><p>Then you can see the content of the mobile phone screen on the HDMI screen connected to the development board</p><p>[[File:zero2w-img348.png]]</p></li></ol>
{| class="wikitable" style="background-color:# First install ffffdc;width:800px;" |-| <big>'''Note: The pin header on the software packages needed 40pin interface is not soldered by default, and you need to compile Android12 source codesolder it yourself before it can be used.'''</big>|}
<span id="pin-gpio-port-test@-method"></span>=== 40pin GPIO port test:~$ '''sudo apt-get update'''method ===
<ol start="2" style="list-style-type: decimal;">
<li><p>Then compile the code in click the longan folder, which mainly contains u-boot and linux kernel</p><ol style="list-style-type: lower-alpha;"><li>First run '''./build.sh configGPIO_TEST''' button to set compilation options</li></ol>open the GPIO test interface</li></ol>
[[File:zero2w-img352.png]]</ol><ol start="3" style="list-style-type: decimal;"><li>The GPIO test@test:~$ interface is as shown in the figure below. The two rows of '''CheckBox'''cd H618buttons on the left have a one-Android12to-Src/longanone 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-img359.png]]</ol><ol start="5" style="list-style-type: decimal;"><li>The serial port test interface of wiringOP is as shown in the figure below</li> [[File:zero2w-img360.png]]</ol><ol start="6" style="list-style-type: decimal;"><li><p>Then select the '''/dev/ttyAS2''' or'''/dev/ttyAS5''' node in the selection box</p><p>[[File:zero2w-img361.png]]</p></li><li><p>Enter the baud rate you want to set in the edit box, and then click the '''OPEN''' button to open the uart node. After the opening is successful, the '''OPEN''' button becomes unselectable, and the '''CLOSE''' button and '''SEND''' button become selectable.</p></li> [[File:zero2w-img362.png]]</ol><ol start="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 '''SEND''' 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;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''GPIO NO.'''| '''GPIO'''| '''Function'''| '''Pin'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''1'''|-| '''264'''| '''PI8'''| '''TWI1-SDA'''| '''3'''|-| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|-| '''269'''| '''PI13'''| '''PWM3'''| '''7'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''9'''|-| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-| '''261'''| '''PI5'''| '''UART2_TX'''| '''15'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''17'''|-| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|-| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''25'''|-| '''266'''| '''PI10'''| '''TWI2-SDA'''| '''27'''|-| '''256'''| '''PI0'''| style="text-align: left;"|| '''29'''|-| '''271'''| '''PI15'''| style="text-align: left;"|| '''31'''|-| '''268'''| '''PI12'''| '''PWM2'''| '''33'''|-| '''258'''| '''PI2'''| style="text-align: left;"|| '''35'''|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''6'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''8'''| '''UART0_TX'''| '''PH0'''| '''224'''|-| '''10'''| '''UART0_RX'''| '''PH1'''| '''225'''|-| '''12'''| style="text-align: left;"|| '''PI1'''| '''257'''|-| '''14'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''16'''| '''PWM4'''| '''PI14'''| '''270'''|-| '''18'''| style="text-align: left;"|| '''PH4'''| '''228'''|-| '''20'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''22'''| '''UART2_RX'''| '''PI6'''| '''262'''|-| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''28'''| '''TWI2-SCL'''| '''PI9'''| '''265'''|-| '''30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''32'''| '''PWM1'''| '''PI11'''| '''267'''|-| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''36'''| style="text-align: left;"|| '''PC12'''| '''76'''|}</div> <ol start="2" style="list-style-type: decimal;"><li>The device node corresponding to SPI1 CS0 is '''/dev/spidev1.0''', and the device node corresponding to SPI1 CS1 is '''/dev/spidev1.1'''</li>{| class="wikitable" style="width:800px;" |-| apollo-p2:/ # '''ls /dev/spidev1.*''' '''<span style="color:#FF0000">/dev/spidev1.0 /dev/spidev1.1</span>'''|}</ol><ol start="3" style="list-style-type: decimal;"><li>Here is a demonstration to test the SPI1 interface through the '''w25qxx''' module. First, connect the w25qxx module to the SPI1 interface.</li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''It doesn't matter if there is no w25qxx module, because there is a SPIFlash on the development board connected to SPI0, and the configuration of SPI0 is also turned on by default in Android, so we can also directly use the onboard SPIFlash for testing.'''</big>|}</ol><ol start="4" style="list-style-type: decimal;"><li>Then open wiringOP APP on the desktop</li> [[File:zero2w-img351.png]]</ol><ol start="5" style="list-style-type: decimal;"><li>Then click the '''SPI_TEST''' button to open the SPI test interface</li> [[File:zero2w-img365.png]]</ol><ol start="6" style="list-style-type: decimal;"><li><p>Then select the spi device node in the upper left corner. If you test the onboard SPIFlash directly, just keep the default '''/dev/spidev0.0'''. If the '''w25qxx''' module is connected to the 40pin spi1 cs0, then please select'''/dev/spidev1.0''', if the w25qxx module is connected to the 40pin spi1 cs1, then please select '''/dev/spidev1.1'''</p><div class="figure"> [[File:zero2w-img366.png]] </div></li><li><p>Then click the '''OPEN''' button to initialize the SPI</p></li> [[File:zero2w-img367.png]]</ol><ol start="8" style="list-style-type: decimal;"><li>Then fill in the bytes that need to be sent, such as reading the ID information of the onboard SPIFlash, filling in the address 0x9f in data[0], and then click the '''TRANSFER''' button</li> [[File:zero2w-img368.png]]</ol><ol start="9" style="list-style-type: decimal;"><li>Finally, the APP will display the read ID information of the onboard SPI Flash.</li> [[File:zero2w-img369.png]]</ol><ol start="10" style="list-style-type: decimal;"><li>If the w25qxx module connected to 40pin SPI1 is read, the ID information of the onboard SPI Flash is also similar.</li></ol> <span id="pin-i2c-test-method"></span> === 40pin I2C test method === # As can be seen from the table below, the Android12 TV system has i2c1 and i2c2 turned on by default. <div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''GPIO NO.'''| '''GPIO'''| '''Function'''| '''Pin'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''1'''|-| '''<span style="color:#FF0000">264</span>'''| '''<span style="color:#FF0000">PI8</span>'''| '''<span style="color:#FF0000">TWI1-SDA</span>'''| '''<span style="color:#FF0000">3</span>'''|-| '''<span style="color:#FF0000">263</span>'''| '''<span style="color:#FF0000">PI7</span>'''| '''<span style="color:#FF0000">TWI1-SCL</span>'''| '''<span style="color:#FF0000">5</span>'''|-| '''269'''| '''PI13'''| '''PWM3'''| '''7'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''9'''|-| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-| '''261'''| '''PI5'''| '''UART2_TX'''| '''15'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''17'''|-| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|-| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''25'''|-| '''<span style="color:#FF0000">266</span>'''| '''<span style="color:#FF0000">PI10</span>'''| '''<span style="color:#FF0000">TWI2-SDA</span>'''| '''<span style="color:#FF0000">27</span>'''|-| '''256'''| '''PI0'''| style="text-align: left;"|| '''29'''|-| '''271'''| '''PI15'''| style="text-align: left;"|| '''31'''|-| '''268'''| '''PI12'''| '''PWM2'''| '''33'''|-| '''258'''| '''PI2'''| style="text-align: left;"|| '''35'''|-| '''272'''| '''PI16'''| style="text-align: left;"|| '''37'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''39'''|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''6'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''8'''| '''UART0_TX'''| '''PH0'''| '''224'''|-| '''10'''| '''UART0_RX'''| '''PH1'''| '''225'''|-| '''12'''| style="text-align: left;"|| '''PI1'''| '''257'''|-| '''14'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''16'''| '''PWM4'''| '''PI14'''| '''270'''|-| '''18'''| style="text-align: left;"|| '''PH4'''| '''228'''|-| '''20'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''22'''| '''UART2_RX'''| '''PI6'''| '''262'''|-| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''<span style="color:#FF0000">28</span>'''| '''<span style="color:#FF0000">TWI2-SCL</span>'''| '''<span style="color:#FF0000">PI9</span>'''| '''<span style="color:#FF0000">265</span>'''|-| '''30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''32'''| '''PWM1'''| '''PI11'''| '''267'''|-| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''36'''| style="text-align: left;"|| '''PC12'''| '''76'''|-| '''38'''| style="text-align: left;"|| '''PI4'''| '''260'''|-| '''40'''| style="text-align: left;"|| '''PI3'''| '''259'''|}</div> <ol start="2" style="list-style-type: decimal;"><li>The device node corresponding to i2c1 is '''/dev/i2c-1''', and the device node corresponding to i2c2 is '''/dev/i2c-2'''</li>{| class="wikitable" style="width:800px;" |-| apollo-p2:/ # '''ls /dev/i2c-*''' '''<span style="color:#FF0000">/dev/i2c-1 /dev/i2c-2</span>''' /dev/i2c-5|}</ol><ol start="3" style="list-style-type: decimal;"><li>First open wiringOP APP on the desktop</li> [[File:zero2w-img351.png]]</ol><ol start="4" style="list-style-type: decimal;"><li>Then click the '''I2C_TEST''' button to open the i2c test interface</li> [[File:zero2w-img370.png]]</ol><ol start="5" style="list-style-type: decimal;"><li>The i2c test interface of wiringOP is shown in the figure below</li> [[File:zero2w-img371.png]]</ol><ol start="6" style="list-style-type: decimal;"><li>Then click the device node selection box in the upper left corner to select the i2c you want to test</li> [[File:zero2w-img372.png]]</ol><ol start="7" style="list-style-type: decimal;"><li>Then connect an i2c device to the 40pin i2c pin. Here we take the ds1307 rtc module as an example.</li> [[File:zero2w-img178.png]]</ol><ol start="8" style="list-style-type: decimal;"><li><p>The i2c address of the ds1307 rtc module is 0x68. After connecting the lines, we can use the '''i2cdetect -y 1''' or '''i2cdetect -y 2''' command on the serial port command line to check whether the i2c address of the ds1307 rtc module can be scanned. If you can see the address 0x68, it means that the ds1307 rtc module is wired correctly.</p>{| class="wikitable" style="width:800px;" |-| <p>apollo-p2:/ # '''i2cdetect -y 1'''</p><p>'''Or'''</p><p>apollo-p2:/ # '''i2cdetect -y 2'''</p>|}<p>[[File:zero2w-img373.png]]</p></li><li><p>Then set the i2c address to 0x68 in wiringOP, and then click the '''OPEN''' button to open i2c</p><p>[[File:zero2w-img374.png]]</p></li><li><p>After clicking the '''OPEN''' button to open i2c, the display is as follows</p><p>[[File:zero2w-img375.png]]</p></li><li><p>Then we test writing a value to the register of the rtc module, for example, writing 0x55 to the 0x1c address</p><ol style="list-style-type: lower-alpha;"><li><p>We first set the address of the register to be written to 0x1c</p><p>[[File:zero2w-img376.png]]</p></li><li><p>Then set the value to be written to 0x55</p><p>[[File:zero2w-img377.png]]</p></li><li><p>Then click the '''WRITE BYTE''' button to perform the writing action</p><p>[[File:zero2w-img378.png]]</p></li></ol></li><li><p>Then click the '''READ BYTE''' button to read the value of the 0x1c register. If it displays 0x55, it means that the i2c read and write test has passed.</p><p>[[File:zero2w-img379.png]]</p></li></ol> <span id="pin-pwm-test"></span> === 40pin PWM test === # As can be seen from the table below, the available pwm are pwm1, pwm2, pwm3 and pwm4. <div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''GPIO NO.'''| '''GPIO'''| '''Function'''| '''Pin'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''1'''|-| '''264'''| '''PI8'''| '''TWI1-SDA'''| '''3'''|-| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|-| '''<span style="color:#FF0000">269</span>'''| '''<span style="color:#FF0000">PI13</span>'''| '''<span style="color:#FF0000">PWM3</span>'''| '''<span style="color:#FF0000">7</span>'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''9'''|-| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-| '''261'''| '''PI5'''| '''UART2_TX'''| '''15'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''17'''|-| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|-| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''25'''|-| '''266'''| '''PI10'''| '''TWI2-SDA'''| '''27'''|-| '''256'''| '''PI0'''| style="text-align: left;"|| '''29'''|-| '''271'''| '''PI15'''| style="text-align: left;"|| '''31'''|-| '''<span style="color:#FF0000">268</span>'''| '''<span style="color:#FF0000">PI12</span>'''| '''<span style="color:#FF0000">PWM2</span>'''| '''<span style="color:#FF0000">33</span>'''|-| '''258'''| '''PI2'''| style="text-align: left;"|| '''35'''|-| '''272'''| '''PI16'''| style="text-align: left;"|| '''37'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''39'''|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''6'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''8'''| '''UART0_TX'''| '''PH0'''| '''224'''|-| '''10'''| '''UART0_RX'''| '''PH1'''| '''225'''|-| '''12'''| style="text-align: left;"|| '''PI1'''| '''257'''|-| '''14'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''<span style="color:#FF0000">16</span>'''| '''<span style="color:#FF0000">PWM4</span>'''| '''<span style="color:#FF0000">PI14</span>'''| '''<span style="color:#FF0000">270</span>'''|-| '''18'''| style="text-align: left;"|| '''PH4'''| '''228'''|-| '''20'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''22'''| '''UART2_RX'''| '''PI6'''| '''262'''|-| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''28'''| '''TWI2-SCL'''| '''PI9'''| '''265'''|-| '''30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''<span style="color:#FF0000">32</span>'''| '''<span style="color:#FF0000">PWM1</span>'''| '''<span style="color:#FF0000">PI11</span>'''| '''<span style="color:#FF0000">267</span>'''|-| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''36'''| style="text-align: left;"|| '''PC12'''| '''76'''|-| '''38'''| style="text-align: left;"|| '''PI4'''| '''260'''|-| '''40'''| style="text-align: left;"|| '''PI3'''| '''259'''|}</div> <ol start="2" style="list-style-type: decimal;"><li>First click the wiringOP icon to open wiringOP APP</li> [[File:zero2w-img351.png]]</ol><ol start="3" style="list-style-type: decimal;"><li>Then click the '''PWM_TEST''' button on the main interface of wiringOP to enter the PWM test interface</li> [[File:zero2w-img380.png]]</ol><ol start="4" style="list-style-type: decimal;"><li>The PWM test interface is as follows</li> <div class="figure"> [[File:zero2w-img381.png]] </div></ol><ol start="5" style="list-style-type: decimal;"><li>Then set which PWM you want to use in the Channel. The default is PWM1. If you want to set it to PWM2, just enter 2 in the Channel. PWM3 and PWM4 and so on.</li> [[File:zero2w-img382.png]]</ol><ol start="6" style="list-style-type: decimal;"><li>Then you can set the PWM period. The default configuration is '''50000ns'''. The converted PWM frequency is '''20KHz'''</li> [[File:zero2w-img383.png]]</ol><ol start="7" style="list-style-type: decimal;"><li>Then click the '''EXPORT'''button to export PWM</li> [[File:zero2w-img384.png]]</ol><ol start="8" style="list-style-type: decimal;"><li>Then drag the progress bar below to change the PWM duty cycle, and then check '''Enable''' to output the PWM waveform.</li> [[File:zero2w-img385.png]]</ol><ol start="9" style="list-style-type: decimal;"><li>Then use an oscilloscope to measure the corresponding pins in the 40pin development board and you can see the following waveform.</li> [[File:zero2w-img386.png]]</ol><span id="how-to-compile-android-12-source-code"></span> = '''How to compile Android 12 source code''' = <span id="download-the-source-code-of-android-12"></span>== Download the source code of Android 12 == <ol style="list-style-type: decimal;"><li><p>First download the compressed package of the Android 12 source code and the compressed package of the files modified by Orange Pi Zero2w from Google Cloud Drive</p><ol style="list-style-type: lower-alpha;"><li>Google Cloud Drive</li> [[File:zero2w-img387.png]]</ol></li></ol><ol start="2" style="list-style-type: decimal;"><li>After downloading the compressed package of Android 12 source code, please check whether the MD5 checksum is correct. If it is incorrect, please download the source code again. Here's how to check the MD5 checksum:</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''md5sum -c H618-Android12-Src.tar.gz.md5sum''' H618-Android12-Src.tar.gzaa: '''<span style="color:#FF0000">OK</span>''' H618-Android12-Src.tar.gzab: '''<span style="color:#FF0000">OK</span>''' ......|}</ol><ol start="3" style="list-style-type: decimal;"><li>Then you need to merge multiple compressed files into one, and then extract the Android source code. The command looks like this:</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''cat H618-Android12-Src.tar.gz<span style="color:#FF0000">a</span>* > H618-Android12-Src.tar.gz''' test@test:~$ '''tar -xvf H618-Android12-Src.tar.gz'''|}</ol><ol start="4" style="list-style-type: decimal;"><li>Then unzip the compressed package of the files modified by Orange Pi Zero2w</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''tar zxf opizero2w_android12_patches.tar.gz''' test@test:~$ '''ls''' '''opizero2w_android12_patches''' opizero2w_android12_patches.tar.gz|}</ol><ol start="5" style="list-style-type: decimal;"><li>Then copy the files modified by Orange Pi Zero2w to the Android source code</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''cp -rf opizero2w_android12_patches/* H618-Android12-Src/'''|}</ol><span id="compile-the-source-code-of-android-12"></span> == Compile the source code of Android 12 == {| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Android12 is compiled on an x86_64 computer with <span style="color:#FF0000">Ubuntu 22.04</span> installed. Other versions of Ubuntu system package dependencies may have some differences. The image download address of the Ubuntu 22.04 <span style="color:#FF0000">amd64</span> version is as follows:''' [https://repo.huaweicloud.com/ubuntu-releases/22.04/ubuntu-22.04.2-desktop-amd64.iso '''https://repo.huaweicloud.com/ubuntu-releases/22.04/ubuntu-22.04.2-desktop-amd64.iso'''] '''The x86_64 computer hardware configuration for compiling Android12 source code recommends a memory of 16GB or more, and a hard disk space of 200GB or more is recommended. The more CPU cores, the better.'''</big>|} # First install the software packages needed to compile Android12 source code ::{| class="wikitable" style="width:800px;" |-| test@test:~$ '''sudo apt-get update''' test@test:~$ '''sudo apt-get install -y git gnupg flex bison gperf build-essential \''' '''zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \''' '''lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev ccache \''' '''libgl1-mesa-dev libxml2-utils xsltproc unzip u-boot-tools python-is-python3 \''' '''libssl-dev libncurses5 clang gawk'''|} <ol start="2" style="list-style-type: decimal;"><li><p>Then compile the code in the longan folder, which mainly contains u-boot and linux kernel</p><ol style="list-style-type: lower-alpha;"><li>First run '''./build.sh config''' to set compilation options</li>{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''cd H618-Android12-Src/longan'''</p><p>test@test:~/H618-Android12-Src/longan$ '''./build.sh config'''</p> <p>Welcome to mkscript setup progress</p><p>All available platform:</p>:<p>0. android</p>:<p>1. linux</p><p>Choice [android]: '''<span style="color:#FF0000">0</span>'''</p><p>All available ic:</p>:<p>0. h618</p><p>Choice [h618]: '''<span style="color:#FF0000">0</span>'''</p><p>All available board:</p>:<p>0. ft</p>:<p>1. p1</p>:<p>2. p2</p>:<p>3. p7</p>:<p>4. p7l</p>:<p>5. perf1</p>:<p>6. perf2</p>:<p>7. perf3</p>:<p>8. qa</p><p>Choice [p2]: '''<span style="color:#FF0000">2</span>'''</p><p>All available flash:</p>:<p>0. default</p>:<p>1. nor</p><p>Choice [default]: '''<span style="color:#FF0000">0</span>'''</p><p>All available kern_ver:</p>:<p>0. linux-5.4</p><p>Choice [linux-5.4]: '''<span style="color:#FF0000">0</span>'''</p><p>All available arch:</p>:<p>0. arm</p>:<p>1. arm64</p><p>Choice [arm64]: '''<span style="color:#FF0000">1</span>'''</p><p>'''......'''</p><p>*** Default configuration is based on 'sun50iw9p1smp_h618_android_defconfig'</p><p>#</p><p># configuration written to .config</p><p>#</p><p>make[1]: Leaving directory '/home/test/H618-Android12-Src/longan/out/kernel/build'</p><p>make: Leaving directory '/home/test/H618-Android12-Src/longan/kernel/linux-5.4'</p><p>INFO: clean buildserver</p><p>INFO: prepare_buildserver</p>|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Then run the '''./build.sh''' script to start compilation.</li>{| class="wikitable" style="width:800px;" |-| test@test:~/H618-Android12-Src/longan$ '''./build.sh'''|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>After compilation is completed, you will see the following output</li>{| class="wikitable" style="width:800px;" |-| sun50iw9p1 compile Kernel successful INFO: Prepare toolchain ... '''......''' INFO: build lichee kernel OK. INFO: build rootfs ... INFO: skip make rootfs for android
INFO: ----------------------------------------
INFO: build lichee OK. INFO: ----------------------------------------|}</ol></li></ol><ol start="3" style="list-style-type: decimal;"><li>Then use the following command to compile the Android source code and generate the final Android image</li></ol>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''cd H618-Android12-Src''' test@test:~/H618-Android12-Src$ '''source build/envsetup.sh''' test@test:~/H618-Android12-Src$ '''lunch apollo_p2-userdebug''' test@test:~/H618-Android12-Src$ '''make -j8''' test@test:~/H618-Android12-Src$ '''pack'''|}</ol><ol start="4" style="list-style-type: decimal;"><li><p>The storage path of the Android image generated by compilation is:</p>{| class="wikitable" style="width:800px;" |-| <p>'''longan/out/h618_android12_p2_uart0.img'''</p>|}</li></ol> <span id="appendix"></span> = '''Appendix''' = <span id="user-manual-update-history"></span>== User manual update history == {| class="wikitable" style="width:800px;text-align: center;"|-| '''Version'''| '''Date'''| '''Release Notes'''|-| v1.0| 2023-09-14| initial version|} <span id="image-update-history"></span>== Image update history == {| class="wikitable" style="width:800px;"|-| style="text-align: center;"| '''Date''' | style="text-align: center;"| '''Release Notes'''|-| 202 3style="text-align: center;"| 2023-09-14| orangepizero2w_1.0.0_debian_bullseye_server_linux5.4.125.7z orangepizero2w_1.0.0_ubuntu_focal_server_linux5.4.125.7z orangepizero2w_1.0.0_ubuntu_focal_desktop_xfce_linux5.4.125.7z orangepizero2w_1.0.0_debian_bullseye_desktop_xfce_linux5.4.125.7z orangepizero2w_1.0.0_ubuntu_jammy_server_linux6.1.31.7z orangepizero2w_1.0.0_debian_bookworm_server_linux6.1.31.7z orangepizero2w_1.0.0_debian_bullseye_server_linux6.1.31.7z orangepizero2w_1.0.0_ubuntu_jammy_desktop_xfce_linux6.1.31.7z orangepizero2w_1.0.0_debian_bookworm_desktop_xfce_linux6.1.31.7z orangepizero2w_1.0.0_debian_bullseye_desktop_xfce_linux6.1.31.7z OrangePi_Zero2w_Android12_v1.0.tar.gz
Opios-arch-aarch64-xfce-opizero2w-23.09-linux6.1.31.img.xz