Open main menu

Wiki-Orange Pi β

Changes

Orange Pi Zero 2W

44,325 bytes added, 20:33, 27 September 2023
Download orangepi-build from github
<div class="figure">
[[File:zero2w-img3.png|800px]]
</div>
<div class="figure">
[[File:zero2w-img4.png|800px]]
</div>
<div class="figure">
[[File:zero2w-img5.png|800px]]
</div>
<span id="orange-pi-zero-2w-24pin-expansion-board-interface-details"></span>
 
== Orange Pi Zero 2w 24pin expansion board interface details ==
<div class="figure">
[[File:zero2w-img6.png|800px]]
</div>
[[File:zero2w-img7.png|800px]]
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
=== Method to reduce the capacity of rootfs partition in TF card ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''After configuring the application or other development environment in the Linux system of the TF card, if you want to back up the Linux system in the TF card, you can use the method in this section to reduce the size of the rootfs partition first, and then start the backup.'''</big>|}
<ol style="list-style-type: decimal;">
<li><p>First, insert the TF card you want to operate on your '''<span style="color:#FF0000">Ubuntu computer</span>''' (not Windows)</p></li>
<li><p>Then install the gparted software on your Ubuntu computer</p>
{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''sudo apt install -y gparted'''</p>|}</li>
<li><p>Then open gparted</p>
{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''sudo gparted'''</p>|}</li>
<li><p>After opening gparted, you can select the TF card in the upper right corner, and then you can see the usage of the TF card capacity.</p>
<p>[[File:zero2w-img97.png]]</p></li>
<li><p>After setting the capacity, click '''Resize/Move''' in the lower right corner.</p>
<p>[[File:zero2w-img93.png]]</p></li>
<li><p>After final confirmation, click the green '''<span style="color:green"></span>''' as shown in the picture below.</p>
<p>[[File:zero2w-img94.png]]</p></li>
<li><p>Then select '''Apply''', and the capacity expansion of the rootfs partition will officially begin.</p>
<p>[[File:zero2w-img96.png]]</p></li>
<li><p>Then you can unplug the TF card and insert it into the development board to start. After entering the Linux system of the development board, if you use the '''df -h''' command, you can see that the size of the rootfs partition is consistent with the size set previously, which means it has been reduced capacity success</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>root@orangepi:~# '''df -h'''</p>
<pspan style="margin-right: 80px;">Filesystem </span><span style="margin-right: 50px;">Size </span><span style="margin-right: 30px;">Used </span><span style="margin-right: 30px;">Avail </span><span style="margin-right: 50px;">Use% Mounted on</pspan><br><pspan style="margin-right: 110px;">udev </span><span style="margin-right: 60px;">925M </span><span style="margin-right: 50px;">0 </span><span style="margin-right: 70px;">925M </span><span style="margin-right: 90px;">0% /dev</pspan><br><pspan style="margin-right: 100px;">tmpfs </span><span style="margin-right: 50px;">199M </span><span style="margin-right: 30px;">3.2M </span><span style="margin-right: 70px;">196M </span><span style="margin-right: 90px;">2% /run</pspan><br><pspan style="margin-right: 25px;color:#FF0000">'''/dev/mmcblk0p1 '''</span><span style="margin-right: 50px;color:#FF0000">'''7.7G '''</span><span style="margin-right: 35px;color:#FF0000">'''3.2G '''</span><span style="margin-right: 80px;color:#FF0000">'''4.4G '''</span><span style="margin-right: 90px;color:#FF0000">'''42% /'''</pspan><br>|}</li></ol>
<span id="pin-expansion-board-interface-pin-description"></span>
 
== 24Pin expansion board interface pin description ==
[[File:zero2w-img105.png]]
</div></li></ol>
{| class="wikitable" style="width:800px;text-align: center;"
|-
| style="width:50px;" | 1| style="width:200px;" | 100M network port
| Used to connect to a wired network to access the Internet
|-
| The default settings of the Linux system are KEY_1 (Number 1 key) and KEY_ENTER (Enter key), which can be customized as other function keys by modifying the dts configuration.
|}
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>The adaptation of Linux5.4 and Linux6.1 systems to expansion boards is shown in the following table</li></ol>
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''24pin expansion board function'''
|-
| '''TV-OUT'''
| '''<span style="color:#FF0000">NO</span>'''| '''<span style="color:#FF0000">NO</span>'''
|}
</ol>
<span id="how-to-use-the-two-lradc-buttons-on-the-24pin-expansion-board"></span>
<span id="how-to-use-the-two-lradc-buttons-on-the-24pin-expansion-board"></span>
== How to use the two LRADC buttons on the 24pin expansion board ==
<li><p>There are two LRADC buttons on the 24pin expansion board, and their locations are as shown in the figure below:</p>
<p>[[File:zero2w-img106.png]]</p></li>
<li><p>In the Linux system, the default key values of KEY1 and KEY2 are</p></li></ol>
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''Linux kernel'''
| '''KEY_ENTER, the enter key'''
|}
</ol>
<ol start="3" style="list-style-type: decimal;">
<li><p>Through the '''evtest''' command, we can check the key values reported after KEY1 and KEY2 are pressed.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>linux5.4</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepizero2w:~$ '''evtest'''</p>
<p>No device specified, trying to scan all of /dev/input/event*</p>
<p>Not running as root, no devices may be available.</p>
<p>Available devices:</p>
<p>'''/dev/input/event0event<span style="color: #FF0000">0</span>: <span style="color:#FF0000">sunxi-keyboard</span>'''</p>
<p>/dev/input/event1: sunxi-ir</p>
<p>/dev/input/event2: axp2101-pek</p>
<p>/dev/input/event6: PixArt USB Optical Mouse</p>
<p>/dev/input/event7: BRLTTY 6.3 Linux Screen Driver Keyboard</p>
<p>Select the device event number [0-7]: '''<span style="color:#FF0000">0 </span> #You need to enter the serial number corresponding to sunxi-keyboard'''</p>
<p>Input driver version is 1.0.1</p>
<p>Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100</p>
<p>Input device name: &quot;sunxi-keyboard&quot;</p>
<p>Supported events:</p>
:<p>Event type 0 (EV_SYN)</p>:<p>Event type 1 (EV_KEY)</p>::<p>Event code 2 (KEY_1)</p>::<p>Event code 28 (KEY_ENTER)</p>
<p>Properties:</p>
<p>Testing ... (interrupt to exit)</p>
 
 
<p>'''#The following are the key values reported after pressing KEY1 and KEY2'''</p>
 
 
<p>Event: time 1693555298.132314, type 1 (EV_KEY), code 2 (KEY_1), value 1</p>
<p>Event: time 1693555298.132314, -------------- SYN_REPORT ------------</p>
<p>Event: time 1693555298.601042, -------------- SYN_REPORT ------------</p>
<p>Event: time 1693555298.710415, type 1 (EV_KEY), code 28 (KEY_ENTER), value 0</p>
<p>Event: time 1693555298.710415, -------------- SYN_REPORT ------------</p>|}</li>
<li><p>linux6.1</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepizero2w:~$ evtest</p>
<p>No device specified, trying to scan all of /dev/input/event*</p>
<p>Available devices:</p>
<p>/dev/input/event0: axp20x-pek</p>
<p>'''/dev/input/event1event<span style="color: #FF0000">1</span>: <span style="color:#FF0000">5070800.lradc</span>'''</p>
<p>/dev/input/event2: SONiX USB Keyboard</p>
<p>/dev/input/event3: SONiX USB Keyboard Consumer Control</p>
<p>/dev/input/event5: PixArt USB Optical Mouse</p>
<p>/dev/input/event6: sunxi-ir</p>
<p>Select the device event number [0-6]: '''<span style="color:#FF0000">1 </span> #You need to enter the serial number corresponding to 5070800.lradc'''</p>
<p>Input driver version is 1.0.1</p>
<p>Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100</p>
<p>Input device name: &quot;5070800.lradc&quot;</p>
<p>Supported events:</p>
:<p>Event type 0 (EV_SYN)</p>:<p>Event type 1 (EV_KEY)</p>::<p>Event code 2 (KEY_1)</p>::<p>Event code 28 (KEY_ENTER)</p>
<p>Properties:</p>
<p>Testing ... (interrupt to exit)</p>
 
 
<p>'''#The following are the key values reported after pressing KEY1 and KEY2'''</p>
 
 
<p>Event: time 1694075818.810877, type 1 (EV_KEY), code 2 (KEY_1), value 1</p>
<p>Event: time 1694075818.810877, -------------- SYN_REPORT ------------</p>
<p>Event: time 1694075819.536128, -------------- SYN_REPORT ------------</p>
<p>Event: time 1694075819.705009, type 1 (EV_KEY), code 28 (KEY_ENTER), value 0</p>
<p>Event: time 1694075819.705009, -------------- SYN_REPORT ------------</p>|}</li></ol>
</li>
<li><p>If you need to modify the key values reported after KEY1 and KEY2 are pressed, you can use the following method:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>There is a '''sun50i-h618-lradc-keys.dts''' file under the &gt; '''/usr/src/''' path, through which we can define KEY1 and KEY2 &gt; as the desired key values.</p>{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepizero2w:~$ '''cd /usr/src/'''</p>
<p>orangepi@orangepizero2w:/usr/src$ '''ls *.dts'''</p>
<p>sun50i-h618-lradc-keys.dts</p>|}</li><li><p>The contents of the '''sun50i-h618-lradc-keys.dts''' file in the &gt; linux5.4 system are as follows:</p><ol style="list-style-type: lower-alphanone;"><li><p>a) KEY1 correspondence: modify '''key0 = &lt;600 2&gt;;''' where 2 is &gt; the number corresponding to the desired key value</p></li><li><p>b) KEY2 correspondence: modify '''key1 = &lt;800 28&gt;;''' where 28 &gt; is the number corresponding to the desired key value</p>{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepizero2w:/usr/src$ '''sudo vim sun50i-h618-lradc-keys.dts'''</p>
<p>/dts-v1/;</p>
<p>/plugin/;</p>
 
 
<p>/ {</p>
:<p>fragment@0 {</p>::<p>target = &lt;&amp;keyboard&gt;;</p>  ::<p>__overlay__ {</p>:::<p>status = &quot;okay&quot;;</p>  :::<p>'''key0 = &lt;600 <span style="color:#FF0000">2</span>&gt;;'''</p>:::<p>'''key1 = &lt;800 <span style="color:#FF0000">28</span>&gt;;'''</p>::<p>};</p>:<p>};</p>
<p>};</p>
<p>|};</p><p>};</p></li></ol>
</li>
<li><p>The contents of the c.linux6.1 system &gt; '''sun50i-h618-lradc-keys.dts''' file are as follows:</p><ol style="list-style-type: lower-alphanone;"><li><p>a) KEY1 corresponding: modify '''linux,code = &lt;2&gt;;''' the 2 in &gt; it is the number corresponding to the desired key value</p></li><li><p>b) KEY2 correspondence: modify '''linux,code = &lt;28&gt;;''' the 28 &gt; in it is the number corresponding to the desired key value</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepizero2w:/usr/src$ '''sudo ''' '''vim ''' '''sun50i-h618-lradc-keys.dts'''</p>
<p>/dts-v1/;</p>
<p>/plugin/;</p>
 
 
<p>/ {</p>
:<p>fragment@0 {</p>::<p>target = &lt;&amp;r_lradc&gt;;</p>  ::<p>__overlay__ {</p>:::<p>status = &quot;okay&quot;;</p>  :::<p>button-500 {</p>::::<p>label = &quot;KEY_1&quot;;</p>::::<p>'''linux,code = &lt;<span style="color:#FF0000">2</span>&gt;;'''</p>:::<p>};</p>  :::<p>button-800 {</p>::::<p>label = &quot;KEY_ENTER&quot;;</p>::::<p>'''linux,code = &lt;<span style="color:#FF0000">28</span>&gt;;'''</p>:::<p>};</p>::<p>};</p>:<p>};</p>
<p>};</p>
<p>button-800 {</p><p>label = &quot;KEY_ENTER&quot;;</p><p>'''linux,code = &lt;28&gt;;'''</p><p>};</p><p>};</p><p>|};</p><p>};</p></li></ol>
</li>
<li><p>For the key values that can be set, please refer to the macro &gt; definition in the '''input-event-codes.h''' header file. Its &gt; path in the kernel source code is:</p>{| class="wikitable" style="width:800px;" |-|
<p>orange-pi-5.4-sun50iw9/include/uapi/linux/input-event-codes.h</p>
<p>orange-pi-6.1-sun50iw9/include/uapi/linux/input-event-codes.h</p>|}</li><li><p>After modification, use the '''orangepi-add-overlay''' command to &gt; add the sun50i-h618-lradc-keys.dts configuration to the &gt; system.</p>{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepizero2w:/usr/src$ '''sudo orangepi-add-overlay sun50i-h618-lradc-keys.dts'''</p>
<p>Compiling the overlay</p>
<p>Copying the compiled overlay file to /boot/overlay-user/</p>
<p>Reboot is required to apply the changes</p>|}</li><li><p>Then restart the system and the customized key values will take &gt; effect.</p></li></ol>
</li></ol>
<span id="network-connection-test"></span>
 
== Network connection test ==
<p>[[File:zero2w-img107.png]]</p></li>
<li><p>Then plug one end of the network cable into the Ethernet interface of the expansion board, and the other end of the network cable into the router, and make sure the network is smooth.</p></li>
<li><p>After the system starts, it will automatically assign an IP address to the Ethernet card through '''DHCP''', '''<span style="color:#FF0000">and no other configuration is required.</span>'''</p></li>
<li><p>The command to view the IP address in the Linux system of the development board is as follows:</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Please do not copy the following commands. For example, the network node name in debian12 is end0, and the following command needs to be modified to ip a s end0.'''</p></big>|}{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepi:~$ '''ip a s eth0'''</p>
<p>3: eth0: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc pfifo_fast state UP group default qlen 1000</p>
:<p>link/ether 5e:ac:14:a5:93:b3 brd ff:ff:ff:ff:ff:ff</p>:<p>inet '''<span style="color:#FF0000">192.168.1.16</span>'''/24 brd 192.168.1.255 scope global dynamic noprefixroute eth0</p>::<p>valid_lft 259174sec preferred_lft 259174sec</p>:<p>inet6 240e:3b7:3240:c3a0:e269:8305:dc08:135e/64 scope global dynamic noprefixroute</p>::<p>valid_lft 259176sec preferred_lft 172776sec</p>:<p>inet6 fe80::957d:bbbd:4928:3604/64 scope link noprefixroute</p>::<p>valid_lft forever preferred_lft forever</p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''There are three ways to check the IP address after the development board is started:'''</p>
<p>'''1. Connect the HDMI display, then log in to the system and use the ip a s eth0 command to check the IP address.'''</p>
<p>'''2. Enter the ip a s eth0 command in the debugging serial terminal to view the IP address.'''</p>
<p>'''3. If there is no debugging serial port or HDMI display, you can also check the IP address of the development board's network port through the router's management interface. However, with this method, people often fail to see the IP address of the development board. If you can't see it, here's how to debug it:'''</p>
:<p>'''A) First check whether the Linux system has started normally. If the green light of the development board flashes, it usually means that it has started normally. If only the red light is on, or the red and green lights are not on, it means that the system has not started normally;'''</p>:<p>'''B) Check whether the network cable is plugged in tightly, or try another network cable;'''</p>:<p>'''C) Try another router (I have encountered many problems with routers, such as the router being unable to assign an IP address normally, or the IP address being assigned normally but not being visible in the router);'''</p>:<p>'''D) If there is no router to replace, you can only connect an HDMI display or use the debugging serial port to check the IP address.'''</p>  <p>'''In addition, it should be noted that the development board's DHCP automatic allocation of IP addresses does not require any settings.'''</p></big>|}</li>
<li><p>The command to test network connectivity is as follows. The '''ping''' command can be interrupted by pressing the '''Ctrl+C''' shortcut key.</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Please do not copy the following commands. For example, the network node name in debian12 is end0. The following command needs to be modified to ping www.baidu.com -I end0.'''</p></big>|}{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepi:~$ '''ping www.baidu.com -I eth0'''</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="wifi-connection-test"></span>
 
=== WIFI connection test ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Please do not connect to WIFI by modifying the /etc/network/interfaces configuration file. There will be problems in connecting to the WIFI network in this way.'''</big>|}
<span id="server-version-image-connects-to-wifi-through-commands"></span>
==== Server version image connects to WIFI through commands ====
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''When the development board is not connected to Ethernet or HDMI display, but only to the serial port, it is recommended to use the commands demonstrated in this section to connect to the WIFI network. Because nmtui can only display characters in some serial port software (such as minicom) and cannot display the graphical interface normally. Of course, if the development board is connected to an Ethernet or HDMI display, you can also use the commands demonstrated in this section to connect to the WIFI network.'''</big>|}
<ol style="list-style-type: decimal;">
<li><p>First log in to the Linux system, there are three ways:</p>
<p>a. If the development board is connected to a network cable, you can remotely log in to '''[[\lOrange Pi Zero 2W#SSH remote login development board|the Linux system through ssh]].'''</p>
<p>b. If the development board is connected to the debugging serial port, you can use the serial port terminal to log in to the Linux system.</p>
<p>c. If the development board is connected to an HDMI display, you can log in to the Linux system through the HDMI display terminal.</p></li></ol>
<!-- --><ol start="2" style="list-style-type: decimal;">
<li><p>First use the '''nmcli dev wifi''' command to scan the surrounding WIFI hotspots</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''nmcli dev wifi'''</p>
|}
<div class="figure">
<li><p>Then use the '''nmcli''' command to connect to the scanned WIFI hotspot, where:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>'''wifi_name''' needs to be replaced with the name of the WIFI &gt; hotspot you want to connect to</p></li><li><p>'''wifi_passwd''' needs to be replaced with the password of the &gt; WIFI hotspot you want to connect to.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo nmcli dev wifi connect <span style="color:#FF0000">wifi_name </span> password <span style="color:#FF0000">wifi_passwd</span>'''</p><p>Device 'wlan0' successfully activated with 'cf937f88-ca1e-4411-bb50-61f402eef293'.</p>|}</li></ol>
</li>
<li><p>You can check the IP address of the wifi through the '''ip addr show wlan0''' command</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''ip a s wlan0'''</p>
<p>11: wlan0: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc pfifo_fast state UP group default qlen 1000</p>
:<p>link/ether 23:8c:d6:ae:76:bb brd ff:ff:ff:ff:ff:ff</p>:<p>inet '''<span style="color:#FF0000">192.168.1.11</span>'''/24 brd 192.168.1.255 scope global dynamic noprefixroute wlan0</p>::<p>valid_lft 259192sec preferred_lft 259192sec</p>:<p>inet6 240e:3b7:3240:c3a0:c401:a445:5002:ccdd/64 scope global dynamic noprefixroute</p>::<p>valid_lft 259192sec preferred_lft 172792sec</p>:<p>inet6 fe80::42f1:6019:a80e:4c31/64 scope link noprefixroute</p>::<p>valid_lft forever preferred_lft forever</p>|}</li>
<li><p>Use the '''ping''' command to test the connectivity of the wifi network. The '''ping''' command can be interrupted by pressing the '''Ctrl+C''' shortcut key.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''ping www.orangepi.org -I wlan0'''</p>
<p>PING www.orangepi.org (182.92.236.130) from 192.168.1.49 wlan0: 56(84) bytes of data.</p>
<p>--- www.orangepi.org ping statistics ---</p>
<p>5 packets transmitted, 5 received, 0% packet loss, time 4006ms</p>
<p>rtt min/avg/max/mdev = 41.321/44.864/48.834/2.484 ms</p>|}</li></ol>
<span id="server-version-image-connects-to-wifi-graphically"></span>
 
==== Server version image connects to WIFI graphically ====
<ol style="list-style-type: decimal;">
<li><p>First log in to the Linux system, there are three ways:</p>
<p>a. If the development board is connected to a network cable, you can remotely log in to '''[[\lOrange Pi Zero 2W#SSH remote login development board|the Linux system through ssh]].'''</p>
<p>b. If the development board is connected to the debugging serial port, you can use the serial port terminal to log in to the Linux system (please use MobaXterm for the serial port software, the graphical interface cannot be displayed using minicom)</p>
<p>c. If the development board is connected to an HDMI display, you can log in to the Linux system through the HDMI display terminal.</p></li>
<li><p>Then enter the nmtui command in the command line to open the wifi connection interface</p>
{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo nmtui'''</p>|}</li>
<li><p>Enter the nmtui command to open the interface as shown below</p>
<p>[[File:zero2w-img109.png]]</p></li>
</div></li>
<li><p>You can check the IP address of the wifi through the '''ip a s wlan0''' command</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''ip a s wlan0'''</p>
<p>11: wlan0: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc pfifo_fast state UP group default qlen 1000</p>
:<p>link/ether 24:8c:d3:aa:76:bb brd ff:ff:ff:ff:ff:ff</p>:<p>inet '''<span style="color:#FF0000">192.168.1.11</span>'''/24 brd 192.168.1.255 scope global dynamic noprefixroute wlan0</p>::<p>valid_lft 259069sec preferred_lft 259069sec</p>:<p>inet6 240e:3b7:3240:c4a0:c401:a445:5002:ccdd/64 scope global dynamic noprefixroute</p>::<p>valid_lft 259071sec preferred_lft 172671sec</p>:<p>inet6 fe80::42f1:6019:a80e:4c31/64 scope link noprefixroute</p>::<p>valid_lft forever preferred_lft forever</p>|}</li>
<li><p>Use the '''ping''' command to test the connectivity of the wifi network. The '''ping''' command can be interrupted by pressing the '''Ctrl+C''' shortcut key.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''ping www.orangepi.org -I wlan0'''</p>
<p>PING www.orangepi.org (182.92.236.130) from 192.168.1.49 wlan0: 56(84) bytes of data.</p>
<p>--- www.orangepi.org ping statistics ---</p>
<p>5 packets transmitted, 5 received, 0% packet loss, time 4006ms</p>
<p>rtt min/avg/max/mdev = 41.321/44.864/48.834/2.484 ms</p>|}</li></ol>
<span id="test-method-for-desktop-image"></span>
 
==== Test method for desktop image ====
<span id="method-to-create-wifi-hotspot-through-create_ap"></span>
 
=== 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: '''
'''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] &lt;wifi-interface&gt; [&lt;interface-with-internet&gt;] [&lt;access-point-name&gt; [&lt;passphrase&gt;]]'''
 
'''* 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&lt;UP,BROADCAST,RUNNING,MULTICAST&gt; 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&lt;link&gt;</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&lt;UP,BROADCAST,RUNNING,MULTICAST&gt; 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&lt;link&gt;</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 '''&lt;OK&gt;''' 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: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; 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 &gt; names are not necessarily the same)</p></li>
<li><p>'''Wired connection 1''' is the name of the Ethernet interface</p>
<p>{| class="wikitable" style="width:800px;"|-|orangepi@orangepi:~$ '''nmcli con show'''</pbr><pspan style="margin-right: 180px;">NAME </span><span style="margin-right: 260px;">UUID </span><span style="margin-right: 45px;">TYPE </span><span style="margin-right: 50px;">DEVICE</pspan><br><pspan style="margin-right: 125px;">'''orangepi''' </span><span style="margin-right: 70px;">cfc4f922-ae48-46f1-84e1-2f19e9ec5e2a </span><span style="margin-right: 50px;">wifi </span><span style="margin-right: 50px;">wlan0</pspan><br><pspan style="margin-right: 50px;">'''Wired connection 1''' </span><span style="margin-right: 50px;">9db058b7-7701-37b8-9411-efc2ae8bfa30 </span><span style="margin-right: 30px;">ethernet </span><span style="margin-right: 50px;">eth0</pspan><br>|}</li></ol>
</li>
<li><p>中Then enter the following command, where</p>
<ol style="list-style-type: lower-alpha;">
<li><p>'''&quot;Wired connection 1&quot;''' means setting the static IP address &gt; of the Ethernet port. If you need to set the static IP address &gt; of WIFI, please change it to the name corresponding to the &gt; WIFI network interface (can be obtained through the '''nmcli &gt; con show''' command)</p></li><li><p>'''ipv4.addresses''' is followed by the static IP address to be &gt; 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 &quot;Wired connection 1&quot; \<br />
ipv4.addresses &quot;192.168.1.110&quot; \'''</p>
<p>'''ipv4.gateway &quot;192.168.1.1&quot; \'''</p>
<p>'''ipv4.dns &quot;8.8.8.8&quot; \'''</p>
<p>'''ipv4.method &quot;manual&quot;'''</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: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; 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.'''
'''Why do you need 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. The Linux system machine can mount it normally and then modify the configuration file in it.''' '''If you want to modify it in a Windows system, 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.''' '''In addition, if you have any problems when trying to use Paragon ExtFS for Windows, please solve it yourself. We will not answer questions.'''</big>|}
<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 &quot;media&quot;'''</p>
<p>/dev/sdd1 &nbsp;&nbsp; 1.4G &nbsp;&nbsp; 1.2G &nbsp;&nbsp; 167M &nbsp;&nbsp; 88% '''<span style="color:#FF0000">/media/test/opi_root</span>'''</p>
<p>test@test:~$ '''ls /media/test/opi_root'''</p>
<p>bin &nbsp;&nbsp; boot &nbsp;&nbsp; dev &nbsp;&nbsp; etc &nbsp;&nbsp; home &nbsp;&nbsp; lib &nbsp;&nbsp; lost+found &nbsp;&nbsp; media &nbsp;&nbsp; mnt &nbsp;&nbsp; opt &nbsp;&nbsp; proc &nbsp;&nbsp; root &nbsp;&nbsp; run <br> sbin &nbsp;&nbsp; selinux &nbsp;&nbsp; srv &nbsp;&nbsp; sys &nbsp;&nbsp; tmp &nbsp;&nbsp; usr &nbsp;&nbsp; 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 &gt; used to set whether to delete the orangepi_first_run.txt file &gt; after the first startup. The default is 1, which means &gt; deletion. If set to 0, orangepi_first_run.txt will be renamed &gt; after the first startup.orangepi_first_run.txt.old, Generally, &gt; just keep the default value</p></li><li><p>'''FR_net_change_defaults''' The variable is used to set whether &gt; to change the default network settings. This must be set to 1, &gt; otherwise all network settings will not take effect.</p></li><li><p>'''FR_net_ethernet_enabled''' The variable is used to control &gt; whether to enable the configuration of the Ethernet port. If &gt; you need to set the static IP address of the Ethernet port, &gt; please set it to 1</p></li><li><p>'''FR_net_wifi_enabled''' The variable is used to control whether &gt; to enable WIFI configuration. If you need to set the &gt; development board to automatically connect to WIFI hotspots, &gt; you must set it to 1. Also please note that if this variable &gt; is set to 1, the Ethernet port settings will be invalid. That &gt; is to say, the WIFI and Ethernet ports cannot be set at the &gt; 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 &gt; WIFI hotspot you want to connect to</p></li><li><p>'''FR_net_wifi_key''' Variable is used to set the password of the &gt; WIFI hotspot you want to connect to</p></li><li><p>'''FR_net_use_static''' Variables are used to set whether the &gt; static IP address of the WIFI or Ethernet port needs to be &gt; set.</p></li><li><p>'''FR_net_static_ip''' The variable is used to set the static IP &gt; address. Please set it according to your actual situation.</p></li><li><p>'''FR_net_static_gateway''' Variables are used to set the gateway. &gt; 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 &gt; board to automatically connect to the WIFI hotspot after it is &gt; 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 &gt; want to connect to</p></li><li><p>d) Set '''FR_net_wifi_key''' to the password of the WIFI hotspot &gt; you want to connect to</p></li></ol>
</li>
<li><p>For example, you want the Linux system of the development board &gt; to automatically connect to the WIFI hotspot after the first &gt; startup, and set the WIFI IP address to a specific static IP &gt; address (so that when the Linux system starts, you can &gt; directly use the set static IP address to ssh remotely Log in &gt; to the development board, there is no need to check the IP &gt; address of the development board through the router &gt; 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 &gt; want to connect to</p></li><li><p>d) Set '''FR_net_wifi_key''' to the password of the WIFI hotspot &gt; 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 &gt; address</p></li></ol>
</li>
<li><p>For example, if you want the development board's Linux system &gt; to automatically set the IP address of the Ethernet port to &gt; the desired static IP address after it is started for the &gt; 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 &gt; 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;" |-| </li></olbig> '''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''' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Need to be replaced with the IP address of the development board)
orangepi@192.168.1.xx's password: (iEnter &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (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.'''
'''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 &gt; host'''</p></li><li><p>Then enter the username '''root''' or '''orangepi''' of the linux &gt; 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>
'''When you want to connect the HDMI of the development board to the HDMI interface of your laptop, please first confirm that your laptop supports the HDMI in function'''
 
'''When HDMI does not display, please first check whether the HDMI cable is plugged in tightly. After confirming that the wiring is OK, you can try a different screen to see if there is any display.'''
 
<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> &gt; /sys/class/graphics/fbcon/cursor_blink #Cursor flashes'''</p><p>root@orangepi:~# '''echo <span style="color:#FF0000">0 </span> &gt; /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 &amp;&amp; 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 &gt; '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li><li><p>Then select '''System'''</p>
<p>[[File:zero2w-img80.png]]</p></li>
<li><p>Then select '''Hardware'''</p>
<p>[[File:zero2w-img81.png]]</p></li>
<li><p>Then use the keyboard's arrow keys to locate the location shown in &gt; the picture below, and then use the space to select '''usb0-host'''</p>
<p>[[File:zero2w-img161.png]]</p></li>
<li><p>Then select '''&lt;Save&gt;'''to save</p>
<li><p>Then select '''&lt;Back&gt;'''</p>
<p>[[File:zero2w-img84.png]]</p></li>
<li><p>Then select '''&lt;Reboot&gt;'''to restart the system to make the &gt; configuration take effect.</p>
<p>[[File:zero2w-img85.png]]</p></li>
<li><p>After restarting, USB0 can use USB devices such as mouse and &gt; 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 &quot;sd*&quot;'''<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 &quot;sd&quot;'''
/dev/sda1 &nbsp;&nbsp;&nbsp; 29G &nbsp;&nbsp; 208K &nbsp;&nbsp; 29G &nbsp;&nbsp; 1% /mnt|}</ol><span id="usb-ethernet-card-test"></span>
<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&lt;UP,BROADCAST,RUNNING,MULTICAST&gt; 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&lt;link&gt;</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 &gt; take pictures</p><ol style="list-style-type: lower-alphanone;"><li><p>a) -d Option to specify the device node of the USB camera</p></li><li><p>b) --no-banner Used to remove watermarks from photos</p></li><li><p>c) -r option is used to specify the resolution of the photo</p></li><li><p>d) -S Option to skip previous frames</p></li><li><p>e) ./image.jpg Used to set the name and path of the generated &gt; photo</p>{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepi:~$ '''sudo''' '''fswebcam -d /dev/video0 \'''</p>
<p>'''--no-banner -r 1280x720 -S 5 ./image.jpg'''</p>|}</li></ol></li><li><p>In the server version of Linux system, after taking the picture, you can use the scp command to transfer the taken picture to the Ubuntu PC for mirror viewing.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''scp image.jpg [mailto:test@192.168.1.55:/home/test test@192.168.1.55:/home/test] (Modify the IP address and path according to the actual situation)'''</p>|}
</li>
<li><p>In the server version of Linux system, after taking the picture, &gt; you can use the scp command to transfer the taken picture to &gt; the Ubuntu PC for mirror viewing.</p><p>orangepi@orangepi:~$ '''scp image.jpg [mailto:test@192.168.1.55:/home/test test@192.168.1.55:/home/test] (Modify the IP address and path according to the actual situation)'''</p></li><li><p>In the desktop version of Linux system, you can directly view &gt; the captured pictures through the HDMI display</p></li></ol>
</li>
<li><p>Use mjpg-streamer to test the USB camera</p>
<ol style="list-style-type: lower-alpha;">
<li><p>Download mjpg-streamer</p>
<ol style="list-style-type: lower-alphanone;"><li><p>a) Github download address:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''git clone https://github.com/jacksonliam/mjpg-streamer'''</p>|}</li><li><p>b) The image download address of Gitee is:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''git clone https://gitee.com/leeboby/mjpg-streamer'''</p>|}</li></ol>
</li>
<li><p>Install dependent software packages</p>
<ol style="list-style-type: lower-alphanone;"><li><p>a) Ubuntu system</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt-get install -y cmake libjpeg8-dev'''</p>|}</li><li><p>b) Debian system</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt-get install -y cmake libjpeg62-turbo-dev'''</p>|}</li></ol>
</li>
<li><p>Compile and install mjpg-streamer</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''cd mjpg-streamer/mjpg-streamer-experimental'''</p>
<p>orangepi@orangepi:~/mjpg-streamer/mjpg-streamer-experimental$ '''make -j4'''</p>
<p>orangepi@orangepi:~/mjpg-streamer/mjpg-streamer-experimental$ '''sudo make install'''</p>|}</li>
<li><p>Then enter the following command to start mjpg_streamer</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that the serial number of the video is not always video0, please refer to what you actually see.'''</p></big>|}{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepi:~/mjpg-streamer/mjpg-streamer-experimental$ '''export LD_LIBRARY_PATH=.'''</p>
<p>orangepi@orangepi:~/mjpg-streamer/mjpg-streamer-experimental$ '''sudo ./mjpg_streamer -i &quot;./input_uvc.so -d \'''</p>
<p>'''/dev/video0 -u -f 30&quot; -o &quot;./output_http.so -w ./www&quot;'''</p>|}</li><li><p>Then enter ['''the IP address of the development board: 8080'''] &gt; in the Ubuntu PC or Windows PC or mobile phone browser on the &gt; same LAN as the development board to see the video output by &gt; the camera.</p>
<div class="figure">
<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: &gt; audiocodec''' is the sound card device required for headphone &gt; playback</p>{| class="wikitable" style="width:800px;" |-|
<p>root@orangepi:~# '''aplay -l'''</p>
<p>**** List of PLAYBACK Hardware Devices ****</p>
<p>'''card 0: audiocodec [audiocodec], device 0: soc@3000000:codec_plat-5096000.codec 5096000.codec-0 []'''</p>
:<p>'''Subdevices: 1/1'''</p>:<p>'''Subdevice #0: subdevice #0'''</p>|}</li><li><p>The output of the b.linux6.1 system is as follows, where &gt; '''audiocodec''' is the sound card device required for headphone &gt; playback.</p>{| class="wikitable" style="width:800px;" |-|
<p>root@orangepi:~# '''aplay -l'''</p>
<p>**** List of PLAYBACK Hardware Devices ****</p>
<p>'''card 0: audiocodec [audiocodec], device 0: CDC PCM Codec-0 [CDC PCM Codec-0]'''</p>
:<p>'''Subdevices: 1/1'''</p>:<p>'''Subdevice #0: subdevice #0'''</p>|}</li></ol>
</li>
<li><p>Then use the '''aplay''' command to play the audio, and the sound can be heard through the headphones</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>root@orangepi:~# '''aplay -D hw:0,0 /usr/share/sounds/alsa/audio.wav'''</p>
<p>Playing WAVE 'audio.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo</p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| </libig></ol> '''If there is noise during the headphone test, please pull out some of the headphones and do not plug them all the way in.'''</big>|}</li></ol><span id="hdmi-audio-playback-test"></span>
<span id="hdmi-audio-playback-test"></span>
==== HDMI audio playback test ====
<li><p>First use the Mini HDMI to HDMI cable to connect the Orange Pi development board to the TV (other HDMI displays need to ensure that they can play audio)</p></li>
<li><p>HDMI audio playback does not require other settings, just use the '''aplay''' command to play directly</p>
{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~# '''aplay -D hw:2,0 /usr/share/sounds/alsa/audio.wav'''</p>|}</li></ol>
<span id="test-audio-methods-on-desktop-systems"></span>
 
=== Test audio methods on desktop systems ===
<li><p>First open the volume control interface</p>
<p>[[File:zero2w-img166.png]]</p></li>
<li><p>When playing audio, the audio device options that can be used by &gt; the '''Playback''' software will be displayed in '''Playback''', &gt; as shown in the figure below. Here you can set which audio &gt; device needs to be played.</p>
<div class="figure">
<span id="infrared-reception-test"></span>
 
== Infrared reception test ==
<li><p>There is no infrared receiver on the main board of the development board. We can expand it through a 24pin expansion board.</p>
<p>[[File:zero2w-img107.png]]</p></li>
<li><p>Install ir-keytable infrared test software</p></li></ol>{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''sudo''' '''apt update'''
orangepi@orangepi:~$ '''sudo''' '''apt-get install -y ir-keytable'''
|}</ol>
<ol start="3" style="list-style-type: decimal;">
<li><p>Then execute ir-keytable to view the information of the infrared device</p>
<ol style="list-style-type: lower-alpha;">
<li>linux5.4 system output is as follows</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''ir-keytable'''
Found /sys/class/rc/rc0/ with:
::Name: sunxi-ir
::Driver: sunxi-rc-recv
::Default keymap: rc_map_sunxi
::Input device: /dev/input/event1
::LIRC device: /dev/lirc0
::Attached BPF protocols: Operation not permitted
::Supported kernel protocols: lirc nec
::Enabled kernel protocols: lirc nec
::bus: 25, vendor/product: 0001:0001, version: 0x0100 Repeat delay = 500 ms, repeat period = 125 ms
::Repeat delay = 500 ms, repeat period = 125 ms
|}
</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li><p>The output of the linux6.1 system is as follows</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''ir-keytable'''</p>
<p>Found /sys/class/rc/rc0/ with:</p>
::<p>Name: sunxi-ir</p>::<p>Driver: sunxi-ir</p>::<p>Default keymap: rc-empty</p>::<p>Input device: /dev/input/event5</p>::<p>LIRC device: /dev/lirc0</p>::<p>Attached BPF protocols: Operation not permitted</p>::<p>Supported kernel protocols: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp imon rc-mm</p>::<p>Enabled kernel protocols: lirc</p>::<p>bus: 25, vendor/product: 0001:0001, version: 0x0100</p>::<p>Repeat delay = 500 ms, repeat period = 125 ms</p>|}</li></ol> <!-- --/li></ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>Before testing the infrared reception function, you need to prepare an Orange Pi-specific infrared remote control. '''<span classstyle="markcolor:#FF0000">Other remote controls do not support it</span>'''.</p>
<div class="figure">
<li><p>Then enter the '''ir-keytable -t''' command in the terminal, and then use the infrared remote control to press the button against the infrared receiver of the Orange Pi development board to see the received key code in the terminal.</p>
<ol style="list-style-type: lower-alpha;">
<li>linux5.4 system output is as follows</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''sudo ir-keytable -t'''
1598339152.914715: event type EV_MSC(0x04): scancode = 0xfb0410
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li><p>linux6.1 system output is as follows</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo ir-keytable -c -p NEC -t'''</p>
<p>Old keytable cleared</p>
<p>202.063219: lirc protocol(nec): scancode = 0x45c</p>
<p>202.063249: event type EV_MSC(0x04): scancode = 0x45c</p>
<p>202.063249: event type EV_SYN(0x00).</p>|}</li></ol></li></ol><span id="temperature-sensor"></span>
<span id="temperature-sensor"></span>
== Temperature sensor ==
H618 has a total of 4 temperature sensors. The command to view the temperature is as follows:
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''The displayed temperature value needs to be divided by 1000, and the unit is Celsius.'''</big>|} 
<ol style="list-style-type: lower-alpha;">
<li>sensor0: CPU temperature sensor, the first command is used to view &gt; the type of temperature sensor, the second command is used to view &gt; the value of the temperature sensor</li></ol>{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''cat /sys/class/thermal/thermal_zone0/type'''
'''57734'''
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li><p>sensor1: DDR temperature sensor, the first command is used to view &gt; the type of temperature sensor, the second command is used to view &gt; the value of the temperature sensor</p>{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepi:~$ '''cat /sys/class/thermal/thermal_zone1/type'''</p>
<p>'''ddr'''_thermal_zone</p>
<p>orangepi@orangepi:~$ '''cat /sys/class/thermal/thermal_zone1/temp'''</p>
<p>'''57410'''</p>|}</li><li><p>sensor2: GPU temperature sensor, the first command is used to view &gt; the type of temperature sensor, the second command is used to view &gt; the value of the temperature sensor</p>{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepi:~$ '''cat /sys/class/thermal/thermal_zone2/type'''</p>
<p>'''gpu'''_thermal_zone</p>
<p>orangepi@orangepi:~$ '''cat /sys/class/thermal/thermal_zone2/temp'''</p>
<p>'''59273'''</p>|}</li><li><p>sensor3: VE's temperature sensor. The first command is used to view &gt; the type of temperature sensor, and the second command is used to &gt; view the value of the temperature sensor.</p>{| class="wikitable" style="width:800px;" |-|
<p>orangepi@orangepi:~$ '''cat /sys/class/thermal/thermal_zone3/type'''</p>
<p>'''ve'''_thermal_zone</p>
<p>orangepi@orangepi:~$ '''cat /sys/class/thermal/thermal_zone3/temp'''</p>
<p>'''58949'''</p>|}</li></ol>
<span id="how-to-check-the-temperature-in-linux6.1-system"></span>
 
=== How to check the temperature in linux6.1 system ===
{| class="wikitable" style="width:800px;"
|-
|
orangepi@orangepi:~$ '''sensors'''
Adapter: Virtual device
temp1: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +'''<span style="color:#FF0000">47.4°C</span>''' (crit = +110.0°C) 
gpu_thermal-virtual-0
Adapter: Virtual device
temp1: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +'''<span style="color:#FF0000">48.7°C</span>''' (crit = +110.0°C) 
ddr_thermal-virtual-0
Adapter: Virtual device
temp1: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +'''<span style="color:#FF0000">47.8°C</span>''' (crit = +110.0°C) 
ve_thermal-virtual-0
Adapter: Virtual device
temp1: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +'''<span style="color:#FF0000">47.2°C</span>''' (crit = +110.0°C)|}
<span id="pin-interface-pin-description"></span>
 
== 40 Pin Interface pin description ==
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note: The pin header on the 40pin interface is not soldered by default, and you need to solder it yourself before it can be used.'''</big>|}
<ol style="list-style-type: decimal;">
</div></li>
<li><p>The functions of the 40 Pin interface pins on the development board are as shown in the table below</p></li></ol>
<div style="display: flex;">{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO序号GPIO NO.'''
| '''GPIO'''
| '''Function'''
| '''pin'''
|
| '''pin'''
| '''Function'''
| '''GPIO'''
| '''GPIO NO'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|
| '''2'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''264'''
| '''TWI1-SDA'''
| '''3'''
|
| '''4'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''263'''
| '''TWI1-SCL'''
| '''5'''
|
| '''6'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''269'''
| '''PWM3/UART4_TX'''
| '''7'''
|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224'''|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''9'''
|
| '''10'''
| '''UART0_RX'''
| '''PH1'''
| '''225'''
|-
| '''226'''
| '''UART5_TX'''
| '''11'''
|
| '''12'''
| style="text-align: left;"|
| '''PI1'''
| '''257'''
|-
| '''227'''
| '''UART5_RX'''
| '''13'''
|
| '''14'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''261'''
| '''TWI0_SCL/UART2_TX'''
| '''15'''
|
| '''16'''
| '''PWM4/UART4_RX'''
| '''PI14'''
| '''270'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|
| '''18'''
| style="text-align: left;"|
| '''PH4'''
| '''228'''
|-
| '''231'''
| '''SPI1_MOSI'''
| '''19'''
|
| '''20'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''232'''
| '''SPI1_MISO'''
| '''21'''
|
| '''22'''
| '''TWI0_SDA/UART2_RX'''
| '''PI6'''
| '''262'''
|-
| '''230'''
| '''SPI1_CLK'''
| '''23'''
|
| '''24'''
| '''SPI1_CS0'''
| '''PH5'''
| '''229'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|
| '''26'''
| '''SPI1_CS1'''
| '''PH9'''
| '''233'''
|-
| '''266'''
| '''TWI2-SDA/UART3_RX'''
| '''27'''
|
| '''28'''
| '''TWI2-SCL/UART3_TX'''
| '''PI9'''
| '''265'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|
| '''30'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|
| '''32'''
| '''PWM1'''
| '''PI11'''
| '''267'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''PC12'''
| '''76'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|-| style="text-align: left;"|| style="text-align: left;"|| '''38GND'''| '''39'''|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| '''4'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''6'''
| '''GND'''
| '''39'''
|
| '''40'''
| style="text-align: left;"|
| '''PI3'''| '''259'''|} <ol start="3" style="list-styletext-typealign: decimalleft;">|<li>There are a total of 28 GPIO ports in the 40pin interface. The high|-level voltage of all GPIO ports is '''3.3v'''</li></ol> <span id="how-to-install-wiringop"></span>== How to install wiringOP == | '''Note that wiringOP is already pre-installed in the linux image released by Orange Pi. Unless the wiringOP code is updated, there is no need to re-download, compile and install, you can just use it directly.8''' | '''The storage path of the compiled wiringOP deb package in orangepi-build is: UART0_TX''' | '''orangepi-build/external/cache/debs/arm64/wiringpi_x.xx.debPH0''' '''After entering the system, you can run the gpio readall command. If you can see the following output, it means that wiringOP has been pre-installed and can be used normally.''' [[File:zero2w-img170.png]] '''WiringOP currently mainly adapts to the functions of setting GPIO port input and output, setting GPIO port output high and low levels, and setting pull-up and pull-down resistors. Functions such as hardware PWM cannot be used.''' <ol style="list-style-type: decimal;"><li><p>Download the code of wiringOP</p><p>orangepi@orangepi:~$ '''sudo apt update'''</p><p>orangepi@orangepi:~$ '''sudo apt install -y git'''</p><p>orangepi@orangepi:~$ '''git clone https://github.com/orangepi-xunlong/wiringOP.git -b next'''</p><p>'''Note that the source code needs to download the code of wiringOP next branch. Please don't miss the -b next parameter.'''</p><p>'''If there is a problem downloading the code from GitHub, you can directly use the wiringOP source code that comes with the Linux image. The storage location is: /usr/src/wiringOP.'''</p></li><li><p>Compile and install wiringOP</p><p>orangepi@orangepi:~$ '''cd wiringOP'''</p><p>orangepi@orangepi:~/wiringOP$ '''sudo ./build clean'''</p><p>orangepi@orangepi:~/wiringOP$ '''sudo ./build'''</p></li><li><p>The output of the test gpio readall command is as follows</p><p>[[File:zero2w-img170.png]]</p></li></ol> <span id="pin-interface-gpio-i2c-uart-spi-and-pwm-testing"></span>== 40pin interface GPIO, I2C, UART, SPI and PWM testing == '''Note: The pin header on the 40pin interface is not soldered by default, and you need to solder it yourself before it can be used.''' <span id="pin-gpio-port-test"></span>=== 40pin GPIO port test === <ol style="list-style-type: decimal;"><li><p>The following uses pin No. 7 - corresponding to GPIO PI13 - corresponding to wPi serial number 2 - as an example to demonstrate how to set the high and low levels of the GPIO port.</p><p>[[File:zero2w-img171.png]]</p></li><li><p>First set the GPIO port to output mode, and the third parameter needs to be the serial number of the wPi corresponding to the input pin.</p><p>root@orangepi:~/wiringOP# '''gpio mode 2 out'''</p></li><li><p>Then set the GPIO port to output a low level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 0v, it means the low level is set successfully.</p><p>root@orangepi:~/wiringOP# '''gpio write 2 0'''</p></li><li><p>Then set the GPIO port to output a high level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 3.3v, it means the setting of the high level is successful.</p><p>root@orangepi:~/wiringOP# '''gpio write 2 1'''</p></li><li><p>The setting method for other pins is similar. You only need to modify the serial number of wPi to the serial number corresponding to the pin.</p></li></ol> <span id="how-to-set-the-pull-down-resistor-of-40-pin-gpio-port"></span>=== How to set the pull-down resistor of 40 Pin GPIO port === <ol style="list-style-type: decimal;"><li><p>The following uses pin No. 7—corresponding to GPIO PI13—corresponding to wPi serial number 2—as an example to demonstrate how to set the pull-up and pull-down resistors of the GPIO port.</p><p>[[File:zero2w-img171.png]]</p></li><li><p>First, you need to set the GPIO port to input mode, and the third parameter needs to be the serial number of the wPi corresponding to the input pin.</p><p>root@orangepi:~/wiringOP# ''| 'gpio mode 2 in'''</p></li><li><p>After setting to input mode, execute the following command to set the GPIO port to pull-up mode.</p><p>root@orangepi:~/wiringOP# 224'''gpio mode 2 up'''</p></li><li><p>Then enter the following command to read the level of the GPIO port. If the level is 1, it means that the pull-up mode is set successfully.</p><p>root@orangepi:~/wiringOP# '''gpio read 2'''</p><p>'''1'''</p></li><li><p>Then execute the following command to set the GPIO port to pull-down mode</p><p>root@orangepi:~/wiringOP# '''gpio mode 2 down'''</p></li><li><p>Then enter the following command to read the level of the GPIO port. If the level is 0, it means that the pull-down mode is set successfully.</p><p>root@orangepi:~/wiringOP# '''gpio read 2'''</p><p>'''0'''</p></li></ol> <span id="pin-spi-test"></span>=== 40pin SPI test === # As can be seen from the table below, the spi available for the 40pin interface is spi1, and there are two chip select pins cs0 and cs1 {| class="wikitable"
|-
| '''GPIO序号10'''| '''GPIOUART0_RX'''| '''FunctionPH1'''| '''pin'''|| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO序号225'''
|-
| '''12'''
| style="text-align: left;"|
| style="text-align: left;"|| '''3.3VPI1'''| '''1257'''|-| '''214'''| '''5VGND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26416'''| '''PI8PWM4/UART4_RX'''| '''TWI1-SDAPI14'''| '''3270'''|-| '''4'''| '''5V18'''| style="text-align: left;"|
| style="text-align: left;"|
| '''PH4'''
| '''228'''
|-
| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|| '''620'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26922'''| '''PI13TWI0_SDA/UART2_RX'''| '''PI6'''| '''262'''|-| '''24'''| '''PWM3/UART4_TXSPI1_CS0'''| '''PH5'''| '''229'''|-| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''7233'''|-| '''828'''| '''UART0_TXTWI2-SCL/UART3_TX'''| '''PH0PI9'''| '''224265'''
|-
| '''30'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''9'''
|
| '''10'''
| '''UART0_RX'''
| '''PH1'''
| '''225'''
|-
| '''22632'''| '''PH2PWM1'''| '''UART5_TXPI11'''| '''11'''|| '''12'''| style="text-align: left;"|| '''PI1'''| '''257267'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|| '''1434'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26136'''| '''PI5'''| '''TWI0_SCL/UART2_TX'''style="text-align: left;"| '''15'''|| '''16'''| '''PWM4/UART4_RX'''| '''PI14PC12'''| '''27076'''
|-
| '''38'''
| style="text-align: left;"|
| style="text-align: left;"|| '''3.3V'''| '''17'''|| '''18'''| style="text-align: left;"|| '''PH4PI4'''| '''228260'''
|-
| '''23140'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|| '''20'''| '''GND'''| style="text-align: left;"|
| style="text-align: left;"|
| '''PI3'''
| '''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>
 
<span id="how-to-install-wiringop"></span>
 
== How to install wiringOP ==
 
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big>'''232Note that wiringOP is already pre-installed in the linux image released by Orange Pi. Unless the wiringOP code is updated, there is no need to re-download, compile and install, you can just use it directly.'''|  '''PH8The storage path of the compiled wiringOP deb package in orangepi-build is: '''| '''SPI1_MISO<span style="color:blue">orangepi-build/external/cache/debs/arm64/wiringpi_x.xx.deb</span>'''|  '''21After entering the system, you can run the gpio readall command. If you can see the following output, it means that wiringOP has been pre-installed and can be used normally.'''</big> [[File:zero2w-img170.png|center]]| <big>'''22WiringOP currently mainly adapts to the functions of setting GPIO port input and output, setting GPIO port output high and low levels, and setting pull-up and pull-down resistors. Functions such as hardware PWM cannot be used.'''</big>| } <ol style="list-style-type: decimal;"><li><p>Download the code of wiringOP</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''TWI0_SDA/UART2_RXsudo apt update'''</p>| <p>orangepi@orangepi:~$ '''PI6sudo apt install -y git'''</p>| <p>orangepi@orangepi:~$ '''262git clone https://github.com/orangepi-xunlong/wiringOP.git -b next'''</p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| '''230'''| '''PH6''<big><p>'| ''Note that the source code needs to download the code of wiringOP next branch. Please don'SPI1_CLKt miss the -b next parameter.'''</p>| <p>'''23If there is a problem downloading the code from GitHub, you can directly use the wiringOP source code that comes with the Linux image. The storage location is: /usr/src/wiringOP.'''</p></big>|}| '''24'''</li>| '''SPI1_CS0'''<li><p>Compile and install wiringOP</p>{| '''PH5'''| '''229'''class="wikitable" style="width:800px;"
|-
| style="text-align: left;"|| style="text-align<p>orangepi@orangepi: left;"|| ~$ '''GNDcd wiringOP'''</p>| <p>orangepi@orangepi:~/wiringOP$ '''25sudo ./build clean'''</p>|| <p>orangepi@orangepi:~/wiringOP$ '''26sudo ./build'''</p>| '''SPI1_CS1'''}</li><li><p>The output of the test gpio readall command is as follows</p><p>[[File:zero2w-img170.png]]</p></li></ol> <span id="pin-interface-gpio-i2c-uart-spi-and-pwm-testing"></span> == 40pin interface GPIO, I2C, UART, SPI and PWM testing ==| '''PH9'''{| '''233'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big>'''266Note: 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>| '''PI10'''} | '''TWI2<span id="pin-gpio-port-SDAtest"></UART3_RX'''span>=== 40pin GPIO port test ===| '''27'''|<ol style="list-style-type: decimal;">| '''28'''<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>| '''TWI2<p>[[File:zero2w-SCLimg171.png]]</p></UART3_TX'''li>| '''PI9'''<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>{| '''265'''class="wikitable" style="width:800px;"
|-
| '''256'''| <p>root@orangepi:~/wiringOP# '''PI0'''| gpio mode <span style="text-aligncolor: left;#FF0000"|| '''29>2</span> out'''</p>|}| '''30'''</li>| '''GND'''<li><p>Then set the GPIO port to output a low level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 0v, it means the low level is set successfully.</p>{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| '''271'''| <p>root@orangepi:~/wiringOP# '''PI15'''| gpio write 2 <span style="text-aligncolor: left;#FF0000"|| '''31>0</span>'''</p>|}| '''32'''</li>| '''PWM1'''<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>{| '''PI11'''| '''267'''class="wikitable" style="width:800px;"
|-
| '''268'''| '''PI12'''| '''PWM2'''| '''33'''|| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''258'''| '''PI2'''| style="text-align: left;"|| '''35'''|| '''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<p>root@orangepi: left;"|| '''GND'''| '''39'''|| '''40~/wiringOP# '''| gpio write 2 <span style="text-aligncolor: left;#FF0000"|| '''PI3'''| '''259>1</span>'''</p>
|}
</li>
<li><p>The setting method for other pins is similar. You only need to modify the serial number of wPi to the serial number corresponding to the pin.</p></li></ol>
 
<span id="how-to-set-the-pull-down-resistor-of-40-pin-gpio-port"></span>
 
=== How to set the pull-down resistor of 40 Pin GPIO port ===
<ol style="list-style-type: decimal;">
<li><p>In Linux systems, spi1 is turned off by default and needs The following uses pin No. 7—corresponding to GPIO PI13—corresponding to wPi serial number 2—as an example to demonstrate how to be turned on manually before it can be used. The opening steps are as follows:</p><ol style="listset the pull-styleup and pull-type: lower-alpha;"><li><p>First run '''orangepi-config'''. Ordinary users remember to add &gt; '''sudo''' permissionsdown resistors of the GPIO port.</p><p>orangepi@orangepi[[File:~$ '''sudo orangepizero2w-config'''img171.png]]</p></li><li><p>Then select '''System'''First, you need to set the GPIO port to input mode, and the third parameter needs to be the serial number of the wPi corresponding to the input pin.</p><p>[[File{| class="wikitable" style="width:zero2w800px;" |-img80.png]]| </p><root@orangepi:~/li>wiringOP# '''gpio mode <lispan style="color:#FF0000">2<p/span>Then select '''Hardwarein'''</p><p>[[File:zero2w-img81.png]]</p>|}</li><li><p>Then use the keyboard's arrow keys After setting to locate the position shown &gt; in the figure belowinput mode, and then use execute the '''space''' following command to select the &gt; dtbo configuration of set the SPI you want GPIO port to openpull-up mode.</p></li></ol></li></ol> {| class="wikitable" style="width:800px;"
|-
| <p>root@orangepi:~/wiringOP# '''dtbo configurationgpio 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>{| '''illustrate'''class="wikitable" style="width:800px;"
|-
| <p>root@orangepi:~/wiringOP# '''spi1-cs0-cs1-spidevgpio read <span style="color:#FF0000">2</span>'''</p>| <p>'''Open cs0 and cs1 of spi1 at the same time<span style="color:#FF0000">1</span>'''</p>|}</li><li><p>Then execute the following command to set the GPIO port to pull-down mode</p>{| class="wikitable" style="width:800px;"
|-
| <p>root@orangepi:~/wiringOP# '''spi1-cs0-spidevgpio mode <span style="color:#FF0000">2</span> down'''</p>| '''Only open cs0 }</li><li><p>Then enter the following command to read the level of spi1'''the GPIO port. If the level is 0, it means that the pull-down mode is set successfully.</p>{| class="wikitable" style="width:800px;"
|-
| <p>root@orangepi:~/wiringOP# '''spi1-cs1-spidevgpio read <span style="color:#FF0000">2</span>'''</p>| <p>'''Only open cs1 of spi1<span style="color:#FF0000">0</span>'''</p>
|}
</li></ol>
[[File:zero2w<span id="pin-img172.png]]spi-test"></span>
<ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select '''&lt;Save&gt;''' to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''&lt;Back&gt;'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''&lt;Reboot&gt;'''to restart the system to make the &gt; configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol>= 40pin SPI test ===
<!-- --><ol start="2" style="list-style-type: decimal;"><li><p>Then check whether there is a '''spidev1.x''' device node in # As can be seen from the Linux system. If it existstable below, it means that the SPI1 configuration has taken effect.</p><p>orangepi@orangepi:~$ '''ls /dev/spidev1*'''</p><p>/dev/spidev1.0 /dev/spidev1.1</p><p>'''Note that only when you open spi1-cs0-cs1-spidev, you will see the device nodes of the two spi.'''</p></li><li><p>Next, start available for the spi loopback test. Do not short-circuit the mosi and miso pins of SPI1 first. The output result of running spidev_test 40pin interface is as follows. You can see that the data of TX spi1, and RX there are inconsistent.</p><p>orangepi@orangepi:~$ '''sudo spidev_test -v -D /dev/spidev1.0'''</p><p>spi mode: 0x0</p><p>bits per word: 8</p><p>max speed: 500000 Hz (500 KHz)</p><p>TX | FF FF FF FF FF FF '''40 00 00 00 00 95''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p><p>RX | FF FF FF FF FF FF '''FF FF FF FF FF FF''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF | ............................….</p></li><li><p>Then short-circuit the two chip select pins of SPI1 mosi (pin 19 in the 40pin interface) cs0 and miso (pin 21 in the 40pin interface) and then run spidev_test. The output is as follows. You can see the sending and receiving The data is the same, indicating that the loopback test passed.</p><p>orangepi@orangepi:~$ '''sudo spidev_test -v -D /dev/spidev1.0'''</p><p>spi mode: 0x0</p><p>bits per word: 8</p><p>max speed: 500000 Hz (500 KHz)</p><p>TX | FF FF FF FF FF FF '''40 00 00 00 00 95''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p><p>RX | FF FF FF FF FF FF '''40 00 00 00 00 95''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p></li></ol>cs1
<span iddiv style="pin-i2c-testdisplay: flex;"></span>=== 40pin I2C test === # As can be seen from the table below, the i2c available for the 40pin interface are i2c0, i2c1 and i2c2 ::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''GPIO序号GPIO NO.'''
| '''GPIO'''
| '''Function'''
| '''pin'''
|
| '''pin'''
| '''Function'''
| '''GPIO'''
| '''GPIO NO.'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|
| '''2'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''264'''
| '''TWI1-SDA'''
| '''3'''
|
| '''4'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''263'''
| '''TWI1-SCL'''
| '''5'''
|
| '''6'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''269'''
| '''PWM3/UART4_TX'''
| '''7'''
|
| '''8'''
| '''UART0_TX'''
| '''PH0'''
| '''224'''
|-
| style="text-align: left;"|
| '''GND'''
| '''9'''
|
| '''10'''
| '''UART0_RX'''
| '''PH1'''
| '''225'''
|-
| '''226'''
| '''UART5_TX'''
| '''11'''
|
| '''12'''
| style="text-align: left;"|
| '''PI1'''
| '''257'''
|-
| '''227'''
| '''UART5_RX'''
| '''13'''
|
| '''14'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''261'''
| '''TWI0_SCL/UART2_TX'''
| '''15'''
|
| '''16'''
| '''PWM4/UART4_RX'''
| '''PI14'''
| '''270'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|-| '''18<span style="color:#FF0000">231</span>'''| '''<span style="color:#FF0000">PH7</span>'''| '''<span style="color:#FF0000">SPI1_MOSI</span>'''| '''<span style="color:#FF0000">19</span>'''|-| '''<span style="color:#FF0000">232</span>'''| '''<span style="color:#FF0000">PH8</span>'''| '''<span style="color:#FF0000">SPI1_MISO</span>'''| '''<span style="color:#FF0000">21</span>'''|-| '''<span style="color:#FF0000">230</span>'''| '''<span style="color:#FF0000">PH6</span>'''| '''<span style="color:#FF0000">SPI1_CLK</span>'''| '''<span style="color:#FF0000">23</span>'''|-| style="text-align: left;"|
| style="text-align: left;"|
| '''PH4'''| '''228'''|-| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|| '''20'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''TWI0_SDA/UART2_RX'''| '''PI6'''| '''262'''|-| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''25'''|| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''
|-
| '''266'''
| '''TWI2-SDA/UART3_RX'''
| '''27'''
|
| '''28'''
| '''TWI2-SCL/UART3_TX'''
| '''PI9'''
| '''265'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|
| '''30'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|
| '''32'''
| '''PWM1'''
| '''PI11'''
| '''267'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|| '''36'''| style="text-align: left;"|| '''PC12'''| '''76'''|-
| '''272'''
| '''PI16'''
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|
| '''40'''
| style="text-align: left;"|
| '''PI3'''
| '''259'''
|}
 <ol start{| class="2wikitable" style="list-stylewidth:390px;margin-typeright: decimal20px;"><li><p>i2c is turned off by default in Linux systems and needs to be turned on manually to use it. The opening steps are as follows: </p><ol style="listtext-style-typealign: lower-alphacenter;"><li><p>First run '''orangepi|-config'''. Ordinary users remember to add &gt; | '''sudopin''' permissions.</p><p>orangepi@orangepi:~$ | '''sudo orangepi-configFunction'''</p></li><li><p>Then select | '''SystemGPIO'''</p><p>[[File:zero2w-img80.png]]</p></li><li><p>Then select '''Hardware| '''</p><p>[[File:zero2w-img81GPIO NO.png]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown &gt; in the picture below, and then use the '''space''' to select the &gt; corresponding i2c configuration in the picture below.</p></li></ol></li></ol> {| class="wikitable"
|-
| '''Multiplexing function in 40pin2'''| '''Corresponding dtbo configuration5V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - i2c04'''| '''pi-i2c05V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - i2c16'''| '''pi-i2c1GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - i2c28'''| '''pi-i2c2UART0_TX'''|} [[File:zero2w-img173.png]] <ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select <span class="mark">&lt;Save&gt;</span> to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''&lt;Back&gt;PH0'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''&lt;Reboot&gt;''' to restart the system to make the &gt; configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol> <!-- --><ol start="3" style="list-style-type: decimal;"><li><p>After starting the Linux system, first confirm that there is an open i2c device node under /dev</p><p>orangepi@orangepi:~$ '''ls /dev/i2c-*'''</p><p>'''/dev/i2c-*'''</p><p>'''Sometimes the i2c device node and the i2c bus serial number do not correspond one to one. For example, the i2c device node of the i2c1 bus may be /dev/i2c-3.'''</p><p>'''The method to accurately confirm the device node under /dev corresponding to the i2c bus is: '''</p></li></ol> <!-- --><ol style="list-style-type: lower-alpha;"><li><p>'''First run the following command to check the corresponding relationship of i2c'''</p><p>orangepi@orangepizero2w:~$ '''ls /sys/devices/platform/soc*/*/i2c-* | grep &quot;i2c-[0-9]&quot;'''</p><p>/sys/devices/platform/soc/5002000.i2c/i2c-0:</p><p>/sys/devices/platform/soc/5002400.i2c/i2c-3:</p><p>/sys/devices/platform/soc/5002800.i2c/i2c-4:</p><p>/sys/devices/platform/soc/5002c00.i2c/i2c-5:</p><p>/sys/devices/platform/soc/6000000.hdmi/i2c-2:</p><p>/sys/devices/platform/soc/7081400.i2c/i2c-1:</p></li><li><p>'''In the above output224'''</p></li></ol> <!-- --><ol style="list-style-type: lower-alpha;"><li><p>5002000 is the register base address of the i2c0 bus, and i2c-0 shown behind it is its corresponding i2c device node</p></li><li><p>5002400 is the register base address of the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li><li><p>5002800 is the register base address of the i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p></li></ol> <!-- --><ol start="4" style="list-style-type: decimal;"><li><p>Then start testing i2c, first install i2c-tools</p><p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y i2c-tools'''</p></li><li><p>Then connect an i2c device to the i2c pin of the 40pin connector</p></li><li><p>Then use the '''i2cdetect -y x''' x command. If the address of the connected i2c device can be detected, it means that i2c can be used normally.</p><p>'''Note that x in the i2cdetect -y x command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p><p>'''Different i2c device addresses are different. The 0x50 address in the picture below is just an example. Please refer to what you actually see.'''</p><div class="figure"> [[File:zero2w-img174.png]] </div></li></ol> <span id="pin-uart-test"></span>=== 40pin UART test === # As can be seen from the table below, the available uarts are uart2, uart3, uart4 and uart5. Please note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial port. {| class="wikitable"
|-
| '''GPIO NO.10'''| '''GPIOUART0_RX'''| '''FunctionPH1'''| '''pin'''|| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.225'''
|-
| '''12'''
| style="text-align: left;"|
| '''PI1'''
| '''257'''
|-
| '''14'''
| '''GND'''
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|
| '''2'''
| '''5V'''
| style="text-align: left;"|
|-
| '''16'''
| '''PWM4/UART4_RX'''
| '''PI14'''
| '''270'''
|-
| '''18'''
| style="text-align: left;"|
| '''PH4'''
| '''228'''
|-
| '''26420'''| '''PI8'''| '''TWI1-SDA'''| '''3'''|| '''4'''| '''5VGND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26322'''| '''PI7TWI0_SDA/UART2_RX'''| '''TWI1PI6'''| '''262'''|-| '''<span style="color:#FF0000">24</span>'''| '''<span style="color:#FF0000">SPI1_CS0</span>'''| '''<span style="color:#FF0000">PH5</span>'''| '''<span style="color:#FF0000">229</span>'''|-| '''<span style="color:#FF0000">26</span>'''| '''<span style="color:#FF0000">SPI1_CS1</span>'''| '''<span style="color:#FF0000">PH9</span>'''| '''<span style="color:#FF0000">233</span>'''|-| '''28'''| '''TWI2-SCL/UART3_TX'''| '''5PI9'''|'''265'''|-| '''630'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26932'''| '''PI13PWM1'''| '''PWM3/UART4_TXPI11'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224267'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''| '''9'''|| '''10'''| '''UART0_RX'''| '''PH1'''| '''225'''|-| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''1236'''
| style="text-align: left;"|
| '''PI1PC12'''| '''25776'''
|-
| '''22738'''| '''PH3'''| '''UART5_RX'''| '''13'''|| '''14'''| '''GND'''| style="text-align: left;"|
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| '''26140'''| '''PI5'''| '''TWI0_SCL/UART2_TX'''| '''15'''|| '''16'''| '''PWM4/UART4_RX'''| '''PI14'''| '''270'''|-
| style="text-align: left;"|
| style="text-align: left;"|| '''3.3VPI3'''| '''17259'''|}| '''18'''</div> <ol style="list-style-type: decimal;"><li><p>In Linux systems, spi1 is turned off by default and needs to be turned on manually before it can be used. The opening steps are as follows:</p>| <ol style="textlist-style-aligntype: leftlower-alpha;"|>| <li><p>First run '''PH4orangepi-config'''| . Ordinary users remember to add '''228sudo'''permissions.</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''231sudo orangepi-config'''</p>| }</li><li><p>Then select '''PH7System'''</p>| '''SPI1_MOSI'''<p>[[File:zero2w-img80.png]]</p></li>| <li><p>Then select '''19Hardware'''</p>|<p>[[File:zero2w-img81.png]]</p></li>| <li><p>Then use the keyboard's arrow keys to locate the position shown in the figure below, and then use the '''20space'''to select the dtbo configuration of the SPI you want to open.</p></li>| '''GND'''{| styleclass="text-align: left;wikitable"|| style="width:800px;text-align: leftcenter;"|
|-
| '''232dtbo configuration'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''TWI0_SDA/UART2_RX'''| '''PI6'''| '''262illustrate'''
|-
| '''230spi1-cs0-cs1-spidev'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229Open cs0 and cs1 of spi1 at the same time'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''25'''|| '''26'''| '''SPI1_CS1'''| '''PH9spi1-cs0-spidev'''| '''233Only open cs0 of spi1'''
|-
| '''266spi1-cs1-spidev'''| '''PI10Only open cs1 of spi1'''| '''TWI2} [[File:zero2w-SDAimg172.png]]</UART3_RX'''ol><ol start="5" style="list-style-type: lower-alpha;">| <li><p>Then select '''27&lt;Save&gt;'''to save</p>|<p>[[File:zero2w-img83.png]]</p></li>| <li><p>Then select '''28&lt;Back&gt;'''</p>| '''TWI2<p>[[File:zero2w-SCLimg84.png]]</p></UART3_TX'''li>| <li><p>Then select '''PI9&lt;Reboot&gt;'''to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol></li></ol><ol start="2" style="list-style-type: decimal;">| <li><p>Then check whether there is a '''265spidev1.x'''device node in the Linux system. If it exists, it means that the SPI1 configuration has taken effect.</p>{| class="wikitable" style="width:800px;"
|-
| '''256'''| '''PI0'''| style="text-align<p>orangepi@orangepi: left;"|| ~$ '''29ls /dev/spidev1*'''</p>|<p>/dev/spidev1.0 /dev/spidev1.1</p>| '''30'''| '''GND'''}{| styleclass="text-align: left;wikitable"|| style="textbackground-aligncolor:#ffffdc;width: left800px;"|
|-
| <big><p>'''271Note that only when you open spi1-cs0-cs1-spidev, you will see the device nodes of the two spi.'''</p></big>| '''PI15'''}</li><li><p>Next, start the spi loopback test. Do not short-circuit the mosi and miso pins of SPI1 first. The output result of running spidev_test is as follows. You can see that the data of TX and RX are inconsistent.</p>{| class="wikitable" style="text-alignwidth: left800px;"|| '''31'''|| '''32'''| '''PWM1'''| '''PI11'''| '''267'''
|-
| <p>orangepi@orangepi:~$ '''268sudo spidev_test -v -D /dev/spidev1.0'''</p><p>spi mode: 0x0</p><p>bits per word: 8</p><p>max speed: 500000 Hz (500 KHz)</p><p>TX | FF FF FF FF FF FF '''PI12<span style="color:#FF0000">40 00 00 00 00 95</span>'''FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p><p>RX | FF FF FF FF FF FF '''PWM2<span style="color:#FF0000">FF FF FF FF FF FF</span>'''FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF | ............................….</p>|}</li><li><p>Then short-circuit the two pins of SPI1 mosi (pin 19 in the 40pin interface) and miso (pin 21 in the 40pin interface) and then run spidev_test. The output is as follows. You can see the sending and receiving The data is the same, indicating that the loopback test passed.</p>{| class="wikitable" style="width:800px;" | -| <p>orangepi@orangepi:~$ '''33sudo spidev_test -v -D /dev/spidev1.0'''</p><p>spi mode: 0x0</p><p>bits per word: 8</p>|<p>max speed: 500000 Hz (500 KHz)</p><p>TX | FF FF FF FF FF FF '''34<span style="color:#FF0000">40 00 00 00 00 95</span>'''FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p><p>RX | FF FF FF FF FF FF '''GND<span style="color:#FF0000">40 00 00 00 00 95</span>'''FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | ......@.…▒..................▒.</p>| }</li></ol> <span id="pin-i2c-test"></span> === 40pin I2C test === # As can be seen from the table below, the i2c available for the 40pin interface are i2c0, i2c1 and i2c2 <div style="text-aligndisplay: leftflex;"|>::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: leftcenter;"|-| '''GPIO NO.'''| '''GPIO'''| '''Function'''| '''pin'''
|-
| '''258'''
| '''PI2'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''PC123.3V'''| '''761'''|-| '''<span style="color:#FF0000">264</span>'''| '''<span style="color:#FF0000">PI8</span>'''| '''<span style="color:#FF0000">TWI1-SDA</span>'''| '''<span style="color:#FF0000">3</span>'''|-| '''<span style="color:#FF0000">263</span>'''| '''<span style="color:#FF0000">v</span>'''| '''<span style="color:#FF0000">TWI1-SCL</span>'''| '''<span style="color:#FF0000">5</span>'''|-| '''269'''| '''PI13'''| '''PWM3/UART4_TX'''| '''7'''
|-
| '''272'''
| '''PI16'''
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''PI4GND'''| '''2609'''|-| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-| '''<span style="color:#FF0000">261</span>'''| '''<span style="color:#FF0000">PI5</span>'''| '''<span style="color:#FF0000">TWI0_SCL</span>/UART2_TX'''| '''<span style="color:#FF0000">15</span>'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND3.3V'''| '''3917'''|-| '''40231'''| style="text-align: left;"|'''PH7'''| '''PI3SPI1_MOSI'''| '''25919'''|} <ol start="2" style="list-style-type: decimal;"><li><p>In Linux systems, uart is turned off by default and needs to be turned on manually before it can be used. The opening steps are as follows:</p><ol style="list-style-type: lower-alpha;"><li><p>First run | '''orangepi-config232'''. Ordinary users remember to add &gt; | '''sudoPH8''' permissions.</p><p>orangepi@orangepi:~$ | '''sudo orangepi-configSPI1_MISO'''</p></li><li><p>Then select | '''System21'''</p><p>[[File:zero2w|-img80.png]]</p></li><li><p>Then select | '''Hardware230'''</p><p>[[File:zero2w-img81.png]]</p></li>| '''PH6'''<li><p>Then use the keyboard's arrow keys to locate the position shown &gt; in the picture below, and then use the | '''spaceSPI1_CLK''' to select the &gt; serial port you want to open.</p></li></ol></li></ol> {| class="wikitable"'''23'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''Multiplexing function in 40pinGND'''| '''Corresponding dtbo configuration25'''
|-
| '''40pin <span style="color:#FF0000">266</span>'''| '''<span style="color:#FF0000">PI10</span>'''| '''<span style="color:#FF0000">TWI2- uart2SDA</span>/UART3_RX'''| '''pi-uart2<span style="color:#FF0000">27</span>'''
|-
| '''40pin - uart3256'''| '''piPI0'''| style="text-uart3align: left;"|| '''29'''
|-
| '''40pin - uart4271'''| '''piPI15'''| style="text-uart4align: left;"|| '''31'''
|-
| '''40pin - uart5268'''| '''ph-uart5PI12'''|}'''PWM2''' [[File:zero2w-img175.png]] <ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select | '''&lt;Save&gt;33''' to save</p><p>[[File:zero2w|-img83.png]]</p></li><li><p>Then select | '''&lt;Back&gt;258'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select | '''&lt;Reboot&gt;PI2''' to restart the system to make the &gt; configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol> <!-- --><ol start="3" | style="listtext-style-typealign: decimalleft;">|<li><p>After entering the Linux system, first confirm whether there is a uart5 device node under | '''/dev35'''</p><p>|-| '''Note that the linux5.4 system is /dev/ttyASx.272'''</p><p>orangepi@orangepi:~$ | '''ls /dev/ttyS*PI16'''</p><p>/dev/ttySx</p></li><li><p>Then start testing the uart interface. First use Dupont wire to short| style="text-circuit the rx and tx pins of the uart interface to be tested.</p></li>align: left;"|<li><p>Use the | '''gpio37''' command in wiringOP to test the loopback function of the serial port as shown below. If you can see the following print, it means the serial port communication is normal.</p><p>'''Note that the last x in the gpio serial /dev/ttySx command needs to be replaced with the serial number of the corresponding uart device node.'''</p>|-| style="text-align: left;"|<p>orangepi@orangepi| style="text-align:~$ left;"|| '''gpio serial /dev/ttySx # linux-6.1 test commandGND'''</p><p>orangepi@orangepi:~$ | '''gpio serial /dev/ttyASx # linux-5.4 test command39'''</p><p>Out: 0|}{| class="wikitable" style="width: 390px;margin-&gt; 0</p><p>Outright: 1: -&gt20px; 1</p><p>Out: 2: text-&gt; 2</p><p>Outalign: 3: -&gtcenter; 3^C</p></li></ol> <span id="pwm-test-method"></span>=== PWM test method === # As can be seen from the following table, the available pwm are pwm1, pwm2, pwm3 and pwm4. {| class="wikitable"
|-
| '''GPIO NO.'''| '''GPIO'''| '''Function'''| '''Pin'''|| '''Pinpin'''
| '''Function'''
| '''GPIO'''
| '''GPIO NO.'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|
| '''2'''
| '''5V'''
| style="text-align: left;"|
|-
| '''264'''
| '''PI8'''
| '''TWI1-SDA'''
| '''3'''
|
| '''4'''
| '''5V'''
| style="text-align: left;"|
|-
| '''263'''
| '''PI7'''
| '''TWI1-SCL'''
| '''5'''
|
| '''6'''
| '''GND'''
| style="text-align: left;"|
|-
| '''269'''| '''PI13'''| '''PWM3/UART4_TX'''| '''7'''|| '''8'''| '''UART0_TX'''
| '''PH0'''
| '''224'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''9'''
|
| '''10'''
| '''UART0_RX'''
| '''225'''
|-
| '''226'''
| '''PH2'''
| '''UART5_TX'''
| '''11'''
|
| '''12'''
| style="text-align: left;"|
| '''257'''
|-
| '''227'''
| '''PH3'''
| '''UART5_RX'''
| '''13'''
|
| '''14'''
| '''GND'''
| style="text-align: left;"|
|-
| '''261'''
| '''PI5'''
| '''TWI0_SCL/UART2_TX'''
| '''15'''
|
| '''16'''
| '''PWM4/UART4_RX'''
| '''270'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|
| '''18'''
| style="text-align: left;"|
| '''228'''
|-
| '''231'''
| '''PH7'''
| '''SPI1_MOSI'''
| '''19'''
|
| '''20'''
| '''GND'''
| style="text-align: left;"|
|-
| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''<span style="color:#FF0000">22</span>'''| '''<span style="color:#FF0000">TWI0_SDA</span>/UART2_RX'''| '''<span style="color:#FF0000">PI6</span>'''| '''<span style="color:#FF0000">262</span>'''
|-
| '''230'''
| '''PH6'''
| '''SPI1_CLK'''
| '''23'''
|
| '''24'''
| '''SPI1_CS0'''
| '''229'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''25'''
|
| '''26'''
| '''SPI1_CS1'''
| '''233'''
|-
| '''266'''| '''PI10'''| '''TWI2-SDA<span style="color:#FF0000">28</UART3_RX'''| '''27'''|| '''28span>'''| '''<span style="color:#FF0000">TWI2-SCL</span>/UART3_TX'''| '''<span style="color:#FF0000">PI9</span>'''| '''265'''|-| '''256'''| '''PI0'''| <span style="text-aligncolor: left;#FF0000"|| '''29>265</span>'''|-| '''30'''| '''GND'''| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''271'''
| '''PI15'''
| style="text-align: left;"|
| '''31'''
|
| '''32'''
| '''PWM1'''
| '''267'''
|-
| '''268'''
| '''PI12'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
|-
| '''258'''
| '''PI2'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''76'''
|-
| '''272'''
| '''PI16'''
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''260'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''39'''
|
| '''40'''
| style="text-align: left;"|
| '''259'''
|}
</div>
<ol start="2" style="list-style-type: decimal;">
<li><p>pwm i2c is turned off by default in Linux systems and needs to be turned on manually to use it. The opening steps are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First run '''orangepi-config'''. Ordinary users remember to add &gt; '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li>
<li><p>Then select '''System'''</p>
<p>[[File:zero2w-img80.png]]</p></li>
<li><p>Then select '''Hardware'''</p>
<p>[[File:zero2w-img81.png]]</p></li>
<li><p>Then use the keyboard's arrow keys to locate the position shown &gt; in the figure picture below, and then use the '''space''' to select the &gt; corresponding i2c configuration corresponding to in the pwm you want to openpicture below.</p><p/li{| class="wikitable" style="width:800px;text-align: center;"|-| '''Multiplexing function in 40pin'''| '''Corresponding dtbo configuration'''|-| '''40pin - i2c0'''| '''pi-i2c0'''|-| '''40pin - i2c1'''| '''pi-i2c1'''|-| '''40pin - i2c2'''| '''pi-i2c2'''|} [[File:zero2w-img176img173.png]]</pol></liol start="5" style="list-style-type: lower-alpha;"><li><p>Then select '''<span class="mark">&lt;Save&gt;''' </span> to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''&lt;Back&gt;'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''&lt;Reboot&gt;''' to restart the system to make the &gt; configuration take effect.</p>
<p>[[File:zero2w-img85.png]]</p></li></ol>
</li>
<li><p>After restarting, you can start the PWM test</p>
<p>'''Please execute the following commands under the root user.'''</p>
<ol style="list-style-type: lower-alpha;">
<li><p>Enter the following command on the command line to make pwm1 &gt; output a 50Hz square wave</p>
<p>root@orangepi:~# '''echo 1 &gt; /sys/class/pwm/pwmchip0/export'''</p>
<p>root@orangepi:~# '''echo 20000000 &gt; /sys/class/pwm/pwmchip0/pwm1/period'''</p>
<p>root@orangepi:~# '''echo 1000000 &gt; /sys/class/pwm/pwmchip0/pwm1/duty_cycle'''</p>
<p>root@orangepi:~# '''echo 1 &gt; /sys/class/pwm/pwmchip0/pwm1/enable'''</p></li>
<li><p>Enter the following command on the command line to make pwm2 &gt; output a 50Hz square wave</p></li></ol>
</li></ol>
<ol start="3" style="list-style-type: decimal;">
<li><p>After starting the Linux system, first confirm that there is an open i2c device node under /dev</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''ls /dev/i2c-*'''</p>
<p>'''/dev/i2c-*'''</p>
|}
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|
<big><p>'''Sometimes the i2c device node and the i2c bus serial number do not correspond one to one. For example, the i2c device node of the i2c1 bus may be /dev/i2c-3.'''</p>
<p>'''The method to accurately confirm the device node under /dev corresponding to the i2c bus is: '''</p></big>
root@orangepi:~# '''echo 2 &gt; /sys/class/pwm/pwmchip0/export'''
root<ol style="list-style-type: lower-alpha;"><li><p>'''First run the following command to check the corresponding relationship of i2c'''</p><p>orangepi@orangepiorangepizero2w:~# $ '''echo 20000000 &gt; ls /sys/classdevices/pwmplatform/pwmchip0soc*/pwm2*/periodi2c-* | grep &quot;i2c-[0-9]&quot;'''</p><p>/sys/devices/platform/soc/5002000.i2c/i2c-0:</p><p>/sys/devices/platform/soc/5002400.i2c/i2c-3:</p><p>/sys/devices/platform/soc/5002800.i2c/i2c-4:</p><p>/sys/devices/platform/soc/5002c00.i2c/i2c-5:</p><p>/sys/devices/platform/soc/6000000.hdmi/i2c-2:</p><p>/sys/devices/platform/soc/7081400.i2c/i2c-1:</p></li>
root@orangepi:~# '''echo 1000000 &gt; /sys/class/pwm/pwmchip0/pwm2/duty_cycle'''
 
root@orangepi:~# '''echo 1 &gt; /sys/class/pwm/pwmchip0/pwm2/enable'''
 
<ol start="3" style="list-style-type: lower-alpha;">
<li>Enter the following command on the command line to make pwm3 output &gt; a 50Hz square wave</li></ol>
 
root@orangepi:~# '''echo 3 &gt; /sys/class/pwm/pwmchip0/export'''
 
root@orangepi:~# '''echo 20000000 &gt; /sys/class/pwm/pwmchip0/pwm3/period'''
 
root@orangepi:~# '''echo 1000000 &gt; /sys/class/pwm/pwmchip0/pwm3/duty_cycle'''
 
root@orangepi:~# '''echo 1 &gt; /sys/class/pwm/pwmchip0/pwm3/enable'''
 
<ol start="4" style="list-style-type: lower-alpha;">
<li>Enter the following command on the command line to make pwm4 output &gt; a 50Hz square wave</li></ol>
 
root@orangepi:~# '''echo 4 &gt; /sys/class/pwm/pwmchip0/export'''
 
root@orangepi:~# '''echo 20000000 &gt; /sys/class/pwm/pwmchip0/pwm4/period'''
 
root@orangepi:~# '''echo 1000000 &gt; /sys/class/pwm/pwmchip0/pwm4/duty_cycle'''
 
root@orangepi:~# '''echo 1 &gt; /sys/class/pwm/pwmchip0/pwm4/enable'''
<li><p>'''In the above output'''</p>
<ol style="list-style-type: none;">
<li><p>a) 5002000 is the register base address of the i2c0 bus, and i2c-0 shown behind it is its corresponding i2c device node</p></li>
<li><p>b) 5002400 is the register base address of the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li>
<li><p>c) 5002800 is the register base address of the i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p></li></ol>
</li></ol>
|}
</li></ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>Then start testing i2c, first install i2c-tools</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo apt-get update'''</p>
<p>orangepi@orangepi:~$ '''sudo apt-get install -y i2c-tools'''</p>
|}
</li>
<li><p>Then connect an i2c device to the i2c pin of the 40pin connector</p></li>
<li><p>Then use the '''i2cdetect -y x''' x command. If the address of the connected i2c device can be detected, it means that i2c can be used normally.</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|
<big><p>'''Note that x in the i2cdetect -y x command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p>
<p>'''Different i2c device addresses are different. The 0x50 address in the picture below is just an example. Please refer to what you actually see.'''</p></big>
|}
<div class="figure">
[[File:zero2w-img177img174.png]]
</div><span id="how-to-install-and-use-wiringop-python"/li></spanol>== How to install and use wiringOP-Python ==
'''Note: The <span id="pin header on the 40pin interface is not soldered by default, and you need to solder it yourself before it can be used.'''-uart-test"></span>
'''wiringOP-Python is the Python language version of wiringOP library, used to operate the development board's GPIO, I2C, SPI, === 40pin UART and other hardware resources in the Python program'''test ===
'''Also please # As can be seen from the table below, the available uarts are uart2, uart3, uart4 and uart5. Please note that all the following commands are operated under the root useruart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial port.'''
<span iddiv style="how-to-install-wiringop-pythondisplay: flex;"></span>::{| class=== How to install wiringOP-Python === <ol "wikitable" style="listwidth:390px;margin-styleright: 20px;text-typealign: decimalcenter;"><li><p>First install dependency packages</p>|-<p>root@orangepi:~# | '''sudo apt-get updateGPIO NO.'''</p><p>root@orangepi:~# | '''sudo apt-get -y install git swig python3-dev python3-setuptoolsGPIO'''</p></li><li><p>Then use the following command to download the source code of wiringOP-Python</p></li></ol>| '''Function'''| '''pin'''Note that the following git clone|-| style="text-recursive command will automatically download the source code of wiringOP, because wiringOPalign: left;"|| style="text-Python depends on wiringOP. Please make sure there are no errors during the download process due to network problemsalign: left;"|| '''3.3V'''| '''1'''If there is a problem downloading the code from GitHub, you can directly use the wiringOP|-Python source code that comes with the Linux image. The storage location is: | '''/usr/src/wiringOP-Python264''' root@orangepi:~# | '''git clone --recursive https://github.com/orangepi-xunlong/wiringOP-Python -b nextPI8''' root@orangepi:~# | '''cd wiringOPTWI1-PythonSDA''' root@orangepi:~/wiringOP-Python# | '''git submodule update --init --remote3''' <ol start="3" style="list|-style-type: decimal;"><li><p>Then use the following command to compile wiringOP-Python and install it into the Linux system of the development board</p>| '''263'''<p>root@orangepi:~# | '''cd wiringOP-PythonPI7'''</p><p>root@orangepi:~/wiringOP-Python# | '''python3 generateTWI1-bindings.py &gt; bindings.iSCL'''</p><p>root@orangepi:~/wiringOP-Python# | '''sudo python3 setup.py install5'''</p></li><li><p>Then enter the following command. If helpful information is output, it means wiringOP|-Python is successfully installed. Press the | '''q269''' key to exit the help information interface.</p></li></ol> root@orangepi:~/wiringOP-Python# | '''python3 -c &quot;import wiringpi; help(wiringpi)&quot;PI13''' Help on module wiringpi: NAME wiringpi DESCRIPTION # This file was automatically generated by SWIG (http:| '''PWM3//www.swig.org).UART4_TX'''| '''7'''# Version 4.0.2 # # Do not make changes to this file unless you know what you are doing|--modify # the SWIG interface file instead. <ol start="5" | style="list-styletext-typealign: decimalleft;">|<li><p>The steps to test whether wiringOP-Python is installed successfully under the python command line are as follows:</p><ol | style="list-styletext-typealign: lower-alphaleft;">|<li>First use the python3 command to enter the command line mode of &gt; python3</li></ol>| '''GND'''</li></ol> root@orangepi:~# | '''python39''' <ol start="2" style="list-style-type: lower|-alpha;"><li>Then import the python module of wiringpi</li></ol>| '''226'''| '''PH2'''&gt;&gt;&gt; | '''import wiringpi;UART5_TX'''| '''11'''<ol start="3" style="list-style|-type: lower-alpha;"><li>Finally, enter the following command to view the help information of &gt; wiringOP-Python. Press the q key to exit the help information &gt; interface.</li></ol>| '''227'''| '''PH3'''&gt;&gt;&gt; | '''help(wiringpi)UART5_RX'''| '''13'''Help on module wiringpi: NAME wiringpi DESCRIPTION # This file was automatically generated by SWIG (http://www.swig.org). # Version 4.0.2 # # Do not make changes to this file unless you know what you are doing|--modify # the SWIG interface file instead. CLASSES builtins.object GPIO I2C Serial nes class GPIO(builtins.object)| '''261'''| GPIO(pinmode=0)'''PI5'''&gt;&gt;&gt; <span id="pin-gpio-port-test-1"><'''TWI0_SCL/span>UART2_TX'''=== 40pin GPIO port test === '| ''Like wiringOP, wiringOP-Python can also determine which GPIO pin to operate by specifying the wPi number. Because there is no command to view the wPi number in wiringOP-Python, you can only view the board's wPi number and physics through the gpio command in wiringOP Correspondence of pins.15''' [[File:zero2w|-img170.png]] <ol | style="listtext-style-typealign: decimalleft;">|<li><p>The following uses pin No. 7 - corresponding to GPIO PI13 - corresponding to wPi serial number 2 - as an example to demonstrate how to set the high and low levels of the GPIO port.</p><p>[[File:zero2w-img171.png]]</p></li><li><p>The steps for testing directly with commands are as follows:</p><ol | style="listtext-style-typealign: lower-alphaleft;">|<li><p>First set the GPIO port to output mode, where the first &gt; parameter of the | '''pinMode3.3V''' function is the serial number of &gt; the wPi corresponding to the pin, and the second parameter is &gt; the GPIO mode.</p><p>root@orangepi:~/wiringOP-Python# | '''python3 -c &quot;import wiringpi; \17'''</p><p>|-| '''from wiringpi import GPIO; wiringpi.wiringPiSetup() ; \231'''</p><p>| '''wiringpi.pinMode(2, GPIO.OUTPUT) ; &quot;PH7'''</p></li><li><p>Then set the GPIO port to output a low level. After setting, you &gt; can use a multimeter to measure the voltage value of the pin. &gt; If it is 0v, it means the low level is set successfully.</p><p>root@orangepi:~/wiringOP-Python# | '''python3 -c &quot;import wiringpi; \SPI1_MOSI'''</p><p>| '''from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\19'''</p><p>|-| '''wiringpi.digitalWrite(2, GPIO.LOW)&quot;232'''</p></li><li><p>Then set the GPIO port to output a high level. After setting, &gt; you can use a multimeter to measure the voltage value of the &gt; pin. If it is 3.3v, it means the setting of the high level is &gt; successful.</p><p>root@orangepi:~/wiringOP-Python# | '''python3 -c &quot;import wiringpi; \PH8'''</p><p>| '''from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\SPI1_MISO'''</p><p>| '''wiringpi.digitalWrite(2, GPIO.HIGH)&quot;21'''</p></li></ol></li><li><p>The steps for testing in the command line of python3 are as follows:</p><ol style="list-style-type: lower|-alpha;"><li><p>First use the python3 command to enter the command line mode of &gt; python3</p><p>root@orangepi:~# | '''python3230'''</p></li><li><p>Then import the python module of wiringpi</p><p>&gt;&gt;&gt; | '''import wiringpiPH6'''</p><p>&gt;&gt;&gt; | '''from wiringpi import GPIOSPI1_CLK'''</p></li><li><p>Then set the GPIO port to output mode, where the first parameter &gt; of the | '''pinMode23'''function is the serial number of the wPi &gt|-| style="text-align: left; corresponding to the pin, and the second parameter is the GPIO &gt"|| style="text-align: left; mode.</p>"|<p>&gt;&gt;&gt; | '''wiringpi.wiringPiSetup()GND'''</p><p>0</p><p>&gt;&gt;&gt; | '''wiringpi.pinMode(2, GPIO.OUTPUT)25'''</p></li><li><p>Then set the GPIO port to output a low level. After setting, you &gt; can use a multimeter to measure the voltage value of the pin. &gt; If it is 0v, it means the low level is set successfully.</p>|-<p>&gt;&gt;&gt; | '''wiringpi.digitalWrite(2, GPIO.LOW)266'''</p></li><li><p>Then set the GPIO port to output a high level. After setting, &gt; you can use a multimeter to measure the voltage value of the &gt; pin. If it is 3.3v, it means the setting of the high level is &gt; successful.</p><p>&gt;&gt;&gt; | '''wiringpi.digitalWrite(2, GPIO.HIGH)PI10'''</p></li></ol><| '''TWI2-SDA/li>UART3_RX'''<li><p>For wiringOP-Python to set the GPIO high and low levels in the python code, you can refer to the | '''blink.py27''' test program in the examples. The |-| '''blink.py256''' test program will set the voltage of all GPIO ports in the 40 Pin of the development board to continuously change high and low.</p><p>root@orangepi:~/wiringOP-Python# | '''cd examplesPI0'''</p><p>root@orangepi| style="text-align:~/wiringOP-Python/examples# left;"|| '''ls blink.py29'''</p><p>|-| '''blink.py271'''</p><p>root@orangepi:~/wiringOP-Python/examples| '''# python3 blink.pyPI15'''</p></li></ol> <span id| style="pintext-spi-test-1align: left;"></span>=== 40pin SPI test === # As can be seen from the table below, the spi available for the 40pin interface is spi1, and there are two chip select pins cs0 and cs1|{| class="wikitable"'''31'''
|-
| '''GPIO NO.268'''| '''GPIOPI12'''| '''FunctionPWM2'''| '''Pin'''|| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.33'''
|-
| '''258'''
| '''PI2'''
| style="text-align: left;"|
| '''35'''|-| '''272'''| '''PI16'''| style="text-align: left;"|| '''3.3V37'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''39'''|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''pin'''| '''Function'''| '''GPIO'''| '''1GPIO NO.'''|-
| '''2'''
| '''5V'''
| style="text-align: left;"|
|-
| '''264'''
| '''PI8'''
| '''TWI1-SDA'''
| '''3'''
|
| '''4'''
| '''5V'''
| style="text-align: left;"|
|-
| '''263'''
| '''PI7'''
| '''TWI1-SCL'''
| '''5'''
|
| '''6'''
| '''GND'''
| style="text-align: left;"|
|-
| '''269'''
| '''PI13'''
| '''PWM3/UART4_TX'''
| '''7'''
|
| '''8'''
| '''UART0_TX'''
| '''224'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''9'''
|
| '''10'''
| '''UART0_RX'''
| '''225'''
|-
| '''226'''
| '''PH2'''
| '''UART5_TX'''
| '''11'''
|
| '''12'''
| style="text-align: left;"|
| '''257'''
|-
| '''227'''
| '''PH3'''
| '''UART5_RX'''
| '''13'''
|
| '''14'''
| '''GND'''
| style="text-align: left;"|
|-
| '''261'''
| '''PI5'''
| '''TWI0_SCL/UART2_TX'''
| '''15'''
|
| '''16'''
| '''PWM4/UART4_RX'''
| '''270'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|
| '''18'''
| style="text-align: left;"|
| '''228'''
|-
| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|| '''20'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''232'''
| '''PH8'''
| '''SPI1_MISO'''
| '''21'''
|
| '''22'''
| '''TWI0_SDA/UART2_RX'''
| '''262'''
|-
| '''230'''
| '''PH6'''
| '''SPI1_CLK'''
| '''23'''
|
| '''24'''
| '''SPI1_CS0'''
| '''229'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''25'''
|
| '''26'''
| '''SPI1_CS1'''
| '''233'''
|-
| '''266'''
| '''PI10'''
| '''TWI2-SDA/UART3_RX'''
| '''27'''
|
| '''28'''
| '''TWI2-SCL/UART3_TX'''
| '''265'''
|-
| '''256'''
| '''PI0'''
| style="text-align: left;"|
| '''29'''
|
| '''30'''
| '''GND'''
| style="text-align: left;"|
|-
| '''271'''
| '''PI15'''
| style="text-align: left;"|
| '''31'''
|
| '''32'''
| '''PWM1'''
| '''267'''
|-
| '''268'''
| '''PI12'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
|-
| '''258'''
| '''PI2'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''76'''
|-
| '''272'''
| '''PI16'''
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''260'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''39'''
|
| '''40'''
| style="text-align: left;"|
| '''259'''
|}
</div>
<ol start="2" style="list-style-type: decimal;">
<li><p>In Linux systems, spi1 uart is turned off by default and needs to be turned on manually before it can be used. The opening steps are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First run '''orangepi-config'''. Ordinary users remember to add &gt; '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li><li><p>Then select '''System'''</p>
<p>[[File:zero2w-img80.png]]</p></li>
<li><p>Then select '''Hardware'''</p>
<p>[[File:zero2w-img81.png]]</p></li>
<li><p>Then use the keyboard's arrow keys to locate the position shown &gt; in the figure picture below, and then use the '''space''' to select the &gt; dtbo configuration of the SPI serial port you want to open.</p></li></ol></li></ol>
{| class="wikitable"style="width:800px;text-align: center;"|-| '''Multiplexing function in 40pin'''| '''Corresponding dtbo configuration'''
|-
| '''dtbo configuration40pin - uart2'''| '''illustratepi-uart2'''
|-
| '''spi140pin -cs0-cs1-spidevuart3'''| '''Open cs0 and cs1 of spi1 at the same timepi-uart3'''
|-
| '''spi140pin -cs0-spidevuart4'''| '''Only open cs0 of spi1pi-uart4'''
|-
| '''spi140pin -cs1-spidevuart5'''| '''Only open cs1 of spi1ph-uart5'''
|}
[[File:zero2w-img175.png]]
</ol>
<ol start="5" style="list-style-type: lower-alpha;">
<li><p>Then select '''&lt;Save&gt;''' to save</p>
<li><p>Then select '''&lt;Back&gt;'''</p>
<p>[[File:zero2w-img84.png]]</p></li>
<li><p>Then select '''&lt;Reboot&gt;''' to restart the system to make the &gt; configuration take effect.</p>
<p>[[File:zero2w-img85.png]]</p></li></ol>
</li></ol>
<!-- -->
<ol start="3" style="list-style-type: decimal;">
<li><p>Then check After entering the Linux system, first confirm whether there is a '''spidev1.x''' uart5 device node in the Linux system. If it exists, it means that the SPI1 configuration has taken effect.</p><p>orangepi@orangepi:~$ under '''ls /dev/spidev1*'''</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <p>/dev/spidev1.0 /dev/spidev1.1</pbig><p>'''Note that only when you open spi1-cs0-cs1-spidev, you will see the device nodes of the two spilinux5.4 system is /dev/ttyASx.'''</p></libig><li><p>Then you can use the '''spidev_test.py''' program in examples to test the SPI loopback function. The '''spidev_test.py''' program needs to specify the following two parameters:</p>|}<ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li>|-| <p>orangepi@orangepi:~$ '''--channells /dev/ttyS*''': Specify the channel number of SPI</p></li><li><p>'''--port''': Specify the port number of the SPI</p><dev/li>ttySx</olp>|}
</li>
<li><p>Without shorting Then start testing the mosi uart interface. First use Dupont wire to short-circuit the rx and miso tx pins of SPI1, the output result uart interface to be tested.</p></li><li><p>Use the '''gpio''' command in wiringOP to test the loopback function of running spidev_test.py is the serial port as followsshown below. You If you can see that the data of TX and RX are inconsistentfollowing print, it means the serial port communication is normal.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>root@orangepi:~/wiringOP-Python# '''cd examplesNote 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></libig>|}{| class="wikitable" style="width:800px;" |-| </olprootorangepi@orangepi:~$ '''gpio serial /wiringOP-Pythondev/examplesttySx # '''python3 spidev_testlinux-6.py \1 test command'''</p> <p>orangepi@orangepi:~$ '''gpio serial /dev/ttyASx # linux--channel 1 --port 05.4 test command'''</p>
spi mode: 0x0
max speed<p>Out: 500000 Hz (500 KHz)0: -&gt; 0</p><p>Out: 1: -&gt; 1</p><p>Out: 2: -&gt; 2</p><p>Out: 3: -&gt; 3^C</p>|}</li></ol>
Opening device <span id="pwm-test-method"></dev/spidev1.1span>
TX | FF FF FF FF FF FF '''40 00 00 00 00 95''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…|=== PWM test method ===
RX | FF FF FF FF FF FF '''FF FF FF FF FF FF''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF |# As can be seen from the following table, the available pwm are pwm1, pwm2, pwm3 and pwm4.............….|
<ol start="6" div style="list-style-typedisplay: decimalflex;"><li><p>Then use Dupont wire to short-circuit the txd (pin 19 in the 40pin interface) and rxd (pin 21 in the 40pin interface) of SPI1 and then run spidev_test.py. The output is as follows, you can see If the data sent and received are the same, it means that the SPI1 loopback test is normal.</p><p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p></li></ol> root@orangepi:~/wiringOP-Python/examples# '''python3 spidev_test.py \''' '''--channel 1 --port 0''' spi mode: 0x0 max speed: 500000 Hz (500 KHz) Opening device /dev/spidev1.1 TX {| FF FF FF FF FF FF '''40 00 00 00 00 95''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…| RX | FF FF FF FF FF FF '''40 00 00 00 00 95''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…| <span idclass="pin-i2c-test-1wikitable"></span>=== 40pin I2C test === # As can be seen from the table below, the i2c available for the 40pin interface are i2c0, i2c1 and i2c2 {| classstyle="wikitablewidth:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO NO.'''
| '''Function'''
| '''Pin'''
|
| '''Pin'''
| '''Function'''
| '''GPIO'''
| '''GPIO NO.'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|
| '''2'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''264'''
| '''TWI1-SDA'''
| '''3'''
|
| '''4'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''263'''
| '''TWI1-SCL'''
| '''5'''
|-| '''6<span style="color:#FF0000">269</span>'''| '''GND<span style="color:#FF0000">PI13</span>'''| '''<span style="color:#FF0000">PWM3</span>/UART4_TX'''| '''<span style="color:#FF0000">7</span>'''|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''9'''
|-
| '''269'''| '''PI13'''| '''PWM3/UART4_TX'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''9'''|| '''10'''| '''UART0_RX'''| '''PH1'''| '''225'''|-| '''226'''| '''PH2'''
| '''UART5_TX'''
| '''11'''
|
| '''12'''
| style="text-align: left;"|
| '''PI1'''
| '''257'''
|-
| '''227'''
| '''UART5_RX'''
| '''13'''
|
| '''14'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''261'''
| '''TWI0_SCL/UART2_TX'''
| '''15'''
|
| '''16'''
| '''PWM4/UART4_RX'''
| '''PI14'''
| '''270'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|
| '''18'''
| style="text-align: left;"|
| '''PH4'''
| '''228'''
|-
| '''231'''
| '''SPI1_MOSI'''
| '''19'''
|
| '''20'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''232'''
| '''SPI1_MISO'''
| '''21'''
|
| '''22'''
| '''TWI0_SDA/UART2_RX'''
| '''PI6'''
| '''262'''
|-
| '''230'''
| '''SPI1_CLK'''
| '''23'''
|
| '''24'''
| '''SPI1_CS0'''
| '''PH5'''
| '''229'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|
| '''26'''
| '''SPI1_CS1'''
| '''PH9'''
| '''233'''
|-
| '''266'''
| '''TWI2-SDA/UART3_RX'''
| '''27'''
|
| '''28'''
| '''TWI2-SCL/UART3_TX'''
| '''PI9'''
| '''265'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|
| '''30'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|
| '''32'''
| '''PWM1'''
| '''PI11'''
| '''267'''
|-
| '''<span style="color:#FF0000">268</span>'''| '''<span style="color:#FF0000">PI12</span>'''| '''<span style="color:#FF0000">PWM2</span>'''| '''33'''|| '''34'''| '''GND'''| <span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"|>33</span>'''
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''PC12'''
| '''76'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|
| '''40'''
| style="text-align: left;"|
| '''PI3'''
| '''259'''
|}
 <ol start{| class="2wikitable" style="list-style-typewidth: decimal390px;"><li><p>i2c is turned off by default in Linux systems and needs to be turned on manually to use it. The opening steps are as follows:</p><ol style="listmargin-style-typeright: lower-alpha20px;"><li><p>First run '''orangepi-config'''. Ordinary users remember to add &gt; '''sudo''' permissions.</p><p>orangepi@orangepi:~$ '''sudo orangepitext-config'''</p></li><li><p>Then select '''System'''</p><p>[[Filealign:zero2w-img80.png]]</p></li><li><p>Then select '''Hardware'''</p><p>[[File:zero2w-img81.png]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown &gt; in the picture below, and then use the '''space''' to select the &gtcenter; corresponding i2c configuration in the picture below.</p></li></ol></li></ol> {| class="wikitable"
|-
| '''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">&lt;Save&gt;</span> to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select <span class="mark">&lt;Back&gt;</span></p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select <span class="mark">&lt;Reboot&gt;</span> to restart the system to make the &gt; configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol> <!-- --><ol start="3" style="list-style-type: decimal;"><li><p>After starting the Linux system, first confirm that there is an open i2c device node under <span class="mark">/dev</span></p><p>orangepi@orangepi:~$ '''ls /dev/i2c-*'''</p><p>'''/dev/i2c-*'''</p><p>'''Sometimes the i2c device node and the i2c bus serial number do not correspond one to one. For example, the i2c device node of the i2c1 bus may be /dev/i2c-3.'''</p><p>'''The method to accurately confirm the device node under /dev corresponding to the i2c bus is:'''</p></li></ol> <!-- --><ol start="3" style="list-style-type: lower-alpha;"><li><p>'''First run the following command to check the corresponding relationship of i2c'''</p><p>orangepi@orangepizero2w:~$ '''ls /sys/devices/platform/soc*/*/i2c-* | grep &quot;i2c-[0-9]&quot;'''</p><p>/sys/devices/platform/soc/5002000.i2c/i2c-0:</p><p>/sys/devices/platform/soc/5002400.i2c/i2c-3:</p><p>/sys/devices/platform/soc/5002800.i2c/i2c-4:</p><p>/sys/devices/platform/soc/5002c00.i2c/i2c-5:</p><p>/sys/devices/platform/soc/6000000.hdmi/i2c-2:</p><p>/sys/devices/platform/soc/7081400.i2c/i2c-1:</p></li><li><p>'''In the above 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>'''&quot;/dev/i2c-x&quot;'''</p><p>Thu 2022-06-16 04:35:46</p><p>Thu 2022-06-16 04:35:47</p><p>Thu 2022-06-16 04:35:48</p><p>^C</p><p>exit</p></li></ol> <span id="pin-uart-test-1"></span>=== 40pin UART test === # As can be seen from the table below, the available uarts are uart2, uart3, uart4 and uart5. Please note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial port. {| class="wikitable"|-| '''GPIO NO.'''| '''GPIO'''| '''Function'''| '''Pin'''|| '''Pin'''| '''Function'''| '''GPIOPH4'''| '''GPIO NO.228'''
|-
| '''20'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|
| '''2'''
| '''5V'''
| 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;"|
| '''GND'''
| '''9'''
|
| '''10'''
| '''UART0_RX'''
| '''PH1'''
| '''225'''
|-
| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''1236'''
| style="text-align: left;"|
| '''PI1PC12'''| '''25776'''
|-
| '''22738'''| '''PH3'''style="text-align: left;"|| '''UART5_RXPI4'''| '''13260'''|-| '''1440'''| '''GND'''| style="text-align: left;"|
| style="text-align: left;"|
| '''PI3'''
| '''259'''
|}
</div>
 
<ol start="2" style="list-style-type: decimal;">
<li><p>pwm is turned off by default in Linux systems and needs to be turned on manually to use it. The opening steps are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First run '''orangepi-config'''. Ordinary users remember to add '''sudo''' permissions.</p>
{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''261sudo orangepi-config'''</p>| }</li><li><p>Then select '''PI5System'''</p><p>[[File:zero2w-img80.png]]</p></li>| <li><p>Then select '''TWI0_SCL/UART2_TXHardware'''</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 '''15space'''to select the configuration corresponding to the pwm you want to open.</p>|<p>[[File:zero2w-img176.png]]</p></li>| <li><p>Then select '''16&lt;Save&gt;'''to save</p><p>[[File:zero2w-img83.png]]</p></li>| <li><p>Then select '''PWM4/UART4_RX&lt;Back&gt;'''</p><p>[[File:zero2w-img84.png]]</p></li>| <li><p>Then select '''PI14&lt;Reboot&gt;'''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>{| '''270'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| style="text-align: left;"|| style="text-align: left;"|| <big><p>'''3Please execute the following commands under the root user.3V'''</p></big>| '''17'''|| '''18'''}| <ol style="textlist-style-aligntype: leftlower-alpha;"|>| '''PH4'''<li><p>Enter the following command on the command line to make pwm1 output a 50Hz square wave</p>{| '''228'''class="wikitable" style="width:800px;"
|-
| <p>root@orangepi:~# '''231echo 1 &gt; /sys/class/pwm/pwmchip0/export'''</p>| <p>root@orangepi:~# '''PH7echo 20000000 &gt; /sys/class/pwm/pwmchip0/pwm1/period'''</p>| <p>root@orangepi:~# '''SPI1_MOSIecho 1000000 &gt; /sys/class/pwm/pwmchip0/pwm1/duty_cycle'''</p>| <p>root@orangepi:~# '''19echo 1 &gt; /sys/class/pwm/pwmchip0/pwm1/enable'''</p>|}| '''20'''</li>| '''GND'''<li><p>Enter the following command on the command line to make pwm2 output a 50Hz square wave</p></li>{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| root@orangepi:~# '''232echo 2 &gt; /sys/class/pwm/pwmchip0/export'''| root@orangepi:~# '''PH8echo 20000000 &gt; /sys/class/pwm/pwmchip0/pwm2/period'''| '''SPI1_MISO'''| root@orangepi:~# '''21echo 1000000 &gt; /sys/class/pwm/pwmchip0/pwm2/duty_cycle'''|| root@orangepi:~# '''22echo 1 &gt; /sys/class/pwm/pwmchip0/pwm2/enable'''| '''TWI0_SDA}</UART2_RX'''ol><ol start="3" style="list-style-type: lower-alpha;">| '''PI6'''<li>Enter the following command on the command line to make pwm3 output a 50Hz square wave</li>{| '''262'''class="wikitable" style="width:800px;"
|-
| root@orangepi:~# '''230echo 3 &gt; /sys/class/pwm/pwmchip0/export'''| root@orangepi:~# '''PH6echo 20000000 &gt; /sys/class/pwm/pwmchip0/pwm3/period'''| root@orangepi:~# '''SPI1_CLKecho 1000000 &gt; /sys/class/pwm/pwmchip0/pwm3/duty_cycle'''| root@orangepi:~# '''23echo 1 &gt; /sys/class/pwm/pwmchip0/pwm3/enable'''|}| '''24'''</ol>| '''SPI1_CS0'''<ol start="4" style="list-style-type: lower-alpha;">| '''PH5'''<li>Enter the following command on the command line to make pwm4 output a 50Hz square wave</li>{| '''229'''class="wikitable" style="width:800px;"
|-
| style="text-align: left;"|| style="text-alignroot@orangepi: left;"|| ~# '''GNDecho 4 &gt; /sys/class/pwm/pwmchip0/export'''| root@orangepi:~# '''25echo 20000000 &gt; /sys/class/pwm/pwmchip0/pwm4/period'''|| root@orangepi:~# '''26echo 1000000 &gt; /sys/class/pwm/pwmchip0/pwm4/duty_cycle'''| root@orangepi:~# '''SPI1_CS1echo 1 &gt; /sys/class/pwm/pwmchip0/pwm4/enable'''| '''PH9'''} <div class="figure"> [[File:zero2w-img177.png]] </div></ol></li></ol><span id="how-to-install-and-use-wiringop-python"></span> == How to install and use wiringOP-Python == {| '''233'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| '''266'''| ''<big>'PI10''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.'| '''TWI2-SDA</UART3_RX'''| '''27'''big>|}{| '''28'''| '''TWI2class="wikitable" style="background-SCL/UART3_TX'''| '''PI9'''| '''265'''color:#ffffdc;width:800px;"
|-
| <big>'''wiringOP-Python is the Python language version of wiringOP library, used to operate the development board'256s GPIO, I2C, SPI, UART and other hardware resources in the Python program'''| '''PI0Also please note that all the following commands are operated under the root user.'''</big>| style} <span id="texthow-to-install-align: left;wiringop-python"|></span>| '''29'''=== How to install wiringOP-Python ===|| '''30'''| '''GND'''| <ol style="textlist-alignstyle-type: leftdecimal;"|><li><p>First install dependency packages</p>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| <p>root@orangepi:~# '''271sudo apt-get update'''</p>| <p>root@orangepi:~# '''PI15sudo apt-get -y install git swig python3-dev python3-setuptools'''</p>|}</li><li><p>Then use the following command to download the source code of wiringOP-Python</p></li>{| class="wikitable" style="textbackground-aligncolor:#ffffdc;width: left800px;"|| '''31'''|| '''32'''| '''PWM1'''| '''PI11'''| '''267'''
|-
| '''268'''| <big>'''PI12Note 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.'''| '''PWM2'''| '''33'''|| '''34If there is a problem downloading the code from GitHub, you can directly use the wiringOP-Python source code that comes with the Linux image. The storage location is: /usr/src/wiringOP-Python'''</big>| '''GND'''}{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| root@orangepi:~# '''258git clone --recursive https://github.com/orangepi-xunlong/wiringOP-Python -b next'''| root@orangepi:~# '''PI2cd wiringOP-Python'''| style="textroot@orangepi:~/wiringOP-align: left;"|| Python# '''35git submodule update --init --remote'''|}| '''36'''</ol>| <ol start="3" style="textlist-style-aligntype: leftdecimal;"|>| '''PC12'''<li><p>Then use the following command to compile wiringOP-Python and install it into the Linux system of the development board</p>{| '''76'''class="wikitable" style="width:800px;"
|-
| <p>root@orangepi:~# '''272cd wiringOP-Python'''</p>| <p>root@orangepi:~/wiringOP-Python# '''PI16python3 generate-bindings.py &gt; bindings.i'''</p>| style="text<p>root@orangepi:~/wiringOP-align: left;"|| Python# '''37sudo 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 '''38q'''key to exit the help information interface.</p></li>{| class="wikitable" style="text-alignwidth: left800px;"|| '''PI4'''| '''260'''
|-
| style="text-alignroot@orangepi: left;"|| style="text~/wiringOP-align: left;"|| Python# '''GNDpython3 -c &quot;import wiringpi; help(wiringpi)&quot;'''| '''39'''|Help on module wiringpi:  NAME :wiringpi  DESCRIPTION : # This file was automatically generated by SWIG (http://www.swig.org). : # Version 4.0.2 : #| '''40'''| style="text: # Do not make changes to this file unless you know what you are doing--align: left;"|modify| '''PI3'''| '''259''': # the SWIG interface file instead.
|}
</ol><ol start="25" style="list-style-type: decimal;"><li><p>In Linux systems, uart is turned off by default and needs to be turned on manually before it can be used. The opening steps 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>First run '''orangepi-config'''. Ordinary users remember to add &gt; '''sudo''' permissions.</p><p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p></li><li><p>Then select '''System'''</p><p>[[File:zero2w-img80.png]]</p></li><li><p>Then select '''Hardware'''</p><p>[[File:zero2w-img81.png]]</p></li><li><p>Then use the keyboard's arrow keys python3 command to locate enter the position shown command line mode of &gt; in the picture below, and then use the '''space''' to select the &gt; serial port you want to open.</p>python3</li></ol></li></ol> {| class="wikitable" style="width:800px;"
|-
| root@orangepi:~# '''Multiplexing function in 40pinpython3'''| '''Corresponding dtbo configuration'''}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Then import the python module of wiringpi</li>{| class="wikitable" style="width:800px;"
|-
| &gt;&gt;&gt; '''40pin - uart2import wiringpi;'''| '''pi}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>Finally, enter the following command to view the help information of &gt; wiringOP-uart2'''Python. Press the q key to exit the help information &gt; interface.</li>{| class="wikitable" style="width:800px;"
|-
| '''40pin - uart3'''| &gt;&gt;&gt; '''pi-uart3help(wiringpi)'''|-| '''40pin - uart4'''| '''pi-uart4'''|-| '''40pin - uart5'''| '''ph-uart5'''|}
[[FileHelp on module wiringpi:zero2w-img175.png]]  NAME
<ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select '''&lt;Save&gt;''' to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''&lt;Back&gt;'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''&lt;Reboot&gt;''' to restart the system to make the &gt; configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol>wiringpi
<!-- -->
<ol start="3" style="list-style-type: decimal;">
<li><p>After entering the Linux system, first confirm whether there is a uart5 device node under '''<span class="mark">/dev</span>'''</p>
<p>'''注意, linux5.4系统为/dev/ttyASx.'''</p>
<p>orangepi@orangepi:~$ '''ls /dev/ttyS*'''</p>
<p>/dev/ttySx</p></li>
<li><p>Then start testing the uart interface. First use Dupont wire to short-circuit the rx and tx pins of the uart interface to be tested.</p></li>
<li><p>Use the '''gpio''' command in wiringOP to test the loopback function of the serial port as shown below. If you can see the following print, it means the serial port communication is normal.</p>
<p>'''Note that the last x in the gpio serial /dev/ttySx command needs to be replaced with the serial number of the corresponding uart device node.'''</p>
<p>orangepi@orangepi:~$ '''gpio serial /dev/ttySx # linux-6.1 test command'''</p>
<p>orangepi@orangepi:~$ '''gpio serial /dev/ttyASx # linux-5.4 test command'''</p>
<p>Out: 0: -&gt; 0</p>
<p>Out: 1: -&gt; 1</p>
<p>Out: 2: -&gt; 2</p>
<p>Out: 3: -&gt; 3^C</p></li>
<li><p>Finally, you can run the '''serialTest.py''' program in examples to test the loopback function of the serial port. If you can see the following print, it means that the serial port loopback test is normal.</p>
<p>'''Note that the x in /dev/ttySx or /dev/ttyASx in the command needs to be replaced with the serial number of the corresponding uart device node.'''</p>
<p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p>
<p>root@orangepi:~/wiringOP-Python/examples# '''python3 serialTest.py --device &quot;/dev/ttySx&quot; # linux6.1 use'''</p>
<p>root@orangepi:~/wiringOP-Python/examples# '''python3 serialTest.py --device &quot;/dev/ttyASx&quot; # linux5.4 use'''</p>
<p>Out: 0: -&gt; 0</p>
<p>Out: 1: -&gt; 1</p>
<p>Out: 2: -&gt; 2</p>
<p>Out: 3: -&gt; 3</p>
<p>Out: 4:^C</p>
<p>exit</p></li></ol>
<span id="hardware-watchdog-test"></span>== Hardware watchdog test ==DESCRIPTION
The watchdog_test program is pre-installed in the Linux system released : # This file was automatically generated by Orange Pi and can be tested directlySWIG (http://www.swig.org).
The method to run the watchdog_test program is as follows:# Version 4.0.2
<ol style="list-style-type: lower-alpha;"><li><p>The second parameter 10 represents the counting time of the watchdog. If the dog is not fed within this time, the system will restart.</p></li><li><p>We can feed the dog by pressing any key on the keyboard (except ESC). After feeding the dog, the program will print a line &quot;keep alive&quot; to indicate that the dog feeding is successful.</p><p>orangepi@orangepi:~$ '''sudo watchdog_test 10'''</p><p>open success</p><p>options is 33152,identity is sunxi-wdt</p><p>put_usr return,if 0,success:0</p><p>The old reset time is: 16</p><p>return ENOTTY,if -1,success:0</p><p>return ENOTTY,if -1,success:0</p><p>put_user return,if 0,success:0</p><p>put_usr return,if 0,success:0</p><p>keep alive</p><p>keep alive</p><p>keep alive</p></li></ol>#
<span id="check: # Do not make changes to this file unless you know what you are doing-the-chipid-of-h618-chip"></span>== Check the chipid of H618 chip ==modify
The command to view : # the H618 chip chipid is as follows. The chipid of each chip is different, so you can use chipid to distinguish multiple development boardsSWIG interface file instead.
orangepi@orangepi:~$ '''cat /sys/class/sunxi_info/sys_info | grep &quot;chipid&quot;'''
sunxi_chipid : 338020004c0048080147478824681ed1CLASSES
<span id="python-related-instructions"></span>== Python related instructions ==:builtins.object
<span id="how-to-compile-and-install-python-source-code"></span>=== How to compile and install Python source code ===::GPIO
'''If the Python version in the Ubuntu or Debian system software repository you are using does not meet the development requirements and you want to use the latest version of Python, you can use the following method to download the Python source code package to compile and install the latest version of Python.'''::I2C
'''The following demonstration is to compile and install the latest version of Python 3.9. If you want to compile and install other versions of Python, the method is the same (you need to download the source code corresponding to the Python you want to install).'''::Serial
<ol style="list-style-type: decimal;"><li><p>First install the dependency packages needed to compile Python</p><p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y build-essential zlib1g-dev \'''</p><p>'''libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev \'''</p><p>'''libreadline-dev libffi-dev curl libbz2-dev'''</p></li><li><p>Then download the latest version of Python3.9 source code and unzip it</p><p>orangepi@orangepi:~$ '''wget \'''</p><p>[https://www.python.org/ftp/python/3.9.10/Python-3.9.10.tgz '''https://www.python.org/ftp/python/3.9.10/Python-3.9.10.tgz''']</p><p>orangepi@orangepi:~$ '''tar xvf Python-3.9.10.tgz'''</p></li><li><p>Then run the configuration command</p><p>orangepi@orangepi:~$ '''cd Python-3.9.10'''</p><p>orangepi@orangepi:~$ '''./configure --enable-optimizations'''</p></li><li><p>Then compile and install Python3.9. The compilation time takes about half an hour.</p><p>orangepi@orangepi:~$ '''make -j4'''</p><p>orangepi@orangepi:~$ '''sudo make altinstall'''</p></li><li><p>After installation, you can use the following command to check the version number of the Python you just installed.</p><p>orangepi@orangepi:~$ '''python3.9 --version'''</p><p>'''Python 3.9.10'''</p></li><li><p>Then update pip</p><p>orangepi@orangepi:~$ '''/usr/local/bin/python3.9 -m pip install --upgrade pip'''</p></li></ol>nes
<span id="how-to-replace-pip-source-in-python"></span>
=== How to replace pip source in Python ===
'''The default source used by Linux system pip is the official source of Python:class GPIO(builtins. However, accessing the official source of Python in China is very slow, and the installation of Python software packages often fails due to network reasons. So when using pip to install the Python library, please remember to change the pip source.'''object)
<ol style="list-style-type: decimal;"><li><p>First install '''python3-pip'''</p><p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y python3-pip'''</p></li><li><p>How to permanently change the pip source under Linux</p><ol style="list-style-type: lower-alpha;"><li><p>First create a new '''~/.pip''' directory, then add the &gt; '''pip.conf''' configuration file, and set the pip source in it &gt; to Tsinghua source.</p><p>orangepi@orangepi:~$ '''mkdir -p ~/.pip'''</p><p>orangepi@orangepi:~$ '''cat &lt;&lt;EOF &gt; ~/.pip/pip.conf'''</p><p>'''[global]'''</p><p>'''timeout = 6000'''</p><p>'''index-url = https://pypi.tuna.tsinghua.edu.cn/simple'''</p><p>'''trusted-host | GPIO(pinmode= pypi.tuna.tsinghua.edu.cn'''</p><p>'''EOF'''</p></li><li><p>Then use pip3 to install the Python library very quickly</p></li></ol></li><li><p>How to temporarily change the pip source under Linux, where '''&lt;packagename&gt;''' needs to be replaced with a specific package name</p><p>orangepi@orangepi:~$ '''pip3 install &lt;packagename&gt; -i \'''</p><p>'''https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn'''</p></li></ol>0)
<span id="how-to-install-docker"></span>== How to install Docker ==:|
The Linux image provided by Orange Pi has Docker pre-installed, but the Docker service is not turned on by default. Use the '''enable_docker.sh''' script to enable the docker service, and then you can start using the docker command, and the docker service will be automatically started the next time you start the system.
orangepi@orangepi:~$ '''enable_docker.sh'''&gt;&gt;&gt;|}</ol></li></ol><span id="pin-gpio-port-test-1"></span>
You can use the following command to === 40pin GPIO port test docker. If '''hello-world''' can be run, docker can be used normally.===
orangepi@orangepi{| class="wikitable" style="background-color:~$ #ffffdc;width:800px;" |-| <big>'''docker run helloLike wiringOP, wiringOP-worldPython can also determine which GPIO pin to operate by specifying the wPi number. Because there is no command to view the wPi number in wiringOP-Python, you can only view the board's wPi number and physics through the gpio command in wiringOP Correspondence of pins.'''</big>
Unable to find image 'hello[[File:zero2w-world:latest' locallyimg170.png|center]]|}
latest<ol style="list-style-type: Pulling from librarydecimal;"><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.</hello-worldp> 256ab8fe8778<p>[[File: Pull completezero2w-img171.png]]</p></li> Digest<li><p>The steps for testing directly with commands are as follows: sha256:7f0a9f93b4aa3022c3a4c147a449ef11e0941a1fd0bf4a8e6c9408b2600777c5</p> Status<ol style="list-style-type: Downloaded newer image for hellolower-world:latestalpha;"> '''Hello from Docker!''' '''This message shows that your installation appears <li><p>First set the GPIO port to be working correctly.output mode, where the first parameter of the ''' pinMode'''.….''' When using function is the docker command, if you are prompted for '''permission denied''', please add serial number of the current user wPi corresponding to the docker user group so that you can run pin, and the second parameter is the docker command without sudoGPIO mode.</p>{| class="wikitable" style="width:800px;" |-| orangepi<p>root@orangepi:~$ /wiringOP-Python# '''sudo usermod python3 -aG docker $USERc &quot;import wiringpi; \'''</p> <p>'''Note: You need to log out and log in again to the system to take effect. You can also restart the systemfrom wiringpi import GPIO; wiringpi.wiringPiSetup() ; \''' <span id="how-to-install-home-assistant"/p></spanp>== How to install Home Assistant == '''Note that this article will only provide methods for installing Home Assistant in Ubuntu or Debian systemswiringpi. For detailed usage of Home Assistant, please refer to the official documentation or corresponding books.''' pinMode(<span idstyle="installation-via-dockercolor:#FF0000">2, GPIO.OUTPUT</span>) ; &quot;'''</p>=== Installation via docker ===|}<ol style="list-style-type: decimal;"/li><li><p>FirstThen set the GPIO port to output a low level. After setting, please install docker and ensure that docker you can run normally. For use a multimeter to measure the installation steps voltage value of dockerthe pin. If it is 0v, please refer to it means the instructions in the [[\llow level is set successfully.</p>{| class="wikitable" style="width:800px;" |-|<p>root@orangepi:~/wiringOP-Python# '''How to Install Dockerpython3 -c &quot;import wiringpi; \''']] section.</p></li><li><p>Then you can search for the docker image of Home Assistant'''from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\'''</p><p>orangepi@orangepi:~$ '''docker search homeassistantwiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.LOW</span>)&quot;'''</p>|}</li><li><p>Then set the GPIO port to output a high level. After setting, you can use the following command a multimeter to download measure the Docker image voltage value of Home Assistant to your local computerthe pin. The image size If it is about 1GB3.3v, and it means the download time will be relatively long. Please be patient and wait for setting of the download to completehigh level is successful.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepiroot@orangepi:~$ /wiringOP-Python# '''docker pull homeassistant/homepython3 -assistantc &quot;import wiringpi; \'''</p><p>Using default tag: latest'''from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\'''</p><p>latest'''wiringpi.digitalWrite(2, <span style="color: Pulling from homeassistant#FF0000">GPIO.HIGH</home-assistantspan>)&quot;'''</p>|}</li></ol></li><li><p>be307f383eccThe steps for testing in the command line of python3 are as follows: Downloading</p><ol style="list-style-type: lower-alpha;"><li><p>5fbc4c07ac88: Download completeFirst use the python3 command to enter the command line mode of python3</p>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~# '''...... (Omit some output)python3'''</p>|}<p/li>3cc6a1510c9f: Pull complete</pli><p>7a4e4d5b979f: Pull completeThen import the python module of wiringpi</p><p>Digest{| class="wikitable" style="width: sha256:81d381f5008c082a37da97d8b08dd8b358dae7ecf49e62ce3ef1eeaefc4381bb</p>800px;" |-| <p>Status: Downloaded newer image for homeassistant/home-assistant:latest&gt;&gt;&gt; '''import wiringpi'''</p><p>docker.io/homeassistant/home-assistant:latest&gt;&gt;&gt; '''from wiringpi import GPIO'''</p>|}</li><li><p>Then you can use set the following command GPIO port to view output mode, where the docker image first parameter of Home Assistant you just downloadedthe '''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>orangepi@orangepi:~$ &gt;&gt;&gt; '''docker images homeassistant/home-assistantwiringpi.wiringPiSetup()'''</p><p>REPOSITORY TAG IMAGE ID CREATED SIZE0</p><p>homeassistant/home-assistant latest bfa0ab9e1cf5 2 months ago &gt;&gt;&gt; '''1wiringpi.pinMode(<span style="color:#FF0000">2, GPIO.17GBOUTPUT</span>)'''</p>|}</li><li><p>At this point Then set the GPIO port to output a low level. After setting, you can run use a multimeter to measure the Home Assistant docker containervoltage value of the pin. If it is 0v, it means the low level is set successfully.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ &gt;&gt;&gt; '''docker run -d \wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.LOW</span>)'''</p>|}</li><li><p>'''--name homeassistant \'''Then set the GPIO port to output a high level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 3.3v, it means the setting of the high level is successful.</p>{| class="wikitable" style="width:800px;" |-| <p>&gt;&gt;&gt; '''--privileged \wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.HIGH</span>)'''</p>|}</li></ol></li><li><p>For wiringOP-Python to set the GPIO high and low levels in the python code, you can refer to the '''--restart=unless-stopped \blink.py'''</p><p>test program in the examples. The '''-e TZ=Asia/Shanghai \blink.py'''test program will set the voltage of all GPIO ports in the 40 Pin of the development board to continuously change high and low.</p>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP-Python# '''-v /home/orangepi/home-assistant:/config \cd examples'''</p><p>root@orangepi:~/wiringOP-Python/examples# '''--network=host \ls blink.py'''</p><p>'''homeassistant/home-assistant:latestblink.py'''</p></li><li><p>Then enter【the IP address of the development boardroot@orangepi: 8123】in the browser to see the Home Assistant interface<~/wiringOP-Python/p><p>examples'''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# python3 blink.py'''</p>|}<div class="figure"/li></ol>
[[File:zero2w<span id="pin-img180.png]]spi-test-1"></span>
</div></li><li><p>Then enter your '''name, username''' and '''password''' and click '''Create Account'''</p><div class="figure">== 40pin SPI test ===
[[File:zero2w-img181.png]]# As can be seen from the table below, the spi available for the 40pin interface is spi1, and there are two chip select pins cs0 and cs1
</div></listyle="display: flex;"><li><p>Then follow the interface prompts to set according to your own preferences, and then click Next</p><div ::{| class="figurewikitable" style="> [[Filewidth:zero2w390px;margin-right: 20px;text-img182align: center;"|-| '''GPIO NO.png]]'''| '''GPIO'''</div></li>| '''Function'''| '''Pin'''<li><p>Then click Next</p>|-<div class| style="figuretext-align: left;">|| style="text-align: left;"|[[File:zero2w-img183| '''3.png]]3V'''| '''1'''</div></li><li><p>Then click Finish</p>|-<div class="figure">| '''264'''| '''PI8'''[[File:zero2w| '''TWI1-img184.png]]SDA'''| '''3'''</div></li>|-<li><p>The main interface finally displayed by Home Assistant is as shown below</p>| '''263'''<p>[[File:zero2w-img185.png]]</p></li>| '''PI7'''<li><p>Method to stop Home Assistant container</p>| '''TWI1-SCL'''<ol style="list-style-type: lower| '''5'''|-alpha;"><li><p>The command to view the docker container is as follows</p><p>orangepi@orangepi:~$ | '''docker ps -a269'''| '''PI13'''</p></li><li><p>The command to stop the Home Assistant container is as follows<| '''PWM3/p>UART4_TX'''<p>orangepi@orangepi:~$ | '''docker stop homeassistant7'''</p></li><li><p>The command to delete the Home Assistant container is as follows</p>|-<p>orangepi@orangepi| style="text-align:~$ '''docker rm homeassistant'''</p></li></ol>left;"|</li></ol> <span id| style="installationtext-via-pythonalign: left;"></span>=== Installation via python ===|| '''GND'''| '''Before installation, please change the source of pip to a domestic source to speed up the installation of Python packages. For the configuration method, see the instructions in the section &quot;[[\l|How to Change the Pip Source of Python]]&quot;9'''|-<ol style="list-style-type: decimal;">| '''226'''<li><p>First install dependency packages</p><p>orangepi@orangepi:~$ | '''sudo apt-get updatePH2'''</p><p>orangepi@orangepi:~$ | '''sudo apt-get install -y python3 python3-dev python3-venv \UART5_TX'''</p><p>| '''python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \11'''</p><p>|-| '''libopenjp2-7 libtiff5 libturbojpeg0-dev tzdata227'''</p><p>| '''If it is debian12, please use the following command:PH3'''</p><p>orangepi@orangepi:~$ | '''sudo apt-get updateUART5_RX'''</p><p>orangepi@orangepi:~$ | '''13'sudo apt-get install -y python3 python3-dev python3-venv \'''</p><p>|-| '''python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \261'''</p><p>| '''libopenjp2-7 libturbojpeg0-dev tzdataPI5'''</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 methodTWI0_SCL/UART2_TX''']] section.</p><p>| '''The default Python version of Debian Bullseye is Python3.9, so there is no need to compile and install it.15'''</p><p>|-| style="text-align: left;"|| style="text-align: left;"|| '''The default Python version of Ubuntu Jammy is Python3.10, so there is no need to compile and install it3.3V'''</p><p>| '''17'''The default Python version of Debian Bookworm is Python3.11, so there is no need to compile and install it.|-| '''</pspan style="color:#FF0000">231</lispan>'''| '''<lispan style="color:#FF0000"><p>Then create a Python virtual environmentPH7</p><pspan>'''Debian Bookworm is python3.11, please remember to replace the corresponding command.| '''</pspan style="color:#FF0000">SPI1_MOSI<p/span>orangepi@orangepi:~$ '''sudo mkdir /srv/homeassistant| '''</pspan style="color:#FF0000">19<p/span>orangepi@orangepi:~$ '''sudo chown orangepi:orangepi /srv/homeassistant|-| '''</p>span style="color:#FF0000">232<p/span>orangepi@orangepi:~$ '''cd /srv/homeassistant| '''</pspan style="color:#FF0000">PH8<p/span>orangepi@orangepi:~$ '''python3.9 -m venv .| '''</pspan style="color:#FF0000">SPI1_MISO<p/span>orangepi@orangepi:~$ '''source bin/activate| '''</pspan style="color:#FF0000">21<p>(homeassistant) orangepi@orangepi:/srv/homeassistant$</pspan></li><li><p>Then install the required Python packages</p><p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ '''python3 |-m pip install wheel| '''</pspan style="color:#FF0000">230</lispan>'''| '''<li><pspan style="color:#FF0000">Then you can install Home Assistant CorePH6</p><pspan>(homeassistant) orangepi@orangepi:/srv/homeassistant$ '''pip3 install homeassistant| '''</p></lispan style="color:#FF0000"><li><p>Then enter the following command to run Home Assistant CoreSPI1_CLK</p><pspan>(homeassistant) orangepi@orangepi:/srv/homeassistant$ '''hass| '''</pspan style="color:#FF0000">23</lispan><li><p>Then enter【'''development board IP address'|-| style="text-align: 8123'''】 in the browser to see the Home Assistant interface</p>left;"|<p>'| style="text-align: left;"|| '''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.GND'''</p><div class="figure">| '''25'''|-[[File:zero2w-img180.png]]| '''266'''| '''PI10'''<| '''TWI2-SDA/div></li></ol>UART3_RX'''| '''27'''<span id="opencv-installation|-method"></span>== OpenCV installation method ==| '''256'''| '''PI0'''<span id| style="usetext-apt-to-install-opencvalign: left;"></span>|| '''29'''=== Use apt to install OpenCV ===|-| '''271'''<ol style="list-| '''PI15'''| style="text-typealign: decimalleft;">|<li><p>The installation command is as follows</p><p>orangepi@orangepi:~$ | '''sudo apt-get update31'''</p><p>orangepi@orangepi:~$ |-| '''sudo apt-get install -y libopencv-dev python3-opencv268'''</p></li><li><p>Then use the following command to print the version number of OpenCV. The output is normal, indicating that the OpenCV installation is successful.</p>| '''PI12'''<ol style="list-style-type: lower-alpha;"><li><p>The version of OpenCV in Ubuntu22.04 is as follows:</p><p>orangepi@orangepi:~$ | ''''python3 -c &quot;import cv2; print(cv2.__version__)&quot;PWM2'''</p><p>| '''4.5.433'''</p></li><li><p>The version of OpenCV in Ubuntu20.04 is as follows:</p><p>orangepi@orangepi:~$ |-| '''''python3 -c &quot;import cv2; print(cv2.__version__)&quot;258'''</p><p>| '''4.2.0PI2'''</p></li><li><p>The version of OpenCV in Debian11 is as follows| style="text-align:</p>left;"|<p>orangepi@orangepi:~$ | '''35''python3 -c &quot;import cv2; print(cv2.__version__)&quot;'|-| '''272'''</p><p>| '''4.5.1PI16'''</p></li><li><p>The version of OpenCV in Debian12 is as follows| style="text-align:</p>left;"|<p>orangepi@orangepi:~$ | '''python3 -c &quot;import cv2; print(cv2.__version__)&quot;37'''</p><p>|-| style="text-align: left;"|| style="text-align: left;"|| '''4.6.0GND'''</p></li></ol></li></ol>| '''39'''|}<span id{| class="set-upwikitable" style="width:390px;margin-theright: 20px;text-chinese-environment-and-install-the-chinese-input-methodalign: center;"></span>== Set up the Chinese environment and install the Chinese input method ==|-| '''Note, before installing the Chinese input method, please make sure that the Linux system used by the development board is a desktop version.Pin'''| '''Function'''<span id="debian-system-installation-method"></span>| '''GPIO'''=== Debian system installation method ===| '''GPIO NO.''' <ol style="list-style|-type: decimal;"><li><p>First set the default | '''locale2'''| '''5V''' to Chinese</p><ol | style="listtext-align: left;"|| style="text-typealign: lower-alphaleft;">||-<li><p>Enter the following command to start configuring | '''locale4'''</p><p>orangepi@orangepi:~$ | '''sudo dpkg-reconfigure locales5V'''</p></li><li><p>Then select '''zh_CN.UTF| style="text-8 UTFalign: left;"|| style="text-align: left;"||-8| ''' in the pop-up interface (use &gt; the up and down keys on the keyboard to move up and down, use &gt; the space bar to select, and finally use the Tab key to move &gt; the cursor to 6'''&lt;OK&gt;| '''GND''', and then return Car can be used)</p><p>[[File| style="text-align:zero2w-img186.png]]</p></li>left;"|<li><p>Then set the default | style="text-align: left;"||-| '''locale8''' to | '''zh_CN.UTF-8UART0_TX'''</p><p>[[File:zero2w-img187.png]]</p></li><li><p>After exiting the interface, the | '''PH0'''locale| ''' setting will begin. &gt; The output displayed on the command line is as follows:</p><p>orangepi@orangepi:~$ 224'''sudo dpkg|-reconfigure locales| '''10'''</p><p>Generating locales (this might take a while)...</p>| '''UART0_RX'''<p>en_US.UTF-8... done</p>| '''PH1'''| '''225'''<p>zh_CN.UTF|-8... done</p><p>Generation complete.</p></li></ol></li><li><p>Then open | '''Input Method12'''</p><p>[[File| style="text-align:zero2w-img188.png]]</p></li>left;"|<li><p>Then select | '''OKPI1'''</p><p>[[File:zero2w-img189.png]]</p></li>| '''257'''|-<li><p>Then select | '''Yes14'''</p><p>[[File:zero2w-img190.png]]</p></li><li><p>Then select '''fcitx''| '''GND'''</p><p>[[File| style="text-align:zero2w-img191.png]]</p></li>left;"|| style="text-align: left;"||-<li><p>Then select | '''OK16'''</p><p>[[File:zero2w-img192.png]]</p></li><li><p>| '''Then restart the Linux system to make the configuration take effect.PWM4/UART4_RX'''</p></li><li><p>Then open | '''Fcitx configurationPI14'''| '''270'''</p><p>[[File:zero2w|-img193.png]]</p></li><li><p>Then click the + sign as shown in the picture below</p>| '''18'''<p>[[File| style="text-align:zero2w-img194.png]]</p></li>left;"|<li><p>Then search | '''Google PinyinPH4''' and click | '''OK228'''</p><div class="figure"> [[File:zero2w|-img195.png]]| '''20'''</div></li><li><p>Then put '| '''GND'Google Pinyin''' on top</p><p>[[File:zero2w| style="text-img196.png]]</p><p>[[Filealign:zero2wleft;"|| style="text-align: left;"||-img197.png]]</p></li><li><p>Then open the | '''Geany22''' editor to test the Chinese input method<| '''TWI0_SDA/p>UART2_RX'''<p>[[File:zero2w-img198.png]]</p></li>| '''PI6'''| '''262'''|-| '''<li><pspan style="color:#FF0000">The Chinese input method test is as follows24</pspan>'''| '''<p>[[Filespan style="color:zero2w-img199.png]]</p#FF0000">SPI1_CS0</lispan>'''| '''<lispan style="color:#FF0000">PH5<p/span>You can switch between Chinese and English input methods through the '''Ctrl+Space| ''' shortcut key</pspan style="color:#FF0000">229</lispan>'''|-| '''<lispan style="color:#FF0000">26<p/span>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| '''</pspan style="color:#FF0000">SPI1_CS1<p/span>orangepi@orangepi:~$ '''sudo vim /etc/default/locale| '''</pspan style="color:#FF0000"><p># File generated by update-localePH9</p><pspan>LC_MESSAGES='''zh_CN.UTF-8| '''</pspan style="color:#FF0000">233<p/span>LANG='''zh_CN.UTF|-8| '''28'''</p><p>LANGUAGE=| '''zh_CN.UTFTWI2-8SCL/UART3_TX'''</p></li><li><p>Then | '''PI9'''| '''restart the system265''' and you will see that the system is displayed in Chinese.</p><p>[[File:zero2w|-img200.png]]</p></li></ol>| '''30'''<span id| '''GND'''| 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 Support32'''</p><p>[[File:zero2w-img201.png]]</p></li>| '''PWM1'''<li><p>Then find the | '''Chinese (China)PI11''' option</p><p>[[File:zero2w| '''267'''|-img202.png]]</p></li><li><p>Then please use the left button of the mouse to select | '''Chinese (China)34''' and hold it down, then drag it up to the starting position. After dragging, the display will be as shown below:</p><p>[[File:zero2w-img203.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="list-styletext-typealign: decimalleft;">|<li><p>Then select | style="text-align: left;"||-| '''Apply System-Wide36''' to apply the Chinese settings to the entire system</p><p>[[File| style="text-align:zero2w-img204.png]]</p></li>left;"|<li><p>Then set the | '''Keyboard input method systemPC12''' system to | '''fcitx76'''</p><p>[[File:zero2w|-img205.png]]</p></li><li><p>| '''Then restart the Linux system to make the configuration take effect38'''</p></li><li><p>After re| style="text-entering the system, please select '''Do not ask me againalign: left;"|| '''PI4'''| '''260''' in the following interface, and then please decide according to your own preferences whether the standard folder should also be updated to Chinese</p><p>[[File:zero2w|-img206.png]]</p></li><li><p>Then you can see that the desktop is displayed in Chinese</p><p>[[File:zero2w-img207.png]]</p></li><li><p>Then we can open | '''Geany40''' to test the Chinese input method. The opening method is as shown in the figure below</p><p>[[File| style="text-align:zero2w-img208.png]]</p></li>left;"|<li><p>After opening | '''GeanyPI3''', the English input method is still the default. We can switch to the Chinese input method through the | '''Ctrl+Space259''' shortcut key, and then we can input Chinese.|}</pdiv><p>[[File:zero2w-img209.png]]</p></li></ol> <span id="installation-method-of-ubuntu-22.04-system"></span>=== Installation method of Ubuntu 22.04 system ===
<ol start="2" style="list-style-type: decimal;"><li><p>In Linux systems, spi1 is turned off by default and needs to be turned on manually before it can be used. The opening steps are as follows:</p><ol style="list-style-type: lower-alpha;"><li><p>First open run '''orangepi-config'''. Ordinary users remember to add '''Language Supportsudo'''permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>[[Fileorangepi@orangepi:zero2w~$ '''sudo orangepi-img201.png]]config'''</p>|}</li><li><p>Then find the select '''Chinese (China)System''' option</p><p>[[File:zero2w-img210img80.png]]</p></li><li><p>Then please use the left button of the mouse to select '''Chinese (China)Hardware''' and hold it down, then drag it up to the starting position. After dragging, the display will be as shown below:</p><p>[[File:zero2w-img211img81.png]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown in the figure below, and then use the '''space''' to select the dtbo configuration of the SPI you want to open.</p></olli>
{| class="wikitable" style="width:800px;text-align: center;"|-| '''dtbo configuration'''| '''illustrate'''|-| '''spi1-cs0-cs1-spidev'Note that this step is not easy to drag, please be patient ''| '''Open cs0 and try it a few times.cs1 of spi1 at the same time'''|-| '''spi1-cs0-spidev'''| '''Only open cs0 of spi1'''|-| '''spi1-cs1-spidev'''| '''Only open cs1 of spi1'''|}</ol><ol start="45" style="list-style-type: decimallower-alpha;"><li><p>Then select '''Apply System-Wide&lt;Save&gt;''' to apply the Chinese settings to the entire systemsave</p><p>[[File:zero2w-img212img83.png]]</p></li><li><p>Then select '''Then restart the Linux system to make the configuration take effect&lt;Back&gt;'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>After re-entering the system, please Then select '''Do not ask me again&lt;Reboot&gt;''' in to restart the following interface, and then please decide whether system to make the standard folder should also be updated to Chinese according to your own preferencesconfiguration take effect.</p><p>[[File:zero2w-img206img85.png]]</p></li></ol></li></ol><!-- --><ol start="3" style="list-style-type: decimal;"><li><p>Then you can see check whether there is a '''spidev1.x''' device node in the Linux system. If it exists, it means that the desktop is displayed in ChineseSPI1 configuration has taken effect.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''ls /dev/spidev1*'''</p><p>[[File/dev/spidev1.0 /dev/spidev1.1</p>|}{| class="wikitable" style="background-color:#ffffdc;width:zero2w800px;" |-| <big><p>'''Note that only when you open spi1-cs0-cs1-img207spidev, you will see the device nodes of the two spi.png]]'''</p></big>|}</li><li><p>Then open you can use the '''spidev_test.py''' program in examples to test the Fcitx5 configuration SPI loopback function. The '''spidev_test.py''' programneeds to specify the following two parameters:</p><ol style="list-style-type: lower-alpha;"><li><p>[[File'''--channel''':zero2wSpecify the channel number of SPI</p></li><li><p>'''--img213.png]]port''': Specify the port number of the SPI</p></li></ol></li><li><p>Then choose to use Pinyin input methodWithout 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><div {| class="figurewikitable" style="width:800px;"|-| <p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p>
[[Fileroot@orangepi:zero2w~/wiringOP-img214Python/examples# '''python3 spidev_test.png]]py \'''
</div></li><li><p>The interface after selection is as shown below, then click OK</p><p>[[File:zero2w-img215.png]]</p></li><li><p>Then we can open '''Geany''' to test the Chinese input method. The opening method is as shown in the figure below</p><p>[[File:zero2w-img208.png]]</p></li><li><p>After opening '-channel 1 --port 0''Geany''', the English input method is still the default. We can switch to the Chinese input method through the '''Ctrl+Space''' shortcut key, and then we can enter Chinese.</p><p>[[File:zero2w-img216.png]]</p></li></ol>
<span id="how-to-remotely-log-in-to-the-linux-system-desktop"></span>== How to remotely log in to the Linux system desktop ==spi mode: 0x0
<span id="remote-login-using-nomachine"></span>=== Remote login using NoMachine ===max speed: 500000 Hz (500 KHz)
'''Please ensure that the Ubuntu or Debian system installed on the development board is a desktop version of the systemOpening device /dev/spidev1. In addition, NoMachine also provides detailed usage documentation. It is strongly recommended to read this document thoroughly to become familiar with the use of NoMachine. The document link is as follows:'''1
TX | FF FF FF FF FF FF '''https<span style="color:#FF0000">40 00 00 00 00 95<//knowledgebase.nomachine.com/DT10R00166span>'''FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…|
RX | FF FF FF FF FF FF '''NoMachine supports Windows, Mac, Linux, iOS and Android platforms, so we can remotely log in and control the Orange Pi development board through NoMachine on a variety of devices. The following demonstrates how to remotely log in to the Linux system desktop of the Orange Pi development board through NoMachine in Windows. For installation methods on other platforms, please refer to NoMachine's official documentation.''' '''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.''' <ol span style="list-style-typecolor: decimal;#FF0000"><li><p>First download the installation package of the NoMachine software Linux '''arm64''' deb version, and then install it into the Linux system of the development boardFF FF FF FF FF FF</p><ol style="list-style-type: lower-alpha;"><lispan>Since H618 is an ARMv8 architecture SOC and the system we use is &gt; Ubuntu or Debian, we need to download the '''NoMachine for ARM &gt; ARMv8 DEB''' installation packageFF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF |.............…. The download link is as &gt; follows:</li></ol>||}
</li></ol>
<ol start="6" style="list-style-type: decimal;">
<li><p>Then use Dupont wire to short-circuit the txd (pin 19 in the 40pin interface) and rxd (pin 21 in the 40pin interface) of SPI1 and then run spidev_test.py. The output is as follows, you can see If the data sent and received are the same, it means that the SPI1 loopback test is normal.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p>
root@orangepi:~/wiringOP-Python/examples# '''Note that this download link may change, please look for the Armv8/Arm64 version of the deb packagepython3 spidev_test.py \'''
[https://www.nomachine.com/download/download&id=112&s=ARM '''https://downloads.nomachine.com/download/?id=118&amp;distro=ARM--channel 1 --port 0''']
[[Filespi mode:zero2w-img217.png]]0x0
<ol start="2" style="list-style-typemax speed: lower-alpha;"><li><p>In addition, you can also download the '''NoMachine''' installation &gt; package from the official tool.</p><p>[[File:zero2w-img218.png]]</p><p>First enter the '''remote login software-NoMachine''' folder</p><p>[[File:zero2w-img219.png]]</p><p>Then download the arm64 version of the deb installation package</p><p>[[File:zero2w-img220.png]]</p></li><li><p>Then upload the downloaded '''nomachine_x.x.x_x_arm64.deb''' to the &gt; Linux system of the development board</p></li><li><p>Then use the following command to install '''NoMachine''' in the Linux &gt; system of the development board</p><p>orangepi@orangepi:~$ '''sudo dpkg -i nomachine_x.x.x_x_arm64_arm64.deb'''</p></li></ol>500000 Hz (500 KHz)
<!-- --><ol start="2" style="list-style-type: decimal;"><li>Then download the installation package of the Windows version of the NoMachine software. The download address is as follows<Opening device /li><dev/ol>spidev1.1
TX | FF FF FF FF FF FF '''Note that this download link may change.<span style="color:#FF0000">40 00 00 00 00 95</span>'''FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…|
RX | FF FF FF FF FF FF '''https<span style="color:#FF0000">40 00 00 00 00 95<//downloadsspan>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@......nomachine.com…||}</downloadli></?ol><span id=9'''"pin-i2c-test-1"></span>
[[File:zero2w-img221.png]]=== 40pin I2C test ===
<ol start="3" style="list-style-type: decimal;"><li><p>Then install NoMachine in Windows. '''Please restart your computer after installation.'''</p></li><li><p>Then open '''NoMachine''' in Window</p><p>[[File:zero2w-img222.png]]</p></li><li><p>After NoMachine is started, it will automatically scan other devices with NoMachine installed on the LAN. After entering the main interface of NoMachine, you # As can see that be seen from the development board is already in the list of connectable devicestable below, and then click on the location shown in i2c available for 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 below40pin interface are i2c0, i2c1 and then click OK to start logging in.</p><p>[[File:zero2w-img225.png]]</p></li><li><p>Then click OK in the next interface.</p></li><li><p>Finally you can see the desktop of the development board Linux system</p><p>[[File:zero2w-img226.png]]</p></li></ol>i2c2
<span iddiv style="remote-login-using-vncdisplay: flex;"></span>::{| class="wikitable" style== Remote login using VNC ==="width:390px;margin-right: 20px;text-align: center;"|-| '''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 normallyGPIO NO.'''| '''GPIO'''| '''Function'''| '''There are many problems with VNC testing in Ubuntu20.04, please do not use this method.Pin'''|-<ol | style="listtext-style-typealign: decimalleft;">|<li><p>First run the | style="text-align: left;"|| '''set_vnc3.sh3V''' script to set up vnc, | '''remember to add sudo permission1'''s</p><p>orangepi@orangepi:~$ '''sudo set_vnc.sh|-| '''</pspan style="color:#FF0000"><p>You will require a password to access your desktops.264</p><pspan>Password: '''#Set the vnc password here, 8 characters| '''</pspan style="color:#FF0000">PI8<p/span>Verify: '''#Set the vnc password here, 8 characters| '''</pspan style="color:#FF0000">TWI1-SDA<p/span>Would you like to enter a view-only password (y/n)? '''n| '''</p><pspan style="color:#FF0000">xauth: file /root/.Xauthority does not exist3</pspan>'''|-<p>New | ''X' desktop is orangepi<span style="color:1#FF0000">263</pspan>'''| '''<pspan style="color:#FF0000">Creating default startup script /root/.vnc/xstartupv</pspan>'''| '''<p>Starting applications specified in /root/.vnc/xstartupspan style="color:#FF0000">TWI1-SCL</pspan>'''| '''<pspan style="color:#FF0000">Log file is 5</root/.vnc/orangepi:1.log</pspan>'''<p>Killing Xtightvnc process ID 3047</p>|-<p>New | '''269''X' desktop is orangepi:1</p><p>Starting applications specified in | '''PI13'''| '''PWM3/root/.vnc/xstartup</p>UART4_TX'''<p>Log file is /root/.vnc/orangepi:1.log</p></li>| '''7'''<li><p>The steps to use MobaXterm software to connect to the development board Linux system desktop are as follows:</p>|-<ol | style="listtext-style-typealign: lower-alphaleft;">|<li>First click Session, then select VNC, then fill in the IP &gt| style="text-align: left; address and port of the development board, and finally click &gt; OK to confirm.</li></ol></li></ol>"|| '''GND'''<div class="figure">| '''9'''[[File:zero2w|-img227.png]]| '''226'''</div>| '''PH2'''| '''UART5_TX'''<ol start="2" style="list-style| '''11'''|-type: lower-alpha;"><li><p>Then enter the VNC password set earlier</p>| '''227'''<p>[[File:zero2w-img228.png]]</p></li>| '''PH3'''| '''UART5_RX'''<li><p>After successful login, the interface is displayed as shown below, &gt; and then you can remotely operate the desktop of the development &gt; board Linux system.</p></li></ol>| '''13''' [[File:zero2w|-img229.png]] | '''<span idstyle="qt-installation-methodcolor:#FF0000">261</span>'''== QT installation method == | '''<ol span style="list-style-typecolor: decimal;#FF0000"><li><p>Use the following script to install QT5 and QT CreatorPI5</p><pspan>orangepi@orangepi:~$ '''install_qt.sh| '''</pspan style="color:#FF0000">TWI0_SCL</li><li><pspan>After installation, the QT version number will be automatically printed.</p>UART2_TX'''| '''<ol span style="list-style-typecolor: lower-alpha;#FF0000">15<li/span><p>The qt version that comes with Ubuntu20.04 is '''5.12.8'''</p><p>orangepi@orangepi|-| style="text-align:~$ 'left;"|| style="text-align: left;"|| ''install_qt'3.sh3V'''</p><p>......</p>| '''17'''<p>QMake version 3.1</p>|-<p>Using Qt version | '''231'''5.12.8| '''PH7''' in /usr/lib/aarch64-linux-gnu</p></li><li><p>The QT version that comes with Ubuntu22.04 is | '''5.15.3SPI1_MOSI'''</p><p>orangepi@orangepi:~$ | '''install_qt.sh19'''</p><p>......</p>|-<p>QMake version 3.1</p><p>Using Qt version | '''232'5.15.3''' in /usr/lib/aarch64-linux-gnu</p></li><li><p>The QT version that comes with Debian11 is | '''5.15.2PH8'''</p><p>orangepi@orangepi:~$ | '''SPI1_MISO'''| '''install_qt.sh21'''</p><p>......</p>|-<p>QMake version 3.1</p>| '''230'''<p>Using Qt version | '''PH6''5.15.2'| '' in /usr/lib/aarch64-linux-gnu</p></li><li><p>The QT version that comes with Debian12 is '''5.15.8SPI1_CLK'''</p><p>orangepi@orangepi:~$ | '''install_qt.sh23'''</p><p>......</p>|-<p>QMake version 3.1</p>| style="text-align: left;"|<p>Using Qt version | style="text-align: left;"|| '''GND'''| '''5.15.825''' in /usr/lib/aarch64|-linux-gnu| '''</pspan style="color:#FF0000">266</li></ol></li><li><pspan>Then you can see the QT Creator startup icon in '''Applications| '''</p><p>[[Filespan style="color:zero2w-img230.png]]</p><p#FF0000">You can also use the following command to open QT CreatorPI10</pspan><p>orangepi@orangepi:~$ '''qtcreator| '''<span style="color:#FF0000">TWI2-SDA</p></lispan>/UART3_RX'''| '''<li><pspan style="color:#FF0000">The interface after QT Creator is opened is as follows27</pspan>'''<p>[[File:zero2w|-img231.png]]</p></li><li><p>The version of QT Creator is as follows</p>| '''256'''<ol style=| '''PI0'''| style="list-styletext-typealign: lower-alphaleft;">|<li><p>The default version of QT Creator in | '''Ubuntu20.0429''' is as &gt; follows</p><p>[[File:zero2w|-img232.png]]</p></li><li><p>The default version of QT Creator in | '''271'''| '''Ubuntu22.04PI15''' is as &gt; follows</p><p>[[File| style="text-align:zero2w-img233.png]]</p></li>left;"|<li><p>The default version of QT Creator in | '''Debian1131''' is as follows</p><p>[[File:zero2w|-img234.png]]</p></li><li><p>The default version of QT Creator in | '''Debian12268''' is as follows</p><p>[[File:zero2w-img235.png]]</p></li></ol>| '''PI12'''</li>| '''PWM2'''<li><p>Then set up QT</p>| '''33'''<ol style="list-style-type: lower|-alpha;"><li><p>First open | '''258'''| '''HelpPI2'''| style="text-&gtalign: left;"|| '''About Plugins...35'''.</p><p>[[File:zero2w-img236.png]]</p></li>|-<li><p>Then remove the check mark of | '''ClangCodeModel272'''</p><p>[[File:zero2w-img237.png]]</p></li>| '''PI16'''| style="text-align: left;"|<li><p>| '''After setting up, you need to restart QT Creator37'''</p></li><li><p>Then make sure the GCC compiler used by QT Creator. If the &gt|-| style="text-align: left;"|| style="text-align: left; default is Clang, please change it to GCC.</p>"|<p>| '''Debian12 please skip this step.GND'''</p><p>[[File| '''39'''|}{| class="wikitable" style="width:zero2w390px;margin-img238.png]]</p><p>[[Fileright:zero2w20px;text-img239.png]]</p></li></ol>align: center;"</li>|-<li><p>Then you can open a sample code</p>| '''Pin'''| '''Function'''<p>[[File:zero2w-img240.png]]</p></li>| '''GPIO'''<li><p>After clicking on the sample code, the corresponding instruction document will automatically open| '''GPIO NO. You can read the instructions carefully.</p>'''<p>[[File:zero2w|-img241.png]]</p></li><li><p>Then click | '''Configure Project2'''| '''5V'''</p><p>[[File| style="text-align:zero2wleft;"|| style="text-img242.png]]</p></li><li><p>Then click the green triangle in the lower align: 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>| '''4'''| '''5V'''<p>[[File| style="text-align:zero2wleft;"|| style="text-img244.png]]</p></li>align: left;"|<li><p>References</p>|-<p>[https://wiki.qt.io/Install_Qt_5_on_Ubuntu | ''''https://wiki.qt.io/Install_Qt_5_on_Ubuntu6''']</p><p>[https://download.qt.io/archive/qtcreator | '''https://download.qt.io/archive/qtcreatorGND''']</p><p>[https| style="text-align: left;"|| style="text-align://download.qt.io/archive/qt left;"||-| '''https://download.qt.io/archive/qt8''']</p></li></ol>| '''UART0_TX'''<span id="ros-installation-method"></span>| '''PH0'''== ROS installation method ==| '''224'''|-<span id="how-to-install-ros-1-noetic-on-ubuntu20.04"></span>| '''10'''=== How to install ROS 1 Noetic on Ubuntu20.04 ===| '''UART0_RX'''| '''PH1'''# The currently active version of ROS 1 is as follows, the recommended version is | '''Noetic Ninjemys225''' [[File:zero2w|-img245.png]]| '''12'''[[File:zero2w| style="text-img246.png]]align: left;"|[http://docs.ros.org/ | '''http://docs.ros.orgPI1'''] | '''https://wiki.ros.org/Distributions257'''|-<ol start| '''14'''| '''GND'''| style="2text-align: left;" || style="list-styletext-typealign: decimalleft;">||-<li><p>The link to the official installation documentation of ROS 1 | '''Noetic Ninjemys16''' is as follows:</p><p>[http://wiki.ros.org/noetic/Installation/Ubuntu | '''http:PWM4//wiki.ros.org/noetic/Installation/UbuntuUART4_RX'''| '''PI14''']</p></li><li><p>In the official installation documentation of ROS | '''Noetic Ninjemys270''', Ubuntu recommends using Ubuntu20.04, so please ensure that the system used by the development board is |-| '''Ubuntu20.04 desktop system18'''.</p><p>[http| style="text-align://wiki.ros.org/noetic/Installation left;"|| '''http://wiki.ros.org/noetic/InstallationPH4''']</p><p>[[File:zero2w-img247.png]]</p></li>| '''228'''<li><p>Then use the script below to install ros1</p>|-<p>orangepi@orangepi:~$ | '''install_ros.sh ros120'''</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.GND'''| 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.'''| style="text-align: left;"||-| '''https<span style="color:#FF0000">22<//raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yamlspan>''' | '''Hit https<span style="color:#FF0000">TWI0_SDA</span>/raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml''UART2_RX''| '''ERROR: error loading sources list<span style="color:#FF0000">PI6</span>''' | '''The read operation timed out''<span style="color:#FF0000">262</span>'''|-orangepi@orangepi:~$ | '''source /opt/ros/noetic/setup.bash24'''| '''SPI1_CS0'''orangepi@orangepi:~$ | '''sudo rosdep initPH5'''| '''229'''Wrote /etc/ros/rosdep/sources.list.d/20|-default.list| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''<span style="color:#FF0000">28</span>'''| '''<span style="color:#FF0000">TWI2-SCL</span>/UART3_TX'''| '''<span style="color:#FF0000">PI9</span>'''| '''<span style="color:#FF0000">265</span>'''|-| '''30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''32'''| '''PWM1'''| '''PI11'''| '''267'''|-| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''36'''| style="text-align: left;"|| '''PC12'''| '''76'''|-| '''38'''| style="text-align: left;"|| '''PI4'''| '''260'''|-| '''40'''| style="text-align: left;"|| '''PI3'''| '''259'''|}</div>
Recommended<ol start="2" style="list-style-type: please decimal;"><li><p>i2c is turned off by default in Linux systems and needs to be turned on manually to use it. The opening steps are as follows:</p><ol style="list-style-type: lower-alpha;"><li><p>First run'''orangepi-config'''. Ordinary users remember to add '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li><li><p>Then select '''System'''</p><p>[[File:zero2w-img80.png]]</p></li><li><p>Then select '''Hardware'''</p><p>[[File:zero2w-img81.png]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown in the picture below, and then use the '''space''' to select the corresponding i2c configuration in the picture below.</p></li>
rosdep update{| class="wikitable" style="width:800px;text-align: center;"|-| '''Multiplexing function in 40pin'''| '''Corresponding dtbo configuration'''|-| '''40pin - i2c0'''| '''pi-i2c0'''|-| '''40pin - i2c1'''| '''pi-i2c1'''|-| '''40pin - i2c2'''| '''pi-i2c2'''|}
[[File:zero2w-img173.png]]</ol><ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select <span class="mark">&lt;Save&gt;</span> to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select <span class="mark">&lt;Back&gt;</span></p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select <span class="mark">&lt;Reboot&gt;</span> to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol></li></ol><!-- --><ol start="3" style="list-style-type: decimal;"><li><p>After starting the Linux system, first confirm that there is an open i2c device node under <span class="mark">/dev</span></p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''rosdep updatels /dev/i2c-*'''</p><p>'''/dev/i2c-*'''</p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''注意,这里说的Linux镜像具体指的是从Orange Pi资料下载页面下载的Debian或者Ubuntu这样的Linux发行版镜像。'''</big>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Sometimes the i2c device node and the i2c bus serial number do not correspond one to one. For example, the i2c device node of the i2c1 bus may be /dev/i2c-3.'''</p><p>'''The method to accurately confirm the device node under /dev corresponding to the i2c bus is: '''</p></big>
reading in sources list data from /etc/ros/rosdep/sources.list.d
Hit https<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 /raw.githubusercontent.comsys/rosdevices/rosdistroplatform/mastersoc*/rosdep*/osxi2c-* | grep &quot;i2c-[0-homebrew9]&quot;'''</p><p>/sys/devices/platform/soc/5002000.yamli2c/i2c-0:</p><p>/sys/devices/platform/soc/5002400.i2c/i2c-3:</p>Hit https<p>/sys/devices/platform/soc/5002800.i2c/i2c-4:</p><p>/sys/devices/platform/soc/raw5002c00.githubusercontenti2c/i2c-5:</p><p>/sys/devices/platform/soc/6000000.comhdmi/i2c-2:</p><p>/rossys/rosdistrodevices/masterplatform/rosdepsoc/base7081400.yamli2c/i2c-1:</p></li>
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
Hit https<li><p>'''In the above output'''</p><ol style="list-style-type:none;"><li><p>a) 5002000 is the register base address of the i2c0 bus, and i2c-0 shown behind it is its corresponding i2c device node</p></li><li><p>b) 5002400 is the register base address of the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li><li><p>c) 5002800 is the register base address of the i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p></li></ol></li></ol>|}</li></rawol><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.githubusercontentHere we take the DS1307 RTC module as an example.com</rosp><p>[[File:zero2w-img178.png]]</rosdistrop></masterli><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>{| 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.'''</rosdepp>'''</ruby.yamlbig>|}
Hit https[[File:zero2w-img179.png]]</li></rawol><ol start="7" style="list-style-type: decimal;"><li><p>Then you can run the '''ds1307.githubusercontentpy''' test program in '''examples''' to read the RTC time</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that the x in i2c-x in the following command needs to be replaced with the serial number of the device node corresponding to the i2c bus.com'''</rosp></rosdistrobig>|}{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/masterwiringOP-Python# '''cd examples'''</releasesp><p>root@orangepi:~/fuertewiringOP-Python/examples# '''python3 ds1307.yamlpy --device \'''</p><p>'''&quot;/dev/i2c-x&quot;'''</p><p>Thu 2022-06-16 04:35:46</p><p>Thu 2022-06-16 04:35:47</p><p>Thu 2022-06-16 04:35:48</p><p>^C</p><p>exit</p>|}</li></ol>
Query rosdistro index https:<span id="pin-uart-test-1"><//raw.githubusercontent.com/ros/rosdistro/master/index-v4.yamlspan>
Skip end-of-life distro &quot;ardent&quot;=== 40pin UART test ===
Skip end-of-life distro &quot;bouncy&quot;# 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.
Skip end-of-life distro &quot<div style="display: flex;crystal&quot">::{| class="wikitable" style="width:390pxSkip endmargin-ofright: 20px;text-life distro &quot;dashing&quotalign: center;"|-Skip end-of-life distro &quot;eloquent&quot;| '''GPIO NO.'''| '''GPIO'''Add distro &quot;foxy&quot;| '''Function'''| '''Pin'''Add distro &quot;galactic&quot;|-Skip end| style="text-of-life distro &quot;groovy&quotalign: left;"| Add distro &quot;humble&quot; Skip end| style="text-of-life distro &quotalign: left;hydro&quot;"|Skip end-of-life distro &quot;indigo&quot;| '''3.3V'''| '''1'''Skip end|-of-life distro &quot;jade&quot;| '''264'''Skip end-of-life distro &quot;kinetic&quot;| '''PI8''' Skip end| '''TWI1-of-life distro &quot;lunar&quot;SDA'''| '''3'''Add distro &quot;melodic&quot;|-| '''263'''Add distro &quot;noetic&quot;| '''PI7'''Add distro &quot;rolling&quot;| '''TWI1-SCL'''| '''5'''updated cache in /home/orangepi/.ros/rosdep/sources.cache|-| '''269'''| '''PI13'''<ol start="6" style="list-style-type: decimal;"><li><p>Then open a command line terminal window on the | '''PWM3/UART4_TX''desktop'| '', and then use the '7''test_ros.sh''' script to start a small turtle routine to test whether ROS can be used normally.</p><p>orangepi@orangepi|-| style="text-align: left;"|| style="text-align:~$ left;"|| '''test_ros.shGND'''</p></li><li><p>After running the | '''test_ros.sh9''' 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>| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''<div class="figure"> [[File:zero2w|-img249.png]]| '''227'''| '''PH3'''</div><ol start="9" style="list-style| '''UART5_RX'''| '''13'''|-type: decimal;"><li><p>At this time, press the direction keys on the keyboard to control the little turtle to move up, down, left, and right.<| '''261'''| '''PI5'''| '''TWI0_SCL/p>UART2_TX'''<p>[[File:zero2w-img250.png]]</p></li></ol>| '''15'''|-<span id| style="howtext-toalign: left;"|| style="text-install-ros-2-galactic-on-ubuntu20.04align: left;"></span>|=== How to install ROS 2 Galactic on Ubuntu20| '''3.04 ===3V''' <ol style="list-style-type: decimal;"><li><p>The currently active version of ROS 2 is as follows, the recommended version is | '''Galactic Geochelone17'''</p><p>[[File:zero2w|-img251.png]]</p><p>[[File:zero2w-img252.png]]</p><p>[http://docs.ros.org/ | '''http://docs.ros.org231''']</p><p>| '''http://docs.ros.org/en/galactic/Releases.htmlPH7'''</p></li><li><p>The link to the official installation documentation of ROS 2 '| '''Galactic GeocheloneSPI1_MOSI''' is as follows:</p><p>| '''docs.ros.org/en/galactic/Installation.html19'''</p><p>|-| '''http://docs.ros.org/en/galactic/Installation/Ubuntu-Install-Debians.html232'''</p></li><li><p>In the official installation documentation of ROS 2 | '''Galactic GeochelonePH8''', Ubuntu Linux recommends using Ubuntu20.04, so please ensure that the system used by the development board is the | '''Ubuntu20.04 desktop systemSPI1_MISO'''. There are several ways to install ROS 2. The following demonstrates how to install ROS 2 | '''Galactic Geochelone21''' through |-| '''Debian packages230'''.</p></li><li><p>Use the | '''install_ros.shPH6''' script to install ros2</p><p>orangepi@orangepi:~$ | '''install_ros.sh ros2SPI1_CLK'''</p></li><li><p>The | '''install_ros.sh23''' script will automatically run the |-| style="text-align: left;"|| style="text-align: left;"|| '''GND'ros2 -h''| '''25''' command after installing ros2. If you can see the following print, it means that the ros2 installation is complete.</p><p>usage: ros2 [|-h] Call `ros2 &lt;command&gt; -h` for more detailed usage. ...</p><p>ros2 is an extensible command| '''266'''| '''PI10'''| '''TWI2-line tool for ROS 2.<SDA/p>UART3_RX'''<p>optional arguments:</p>| '''27'''<p>-h, -|-help show this help message and exit</p><p>Commands:</p>| '''256'''<p>action Various action related sub-commands</p>| '''PI0'''<p>bag Various rosbag related sub| style="text-commands</p>align: left;"|<p>component Various component related sub-commands</p>| '''29'''<p>daemon Various daemon related sub|-commands</p><p>doctor Check ROS setup and other potential issues</p>| '''271'''<p>interface Show information about ROS interfaces</p>| '''PI15'''<p>launch Run a launch file</p><p>lifecycle Various lifecycle related sub| style="text-commands</p>align: left;"|<p>multicast Various multicast related sub-commands</p>| '''31'''<p>node Various node related sub|-commands</p><p>param Various param related sub-commands</p>| '''268'''<p>pkg Various package related sub-commands</p>| '''PI12'''<p>run Run a package specific executable</p>| '''PWM2'''<p>security Various security related sub-commands</p>| '''33'''<p>service Various service related sub|-commands</p><p>topic Various topic related sub-commands</p>| '''258'''<p>wtf Use `wtf` as alias to `doctor`</p>| '''PI2'''<p>Call `ros2 &lt;command&gt; | style="text-h` for more detailed usage.</p></li>align: left;"|<li><p>Then you can use the | '''35'test_ros.sh''|-| '''272''' script to test whether ROS 2 is installed successfully. If you can see the following print, it means ROS 2 can run normally.</p><p>orangepi@orangepi:~$ | '''test_ros.shPI16'''</p><p>[INFO] [1671174101.200091527] [talker]: Publishing| style="text-align: left;"|| '''37''Hello World: 1'</p><p>[INFO] [1671174101.235661048] [listener]: I heard: [Hello World|-| style="text-align: 1]</p>left;"|<p>[INFO] [1671174102.199572327] [talker]: Publishing| style="text-align: left;"|| '''GND''Hello World: 2'</p><p>[INFO] [1671174102.204196299] [listener]| '''39'''|}{| class="wikitable" style="width: I heard390px;margin-right: [Hello World20px;text-align: 2]</p>center;"<p>[INFO] [1671174103.199580322] [talker]: Publishing: |-| '''Pin'''| '''Function''Hello World: 3'</p><p>[INFO] [1671174103.204019965] [listener]: I heard: [Hello World: 3]</p></li><li><p>Run the following command to open rviz2</p><p>orangepi@orangepi:~$ | '''source /opt/ros/galactic/setup.bashGPIO'''</p><p>orangepi@orangepi:~$ | '''ros2 run rviz2 rviz2GPIO NO.'''</p><p>[[File:zero2w|-img253.png]]</p></li><li><p>For how to use ROS, please refer to the documentation of ROS | '''2.</p>'''<p>[http://docs.ros.org/en/galactic/Tutorials.html | '''5V'''http://docs.ros.org/en/galactic/Tutorials.html''']</p></li></ol>| style="text-align: left;"|<span id| style="howtext-to-install-ros-2-humble-on-ubuntu22.04align: left;"></span>|=== How to install ROS 2 Humble on Ubuntu22.04 ===|- <ol | '''4'''| '''5V'''| style="listtext-align: left;"|| style="text-typealign: decimalleft;">|<li><p>Use the install_ros.sh script to |-| '''install_ros.sh6'''</p><p>orangepi@orangepi:~$ | '''install_ros.sh ros2GND'''</p></li><li><p>The | style="text-align: left;"|| style="text-align: left;"||-| '''install_ros.sh8''' script will automatically run the | '''ros2 -hUART0_TX'''| '''PH0'''| '''224''' command after installing ros2. If you can see the following print, it means that the ros2 installation is complete.</p><p>usage: ros2 [|-h] Call `ros2 &lt;command&gt; -h` for more detailed usage. ...</p><p>ros2 is an extensible command-line tool for ROS 2.</p>| '''10'''| '''UART0_RX'''<p>optional arguments:</p>| '''PH1'''| '''225'''<p>|-h, --help show this help message and exit</p><p>Commands| '''12'''| style="text-align:</p>left;"|<p>action Various action related sub-commands</p>| '''PI1'''<p>bag Various rosbag related sub-commands</p>| '''257'''<p>component Various component related sub|-commands</p><p>daemon Various daemon related sub-commands</p>| '''14'''<p>doctor Check ROS setup and other potential issues</p>| '''GND'''<p>interface Show information about ROS interfaces</p>| style="text-align: left;"|<p>launch Run a launch file</p>| style="text-align: left;"|<p>lifecycle Various lifecycle related sub|-commands</p><p>multicast Various multicast related sub-commands<| '''16'''| '''PWM4/p>UART4_RX'''<p>node Various node related sub-commands</p>| '''PI14'''<p>param Various param related sub-commands</p>| '''270'''<p>pkg Various package related sub|-commands</p><p>run Run a package specific executable</p>| '''18'''<p>security Various security related sub| style="text-commands</p>align: left;"|<p>service Various service related sub-commands</p>| '''PH4'''| '''228'''<p>topic Various topic related sub|-commands</p><p>wtf Use `wtf` as alias to `doctor`</p>| '''20'''<p>Call `ros2 &lt;command&gt; -h` for more detailed usage.</p></li><li><p>Then you can use the | '''test_ros.shGND''' script to test whether ROS 2 is successfully installed. If you can see the following print, it means ROS 2 can run normally.</p><p>orangepi@orangepi| style="text-align: left;"|| style="text-align:~$ '''test_ros.sh'left;"||-| '''22'''</p><p>[INFO] [1671174101.200091527] [talker]: Publishing: | ''Hello World: 1'<TWI0_SDA/p>UART2_RX'''<p>[INFO] [1671174101.235661048] [listener]: I heard: [Hello World: 1]</p>| '''PI6'''<p>[INFO] [1671174102.199572327] [talker]: Publishing: | '''262''Hello World: 2'</p><p>[INFO] [1671174102.204196299] [listener]: I heard: [Hello World: 2]</p>|-<p>[INFO] [1671174103.199580322] [talker]: Publishing: | '''24''Hello World: 3'</p><p>[INFO] [1671174103.204019965] [listener]: I heard: [Hello World: 3]</p></li><li><p>Run the following command to open rviz2</p><p>orangepi@orangepi:~$ | '''SPI1_CS0'''source /opt/ros/humble/setup.bash| '''PH5'''</p><p>orangepi@orangepi:~$ | '''ros2 run rviz2 rviz2229'''</p><p>[[File:zero2w|-img254.png]]</p></li><li><p>Reference documentation</p><p>| '''26'''| '''http://docs.ros.org/en/humble/index.htmlSPI1_CS1'''</p><p>[http://docs.ros.org/en/galactic/Tutorials.html | '''http://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.htmlPH9'''| '''233''']</p></li></ol> <span id="how|-to-install-kernel-header-files"></span>== How to install kernel header files ==| '''28'''| '''TWI2-SCL/UART3_TX'''| '''Debian11 system with Linux6.1 kernel will report GCC error when compiling kernel module. So if you want to compile the kernel module, please use Debian12 or Ubuntu22.04.PI9'''| '''265'''<ol |-| '''30'''| '''GND'''| style="list-styletext-typealign: decimalleft;">|<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 | style="text-align: left;"||-| '''/opt/32'''</p><p>orangepi@orangepi:~$ | '''PWM1'''| '''PI11'''| '''ls /opt/linux-headers*267'''</p><p>/opt/linux|-headers-xxx-sun50iw9_x.x.x_arm64.deb</p></li><li><p>Use the following command to install the deb package of the kernel header file</p><p>orangepi@orangepi:~$ | '''sudo dpkg -i /opt/linux-headers*.deb34'''</p></li><li><p>After installation, you can see the folder where the kernel header file is located under | '''/usr/srcGND'''.</p><p>orangepi@orangepi| style="text-align:~$ left;"|| style="text-align: left;"||-| '''ls /usr/src36'''</p><p>linux| style="text-headers-x.x.x</p></li>align: left;"|<li><p>Then you can compile the source code of the hello kernel module that comes with the Linux image. The source code of the hello module is in | '''PC12'/usr/src/hello''| '. After entering this directory, then use the make command to compile.</p><p>orangepi@orangepi:~$ ''76'cd /usr/src/hello/'''</p><p>orangepi@orangepi:/usr/src/hello$ |-| '''sudo make38'''</p><p>make | style="text-C /lib/modules/5.4.125/build M=/usr/src/hello modules</p>align: left;"|<p>make[1]: Entering directory | '''PI4'''| '''260''/usr/src/linux-headers-5.4.125'</p><p>CC [M] /usr/src/hello/hello.o</p>|-<p>Building modules, stage 2.</p>| '''40'''| style="text-align: left;"|| '''PI3'''| '''259'''|}<p>MODPOST 1 modules</pdiv> <p>CC [M] /usr/src/hello/hello.mod.o</pol start="2" style="list-style-type: decimal;"><pli>LD [M] /usr/src/hello/hello.ko</p><p>make[1]: Leaving directory '/usr/src/linux-headers-5In Linux systems, uart is turned off by default and needs to be turned on manually before it can be used.4.125'</p></li><li><p>After compilation, the '''hello.ko''' kernel module will be generated</p><p>orangepi@orangepiThe opening steps are as follows::/usr/src/hello$ '''ls *.ko'''</p><p>hello.ko</p></li><li><p>Use the '''insmod''' command to insert the '''hello.ko''' kernel module into the kernel</p><p>orangepi@orangepi:/usr/src/hello$ '''sudo insmod hello.ko'''</p></li><li><p>Then use the '''demsg''' command to view the output of the '''hello.ko''' kernel module. If you can see the following output, it means that the '''hello.ko''' kernel module is loaded correctly.</p><p>orangepi@orangepi:/usr/src/hello$ '''dmesg | grep &quot;Hello&quot;'''</p><p>[ 2871.893988] '''Hello Orange Pi -- init'''</p></li><li><p>Use the '''rmmod''' command to uninstall the '''hello.ko''' kernel module</p><p>orangepi@orangepi:/usr/src/hello$ '''sudo rmmod hello'''</p><p>orangepi@orangepi:/usr/src/hello$ '''dmesg | grep &quot;Hello&quot;'''</p><p>[ 2871.893988] Hello Orange Pi -- init</p><p>[ 3173.800892] '''Hello Orange Pi -- exit'''</p></li></ol> <span id="testing-of-some-programming-languages-supported-by-linux-system"></span>== Testing of some programming languages supported by Linux system == <span id="debian-bullseye-system"></span>=== Debian Bullseye system === <ol style="list-style-type: decimal;"><li><p>Debian Bullseye is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.</p><ol style="list-style-type: lower-alpha;"><li><p>The version of a.gcc is as follows</p><p>orangepi@orangepi:~$ '''gcc --version'''</p><p>gcc (Debian 10.2.1-6) 10.2.1 20210110</p><p>Copyright (C) 2020 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p></li><li><p>Write the '''hello_world.c''' program in C language</p><p>orangepi@orangepi:~$ '''vim hello_world.c'''</p><p>#include &lt;stdio.h&gt;</p><p>int main(void)</p><p>{</p><p>printf(&quot;Hello World!\n&quot;);</p><p>return 0;</p><p>}</p></li><li><p>Then compile and run '''hello_world.c'''</p><p>orangepi@orangepi:~$ '''gcc -o hello_world hello_world.c'''</p><p>orangepi@orangepi:~$ '''./hello_world'''</p><p>Hello World!</p></li></ol></li><li><p>Debian Bullseye has Python3 installed by default</p><ol style="list-style-type: lower-alpha;"><li><p>The specific version of Python is as follows</p><p>orangepi@orangepi:~$ '''python3'''</p><p>'''Python 3.9.2''' (default, Feb 28 2021, 17:03:44)</p><p>[GCC 10.2.1 20210110] on linux</p><p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</p><p>&gt;&gt;&gt;</p><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p></li><li><p>Write the '''hello_world.py''' program in Python language</p><p>orangepi@orangepi:~$ '''vim hello_world.py'''</p><p>print('Hello World!')</p></li><li><p>The result of running '''hello_world.py''' is as follows</p><p>orangepi@orangepi:~$ '''python3 hello_world.py'''</p><p>Hello World!</p></li></ol></li><li><p>Debian Bullseye does not install Java compilation tools and operating environment by default.</p><ol style="list-style-type: lower-alpha;"><li><p>You can use the following command to install openjdk. The latest &gt; version in Debian Bullseye is openjdk-17</p><p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''</p></li><li><p>After installation, you can check the Java version.</p><p>orangepi@orangepi:~$ '''java --version'''</p></li><li><p>Write the Java version of '''hello_world.java'''</p><p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p><p>public static void main(String[] args)</p><p>{</p><p>System.out.println(&quot;Hello World!&quot;);</p><p>}</p><p>}</p></li><li><p>Then compile and run '''hello_world.java'''</p><p>orangepi@orangepi:~$ '''javac hello_world.java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p></li></ol></li></ol> <span id="debian-bookworm-system"></span>=== Debian Bookworm system === <ol style="list-style-type: decimal;"><li><p>Debian Bookworm is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.</p><ol style="list-style-type: lower-alpha;"><li><p>The version of a.gcc is as follows</p><p>orangepi@orangepi:~$ '''gcc --version'''</p><p>gcc (Debian 12.2.0-14) 12.2.0</p><p>Copyright (C) 2022 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p></li><li><p>Write the '''hello_world.c''' program in C language</p><p>orangepi@orangepi:~$ '''vim hello_world.c'''</p><p>#include &lt;stdio.h&gt;</p><p>int main(void)</p><p>{</p><p>printf(&quot;Hello World!\n&quot;);</p><p>return 0;</p><p>}</p></li><li><p>Then compile and run '''hello_world.c'''</p><p>orangepi@orangepi:~$ '''gcc -o hello_world hello_world.c'''</p><p>orangepi@orangepi:~$ '''./hello_world'''</p><p>Hello World!</p></li></ol></li><li><p>Debian Bookworm has Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The specific version of Python is as follows</p><p>orangepi@orangepi:~$ First run '''python3orangepi-config'''</p><p>Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux</p><p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</p><p>&gt;&gt;&gt;</p><p>'''Use the Ctrl+D shortcut key Ordinary users remember to exit pythonadd 's interactive mode.'''</p></li><li><p>Write the sudo'''hello_worldpermissions.py''' program in Python language</p><p>orangepi@orangepi{| class="wikitable" style="width:~$ '''vim hello_world.py'''</p>800px;" <p>print('Hello World!')</p></li>|-<li><p>The result of running '''hello_world.py''' is as follows</p>| <p>orangepi@orangepi:~$ '''python3 hello_world.pysudo orangepi-config'''</p><p>Hello World!</p></li></ol>|}
</li>
<li><p>Debian Bookworm does not install Java compilation tools and operating environment by default.Then select '''System'''</p><ol style="list-style-typep>[[File: lowerzero2w-alpha;"img80.png]]</p></li><li><p>You can use the following command to install openjdk. The latest &gt; version in Debian Bookworm is openjdk-17Then select '''Hardware'''</p><p>orangepi@orangepi[[File:~$ '''sudo apt install zero2w-y openjdk-17-jdk'''img81.png]]</p></li><li><p>After installationThen use the keyboard's arrow keys to locate the position shown in the picture below, and then use the '''space''' to select the serial port you can check the Java versionwant to open.</p><p/li>orangepi@orangepi {| class="wikitable" style="width:~$ 800px;text-align: center;"|-| '''Multiplexing function in 40pin'''| '''Corresponding dtbo configuration'''|-| '''java 40pin -uart2'''| '''pi-versionuart2'''</p></li><li><p>Write the Java version of |-| '''40pin - uart3'''| '''pi-uart3'''|-| '''40pin - uart4'''| '''pi-uart4'''|-| '''hello_world.java40pin - uart5'''</p><p>orangepi@orangepi:~$ | '''vim hello_world.javaph-uart5'''</p><p>public class hello_world</p>|}<p>{</p><p>public static void main(String[[File:zero2w-img175.png] args)]</pol><pol start="5" style="list-style-type: lower-alpha;">{</pli><p>System.out.println(Then select '''&quotlt;Hello World!Save&quot;)gt;''' to save</p><p>}</p><p>}[[File:zero2w-img83.png]]</p></li><li><p>Then compile and run select '''hello_world.java&lt;Back&gt;'''</p><p>orangepi@orangepi[[File:~$ '''javac hello_worldzero2w-img84.java'''png]]</p></li><li><p>orangepi@orangepi:~$ Then select '''java hello_world&lt;Reboot&gt;'''to restart the system to make the configuration take effect.</p><p>Hello World![[File:zero2w-img85.png]]</p></li></ol>
</li></ol>
<!-- -->
<ol start="3" style="list-style-type: decimal;">
<li><p>After entering the Linux system, first confirm whether there is a uart5 device node under '''<span class="mark">/dev</span>'''</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|
<big><p>'''注意, linux5.4系统为/dev/ttyASx.'''</p></big>
|}
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''ls /dev/ttyS*'''</p>
<p>/dev/ttySx</p>
|}
</li>
<li><p>Then start testing the uart interface. First use Dupont wire to short-circuit the rx and tx pins of the uart interface to be tested.</p></li>
<li><p>Use the '''gpio''' command in wiringOP to test the loopback function of the serial port as shown below. If you can see the following print, it means the serial port communication is normal.</p>
{| 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 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # linux-6.1 test command'''</p>
<p>orangepi@orangepi:~$ '''gpio serial /dev/ttyASx &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # linux-5.4 test command'''</p>
<span id="ubuntu-focal-system"></span>
=== Ubuntu Focal system ===
<ol style="list-style-type: decimal;"><li><p>Ubuntu Focal is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.</p><ol style="list-style-typeOut: 0: lower-alpha&gt;"><li><p>The version of a.gcc is as follows0</p><p>orangepi@orangepiOut: 1:~$ '''gcc --version'''</p><p>gcc (Ubuntu 9.4.0-1ubuntu1~20.04.&gt; 1) 9.4.0</p><p>Copyright (C) 2019 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p></li><li><p>Write the '''hello_world.c''' program in C language</p><p>orangepi@orangepiOut: 2:~$ '''vim hello_world.c'''</p><p>#include &lt;stdio.h-&gt;2</p><p>int main(void)</p><p>{</p><p>printf(Out: 3: -&quot;Hello World!\n&quot;)gt;3^C</p><p>return 0;</p><p>|}</p></li><li><p>Then compile and run '''hello_world.c'''</p><p>orangepi@orangepi:~$ '''gcc -o hello_world hello_world.c'''</p><p>orangepi@orangepi:~$ '''./hello_world'''</p><p>Hello World!</p></li></ol>
</li>
<li><p>Ubuntu Focal has Python3 installed by default</p><ol style="list-style-type: lower-alpha;"><li><p>The specific version of Python3 is as follows</p><p>orangepi@orangepi:~$ Finally, you can run the '''python3serialTest.py'''</p><p>Python 3program in examples to test the loopback function of the serial port.8.10 (defaultIf you can see the following print, Nov 14 2022, 12:59:47)</p><p>[GCC 9it means that the serial port loopback test is normal.4.0] on linux</p><p>Type &quot{| class="wikitable" style="background-color:#ffffdc;help&quotwidth:800px;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</p>" <p>&gt;&gt;&gt;</p>|-<p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p></li>| <libig><p>Write the '''hello_world.py''' program Note that the x in Python language</p><p>orangepi@orangepi:~$ '''vim hello_world.py'''<dev/p><p>print('Hello World!')<ttySx or /p><dev/li><li><p>The result ttyASx in the command needs to be replaced with the serial number of running '''hello_worldthe corresponding uart device node.py''' is as follows</p><p>orangepi@orangepi:~$ '''python3 hello_world.py'''</pbig><p>Hello World!</p></li></ol>|}</li><li><p>Ubuntu Focal does not have Java compilation tools and running environment installed by default.</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>You can use the following command to install openjdk|-17</p>| <p>orangepiroot@orangepi:~$ /wiringOP-Python# '''sudo apt install -y openjdk-17-jdkcd examples'''</p></li><li><p>After installation, you can check the Java version.</p><p>orangepiroot@orangepi:~$ '''java /wiringOP--versionPython/examples# '''</p><p>openjdk 17python3 serialTest.0.2 2022py -01-18<device &quot;/p><p>OpenJDK Runtime Environment (build 17.0.2+8-Ubuntu-120.04)<dev/p><p>OpenJDK 64-Bit Server VM (build 17ttySx&quot; # linux6.0.2+8-Ubuntu-120.04, mixed mode, sharing)</p></li><li><p>Write the Java version of '''hello_world.java1 use'''</p><p>orangepiroot@orangepi:~$ /wiringOP-Python/examples# '''vim hello_worldpython3 serialTest.java'''</p><p>public class hello_world</p><p>{</p><p>public static void main(String[] args)</p><p>{</p><p>System.out.println(py --device &quot;Hello World!/dev/ttyASx&quot;);</p><p>}</p><p>}</p></li><li><p>Then compile and run '''hello_world# linux5.java'''</p><p>orangepi@orangepi:~$ '''javac hello_world.java'''</p><p>orangepi@orangepi:~$ '''java hello_world4 use'''</p><p>Hello World!</p></li></ol></li></ol>
<span id="ubuntu-jammy-system"></span>
=== Ubuntu Jammy system ===
<ol style="list-style-type: decimal;"><li><p>Ubuntu Jammy is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.</p><ol style="list-style-typeOut: lower-alpha;"><li><p>The version of a.gcc is as follows</p><p>orangepi@orangepi0:~$ '''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 &lt;stdio.h&gt;</p><p>int main(void)</p><p>{</p><p>printf(&quot;Hello World!\n&quot;);</p><p>return 0;</p><p>}</p></li><li><p>Then compile and run '''hello_world.c'''</p><p>orangepi@orangepiOut:~$ '''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-type1: lower-alpha&gt;"><li><p>The specific version of Python3 is as follows1</p><p>orangepi@orangepiOut:~$ '''python3'''</p><p>Python 3.10.6 (main, May 29 2023, 112:10:38) [GCC 11.3.0] on linux</p><p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</p><p>-&gt;&gt;&gt;</p><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p></li><li><p>Write the '''hello_world.py''' program in Python language2</p><p>orangepi@orangepiOut:~$ '''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@orangepi3:~$ '''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&gt;"><li><p>You can use the following command to install openjdk-183</p><p>orangepi@orangepiOut:~$ '''sudo apt install -y openjdk-18-jdk'''</p></li><li><p>After installation, you can check the Java version.</p><p>orangepi@orangepi4:~$ '''java --version'''^C</p><p>openjdk 18.0.2-ea 2022-07-19exit</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><p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p><p>public static void main(String[] args)</p><p>{</p><p>System.out.println(&quot;Hello World!&quot;);</p><p>}</p><p>|}</p></li><li><p>Then compile and run '''hello_world.java'''</p><p>orangepi@orangepi:~$ '''javac hello_world.java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p></li></ol>
</li></ol>
<span id="methodhardware-ofwatchdog-uploading-files-to-the-development-board-linux-systemtest"></span>== Method of uploading files to the development board Linux system ==
<span id="method-to-upload-files-to-the-development-board-linux-system-in-ubuntu-pc"></span>=== Method to upload files to the development board Linux system in Ubuntu PC =Hardware watchdog test ==
<span id="howThe watchdog_test program is pre-to-upload-files-using-scp-command"></span>installed in the Linux system released by Orange Pi and can be tested directly. ==== How The method to upload files using scp command ====run the watchdog_test program is as follows:
<ol style="list-style-type: decimal;">
<li><p>Use the scp command to upload files to the Linux system of the development board in Ubuntu PC. The specific command is as follows</p>
<ol style="list-style-type: lower-alpha;">
<li><p>'''file_path: '''Needs to be replaced with The second parameter 10 represents the path counting time of the file to &gt; be uploadedwatchdog. If the dog is not fed within this time, the system will restart.</p></li><li><p>'''orangepi: '''This is We can feed the dog by pressing any key on the keyboard (except ESC). After feeding the user name of dog, the development board's program will print a line &gtquot; Linux system. It can also be replaced with something else, keep alive&gtquot; such as rootto indicate that the dog feeding is successful.</p></li><li>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''192.168.xx.xx:sudo watchdog_test 10''' This is the IP address of the development &gt; board. Please modify it according to the actual situation.</p><p>open success</lip><lip>options is 33152,identity is sunxi-wdt</p><p>'''/home/orangepiput_usr return,if 0,success:''' The path in the development board Linux &gt; system can also be modified to other paths.0</p><p>test@testThe old reset time is:~$ '''scp file_path orangepi@192.168.xx.xx:/home/orangepi/'''16</p></lip>return ENOTTY,if -1,success:0</olp><p>return ENOTTY,if -1,success:0</lip><li><p>If you want to upload a folderput_user return,if 0, you need to add the -r parametersuccess:0</p><p>test@test:~$ '''scp -r dir_path orangepi@192.168.xx.xxput_usr return,if 0,success:0</home/orangepi/'''p></p>keep alive</lip><lip>keep alive</p><p>There are more usages of scp, please use the following command to view the man manualkeep alive</p>|}</li></ol>
test@test:~$ '''man scp'''<span id="check-the-chipid-of-h618-chip"></span>
<span id="how-to-upload-files-using-filezilla"></span>==== How to upload files using filezilla ==Check the chipid of H618 chip ==
<ol style="list-style-type: decimal;"><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 The command to open filezilla</p><p>test@test:~$ '''filezilla'''</p></li><li><p>The interface after opening filezilla view the H618 chip chipid is as shown belowfollows. At this timeThe chipid of each chip is different, the remote site on the right is emptyso you can use chipid to distinguish multiple development boards.</p><div class="figure">
[[File{| class="wikitable" style="width:zero2w800px;" |-img255.png]]| orangepi@orangepi:~$ '''cat /sys/class/sunxi_info/sys_info | grep &quot;chipid&quot;'''
</div></li>sunxi_chipid : 338020004c0048080147478824681ed1<li><p>The method of connecting the development board is as shown in the figure below</p></li></ol>|}
<div classspan id="figurepython-related-instructions"></span>
[[File:zero2w-img256.png]]== Python related instructions ==
</div><ol startspan id="5" style="listhow-to-stylecompile-type: decimal;"><li><p>Then choose to '''save the password''' and click '''OK'''</p><p>[[File:zero2w-img257.png]]</pinstall-python-source-code"></lispan><li><p>Then select '''Always trust this host''' === How to compile and click '''OK'''</p></li></ol>install Python source code ===
<div {| class="figurewikitable"style="background-color:#ffffdc;width:800px;" |-| <big>'''If the Python version in the Ubuntu or Debian system software repository you are using does not meet the development requirements and you want to use the latest version of Python, you can use the following method to download the Python source code package to compile and install the latest version of Python.'''
[[File:zero2w-img258'''The following demonstration is to compile and install the latest version of Python 3.png]]9. If you want to compile and install other versions of Python, the method is the same (you need to download the source code corresponding to the Python you want to install).'''</big>|}
<ol style="list-style-type: decimal;"><li><p>First install the dependency packages needed to compile Python</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y build-essential zlib1g-dev \'''</divp><ol startp>'''libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev \'''</p><p>'''libreadline-dev libffi-dev curl libbz2-dev'''</p>|}</li><li><p>Then download the latest version of Python3.9 source code and unzip it</p>{| class="7wikitable" style="listwidth:800px;" |-| <p>orangepi@orangepi:~$ '''wget \'''</p><p>'''https://www.python.org/ftp/python/3.9.10/Python-3.9.10.tgz'''</p><p>orangepi@orangepi:~$ '''tar xvf Python-3.9.10.tgz'''</p>|}</li><li><p>Then run the configuration command</p>{| class="wikitable" style="width:800px;" |-type| <p>orangepi@orangepi:~$ '''cd Python-3.9.10'''</p><p>orangepi@orangepi:~$ '''./configure --enable-optimizations'''</p>|}</li><li><p>Then compile and install Python3.9. The compilation time takes about half an hour.</p>{| class="wikitable" style="width: decimal800px;"|-| <p>orangepi@orangepi:~$ '''make -j4'''</p><p>orangepi@orangepi:~$ '''sudo make altinstall'''</p>|}</li><li><p>After the connection is successfulinstallation, you can see use the directory structure following command to check the version number of the development boardPython you just installed.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ ''s Linux file system on the right side of the filezilla software'python3.9 --version'''</p><p>'''Python 3.9.10'''</p>|}</li><li><p>Then update pip</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''/usr/local/bin/python3.9 -m pip install --upgrade pip'''</p>|}</li></ol>
<div classspan id="figurehow-to-replace-pip-source-in-python"></span>
[[File:zero2w-img259.png]]=== How to replace pip source in Python ===
</div><ol start{| class="8wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;">|-| <libig>Then select '''The default source used by Linux system pip is the path to be uploaded to the development board on the right side official source of the filezilla softwarePython. However, select accessing the file to be uploaded official source of Python in Ubuntu PC on China is very slow, and the left side installation of the filezilla Python software, right-click packages often fails due to network reasons. So when using pip to install the mousePython library, and then click the upload option please remember to start uploading change the file to the development boardpip source.'''</li></olbig>|}
<div ol style="list-style-type: decimal;"><li><p>First install '''python3-pip'''</p>{| class="figurewikitable" style="width:800px;"|-| <p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y python3-pip'''</p>|}</li><li><p>How to permanently change the pip source under Linux</p><ol style="list-style-type: lower-alpha;"><li><p>First create a new '''~/.pip''' directory, then add the '''pip.conf''' configuration file, and set the pip source in it to Tsinghua source.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''mkdir -p ~/.pip'''</p><p>orangepi@orangepi:~$ '''cat &lt;&lt;EOF &gt; ~/.pip/pip.conf'''</p><p>'''[[Fileglobal]'''</p><p>'''timeout = 6000'''</p><p>'''index-url = https://pypi.tuna.tsinghua.edu.cn/simple'''</p><p>'''trusted-host = pypi.tuna.tsinghua.edu.cn'''</p><p>'''EOF'''</p>|}</li><li><p>Then use pip3 to install the Python library very quickly</p></li></ol></li><li><p>How to temporarily change the pip source under Linux, where '''&lt;packagename&gt;''' needs to be replaced with a specific package name</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''pip3 install &lt;packagename&gt; -i \'''</p><p>'''https:zero2w//pypi.tuna.tsinghua.edu.cn/simple -img260-trusted-host pypi.png]]tuna.tsinghua.edu.cn'''</p>|}</li></ol>
</div><ol startspan id="9" style="listhow-to-styleinstall-type: decimal;docker"><li><p>After the upload is completed, you can go to the corresponding path in the development board Linux system to view the uploaded file.</p></li><li><p>The method of uploading a folder is the same as the method of uploading a file, so I won't go into details here.</p></li></olspan>
<span id="method-to-upload-files-from-windows-pc-to-development-board-linux-system"></span>=== Method How to upload files from Windows PC to development board Linux system =install Docker ==
<span id="howThe Linux image provided by Orange Pi has Docker pre-installed, but the Docker service is not turned on by default. Use the '''enable_docker.sh''' script to-upload-files-using-filezilla-1"></span>==== How to upload files enable the docker service, and then you can start using filezilla ====the docker command, and the docker service will be automatically started the next time you start the system.
# First download the installation file of the Windows version of the filezilla software{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''enable_docker. The download link is as followssh'''|}
[https://filezilla-projectYou can use the following command to test docker.org/download.php?type=client If '''https://filezillahello-project.org/download.php?type=clientworld''']can be run, docker can be used normally.
[[File{| class="wikitable" style="width:zero2w800px;" |-img261.png]]| orangepi@orangepi:~$ '''docker run hello-world'''
<div class="figure">Unable to find image 'hello-world:latest' locally
[[Filelatest:zero2wPulling from library/hello-img262.png]]world
</div><ol start="2" style="list-style-type256ab8fe8778: decimal;"><li><p>The downloaded installation package is as shown below, then double-click to install it directly</p><p>'''FileZilla_Server_1.5.1_win64-setup.exe'''</p></li></ol>Pull complete
During the installation process, please select '''Decline''' on the following installation interface, and then select '''Next&gt;'''Digest: sha256:7f0a9f93b4aa3022c3a4c147a449ef11e0941a1fd0bf4a8e6c9408b2600777c5
<div class="figure">Status: Downloaded newer image for hello-world:latest
[[File:zero2w-img263.png]]
'''</div><ol start="3" span style="list-style-typecolor: decimal;#FF0000"><li>The interface after opening filezilla is as shown below. At this time, the remote site on the right is empty.</li>Hello from Docker!</olspan>'''
'''<div classspan style="figurecolor:#FF0000">This message shows that your installation appears to be working correctly.</span>'''
[[File:zero2w-img264'''.png]]….'''|}
</div><ol start="4" style="list-style-type: decimal;"><li>The method of connecting When using the development board is as shown in docker command, if you are prompted for '''permission denied''', please add the figure below:</li></ol>current user to the docker user group so that you can run the docker command without sudo.
<div {| class="figurewikitable">style="width:800px;" |-| orangepi@orangepi:~$ '''sudo usermod -aG docker $USER'''|}
[[File{| class="wikitable" style="background-color:#ffffdc;width:zero2w800px;" |-img256| <big>'''Note: You need to log out and log in again to the system to take effect. You can also restart the system.png]]'''</big>|}
</div><ol startspan id="5" style="listhow-to-install-stylehome-type: decimal;assistant"><li>Then choose to '''save the password''' and click '''OK'''</li></olspan>
<div class="figure">= How to install Home Assistant ==
[[File{| class="wikitable" style="background-color:zero2w#ffffdc;width:800px;" |-img265| <big>'''Note that this article will only provide methods for installing Home Assistant in Ubuntu or Debian systems. For detailed usage of Home Assistant, please refer to the official documentation or corresponding books.png]]'''</big>|}
</div><ol start="6" style="list-style-type: decimal;"><li>Then select '''Always trust this host''' and click '''OK'''</li></ol> <div class="figure"> [[File:zero2w-img266.png]] </div><ol start="7" style="list-style-type: decimal;"><li>After the connection is successful, you can see the directory structure of the development board's Linux file system on the right side of the filezilla software.</li></ol> <div class="figure"> [[File:zero2w-img267.png]] </div><ol start="8" style="list-style-type: decimal;"><li>Then select the path to be uploaded to the development board on the right side of the filezilla software, select the file to be uploaded on the Windows PC on the left side of the filezilla software, right-click the mouse, and then click the upload option to start uploading the file to the development board.</li></ol> <div class="figure"> [[File:zero2w-img268.png]] </div><ol start="9" style="list-style-type: decimal;"><li><p>After the upload is completed, you can go to the corresponding path in the development board Linux system to view the uploaded file.</p></li><li><p>The method of uploading a folder is the same as the method of uploading a file, so I won't go into details here.</p></li></ol> <span id="instructionsinstallation-forvia-using-the-logo-on-and-off-the-machinedocker"></span>== Instructions for using the logo on and off the machine = Installation via docker ===
<ol style="list-style-type: decimal;">
<li><p>The power on/off logo will only be displayed on First, please install docker and ensure that docker can run normally. For the desktop version installation steps of docker, please refer to the system by defaultinstructions in the [[Orange Pi Zero 2W#How to install Docker|'''How to Install Docker''']] section.</p></li><li><p>Set Then you can search for the docker image of Home Assistant</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''bootlogodocker search homeassistant''' variable </p>|}</li><li><p>Then use the following command to download the Docker image of Home Assistant to your local computer. The image size is about 1GB, and the download time will be relatively long. Please be patient and wait for the download to complete.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''falsedocker pull homeassistant/home-assistant''' in </p><p>Using default tag: latest</p><p>latest: Pulling from homeassistant/home-assistant</p><p>be307f383ecc: Downloading</p><p>5fbc4c07ac88: Download complete</p><p>'''/boot/orangepiEnv.txt..... (Omit some output)''' </p><p>3cc6a1510c9f: Pull complete</p><p>7a4e4d5b979f: Pull complete</p><p>Digest: sha256:81d381f5008c082a37da97d8b08dd8b358dae7ecf49e62ce3ef1eeaefc4381bb</p><p>Status: Downloaded newer image for homeassistant/home-assistant:latest</p><p>docker.io/homeassistant/home-assistant:latest</p>|}</li><li><p>Then you can use the following command to turn off view the switch logo.docker image of Home Assistant you just downloaded</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo vim docker images homeassistant/boot/orangepiEnv.txthome-assistant'''</p><p>verbosity=1REPOSITORY &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TAG &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IMAGE &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ID &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CREATED &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIZE</p><p>homeassistant/home-assistant &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; latest &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bfa0ab9e1cf5 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2 months ago &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '''bootlogo<span style=false"color:#FF0000">1.17GB</span>'''</p>|}</li><li><p>Set At this point you can run the Home Assistant docker container</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''bootlogodocker run -d \''' variable to </p>:<p>'''true--name homeassistant \''' in </p>:<p>'''/boot/orangepiEnv.txt--privileged \''' to enable the power on/off logo.</p>:<p>orangepi@orangepi:~$ '''sudo vim /boot/orangepiEnv.txt--restart=unless-stopped \'''</p>:<p>verbosity'''-e TZ=1Asia/Shanghai \'''</p>:<p>'''bootlogo=true-v /home/orangepi/home-assistant:/config \'''</p></li><li>:<p>The location of the boot logo picture in the Linux system is'''--network=host \'''</p>:<p>'''homeassistant/usr/share/plymouth/themes/orangepi/watermark.pnghome-assistant:latest'''</p>|}</li><li><p>After replacing Then enter【the IP address of the boot logo image, you need development board: 8123】in the browser to run see the following command to take effectHome Assistant interface</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>orangepi@orangepi:~$ '''sudo update-initramfs -uIt takes a while for the Home Assistant container to start. If the interface below does not display normally, please wait a few seconds before refreshing it. If the following interface is not displayed normally after waiting for more than a minute, it means there is a problem with the Home Assistant installation. At this time, you need to check whether there is a problem with the previous installation and setting process.'''</p></libig>|}</oldiv class="figure">
<span id="how[[File:zero2w-to-turn-on-the-power-button-in-linux5.4"></span>== How to turn on the power button in Linux5img180.4 ==png]]
There is no power on</off button on the main board of the development board. We can expand it through a 24pin expansion board. The location of the power ondiv></off button on the expansion board is as follows:li><li><p>Then enter your '''name, username''' and '''password''' and click '''Create Account'''</p><div class="figure">
[[File:zero2w-img269img181.png]]
The power on</off button of div></li><li><p>Then follow the Linux 6.1 image is turned on by defaultinterface prompts to set according to your own preferences, but the power onand then click Next</off button of the Linux 5.4 kernel image is turned off by default and needs to be turned on manually for normal use. The steps are as follows:p><div class="figure">
<ol style="list-style-type: decimal;"><li><p>First run '''orangepi-config'''. Ordinary users remember to add '''sudo''' permissions.</p><p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p></li><li><p>Then select '''System'''</p><p>[[File:zero2w-img80.png]]</p></li><li><p>Then select '''Hardware'''</p><p>[[File:zero2w-img81.png]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown in the picture below, and then use the '''space''' to select the dtbo configuration of the SPI you want to open.</p><p>[[File:zero2w-img270.png]]</p></li><li><p>Then select '''&lt;Save&gt;''' to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''&lt;Back&gt;'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''&lt;Reboot&gt;''' to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85img182.png]]</p></li></ol>
<span id="how-to-shut-down-and-restart-the-development-board"/div></li><li><p>Then click Next</spanp><div class== How to shut down and restart the development board =="figure">
<ol style="list-style-type: decimal;"><li><p>During the running of the Linux system, if you directly unplug the power supply, it may cause the file system to lose some data. It is recommended to use the '''poweroff''' command to shut down the Linux system of the development board before powering off, and then unplug the power supply.</p><p>orangepi@orangepi:~$ '''sudo poweroff'''</p><p>'''Note that after turning off the development board, you need to unplug and replug the power supply before it can be turned on.'''</p></li><li><p>In addition to using the poweroff command to shut down, you can also use the power on/off button on the expansion board to shut down.</p><p>[[File:zero2w-img269img183.png]]</p><p>'''Note that Linux 5.4 requires manual configuration of the power on/off button before it can be used. For the opening method, please refer to the method of opening the power button in Linux5.4.'''</p></li><li><p>Use the '''reboot''' command to restart the Linux system in the development board</p><p>orangepi@orangepi:~$ '''sudo''' '''reboot'''</p></li></ol>
<span id/div></li><li><p>Then click Finish</p><div class="linux-sdkorangepi-build-usage-instructionsfigure"></span>
= '''Linux SDK——orangepi-build usage instructions''' = <span id="compilation-system-requirements"></span>== Compilation system requirements == The Linux SDK, '''orangepi-build''', only supports running on X64 computers with '''Ubuntu 22.04''' 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 '''22.04''', it means that the Ubuntu version currently used does not meet the requirements. Please change the system before performing the following operations. test@test:~$ '''lsb_release -a''' No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04 LTS Release: '''22.04''' Codename: '''jammy''' If the computer is installed with a Windows system and does not have Ubuntu 22.04 installed on it, you can consider using'''VirtualBox''' or '''VMware''' to install an Ubuntu 22.04 virtual machine in the Windows system. But please note, do not compile orangepi-build on the WSL virtual machine, because orangepi-build has not been tested in the WSL virtual machine, so there is no guarantee that orangepi-build can be used normally in WSL. In addition, please do not compile the Linux system on the development board. Use orangepi-build. The installation image download address of Ubuntu 22.04 amd64 version is: [https[File://repo.huaweicloud.com/ubuntuzero2w-releases/21img184.04/ubuntu-21.04-desktop-amd64.iso '''https://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/22.04/ubuntu-22.04-desktop-amd64.iso'''png]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:
</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>
[https:<span id="installation-via-python"><//mirrors.tuna.tsinghua.edu.cn/help/ubuntu/ '''https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/''']span>
<ol start="2" style="list-style-type: lower-alpha;"><li>Note that the Ubuntu version needs to be switched to 22.04.</li></ol>= Installation via python ===
[[File{| class="wikitable" style="background-color:#ffffdc;width:zero2w800px;" |-img271| <big>'''Before installation, please change the source of pip to a domestic source to speed up the installation of Python packages.pngFor the configuration method, see the instructions in the section &quot;[[Orange Pi Zero 2W#How to replace pip source in Python|How to Change the Pip Source of Python]]&quot;'''</big>|}
<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></olbigtest<p>orangepi@testorangepi:~$ '''sudo mv /etc/apt/sources.list cat /etc/apt/sources.list.bak-get update'''</p> test<p>orangepi@testorangepi:~$ '''sudo vim 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>|}</sourcesli><li><p>Then you need to compile and install Python3.list9. 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 source code image default Python version of Debian Bullseye is Python3.9, so there is commented by 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 improve apt update speedcompile and install it.'''</p><p>'''The default Python version of Debian Bookworm is Python3. You can uncomment 11, so there is no need to compile and install it yourself if necessary.'''</p></big>|}deb https:</li><li><p>Then create a Python virtual environment</mirrorsp>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Debian Bookworm is python3.tuna11, please remember to replace the corresponding command.tsinghua.edu.cn'''</ubuntup></ jammy main restricted universe multiversebig>|}# deb{| class="wikitable" style="width:800px;" |-src https| <p>orangepi@orangepi:~$ '''sudo mkdir /srv/homeassistant'''</p><p>orangepi@orangepi:~$ '''sudo chown orangepi:orangepi /mirrors.tuna.tsinghua.edu.cnsrv/ubuntuhomeassistant'''</ jammy main restricted universe multiversep> deb https<p>orangepi@orangepi:~$ '''cd /srv/homeassistant'''</mirrorsp><p>orangepi@orangepi:~$ '''python3.tuna9 -m venv .tsinghua.edu.cn'''</p><p>orangepi@orangepi:~$ '''source bin/ubuntuactivate'''</ jammy-updates main restricted universe multiversep> # deb-src https<p>(homeassistant) orangepi@orangepi:/srv/mirrors.tuna.tsinghua.edu.cnhomeassistant$</p>|}</ubuntuli><li><p>Then install the required Python packages</ jammyp>{| class="wikitable" style="width:800px;" |-updates main restricted universe multiverse| 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</ jammyp>{| class="wikitable" style="width:800px;" |-backports main restricted universe multiverse| # deb-src https<p>(homeassistant) orangepi@orangepi:/srv/mirrors.tuna.tsinghua.edu.cnhomeassistant$ '''pip3 install homeassistant'''</p>|}</ubuntuli><li><p>Then enter the following command to run Home Assistant Core</ jammyp>{| class="wikitable" style="width:800px;" |-backports main restricted universe multiverse| deb https<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-security main restricted universe multiversebig>|}<div class="figure">
# deb[[File:zero2w-src https://mirrors.tuna.tsinghuaimg180.edu.cn/ubuntu/ jammy-security main restricted universe multiversepng]]
# Pre-release software source, not recommended to be enabled</div></li></ol>
# deb https://mirrors.tuna.tsinghua.edu.cn<span id="opencv-installation-method"></ubuntu/ jammy-proposed main restricted universe multiversespan>
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse== OpenCV installation method ==
<ol startspan id="4" style="listuse-apt-styleto-type: lowerinstall-alpha;opencv"><li/span>After the replacement, you need === Use apt to update the package information and ensure that no errors are reported.</li></ol>install OpenCV ===
test<ol style="list-style-type: decimal;"><li><p>The installation command is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@testorangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y libopencv-dev python3-opencv'''</p>|}</li><li><p>Then use the following command to print the version number of OpenCV. The output is normal, indicating that the OpenCV installation is successful.</p><ol start="5" style="list-style-type: lower-alpha;"><li><p>The version of OpenCV in Ubuntu22.04 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''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 imagepython3 -c &quot;import cv2; print(cv2.__version__)&quot;'''</lip><p>'''4.5.4'''</olp>|}<span id/li><li><p>The version of OpenCV in Ubuntu20.04 is as follows:</p>{| class="wikitable" style="obtainwidth:800px;" |-the-source-code| <p>orangepi@orangepi:~$ '''python3 -c &quot;import cv2; print(cv2.__version__)&quot;'''</p><p>'''4.2.0'''</p>|}</li><li><p>The version ofOpenCV in Debian11 is as follows:</p>{| class="wikitable" style="width:800px;" |-linux| <p>orangepi@orangepi:~$ '''python3 -sdk"c &quot;import cv2; print(cv2.__version__)&quot;'''</p><p>'''4.5.1'''</p>|}</spanli>== Obtain the source code <li><p>The version of linux sdk OpenCV in Debian12 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 -c &quot;import cv2; print(cv2.__version__)&quot;'''</p><p>'''4.6.0'''</p>|}</li></ol></li></ol>
<span id="downloadset-orangepiup-buildthe-fromchinese-githubenvironment-and-install-the-chinese-input-method"></span>=== Download orangepi-build from github ===
Linux sdk refers to == Set up the orangepi-build set of codes. Orangepi-build is modified based on Chinese environment and install the armbian build compilation system. Multiple versions of Linux images can be compiled using orangepi-build. Use the following command to download the orangepi-build code:Chinese input method ==
test@test{| class="wikitable" style="background-color:#ffffdc;width:~$ 800px;" |-| <big>'''sudo apt-get updateNote, before installing the Chinese input method, please make sure that the Linux system used by the development board is a desktop version.'''</big>|}
test@test:~$ '''sudo apt<span id="debian-get install system-y git'''installation-method"></span>=== Debian system installation method ===
test@test<ol style="list-style-type:~$ decimal;"><li><p>First set the default '''locale'''git clone httpsto Chinese</p><ol style="list-style-type:lower-alpha;"><li><p>Enter the following command to start configuring '''locale'''<//github.com/p>{| class="wikitable" style="width:800px;" |-| <p>orangepi-xunlong/@orangepi:~$ '''sudo dpkg-build.git -b nextreconfigure locales'''</p>|}</li><li><p>Then select '''zh_CN.UTF-8 UTF-8'Note that when using '' in the H618 Soc development boardpop-up interface (use the up and down keys on the keyboard to move up and down, you need use the space bar to download select, and finally use the source code of Tab key to move the next branch of orangepi-build. The above git clone command needs cursor to specify the branch of the orangepi-build source code as next.'''&lt;OK&gt;''', and then return Car can be used)</p><div class="figure"p> [[File:zero2w-img272img186.png]] </divp></li><li><p>Then set the default '''locale'''When downloading the orangepi-build code through the git clone command, you do not need to enter the user name and password of the github account (the same is true for downloading other codes in this manual)'''zh_CN. If after entering the git clone command, Ubuntu PC prompts you to enter the user name of the github account. The name and password are usually entered incorrectly in the address of the orangepiUTF-8'''</p><p>[[File:zero2w-build warehouse behind git cloneimg187. Please carefully check whether there are any errors in the spelling of png]]</p></li><li><p>After exiting the commandinterface, rather than thinking that we have forgotten to provide the username and password of the github account.''' locale''' setting will begin. The u-boot and linux kernel versions currently used by output displayed on the H618 series development boards are command line is as follows:</p>{| class="wikitable" style="width:800px;"
|-
| '''branch'''| <p>orangepi@orangepi:~$ '''usudo dpkg-boot Versionreconfigure locales'''</p>| '''linux Kernel version'''<p>Generating locales (this might take a while)...</p>|:<p>en_US.UTF-8... done</p>| '''current'''| '''u:<p>zh_CN.UTF-boot v20188.05'''| '''linux5.4'''|-| '''next'''| '''u-boot v2021.07'''done</p>| '''linux6<p>Generation complete.1'''</p>
|}
</li></ol>
</li>
<li><p>Then open '''Input Method'''</p>
<p>[[File:zero2w-img188.png]]</p></li>
<li><p>Then select '''OK'''</p>
<p>[[File:zero2w-img189.png]]</p></li>
<li><p>Then select '''Yes'''</p>
<p>[[File:zero2w-img190.png]]</p></li>
<li><p>Then select '''fcitx'''</p>
<p>[[File:zero2w-img191.png]]</p></li>
<li><p>Then select '''OK'''</p>
<p>[[File:zero2w-img192.png]]</p></li>
<li><p>'''<span style="color:#FF0000">Then restart the Linux system to make the configuration take effect.</span>'''</p></li>
<li><p>Then open '''Fcitx configuration'''</p>
<p>[[File:zero2w-img193.png]]</p></li>
<li><p>Then click the + sign as shown in the picture below</p>
<p>[[File:zero2w-img194.png]]</p></li>
<li><p>Then search '''Google Pinyin''' and click '''OK'''</p>
<div class="figure">
'''The branch mentioned here is not the same thing as the branch of orangepi[[File:zero2w-build source code, please don't get confusedimg195. This branch is mainly used to distinguish different kernel source code versions.'''png]]
</div></li><li><p>Then put '''We define the linux5.4 bsp kernel currently provided by Allwinner as the current branch. The latest linux6.1 LTS kernel is defined as the next branch.Google Pinyin'''on top</p> After downloading, the following files and folders will be included<p>[[File:zero2w-img196.png]]</p><ol style="list-style-typep>[[File: lowerzero2w-alpha;"img197.png]]</p></li><li><p>Then open the '''build.shGeany'''editor to test the Chinese input method</p><p>[[File: Compile startup scriptzero2w-img198.png]]</p></li><li><p>The Chinese input method test is as follows</p><p>[[File:zero2w-img199.png]]</p></li><li><p>You can switch between Chinese and English input methods through the '''externalCtrl+Space''': Contains configuration files needed to compile the image, specific scripts, and source code of some programs, etc.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 '''LICENSEzh_CN.UTF-8'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi: GPL 2 license file~$ '''sudo vim /etc/default/locale'''</p><p># File generated by update-locale</lip><lip>LC_MESSAGES='''<span style="color:#FF0000">zh_CN.UTF-8</span>'''</p><p>LANG='''README<span style="color:#FF0000">zh_CN.mdUTF-8</span>'''</p><p>LANGUAGE='''<span style="color: orangepi#FF0000">zh_CN.UTF-build documentation8</span>'''</p>|}</li><li><p>Then '''scripts<span style="color:#FF0000">restart the system</span>'''and you will see that the system is displayed in Chinese.</p><p>[[File: Common script for compiling linux imageszero2w-img200.png]]</p></li></ol>
test@test:~<span id="installation-method-of-ubuntu-20.04-system"></orangepi-build$ '''ls'''span>
'''build=== Installation method of Ubuntu 20.sh external LICENSE README.md scripts'''04 system ===
<ol style="list-style-type: decimal;"><li><p>First open '''Language Support''If you downloaded the orangepi'</p><p>[[File:zero2w-build code from github, after downloading, you may img201.png]]</p></li><li><p>Then find that orangepithe '''Chinese (China)''' option</p><p>[[File:zero2w-build does not contain img202.png]]</p></li><li><p>Then please use the source code left button of u-boot the mouse to select '''Chinese (China)''' and linux kernelhold it down, and there is no cross-compilation tool required then drag it up to compile uthe starting position. After dragging, the display will be as shown below:</p><p>[[File:zero2w-boot and linux kernelimg203. chain, png]]</p></li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note that this step is normalnot easy to drag, because these things are stored in other separate github repositories or some servers (their addresses will please be detailed below)patient and try it a few times.'''</big>|}</ol><ol start="4" style="list-style-type: decimal;"><li><p>Then select '''Apply System-Wide''' to apply the Chinese settings to the entire system</p><p>[[File:zero2w-img204. Orangepipng]]</p></li><li><p>Then set the '''Keyboard input method system''' system to '''fcitx'''</p><p>[[File:zero2w-build will specify img205.png]]</p></li><li><p>'''<span style="color:#FF0000">Then restart the Linux system to make the addresses of uconfiguration take effect</span>'''</p></li><li><p>After re-bootentering the system, please select '''Do not ask me again''' in the following interface, Linux kernel and crossthen please decide according to your own preferences whether the standard folder should also be updated to Chinese</p><p>[[File:zero2w-compilation tool chain img206.png]]</p></li><li><p>Then you can see that the desktop is displayed in Chinese</p><p>[[File:zero2w-img207.png]]</p></li><li><p>Then we can open '''Geany''' to test the script and configuration fileChinese input method. When running orangepiThe opening method is as shown in the figure below</p><p>[[File:zero2w-buildimg208.png]]</p></li><li><p>After opening '''Geany''', when it finds that these things are not available locally, it will automatically download them from the corresponding placesEnglish input method is still the default.We can switch to the Chinese input method through the '''Ctrl+Space'''shortcut key, and then we can input Chinese.</p><p>[[File:zero2w-img209.png]]</p></li></ol>
<span id="downloadinstallation-themethod-crossof-compilationubuntu-tool22.04-chainsystem"></span>=== Download the cross-compilation tool chain ===
When orangepi-build is run for the first time, it will automatically download the cross-compilation '''toolchain''' and put it in the '''toolchains''' folder. Every time you run orangepi-build's build.sh script, it will check whether the cross-compilation toolchain in toolchains exists. If If it does not exist, the download will be restarted. If it exists, it will be used directly without repeated downloading=== Installation method of Ubuntu 22.04 system ===
<div classol style="figurelist-style-type: decimal;"><li><p>First open '''Language Support'''</p><p>[[File:zero2w-img273img201.png]]</p></li><li><p>Then find the '''Chinese (China)''' option</p><p>[[File:zero2w-img210.png]]</divp></li>The mirror URL <li><p>Then please use the left button of the cross-compilation tool chain in mouse to select '''Chinese (China is )''' and hold it down, then drag it up to the starting position. After dragging, the open source software mirror site of Tsinghua Universitydisplay will be as shown below:</p> <p>[[httpsFile:zero2w-img211.png]]</p></mirrorsli>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note that this step is not easy to drag, please be patient and try it a few times.tuna.tsinghua.edu.cn'''</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</armbianp><p>[[File:zero2w-releasesimg212.png]]</_toolchainp></ li><li><p>'''https<span style="color:#FF0000">Then restart the Linux system to make the configuration take effect</span>'''</mirrorsp></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.tuna</p><p>[[File:zero2w-img206.tsinghuapng]]</p></li><li><p>Then you can see that the desktop is displayed in Chinese</p><p>[[File:zero2w-img207.edupng]]</p></li><li><p>Then open the Fcitx5 configuration program</p><p>[[File:zero2w-img213.cnpng]]</armbian-releasesp></_toolchainli><li><p>Then choose to use Pinyin input method</''']p><div class="figure">
After toolchains is downloaded, it will contain multiple versions of cross[[File:zero2w-compilation t'''toolchain''':img214.png]]
</div></li><li><p>The interface after selection is as shown below, then click OK</p><p>[[File:zero2w-img215.png]]</p></li><li><p>Then we can open '''Geany''' to test@testthe Chinese input method. The opening method is as shown in the figure below</p><p>[[File:~zero2w-img208.png]]</orangepi-build$ p></li><li><p>After opening '''Geany''', the English input method is still the default. We can switch to the Chinese input method through the '''ls toolchains/Ctrl+Space'''shortcut key, and then we can enter Chinese.</p><p>[[File:zero2w-img216.png]]</p></li></ol>
gcc<span id="how-armto-11.2remotely-2022.02log-x86_64in-aarch64to-nonethe-linux-gnu gccsystem-linaro-4.9.4-2017.01-x86_64_aarch64-linux-gnu gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabidesktop"></span>
gcc-arm-11.2-2022.02-x86_64-arm-none-linux-gnueabihf gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabi gcc-linaro-aarch64-none-elf-4.8-2013.11_linux== How to remotely log in to the Linux system desktop ==
gcc<span id="remote-armlogin-9.2using-2019.12-x86_64-aarch64-none-linux-gnu gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf gcc-linaro-arm-linux-gnueabihf-4.8-2014.04_linuxnomachine"></span>=== Remote login using NoMachine ===
gcc{| class="wikitable" style="background-armcolor:#ffffdc;width:800px;" |-9| <big>'''Please ensure that the Ubuntu or Debian system installed on the development board is a <span style="color:#FF0000">desktop version</span> of the system.2-2019.12-x86_64-arm-none-linux-gnueabihf gcc-linaro-7.4.1-2019In addition, NoMachine also provides detailed usage documentation.02-x86_64_aarch64-linux-gnu gcc-linaro-arm-none-eabi-4.8-2014It is strongly recommended to read this document thoroughly to become familiar with the use of NoMachine.04_linuxThe document link is as follows:'''
'''https://knowledgebase.nomachine.com/DT10R00166'''</big>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''NoMachine supports Windows, Mac, Linux, iOS and Android platforms, so we can remotely log in and control the Orange Pi development board through NoMachine on a variety of devices. The cross-compilation tool chain used following demonstrates how to remotely log in to compile the H618 Linux kernel source code issystem desktop of the Orange Pi development board through NoMachine in Windows. For installation methods on other platforms, please refer to NoMachine's official documentation.'''</big>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Before operating, please make sure that the Windwos computer and the development board are in the same LAN, and that you can log in to the Ubuntu or Debian system of the development board through ssh normally.'''</big>|}
<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/olArm64 version of the deb package.'''</big>|}{| class="wikitable" style="width:800px;" |-| [https://www.nomachine.com/download/download&id=112&s=ARM '''gcc-arm-11https://downloads.2-2022nomachine.02-x86_64-aarch64-none-linux-gnucom/download/?id=118&amp;distro=ARM''']|}
[[File:zero2w-img217.png]]
</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>linux6<p>In addition, you can also download the '''NoMachine''' installation package from the official tool.1</lip><p>[[File:zero2w-img218.png]]</olp<p>First enter the '''gccremote login software-armNoMachine''' folder</p><p>[[File:zero2w-11img219.2png]]</p><p>Then download the arm64 version of the deb installation package</p><p>[[File:zero2w-2022img220.png]]</p></li><li><p>Then upload the downloaded '''nomachine_x.x.x_x_arm64.02deb''' 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;" |-x86_64| <p>orangepi@orangepi:~$ '''sudo dpkg -aarch64i nomachine_x.x.x_x_arm64_arm64.deb'''</p>|}</li></ol></li></ol><ol start="2" style="list-nonestyle-linuxtype: 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-gnucolor:#ffffdc;width:800px;" |-| <big>'''Note that this download link may change.'''</big>|}{| class="wikitable" style="width:800px;" The cross|-compilation tool chain used to compile the H618 u-boot source code is| '''https://downloads.nomachine.com/download/?id=9'''|}
[[File:zero2w-img221.png]]</ol><ol start="3" style="list-style-type: lower-alphadecimal;"><li>v2018<p>Then install NoMachine in Windows. '''Please restart your computer after installation.'''</p></li><li><p>Then open '''NoMachine''' in Window</p><p>[[File:zero2w-img222.png]]</p></li><li><p>After NoMachine is started, it will automatically scan other devices with NoMachine installed on the LAN. After entering the main interface of NoMachine, you can see that the development board is already in the list of connectable devices, and then click on the location shown in the red box in the picture below You can now log in to the Linux system desktop of the development board.</p><p>[[File:zero2w-img223.png]]</p></li><li><p>Then click '''OK'''</p><p>[[File:zero2w-img224.png]]</p></li><li><p>Then enter the username and password of the development board Linux system in the corresponding positions in the figure below, and then click OK to start logging in.</p><p>[[File:zero2w-img225.png]]</p></li><li><p>Then click OK in the next interface.</p></li><li><p>Finally you can see the desktop of the development board Linux system</p><p>[[File:zero2w-img226.05png]]</p></li></ol>
'''gcc<span id="remote-linarologin-7.4.1using-2019.02-x86_64_arm-linux-gnueabi'''vnc"></span>
<ol start="2" style="list-style-type: lower-alpha;"><li>v2021.07</li></ol>= Remote login using VNC ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''gcc-arm-11Before 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.2-2022.02-x86_64-aarch64-none-linux-gnu'''
'''<span idstyle="orangepi-build-complete-directory-structure-descriptioncolor:#FF0000">There are many problems with VNC testing in Ubuntu20.04, please do not use this method.</span>'''</big>=== orangepi-build complete directory structure description ===|}
<ol style="list-style-type: decimal;">
<li><p>After downloading, First run the orangepi-build warehouse does not contain the source code of the linux kernel'''set_vnc.sh''' script to set up vnc, u-boot and cross-compilation tool chain. The source code of the linux kernel and u-boot is stored in an independent git warehouse.'''remember to add sudo permission'''s</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li>|-| <p>The git warehouse where the linux kernel source code is stored is as followsorangepi@orangepi:~$ '''sudo set_vnc. Please note that the branch of the linux-orangepi warehouse is switched tosh'''</p><ol style="list-style-type: lower-alpha;"p><li>Linux5You will require a password to access your desktops.4</li></ol></li></ol></li></olp>
https://github.com/orangepi-xunlong/linux-orangepi/tree/'''orange-pi-5.4-sun50iw9'''
<ol startp>Password: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '''<span style="2color:#FF0000" >#Set the vnc password here, 8 characters</span>'''</p><p>Verify: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '''<span style="listcolor:#FF0000">#Set the vnc password here, 8 characters</span>'''</p><p>Would you like to enter a view-only password (y/n)? '''<span style-type="color: lower-alpha;#FF0000">n<li/span>Linux6.1'''</lip><p>xauth: file /root/.Xauthority does not exist</olp>
https://github.com/orangepi-xunlong/linux-orangepi/tree/'''orange-pi-6.1-sun50iw9'''
<ol start="2" style="list-style-type: lower-alpha;"><li><p>The git warehouse where the u-boot source code New 'X' desktop is stored is as follows. Please note that the branch of the u-boot-orangepi warehouse is switched to:1</p><ol style="list-style-type: lower-alpha;"><li>v2018.05</li></ol></li></ol>
https://github.com/orangepi-xunlong/u-boot-orangepi/tree/'''v2018.05-h618'''
<ol start="2" style="list-style-type: lower-alpha;"p>Creating default startup script /root/.vnc/xstartup</p><lip>v2021Starting applications specified in /root/.07vnc/xstartup</lip><p>Log file is /root/.vnc/orangepi:1.log</olp>
https://github.com/orangepi-xunlong/u-boot-orangepi/tree/'''v2021.07-sunxi'''
<ol start="2" style="list-style-type: decimal;"><li><p>When orangepi-build is run for the first time, it will download the cross-compilation tool chain, u-boot and linux kernel source code. After successfully compiling a linux image, the files and folders that can be seen in orangepi-build are:</p><ol style="list-style-type: lower-alpha;"><li><p>'''build.sh''': Compile startup script</p></li><li><p>'''external''': Contains the configuration files needed to compile the image, scripts for specific functions, and the source code of some programs. The rootfs compressed package cached during the image compilation Killing Xtightvnc 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 fileID 3047</p></li><li><p>'''README.md''': orangepi-build documentation</p></li><li><p>'''output''': Store compiled u-boot, linux and other deb packages, compilation logs, and compiled images and other files</p></li><li><p>'''scripts''': Common script for compiling linux images</p></li><li><p>'''toolchains''': Store cross-compilation tool chain</p></li><li><p>'''u-boot''': Store the source code of u-boot</p></li><li><p>'''userpatches''': Store the configuration files needed to compile the script</p></li></ol></li></ol>
test@test:~/orangepi-build$ '''ls'''
<p>New 'X''build.sh external kernel LICENSE output README.md scripts toolchains u-boot userpatches'''desktop is orangepi:1</p>
<span id="compile-u-boot"></span>
== Compile u-boot ==
# Run the build<p>Starting applications specified in /root/.sh script, remember to add sudo permissionsvnc/xstartup</p> test@test:~<p>Log file is /root/.vnc/orangepi-build$ '''sudo :1.log</build.sh'''p>|}</li><li><p>The steps to use MobaXterm software to connect to the development board Linux system desktop are as follows:</p><ol start="2" style="list-style-type: decimallower-alpha;"><li>Select '''U-boot package''' First click Session, then select VNC, then fill in the IP address and port of the development board, and press Enterfinally click OK to confirm.</li></ol>
<div class="figure">
[[File:zero2w-img274img227.png]]
</div></ol><ol start="32" style="list-style-type: decimallower-alpha;"><li><p>Then select enter the model VNC password set earlier</p><p>[[File:zero2w-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 boardLinux system.</lip></olli>
[[File:zero2w-img275img229.png]]</ol></li></ol><span id="qt-installation-method"></span>
<ol start="4" style="list-style-type: decimal;"><li><p>Then select the branch type of u-boot</p><ol styleQT installation method =="list-style-type: lower-alpha;"><li><p>The current branch will compile the u-boot v2018.05 version code that needs to be used by the linux5.4 image.</p></li><li><p>The next branch will compile the u-boot v2021.07 version code that needs to be used by the linux6.1 image.</p><p>[[File:zero2w-img276.png]]</p></li></ol></li><li><p>If you select the next branch, you will also be prompted to select the memory size, and you do not need to select the current branch.</p></li></ol>
<blockquoteol style="list-style-type: decimal;">a. If the development board you purchased has a memory size of 1.5GB, please select the first option. b. If <li><p>Use the development board you purchased has 1GB or 2GB or 4GB memory size, please choose the second option.following script to install QT5 and QT Creator</blockquotep>[[File:zero2w-img277.png]] <ol start{| class="6wikitable" style="list-style-typewidth: decimal800px;"|-| <p>orangepi@orangepi:~$ '''install_qt.sh'''</p>|}</li><li><p>Then it After installation, the QT version number will start to compile u-bootbe automatically printed. Some of the information prompted when compiling the next branch is as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li>Version <p>The qt version that comes with Ubuntu20.04 is '''5.12.8'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''install_qt.sh'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version '''<span style="color:#FF0000">5.12.8</span>''' in /usr/lib/aarch64-linux-gnu</p>|}</li><li><p>The QT version that comes with Ubuntu22.04 is '''5.15.3'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''install_qt.sh'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version '''<span style="color:#FF0000">5.15.3</span>''' in /usr/lib/aarch64-linux-gnu</p>|}</li><li><p>The QT version that comes with Debian11 is '''5.15.2'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''install_qt.sh'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version '''<span style="color:#FF0000">5.15.2</span>''' in /usr/lib/aarch64-linux-gnu</p>|}</li><li><p>The QT version that comes with Debian12 is '''5.15.8'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''install_qt.sh'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version '''<span style="color:#FF0000">5.15.8</span>''' in /usr/lib/aarch64-linux-gnu</p>|}</li></ol></li><li><p>Then you can see the QT Creator startup icon in '''Applications'''</p><p>[[File:zero2w-img230.png]]</p><p>You can also use the following command to open QT Creator</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''qtcreator'''</p>|}</li><li><p>The interface after QT Creator is opened is as follows</p><p>[[File:zero2w-img231.png]]</p></li><li><p>The version of QT Creator is as follows</p><ol style="list-style-type: lower-alpha;"><li><p>The default version of uQT Creator in '''Ubuntu20.04''' is as follows</p><p>[[File:zero2w-boot source img232.png]]</p></li><li><p>The default version of QT Creator in '''Ubuntu22.04''' is as follows</p><p>[[File:zero2w-img233.png]]</p></li><li><p>The default version of QT Creator in '''Debian11''' is as follows</p><p>[[File:zero2w-img234.png]]</p></li><li><p>The default version of QT Creator in '''Debian12''' is as follows</p><p>[[File:zero2w-img235.png]]</p></li></ol></li><li><p>Then set up QT</p><ol style="list-style-type: lower-alpha;"><li><p>First open '''Help'''-&gt;'''About Plugins...'''.</p><p>[[File:zero2w-img236.png]]</p></li><li><p>Then remove the check mark of '''ClangCodeModel'''</p><p>[[File:zero2w-img237.png]]</p></li><li><p>'''<span style="color:#FF0000">After setting up, you need to restart QT Creator</span>'''</p></li><li><p>Then make sure the GCC compiler used by QT Creator. If the default is Clang, please change it to GCC.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Debian12 please skip this step.'''</p></big>|}<p>[[File:zero2w-img238.png]]</p><p>[[File:zero2w-img239.png]]</p></li></ol></li><li><p>Then you can open a sample code</p><p>[[File:zero2w-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.</olp><p>[[File:zero2w-img241.png]]</p></li><li><p>Then click '''Configure Project'''</p><p>[[File:zero2w-img242.png]]</p></li><li><p>Then click the green triangle in the lower left corner to compile and run the 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>
[ o.k. ] Compiling u-boot [ '''v2021.07''' ] <ol startspan id="2" style="list-styleros-type: lowerinstallation-alpha;method"><li>Version of the cross-compilation tool chain</li></olspan[ o.k. ] Compiler version [ '''aarch64-linux-gnu-gcc 11''' ] <ol start="3" style="list-style-type: lower-alpha;"><li>Path to the compiled u-boot deb package</li></ol> [ o.k. ] Target directory [ '''orangepi-build/output/debs/u-boot''' ]
<ol start="4" style="list-style-type: lower-alpha;"><li>The package name of the compiled u-boot deb package</li></ol>ROS installation method ==
[ o.k. ] File name [ '''linux<span id="how-to-install-ros-u1-bootnoetic-nexton-orangepizero2w_x.xubuntu20.x_arm6404"></span>=== How to install ROS 1 Noetic on Ubuntu20.deb''' ]04 ===
<ol start="5" style="list-style-type: lower-alpha;"><li>Compilation time</li></ol># The currently active version of ROS 1 is as follows, the recommended version is '''Noetic Ninjemys'''
::[ o.k[File:zero2w-img245. png] Runtime [ '''1 min''' ]
<ol start="6" style="list-style-type: lower-alpha;"><li>Repeat the command to compile u-boot. Use the following command without selecting through the graphical interface. You can start compiling u:[[File:zero2w-boot directlyimg246.</li></ol>png]]
::{| class="wikitable" style="width:800px;" |-| [ ohttp://docs.kros. ] Repeat Build Options [ org/ '''sudo http://docs./buildros.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=u-bootorg''' ]
<ol start="7" style="list-style-type'''https: decimal;"><li>View the compiled u-boot deb package</li></ol>wiki.ros.org/Distributions'''|}
test<ol start="2" style="list-style-type: decimal;"><li><p>The link to the official installation documentation of ROS 1 '''Noetic Ninjemys''' is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>[http://wiki.ros.org/noetic/Installation/Ubuntu '''http://wiki.ros.org/noetic/Installation/Ubuntu''']</p>|}</li><li><p>In the official installation documentation of ROS '''Noetic Ninjemys''', Ubuntu recommends using Ubuntu20.04, so please ensure that the system used by the development board is '''<span style="color:#FF0000">Ubuntu20.04 desktop system</span>'''.</p>{| class="wikitable" style="width:800px;" |-| <p>[http://wiki.ros.org/noetic/Installation '''http://wiki.ros.org/noetic/Installation''']</p><p>[[File:zero2w-img247.png]]</p>|}</li><li><p>Then use the script below to install ros1</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@testorangepi:~/orangepi-build$ '''ls outputinstall_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.</debsp></uli>{| class="wikitable" style="background-bootcolor:#ffffdc;width:800px;" |-| <big>'''<span style="color:#FF0000">Note that when running the following command, you need to ensure that the development board can access github normally, otherwise an error will be reported due to network problems.</span>'''
'''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb'''
<ol start="8" style="list-style-type: decimal;"><li>When '''The install_ros.sh script will try to modify /etc/hosts and automatically run the orangepi-bulid compilation system compiles the u-boot source codefollowing commands. However, it will first synchronize the u-boot source code with the u-boot source code of the this method cannot guarantee that github servercan be accessed normally every time. Therefore, if you want to modify If install_ros.sh prompts the u-boot source codefollowing error after installing ros1, you first need please find other ways to turn off allow the download and update function linux system of the source code. ('''You need development board to completely compile u-boot before you can turn off this functionaccess github normally, otherwise it will prompt that and then manually run the source code of u-boot cannot be foundfollowing Order.'''), otherwise the modifications will be restored. The method is as follows:</li></ol>
<blockquote>Set the IGNORE_UPDATES variable in u'''userpatches/config-default.conf''' to &quot;yes&quot;
</blockquote>
test@test:~/orangepi-build$ '''vim userpatches/config-default.conf'''
'''https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew....yaml'''
IGNORE_UPDATES=&quot;'''yesHit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml'''&quot;
......'''<span style="color:#FF0000">ERROR: error loading sources list:</span>'''
::'''<ol start="9" span style="list-style-typecolor: decimal;#FF0000">The read operation timed out<li/span><p>When debugging u-boot code, you can use the following method to update u-boot in the linux image for testing'''</pbig><ol |}{| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li>First upload the compiled deb package of u|-boot to the Linux system of the development board.<| orangepi@orangepi:~$ '''source /li><opt/ol><ros/li><noetic/ol>setup.bash'''
testorangepi@testorangepi:~/orangepi-build$ '''cd output/debs/u-bootsudo rosdep init'''
test@test:~Wrote /orangepi_buildetc/outputros/debsrosdep/usources.list.d/20-boot$ '''scp \'''default.list
'''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb [mailtoRecommended:root@192.168.1.xxx:/root root@192.168.1.xxx:/root]'''please run
<ol start="2" style="list-style-type: lower-alpha;">
<li>Install the new u-boot deb package just uploaded</li></ol>
orangepi@orangepi:~$ '''sudo dpkg -i''' '''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb''':rosdep update
<ol start="3" style="list-style-typeorangepi@orangepi: lower-alpha;"><li>Then run the nand-sata-install script</li></ol>~$ '''rosdep update'''
orangepi@orangepi:~$ '''sudo nand-sata-install'''reading in sources list data from /etc/ros/rosdep/sources.list.d
<ol start="4" style="list-style-typeHit https: lower-alpha;"><li>Then select '''5 Install/Update the bootloader on SD/eMMC'''<raw.githubusercontent.com/ros/rosdistro/master/li><rosdep/ol>osx-homebrew.yaml
[[FileHit https:zero2w-img278//raw.png]]githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
<ol start="5" style="list-style-typeHit https: lower-alpha;"><li>After pressing the Enter key, a Warning will pop up first//raw.githubusercontent.<com/li><ros/ol>rosdistro/master/rosdep/python.yaml
[[FileHit https:zero2w-img279//raw.png]]githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
<ol start="6" style="list-style-typeHit https: lower-alpha;"><li>Press the Enter key again to start updating u-boot//raw. After the update is completed, the following information will be displayedgithubusercontent.<com/ros/rosdistro/li><master/ol>releases/fuerte.yaml
[[FileQuery rosdistro index https:zero2w//raw.githubusercontent.com/ros/rosdistro/master/index-img280v4.png]]yaml
<ol start="7" style="listSkip end-styleof-type: lower-alphalife distro &quot;ardent&quot;"><li>Then you can restart the development board to test whether the u-boot modification has taken effect.</li></ol>
<span id="compileSkip end-theof-linux-kernel"></span>== Compile the linux kernel ==life distro &quot;bouncy&quot;
# Run the '''build.sh''' script, remember to add sudo permissionsSkip end-of-life distro &quot;crystal&quot;
test@test:~/orangepiSkip end-build$ '''sudo ./build.sh'''of-life distro &quot;dashing&quot;
<ol start="2" style="listSkip end-styleof-type: decimallife distro &quot;eloquent&quot;"><li>Select '''Kernel package''' and press Enter</li></ol>
<div class="figure">Add distro &quot;foxy&quot;
[[File:zero2w-img281.png]]Add distro &quot;galactic&quot;
</div><ol start="3" style="listSkip end-styleof-type: decimallife distro &quot;groovy&quot;"><li>Then you will be prompted whether you need to display the kernel configuration interface. If you do not need to modify the kernel configuration, select the first one. If you need to modify the kernel configuration, select the second one.</li></ol>
[[File:zero2w-img282.png]]Add distro &quot;humble&quot;
<ol start="4" style="listSkip end-styleof-type: decimallife distro &quot;hydro&quot;"><li>Then select the model of the development board</li></ol>
[[File:zero2wSkip end-img275.png]]of-life distro &quot;indigo&quot;
<ol start="5" style="listSkip end-styleof-type: decimallife distro &quot;jade&quot;"><li>Then select the branch type of the kernel source code</li></ol>
<blockquote>a. The current branch will compile the linux5.4 kernel source codeSkip end-of-life distro &quot;kinetic&quot;
b. The next branch will compile the linux6.1 kernel source code</blockquote>[[File:zero2wSkip end-img276.png]]of-life distro &quot;lunar&quot;
<ol start="6" style="list-style-type: decimalAdd distro &quot;melodic&quot;"><li>If you choose to display the kernel configuration menu (the second option) in step 3), the kernel configuration interface opened through '''make menuconfig''' will pop up. At this time, you can directly modify the kernel configuration. After modification, save and exit. Yes, compilation of the kernel source code will begin after exiting.</li></ol>
[[File:zero2w-img283.png]]Add distro &quot;noetic&quot;
<ol style="list-style-type: lower-alphaAdd distro &quot;rolling&quot;"><li>If you do not need to modify the kernel configuration options, when running the build.sh script, pass '''KERNEL_CONFIGURE=no''' to temporarily block the pop-up of the kernel configuration interface.</li></ol>
updated cache in /home/orangepi/.ros/rosdep/sources.cache|}</ol><ol start="6" style="list-style-type: decimal;"><li><p>Then open a command line terminal window on the '''desktop''', and then use the '''test_ros.sh''' script to start a small turtle routine to testwhether ROS can be used normally.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@testorangepi:~/orangepi-build$ '''sudo test_ros.sh'''</buildp>|}</li><li><p>After running the '''test_ros.sh KERNEL_CONFIGURE=no'''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 startdiv class="2figure" style="list-style-type: lower-alpha;"><li><p>b. You can also set '''KERNEL_CONFIGURE=no''' in the orangepi-build/userpatches/config-default.confconfiguration file to permanently disable this function.</p></li><li><p>If the following error is prompted when compiling the kernel, it is because the Ubuntu PC terminal interface is too small, causing the make menuconfig interface to be unable to be displayed. Please increase the Ubuntu PC terminal to the maximum size, and then rerun the build.sh script.</p></li></ol>
[[File:zero2w-img284img249.png]]
</div></ol><ol start="79" style="list-style-type: decimal;"><li><p>Part of At this time, press the direction keys on the information prompted when compiling keyboard to control the next branch kernel source code is explained as follows:little turtle to move up, down, left, and right.</p><ol style="list-style-typep>[[File: lowerzero2w-alpha;"><li>Version of the linux kernel source codeimg250.png]]</lip></ol></li></ol>
[ o<span id="how-to-install-ros-2-galactic-on-ubuntu20.k. ] Compiling current kernel [ '''6.1.31''' ]04"></span>
<ol start="== How to install ROS 2" styleGalactic on Ubuntu20.04 ==="list-style-type: lower-alpha;"><li>The version of the cross-compilation tool chain used</li></ol>
<ol style="list-style-type: decimal;"><li><p>The currently active version of ROS 2 is as follows, the recommended version is '''Galactic Geochelone'''</p><p>[[ oFile:zero2w-img251.kpng]]</p><p>[[File:zero2w-img252. png]] Compiler version </p>{| class="wikitable" style="width:800px;" |-| <p>[ http://docs.ros.org/ '''http://docs.ros.org''']</p><p>'''aarch64http://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;" |-linux| <p>'''docs.ros.org/en/galactic/Installation.html'''</p><p>'''http://docs.ros.org/en/galactic/Installation/Ubuntu-Install-Debians.html'''</p>|}</li><li><p>In the official installation documentation of ROS 2 '''Galactic Geochelone''', Ubuntu Linux recommends using Ubuntu20.04, so please ensure that the system used by the development board is the '''<span style="color:#FF0000">Ubuntu20.04 desktop system</span>'''. There are several ways to install ROS 2. The following demonstrates how to install ROS 2 '''Galactic Geochelone''' through '''Debian packages'''.</p></li><li><p>Use the '''install_ros.sh''' script to install ros2</p>{| class="wikitable" style="width:800px;" |-gnu| <p>orangepi@orangepi:~$ '''install_ros.sh ros2'''</p>|}</li><li><p>The '''install_ros.sh''' script will automatically run the '''ros2 -gcc 11h''' command after installing ros2. If you can see the following print, it means that the ros2 installation is complete.</p>{| class="wikitable" style="width:800px;" |-| <p>usage: ros2 [-h]Call `ros2 &lt;command&gt; -h` for more detailed usage. ...</p>
<ol start="3" style="list-style-type: lower-alpha;">
<li>The default configuration file used by the kernel and the path where it is stored are as follows</li></ol>
[ o<p>ros2 is an extensible command-line tool for ROS 2.k. ] Using kernel config file [ '''orangepi-build/external</config/kernel/linux-6.1-sun50iw9-next.config''' ]p>
<ol start="4" style="list-style-type: lower-alpha;">
<li>The path to the kernel-related deb package generated by compilation</li></ol>
[ o.k. ] Target directory [ '''output<p>optional arguments:</debsp>:<p>-h, --help show this help message and exit</''' ]p>
<ol start="5" style="list-style-type: lower-alpha;">
<li>The package name of the kernel image deb package generated by compilation</li></ol>
[ o.k. ] File name [ '''linux<p>Commands:</p>:<p>action Various action related sub-imagecommands</p>:<p>bag Various rosbag related sub-nextcommands</p>:<p>component Various component related sub-sun50iw9_x.x.x_arm64.deb''' ]commands</p>:<p>daemon Various daemon related sub-commands</p>:<p>doctor Check ROS setup and other potential issues</p>:<p>interface Show information about ROS interfaces</p>:<p>launch Run a launch file</p>:<p>lifecycle Various lifecycle related sub-commands</p>:<p>multicast Various multicast related sub-commands</p>:<p>node Various node related sub-commands</p>:<p>param Various param related sub-commands</p>:<p>pkg Various package related sub-commands</p>:<p>run Run a package specific executable</p>:<p>security Various security related sub-commands</p>:<p>service Various service related sub-commands</p>:<p>topic Various topic related sub-commands</p>:<p>wtf Use `wtf` as alias to `doctor`</p>
<ol start="6" style="list-style-type: lower-alpha;">
<li>Compilation time</li></ol>
[ o:<p>Call `ros2 &lt;command&gt; -h` for more detailed usage.k. ] Runtime [ </p>|}</li><li><p>Then you can use the '''10 mintest_ros.sh''' ]script to test whether ROS 2 is installed successfully. If you can see the following print, it means ROS 2 can run normally.</p> <ol start{| class="7wikitable" style="list-style-typewidth: lower-alpha800px;"|-| <p>orangepi@orangepi:~$ '''test_ros.sh'''</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] [1671174101.200091527] [talker]: Publishing: 'Hello World: 1'</lip><p>[INFO] [1671174101.235661048] [listener]: I heard: [Hello World: 1]</olp<p>[INFO] [ o.k1671174102. 199572327] Repeat Build Options [ talker]: Publishing: 'Hello World: 2''sudo </p><p>[INFO] [1671174102.204196299] [listener]: I heard: [Hello World: 2]</buildp><p>[INFO] [1671174103.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=kernel KERNEL_CONFIGURE=no'199580322] [talker]: Publishing: 'Hello World: 3' </p><p>[INFO] [1671174103.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_x.x.x_arm64source /opt/ros/galactic/setup.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>
test@test:~/orangepi<span id="how-to-install-ros-2-humble-on-build$ '''ls output/debsubuntu22.04"></linux-*'''span>
output/debs/linux-dtb-next-sun50iw9_x=== How to install ROS 2 Humble on Ubuntu22.x.x_arm64.deb04 ===
output/debs/linux<ol style="list-headersstyle-next-sun50iw9_xtype: decimal;"><li><p>Use the install_ros.xsh script to '''install_ros.x_arm64sh'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''install_ros.debsh ros2'''</p>|}output</debsli><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.</linuxp>{| class="wikitable" style="width:800px;" |-image| <p>usage: ros2 [-nexth] Call `ros2 &lt;command&gt; -sun50iw9_xh` for more detailed usage.x.x_arm64.deb.</p>
<ol start="9" style="list-style-type: decimal;">
<li>When the orangepi-bulid compilation system compiles the linux kernel source code, it will first synchronize the linux kernel source code with the linux kernel source code of the github server. Therefore, if you want to modify the linux kernel source code, you first need to turn off the update function of the source code ('''it needs to be completely compiled once This function can only be turned off after obtaining the Linux kernel source code, otherwise it will prompt that the source code of the Linux kernel cannot be found'''), otherwise the modifications will be restored. The method is as follows:</li></ol>
<blockquotep>Set the IGNORE_UPDATES variable in '''userpatches/configros2 is an extensible command-defaultline tool for ROS 2.conf''' to &quot;yes&quot;</blockquotep>test@test:~/orangepi-build$ '''vim userpatches/config-default.conf'''
IGNORE_UPDATES=&quot;'''yes'''&quot;
<ol start="10" style="list-style-type: decimal;"><li><p>If the kernel is modified, you can use the following method to update the kernel and kernel module of the development board Linux systemoptional arguments:</p>:<ol style="listp>-styleh, -type: lower-alpha;"><li>Upload the compiled deb package of the Linux kernel to the Linux system of the development boardhelp show this help message and exit</li></ol></li></olp>
test@test:~/orangepi-build$ '''cd output/debs'''
test@test<p>Commands:~</orangepip>:<p>action Various action related sub-commands</p>:<p>bag Various rosbag related sub-commands</p>:<p>component Various component related sub-commands</p>:<p>daemon Various daemon related sub-commands</p>:<p>doctor Check ROS setup and other potential issues</p>:<p>interface Show information about ROS interfaces</p>:<p>launch Run a launch file</p>:<p>lifecycle Various lifecycle related sub-buildcommands</outputp>:<p>multicast Various multicast related sub-commands</p>:<p>node Various node related sub-commands</p>:<p>param Various param related sub-commands</p>:<p>pkg Various package related sub-commands</p>:<p>run Run a package specific executable</p>:<p>security Various security related sub-commands</p>:<p>service Various service related sub-commands</p>:<p>topic Various topic related sub-commands</p>:<p>wtf Use `wtf` as alias to `doctor`</debs$ '''scp \'''p>
'''linux-image-next-sun50iw9_x.x.x_arm64.deb root@192.168.1.xxx:/root'''
:<p>Call `ros2 &lt;command&gt; -h` for more detailed usage.</p>|}</li><li><p>Then you can use the '''test_ros.sh''' script to test whether ROS 2 is successfully installed. If you can see the following print, it means ROS 2 can run normally.<ol start/p>{| class="2wikitable" style="listwidth:800px;" |-| <p>orangepi@orangepi:~$ '''test_ros.sh'''</p><p>[INFO] [1671174101.200091527] [talker]: Publishing: 'Hello World: 1'</p><p>[INFO] [1671174101.235661048] [listener]: I heard: [Hello World: 1]</p><p>[INFO] [1671174102.199572327] [talker]: Publishing: 'Hello World: 2'</p><p>[INFO] [1671174102.204196299] [listener]: I heard: [Hello World: 2]</p><p>[INFO] [1671174103.199580322] [talker]: Publishing: 'Hello World: 3'</p><p>[INFO] [1671174103.204019965] [listener]: I heard: [Hello World: 3]</p>|}</li><li><p>Run the following command to open rviz2</p>{| class="wikitable" style="width:800px;" |-type| <p>orangepi@orangepi:~$ '''source /opt/ros/humble/setup.bash'''</p><p>orangepi@orangepi:~$ '''ros2 run rviz2 rviz2'''</p><p>[[File: lowerzero2w-alphaimg254.png]]</p>|}</li><li><p>Reference documentation</p>{| class="wikitable" style="width:800px;"|-| <p>'''http://docs.ros.org/en/humble/index.html'''</p><lip>[http://docs.ros.org/en/galactic/Tutorials.html '''http://docs.ros.org/en/humble/Installation/Ubuntu-Install the deb package of the new linux kernel just uploaded-Debians.html''']</p>|}</li></ol>
orangepi@orangepi:~$ '''sudo dpkg <span id="how-i linuxto-imageinstall-nextkernel-sun50iw9_x.x.x_arm64.deb'''header-files"></span>
<ol start="3" style="list-style-type: lower-alpha;"><li>Then restart the development board and check whether the How to install kernel-related modifications have taken effect.</li></ol>header files ==
orangepi@orangepi{| class="wikitable" style="background-color:~$ #ffffdc;width:800px;" |-| <big>'''sudo''' '''rebootDebian11 system with <span style="color:#FF0000">Linux6.1</span> kernel will report GCC error when compiling kernel module. So if you want to compile the kernel module, please use Debian12 or Ubuntu22.04.'''</big>|}
<span idol style="compilelist-style-rootfstype: 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/'''</spanp>{| class="wikitable" style= Compile rootfs =="width:800px;" |-# Run the build.sh script, remember to add sudo permissions|  test<p>orangepi@testorangepi:~/orangepi-build$ '''sudo .ls /opt/build.shlinux-headers*'''</p><p>/opt/linux-headers-xxx-sun50iw9_x.x.x_arm64.deb</p>|}</li><ol startli><p>Use the following command to install the deb package of the kernel header file</p>{| class="2wikitable" style="list-style-typewidth: decimal800px;">|-| <lip>Select orangepi@orangepi:~$ '''Rootfs and all sudo dpkg -i /opt/linux-headers*.deb packages''' and press Enter</p>|}</li><li><p>After installation, you can see the folder where the kernel header file is located under '''/olusr/src'''.</p<div {| class="figurewikitable">style="width:800px;" |-| [[File<p>orangepi@orangepi:zero2w~$ '''ls /usr/src'''</p><p>linux-headers-img285x.png]]x.x</p>|}</divli><ol startli><p>Then you can compile the source code of the hello kernel module that comes with the Linux image. The source code of the hello module is in '''/usr/src/hello'''. After entering this directory, then use the make command to compile.</p>{| class="3wikitable" style="list-style-typewidth: decimal800px;"|-| <p>orangepi@orangepi:~$ '''cd /usr/src/hello/'''</p><lip>Then select the model of the development boardorangepi@orangepi:/usr/src/hello$ '''sudo make'''</lip><p>make -C /lib/olmodules/5.4.125/build M=/usr/src/hello modules</p><p>make[1]: Entering directory '/usr/src/linux-headers-5.4.125'</p>:<p>CC [M] /usr/src/hello/hello.o</p>:<p>Building modules, stage 2.</p>:<p>MODPOST 1 modules</p>:<p>CC [FileM] /usr/src/hello/hello.mod.o</p>:<p>LD [M] /usr/src/hello/hello.ko</p><p>make[1]:zero2wLeaving directory '/usr/src/linux-img275headers-5.png]]4.125'</p>|}<ol start/li><li><p>After compilation, the '''hello.ko''' kernel module will be generated</p>{| class="4wikitable" style="list-style-typewidth: decimal800px;"|-| <p>orangepi@orangepi:/usr/src/hello$ '''ls *.ko'''</p><p>hello.ko</p>|}</li><li><p>Then select Use the branch type of '''insmod''' command to insert the '''hello.ko''' kernel source code. Different versions of module into the kernel source code maintain different rootfs types.</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"|-| <p>orangepi@orangepi:/usr/src/hello$ '''sudo insmod hello.ko'''</p>|}</li><li><p>In Then use the '''demsg''' command to view the current branch, output of the '''hello.ko''' kernel module. If you can see three options: debian11the following output, ubuntu20it means that the '''hello.04, and ubuntu22ko''' kernel module is loaded correctly.04</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:/usr/src/hello$ '''dmesg | grep &quot;Hello&quot;'''</p><p>[ 2871.893988] '''Hello Orange Pi -- init'''</p>|}</li><li><p>In Use the '''rmmod''' command to uninstall the next branch, you can see three options'''hello.ko''' kernel module</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:/usr/src/hello$ '''sudo rmmod hello'''</p><p>orangepi@orangepi: debian11, debian12, and ubuntu22.04/usr/src/hello$ '''dmesg | grep &quot;Hello&quot;'''</p><p>[ 2871.893988] Hello Orange Pi -- init</p></lip>[ 3173.800892] '''Hello Orange Pi -- exit'''</olp>|}
</li></ol>
[[File:zero2w<span id="testing-img276.png]]of-some-programming-languages-supported-by-linux-system"></span>
<ol start="5" style="list-style-type: decimal;"><li>Then select the type Testing of rootfs</li></ol>some programming languages supported by Linux system ==
[[File:zero2w<span id="debian-img286.png]]bullseye-system"></span>=== Debian Bullseye system ===
<ol start="6" style="list-style-type: decimal;"><li><p>Then select Debian Bullseye is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the type Linux system of imagethe 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:~$ '''Image with console interface (server)gcc --version''' Represents </p><p>gcc (Debian 10.2.1-6) 10.2.1 20210110</p><p>Copyright (C) 2020 Free Software Foundation, Inc.</p><p>This is free software; see the image of the server version, which source for copying conditions. There is relatively small in sizeNO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>|}</li><li><p>Write the '''Image with desktop environmenthello_world.c''' Represents an image with a desktop, which is relatively large program in size.C language</p>{| class="wikitable" style="width:800px;" |-| </lip>orangepi@orangepi:~$ '''vim hello_world.c'''</olp></lip>#include &lt;stdio.h&gt;</olp>
<div class="figure">
[[File<p>int main(void)</p><p>{</p>:zero2w-img287.png]]<p>printf(&quot;Hello World!\n&quot;);</p>
</div>
<ol start="7" style="list-style-type: decimal;">
<li>If you are compiling the server version of the image, you can also choose to compile the Standard version or the Minimal version. The Minimal version will have much less pre-installed software than the Standard version ('''please do not choose the Minimal version without special needs, because many things are not pre-installed by default. Some functions may not be available''')</li></ol>
:<div class="figure"p>return 0;</p[[File:zero2w-img288.png]] <p>}</divp>|}<ol start="8" style="list-style-type: decimal;"/li><li>If you are compiling a desktop version of the image, you also need to select the type of desktop environment. Currently, only XFCE is maintained, so please select an XFCE type desktop.</lip>Then compile and run '''hello_world.c'''</olp[[File:zero2w-img289.png]] [[File:zero2w-img290.png]] You can then select additional packages that need to be installed. Please press the Enter key here to skip directly. [[File:zero2w-img291.png]] <ol start{| class="9wikitable" style="list-style-typewidth: decimal800px;"><li>|-| <p>Then the compilation of rootfs will startorangepi@orangepi:~$ '''gcc -o hello_world hello_world. Some of the information prompted during compilation are as follows:c'''</p><ol style="list-style-typep>orangepi@orangepi: lower-alpha;"~$ '''./hello_world'''</p><lip>Type of rootfsHello World!</li></olp>|}
</li></ol>
 [ o.k. ] local not found [ Creating new rootfs cache for '''bullseye''' ] <ol start="2" style="list-style-type: lower-alpha;"><li>The storage path of the compiled rootfs compressed package</li></ol> [ o.k. ] Target directory [ '''orangepi-build/external/cache/rootfs''' ] <ol start="3" style="list-style-type: lower-alpha;"><li>The name of the rootfs compressed package generated by compilation</li></ol> [ o.k. ] File name [ '''bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4''' ] <ol start="10" style="list-style-type: decimal;"><li><p>View the compiled rootfs compressed packageDebian Bullseye has Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The specific version of Python is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3'''</p><p>'''Python 3.9.2'''bullseye(default, Feb 28 2021, 17:03:44)</p><p>[GCC 10.2.1 20210110] on linux</p><p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</p><p>&gt;&gt;&gt;</p>|}{| class="wikitable" style="background-xfcecolor:#ffffdc;width:800px;" |-arm64| <big><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p></big>|}</li><li><p>Write the '''hello_world.5250ec7002de9e81a41de169f1f89721py''' program in Python language</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.tarpy'''</p><p>print('Hello World!')</p>|}</li><li><p>The result of running '''hello_world.lz4py''' It is a compressed package of rootfsas follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 hello_world.py'''</p><p>Hello World!</p>|}</li></ol></li><li><p>Debian Bullseye does not install Java compilation tools and operating environment by default.</p><ol style="list-style-type: lower-alpha;"><li><p>You can use the following command to install openjdk. The meaning of each field latest version in Debian Bullseye is openjdk-17</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''</p>|}</li><li><p>After installation, you can check the Java version.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''java --version'''</p>|}</li><li><p>Write the name isJava version of '''hello_world.java'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println(&quot;Hello World!&quot;);</p>:<p>}</p><p>}</p>|}</li><li><p>Then compile and run '''hello_world.java'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''javac hello_world.java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p>|}</li></ol>
</li></ol>
<blockquote>a) '''bullseye''' represents the type of Linux distribution of rootfs b) '''xfce''' indicates that the rootfs is the desktop version, and if it is cli, it indicates the server version. c) '''arm64''' represents the architecture type of rootfs d) '''25250ec7002de9e81a41de169f1f89721''' is the MD5 hash value generated by the package names of all software packages installed by rootfs. As long as the list of software packages installed by rootfs is not modified, this value will not change. The compilation script will use this MD5 hash value. Determine whether rootfs needs to be recompiled</blockquote><ol start="2" stylespan id="list-styledebian-type: lowerbookworm-alpha;system"><li>'''bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4.list''' Lists the package names of all packages installed by rootfs</lispan></ol> test@test:~/orangepi-build$ '''ls external/cache/rootfs/''' bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4 bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4.current bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4.list
<ol start="11" style="list-style-type: decimal;"><li>If the required rootfs already exists under '''external/cache/rootfs''', then compiling the rootfs again will directly skip the compilation process and will not restart the compilation. When compiling the image, it will also go to '''external/cache/rootfs''' to check whether it already exists. There is a cached rootfs available. If it is available, use it directly. This can save a lot of download and compilation time.</li></ol>= Debian Bookworm system ===
<span idol style="list-style-type: decimal;"><li><p>Debian Bookworm is installed with the gcc compilation tool chain by default, which can directly compileC language programs in the Linux system of the development board.</p><ol style="list-linuxstyle-imagetype: lower-alpha;"><li><p>The version of a.gcc is as follows</spanp>{| class="wikitable" style= Compile linux image "width:800px;" |-| <p>orangepi@orangepi:~$ '''gcc --version'''</p><p>gcc (Debian 12.2.0-14) 12.2.0</p><p>Copyright (C) 2022 Free Software Foundation, Inc.</p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>|}</li><li><p>Write the '''hello_world.c''' program in C language</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.c'''</p><p>#include &lt;stdio.h&gt;</p>
# Run the '''build.sh''' script, remember to add sudo permissions
test@test<p>int main(void)</p><p>{</p>:~/orangepi-build$ '''sudo .<p>printf(&quot;Hello World!\n&quot;);</build.sh'''p>
<ol start="2" style="list-style-type: decimal;">
<li>Select '''Full OS image for flashing''' and press Enter</li></ol>
:<div class="figure"p>return 0;</p><p>}</p>[[File:zero2w-img292.png]]|}</li><li><p>Then compile and run '''hello_world.c'''</divp><ol start{| class="3wikitable" style="listwidth:800px;" |-style| <p>orangepi@orangepi:~$ '''gcc -typeo hello_world hello_world.c'''</p><p>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 &quot;help&quot;, ubuntu20.04&quot;copyright&quot;, and ubuntu22&quot;credits&quot; or &quot;license&quot; for more information.04</p><p>&gt;&gt;&gt;</p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p></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>
 [[File:zero2w-img276.png]] <ol start="5" style="list-style-type: decimal;"/li><li><p>If you select the next branch, you will also be prompted to select the memory size, Debian Bookworm does not install Java compilation tools and you do not need to select the current branchoperating environment by default.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>If You can use the development board you purchased has a memory size of 1.5GB, please select the first optionfollowing command to install openjdk.The latest version in Debian Bookworm is openjdk-17</p></li><li><p>If the development board you purchased has 1GB or 2GB or 4GB memory size, please choose the second option.</p>{| class="wikitable" style="width:800px;" |-| <p>[[Fileorangepi@orangepi:zero2w~$ '''sudo apt install -y openjdk-17-img277.png]]jdk'''</p></li></ol>|}
</li>
<li><p>Then select After installation, you can check the Java version.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''java --version'''</p>|}</li><li><p>Write the type Java version of rootfs'''hello_world.java'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println(&quot;Hello World!&quot;);</p>:<p>}</p><p>}</p>|}</li><li><p>Then compile and run '''hello_world.java'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''javac hello_world.java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p>|}</li></ol></li></ol> <span id="ubuntu-focal-system"></span>
[[File:zero2w-img286.png]]=== Ubuntu Focal system ===
<ol start="7" style="list-style-type: decimal;"><li><p>Then select Ubuntu Focal is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the type Linux system of imagethe 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:~$ '''Image with console interface (server)gcc --version''' Represents </p><p>gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0</p><p>Copyright (C) 2019 Free Software Foundation, Inc.</p><p>This is free software; see the image of the server version, which source for copying conditions. There is relatively small in sizeNO</p><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>|}</li><li><p>Write the '''Image with desktop environmenthello_world.c'''Represents an image with a desktop, which is relatively large program in size.C language</p>{| class="wikitable" style="width:800px;" |-| </lip>orangepi@orangepi:~$ '''vim hello_world.c'''</olp></lip>#include &lt;stdio.h&gt;</olp>
<div class="figure">
[[File<p>int main(void)</p><p>{</p>:zero2w-img287.png]]<p>printf(&quot;Hello World!\n&quot;);</p>
</div>
<ol start="8" style="list-style-type: decimal;">
<li>If you are compiling the server version of the image, you can also choose to compile the Standard version or the Minimal version. The Minimal version will have much less pre-installed software than the Standard version ('''please do not choose the Minimal version without special needs, because many things are not pre-installed by default. Some functions may not be available''')</li></ol>
:<div class="figure"p>return 0;</p><p>}</p>[[File:zero2w-img288.png]]|}</li><li><p>Then compile and run '''hello_world.c'''</divp><ol start{| class="9wikitable" style="list-style-typewidth: decimal800px;">|-| <lip>If you are compiling a desktop version of the image, you also need to select the type of desktop environment. Currently, only XFCE is maintained, so please select an XFCE type desktoporangepi@orangepi:~$ '''gcc -o hello_world hello_world.c'''</lip></olp[[Fileorangepi@orangepi:zero2w-img289~$ '''.png]] [[File:zero2w-img290.png]] You can then select additional packages that need to be installed. Please press the Enter key here to skip directly. [[File:zero2w-img291.png]]/hello_world'''</p><ol start="10" style="list-style-type: decimal;"p>Hello World!<li/p>Then the compilation of the linux image will begin. The general process of compilation is as follows|}</li></ol> a. Initialize the compilation environment of Ubuntu PC and install the software packages required for the compilation process. b. Download the source code of u-boot and linux kernel (if already cached, only update the code) c. Compile u-boot source code and generate u-boot deb package d. Compile linux source code and generate linux-related deb packages e. Make the deb package of linux firmware f. Make the deb package of orangepi-config tool g. Create a deb package with board-level support h. If you compile the desktop version image, you will also create a desktop-related deb package. i. Check whether rootfs has been cached. If not, re-create rootfs. If it has been cached, decompress it directly and use it. j. Install the deb package generated previously into rootfs k. Make some specific settings for different development boards and different types of images, such as pre-installing additional software packages, modifying system configurations, etc. l. Then create the image file and format the partition. The default type is ext4. m. Then copy the configured rootfs to the mirror partition. n. Then update initramfs o. Finally, write the bin file of u-boot into the image through the dd command. <ol start="11" style="list-style-type: decimal;"/li><li><p>After compiling the image, the following message will be displayedUbuntu Focal has Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The storage path specific version of the compiled image</li>Python3 is as follows</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="2wikitable" style="list-style-typewidth: lower-alpha800px;">|-| <lip>Compilation time</li></ol> orangepi@orangepi:~$ '''[ o.k. ] Runtime [ 19 min ]python3''' <ol start="3" style="list-style-type: lower-alpha;"/p><lip>Repeat the command to compile the imagePython 3. Use the following command to start compiling the image directly without selecting it through the graphical interface8.10 (default, Nov 14 2022, 12:59:47)</lip></olp> [ oGCC 9.k4. 0] Repeat Build Options [ '''sudo .on linux</build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=image RELEASE=bullseye BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_CONFIGURE=yes''' ]p><span id="instructions-p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for-using-the-orange-pi-os-arch-system">more information.</spanp= '''Instructions for using the Orange Pi OS Arch system''' = <span id="orange-pi-os-arch-system-function-adaptation-status"p>&gt;&gt;&gt;</spanp>== Orange Pi OS Arch system function adaptation status ==|}{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big><p>'''Motherboard functionsUse the Ctrl+D shortcut key to exit python's interactive mode.'''</p></big>| }</li><li><p>Write the '''OPi OS Archhello_world.py'''program in Python language</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''vim hello_world.py''HDMI video'</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:~$ '''HDMI Audiopython3 hello_world.py'''</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:~$ '''Typesudo apt install -y openjdk-17-C USB2.0 x 2jdk'''</p>| '''OK'''}</li><li><p>After installation, you can check the Java version.</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''TF Card Startupjava --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:~$ '''WIFIvim hello_world.java'''</p><p>public class hello_world</p><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println(&quot;Hello World!&quot;);</p>:<p>}</p><p>}</p>| }</li><li><p>Then compile and run '''OKhello_world.java'''</p>{| class="wikitable" style="width:800px;"
|-
| '''Bluetooth'''| '''OK'''|-| '''LED Light'''| '''OK'''|-| '''40pin GPIO'''| '''OK'''|-| '''40pin I2C'''| '''OK'''|-| '''40pin SPI'''| '''OK'''|-| '''40pin UART'''| '''OK'''|-| '''40pin PWM'''| '''OK'''|-| '''Temperature Sensor'''| '''OK'''|-| <p>orangepi@orangepi:~$ '''Hardware watchdogjavac hello_world.java'''</p>| <p>orangepi@orangepi:~$ '''OKjava hello_world'''</p>|-| '''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 &lt;stdio.h&gt;</p>  <p>int main(void)</p><p>{</p>:<p>printf(&quot;Hello World!\n&quot;);</p>  :<p>return 0;</p><p>}</p>| }</li><li><p>Then compile and run '''OKhello_world.c'''</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''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 &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</p><p>&gt;&gt;&gt;</p>| '''OK'''}{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big><p>'''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;"
|-
| '''On/off button'''| <p>orangepi@orangepi:~$ '''OKpython3 hello_world.py'''</p>|-| '''LRADC''' '''Custom buttons x 2'''| '''OK'''|-| '''TV-OUT'''| '''NO'''<p>Hello World!</p>
|}
 <span id="orange-pi-os-arch-system-user-guide-instructions"/li></spanol>== Orange Pi OS Arch System User Guide Instructions ==</li> First of all, please note that the OPi OS Arch system <li><p>Ubuntu Jammy does not have a install Java compilation tools and operating environment by default orangepi user and password, so you cannot directly log in remotely through the serial port and ssh after the system is started after burning (not even the root user). This is different from Ubuntu and Debian systems. When the OPi OS Arch system is started for the first time, you need to connect an HDMI display and then initialize the system settings through the user wizard (including creating a new user name and setting a password). The setup steps of the user wizard are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>You can use the following command to install openjdk-18</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-18-jdk'''</p>|}</li><li><p>After burning the systeminstallation, when you start it for can check the first time and enter the desktopJava 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, you will see sharing)</p>|}</li><li><p>Write the user wizard program shown in the figure belowJava version of '''hello_world.java'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println(&quot;Hello World!&quot;);</p>:<p>}</p><p>}</p>|}</li><li><p>Then compile and run '''hello_world.java'''<div /p>{| class="figurewikitable" 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>
[[File:zero2w<span id="method-img293.png]]of-uploading-files-to-the-development-board-linux-system"></span>
</div></li><li><p>First you need == Method of uploading files to select the language you want</p><div classdevelopment board Linux system =="figure">
[[File:zero2w<span id="method-img294.png]]to-upload-files-to-the-development-board-linux-system-in-ubuntu-pc"></span>=== Method to upload files to the development board Linux system in Ubuntu PC ===
</divspan id="how-to-upload-files-using-scp-command"></lispan><li><p>After selecting the language, the user wizard will immediately switch ==== How to the corresponding language interface, as shown below in Chinese</p><div classupload files using scp command ===="figure">
[[File<ol style="list-style-type: decimal;"><li><p>Use the scp command to upload files to the Linux system of the development board in Ubuntu PC. The specific command is as follows</p><ol style="list-style-type: lower-alpha;"><li><p>'''file_path: '''Needs to be replaced with the path of the file to be uploaded</p></li><li><p>'''orangepi: '''This is the user name of the development board's Linux system. It can also be replaced with something else, such as root.</p></li><li><p>'''192.168.xx.xx:''' This is the IP address of the development board. Please modify it according to the actual situation.</p></li><li><p>'''/home/orangepi:''' The path in the development board Linux system can also be modified to other paths.</p>{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''scp file_path orangepi@192.168.xx.xx:zero2w/home/orangepi/'''</p>|}</li></ol></li><li><p>If you want to upload a folder, you need to add the -img295r parameter</p>{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''scp <span style="color:#FF0000">-r</span> dir_path orangepi@192.png]]168.xx.xx:/home/orangepi/'''</p>|}</li><li><p>There are more usages of scp, please use the following command to view the man manual</p></li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''man scp'''|}</ol><span id="how-to-upload-files-using-filezilla"></span> ==== How to upload files using filezilla ====
<ol style="list-style-type: decimal;"><li><p>First install filezilla in Ubuntu PC</divp>{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''sudo apt install -y filezilla'''</p>|}</li><li><p>Then select use the following command to open filezilla</p>{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''filezilla'''</p>|}</li><li><p>The interface after opening filezilla is as shown below. At this time, the remote site on the arearight is empty.</p>
<div class="figure">
[[File:zero2w-img296img255.png]]
</div></li>
<li><p>Then select The method of connecting the keyboard modeldevelopment board is as shown in the figure below</p></li> 
<div class="figure">
[[File:zero2w-img297img256.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></li>
<li><p>Then create a new username and set a password</p>
<div class="figure">
[[File:zero2w-img298img258.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></li>
<li><p>Then make sure there is no problem with the selection, and then click the install '''button'''</p>
<div class="figure">
[[File:zero2w-img299img259.png]] </div></ol><ol start="8" style="list-style-type: decimal;"><li>Then select the path to be uploaded to the development board on the right side of the filezilla software, select the file to be uploaded in Ubuntu PC on the left side of the filezilla software, right-click the mouse, and then click the upload option to start uploading the file to the development board.</li>
</div></li>
<li><p>Then wait for the installation to complete</p>
<div class="figure">
[[File:zero2w-img300img260.png]]
</div></liol><ol start="9" style="list-style-type: decimal;"><li><p>After the installation upload is completecompleted, you need can go to click the '''Finish''' button corresponding path in the development board Linux system to restart view the systemuploaded 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>
[[File:zero2w<span id="method-img301.png]]to-upload-files-from-windows-pc-to-development-board-linux-system"></span>
</div></li><li><p>The Orange Pi Hello program will automatically start after restarting. At this time, you need === Method to remove the check '''mark of Start on startup''' in the lower right corner, otherwise you need upload files from Windows PC to manually close the Orange Pi Hello program every time you start it.</p><div classdevelopment board Linux system ==="figure">
[[File:zero2w<span id="how-img302.png]]to-upload-files-using-filezilla-1"></span>==== How to upload files using filezilla ====
</div><p>At this point, you can use # First download the newly created username and password to log in to installation file of the OPi OS system through Windows version of the serial port or sshfilezilla software.</p></li></ol>The download link is as follows
<span id::{| class="howwikitable" style="width:800px;" |-to| [https://filezilla-setproject.org/download.php?type=client '''https://filezilla-dt-overlays"><project.org/span>download.php?type=client''']== How to set DT overlays ==|}
The multiplexing functions such as I2C/SPI/UART/PWM in the 40::[[File:zero2w-pin development board are turned off by default in the kernel's dts, and the corresponding DT overlays need to be manually turned on before they can be usedimg261.png]]
The method to open DT overlays in OPi OS Arch system is as follows:<div class="figure">
# First open the '''/boot/extlinux/extlinux.conf''' configuration file ::[[orangepi@orangepiFile:zero2w-pc ~img262.png]]$ '''sudo vim /boot/extlinux/extlinux.conf'''
</div>
<ol start="2" style="list-style-type: decimal;">
<li>Then open the corresponding configuration by adding <p>The downloaded installation package is as shown below, then double-click to install it directly</p>{| class="wikitable" style="width:800px;" |-| <p>'''FDTOVERLAYSFileZilla_Server_1.5.1_win64-setup.exe''' </p>|}During the installation process, please select '''/dtbs/allwinner/overlay/xxx.dtboDecline''' in on the following installation interface, and then select '''/boot/extlinux/extlinux.confNext&gt;'''</li></ol>
'''Note that xxx.dtbo in FDTOVERLAYS /dtbs/allwinner/overlay/xxx.dtbo needs to be replaced with the specific dtbo configuration, please do not copy it.'''<div class="figure">
[orangepi@orangepi[File:zero2w-pc ~img263.png]]$ '''sudo vim /boot/extlinux/extlinux.conf'''
LABEL Orange Pi</div></li></ol><ol start="3" style="list-style-type: decimal;"><li>The interface after opening filezilla is as shown below. At this time, the remote site on the right is empty.</li>
KERNEL /Image<div class="figure">
FDT /dtbs/allwinner/sun50i-h616-orangepi[[File:zero2w-zero2wimg264.dtbpng]]
'''FDTOVERLAYS </dtbsdiv></allwinnerol><ol start="4" style="list-style-type: decimal;"><li>The method of connecting the development board is as shown in the figure below:</overlay/xxx.dtbo''' #Configuration that needs to be addedli>
<ol startdiv class="3figure" style="list-style-type: decimal;"><li><p>The storage path of xxx.dtbo in the OPi OS Arch image is as follows. Please note that not all dtbo under this path can be used.</p><p>'''/boot/dtbs/allwinner/overlay/'''</p></li><li><p>The DT overlays configuration that can be used by the development board is as follows</p></li></ol>
{| class="wikitable"|-| '''Functions on the development board'''| '''Corresponding DT overlays configuration'''|-| '''40pin - i2c0'''| '''sun50i-h616-pi-i2c0.dtbo'''|-| '''40pin - i2c1'''| '''sun50i-h616-pi-i2c1.dtbo'''|-| '''40pin - i2c2'''| '''sun50i-h616-pi-i2c2.dtbo'''|-| '''40pin - uart2'''| '''sun50i-h616-pi-uart2.dtbo'''|-| '''40pin - uart3'''| '''sun50i-h616-pi-uart3.dtbo'''|-| '''40pin - uart4'''| '''sun50i-h616-pi-uart4.dtbo'''|-| '''40pin - uart5'''| '''sun50i-h616-ph-uart5.dtbo'''|-| '''40pin - pwm1'''| '''sun50i-h616-pi-pwm1.dtbo'''|-| '''40pin - pwm2'''| '''sun50i-h616-pi-pwm2.dtbo'''|-| '''40pin - pwm3'''| '''sun50i-h616-pi-pwm3.dtbo'''|-| '''40pin - pwm4'''| '''sun50i-h616-pi-pwm4.dtbo'''|-| '''40pin - spi1 cs0'''| '''sun50i-h616-spi1-cs0-spidev.dtbo'''|-| '''40pin - spi1 cs1'''| '''sun50i-h616-spi1-cs1-spidev.dtbo'''|-| '''40pin - spi1 cs0 cs1'''| '''sun50i-h616-spi1-cs0-cs1-spidev.dtbo'''|-| '''设Set USB0 to Host mode'''| '''sun50i-h616-usb0-host.dtbo'''|-| '''Turn off the green LED light'''| '''sun50i-h616-[[File:zero2w-disable-led.dtbo'''|-| '''How to close the UART0 debugging serial port'''| '''sun50i-h616-disable-uart0img256.dtbo'''|}png]]
</div></ol>
<ol start="5" style="list-style-type: decimal;">
<li>If you need Then choose to open multiple configurations at '''save the same time, just add the paths of multiple configurations directly after password''' and click '''FDTOVERLAYS.OK''' For example, the configuration of opening i2c1 and uart5 at the same time is as follows</li></ol>
<div class="figure"> [orangepi@orangepi[File:zero2w-pc ~img265.png]]$ '''sudo vim /boot/extlinux/extlinux.conf'''
LABEL Orange Pi</div></ol><ol start="6" style="list-style-type: decimal;"><li>Then select '''Always trust this host''' and click '''OK'''</li>
KERNEL /Image<div class="figure">
FDT /dtbs/allwinner/sun50i-h616-orangepi[[File:zero2w-zero2wimg266.dtbpng]]
'''FDTOVERLAYS </dtbsdiv></allwinner/overlay/sun50iol><ol start="7" style="list-h616style-pi-i2c1type: 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.dtbo /dtbs</allwinner/overlay/sun50i-h616-ph-uart5.dtbo'''li>
<ol startdiv class="6figure" style="list-style-type: decimal;"><li>After setting, you need to restart the system for the configuration to take effect.</li></ol>
[orangepi@orangepi[File:zero2w-pc ~img267.png]]$ '''sudo reboot'''
<span id/div></ol><ol start="how-to8" style="list-installstyle-softwaretype: decimal;"></spanli>== How Then select the path to be uploaded to the development board on the right side of the filezilla software, select the file to install be uploaded on the Windows PC on the left side of the filezilla software ==, right-click the mouse, and then click the upload option to start uploading the file to the development board.</li>
You can use the pacman package management tool to install software that is not available in OPi OS. For example, the command to install the vim editor is as follows. If you want to install other software, you only need to replace vim with the package name of the software you want to install.<div class="figure">
[orangepi@orangepi[File:zero2w-pc ~img268.png]]$ '''sudo pacman -Syy vim'''
<span id/div></ol><ol start="9" style="androidlist-12-tvstyle-type: decimal;"><li><p>After the upload is completed, you can go to the corresponding path in the development board Linux system-usage-instructions"to view the uploaded file.</p></li><li><p>The method of uploading a folder is the same as the method of uploading a file, so I won't go into details here.</p></li></spanol>
<span id= '''Android 12 TV system usage "instructions''' =-for-using-the-logo-on-and-off-the-machine"></span>
<span id="supported-android-versions"></span>== Supported Android versions Instructions for using the logo on and off the machine ==
<ol style="list-style-type: decimal;"><li><p>The power on/off logo will only be displayed on the desktop version of the system by default.</p></li><li><p>Set the '''bootlogo''' variable to '''false''' in '''/boot/orangepiEnv.txt''' to turn off the switch logo.</p>{| class="wikitable" style="width:800px;"
|-
| Android Version<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>{| Kernel versionclass="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''Android 12 TV Versionsudo vim /boot/orangepiEnv.txt'''</p><p>verbosity=1</p>| <p>'''linux5.4<span style="color:#FF0000">bootlogo=true</span>'''</p>
|}
</li><span id="android-12-tv-function-adaptation-status"li><p>The location of the boot logo picture in the Linux system is</spanp>== Android 12 TV function adaptation status == {| class="wikitable" style="width:800px;"
|-
| <p>'''Motherboard functions/usr/share/plymouth/themes/orangepi/watermark.png'''</p>|}</li><li><p>After replacing the boot logo image, you need to run the following command to take effect</p>{| '''Android12 TV'''class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''HDMI videosudo update-initramfs -u'''</p>| }</li></ol> <span id="how-to-turn-on-the-power-button-in-linux5.4"></span> == How to turn on the power button in Linux5.4 == There is no power on/off button on the main board of the development board. We can expand it through a 24pin expansion board. The location of the power on/off button on the expansion board is as follows: [[File:zero2w-img269.png]] The power on/off button of the Linux 6.1 image is turned on by default, but the power on/off button of the Linux 5.4 kernel image is turned off by default and needs to be turned on manually for normal use. The steps are as follows: <ol style="list-style-type: decimal;"><li><p>First run '''orangepi-config'OK''. Ordinary users remember to add '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''HDMI Audiosudo orangepi-config'''</p>| }</li><li><p>Then select '''System'''</p><p>[[File:zero2w-img80.png]]</p></li><li><p>Then select '''Hardware'''</p><p>[[File:zero2w-img81.png]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown in the picture below, and then use the '''space''' to select the dtbo configuration of the SPI you want to open.</p><p>[[File:zero2w-img270.png]]</p></li><li><p>Then select '''&lt;Save&gt;''' to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''&lt;Back&gt;'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''&lt;Reboot&gt;'OK''to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol> <span id="how-to-shut-down-and-restart-the-development-board"></span> == How to shut down and restart the development board == <ol style="list-style-type: decimal;"><li><p>During the running of the Linux system, if you directly unplug the power supply, it may cause the file system to lose some data. It is recommended to use the '''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:~$ '''Type-C USB2.0 x 2sudo poweroff'''</p>|}{| '''OK'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big><p>'''TF card startupNote 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>'''WIFINote 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'''''Bluetooth'reboot'''</p>| }</li></ol> <span id="linux-sdkorangepi-build-usage-instructions"></span> = '''Linux SDK——orangepi-build usage instructions''' = <span id="compilation-system-requirements"></span>== Compilation system requirements == The Linux SDK, '''orangepi-build''OK', only supports running on X64 computers with '''<span style="color:#FF0000">Ubuntu 22.04</span>''' installed. Therefore, before downloading orangepi-build, please first ensure that the Ubuntu version installed on your computer is Ubuntu 22.04. The command to check the Ubuntu version installed on the computer is as follows. If the Release field does not display '''<span style="color:#FF0000">22.04</span>''', it means that the Ubuntu version currently used does not meet the requirements. Please change the system before performing the following operations. {| class="wikitable" style="width:800px;"
|-
| test@test:~$ '''lsb_release -a''' No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04 LTS Release: '''<span style="color:#FF0000">22.04</span>''USB Camera' Codename: '''jammy'''| } If the computer is installed with a Windows system and does not have Ubuntu 22.04 installed on it, you can consider using'''OKVirtualBox'''or '''VMware''' to install an Ubuntu 22.04 virtual machine in the Windows system. But please note, do not compile orangepi-build on the WSL virtual machine, because orangepi-build has not been tested in the WSL virtual machine, so there is no guarantee that orangepi-build can be used normally in WSL. In addition, please do not compile the Linux system on the development board. Use orangepi-build. The installation image download address of Ubuntu 22.04 amd64 version is: {| class="wikitable" style="width:800px;"
|-
| [https://repo.huaweicloud.com/ubuntu-releases/21.04/ubuntu-21.04-desktop-amd64.iso '''LED Lighthttps://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/22.04/ubuntu-22.04-desktop-amd64.iso''']| '''OK'''} 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;"
|-
| '''40pin GPIO'''| '''OK'''|-| '''40pin I2C'''| '''OK'''|-| '''40pin SPI1'''| '''OK'''|-| '''40pin UART'''| '''OK'''|-| '''40pin PWM'''| '''OK'''|-| '''Temperature Sensor'''| '''OK'''|-| '''Hardware watchdog'''| '''OK'''|-| '''Mali GPU'''| '''OK'''|-| '''Video codec'''| [https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/ '''OKhttps://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 '''/etc/apt/sources.list''' file that need to be replaced are:</li>{| class="wikitable" style="width:800px;"
|-
| '''24pin Expansion board function'''| test@test:~$ '''Android12 TV'''|-| '''100M network port'''| '''OK'''|-| '''100M Ethernet port light'''| '''OK'''|-| '''USB2sudo mv /etc/apt/sources.list cat /etc/apt/sources.list.0 HOST x 2bak'''| '''OK'''|-| test@test:~$ '''Infrared reception'''| '''OK'''|-| '''Headphone audio playback'''| '''OK'''|-| '''Onsudo vim /etc/apt/off button'''| '''OK'''|-| '''LRADC''' '''Custom buttons x 2'''| '''OK, The default setting is the volume up and down keyssources.list'''|-| '''TV-OUT'''| '''OK'''|}
<span id="onboard-led-light-display-instructions"></span>== Onboard LED light display instructions =='''#''' The source code image is commented by default to improve apt update speed. You can uncomment it yourself if necessary.
{| class="wikitable"deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse|-|| '''green light'''| '''red light'''|-| '''u-boot startup phase'''| '''Off'''| '''on#'''|deb-| '''Kernel boot to enter the system'''| '''on'''| '''on'''|}src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
<span id="how-to-return-to-the-previous-interfacedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-in-android"></span>== How to return to the previous interface in Android ==updates main restricted universe multiverse
We generally use the mouse and keyboard to control the Android system of the development board'''#''' deb-src https://mirrors. When entering certain interfaces and need to return to the previous interface or desktop, we can only return by righttuna.tsinghua.edu.cn/ubuntu/ jammy-clicking the mouse, and the keyboard cannot return.updates main restricted universe multiverse
If you have purchased the infrared remote control (other remote controls do not work) and a 24pin expansion board that come with the development board, after connecting the 24pin expansion board to the development board, you can also use the return key on the remote control to return to the previous menudeb https://mirrors.tuna.tsinghua. The location of the return key is as shown belowedu. Shown:cn/ubuntu/ jammy-backports main restricted universe multiverse
[[File'''#''' deb-src https:zero2w//mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-img303.png]]backports main restricted universe multiverse
<span id="howdeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-to-use-adb"></span>== How to use ADB ==security main restricted universe multiverse
<span id="use'''#''' deb-networksrc https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-connection-adb-debugging"></span>=== Use network connection adb debugging ===security main restricted universe multiverse
'''Using network adb does not require a USB Typc C interface data cable to connect the computer and the development board. Instead, it communicates through the network, so first make sure that the development board's wired or wireless network is connected, and then obtain the IP address of the development board. Next To be used.'''
# Make sure the '''service.adb.tcp.port#''' of the Android system is set Pre-release software source, not recommended to 5555 port numberbe enabled
apollo-p2:/ # '''getprop | grep &quot;adb.tcp&quot;#'''deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
[service'''#''' deb-src https://mirrors.tuna.tsinghua.adbedu.tcpcn/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.port]</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: [5555]#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>
<ol startspan id="2" style="listobtain-the-source-code-of-stylelinux-type: decimal;sdk"><li>If '''service.adb.tcp.port''' is not set, you can use the following command in the serial port to set the port number of the network adb</li></olspan>
apollo-p2:/ # '''setprop service.adb.tcp.port 5555'''<br />apollo-p2:/ # '''stop adbd'''== Obtain the source code of linux sdk ==
apollo<span id="download-p2:orangepi-build-from-github"></ # '''start adbd'''span>=== Download orangepi-build from github ===
<ol start="3" style="listLinux sdk refers to the orangepi-stylebuild set of codes. Orangepi-typebuild is modified based on the armbian build compilation system. Multiple versions of Linux images can be compiled using orangepi-build. Use the following command to download the orangepi-build code: decimal;"><li>Install adb tool on Ubuntu PC</li></ol>
{| class="wikitable" style="width:800px;"
|-
|
test@test:~$ '''sudo apt-get update'''
test@test:~$ '''sudo apt-get install -y adbgit'''
<ol starttest@test:~$ '''git clone https://github.com/orangepi-xunlong/orangepi-build.git -b next'''|}{| class="4wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;"|-| <big>'''Note that when using the H618 Soc development board, you need to download the source code of the <lispan style="color:#FF0000">Then connect network adb on Ubuntu PCnext</lispan>branch of orangepi-build. The above git clone command needs to specify the branch of the orangepi-build source code as next.'''</olbig>
test@test:~$ '''adb connect 192.168.1.xxx:5555''' '''(Need to be modified to the IP address of the development board)'''<div class="figure">
* daemon not running; starting now at tcp[[File:5037zero2w-img272.png|center|800px]]
* daemon started successfully</div>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''When downloading the orangepi-build code through the git clone command, you do not need to enter the user name and password of the github account (the same is true for downloading other codes in this manual). If after entering the git clone command, Ubuntu PC prompts you to enter the user name of the github account. The name and password are usually entered incorrectly in the address of the orangepi-build warehouse behind git clone. Please carefully check whether there are any errors in the spelling of the command, rather than thinking that we have forgotten to provide the username and password of the github account.'''</big>|}
connected to 192.168.1.xxxThe u-boot and linux kernel versions currently used by the H618 series development boards are as follows:5555
test@test{| class="wikitable" style="width:~$ 800px;text-align: center;"|-| '''branch'''| '''u-boot Version'''| '''linux Kernel version'''|-| '''current'''| '''u-boot v2018.05'''| '''linux5.4'''|-| '''next'''| '''u-boot v2021.07'''| '''adb deviceslinux6.1'''|}
List {| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''The branch mentioned here is not the same thing as the branch of devices attachedorangepi-build source code, please don't get confused. This branch is mainly used to distinguish different kernel source code versions.'''
192'''We define the linux5.1684 bsp kernel currently provided by Allwinner as the current branch. The latest linux6.1LTS kernel is defined as the next branch.xxx:5555 device'''</big>|}
<ol start="5" style="list-style-typeAfter downloading, the following files and folders will be included: decimal;"><li>Then you can log in to the android system through adb shell on Ubuntu PC</li></ol>
<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$ '''adb shellls'''
apollo'''build.sh &nbsp;&nbsp;&nbsp;&nbsp; external &nbsp;&nbsp;&nbsp;&nbsp; LICENSE &nbsp;&nbsp;&nbsp;&nbsp; README.md &nbsp;&nbsp;&nbsp;&nbsp; scripts'''|}{| class="wikitable" style="background-p2color:#ffffdc;width:800px;" |-| <big>'''If you downloaded the orangepi-build code from github, after downloading, you may find that orangepi-build does not contain the source code of u-boot and linux kernel, and there is no cross-compilation tool required to compile u-boot and linux kernel. chain, this is normal, because these things are stored in other separate github repositories or some servers (their addresses will be detailed below). Orangepi-build will specify the addresses of u-boot, Linux kernel and cross-compilation tool chain in the script and configuration file. When running orangepi-build, when it finds that these things are not available locally, it will automatically download them from the corresponding places.'''</ #big>|}
<span id="usedownload-datathe-cablecross-tocompilation-connecttool-adb-debuggingchain"></span>=== Use data cable to connect adb debugging ===
# Prepare a USB Type C interface data cable, plug one end of === Download 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.cross-compilation tool chain ===
[[File:zero2wWhen orangepi-img304build is run for the first time, it will automatically download the cross-compilation '''toolchain''' and put it in the '''toolchains''' folder.png]] [[File:zero2wEvery time you run orangepi-img305build's build.sh script, it will check whether the cross-compilation toolchain in toolchains exists. If If it does not exist, the download will be restarted. If it exists, it will be used directly without repeated downloading.png]]
<ol startdiv class="2figure" style="list-style-type: decimal;"><li>Install adb tool on Ubuntu PC</li></ol>
test@test[[File:~$ '''sudo aptzero2w-get update'''img273.png]]
test@test</div>The mirror URL of the cross-compilation tool chain in China is the open source software mirror site of Tsinghua University:~$ '''sudo apt-get install -y adb'''
<ol start{| class="3wikitable" style="list-style-typewidth: decimal800px;"><li>Check whether the ADB device is recognized<|-| [https:/li></ol>mirrors.tuna.tsinghua.edu.cn/armbian-releases/_toolchain/ '''https://mirrors.tuna.tsinghua.edu.cn/armbian-releases/_toolchain/''']|}
test@test:~$ After toolchains is downloaded, it will contain multiple versions of cross-compilation '''adb devicestoolchain''':
List of devices attached{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''ls toolchains/'''
4c00146473c28651dd0 devicegcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu
<ol start="gcc-linaro-4" style="list.9.4-2017.01-x86_64_aarch64-stylelinux-type: decimal;"><li>Then you can log in to the android system through adb shell on Ubuntu PC</li></ol>gnu
test@test:~$ '''adb shell'''gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabi
apollogcc-p2:/ $arm-11.2-2022.02-x86_64-arm-none-linux-gnueabihf
<span id="viewgcc-howlinaro-to4.9.4-set2017.01-hdmix86_64_arm-displaylinux-resolution"></span>== View how to set HDMI display resolution ==gnueabi
<ol style="listgcc-stylelinaro-type: decimal;"><li><p>Enter first '''Settings'''</p><p>[[File:zero2waarch64-img306.png]]</p></li><li><p>Then select '''Device Preferences'''</p><p>[[File:zero2w-img307.png]]</p></li><li><p>Then select '''Display &amp; Sound'''</p><p>[[File:zero2w-img308.png]]</p></li><li><p>Then select '''Advanced display settings'''</p><p>[[File:zero2w-img309.png]]</p></li><li><p>Then select '''HDMI output mode'''</p><p>[[File:zero2wnone-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:zero2welf-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 option4.</p><p>[[File:zero2w8-img3122013.png]]</p></li></ol>11_linux
<span id="hdmigcc-toarm-vga9.2-display2019.12-testx86_64-1"></span>=== HDMI to VGA display test ===aarch64-none-linux-gnu
<ol style="listgcc-stylelinaro-type: decimal;"><li><p>First you need to prepare the following accessories</p><ol style="list5.5.0-style2017.10-type: lowerx86_64_arm-alpha;"><li>HDMI to VGA converter</li></ol></li></ol>linux-gnueabihf
[[File:zero2wgcc-img144linaro-arm-linux-gnueabihf-4.8-2014.png]]04_linux
<ol start="gcc-arm-9.2" style="list-style2019.12-x86_64-arm-none-type: lowerlinux-alpha;"><li>A VGA cable and a Mini HDMI male to HDMI female adapter</li></ol>gnueabihf
[[File:zero2wgcc-img145linaro-7.png]] [[File:zero2w4.1-img1462019.png]]02-x86_64_aarch64-linux-gnu
<ol start="3" style="listgcc-stylelinaro-type: lowerarm-alpha;">none-eabi-4.8-2014.04_linux<li>A monitor or TV that supports VGA interface</li></ol>|}
<!The cross-- --><ol start="2" style="list-style-type: decimal;"><li>HDMI compilation tool chain used to VGA display test compile the H618 Linux kernel source code is as follows</li></ol>:
[[File<ol style="list-style-type:zero2wlower-img313alpha;"><li>linux5.png]]4</li>{| class="wikitable" style="width:800px;" |-| '''When using HDMI to VGA display, the development board and the Android system of the development board do not need to make any settingsgcc-arm-11. 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 monitor2-2022.02-x86_64-aarch64-none-linux-gnu'''|}</ol><span idol start="wi2" style="list-fistyle-connectiontype: lower-methodalpha;"><li>linux6.1</spanli>{| class="wikitable" style= WI"width:800px;" |-FI connection method ==| # Choose first '''Settingsgcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu'''|}</ol>The cross-compilation tool chain used to compile the H618 u-boot source code is:
[[File<ol style="list-style-type: lower-alpha;"><li>v2018.05</li>{| class="wikitable" style="width:800px;" |-| '''gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabi'''|}</ol><ol start="2" style="list-style-type:zero2wlower-img306alpha;"><li>v2021.png]]07</li>{| class="wikitable" style="width:800px;" |-| '''gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu'''|}</ol><span id="orangepi-build-complete-directory-structure-description"></span>
<ol start="2" style="list= orangepi-style-type: decimal;"><li>Then select '''Network &amp; Internet'''</li></ol>build complete directory structure description ===
[[File<ol style="list-style-type:zero2wdecimal;"><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-img314boot is stored in an independent git warehouse.png]]</p><ol start="3" style="list-style-type: decimallower-alpha;"><li>Then turn on WI<p>The git warehouse where the linux kernel source code is stored is as follows. Please note that the branch of the linux-FIorangepi warehouse is switched to</p><ol style="list-style-type: none;"><li>a) Linux5.4</olli>{| class="wikitable" style="width:800px;" |-| [[Filehttps:zero2w//github.com/orangepi-img315xunlong/linux-orangepi/tree/'''orange-pi-5.png]]4-sun50iw9'''|}</ol><ol start="42" style="list-style-type: decimallower-alpha;"><li>After turning on WIb) Linux6.1</li>{| class="wikitable" style="width:800px;" |-| https://github.com/orangepi-xunlong/linux-FI, you can see the searched signals under orangepi/tree/'''Available networksorange-pi-6.1-sun50iw9'''.|}</ol></li></ol> [[File:zero2w-img316.png]] <ol start="52" style="list-style-type: decimallower-alpha;"><li>After selecting <p>The git warehouse where the u-boot source code is stored is as follows. Please note that the branch of the WIu-FI you want boot-orangepi warehouse is switched to connect to, the password input interface shown below will pop up</p><ol style="list-style-type: lower-alpha;"><li>a) v2018.05</li>{| class="wikitable" style="width:800px;" |-| https://github.com/orangepi-xunlong/u-boot-orangepi/tree/'''v2018.05-h618'''|}</ol><ol start="2" style="list-style-type: lower-alpha;"><div li>b) v2021.07</li>{| class="figurewikitable" style="width:800px;">|-| [[Filehttps:zero2w//github.com/orangepi-xunlong/u-img317boot-orangepi/tree/'''v2021.png]]07-sunxi'''|}</ol></li></ol></divli></ol><ol start="62" style="list-style-type: decimal;"><li>Then use <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 keyboard files and folders that can be seen in orangepi-build are:</p><ol style="list-style-type: lower-alpha;"><li><p>'''build.sh''': Compile startup script</p></li><li><p>'''external''': Contains the configuration files needed to enter 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 password corresponding to source code of the WIlinux 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-FIboot, linux and other deb packages, compilation logs, and then use 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 mouse to click the Enter button on source code of u-boot</p></li><li><p>'''userpatches''': Store the virtual keyboard to start connecting configuration files needed to compile the WIscript</p></li>{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-FIbuild$ '''ls''' '''build.sh &nbsp;&nbsp;&nbsp;&nbsp; external &nbsp;&nbsp;&nbsp;&nbsp; kernel &nbsp;&nbsp;&nbsp;&nbsp; LICENSE &nbsp;&nbsp;&nbsp;&nbsp; output &nbsp;&nbsp;&nbsp;&nbsp; README.md &nbsp;&nbsp;&nbsp;&nbsp; scripts &nbsp;&nbsp;&nbsp;&nbsp; toolchains &nbsp;&nbsp;&nbsp;&nbsp; u-boot &nbsp;&nbsp;&nbsp;&nbsp; userpatches'''|}</ol></li></ol>
<div classspan id="figurecompile-u-boot"></span>
[[File:zero2w== Compile u-img318.png]]boot ==
</div><ol start="7" style="list-style-type: decimal;"><li>The display after successful WI-FI connection is as shown below</li></ol># Run the build.sh script, remember to add sudo permissions
[[File{| class="wikitable" style="width:zero2w800px;" |-img319| test@test:~/orangepi-build$ '''sudo ./build.png]]sh'''|}
<span idol start="how-to-use-wi2" style="list-fistyle-hotspottype: decimal;"><li>Select '''U-boot package''' and press Enter</spanli>== How to use WI-FI hotspot ==
# First, please make sure that the Ethernet port is connected to the network cable and can access the Internet normally.# Then select '''Settings'''<div class="figure">
[[File:zero2w-img306img274.png]]
</div></ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then select '''Network &amp; Internet'''the model of the development board</li></ol> [[File:zero2w-img314.png]]
[[File:zero2w-img275.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>Then select '''WIFI hotspot'''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></olli><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-img320img276.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 start="5" style="list-style-type: decimallower-alpha;"><li>Then open '''Hotspot Enable'''. You can also see <p>If the name and password development board you purchased has a memory size of the generated hotspot in the picture below1. Remember them and use them when connecting to the hotspot (if you need to modify 5GB, please select the name and password of the hotspot, you need to close Hotspot Enable firstoption. Then you can modify it)</p></li><li><p>If the development board you purchased has 1GB or 2GB or 4GB memory size, please choose the second option.</olp<p>[[File:zero2w-img321img277.png]]</p></li></ol></li></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 ('''here AndroidAP_7132''') shown under the '''Hotspot name''' in the picture above in the WI-FI list searched by the mobile phone. <p>Then you can click AndroidAP_7132 it will start to connect to the hotspotcompile u-boot. The password can be seen under Some of the '''Hotspot password''' in information prompted when compiling the picture above.next branch is as follows:</p><ol style="list-style-type: lower-alpha;"><li>Version of u-boot source code</olli>{| class="wikitable" style="width:800px;" |-| [o.k. ] Compiling u-boot [File:zero2w-img322'''v2021.png]07''' ]|}</ol><ol start="72" style="list-style-type: decimallower-alpha;"><li>After Version of 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)cross-compilation tool chain</li>{| class="wikitable" style="width:800px;" |-| [ o. At this time, you can open a web page on your mobile phone to see if you can access the Internetk. If the web page can be opened normally, it means that the ] Compiler version [ '''WIaarch64-linux-gnu-FI Hotspotgcc 11''' of the development board can be used normally.</li>]|}</ol> [[File:zero2w-img323.png]] <span idol start="3" style="howlist-tostyle-check-the-ip-address-oftype: lower-alpha;"><li>Path to thecompiled u-ethernet-port">boot deb package</spanli>{| class="wikitable" style= How to check the IP address of the Ethernet port =="width:800px;" |-| # There is no wired network interface on the main board of the development board[ o. We can expand the 100M Ethernet through a 24pin expansion boardk] Target directory [[File:zero2w'''orangepi-build/output/debs/u-img107.png]boot''' ]|}</ol><ol start="24" style="list-style-type: decimallower-alpha;"><li><p>Then make sure the network port The package name of the expansion board is connected to the router or switch</p>compiled u-boot deb package</li><li><p>Then open {| class="wikitable" style="width:800px;" |-| [ o.k. ] File name [ '''Settingslinux-u-boot-next-orangepizero2w_x.x.x_arm64.deb''']|}</pol><p>[[Fileol start="5" style="list-style-type:zero2wlower-img324.png]]alpha;"></pli>Compilation time</li><li><p>Then select {| class="wikitable" style="width:800px;" |-| [ o.k. ] Runtime [ '''Network &amp; Internet1 min''']|}</pol><p>[[Fileol start="6" style="list-style-type:zero2wlower-img325.png]]</p></lialpha;"><li><p>Then you can see Repeat the IP address of command to compile u-boot. Use the development board's wired network port at following command without selecting through the location shown in the picture belowgraphical interface. You can start compiling u-boot directly.</pli><p>[[File{| class="wikitable" style="width:zero2w800px;" |-img326| [ o.k.png]Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=u-boot''' ]|}</pol></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/'''
'''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb'''|}</ol><span idol start="8" style="bluetoothlist-connectionstyle-methodtype: decimal;"><li>When the orangepi-bulid compilation system compiles the u-boot source code, it will first synchronize the u-boot source code with the u-boot source code of the github server. Therefore, if you want to modify the u-boot source code, you first need to turn off the download and update function of the source code. ('''You need to completely compile u-boot before you can turn off this function, otherwise it will prompt that the source code of u-boot cannot be found'''), otherwise the modifications will be restored. The method is as follows:</spanli>== Bluetooth connection method ==
# Choose first Set the IGNORE_UPDATES variable in u'''Settingsuserpatches/config-default.conf'''to &quot;yes&quot;
[[File{| class="wikitable" style="width:zero2w800px;" |-img306| test@test:~/orangepi-build$ '''vim userpatches/config-default.png]]conf'''
<ol start="2" style="list-style-type: decimal;"><li>Then select '''Bluetooth'''</li></ol>......
[[FileIGNORE_UPDATES=&quot;'''<span style="color:zero2w-img327.png]]#FF0000">yes</span>'''&quot;
......|}</ol><ol start="39" style="list-style-type: decimal;"><li>Then Open '''Bluetooth Enable'''<p>When debugging u-boot code, you can use the following method to update u-boot in the linux image for testing</p><ol style="list-style-type: lower-alpha;"><li>First upload the compiled deb package of u-boot to the Linux system of the development board.</olli>{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''cd output/debs/u-boot'''
[[Filetest@test:zero2w~/orangepi_build/output/debs/u-img328.png]]boot$ '''scp \'''
'''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb [mailto:root@192.168.1.xxx:/root root@192.168.1.xxx:/root]'''|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Install the new u-boot deb package just uploaded</li>{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''sudo dpkg -i''' '''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb'''|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>Then run the nand-sata-install script</li>{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''sudo nand-sata-install'''|}</ol><ol start="4" style="list-style-type: decimallower-alpha;"><li>Then click select '''Pair new device5 Install/Update the bootloader on SD/eMMC'''to start scanning for surrounding Bluetooth devices</li> [[File:zero2w-img278.png]]</ol><ol start="5" style="list-style-type: lower-alpha;"><li>After pressing the Enter key, a Warning will pop up first.</li>
[[File:zero2w-img329img279.png]]</ol><ol start="6" style="list-style-type: lower-alpha;"><li>Press the Enter key again to start updating u-boot. After the update is completed, the following information will be displayed.</li>
[[File:zero2w-img280.png]]</ol><ol start="57" style="list-style-type: decimallower-alpha;"><li>The searched Bluetooth devices will be displayed under '''Available devices'''Then you can restart the development board to test whether the u-boot modification has taken effect.</li></ol></li></ol><span id="compile-the-linux-kernel"></span>
[[File:zero2w-img330.png]]== Compile the linux kernel ==
<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 # Run the '''Pairbuild.sh'''option</li></ol>script, remember to add sudo permissions
[[File:zero2w:{| class="wikitable" style="width:800px;" |-img331| test@test:~/orangepi-build$ '''sudo ./build.png]]sh'''|}
<ol start="72" style="list-style-type: decimal;"><li>What is tested here is the Bluetooth configuration process between the development board Select '''Kernel package''' 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.press Enter</li></ol>
[[File:zero2w-img332.png]]<div class="figure">
<ol start="8" style="list[[File:zero2w-style-type: decimal;"><li>After pairing is completed, open '''Paired devices''' and you will see the paired Bluetooth devicesimg281.</li></ol>png]]
[[File</div></ol><ol start="3" style="list-style-type:zero2w-img333decimal;"><li>Then you will be prompted whether you need to display the kernel configuration interface. If you do not need to modify the kernel configuration, select the first one. If you need to modify the kernel configuration, select the second one.png]]</li>
[[File:zero2w-img282.png]]</ol><ol start="94" 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 Then select the Android system model of the development board, and then click '''Accept''' to start receiving the pictures sent by the mobile phone.</li></ol>
[[File:zero2w-img334img275.png]]</ol><ol start="5" style="list-style-type: decimal;"><li>Then select the branch type of the kernel source code</li>
<ol start="10" style="list-style-type: decimal;"><li>Pictures received by the Bluetooth system of :a. The current branch will compile the development board Android system can be viewed in '''Received files'''linux5.</li></ol>4 kernel source code
[[File:zero2w-img335:b. The next branch will compile the linux6.png]]1 kernel source code
::[[File:zero2w-img276.png]]<span id/ol><ol start="6" style="how-tolist-setstyle-usb0-to-host-mode-1type: decimal;"><li>If you choose to display the kernel configuration menu (the second option) in step 3), the kernel configuration interface opened through '''make menuconfig''' will pop up. At this time, you can directly modify the kernel configuration. After modification, save and exit. Yes, compilation of the kernel source code will begin after exiting.</spanli>== How to set USB0 to HOST mode ==
As shown in the figure below, there are two Type[[File:zero2w-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 modeimg283.png]]
[[File<ol style="list-style-type: lower-alpha;"><li>If you do not need to modify the kernel configuration options, when running the build.sh script, pass '''KERNEL_CONFIGURE=no''' to temporarily block the pop-up of the kernel configuration interface.</li>{| class="wikitable" style="width:zero2w800px;" |-img160| test@test:~/orangepi-build$ '''sudo .png]]/build.sh KERNEL_CONFIGURE=no'''|}USB0 of </ol><ol start="2" style="list-style-type: lower-alpha;"><li><p>b. You can also set '''KERNEL_CONFIGURE=no''' in the Android12 TV system released by Orange Pi is set to Device mode by orangepi-build/userpatches/config-default, so when there is no need .confconfiguration file to use USB0 Device mode (ADB permanently disable this function needs to ensure that USB0 .</p></li><li><p>If the following error is in Device mode)prompted when compiling the kernel, it is recommended because the Ubuntu PC terminal interface is too small, causing the make menuconfig interface to use USB0 for power supply, so that USB1 can be directly used unable to connect USB devices be displayedIf you want Please increase the Ubuntu PC terminal to use USB0 to connect USB devicesthe maximum size, you need to set USB0 to HOST modeand then rerun the build.sh script. The method is as follows:</p></li>
[[File:zero2w-img284.png]]
</ol>
</ol>
<ol start="7" style="list-style-type: decimal;">
<li><p>Part of the information prompted when compiling the next branch kernel source code is explained as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li>Run Version of the following command to set USB0 to HOST mode:linux kernel source code</li></ol>{| class="wikitable" style="width:800px;" apollo|-p2:/ # | [ o.k. ] Compiling current kernel [ '''cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_host6.1.31''']|}host_chose finished! apollo-p2:</ #ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>Run The version of the following command to switch back to Device modecross-compilation tool chain used</li></ol>{| class="wikitable" style="width:800px;" apollo|-p2:/ # | [ o.k. ] Compiler version [ '''cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_deviceaarch64-linux-gnu-gcc 11''']|}device_chose finished! apollo-p2:</ #ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>The command to view default configuration file used by the kernel and the current mode of USB0 path where it isstored 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;">apollo<li>The path to the kernel-p2related deb package generated by compilation</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Target directory [ '''output/debs/ # '''cat ]|}</sysol><ol start="5" style="list-style-type: lower-alpha;"><li>The package name of the kernel image deb package generated by compilation</devicesli>{| class="wikitable" style="width:800px;" |-| [ o.k. ] File name [ '''linux-image-next-sun50iw9_x.x.x_arm64.deb''' ]|}</ol><ol start="6" style="list-style-type: lower-alpha;"><li>Compilation time</platformli>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Runtime [ '''10 min''' ]|}</soc@3000000ol><ol start="7" style="list-style-type: lower-alpha;"><li>Finally, the compilation command to repeatedly compile the last selected kernel will be displayed. Use the following command without selecting through the graphical interface, and you can directly start compiling the kernel source code.</soc@3000000\li>{| class="wikitable" style="width:usbc0@0800px;" |-| [ o.k. ] Repeat Build Options [ '''sudo ./otg_rolebuild.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=kernel KERNEL_CONFIGURE=no''']|}usb_host</ol></li></ol><span idol start="how8" style="list-tostyle-type: decimal;"><li><p>View the kernel-related deb package generated by compilation</p><ol style="list-usestyle-usbtype: lower-cameraalpha;"><li><p>'''linux-dtb-next-sun50iw9_x.x.x_arm64.deb''' Contains dtb files used by the kernel</p></li><li><p>'''linux-headers-next-sun50iw9_x.x.x_arm64.deb''' Contains kernel header files</p></li><li><p>'''linux-image-next-sun50iw9_x.x.x_arm64.deb''' Contains kernel images and kernel modules</p></spanli>{| class="wikitable" style= How to use USB camera =="width:800px;" |-| test@test:~/orangepi-build$ '''ls output/debs/linux-*'''
# 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 output/devdebs/linux-dtb-next-sun50iw9_x.x.x_arm64.deb
console:output/ # '''ls debs/dev/video0'''linux-headers-next-sun50iw9_x.x.x_arm64.deb
output/devdebs/video0linux-image-next-sun50iw9_x.x.x_arm64.deb|}</ol></li></ol><ol start="9" style="list-style-type: decimal;"><li>When the orangepi-bulid compilation system compiles the linux kernel source code, it will first synchronize the linux kernel source code with the linux kernel source code of the github server. Therefore, if you want to modify the linux kernel source code, you first need to turn off the update function of the source code ('''it needs to be completely compiled once This function can only be turned off after obtaining the Linux kernel source code, otherwise it will prompt that the source code of the Linux kernel cannot be found'''), otherwise the modifications will be restored. The method is as follows:</li>
<ol start="3" style="list-style-type: decimal;"><li><p>Then make sure that the adb connection between the Ubuntu PC and the development board is normal. For how to use adb, please refer to Set the instructions IGNORE_UPDATES variable in the section &quot;'''How to use ADBuserpatches/config-default.conf'''to &quot;yes&quot;.</p></li><li><p>Download the USB camera test APP from the '''official tool''' on the development board information download page</p></li></ol>
<div {| class="figurewikitable">style="width:800px;" |-| test@test:~/orangepi-build$ '''vim userpatches/config-default.conf'''
[[FileIGNORE_UPDATES=&quot;'''<span style="color:zero2w#FF0000">yes</span>'''&quot;|}</ol><ol start="10" style="list-img336.png]]style-type: decimal;"><li><p>If the kernel is modified, you can use the following method to update the kernel and kernel module of the development board Linux system</p><ol style="list-style-type: lower-alpha;"><li>Upload the compiled deb package of the Linux kernel to the Linux system of the development board</li>{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''cd output/debs'''
<test@test:~/div><div class="figure">orangepi-build/output/debs$ '''scp \'''
[[File'''linux-image-next-sun50iw9_x.x.x_arm64.deb root@192.168.1.xxx:/root'''|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Install the deb package of the new linux kernel just uploaded.</li>{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''sudo dpkg -i linux-image-next-sun50iw9_x.x.x_arm64.deb'''|}</ol><ol start="3" style="list-style-type:zero2wlower-alpha;"><li>Then restart the development board and check whether the kernel-img337related modifications have taken effect.png]]</li>{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''sudo''' '''reboot'''|}</ol></li></ol><span id="compile-rootfs"></span>
</div><ol start="5" style="list-style-type: decimal;"><li>Then use the adb command to install the USB camera test APP into the Android system. Of course, you can also use a USB disk copy to install it.</li></ol>Compile rootfs ==
test@test:~$ '''adb install usbcamera# Run the build.apk'''sh script, remember to add sudo permissions
<ol start::{| class="6wikitable" style="list-style-typewidth: decimal800px;"><li>After installation, you can see the startup icon of the USB camera on the Android desktop|-| test@test:~/orangepi-build$ '''sudo .</li></ol>build.sh'''|}
[[File<ol start="2" style="list-style-type:zero2w-img338.png]]decimal;"><li>Select '''Rootfs and all deb packages''' and press Enter</li>
<ol startdiv class="7figure" style="list-style-type: decimal;"><li>Then double-click to open the USB camera APP and you can see the output video of the USB camera.</li></ol>
<span id="android[[File:zero2w-system-root-description"></span>== Android system ROOT description ==img285.png]]
'''The Android system released by Orange Pi has been ROOT and can be tested using </div></ol><ol start="3" style="list-style-type: decimal;"><li>Then select the following method.'''model of the development board</li>
# Download from the '''official tool''' on the development board data download page '''rootcheck.apk''' <div class="figure"> [[File:zero2w-img336img275.png]] </div><div class="figure"> [[File:zero2w-img339.png]] </divol><ol start="24" style="list-style-type: decimal;"><li><p>Then make sure that select the adb connection between the Ubuntu PC and branch type of the development board is normalkernel source code. For how to use adb, please refer to the instructions in Different versions of the section &quot;'''How to use ADB'''&quot;kernel source code maintain different rootfs types.</p></liol style="list-style-type: lower-alpha;"><li><p>Then use the adb command to install rootcheck.apk into In the Android system. Of coursecurrent branch, you can also use a USB disk copy to install itsee three options: debian11, ubuntu20.04, and ubuntu22.04.</p></li></ol> test@test:~$ '''adb install rootcheck.apk''' <ol start="4" style="list-style-type: decimal;"li><lip>After installationIn the next branch, you can see the startup icon of the ROOT test tool on the Android desktopthree options: debian11, debian12, and ubuntu22.04.</lip></olli[[File:zero2w-img340.png]]
[[File:zero2w-img276.png]]
</ol>
</li></ol>
<ol start="5" style="list-style-type: decimal;">
<li>The display interface after opening Then select the '''ROOT test tool''' for the first time is as shown belowtype of rootfs</li></ol>
[[File:zero2w-img341img286.png]]</ol><ol start="6" style="list-style-type: decimal;"><li><p>Then select the type of image</p><ol style="list-style-type: lower-alpha;"><li><p>'''Image with console interface (server)''' Represents the image of the server version, which is relatively small in size.</p></li><li><p>'''Image with desktop environment''' Represents an image with a desktop, which is relatively large in size.</p></li>
<ol startdiv class="6figure" style="list-style-type: decimal;"><li>Then you can click '''CHECK NOW''' to start checking the ROOT status of the Android system. After the check is completed, the display is as follows. You can see that the Android system has obtained ROOT permissions.</li></ol>
[[File:zero2w-img342img287.png]]
<span id/div></ol></li></ol><ol start="7" style="howlist-to-use-miracastreceiverstyle-type: decimal;"><li>If you are compiling the server version of the image, you can also choose tocompile the Standard version or the Minimal version. The Minimal version will have much less pre-cast-installed software than the-mobile-phone-screen-to-Standard version ('''please do not choose theMinimal version without special needs, because many things are not pre-development-board">installed by default. Some functions may not be available''')</spanli>== How to use MiracastReceiver to cast the mobile phone screen to the development board ==
<ol style="list-style-type: decimal;">
<li><p>First, please make sure that both the development board and the mobile phone are connected to the same WIFI hotspot. For the method of connecting the development board to WIFI, please refer to '''the instructions in the WI-FI connection method.'''</p></li>
<li><p>Then open the '''MiracastReceiver'''application in the Android system of the development board</p>
<p>[[File:zero2w-img343.png]]</p></li>
<li><p>The interface after '''MiracastReceiver''' is opened is as follows</p>
<div class="figure">
[[File:zero2w-img344img288.png]]
</div></li><li><p>Then find the screen mirroring function in the phone settings. Here we take '''Xiaomi 12S Pro mobile phone''' as an example. Please research other brands of mobile phones by yourself. As shown in the picture below, click the button in the red box to open the screen mirroring function of the phone.</pol><p>[[Fileol start="8" style="list-style-type:zero2w-img345.png]]</p></lidecimal;"><li><p>After waiting for If you are compiling a period desktop version of timethe image, you will be able also need to see the searched connectable devices on your mobile phone, and then we can select the device corresponding to the development board to connect.</p><p>[[File:zero2w-img346.png]]</p></li><li><p>Then the selection box shown in the figure below will pop up in the '''MiracastReceiver''' application interface type of the development boarddesktop environment. Here we can Currently, only XFCE is maintained, so please 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-img348an XFCE type desktop.png]]</p></li></ol>
<span id="method[[File:zero2w-of-turning-on-and-off-the-machine-through-buttons-or-infrared-remote-control"></span>== Method of turning on and off the machine through buttons or infrared remote control ==img289.png]]
We can turn off or turn on the Android system of the development board through the power on/off button or infrared remote control. However, it should be noted that there is no power on/off button and infrared receiver on the main board of the development board, and it needs to be expanded through a 24pin expansion board[[File:zero2w-img290.png]]
[[File:zero2w-img107You can then select additional packages that need to be installed. Please press the Enter key here to skip directly.png]]
The location [[File:zero2w-img291.png]]</ol><ol start="9" style="list-style-type: decimal;"><li><p>Then the compilation of rootfs will start. Some of the power button on the 24pin expansion board is information prompted during compilation are as shown in follows:</p><ol style="list-style-type: lower-alpha;"><li>Type of rootfs</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] local not found [ Creating new rootfs cache for '''bullseye''' ]|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>The storage path of the figure belowcompiled rootfs compressed package</li>{| class="wikitable" style="width:800px;" |-| [o.k. ] Target directory [File'''orangepi-build/external/cache/rootfs''' ]|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>The name of the rootfs compressed package generated by compilation</li>{| class="wikitable" style="width:zero2w800px;" |-img269| [ o.k.png]File name [ '''bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4''' ]|}</ol></li></ol><ol start="10" style="list-style-type: decimal;"><li><p>View the compiled rootfs compressed package</p><ol style="list-style-type: lower-alpha;"><li>'''bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4''' It is a compressed package of rootfs. The meaning of each field in the name is</li>
The location :a) '''bullseye''' represents the type of the infrared remote control power button is as follows:Linux distribution of rootfs
[[File:zero2w-img349b) '''xfce''' indicates that the rootfs is the desktop version, and if it is cli, it indicates the server version.png]]
When shutting down, we need to press and hold the power button or the power button on the infrared remote control, and then the Android system will pop up the confirmation dialog box shown in the figure below, and then select :c) '''OKarm64''' to shut down represents the Android system.architecture type of rootfs
[[File:zero2wd) '''25250ec7002de9e81a41de169f1f89721''' is the MD5 hash value generated by the package names of all software packages installed by rootfs. As long as the list of software packages installed by rootfs is not modified, this value will not change. The compilation script will use this MD5 hash value. Determine whether rootfs needs to be recompiled</ol><ol start="2" style="list-style-type: lower-alpha;"><li>'''bullseye-img350xfce-arm64.png]]5250ec7002de9e81a41de169f1f89721.tar.lz4.list''' Lists the package names of all packages installed by rootfs</li>{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''ls external/cache/rootfs/'''
After shutting down, press and hold the power button or the power button on the infrared remote control again to turn it onbullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4
<span id="pinbullseye-interfacexfce-gpio-uart-spi-test"></span>== 40pin interface GPIO, UART, SPI test ==arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4.current
bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4.list|}</ol></li></ol><ol start="11" style="list-style-type: decimal;"><li>If the required rootfs already exists under '''Note: The pin header on external/cache/rootfs''', then compiling the rootfs again will directly skip the 40pin interface is compilation process and will not soldered by defaultrestart the compilation. When compiling the image, and you need it will also go to '''external/cache/rootfs''' to solder check whether it already exists. There is a cached rootfs available. If it yourself before is available, use it directly. This can be usedsave a lot of download and compilation time.'''</li></ol>
<span id="pincompile-gpiolinux-port-test-methodimage"></span>=== 40pin GPIO port test method ===
# First open wiringOP APP on the desktop== Compile linux image ==
[[File:zero2w-img351# Run the '''build.png]]sh''' script, remember to add sudo permissions
<ol start::{| class="2wikitable" style="list-style-typewidth: decimal800px;"><li>Then click the |-| test@test:~/orangepi-build$ '''GPIO_TESTsudo ./build.sh''' button to open the GPIO test interface</li></ol> [[File:zero2w-img352.png]]|}
<ol start="32" style="list-style-type: decimal;"><li>The GPIO test interface is as shown in the figure below. The two rows of Select '''CheckBoxFull OS image for flashing''' buttons on the left have a one-to-one correspondence with the 40pin pins. When the '''CheckBox''' button is checked, the corresponding GPIO pin will be set to '''OUT''' mode and the pin level is set to high level; when unchecked, the GPIO pin level will be set to low level; when the GPIO is clicked When you click the '''GPIO READALL''' button, you can get information such as wPi number, GPIO mode, pin level, etc.; when you click the'''BLINK ALL GPIO''' button, all GPIO ports will cycle through outputting high and low levels. This function can be used to test all the 40pin pins. GPIO port.press Enter</li></ol>
[[File:zero2w-img353.png]]<div class="figure">
<ol start="4" style="list-style[[File:zero2w-type: decimal;"><li>Then click the '''GPIO READALL''' button, and the output information is as shown below:</li></ol>img292.png]]
</div class></ol><ol start="figure3"style="list-style-type: decimal;"><li>Then select the model of the development board</li>
[[File:zero2w-img354img275.png]]</ol><ol start="4" style="list-style-type: decimal;"><li><p>Then select the branch type of the kernel source code. Different versions of the kernel source code maintain different rootfs types.</p><ol style="list-style-type: lower-alpha;"><li><p>In the current branch, you can see three options: debian11, ubuntu20.04, and ubuntu22.04.</p></li><li><p>In the next branch, you can see three options: debian11, debian12, and ubuntu22.04.</p></li>
[[File:zero2w-img276.png]]</divol></li></ol>
<ol start="5" style="list-style-type: decimal;">
<li>There are a total of 28 GPIO ports available in the 40-pin development board. The following takes pin 12 - corresponding to GPIO PI01 - corresponding to wPi serial number 6 - as an example to demonstrate how to set the high and low levels of the GPIO port. First click the '''CheckBox''' button corresponding to pin 12. When <p>If you select the button is selectednext branch, pin 12 you will also be set prompted to high level. After settingselect the memory size, and you can use a multimeter do not need to measure select the value of current branch.</p><ol style="list-style-type: lower-alpha;"><li><p>If the voltage development board you purchased has a memory size of 1.5GB, please select the pinfirst option. </p></li><li><p>If it is '''3.3v'''the development board you purchased has 1GB or 2GB or 4GB memory size, it means please choose the setting High level successsecond option.</p><p>[[File:zero2w-img277.png]]</p></li></ol></li><li><p>Then select the type of rootfs</p></li>
[[File:zero2w-img355img286.png]]</ol><ol start="7" style="list-style-type: decimal;"><li><p>Then select the type of image</p><ol style="list-style-type: lower-alpha;"><li><p>'''Image with console interface (server)''' Represents the image of the server version, which is relatively small in size.</p></li><li><p>'''Image with desktop environment'''Represents an image with a desktop, which is relatively large in size.</p></li> <div class="figure">
<ol start="6" style="list[[File:zero2w-style-type: decimal;"><li>Then click the '''GPIO READALL''' button and you can see that the current pin 12 mode is '''OUT''' and the pin level is high levelimg287.</li></ol>png]]
[[File</div></ol></li></ol><ol start="8" style="list-style-type:zero2wdecimal;"><li>If you are compiling the server version of the image, you can also choose to compile the Standard version or the Minimal version. The Minimal version will have much less pre-installed software than the Standard version ('''please do not choose the Minimal version without special needs, because many things are not pre-img356installed by default.png]]Some functions may not be available''')</li>
<ol startdiv class="7figure" style="list-style-type: decimal;"><li>Click the '''CheckBox''' button in the picture below again to uncheck it, and pin 12 will be set to low level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is '''0v''', it means the low level setting is successful.</li></ol>
[[File:zero2w-img357img288.png]]
</div></ol><ol start="89" style="list-style-type: decimal;"><li>Then click If you are compiling a desktop version of the '''GPIO READALL''' button and image, you can see that also need to select the current pin 12 mode type of desktop environment. Currently, only XFCE is OUT and the pin level is low levelmaintained, so please select an XFCE type desktop.</li></ol>
[[File:zero2w-img358img289.png]]
<span id="pin[[File:zero2w-uart-test-method"></span>=== 40pin UART test method ===img290.png]]
# As You can then select additional packages that need to be seen from the table below, the default uarts available in the Android12 TV system are uart2 and uart5installed. Please note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial portpress the Enter key here to skip directly.
{| class[[File:zero2w-img291.png]]</ol><ol start="10" style="wikitablelist-style-type: decimal;"><li>Then the compilation of the linux image will begin. The general process of compilation is as follows</li> ::a. Initialize the compilation environment of Ubuntu PC and install the software packages required for the compilation process. ::b. Download the source code of u-boot and linux kernel (if already cached, only update the code) ::c. Compile u-boot source code and generate u-boot deb package ::d. Compile linux source code and generate linux-related deb packages ::e. Make the deb package of linux firmware ::f. Make the deb package of orangepi-config tool ::g. Create a deb package with board-level support ::h. If you compile the desktop version image, you will also create a desktop-related deb package. ::i. Check whether rootfs has been cached. If not, re-create rootfs. If it has been cached, decompress it directly and use it. ::j. Install the deb package generated previously into rootfs|::k. Make some specific settings for different development boards and different types of images, such as pre-installing additional software packages, modifying system configurations, etc. ::l. Then create the image file and format the partition. The default type is ext4. | '''GPIO序号'''::m. Then copy the configured rootfs to the mirror partition. ::n. Then update initramfs| '''GPIO'''| '''功能'''::o. Finally, write the bin file of u-boot into the image through the dd command.| '''引脚'''</ol>|<ol start="11" style="list-style-type: decimal;">| '''引脚'''<li><p>After compiling the image, the following message will be displayed</p>| '''功能'''<ol style="list-style-type: lower-alpha;">| '''GPIO'''<li>The storage path of the compiled image</li>{| '''GPIO序号'''class="wikitable" style="width:800px;"
|-
| style="text-align: left;"|| style="text-align: left;"|| [ o.k. ] Done building [ '''3output/images/orangepizero2w_x.3Vx.x_debian_bullseye_linux6.1.xx_xfce_desktop/orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop.img''']| '''1'''}|</ol>| '''<ol start="2'''| '''5V'''| " style="textlist-style-aligntype: leftlower-alpha;"|><li>Compilation time</li>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| '''264[ o.k. ] Runtime [ 19 min ]'''| '''PI8'''}| '''TWI1-SDA'''</ol>| '''<ol start="3'''|| '''4'''| '''5V'''| " style="textlist-alignstyle-type: leftlower-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>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| [ o.k. ] Repeat Build Options [ '''263sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=image RELEASE=bullseye BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_CONFIGURE=yes''']| '''PI7'''}</ol></li></ol>| '''TWI1<span id="instructions-for-using-the-orange-pi-os-arch-SCL'''system"></span>| '''5'''|| = '''6Instructions for using the Orange Pi OS Arch system'''=| '''GND'''| style<span id="textorange-pi-os-arch-system-function-adaptation-align: left;status"|></span>== Orange Pi OS Arch system function adaptation status == {| class="wikitable" style="width:800px;text-align: leftcenter;"|
|-
| '''269Motherboard functions'''| '''PI13'''| '''PWM3'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224OPi OS Arch'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''9'''|| '''10'''| '''UART0_RX'''| '''PH1HDMI video'''| '''225OK'''
|-
| '''226HDMI Audio'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''12'''| style="text-align: left;"|| '''PI1'''| '''257OK'''
|-
| '''227'''| '''PH3'''| '''UART5_RXType-C USB2.0 x 2'''| '''13OK'''|| '''14'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''261TF Card Startup'''| '''PI5OK'''| '''UART2_TX'''| '''15'''|| '''16'''| '''PWM4'''-| '''PI14WIFI'''| '''270OK'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''17'''|| '''18'''| style="text-align: left;"|| '''PH4Bluetooth'''| '''228OK'''
|-
| '''231LED Light'''| '''PH7OK'''| '''SPI1_MOSI'''| '''19'''|| '''20'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''23240pin GPIO'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''UART2_RX'''| '''PI6'''| '''262OK'''
|-
| '''23040pin I2C'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229OK'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''GND40pin SPI'''| '''25OK'''|-| '''26'''| '''SPI1_CS1'''| '''PH940pin UART'''| '''233OK'''
|-
| '''26640pin PWM'''| '''PI10'''| '''TWI2-SDA'''| '''27'''|| '''28'''| '''TWI2-SCL'''| '''PI9'''| '''265OK'''
|-
| '''256Temperature Sensor'''| '''PI0OK'''| style="text-align: left;"|| '''29'''|| '''30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''271Hardware watchdog'''| '''PI15'''| style="text-align: left;"|| '''31'''|| '''32'''| '''PWM1'''| '''PI11'''| '''267OK'''
|-
| '''268Mali GPU'''| '''PI12'''| '''PWM2'''| '''33'''|| '''34'''| '''GND'''| <span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"|>NO</span>'''
|-
| '''258Video codec'''| '''PI2<span style="color:#FF0000">NO</span>'''| } {| class="wikitable" style="width:800px;text-align: leftcenter;"|-| '''24pin expansion board function'''| '''OPi OS Arch'''|-| '''35100M network port'''|'''OK'''|-| '''36100M Ethernet port light'''| '''OK'''|-| '''USB2.0 HOST x 2'''| '''OK'''|-| '''Infrared reception'''| '''OK'''| style="text-align: left;"| '''Headphone audio playback'''| '''OK'''|-| '''PC12On/off button'''| '''76OK'''
|-
| '''272LRADC'''| '''PI16'''| style="text-align: left;"|| '''37'''|| '''38'''| style="text-align: left;"|| '''PI4Custom buttons x 2'''| '''260OK'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''GNDTV-OUT'''| '''39'''|| '''40'''| <span style="text-aligncolor: left;#FF0000"|| '''PI3'''| '''259>NO</span>'''
|}
<ol startspan id="2" style="listorange-pi-os-arch-system-user-styleguide-type: decimal;instructions"><li>The device node corresponding to uart2 is '''/dev/ttyAS2''', and the device node corresponding to uart5 is'''/dev/ttyAS5'''</li></olspan>
apollo-p2:/ # ls /dev/ttyAS*== Orange Pi OS Arch System User Guide Instructions ==
/dev/ttyAS0 /dev/ttyAS1 '''/dev/ttyAS2 /dev/ttyAS5'''First of all, please note that the OPi OS Arch system does not have a default orangepi user and password, so you cannot directly log in remotely through the serial port and ssh after the system is started after burning (not even the root user). This is different from Ubuntu and Debian systems.
<ol start="3" style="list-style-typeWhen the OPi OS Arch system is started for the first time, you need to connect an HDMI display and then initialize the system settings through the user wizard (including creating a new user name and setting a password). The setup steps of the user wizard are as follows: decimal;"><li>First open wiringOP APP on the desktop</li></ol>
[[File<ol style="list-style-type:zero2wlower-img351alpha;"><li><p>After burning the system, when you start it for the first time and enter the desktop, you will see the user wizard program shown in the figure below.png]]</p><div class="figure">
[[File:zero2w-img293.png]] <ol start/div></li><li><p>First you need to select the language you want</p><div class="4figure" style="list> [[File:zero2w-style-type: decimal;"img294.png]] </div></li><li>Then click <p>After selecting the language, the '''UART_TEST'''button user wizard will immediately switch to open the UART test corresponding language interface, as shown below in Chinese</lip></oldiv class="figure">
[[File:zero2w-img359img295.png]]
<ol start="5" style="list-style-type: decimal;"/div></li><li>The serial port test interface of wiringOP is as shown in <p>Then select the figure belowarea</lip></oldiv class="figure">
[[File:zero2w-img360img296.png]]
<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]]</pdiv></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 Then select the '''CLOSE''' button and '''SEND''' button become selectable.keyboard model</p></li></oldiv class="figure">
[[File:zero2w-img362img297.png]]
<ol start="8" style="list-style-type: decimal;"><li><p>Then use Dupont wire to short the rx and tx pins of uart</pdiv></li><li><p>Then you can enter create a paragraph of characters in the send edit box below new username and click the '''SEND''' button to start sending.set a password</p></li></oldiv class="figure">
[[File:zero2w-img363img298.png]]
<ol start="10" style="list-style-type: decimal;"/div></li><li>If everything <p>Then make sure there is normalno problem with the selection, and then click the received string will be displayed in the receiving boxinstall '''button'''</lip></oldiv class="figure">
[[File:zero2w-img364img299.png]]
<span id="pin-spi-test-method"/div></li><li><p>Then wait for the installation to complete</spanp><div class=== 40pin SPI test method ==="figure">
# As can be seen from the table below, the spi available for the 40pin interface is spi1, and there are two chip select pins cs0 and cs1[[File:zero2w-img300.png]]
{| </div></li><li><p>After the installation is complete, you need to click the '''Finish''' button to restart the system.</p><div class="wikitablefigure">|[[File:zero2w-img301.png]]| '''GPIO serial number'''| '''GPIO'''</div></li>| <li><p>The Orange Pi Hello program will automatically start after restarting. At this time, you need to remove the check '''Functionmark of Start on startup'''in the lower right corner, otherwise you need to manually close the Orange Pi Hello program every time you start it.</p>| '''pin'''<div class="figure">|| '''pin'''[[File:zero2w-img302.png]]| '''Function'''| '''GPIO'''</div>| '''GPIO <p>At this point, you can use the newly created username and password to log in to the OPi OS system through the serial number'''port or ssh.</p></li></ol>|-| style<span id="texthow-align: left;to-set-dt-overlays"|></span>| style="text= How to set DT overlays == The multiplexing functions such as I2C/SPI/UART/PWM in the 40-align: left;"|| ''pin development board are turned off by default in the kernel'3s dts, and the corresponding DT overlays need to be manually turned on before they can be used.3V'''| '''1'''|The method to open DT overlays in OPi OS Arch system is as follows: | # First open the '''2/boot/extlinux/extlinux.conf'''configuration file| '''5V'''::{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| [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;"|
|-
| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|| <big>'''6Note that xxx.dtbo in FDTOVERLAYS /dtbs/allwinner/overlay/xxx.dtbo needs to be replaced with the specific dtbo configuration, please do not copy it.'''</big>| '''GND'''}{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| [orangepi@orangepi-pc ~]$ '''269sudo vim /boot/extlinux/extlinux.conf'''| LABEL Orange Pi KERNEL /Image FDT /dtbs/allwinner/sun50i-h616-orangepi-zero2w.dtb '''PI13FDTOVERLAYS /dtbs/allwinner/overlay/<span style="color:#FF0000">xxx.dtbo</span>'''#Configuration that needs to be added| '''PWM3'''}</ol><ol start="3" style="list-style-type: decimal;"><li><p>The storage path of xxx.dtbo in the OPi OS Arch image is as follows. Please note that not all dtbo under this path can be used.</p>{| '''7'''class="wikitable" style="width:800px;" |-| <p>'''8/boot/dtbs/allwinner/overlay/'''</p>| '''UART0_TX'''}</li><li><p>The DT overlays configuration that can be used by the development board is as follows</p></li>| '''PH0'''{| '''224'''class="wikitable" style="width:800px;text-align: center;"
|-
| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''9'''|| '''10'''| '''UART0_RX'''| '''PH1Functions on the development board'''| '''225Corresponding DT overlays configuration'''
|-
| '''22640pin - i2c0'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''12'''| style="textsun50i-h616-pi-align: left;"|| '''PI1'''| '''257i2c0.dtbo'''
|-
| '''22740pin - i2c1'''| '''PH3'''| '''UART5_RX'''| '''13'''|| '''14''sun50i-h616-pi-i2c1.dtbo'| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''26140pin - i2c2'''| '''PI5sun50i-h616-pi-i2c2.dtbo'''| '''UART2_TX'''| '''15'''|| '''16'''| '''PWM4'''-| '''PI1440pin - uart2'''| '''270sun50i-h616-pi-uart2.dtbo'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''3.3V40pin - uart3'''| '''17'''|| '''18'''| style="textsun50i-h616-pi-align: left;"|| '''PH4'''| '''228uart3.dtbo'''
|-
| '''23140pin - uart4'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|| '''20''sun50i-h616-pi-uart4.dtbo'| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''23240pin - uart5'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''UART2_RX'''| '''PI6'''| '''262sun50i-h616-ph-uart5.dtbo'''
|-
| '''23040pin - pwm1'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229sun50i-h616-pi-pwm1.dtbo'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''GND40pin - pwm2'''| '''25sun50i-h616-pi-pwm2.dtbo'''|-| '''2640pin - pwm3'''| '''SPI1_CS1sun50i-h616-pi-pwm3.dtbo'''|-| '''PH940pin - pwm4'''| '''233sun50i-h616-pi-pwm4.dtbo'''
|-
| '''26640pin - spi1 cs0'''| '''PI10'''| '''TWI2sun50i-h616-spi1-SDA'''| '''27'''|| '''28'''| '''TWI2cs0-SCL'''| '''PI9'''| '''265spidev.dtbo'''
|-
| '''25640pin - spi1 cs1'''| '''PI0'''| style="textsun50i-h616-spi1-cs1-align: left;"|| '''29'spidev.dtbo''|| '''30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''27140pin - spi1 cs0 cs1'''| '''PI15'''| style="textsun50i-h616-spi1-cs0-cs1-align: left;"|| '''31'''|| '''32'''| '''PWM1'''| '''PI11'''| '''267spidev.dtbo'''
|-
| '''268设Set USB0 to Host mode'''| '''PI12'''| ''sun50i-h616-usb0-host.dtbo'PWM2'''| '''33'''|| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''258Turn off the green LED light'''| '''PI2sun50i-h616-zero2w-disable-led.dtbo'''| style="text-align: left;"|| '''35How to close the UART0 debugging serial port'''|| '''36'''| style="textsun50i-h616-disable-align: left;"|| '''PC12'''| '''76uart0.dtbo'''
|}
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>If you need to open multiple configurations at the same time, just add the paths of multiple configurations directly after '''FDTOVERLAYS.''' For example, the configuration of opening i2c1 and uart5 at the same time is as follows</li>
{| class="wikitable" style="width:800px;"
|-
|
[orangepi@orangepi-pc ~]$ '''sudo vim /boot/extlinux/extlinux.conf'''
<ol start="2" style="list-style-type: decimal;"><li>The device node corresponding to SPI1 CS0 is '''/dev/spidev1.0''', and the device node corresponding to SPI1 CS1 is '''/dev/spidev1.1'''</li></ol>LABEL Orange Pi
apollo-p2:KERNEL / # '''ls /dev/spidev1.*'''Image
'''FDT /devdtbs/spidev1.0 /devallwinner/spidev1sun50i-h616-orangepi-zero2w.1'''dtb
'''FDTOVERLAYS <span style="color:#FF0000">/dtbs/allwinner/overlay/sun50i-h616-pi-i2c1.dtbo /dtbs/allwinner/overlay/sun50i-h616-ph-uart5.dtbo</span>'''|}</ol><ol start="36" style="list-style-type: decimal;"><li>Here is a demonstration After setting, you need to test restart the SPI1 interface through system for the configuration to take effect.</li>{| class="wikitable" style="width:800px;" |-| [orangepi@orangepi-pc ~]$ '''w25qxxsudo reboot''' module. First, connect the w25qxx module to the SPI1 interface.|}</liol><span id="how-to-install-software"></olspan>
'''It doesn't matter if there is no w25qxx module, because there is a SPIFlash on the development board connected == How to SPI0, and the configuration of SPI0 is also turned on by default in Android, so we can also directly use the onboard SPIFlash for testing.'''install software ==
<ol start="4" style="list-style-type: decimal;"><li>Then open wiringOP APP on You can use the desktop</li></ol>pacman package management tool to install software that is not available in OPi OS. For example, the command to install the vim editor is as follows. If you want to install other software, you only need to replace vim with the package name of the software you want to install.
{| class="wikitable" style="width:800px;" |-| [[File:zero2worangepi@orangepi-img351.png]pc ~]$ '''sudo pacman -Syy vim'''|}
<ol startspan id="5" style="listandroid-12-tv-system-styleusage-type: decimal;instructions"><li>Then click the '''SPI_TEST''' button to open the SPI test interface</li></olspan>
[[File:zero2w-img365.png]]= '''Android 12 TV system usage instructions''' =
<ol startspan id="6" style="listsupported-styleandroid-type: decimal;versions"><li><p>Then select the spi device node in the upper left corner. If you test the onboard SPIFlash directly, just keep the default '''/dev/spidev0.0'''. If the '''w25qxx''' module is connected to the 40pin spi1 cs0, then please select'''/dev/spidev1.0''', if the w25qxx module is connected to the 40pin spi1 cs1, then please select '''/dev/spidev1.1'''</pspan><div class="figure">= Supported Android versions ==
[[File{| class="wikitable" style="width:zero2w800px;text-img366align: center;"|-| Android Version| Kernel version|-| '''Android 12 TV Version'''| '''linux5.png]]4'''|}
</divspan id="android-12-tv-function-adaptation-status"></lispan><li><p>Then click the '''OPEN''' button to initialize the SPI</p></li></ol>== Android 12 TV function adaptation status ==
[[File:zero2w-img367.png]] <ol start{| class="8wikitable" style="list-style-typewidth: decimal800px;"><li>Then fill in the bytes that need to be sent, such as reading the ID information of the onboard SPIFlash, filling in the address 0x9f in data[0], and then click the '''TRANSFER''' button</li></ol> [[File:zero2wtext-img368.png]] <ol start="9" style="list-style-typealign: decimalcenter;"><li>Finally, the APP will display the read ID information of the onboard SPI Flash.</li></ol> [[File:zero2w-img369.png]] <ol start="10" style="list-style-type: decimal;"><li>If the w25qxx module connected to 40pin SPI1 is read, the ID information of the onboard SPI Flash is also similar.</li></ol> <span id="pin-i2c-test-method"></span>=== 40pin I2C test method === # As can be seen from the table below, the Android12 TV system has i2c1 and i2c2 turned on by default. {| class="wikitable"
|-
| '''GPIO serial numberMotherboard functions'''| '''GPIO'''| '''Function'''| '''pin'''|| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO serial numberAndroid12 TV'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''1'''|| '''2HDMI video'''| '''5VOK'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''264HDMI Audio'''| '''PI8OK'''| '''TWI1-SDA'''| '''3'''|| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''263'''| '''PI7'''| '''TWI1Type-SCL'''| '''5C USB2.0 x 2'''|| '''6OK'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''269TF card startup'''| '''PI13OK'''| '''PWM3'''| '''7'''|| '''8'''| '''UART0_TX'''-| '''PH0WIFI'''| '''224OK'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''9'''|| '''10'''| '''UART0_RX'''| '''PH1Bluetooth'''| '''225OK'''
|-
| '''226USB Camera'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''12'''| style="text-align: left;"|| '''PI1'''| '''257OK'''
|-
| '''227LED Light'''| '''PH3OK'''| '''UART5_RX'''| '''13'''|| '''14'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''26140pin GPIO'''| '''PI5'''| '''UART2_TX'''| '''15'''|| '''16'''| '''PWM4'''| '''PI14'''| '''270OK'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''3.3V40pin I2C'''| '''17OK'''|| '''18'''| style="text-align: left;"|| '''PH440pin SPI1'''| '''228OK'''
|-
| '''23140pin UART'''| '''PH7OK'''| '''SPI1_MOSI'''| '''19'''|| '''20'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''23240pin PWM'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''22'''| '''UART2_RX'''| '''PI6'''| '''262OK'''
|-
| '''230Temperature Sensor'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229OK'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''25'''|| '''26'''| '''SPI1_CS1'''| '''PH9Hardware watchdog'''| '''233OK'''
|-
| '''266Mali GPU'''| '''PI10OK'''| '''TWI2-SDA'''| '''27Video codec'''|| '''28OK'''| '''TWI2-SCL'''}| '''PI9'''{| '''265'''class="wikitable" style="width:800px;text-align: center;"
|-
| '''25624pin Expansion board function'''| '''PI0Android12 TV'''| style="text-align: left;"|| '''29'''|| '''30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''271100M network port'''| '''PI15'''| style="text-align: left;"|| '''31'''|| '''32'''| '''PWM1'''| '''PI11'''| '''267OK'''
|-
| '''268100M Ethernet port light'''| '''PI12OK'''| '''PWM2'''| '''33'''|| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''258USB2.0 HOST x 2'''| '''PI2'''| style="text-align: left;"|| '''35'''|| '''36'''| style="text-align: left;"|| '''PC12'''| '''76OK'''
|-
| '''272Infrared reception'''| '''PI16OK'''| style="text-align: left;"|'''Headphone audio playback'''| '''37OK'''|-| '''38On/off button'''| '''OK'''| style="text-align: left;"| '''LRADC''' '''Custom buttons x 2'''| '''OK, The default setting is the volume up and down keys.'''|-| '''PI4TV-OUT'''| '''260OK'''|} <span id="onboard-led-light-display-instructions"></span>== Onboard LED light display instructions == {| class="wikitable" style="width:800px;text-align: center;"
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''39'''
|
| '''40green light'''| style="text'''red light'''|-| '''u-align: left;"boot startup phase'''|'''Off'''| '''on'''|-| '''Kernel boot to enter the system'''| '''PI3on'''| '''259on'''
|}
<ol startspan id="2" style="listhow-to-stylereturn-type: decimal;"><li>The device node corresponding to i2c1 is '''/dev/i2c-1''', and the device node corresponding to i2c2 is '''/dev/i2c-2'''</liprevious-interface-in-android"></olspan>== How to return to the previous interface in Android ==
apolloWe generally use the mouse and keyboard to control the Android system of the development board. When entering certain interfaces and need to return to the previous interface or desktop, we can only return by right-p2:/ # '''ls /dev/i2c-*'''clicking the mouse, and the keyboard cannot return.
'''/dev/i2c-1 /dev/i2c-2''' /dev/i2c-5If you have purchased the infrared remote control (other remote controls do not work) and a 24pin expansion board that come with the development board, after connecting the 24pin expansion board to the development board, you can also use the return key on the remote control to return to the previous menu. The location of the return key is as shown below. Shown:
<ol start="3" style="list[[File:zero2w-style-type: decimal;"><li>First open wiringOP APP on the desktop</li></ol>img303.png]]
[[File:zero2w<span id="how-img351.png]]to-use-adb"></span>== How to use ADB ==
<ol startspan id="4" style="listuse-network-connection-styleadb-type: decimal;debugging"><li>Then click the '''I2C_TEST''' button to open the i2c test interface</li></olspan>=== Use network connection adb debugging ===
[[File{| class="wikitable" style="background-color:#ffffdc;width:zero2w800px;" |-img370| <big>'''Using network adb does not require a USB Typc C interface data cable to connect the computer and the development board. Instead, it communicates through the network, so first make sure that the development board's wired or wireless network is connected, and then obtain the IP address of the development board. Next To be used.png]]'''</big>|}
<ol start="5" style="list-style-type: decimal;"><li>The i2c test interface # Make sure the '''service.adb.tcp.port''' of wiringOP the Android system is shown in the figure below</li></ol>set to 5555 port number
::{| class="wikitable" style="width:800px;" |-| apollo-p2:/ # '''getprop | grep &quot;adb.tcp&quot;''' [service.adb.tcp.port]: [File5555]|} <ol start="2" style="list-style-type: decimal;"><li>If '''service.adb.tcp.port''' is not set, you can use the following command in the serial port to set the port number of the network adb</li>{| class="wikitable" style="width:zero2w800px;" |-| apollo-img371p2:/ # '''setprop service.adb.tcp.png]]port 5555'''
<ol start="6" style="listapollo-style-typep2: decimal;"><li>Then click the device node selection box in the upper left corner to select the i2c you want to test</li></ol># '''stop adbd'''
[[Fileapollo-p2:/ # '''start adbd'''|}</ol><ol start="3" style="list-style-type: decimal;"><li>Install adb tool on Ubuntu PC</li>{| class="wikitable" style="width:800px;" |-| test@test:zero2w~$ '''sudo apt-img372.png]]get update'''
test@test:~$ '''sudo apt-get install -y adb'''|}</ol><ol start="74" 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.network adb on Ubuntu PC</li></ol>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''adb connect 192.168.1.xxx:5555''' '''(Need to be modified to the IP address of the development board)'''
[[File<p>* daemon not running; starting now at tcp:zero2w-img178.png]]5037</p>
<ol start="8" style="list-style-type: decimal;"><li><p>The i2c address of the ds1307 rtc module is 0x68. After connecting the lines, we can use the '''i2cdetect -y 1''' or '''i2cdetect -y 2''' command on the serial port command line to check whether the i2c address of the ds1307 rtc module can be scanned. If you can see the address 0x68, it means that the ds1307 rtc module is wired correctly.</p><p>apollo-p2:/ # '''i2cdetect -y 1'''</p><p>'''Or'''</p><p>apollo-p2:/ # '''i2cdetect -y 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>* daemon started successfully</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 ===connected to 192.168.1.xxx:5555
# As can be seen from the table below, the available pwm are pwm1, pwm2, pwm3 and pwm4.
{| class="wikitable"|-| test@test:~$ '''GPIO serial numberadb devices'''| '''GPIO'''| '''Function'''List of devices attached | '''pin'''192.168.1.xxx:5555 device|}| '''pin'''</ol>| '''Function'''<ol start="5" style="list-style-type: decimal;">| '''GPIO'''<li>Then you can log in to the android system through adb shell on Ubuntu PC</li>{| '''GPIO serial number'''class="wikitable" style="width:800px;"
|-
| style="texttest@test:~$ '''adb shell''' apollo-alignp2: left;"/ #|}| style</ol><span id="textuse-data-cable-to-connect-align: left;adb-debugging"|></span> === Use data cable to connect adb debugging === | # 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''3s USB interface can provide the most sufficient power to drive the development board.3V'''| '''1'''|::[[File:zero2w-img304.png]] [[File:zero2w-img305.png]] | '''<ol start="2'''| '''5V'''| " style="textlist-style-aligntype: leftdecimal;"|><li>Install adb tool on Ubuntu PC</li>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| test@test:~$ '''264sudo apt-get update'''| '''PI8'''| test@test:~$ '''TWI1sudo apt-get install -SDAy adb'''| '''3'''}|</ol>| '''4'''| '''5V'''| <ol start="3" style="textlist-style-aligntype: leftdecimal;"|><li>Check whether the ADB device is recognized</li>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| test@test:~$ '''263adb devices'''| '''PI7'''| '''TWI1-SCL'''List of devices attached| '''5'''|4c00146473c28651dd0 device| '''6'''}| '''GND'''</ol>| <ol start="4" style="textlist-style-aligntype: 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:~$ '''269adb 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 '''PI13Settings'''</p><p>[[File:zero2w-img306.png]]</p></li>| <li><p>Then select '''PWM3Device Preferences'''</p><p>[[File:zero2w-img307.png]]</p></li>| <li><p>Then select '''7Display &amp; Sound'''</p>|<p>[[File:zero2w-img308.png]]</p></li>| <li><p>Then select '''8Advanced display settings'''</p>| <p>[[File:zero2w-img309.png]]</p></li><li><p>Then select '''UART0_TXHDMI output mode'''</p><p>[[File:zero2w-img310.png]]</p></li>| '''PH0'''<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>| '''224'''|<span id="hdmi-to-vga-display-test-1"></span>=== HDMI to VGA display test === | <ol style="textlist-style-aligntype: leftdecimal;"|><li><p>First you need to prepare the following accessories</p>| <ol style="textlist-style-aligntype: leftlower-alpha;"|>| '''GND'''<li>HDMI to VGA converter</li>| '''9'''|[[File:zero2w-img144.png]]| '''10'''</ol>| '''UART0_RX'''<ol start="2" style="list-style-type: lower-alpha;">| '''PH1'''<li>A VGA cable and a Mini HDMI male to HDMI female adapter</li>| '''225'''|[[File:zero2w-img145.png]] [[File:zero2w-img146.png]]| '''226'''</ol>| '''PH2'''<ol start="3" style="list-style-type: lower-alpha;">| '''UART5_TX'''<li>A monitor or TV that supports VGA interface</li></ol>| '''11'''</li></ol>|| '''12'''| <ol start="2" style="textlist-style-aligntype: leftdecimal;"|><li>HDMI to VGA display test is as follows</li> [[File:zero2w-img313.png]]| '''PI1'''{| '''257'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big>'''227When using HDMI to VGA display, the development board and the Android system of the development board do not need to make any settings. You only need the Mini HDMI interface of the development board to display normally. So if there is a problem with the test, please check whether there is a problem with the HDMI to VGA converter, VGA cable and monitor.'''</big>| '''PH3'''}</ol><span id="wi-fi-connection-method"></span> == WI-FI connection method ==| '''UART5_RX'''| # Choose first '''13Settings'''|| '''14'''::[[File:zero2w-img306.png]]| '''GND'''| style<ol start="text-align: left;2"|| style="textlist-style-aligntype: leftdecimal;"|>|-| <li>Then select '''261Network &amp; Internet'''</li>| '''PI5'''| '''UART2_TX'''[[File:zero2w-img314.png]]| '''15'''</ol>|<ol start="3" style="list-style-type: decimal;">| '''16'''<li>Then turn on WI-FI</li>| '''PWM4'''| '''PI14'''| '''270'''[[File:zero2w-img315.png]]|-</ol>| style<ol start="text-align: left;4"|| style="textlist-style-aligntype: leftdecimal;"|>| <li>After turning on WI-FI, you can see the searched signals under '''3.3VAvailable networks'''.</li>| '''17'''|[[File:zero2w-img316.png]]| '''18'''</ol>| <ol start="5" style="textlist-alignstyle-type: leftdecimal;"|>| '''PH4'''| '''228'''|<li>After selecting the WI-FI you want to connect to, the password input interface shown below will pop up.</li>| '''231'''| '''PH7'''<div class="figure">| '''SPI1_MOSI'''| '''19'''[[File:zero2w-img317.png]]|| '''20'''</div></ol>| '''GND'''| <ol start="6" style="textlist-alignstyle-type: leftdecimal;"|><li>Then use the keyboard to enter the password corresponding to the WI-FI, and then use the mouse to click the Enter button on the virtual keyboard to start connecting to the WI-FI.</li> <div class="figure"> [[File:zero2w-img318.png]] </div></ol>| <ol start="7" style="textlist-alignstyle-type: leftdecimal;"|>|<li>The display after successful WI-FI connection is as shown below</li>| '''232'''| '''PH8'''| '''SPI1_MISO'''[[File:zero2w-img319.png]]| '''21'''</ol>|<span id="how-to-use-wi-fi-hotspot"></span>| '''22'''| '''UART2_RX'''| '''PI6'''| '''262'''|== How to use WI-FI hotspot ==| '''230'''| '''PH6'''# First, please make sure that the Ethernet port is connected to the network cable and can access the Internet normally.| # Then select '''SPI1_CLKSettings'''| '''23'''|::[[File:zero2w-img306.png]]| '''24'''| '''SPI1_CS0'''<ol start="3" style="list-style-type: decimal;">| <li>Then select '''PH5Network &amp; Internet'''</li>| '''229'''|[[File:zero2w-img314.png]]</ol>| style<ol start="text-align: left;4"|| style="textlist-alignstyle-type: leftdecimal;"|>| <li>Then select '''GNDWIFI hotspot'''</li>| '''25'''|[[File:zero2w-img320.png]]| '''26'''</ol>| '''SPI1_CS1'''<ol start="5" style="list-style-type: decimal;">| <li>Then open '''PH9Hotspot Enable'''. You can also see the name and password of the generated hotspot in the picture below. Remember them and use them when connecting to the hotspot (if you need to modify the name and password of the hotspot, you need to close Hotspot Enable first. Then you can modify it)</li>| '''233'''|[[File:zero2w-img321.png]]| '''266'''</ol>| '''PI10'''| '''TWI2<ol start="6" style="list-style-SDA'''type: decimal;">| <li>At this time, you can take out your mobile phone. If everything is normal, you can find the WIFI hotspot with the same name ('''27here AndroidAP_7132'''|| ) shown under the '''28Hotspot name'''| '''TWI2in the picture above in the WI-SCLFI list searched by the mobile phone. Then you can click AndroidAP_7132 to connect to the hotspot. The password can be seen under the '''| '''PI9Hotspot password'''in the picture above.</li>| '''265'''|[[File:zero2w-img322.png]]| '''256'''</ol>| '''PI0'''| <ol start="7" style="textlist-style-aligntype: leftdecimal;"|>| <li>After the connection is successful, it will be displayed as shown below (the interface will be different on different mobile phones, the specific interface is subject to the one displayed on your mobile phone). At this time, you can open a web page on your mobile phone to see if you can access the Internet. If the web page can be opened normally, it means that the '''29WI-FI Hotspot'''of the development board can be used normally.</li>|| '''30'''[[File:zero2w-img323.png]]| '''GND'''</ol>| style<span id="texthow-to-check-the-ip-address-of-the-ethernet-align: left;port"|></span> | style="text-align= How to check the IP address of the Ethernet port == # There is no wired network interface on the main board of the development board. We can expand the 100M Ethernet through a 24pin expansion board. ::[[File: left;"||zero2w-img107.png]]| '''271'''| '''PI15'''| <ol start="2" style="textlist-style-aligntype: leftdecimal;"|><li><p>Then make sure the network port of the expansion board is connected to the router or switch</p></li>| <li><p>Then open '''31Settings'''</p>|<p>[[File:zero2w-img324.png]]</p></li>| <li><p>Then select '''32Network &amp; Internet'''</p>| '''PWM1''<p>[[File:zero2w-img325.png]]</p></li><li><p>Then you can see the IP address of the development board's wired network port at the location shown in the picture below.</p>| '''PI11'''<p>[[File:zero2w-img326.png]]</p></li></ol>| '''267'''|<span id="bluetooth-connection-method"></span>| '''268'''| '''PI12'''== Bluetooth connection method ==| '''PWM2'''| # Choose first '''33Settings'''|| '''34'''::[[File:zero2w-img306.png]]| '''GND'''| style<ol start="text-align: left;2"|| style="textlist-style-aligntype: leftdecimal;"||->| <li>Then select '''258Bluetooth'''</li>| '''PI2'''| [[File:zero2w-img327.png]]</ol><ol start="3" style="textlist-style-aligntype: leftdecimal;"|>| <li>Then Open '''35Bluetooth Enable'''</li> |[[File:zero2w-img328.png]]| '''36'''</ol>| <ol start="4" style="textlist-alignstyle-type: leftdecimal;"|>| <li>Then click '''PC12Pair new device'''to start scanning for surrounding Bluetooth devices</li>| '''76'''|[[File:zero2w-img329.png]]| '''272'''</ol>| '''PI16'''| style<ol start="text-align: left;5"|| '''37'''|| '''38'''| style="textlist-alignstyle-type: leftdecimal;"|>| <li>The searched Bluetooth devices will be displayed under '''PI4Available devices'''</li>| '''260'''|[[File:zero2w-img330.png]]| style</ol><ol start="text-align: left;6"|| style="textlist-style-aligntype: leftdecimal;"|>| <li>Then click on the Bluetooth device you want to connect to start pairing. When the following interface pops up, please use the mouse to select the '''GNDPair'''option</li>| '''39'''|[[File:zero2w-img331.png]]| '''40'''</ol>| <ol start="7" style="textlist-alignstyle-type: leftdecimal;"|>| '''PI3'''| '''259'''|}<li>What is tested here is the Bluetooth configuration process between the development board and the Android phone. At this time, the following confirmation interface will pop up on the phone. Click the pairing button on the phone to start the pairing process.</li>
[[File:zero2w-img332.png]]</ol><ol start="28" style="list-style-type: decimal;"><li>First click After pairing is completed, open '''Paired devices''' and you will see the wiringOP icon to open wiringOP APPpaired Bluetooth devices.</li></ol>
[[File:zero2w-img351img333.png]]</ol><ol start="9" style="list-style-type: decimal;"><li>At this time, you can use the Bluetooth of your mobile phone to send a picture to the development board. After sending, you can see the following confirmation interface in the Android system of the development board, and then click '''Accept''' to start receiving the pictures sent by the mobile phone.</li>
[[File:zero2w-img334.png]]</ol><ol start="310" style="list-style-type: decimal;"><li>Then click Pictures received by the Bluetooth system of the development board Android system can be viewed in '''PWM_TESTReceived files''' button on the main interface of wiringOP to enter the PWM test interface.</li></ol>
[[File:zero2w-img380img335.png]]</ol><span id="how-to-set-usb0-to-host-mode-1"></span>
<ol start="4" style="list-style-type: decimal;"><li>The PWM test interface is as follows</li></ol>How to set USB0 to HOST mode ==
<div class="As shown in the figure">below, there are two Type-C interfaces on the motherboard of the development board: USB0 and USB1. Both of these interfaces can be used to power the development board, and they can also be used as USB2.0 HOST interfaces. The difference between USB0 and USB1 is that in addition to being set to HOST mode, USB0 can also be set to Device mode, while USB1 only has HOST mode.
[[File:zero2w-img381img160.png]]
</div><ol start="5" style="list-style-type: decimal;"><li>Then USB0 of the Android12 TV system released by Orange Pi is set which PWM you want to use in the Channel. The Device mode by default , so when there is PWM1. If you want no need to use USB0 Device mode (ADB function needs to set ensure that USB0 is in Device mode), it is recommended to PWM2use USB0 for power supply, just enter 2 in the Channel. PWM3 and PWM4 and so onthat USB1 can be directly used to connect USB devices .</li></ol>
[[FileIf you want to use USB0 to connect USB devices, you need to set USB0 to HOST mode. The method is as follows:zero2w-img382.png]]
<ol start="6" style="list-style-type: decimallower-alpha;"><li>Then you can Run the following command to set the PWM period. The default configuration is USB0 to HOST mode:</li>{| class="wikitable" style="width:800px;" |-| apollo-p2:/ # '''50000ns'''. The converted PWM frequency is ''cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_host'20KHz'''</li></ol>
[[File:zero2w-img383.png]]host_chose finished!
apollo-p2:/ #|}</ol><ol start="72" style="list-style-type: decimallower-alpha;"><li>Then click Run the following command to switch back to Device mode</li>{| class="wikitable" style="width:800px;" |-| apollo-p2:/ # '''EXPORTcat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_device'''button to export PWM</li></ol>
[[File:zero2w-img384.png]]device_chose finished!
apollo-p2:/ #|}</ol><ol start="83" style="list-style-type: decimallower-alpha;"><li>Then drag the progress bar below The command to change view the PWM duty cycle, and then check current mode of USB0 is</li>{| class="wikitable" style="width:800px;" |-| apollo-p2:/ # '''Enablecat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/otg_role''' to output the PWM waveform.</li></ol>
[[File:zero2wusb_host|}</ol><span id="how-img385.png]]to-use-usb-camera"></span>
<ol start="9" style="list-style-type: decimal;"><li>Then How to use an oscilloscope to measure the corresponding pins in the 40pin development board and you can see the following waveform.</li></ol>USB camera ==
[[File:zero2w-img386.png]]# First insert the USB (UVC protocol) camera into the USB interface of the development board# If the USB camera is recognized normally, the corresponding video device node will be generated under /dev
<span id::{| class="howwikitable" style="width:800px;" |-to-compile-android-12-source-code"><| console:/ # '''ls /dev/span>video0'''
= '''How to compile Android 12 source code''' =/dev/video0|}
<span idol start="download-the3" style="list-sourcestyle-code-of-android-12type: decimal;"><li><p>Then make sure that the adb connection between the Ubuntu PC and the development board is normal. For how to use adb, please refer to the instructions in the section &quot;[[Orange Pi Zero 2W#How to use ADB|'''How to use ADB''']]&quot;.</spanp></li>== <li><p>Download the source code of Android 12 ==USB camera test APP from the '''official tool''' on the development board information download page</p></li>
<ol stylediv class="list-style-type: decimal;figure"><li><p>First download the compressed package of the Android 12 source code and the compressed package of the files modified by Orange Pi Zero2w from Google Cloud Drive</p><ol style="list-style-type: lower-alpha;"><li>Google Cloud Drive</li></ol></li></ol>
[[File:zero2w-img387img336.png]]
<ol start="2" style/div><div class="list-style-type: decimal;figure"><li>After downloading the compressed package of Android 12 source code, please check whether the MD5 checksum is correct. If it is incorrect, please download the source code again. Here's how to check the MD5 checksum:</li></ol>
test@test[[File:~$ '''md5sum zero2w-c H618-Android12-Src.tar.gzimg337.md5sum'''png]]
H618</div></ol><ol start="5" style="list-Android12style-Srctype: decimal;"><li>Then use the adb command to install the USB camera test APP into the Android system.tarOf course, you can also use a USB disk copy to install it.gzaa</li>{| class="wikitable" style="width:800px;" |-| test@test: ~$ '''OKadb install usbcamera.apk'''|}</ol><ol start="6" style="list-style-type: decimal;"><li>After installation, you can see the startup icon of the USB camera on the Android desktop.</li>
H618[[File:zero2w-Android12img338.png]]</ol><ol start="7" style="list-style-type: decimal;"><li>Then double-Srcclick to open the USB camera APP and you can see the output video of the USB camera.tar.gzab: '''OK'''</li></ol> <span id="android-system-root-description"></span>
......== Android system ROOT description ==
<ol start{| class="3wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;">|-| <libig>Then you need to merge multiple compressed files into one, '''The Android system released by Orange Pi has been ROOT and then extract can be tested using the Android source codefollowing method. The command looks like this:'''</li></olbig>|}
test@test:~$ # Download from the '''cat H618-Android12-Src.tar.gza* &gt; H618-Android12-Src.tarofficial tool''' on the development board data download page '''rootcheck.gzapk'''
test@test:~$ '''tar -xvf H618-Android12-Src.tar.gz'''<div class="figure">
<ol start="4" style="list::[[File:zero2w-style-type: decimal;"><li>Then unzip the compressed package of the files modified by Orange Pi Zero2w</li></ol>img336.png]]
test@test:~$ '''tar zxf opizero2w_android12_patches.tar.gz'''</div><div class="figure">
test@test:~$ '''ls''':[[File:zero2w-img339.png]]
</div><ol start="2" style="list-style-type: decimal;"><li><p>Then make sure that the adb connection between the Ubuntu PC and the development board is normal. For how to use adb, please refer to the instructions in the section &quot;[[Orange Pi Zero 2W#How to use ADB|'''opizero2w_android12_patchesHow to use ADB''' opizero2w_android12_patches]]&quot;.</p></li><li><p>Then use the adb command to install rootcheck.apk into the Android system. Of course, you can also use a USB disk copy to install it.tar</p></li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''adb install rootcheck.apk'''|}</ol><ol start="4" style="list-style-type: decimal;"><li>After installation, you can see the startup icon of the ROOT test tool on the Android desktop.gz</li>
[[File:zero2w-img340.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>Then copy The display interface after opening the files modified by Orange Pi Zero2w to '''ROOT test tool''' for the Android source codefirst time is as shown below</li></ol>
test@test[[File:~$ '''cp zero2w-rf opizero2w_android12_patchesimg341.png]]</* H618ol><ol start="6" style="list-Android12style-Src/type: decimal;"><li>Then you can click '''CHECK NOW'''to start checking the ROOT status of the Android system. After the check is completed, the display is as follows. You can see that the Android system has obtained ROOT permissions.</li>
[[File:zero2w-img342.png]]</ol><span id="compilehow-to-use-miracastreceiver-to-cast-the-sourcemobile-codephone-ofscreen-androidto-12the-development-board"></span>== Compile the source code of Android 12 ==
'''Android12 is compiled on an x86_64 computer with Ubuntu 22.04 installed. Other versions of Ubuntu system package dependencies may have some differences. The image download address of == How to use MiracastReceiver to cast the Ubuntu 22.04 amd64 version is as follows:'''mobile phone screen to the development board ==
[https://repo.huaweicloud.com/ubuntu<ol style="list-releases/22.04/ubuntustyle-22type: decimal;"><li><p>First, please make sure that both the development board and the mobile phone are connected to the same WIFI hotspot.04.2For the method of connecting the development board to WIFI, please refer to [[Orange Pi Zero 2W#WI-desktopFI connection method|'''the instructions in the WI-amd64FI connection method.iso '''https:]]</p></repo.huaweicloud.com/ubuntu-releases/22.04/ubuntu-22.04.2-desktop-amd64.isoli><li><p>Then open the '''] MiracastReceiver'''The x86_64 computer hardware configuration for compiling Android12 source code recommends a memory application in the Android system of 16GB or more, and a hard disk space of 200GB or more is recommendedthe development board</p><p>[[File:zero2w-img343. png]]</p></li><li><p>The more CPU cores, the better.interface after '''MiracastReceiver'''is opened is as follows</p><div class="figure">
# First install the software packages needed to compile Android12 source code[[File:zero2w-img344.png]]
test@test</div></li><li><p>Then find the screen mirroring function in the phone settings. Here we take '''Xiaomi 12S Pro mobile phone''' as an example. Please research other brands of mobile phones by yourself. As shown in the picture below, click the button in the red box to open the screen mirroring function of the phone.</p><p>[[File:~$ zero2w-img345.png]]</p></li><li><p>After waiting for a period of time, you will be able to see the searched connectable devices on your mobile phone, and then we can select the device corresponding to the development board to connect.</p><p>[[File:zero2w-img346.png]]</p></li><li><p>Then the selection box shown in the figure below will pop up in the '''MiracastReceiver''' application interface of the development board. Here we can select '''sudo apt-get updateAccept'''</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>
test@test:~$ '''sudo apt<span id="method-get install of-y git gnupg flex bison gperf buildturning-essential \'''on-and-off-the-machine-through-buttons-or-infrared-remote-control"></span>
'''zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \'''== Method of turning on and off the machine through buttons or infrared remote control ==
'''lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev ccache \'''We can turn off or turn on the Android system of the development board through the power on/off button or infrared remote control. However, it should be noted that there is no power on/off button and infrared receiver on the main board of the development board, and it needs to be expanded through a 24pin expansion board.
'''libgl1[[File:zero2w-mesa-dev libxml2-utils xsltproc unzip u-boot-tools python-is-python3 \'''img107.png]]
'''libssl-dev libncurses5 clang gawk'''The location of the power button on the 24pin expansion board is as shown in the figure below:
<ol start="2" style="list-style-type[[File: decimal;"><li><p>Then compile the code in the longan folder, which mainly contains u-boot and linux kernel</p><ol style="listzero2w-style-type: lower-alpha;"><li>First run '''./buildimg269.sh config''' to set compilation options</li></ol></li></ol>png]]
test@testThe location of the infrared remote control power button is as follows:~$ '''cd H618-Android12-Src/longan'''
test@test[[File:~/H618zero2w-Android12-Src/longan$ '''./buildimg349.sh config'''png]]
Welcome When shutting down, we need to mkscript setup progresspress and hold the power button or the power button on the infrared remote control, and then the Android system will pop up the confirmation dialog box shown in the figure below, and then select '''OK''' to shut down the Android system.
All available platform[[File:zero2w-img350.png]]
0After shutting down, press and hold the power button or the power button on the infrared remote control again to turn it on. android
1. linux<span id="pin-interface-gpio-uart-spi-test"></span>== 40pin interface GPIO, UART, SPI test ==
Choice [android]{| class="wikitable" style="background-color: #ffffdc;width:800px;" |-| <big>'''0Note: 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>|}
All available ic:<span id="pin-gpio-port-test-method"></span>=== 40pin GPIO port test method ===
0. h618# First open wiringOP APP on the desktop
Choice ::[[h618File:zero2w-img351.png]]: '''0'''
All available board<ol start="2" style="list-style-type:decimal;"><li>Then click the '''GPIO_TEST''' button to open the GPIO test interface</li>
0[[File:zero2w-img352. ftpng]]</ol><ol start="3" style="list-style-type: decimal;"><li>The GPIO test interface is as shown in the figure below. The two rows of '''CheckBox''' buttons on the left have a one-to-one correspondence with the 40pin pins. When the '''CheckBox''' button is checked, the corresponding GPIO pin will be set to '''OUT''' mode and the pin level is set to high level; when unchecked, the GPIO pin level will be set to low level; when the GPIO is clicked When you click the '''GPIO READALL''' button, you can get information such as wPi number, GPIO mode, pin level, etc.; when you click the'''BLINK ALL GPIO''' button, all GPIO ports will cycle through outputting high and low levels. This function can be used to test all the 40pin pins. GPIO port.</li>
1[[File:zero2w-img353. p1png]]</ol><ol start="4" style="list-style-type: decimal;"><li>Then click the '''GPIO READALL''' button, and the output information is as shown below:</li>
2. p2<div class="figure">
3[[File:zero2w-img354. p7png]]
4</div></ol><ol start="5" style="list-style-type: decimal;"><li>There are a total of 28 GPIO ports available in the 40-pin development board. p7lThe following takes pin 12 - corresponding to GPIO PI01 - corresponding to wPi serial number 6 - as an example to demonstrate how to set the high and low levels of the GPIO port. First click the '''CheckBox''' button corresponding to pin 12. When the button is selected, pin 12 will be set to high level. After setting, you can use a multimeter to measure the value of the voltage of the pin. If it is '''3.3v''', it means the setting High level success.</li>
5[[File:zero2w-img355. perf1png]]</ol><ol start="6" style="list-style-type: decimal;"><li>Then click the '''GPIO READALL''' button and you can see that the current pin 12 mode is '''OUT''' and the pin level is high level.</li>
6[[File:zero2w-img356. perf2png]]</ol><ol start="7" style="list-style-type: decimal;"><li>Click the '''CheckBox''' button in the picture below again to uncheck it, and pin 12 will be set to low level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is '''0v''', it means the low level setting is successful.</li>
7[[File:zero2w-img357. perf3png]]</ol><ol start="8" style="list-style-type: decimal;"><li>Then click the '''GPIO READALL''' button and you can see that the current pin 12 mode is OUT and the pin level is low level.</li>
8[[File:zero2w-img358. qapng]]</ol><span id="pin-uart-test-method"></span>
Choice [p2]: '''2'''=== 40pin UART test method ===
All # As can be seen from the table below, the default uarts available flash:in the Android12 TV system are uart2 and uart5. Please note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial port.
0. default<div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-1| '''GPIO NO. nor'''| '''GPIO'''| '''Function'''Choice [default]: | '''0Pin'''|-All available kern_ver| style="text-align:left;"|| style="text-align: left;"|0| '''3. linux-5.43V'''| '''1'''Choice [linux|-5.4]: | '''0264'''| '''PI8'''All available arch:| '''TWI1-SDA'''| '''3'''0. arm|-| '''263'''1. arm64| '''PI7'''| '''TWI1-SCL'''Choice [arm64]: | '''15'''|-| '''......269'''| '''PI13'''*** Default configuration is based on | '''PWM3''sun50iw9p1smp_h618_android_defconfig'| '''7'''#|-| style="text-align: left;"|# configuration written to .config| style="text-align: left;"|| '''GND'''#| '''9'''|-make[1]| '''<span style="color: Leaving directory #FF0000">226</span>'''| '''<span style="color:#FF0000">PH2</homespan>'''| '''<span style="color:#FF0000">UART5_TX</testspan>'''| '''<span style="color:#FF0000">11</H618span>'''|-Android12-Src| '''<span style="color:#FF0000">227</longanspan>'''| '''<span style="color:#FF0000">PH3</outspan>'''| '''<span style="color:#FF0000">UART5_RX</kernelspan>'''| '''<span style="color:#FF0000">13</buildspan>'''|-make| '''<span style="color: Leaving directory #FF0000">261</span>'''| '''<span style="color:#FF0000">PI5</homespan>'''| '''<span style="color:#FF0000">UART2_TX</testspan>'''| '''<span style="color:#FF0000">15</H618span>'''|-Android12| style="text-Src/longan/kernel/linuxalign: left;"|| style="text-5align: left;"|| '''3.43V'''| '''17'''|-| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|-INFO: clean buildserver| '''230'''| '''PH6'''| '''SPI1_CLK'''INFO: prepare_buildserver| '''23'''|-<ol start| style="2text-align: left;" || style="listtext-align: left;"|| '''GND'''| '''25'''|-| '''266'''| '''PI10'''| '''TWI2-SDA'''| '''27'''|-| '''256'''| '''PI0'''| style="text-typealign: lowerleft;"|| '''29'''|-| '''271'''| '''PI15'''| style="text-alphaalign: left;">|| '''31'''|-| '''268'''| '''PI12'''| '''PWM2'''| '''33'''|-<li>Then run the | '''./build.sh258''' script to start compilation.</li></ol>| '''PI2'''test@test| style="text-align:~/H618left;"|| '''35'''|-Android12| '''272'''| '''PI16'''| style="text-Src/longan$ align: left;"|| '''./build.sh37'''|-<ol start| style="3text-align: left;" || style="listtext-align: left;"|| '''GND'''| '''39'''|}{| class="wikitable" style="width:390px;margin-typeright: lower20px;text-alphaalign: center;"><li>After compilation is completed, you will see the following output</li></ol>|-| '''Pin'''sun50iw9p1 compile Kernel successful| '''Function'''| '''GPIO'''INFO: Prepare toolchain ..| '''GPIO NO.'''|-| '''......2'''| '''5V'''INFO| style="text-align: build kernel OK.left;"| INFO| style="text-align: build rootfs ...left;"||-INFO: skip make rootfs for android| '''4'''| '''5V'''INFO| 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;"||-| '''<span style="color:#FF0000">22</span>'''| '''<span style="color:#FF0000">UART2_RX</span>'''| '''<span style="color:#FF0000">PI6</span>'''| '''<span style="color:#FF0000">262</span>'''|-| '''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'''|-| '''38'''| style="text-align: left;"|| '''PI4'''| '''260'''|-| '''40'''| style="text------align: left;"|| '''PI3'''| '''259'''|}</div>
INFO<ol start="2" style="list-style-type: build lichee OKdecimal;"><li>The device node corresponding to uart2 is '''/dev/ttyAS2''', and the device node corresponding to uart5 is'''/dev/ttyAS5'''</li>{| class="wikitable" style="width:800px;" |-| <p>apollo-p2:/ # ls /dev/ttyAS*</p><p>/dev/ttyAS0 &nbsp;&nbsp;&nbsp;&nbsp; /dev/ttyAS1 &nbsp;&nbsp;&nbsp;&nbsp; '''<span style="color:#FF0000">/dev/ttyAS2 &nbsp;&nbsp;&nbsp;&nbsp; /dev/ttyAS5</span>'''</p>|}</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 '''UART_TEST'''button to open the UART test interface</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 ===
INFO: ----------------------------------------# 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
<ol startdiv style="display: flex;">::{| class="3wikitable" style="listwidth:390px;margin-styleright: 20px;text-typealign: decimalcenter;"><li>Then use the following command to compile the Android source code and generate the final Android image</li></ol>|-| '''GPIO NO.'''| '''GPIO'''| '''Function'''test@test:~$ | '''cd H618-Android12-SrcPin'''|-test@test| style="text-align:~/H618left;"|| style="text-Android12-Src$ align: left;"|| '''source build/envsetup3.sh3V''' test@test:~/H618-Android12-Src$ | '''1'lunch apollo_p2''|-userdebug| '''264''' test@test:~/H618-Android12-Src$ | '''make -j8PI8''' test@test:~/H618-Android12-Src$ | '''packTWI1-SDA'''| '''3'''<ol start="4" style="list|-style-type: decimal;"><li><p>The storage path of the Android image generated by compilation is:</p>| '''263'''| '''PI7'''<p>| '''longan/out/h618_android12_p2_uart0.imgTWI1-SCL'''</p></li></ol> <span id| '''5'''|-| '''269'''| '''PI13'''| '''PWM3'''| '''7'''|-| style="appendixtext-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></span> <ol start="2" style="list-style-type: decimal;"><li>The device node corresponding to SPI1 CS0 is '''/dev/spidev1.0''', and the device node corresponding to SPI1 CS1 is '''/dev/spidev1.1'''</li>{| class="wikitable" style="width:800px;" |-| apollo-p2:/ # '''ls /dev/spidev1.*''' '''<span style="color:#FF0000">/dev/spidev1.0 &nbsp;&nbsp;&nbsp;&nbsp; /dev/spidev1.1</span>'''|}</ol><ol start="3" style="list-style-type: decimal;"><li>Here is a demonstration to test the SPI1 interface through the '''w25qxx''' module. First, connect the w25qxx module to the SPI1 interface.</li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''It doesn't matter if there is no w25qxx module, because there is a SPIFlash on the development board connected to SPI0, and the configuration of SPI0 is also turned on by default in Android, so we can also directly use the onboard SPIFlash for testing.'''</big>|}</ol><ol start="4" style="list-style-type: decimal;"><li>Then open wiringOP APP on the desktop</li> [[File:zero2w-img351.png]]</ol><ol start="5" style="list-style-type: decimal;"><li>Then click the '''SPI_TEST''' button to open the SPI test interface</li> [[File:zero2w-img365.png]]</ol><ol start="6" style="list-style-type: decimal;"><li><p>Then select the spi device node in the upper left corner. If you test the onboard SPIFlash directly, just keep the default '''/dev/spidev0.0'''. If the '''w25qxx''' module is connected to the 40pin spi1 cs0, then please select'''/dev/spidev1.0''', if the w25qxx module is connected to the 40pin spi1 cs1, then please select '''/dev/spidev1.1'''</p><div class="figure"> [[File:zero2w-img366.png]] </div></li><li><p>Then click the '''OPEN''' button to initialize the SPI</p></li> [[File:zero2w-img367.png]]</ol><ol start="8" style="list-style-type: decimal;"><li>Then fill in the bytes that need to be sent, such as reading the ID information of the onboard SPIFlash, filling in the address 0x9f in data[0], and then click the '''TRANSFER''' button</li> [[File:zero2w-img368.png]]</ol><ol start="9" style="list-style-type: decimal;"><li>Finally, the APP will display the read ID information of the onboard SPI Flash.</li> [[File:zero2w-img369.png]]</ol><ol start="10" style="list-style-type: decimal;"><li>If the w25qxx module connected to 40pin SPI1 is read, the ID information of the onboard SPI Flash is also similar.</li></ol> <span id="pin-i2c-test-method"></span> === 40pin I2C test method === # As can be seen from the table below, the Android12 TV system has i2c1 and i2c2 turned on by default. <div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''GPIO NO.'''| '''GPIO'''| '''Function'''| '''Pin'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''1'''|-| '''<span style="color:#FF0000">264</span>'''| '''<span style="color:#FF0000">PI8</span>'''| '''<span style="color:#FF0000">TWI1-SDA</span>'''| '''<span style="color:#FF0000">3</span>'''|-| '''<span style="color:#FF0000">263</span>'''| '''<span style="color:#FF0000">PI7</span>'''| '''<span style="color:#FF0000">TWI1-SCL</span>'''| '''<span style="color:#FF0000">5</span>'''|-| '''269'''| '''PI13'''| '''PWM3'''| '''7'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''9'''|-| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-| '''261'''| '''PI5'''| '''UART2_TX'''| '''15'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''17'''|-| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|-| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''25'''|-| '''<span style="color:#FF0000">266</span>'''| '''<span style="color:#FF0000">PI10</span>'''| '''<span style="color:#FF0000">TWI2-SDA</span>'''| '''<span style="color:#FF0000">27</span>'''|-| '''256'''| '''PI0'''| style="text-align: left;"|| '''29'''|-| '''271'''| '''PI15'''| style="text-align: left;"|| '''31'''|-| '''268'''| '''PI12'''| '''PWM2'''| '''33'''|-| '''258'''| '''PI2'''| style="text-align: left;"|| '''35'''|-| '''272'''| '''PI16'''| style="text-align: left;"|| '''37'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''39'''|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''6'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''8'''| '''UART0_TX'''| '''PH0'''| '''224'''|-| '''10'''| '''UART0_RX'''| '''PH1'''| '''225'''|-| '''12'''| style="text-align: left;"|| '''PI1'''| '''257'''|-| '''14'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''16'''| '''PWM4'''| '''PI14'''| '''270'''|-| '''18'''| style="text-align: left;"|| '''PH4'''| '''228'''|-| '''20'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''22'''| '''UART2_RX'''| '''PI6'''| '''262'''|-| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''<span style="color:#FF0000">28</span>'''| '''<span style="color:#FF0000">TWI2-SCL</span>'''| '''<span style="color:#FF0000">PI9</span>'''| '''<span style="color:#FF0000">265</span>'''|-| '''30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''32'''| '''PWM1'''| '''PI11'''| '''267'''|-| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''36'''| style="text-align: left;"|| '''PC12'''| '''76'''|-| '''38'''| style="text-align: left;"|| '''PI4'''| '''260'''|-| '''40'''| style="text-align: left;"|| '''PI3'''| '''259'''|}</div> <ol start="2" style="list-style-type: decimal;"><li>The device node corresponding to i2c1 is '''/dev/i2c-1''', and the device node corresponding to i2c2 is '''/dev/i2c-2'''</li>{| class="wikitable" style="width:800px;" |-| apollo-p2:/ # '''ls /dev/i2c-*''' '''<span style="color:#FF0000">/dev/i2c-1 &nbsp;&nbsp;&nbsp;&nbsp; /dev/i2c-2</span>''' &nbsp;&nbsp;&nbsp;&nbsp; /dev/i2c-5|}</ol><ol start="3" style="list-style-type: decimal;"><li>First open wiringOP APP on the desktop</li> [[File:zero2w-img351.png]]</ol><ol start="4" style="list-style-type: decimal;"><li>Then click the '''I2C_TEST''' button to open the i2c test interface</li> [[File:zero2w-img370.png]]</ol><ol start="5" style="list-style-type: decimal;"><li>The i2c test interface of wiringOP is shown in the figure below</li> [[File:zero2w-img371.png]]</ol><ol start="6" style="list-style-type: decimal;"><li>Then click the device node selection box in the upper left corner to select the i2c you want to test</li> [[File:zero2w-img372.png]]</ol><ol start="7" style="list-style-type: decimal;"><li>Then connect an i2c device to the 40pin i2c pin. Here we take the ds1307 rtc module as an example.</li> [[File:zero2w-img178.png]]</ol><ol start="8" style="list-style-type: decimal;"><li><p>The i2c address of the ds1307 rtc module is 0x68. After connecting the lines, we can use the '''i2cdetect -y 1''' or '''i2cdetect -y 2''' command on the serial port command line to check whether the i2c address of the ds1307 rtc module can be scanned. If you can see the address 0x68, it means that the ds1307 rtc module is wired correctly.</p>{| class="wikitable" style="width:800px;" |-| <p>apollo-p2:/ # '''i2cdetect -y 1'''</p><p>'''Or'''</p><p>apollo-p2:/ # '''i2cdetect -y 2'''</p>|}<p>[[File:zero2w-img373.png]]</p></li><li><p>Then set the i2c address to 0x68 in wiringOP, and then click the '''OPEN''' button to open i2c</p><p>[[File:zero2w-img374.png]]</p></li><li><p>After clicking the '''OPEN''' button to open i2c, the display is as follows</p><p>[[File:zero2w-img375.png]]</p></li><li><p>Then we test writing a value to the register of the rtc module, for example, writing 0x55 to the 0x1c address</p><ol style="list-style-type: lower-alpha;"><li><p>We first set the address of the register to be written to 0x1c</p><p>[[File:zero2w-img376.png]]</p></li><li><p>Then set the value to be written to 0x55</p><p>[[File:zero2w-img377.png]]</p></li><li><p>Then click the '''WRITE BYTE''' button to perform the writing action</p><p>[[File:zero2w-img378.png]]</p></li></ol></li><li><p>Then click the '''READ BYTE''' button to read the value of the 0x1c register. If it displays 0x55, it means that the i2c read and write test has passed.</p><p>[[File:zero2w-img379.png]]</p></li></ol> <span id="pin-pwm-test"></span> === 40pin PWM test === # As can be seen from the table below, the available pwm are pwm1, pwm2, pwm3 and pwm4. <div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''GPIO NO.'''| '''GPIO'''| '''Function'''| '''Pin'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''1'''|-| '''264'''| '''PI8'''| '''TWI1-SDA'''| '''3'''|-| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|-| '''<span style="color:#FF0000">269</span>'''| '''<span style="color:#FF0000">PI13</span>'''| '''<span style="color:#FF0000">PWM3</span>'''| '''<span style="color:#FF0000">7</span>'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''9'''|-| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-| '''261'''| '''PI5'''| '''UART2_TX'''| '''15'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''17'''|-| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|-| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''25'''|-| '''266'''| '''PI10'''| '''TWI2-SDA'''| '''27'''|-| '''256'''| '''PI0'''| style="text-align: left;"|| '''29'''|-| '''271'''| '''PI15'''| style="text-align: left;"|| '''31'''|-| '''<span style="color:#FF0000">268</span>'''| '''<span style="color:#FF0000">PI12</span>'''| '''<span style="color:#FF0000">PWM2</span>'''| '''<span style="color:#FF0000">33</span>'''|-| '''258'''| '''PI2'''| style="text-align: left;"|| '''35'''|-| '''272'''| '''PI16'''| style="text-align: left;"|| '''37'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''39'''|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''6'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''8'''| '''UART0_TX'''| '''PH0'''| '''224'''|-| '''10'''| '''UART0_RX'''| '''PH1'''| '''225'''|-| '''12'''| style="text-align: left;"|| '''PI1'''| '''257'''|-| '''14'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''<span style="color:#FF0000">16</span>'''| '''<span style="color:#FF0000">PWM4</span>'''| '''<span style="color:#FF0000">PI14</span>'''| '''<span style="color:#FF0000">270</span>'''|-| '''18'''| style="text-align: left;"|| '''PH4'''| '''228'''|-| '''20'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''22'''| '''UART2_RX'''| '''PI6'''| '''262'''|-| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''28'''| '''TWI2-SCL'''| '''PI9'''| '''265'''|-| '''30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''<span style="color:#FF0000">32</span>'''| '''<span style="color:#FF0000">PWM1</span>'''| '''<span style="color:#FF0000">PI11</span>'''| '''<span style="color:#FF0000">267</span>'''|-| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''36'''| style="text-align: left;"|| '''PC12'''| '''76'''|-| '''38'''| style="text-align: left;"|| '''PI4'''| '''260'''|-| '''40'''| style="text-align: left;"|| '''PI3'''| '''259'''|}</div> <ol start="2" style="list-style-type: decimal;"><li>First click the wiringOP icon to open wiringOP APP</li> [[File:zero2w-img351.png]]</ol><ol start="3" style="list-style-type: decimal;"><li>Then click the '''PWM_TEST''' button on the main interface of wiringOP to enter the PWM test interface</li> [[File:zero2w-img380.png]]</ol><ol start="4" style="list-style-type: decimal;"><li>The PWM test interface is as follows</li> <div class="figure"> [[File:zero2w-img381.png]] </div></ol><ol start="5" style="list-style-type: decimal;"><li>Then set which PWM you want to use in the Channel. The default is PWM1. If you want to set it to PWM2, just enter 2 in the Channel. PWM3 and PWM4 and so on.</li> [[File:zero2w-img382.png]]</ol><ol start="6" style="list-style-type: decimal;"><li>Then you can set the PWM period. The default configuration is '''50000ns'''. The converted PWM frequency is '''20KHz'''</li> [[File:zero2w-img383.png]]</ol><ol start="7" style="list-style-type: decimal;"><li>Then click the '''EXPORT'''button to export PWM</li> [[File:zero2w-img384.png]]</ol><ol start="8" style="list-style-type: decimal;"><li>Then drag the progress bar below to change the PWM duty cycle, and then check '''Enable''' to output the PWM waveform.</li> [[File:zero2w-img385.png]]</ol><ol start="9" style="list-style-type: decimal;"><li>Then use an oscilloscope to measure the corresponding pins in the 40pin development board and you can see the following waveform.</li> [[File:zero2w-img386.png]]</ol><span id="how-to-compile-android-12-source-code"></span> = '''How to compile Android 12 source code''' = <span id="download-the-source-code-of-android-12"></span>== Download the source code of Android 12 == <ol style="list-style-type: decimal;"><li><p>First download the compressed package of the Android 12 source code and the compressed package of the files modified by Orange Pi Zero2w from Google Cloud Drive</p><ol style="list-style-type: lower-alpha;"><li>Google Cloud Drive</li> [[File:zero2w-img387.png]]</ol></li></ol><ol start="2" style="list-style-type: decimal;"><li>After downloading the compressed package of Android 12 source code, please check whether the MD5 checksum is correct. If it is incorrect, please download the source code again. Here's how to check the MD5 checksum:</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''md5sum -c H618-Android12-Src.tar.gz.md5sum''' H618-Android12-Src.tar.gzaa: '''<span style="color:#FF0000">OK</span>''' H618-Android12-Src.tar.gzab: '''<span style="color:#FF0000">OK</span>''' ......|}</ol><ol start="3" style="list-style-type: decimal;"><li>Then you need to merge multiple compressed files into one, and then extract the Android source code. The command looks like this:</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''cat H618-Android12-Src.tar.gz<span style="color:#FF0000">a</span>* &gt; H618-Android12-Src.tar.gz''' test@test:~$ '''tar -xvf H618-Android12-Src.tar.gz'''|}</ol><ol start="4" style="list-style-type: decimal;"><li>Then unzip the compressed package of the files modified by Orange Pi Zero2w</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''tar zxf opizero2w_android12_patches.tar.gz''' test@test:~$ '''ls''' '''opizero2w_android12_patches''' opizero2w_android12_patches.tar.gz|}</ol><ol start="5" style="list-style-type: decimal;"><li>Then copy the files modified by Orange Pi Zero2w to the Android source code</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''cp -rf opizero2w_android12_patches/* H618-Android12-Src/'''|}</ol><span id="compile-the-source-code-of-android-12"></span> == Compile the source code of Android 12 == {| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Android12 is compiled on an x86_64 computer with <span style="color:#FF0000">Ubuntu 22.04</span> installed. Other versions of Ubuntu system package dependencies may have some differences. The image download address of the Ubuntu 22.04 <span style="color:#FF0000">amd64</span> version is as follows:''' [https://repo.huaweicloud.com/ubuntu-releases/22.04/ubuntu-22.04.2-desktop-amd64.iso '''https://repo.huaweicloud.com/ubuntu-releases/22.04/ubuntu-22.04.2-desktop-amd64.iso'''] '''The x86_64 computer hardware configuration for compiling Android12 source code recommends a memory of 16GB or more, and a hard disk space of 200GB or more is recommended. The more CPU cores, the better.'''</big>|} # First install the software packages needed to compile Android12 source code ::{| class="wikitable" style="width:800px;" |-| test@test:~$ '''sudo apt-get update''' test@test:~$ '''sudo apt-get install -y git gnupg flex bison gperf build-essential \''' '''zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \''' '''lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev ccache \''' '''libgl1-mesa-dev libxml2-utils xsltproc unzip u-boot-tools python-is-python3 \''' '''libssl-dev libncurses5 clang gawk'''|} <ol start="2" style="list-style-type: decimal;"><li><p>Then compile the code in the longan folder, which mainly contains u-boot and linux kernel</p><ol style="list-style-type: lower-alpha;"><li>First run '''./build.sh config''' to set compilation options</li>{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''cd H618-Android12-Src/longan'''</p><p>test@test:~/H618-Android12-Src/longan$ '''./build.sh config'''</p>  <p>Welcome to mkscript setup progress</p><p>All available platform:</p>:<p>0. android</p>:<p>1. linux</p><p>Choice [android]: '''<span style="color:#FF0000">0</span>'''</p><p>All available ic:</p>:<p>0. h618</p><p>Choice [h618]: '''<span style="color:#FF0000">0</span>'''</p><p>All available board:</p>:<p>0. ft</p>:<p>1. p1</p>:<p>2. p2</p>:<p>3. p7</p>:<p>4. p7l</p>:<p>5. perf1</p>:<p>6. perf2</p>:<p>7. perf3</p>:<p>8. qa</p><p>Choice [p2]: '''<span style="color:#FF0000">2</span>'''</p><p>All available flash:</p>:<p>0. default</p>:<p>1. nor</p><p>Choice [default]: '''<span style="color:#FF0000">0</span>'''</p><p>All available kern_ver:</p>:<p>0. linux-5.4</p><p>Choice [linux-5.4]: '''<span style="color:#FF0000">0</span>'''</p><p>All available arch:</p>:<p>0. arm</p>:<p>1. arm64</p><p>Choice [arm64]: '''<span style="color:#FF0000">1</span>'''</p><p>'''......'''</p><p>*** Default configuration is based on 'sun50iw9p1smp_h618_android_defconfig'</p><p>#</p><p># configuration written to .config</p><p>#</p><p>make[1]: Leaving directory '/home/test/H618-Android12-Src/longan/out/kernel/build'</p><p>make: Leaving directory '/home/test/H618-Android12-Src/longan/kernel/linux-5.4'</p><p>INFO: clean buildserver</p><p>INFO: prepare_buildserver</p>|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Then run the '''./build.sh''' script to start compilation.</li>{| class="wikitable" style="width:800px;" |-| test@test:~/H618-Android12-Src/longan$ '''./build.sh'''|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>After compilation is completed, you will see the following output</li>{| class="wikitable" style="width:800px;" |-| sun50iw9p1 compile Kernel successful INFO: Prepare toolchain ... '''......''' INFO: build kernel OK. INFO: build rootfs ... INFO: skip make rootfs for android INFO: ---------------------------------------- INFO: build lichee OK. INFO: ----------------------------------------|}</ol></li></ol><ol start="3" style="list-style-type: decimal;"><li>Then use the following command to compile the Android source code and generate the final Android image</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''cd H618-Android12-Src''' test@test:~/H618-Android12-Src$ '''source build/envsetup.sh''' test@test:~/H618-Android12-Src$ '''lunch apollo_p2-userdebug''' test@test:~/H618-Android12-Src$ '''make -j8''' test@test:~/H618-Android12-Src$ '''pack'''|}</ol><ol start="4" style="list-style-type: decimal;"><li><p>The storage path of the Android image generated by compilation is:</p>{| class="wikitable" style="width:800px;" |-| <p>'''longan/out/h618_android12_p2_uart0.img'''</p>|}</li></ol> <span id="appendix"></span> = '''Appendix''' = <span id="user-manual-update-history"></span>== User manual update history == {| class="wikitable" style="width:800px;text-align: center;"|-| '''Version'''| '''Date'''| '''Release Notes'''|-| v1.0| 2023-09-14| initial version|} <span id="image-update-history"></span>== Image update history == {| class="wikitable" style="width:800px;"|-| style="text-align: center;"| '''Date''' | style="text-align: center;"| '''Release Notes'''|-| style="text-align: center;"| 2023-09-14| orangepizero2w_1.0.0_debian_bullseye_server_linux5.4.125.7z orangepizero2w_1.0.0_ubuntu_focal_server_linux5.4.125.7z orangepizero2w_1.0.0_ubuntu_focal_desktop_xfce_linux5.4.125.7z orangepizero2w_1.0.0_debian_bullseye_desktop_xfce_linux5.4.125.7z  orangepizero2w_1.0.0_ubuntu_jammy_server_linux6.1.31.7z orangepizero2w_1.0.0_debian_bookworm_server_linux6.1.31.7z orangepizero2w_1.0.0_debian_bullseye_server_linux6.1.31.7z orangepizero2w_1.0.0_ubuntu_jammy_desktop_xfce_linux6.1.31.7z orangepizero2w_1.0.0_debian_bookworm_desktop_xfce_linux6.1.31.7z orangepizero2w_1.0.0_debian_bullseye_desktop_xfce_linux6.1.31.7z  OrangePi_Zero2w_Android12_v1.0.tar.gz
= '''Appendix''' =
 
<span id="user-manual-update-history"></span>
== User manual update history ==
 
{| class="wikitable"
|-
| '''Version'''
| '''Date'''
| '''Release Notes'''
|-
| v1.0
| 2023-09-14
| initial version
|}
 
<span id="image-update-history"></span>
== Image update history ==
 
{| class="wikitable"
|-
| '''Date'''
 
| '''Release Notes'''
|-
| 202 3-09-14
|
orangepizero2w_1.0.0_debian_bullseye_server_linux5.4.125.7z
 
orangepizero2w_1.0.0_ubuntu_focal_server_linux5.4.125.7z
 
orangepizero2w_1.0.0_ubuntu_focal_desktop_xfce_linux5.4.125.7z
 
orangepizero2w_1.0.0_debian_bullseye_desktop_xfce_linux5.4.125.7z
 
orangepizero2w_1.0.0_ubuntu_jammy_server_linux6.1.31.7z
 
orangepizero2w_1.0.0_debian_bookworm_server_linux6.1.31.7z
 
orangepizero2w_1.0.0_debian_bullseye_server_linux6.1.31.7z
 
orangepizero2w_1.0.0_ubuntu_jammy_desktop_xfce_linux6.1.31.7z
 
orangepizero2w_1.0.0_debian_bookworm_desktop_xfce_linux6.1.31.7z
 
orangepizero2w_1.0.0_debian_bullseye_desktop_xfce_linux6.1.31.7z
 
OrangePi_Zero2w_Android12_v1.0.tar.gz
Opios-arch-aarch64-xfce-opizero2w-23.09-linux6.1.31.img.xz