Changes

Jump to: navigation, search

Orange Pi Zero 2W

6,975 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;"
<div class="figure">
[[File:zero2w-img272.png|center|800px]]
</div>
# Run the build.sh script, remember to add sudo permissions
::{| class="wikitable" style="width:800px;"
|-
|
test@test:~/orangepi-build$ '''sudo ./build.sh'''
|}
<ol start="2" style="list-style-type: decimal;">
<li>Select '''Rootfs and all deb packages''' and press Enter</li></ol>
<div class="figure">
[[File:zero2w-img285.png]]
</div></ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then select the model of the development board</li></ol>
[[File:zero2w-img275.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>Then select the branch type of the kernel source code. Different versions of the kernel source code maintain different rootfs types.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>In the current branch, you can see three options: debian11, ubuntu20.04, and ubuntu22.04.</p></li>
<li><p>In the next branch, you can see three options: debian11, debian12, and ubuntu22.04.</p></li></ol></li></ol>
[[File:zero2w-img276.png]]
</ol></li></ol>
<ol start="5" style="list-style-type: decimal;">
<li>Then select the type of rootfs</li></ol>
[[File:zero2w-img286.png]]
</ol>
<ol start="6" style="list-style-type: decimal;">
<li><p>Then select the type of image</p>
<ol style="list-style-type: lower-alpha;">
<li><p>'''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></li></ol>
<div class="figure">
[[File:zero2w-img287.png]]
</div></ol></li></ol>
<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">
</div>
</ol>
<ol start="8" style="list-style-type: decimal;">
<li>If you are compiling a desktop version of the image, you also need to select the type of desktop environment. Currently, only XFCE is maintained, so please select an XFCE type desktop.</li></ol>
[[File:zero2w-img289.png]]
[[File:zero2w-img291.png]]
</ol>
<ol start="9" style="list-style-type: decimal;">
<li><p>Then the compilation of rootfs will start. Some of the information prompted during compilation are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li>Type of rootfs</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] local not found [ Creating new rootfs cache for '''bullseye''' ]
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>The storage path of the compiled rootfs compressed package</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Target directory [ '''orangepi-build/external/cache/rootfs''' ]
|}</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>The name of the rootfs compressed package generated by compilation</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] File name [ '''bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4''' ]
|}</ol></li></ol>
<ol start="10" style="list-style-type: decimal;">
<li><p>View the compiled rootfs compressed package</p>
<ol style="list-style-type: lower-alpha;">
<li>'''bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4''' It is a compressed package of rootfs. The meaning of each field in the name is</li></ol></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</blockquoteol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>'''bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4.list''' Lists the package names of all packages installed by rootfs</li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~/orangepi-build$ '''ls external/cache/rootfs/'''
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 '''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>
<span id="compile-linux-image"></span>
 
== Compile linux image ==
# Run the '''build.sh''' script, remember to add sudo permissions
::{| class="wikitable" style="width:800px;"
|-
|
test@test:~/orangepi-build$ '''sudo ./build.sh'''
|}
<ol start="2" style="list-style-type: decimal;">
<li>Select '''Full OS image for flashing''' and press Enter</li></ol>
<div class="figure">
[[File:zero2w-img292.png]]
</div></ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then select the model of the development board</li></ol>
[[File:zero2w-img275.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>Then select the branch type of the kernel source code. Different versions of the kernel source code maintain different rootfs types.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>In the current branch, you can see three options: debian11, ubuntu20.04, and ubuntu22.04.</p></li>
<li><p>In the next branch, you can see three options: debian11, debian12, and ubuntu22.04.</p></li></ol></li></ol>
[[File:zero2w-img276.png]]
</ol></li></ol>
<ol start="5" style="list-style-type: decimal;">
<li><p>If you select the next branch, you will also be prompted to select the memory size, and you do not need to select the current branch.</p>
<p>[[File:zero2w-img277.png]]</p></li></ol>
</li>
<li><p>Then select the type of rootfs</p></li></ol>
[[File:zero2w-img286.png]]
</ol>
<ol start="7" style="list-style-type: decimal;">
<li><p>Then select the type of image</p>
<ol style="list-style-type: lower-alpha;">
<li><p>'''Image with console interface (server)''' Represents the image of the server version, which is relatively small in size.</p></li>
<li><p>'''Image with desktop environment'''Represents an image with a desktop, which is relatively large in size.</p></li></ol></li></ol>
<div class="figure">
[[File:zero2w-img287.png]]
</div></ol></li></ol>
<ol start="8" style="list-style-type: decimal;">
<li>If you are compiling the server version of the image, you can also choose to compile the Standard version or the Minimal version. The Minimal version will have much less pre-installed software than the Standard version ('''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">
[[File:zero2w-img288.png]]
</div></ol>
<ol start="9" style="list-style-type: decimal;">
<li>If you are compiling a desktop version of the image, you also need to select the type of desktop environment. Currently, only XFCE is maintained, so please select an XFCE type desktop.</li></ol>
[[File:zero2w-img289.png]]
[[File:zero2w-img291.png]]
</ol>
<ol start="10" style="list-style-type: decimal;">
<li>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.
::o. Finally, write the bin file of u-boot into the image through the dd command.
</ol>
<ol start="11" style="list-style-type: decimal;">
<li><p>After compiling the image, the following message will be displayed</p>
<ol style="list-style-type: lower-alpha;">
<li>The storage path of the compiled image</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Done building [ '''output/images/orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop/orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop.img''' ]
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>Compilation time</li></ol>{| class="wikitable" style="width:800px;" |-|
'''[ o.k. ] Runtime [ 19 min ]'''
|}</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>Repeat the command to compile the image. Use the following command to start compiling the image directly without selecting it through the graphical interface.</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=image RELEASE=bullseye BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_CONFIGURE=yes''' ]
|}</ol></li></ol>
<span id="instructions-for-using-the-orange-pi-os-arch-system"></span>
== Orange Pi OS Arch system function adaptation status ==
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''Motherboard functions'''
|-
| '''Mali GPU'''
| '''<span style="color:#FF0000">NO</span>'''
|-
| '''Video codec'''
| '''<span style="color:#FF0000">NO</span>'''
|}
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''24pin expansion board function'''
|-
| '''TV-OUT'''
| '''<span style="color:#FF0000">NO</span>'''
|}
<span id="orange-pi-os-arch-system-user-guide-instructions"></span>
 
== Orange Pi OS Arch System User Guide Instructions ==
# First open the '''/boot/extlinux/extlinux.conf''' configuration file
::{| class="wikitable" style="width:800px;"
|-
|
[orangepi@orangepi-pc ~]$ '''sudo vim /boot/extlinux/extlinux.conf'''
|}
<ol start="2" style="list-style-type: decimal;">
<li>Then open the corresponding configuration by adding '''FDTOVERLAYS''' '''/dtbs/allwinner/overlay/xxx.dtbo''' in '''/boot/extlinux/extlinux.conf'''</li></ol> '''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.'''
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|
<big>'''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.'''</big>
|}
{| class="wikitable" style="width:800px;"
|-
|
[orangepi@orangepi-pc ~]$ '''sudo vim /boot/extlinux/extlinux.conf'''
FDT /dtbs/allwinner/sun50i-h616-orangepi-zero2w.dtb
'''FDTOVERLAYS /dtbs/allwinner/overlay/<span style="color:#FF0000">xxx.dtbo</span>''' #Configuration that needs to be added|}</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>
<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" style="width:800px;"
|-
| <p>'''/boot/dtbs/allwinner/overlay/'''</p>|}</li><li><p>The DT overlays configuration that can be used by the development board is as follows</p></li> {| class="wikitable" style="width:800px;text-align: center;"|-| '''Functions on the development board'''
| '''Corresponding DT overlays configuration'''
|-
| '''sun50i-h616-disable-uart0.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></ol>{| class="wikitable" style="width:800px;" |-|
[orangepi@orangepi-pc ~]$ '''sudo vim /boot/extlinux/extlinux.conf'''
FDT /dtbs/allwinner/sun50i-h616-orangepi-zero2w.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="6" style="list-style-type: decimal;">
<li>After setting, you need to restart the system for the configuration to take effect.</li></ol>{| class="wikitable" style="width:800px;" |-|
[orangepi@orangepi-pc ~]$ '''sudo reboot'''
|}
</ol>
<span id="how-to-install-software"></span>
<span id="how-to-install-software"></span>
== How to install software ==
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.
{| class="wikitable" style="width:800px;"
|-
|
[orangepi@orangepi-pc ~]$ '''sudo pacman -Syy vim'''
|}
<span id="android-12-tv-system-usage-instructions"></span>
== Supported Android versions ==
{| class="wikitable" style="width:800px;text-align: center;"
|-
| Android Version
== Android 12 TV function adaptation status ==
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''Motherboard functions'''
|}
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''24pin Expansion board function'''
== Onboard LED light display instructions ==
{| class="wikitable" style="width:800px;text-align: center;"
|-
|
=== Use network connection adb debugging ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <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.'''</big>|}
# Make sure the '''service.adb.tcp.port''' of the Android system is set to 5555 port number
::{| class="wikitable" style="width:800px;"
|-
|
apollo-p2:/ # '''getprop | grep &quot;adb.tcp&quot;'''
[service.adb.tcp.port]: [5555]
|}
<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:800px;" |-| apollo-p2:/ol># '''setprop service.adb.tcp.port 5555'''
apollo-p2:/ # '''setprop service.adb.tcp.port 5555'''<br />
apollo-p2:/ # '''stop adbd'''
apollo-p2:/ # '''start adbd'''
|}</ol>
<ol start="3" style="list-style-type: 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 adb'''
|}</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then connect 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)'''
<p>* daemon not running; starting now at tcp:5037</p>
<p>* daemon started successfully</p>
connected to 192.168.1.xxx:5555
 
test@test:~$ '''adb devices'''
192.168.1.xxx:5555 device
|}</ol>
<ol start="5" style="list-style-type: decimal;">
<li>Then you can log in to the android system through adb shell on Ubuntu PC</li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~$ '''adb shell'''
apollo-p2:/ #
|}
</ol>
<span id="use-data-cable-to-connect-adb-debugging"></span>
<span id="use-data-cable-to-connect-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's USB interface can provide the most sufficient power to drive the development board.
::[[File:zero2w-img304.png]] [[File:zero2w-img305.png]]
<ol start="2" style="list-style-type: 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 adb'''
|}</ol>
<ol start="3" style="list-style-type: decimal;">
<li>Check whether the ADB device is recognized</li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~$ '''adb devices'''
4c00146473c28651dd0 device
|}</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then you can log in to the android system through adb shell on Ubuntu PC</li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~$ '''adb shell'''
apollo-p2:/ $
|}
</ol>
<span id="view-how-to-set-hdmi-display-resolution"></span>
<span id="view-how-to-set-hdmi-display-resolution"></span>
== View how to set HDMI display resolution ==
<li><p>First you need to prepare the following accessories</p>
<ol style="list-style-type: lower-alpha;">
<li>HDMI to VGA converter</li></ol></li></ol>
[[File:zero2w-img144.png]]
</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>A VGA cable and a Mini HDMI male to HDMI female adapter</li></ol>
[[File:zero2w-img145.png]] [[File:zero2w-img146.png]]
</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>A monitor or TV that supports VGA interface</li></ol>
</li></ol>
<!-- -->
<ol start="2" style="list-style-type: decimal;">
<li>HDMI to VGA display test is as follows</li></ol>
[[File:zero2w-img313.png]]
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''When 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>|}</ol><span id="wi-fi-connection-method"></span>
<span id="wi-fi-connection-method"></span>
== WI-FI connection method ==
# Choose first '''Settings'''
::[[File:zero2w-img306.png]]
<ol start="2" style="list-style-type: decimal;">
<li>Then select '''Network &amp; Internet'''</li></ol>
[[File:zero2w-img314.png]]
</ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then turn on WI-FI</li></ol>
[[File:zero2w-img315.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>After turning on WI-FI, you can see the searched signals under '''Available networks'''.</li></ol>
[[File:zero2w-img316.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>After selecting the WI-FI you want to connect to, the password input interface shown below will pop up.</li></ol>
<div class="figure">
[[File:zero2w-img317.png]]
</div></ol>
<ol start="6" style="list-style-type: decimal;">
<li>Then use the keyboard to enter the password corresponding to the WI-FI, and then use the mouse to click the Enter button on the virtual keyboard to start connecting to the WI-FI.</li></ol>
<div class="figure">
[[File:zero2w-img318.png]]
</div></ol>
<ol start="7" style="list-style-type: decimal;">
<li>The display after successful WI-FI connection is as shown below</li></ol>
[[File:zero2w-img319.png]]
</ol>
<span id="how-to-use-wi-fi-hotspot"></span>
<span id="how-to-use-wi-fi-hotspot"></span>
== How to use WI-FI hotspot ==
# Then select '''Settings'''
::[[File:zero2w-img306.png]]
<ol start="3" style="list-style-type: decimal;">
<li>Then select '''Network &amp; Internet'''</li></ol>
[[File:zero2w-img314.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then select '''WIFI hotspot'''</li></ol>
[[File:zero2w-img320.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>Then open '''Hotspot Enable'''. You can also see the name and password of the generated hotspot in the picture below. Remember them and use them when connecting to the hotspot (if you need to modify the name and password of the hotspot, you need to close Hotspot Enable first. Then you can modify it)</li></ol>
[[File:zero2w-img321.png]]
</ol>
<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. Then you can click AndroidAP_7132 to connect to the hotspot. The password can be seen under the '''Hotspot password''' in the picture above.</li></ol>
[[File:zero2w-img322.png]]
</ol>
<ol start="7" style="list-style-type: decimal;">
<li>After the connection is successful, it will be displayed as shown below (the interface will be different on different mobile phones, the specific interface is subject to the one displayed on your mobile phone). At this time, you can open a web page on your mobile phone to see if you can access the Internet. If the web page can be opened normally, it means that the '''WI-FI Hotspot''' of the development board can be used normally.</li></ol>
[[File:zero2w-img323.png]]
</ol>
<span id="how-to-check-the-ip-address-of-the-ethernet-port"></span>
<span id="how-to-check-the-ip-address-of-the-ethernet-port"></span>
== How to check the IP address of the Ethernet port ==
# There is no wired network interface on the main board of the development board. We can expand the 100M Ethernet through a 24pin expansion board.
::[[File:zero2w-img107.png]]
<ol start="2" style="list-style-type: decimal;">
<span id="bluetooth-connection-method"></span>
 
== Bluetooth connection method ==
# Choose first '''Settings'''
::[[File:zero2w-img306.png]]
<ol start="2" style="list-style-type: decimal;">
<li>Then select '''Bluetooth'''</li></ol>
[[File:zero2w-img327.png]]
</ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then Open '''Bluetooth Enable'''</li></ol>
[[File:zero2w-img328.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then click '''Pair new device'''to start scanning for surrounding Bluetooth devices</li></ol>
[[File:zero2w-img329.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>The searched Bluetooth devices will be displayed under '''Available devices'''</li></ol>
[[File:zero2w-img330.png]]
</ol>
<ol start="6" style="list-style-type: decimal;">
<li>Then click on the Bluetooth device you want to connect to start pairing. When the following interface pops up, please use the mouse to select the '''Pair'''option</li></ol>
[[File:zero2w-img331.png]]
</ol>
<ol start="7" style="list-style-type: decimal;">
<li>What is tested here is the Bluetooth configuration process between the development board and the Android phone. At this time, the following confirmation interface will pop up on the phone. Click the pairing button on the phone to start the pairing process.</li></ol>
[[File:zero2w-img332.png]]
</ol>
<ol start="8" style="list-style-type: decimal;">
<li>After pairing is completed, open '''Paired devices''' and you will see the paired Bluetooth devices.</li></ol>
[[File:zero2w-img333.png]]
</ol>
<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></ol>
[[File:zero2w-img334.png]]
</ol>
<ol start="10" style="list-style-type: decimal;">
<li>Pictures received by the Bluetooth system of the development board Android system can be viewed in '''Received files'''.</li></ol>
[[File:zero2w-img335.png]]
</ol>
<span id="how-to-set-usb0-to-host-mode-1"></span>
<span id="how-to-set-usb0-to-host-mode-1"></span>
== How to set USB0 to HOST mode ==
<ol style="list-style-type: lower-alpha;">
<li>Run the following command to set USB0 to HOST mode:</li></ol>{| class="wikitable" style="width:800px;" |-|
apollo-p2:/ # '''cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_host'''
apollo-p2:/ #
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>Run the following command to switch back to Device mode</li></ol>{| class="wikitable" style="width:800px;" |-|
apollo-p2:/ # '''cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_device'''
apollo-p2:/ #
|}</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>The command to view the current mode of USB0 is</li></ol>{| class="wikitable" style="width:800px;" |-|
apollo-p2:/ # '''cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/otg_role'''
usb_host
|}
</ol>
<span id="how-to-use-usb-camera"></span>
<span id="how-to-use-usb-camera"></span>
== How to use USB camera ==
# If the USB camera is recognized normally, the corresponding video device node will be generated under /dev
::{| class="wikitable" style="width:800px;"
|-
|
console:/ # '''ls /dev/video0'''
/dev/video0
|}
<ol start="3" style="list-style-type: decimal;">
<li><p>Then make sure that the adb connection between the Ubuntu PC and the development board is normal. For how to use adb, please refer to the instructions in the section &quot;[[Orange Pi Zero 2W#How to use ADB|'''How to use ADB''']]&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="figure">
[[File:zero2w-img337.png]]
</div></ol>
<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>{| class="wikitable" style="width:800px;" |-|
test@test:~$ '''adb 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></ol>
[[File:zero2w-img338.png]]
</ol>
<ol start="7" style="list-style-type: decimal;">
<li>Then double-click to open the USB camera APP and you can see the output video of the USB camera.</li></ol>
<span id="android-system-root-description"></span>
 
== Android system ROOT description ==
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''The Android system released by Orange Pi has been ROOT and can be tested using the following method.'''</big>|}
# Download from the '''official tool''' on the development board data download page '''rootcheck.apk'''
<div class="figure">
::[[File:zero2w-img336.png]]
</div>
<div class="figure">
::[[File:zero2w-img339.png]]
</div>
<ol start="2" style="list-style-type: decimal;">
<li><p>Then make sure that the adb connection between the Ubuntu PC and the development board is normal. For how to use adb, please refer to the instructions in the section &quot;[[Orange Pi Zero 2W#How to use ADB|'''How to use ADB''']]&quot;.</p></li><li><p>Then use the adb command to install rootcheck.apk into the Android system. Of course, you can also use a USB disk copy to install it.</p></li></ol>{| 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.</li></ol>
[[File:zero2w-img340.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>The display interface after opening the '''ROOT test tool''' for the first time is as shown below</li></ol>
[[File:zero2w-img341.png]]
</ol>
<ol start="6" 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-img342.png]]
</ol>
<span id="how-to-use-miracastreceiver-to-cast-the-mobile-phone-screen-to-the-development-board"></span>
<span id="how-to-use-miracastreceiver-to-cast-the-mobile-phone-screen-to-the-development-board"></span>
== How to use MiracastReceiver to cast the mobile phone screen to the development board ==
<ol style="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 [[Orange Pi Zero 2W#WI-FI connection method|'''the instructions in the WI-FI connection method.''']]</p></li>
<li><p>Then open the '''MiracastReceiver'''application in the Android system of the development board</p>
<p>[[File:zero2w-img343.png]]</p></li>
<span id="method-of-turning-on-and-off-the-machine-through-buttons-or-infrared-remote-control"></span>
 
== Method of turning on and off the machine through buttons or infrared remote control ==
== 40pin interface GPIO, UART, SPI test ==
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note: The pin header on the 40pin interface is not soldered by default, and you need to solder it yourself before it can be used.'''</big>|}
<span id="pin-gpio-port-test-method"></span>
# First open wiringOP APP on the desktop
::[[File:zero2w-img351.png]]
<ol start="2" style="list-style-type: decimal;">
<li>Then click the '''GPIO_TEST''' button to open the GPIO test interface</li></ol>
[[File:zero2w-img352.png]]
</ol>
<ol start="3" style="list-style-type: decimal;">
<li>The GPIO test interface is as shown in the figure below. The two rows of '''CheckBox''' buttons on the left have a one-to-one correspondence with the 40pin pins. When the '''CheckBox''' button is checked, the corresponding GPIO pin will be set to '''OUT''' mode and the pin level is set to high level; when unchecked, the GPIO pin level will be set to low level; when the GPIO is clicked When you click the '''GPIO READALL''' button, you can get information such as wPi number, GPIO mode, pin level, etc.; when you click the'''BLINK ALL GPIO''' button, all GPIO ports will cycle through outputting high and low levels. This function can be used to test all the 40pin pins. GPIO port.</li></ol>
[[File:zero2w-img353.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then click the '''GPIO READALL''' button, and the output information is as shown below:</li></ol>
<div class="figure">
[[File:zero2w-img354.png]]
</div></ol>
<ol start="5" style="list-style-type: decimal;">
<li>There are a total of 28 GPIO ports available in the 40-pin development board. The following takes pin 12 - corresponding to GPIO PI01 - corresponding to wPi serial number 6 - as an example to demonstrate how to set the high and low levels of the GPIO port. First click the '''CheckBox''' button corresponding to pin 12. When the button is selected, pin 12 will be set to high level. After setting, you can use a multimeter to measure the value of the voltage of the pin. If it is '''3.3v''', it means the setting High level success.</li></ol>
[[File:zero2w-img355.png]]
</ol>
<ol start="6" style="list-style-type: decimal;">
<li>Then click the '''GPIO READALL''' button and you can see that the current pin 12 mode is '''OUT''' and the pin level is high level.</li></ol>
[[File:zero2w-img356.png]]
</ol>
<ol start="7" style="list-style-type: decimal;">
<li>Click the '''CheckBox''' button in the picture below again to uncheck it, and pin 12 will be set to low level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is '''0v''', it means the low level setting is successful.</li></ol>
[[File:zero2w-img357.png]]
</ol>
<ol start="8" style="list-style-type: decimal;">
<li>Then click the '''GPIO READALL''' button and you can see that the current pin 12 mode is OUT and the pin level is low level.</li></ol>
[[File:zero2w-img358.png]]
</ol>
<span id="pin-uart-test-method"></span>
<span id="pin-uart-test-method"></span>
=== 40pin UART test method ===
# As can be seen from the table below, the default uarts available in the Android12 TV system are uart2 and uart5. Please note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial port.
<div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO序号GPIO NO.'''
| '''GPIO'''
| '''功能Function'''| '''引脚'''|| '''引脚'''| '''功能'''| '''GPIO'''| '''GPIO序号Pin'''
|-
| 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'''
| '''7'''
|
| '''8'''
| '''UART0_TX'''
| '''PH0'''
| '''224'''
|-
| style="text-align: left;"|
| '''GND'''
| '''9'''
|
| '''10'''
| '''UART0_RX'''
| '''PH1'''
| '''225'''
|-
| '''<span style="color:#FF0000">226</span>'''| '''<span style="color:#FF0000">PH2</span>'''| '''<span style="color:#FF0000">UART5_TX</span>'''| '''<span style="color:#FF0000">11</span>'''|-| '''12'''| <span style="text-aligncolor: left;#FF0000"|| '''PI1'''| '''257'''|-| '''>227</span>'''| '''<span style="color:#FF0000">PH3</span>'''| '''<span style="color:#FF0000">UART5_RX</span>'''| '''<span style="color:#FF0000">13</span>'''|-| '''14'''| '''GND'''| <span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"||-| '''>261</span>'''| '''<span style="color:#FF0000">PI5</span>'''| '''<span style="color:#FF0000">UART2_TX</span>'''| '''<span style="color:#FF0000">15'''|| '''16'''| '''PWM4'''| '''PI14'''| '''270</span>'''
|-
| 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'''
| '''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'''
| '''27'''
|
| '''28'''
| '''TWI2-SCL'''
| '''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'''
| '''PI12'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''PC12'''
| '''76'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|
| '''40'''
| style="text-align: left;"|
| '''PI3'''
| '''259'''
|}
 <ol start{| class="2" style="list-style-type: decimal;"><li>The device node corresponding to uart2 is '''/dev/ttyAS2''', and the device node corresponding to uart5 is'''/dev/ttyAS5'''</li></ol> apollo-p2:/ # ls /dev/ttyAS* /dev/ttyAS0 /dev/ttyAS1 '''/dev/ttyAS2 /dev/ttyAS5''' <ol start="3" style="list-style-type: decimal;"><li>First open wiringOP APP on the desktop</li></ol> [[File:zero2w-img351.png]] <ol start="4" style="list-style-type: decimal;"><li>Then click the '''UART_TEST'''button to open the UART test interface</li></ol> [[File:zero2w-img359.png]] <ol start="5" style="list-style-type: decimal;"><li>The serial port test interface of wiringOP is as shown in the figure below</li></ol> [[File:zero2w-img360.png]] <ol start="6wikitable" style="list-style-typewidth: decimal390px;"><li><p>Then select the '''/dev/ttyAS2''' or'''/dev/ttyAS5''' node in the selection box</p><p>[[File:zero2wmargin-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></ol> [[Fileright:zero2w-img362.png]] <ol start="8" style="list-style-type: decimal20px;"><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></ol> [[File:zero2w-img363.png]] <ol start="10" style="listtext-style-typealign: decimalcenter;"><li>If everything is normal, the received string will be displayed in the receiving box</li></ol> [[File:zero2w-img364.png]] <span id="pin-spi-test-method"></span>=== 40pin SPI test method === # As can be seen from the table below, the spi available for the 40pin interface is spi1, and there are two chip select pins cs0 and cs1 {| class="wikitable"
|-
| '''GPIO serial numberPin'''| '''Function'''
| '''GPIO'''
| '''Function'''| '''pin'''|| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO serial numberNO.'''
|-
| 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'''
| '''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'''
| '''UART2_TX'''
| '''15'''
|
| '''16'''
| '''PWM4'''
| '''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">UART2_RX</span>'''| '''<span style="color:#FF0000">PI6</span>'''| '''<span style="color:#FF0000">262</span>'''|-| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''
| '''SPI1_CS0'''
| '''PH5'''
| '''229'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''25'''
|
| '''26'''
| '''SPI1_CS1'''
| '''233'''
|-
| '''266'''
| '''PI10'''
| '''TWI2-SDA'''
| '''27'''
|
| '''28'''
| '''TWI2-SCL'''
| '''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;"|
| '''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 SPI1 CS0 uart2 is '''/dev/spidev1.0ttyAS2''', and the device node corresponding to SPI1 CS1 uart5 is '''/dev/spidev1.1ttyAS5'''</li>{| class="wikitable" style="width:800px;" |-| </olp> apollo-p2:/ # '''ls /dev/spidev1.ttyAS*'''</p><p>/dev/ttyAS0 &nbsp;&nbsp;&nbsp;&nbsp; /dev/ttyAS1 &nbsp;&nbsp;&nbsp;&nbsp; '''<span style="color:#FF0000">/dev/spidev1.0 ttyAS2 &nbsp;&nbsp;&nbsp;&nbsp; /dev/spidev1.1ttyAS5</span>'''</p>|}</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 open wiringOP APP on the SPI1 interface.desktop</li></ol> '''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.'''
[[File:zero2w-img351.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then click the '''UART_TEST'''button to open wiringOP APP on the desktopUART test interface</li></ol> [[File:zero2w-img351.png]]
[[File:zero2w-img359.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>Then click the '''SPI_TEST''' button to open the SPI The serial port test interfaceof wiringOP is as shown in the figure below</li></ol> [[File:zero2w-img365.png]]
[[File:zero2w-img360.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'ttyAS2''. If the '''w25qxx''' module is connected to the 40pin spi1 cs0, then please selector'''/dev/spidev1.0ttyAS5''', if the w25qxx module is connected to node in the 40pin spi1 cs1, then please select '''/dev/spidev1.1'''selection box</p><div class="figure"p> [[File:zero2w-img366img361.png]] </divp></li><li><p>Then Enter the baud rate you want to set in the edit box, and then click the '''OPEN''' button to initialize open the SPIuart node. After the opening is successful, the '''OPEN''' button becomes unselectable, and the '''CLOSE''' button and '''SEND''' button become selectable.</p></li></ol> [[File:zero2w-img367.png]]
[[File:zero2w-img362.png]]
</ol>
<ol start="8" style="list-style-type: decimal;">
<li><p>Then fill in the bytes that need use Dupont wire to be sent, such as reading short the ID information rx and tx pins of uart</p></li><li><p>Then you can enter a paragraph of the onboard SPIFlash, filling characters in the address 0x9f in data[0], send edit box below and then click the '''TRANSFERSEND''' buttonto start sending.</lip></olli>
[[File:zero2w-img368img363.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 start><span id="9" style="listpin-spi-styletest-type: decimal;method"><li>Finally, the APP will display the read ID information of the onboard SPI Flash.</li></olspan>
[[File:zero2w-img369.png]]=== 40pin SPI test method ===
<ol start="10" style="list-style-type: decimal;"><li>If # As can be seen from the w25qxx module connected to 40pin SPI1 is readtable below, the ID information of spi available for the onboard SPI Flash 40pin interface is also similar.</li></ol>spi1, and there are two chip select pins cs0 and cs1
<span iddiv style="pin-i2c-test-methoddisplay: flex;"></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" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO serial numberNO.'''
| '''GPIO'''
| '''Function'''
| '''pin'''|| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO serial numberPin'''
|-
| 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'''
| '''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'''
| '''UART2_TX'''
| '''15'''
|
| '''16'''
| '''PWM4'''
| '''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'''
| '''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'''
| '''27'''
|
| '''28'''
| '''TWI2-SCL'''
| '''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'''
|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''36Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|
| style="text-align: left;"|
| '''PC12'''
| '''76'''
|-
| '''2724'''| '''PI165V'''
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| '''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'''
| '''39'''
|
| '''40'''
| style="text-align: left;"|
| style="text-align: left;"||-| '''PI316'''| '''259PWM4'''|}'''PI14'''| '''270'''|-| '''18'''<ol start| style="2text-align: left;" || '''PH4'''| '''228'''|-| '''20'''| '''GND'''| style="listtext-align: left;"|| style="text-typealign: decimalleft;">||-| '''22'''<li>The device node corresponding to i2c1 is | '''UART2_RX'''| '''PI6'''| '''262'''/dev/i2c|-1| ''', and the device node corresponding to i2c2 is 24'''/dev/i2c| '''SPI1_CS0'''| '''PH5'''| '''229'''|-2| '''26'''| '''SPI1_CS1'''| '''PH9'''</li></ol>| '''233'''apollo|-p2:/ # | '''28'''| '''ls /dev/i2cTWI2-*SCL'''| '''PI9'''| '''265'''|-| '''30'''| '''GND'''/dev/i2c| style="text-align: left;"|| style="text-1 /dev/i2calign: left;"||-2| '''32' /dev/i2c''| '''PWM1'''| '''PI11'''| '''267'''|-5| '''34'''| '''GND'''<ol start| style="3text-align: left;" || style="listtext-align: left;"||-| '''36'''| style="text-typealign: decimalleft;">|| '''PC12'''| '''76'''|}<li>First open wiringOP APP on the desktop</li></oldiv>
[[File<ol start="2" style="list-style-type:zero2wdecimal;"><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;" |-img351| apollo-p2:/ # '''ls /dev/spidev1.png]]*'''
'''<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 click the '''I2C_TEST''' button to open wiringOP APP on the i2c test interfacedesktop</li></ol> [[File:zero2w-img370.png]]
[[File:zero2w-img351.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>The i2c Then click the '''SPI_TEST''' button to open the SPI test interface of wiringOP is shown in the figure below</li></ol>
[[File:zero2w-img371img365.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]]
<ol start="6" style="list-style-type: decimal;"/div></li><li><p>Then click the device node selection box in the upper left corner '''OPEN''' button to select initialize the i2c you want to testSPI</lip></olli>
[[File:zero2w-img372img367.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="79" style="list-style-type: decimal;"><li>Then connect an i2c device to Finally, the APP will display the 40pin i2c pin. Here we take read ID information of the ds1307 rtc module as an exampleonboard SPI Flash.</li></ol>
[[File:zero2w-img178img369.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>
<ol startspan id="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:zero2wpin-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;method"><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></olspan>
<span id="pin-pwm-test"></span>=== 40pin PWM I2C test method ===
# As can be seen from the table below, the available pwm are pwm1, pwm2, pwm3 Android12 TV system has i2c1 and pwm4i2c2 turned on by default.
<div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO serial numberNO.'''
| '''GPIO'''
| '''Function'''
| '''pin'''|| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO serial numberPin'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|
| '''2'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''<span style="color:#FF0000">264</span>'''| '''<span style="color:#FF0000">PI8</span>'''| '''<span style="color:#FF0000">TWI1-SDA</span>'''| '''3'''|| '''4'''| '''5V'''| <span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"|>3</span>'''
|-
| '''<span style="color:#FF0000">263</span>'''| '''<span style="color:#FF0000">PI7</span>'''| '''<span style="color:#FF0000">TWI1-SCL</span>'''| '''5'''|| '''6'''| '''GND'''| <span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"|>5</span>'''
|-
| '''269'''
| '''PWM3'''
| '''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'''
| '''UART2_TX'''
| '''15'''
|
| '''16'''
| '''PWM4'''
| '''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'''
| '''UART2_RX'''
| '''PI6'''
| '''262'''
|-
| '''230'''
| '''SPI1_CLK'''
| '''23'''
|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''25'''
|
| '''26'''
| '''SPI1_CS1'''
| '''PH9'''
| '''233'''
|-
| '''<span style="color:#FF0000">266</span>'''| '''<span style="color:#FF0000">PI10</span>'''| '''<span style="color:#FF0000">TWI2-SDA</span>'''| '''<span style="color:#FF0000">27'''|| '''28'''| '''TWI2-SCL'''| '''PI9'''| '''265</span>'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|
| '''30'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|
| '''32'''
| '''PWM1'''
| '''PI11'''
| '''267'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''PC12'''
| '''76'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|
| '''40'''
| style="text-align: left;"|
| '''PI3'''
| '''259'''
|}
{| 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>First click the wiringOP icon The device node corresponding to open wiringOP APP<i2c1 is '''/li><dev/ol> [[File:zero2w-img351.png]] <ol start="3" style="list-stylei2c-type: decimal;"><li>Then click the '1''PWM_TEST''' button on the main interface of wiringOP to enter the PWM test interface</li></ol> [[File:zero2w-img380.png]] <ol start="4" style="list-style-type: decimal;"><li>The PWM test interface is as follows</li></ol> <div class="figure"> [[File:zero2w-img381.png]] </div><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></ol> [[File:zero2w-img382.png]] <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 device node corresponding to i2c2 is '''20KHz'''</li><dev/ol> [[File:zero2wi2c-img383.png]] <ol start="7" style="list-style-type: decimal;"><li>Then click the '2''EXPORT'''button to export PWM</li></ol[[File:zero2w-img384.png]] <ol start{| class="8wikitable" style="list-style-typewidth: decimal800px;"><li>Then drag the progress bar below to change the PWM duty cycle, and then check '''Enable''' to output the PWM waveform.</li></ol> [[File:zero2w|-img385.png]]| <ol start="9" style="listapollo-style-typep2: decimal;"><li>Then use an oscilloscope to measure the corresponding pins in the 40pin development board and you can see the following waveform.</li></ol> [[File:zero2w-img386.png]] <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"><ls /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<dev/p><ol style="listi2c-style-type: lower-alpha;"><li>Google Cloud Drive</li></ol></li></ol> [[File:zero2w-img387.png]] <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></ol>
test@test:~$ '''md5sum -c H618<span style="color:#FF0000">/dev/i2c-Android121 &nbsp;&nbsp;&nbsp;&nbsp; /dev/i2c-Src.tar.gz.md5sum2</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>
H618[[File:zero2w-Android12img351.png]]</ol><ol start="4" style="list-Src.tar.gzaastyle-type: decimal;"><li>Then click the '''OKI2C_TEST'''button to open the i2c test interface</li>
H618[[File:zero2w-Android12img370.png]]</ol><ol start="5" style="list-Src.tar.gzabstyle-type: '''OK'''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="37" style="list-style-type: decimal;"><li>Then you need connect an i2c device to merge multiple compressed files into one, and then extract the Android source code40pin i2c pin. Here we take the ds1307 rtc module as an example. The command looks like this:</li></ol>
test@test[[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 '''cat H618i2cdetect -Android12y 1''' or '''i2cdetect -Srcy 2''' command on the serial port command line to check whether the i2c address of the ds1307 rtc module can be scanned.tarIf you can see the address 0x68, it means that the ds1307 rtc module is wired correctly.gza* &gt</p>{| class="wikitable" style="width:800px; H618" |-| <p>apollo-p2:/ # '''i2cdetect -Android12y 1'''</p><p>'''Or'''</p><p>apollo-Srcp2:/ # '''i2cdetect -y 2'''</p>|}<p>[[File:zero2w-img373.tarpng]]</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.gzpng]]</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>
test@test:~$ '''tar <span id="pin-xvf H618pwm-Android12-Src.tar.gz'''test"></span>
<ol start="4" style="list-style-type: decimal;"><li>Then unzip the compressed package of the files modified by Orange Pi Zero2w</li></ol>= 40pin PWM test ===
test@test:~$ '''tar zxf opizero2w_android12_patches# As can be seen from the table below, the available pwm are pwm1, pwm2, pwm3 and pwm4.tar.gz'''
test@test<div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align:~$ center;"|-| '''GPIO NO.'''| '''lsGPIO'''| '''Function'''| '''opizero2w_android12_patchesPin''' opizero2w_android12_patches.tar.gz|-<ol start| style="5text-align: left;" || style="list-styletext-typealign: decimalleft;">|| '''3.3V'''| '''1'''|-| '''264'''| '''PI8'''| '''TWI1-SDA'''| '''3'''|-| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|-| '''<lispan style="color:#FF0000">Then copy the files modified by Orange Pi Zero2w to the Android source code269</lispan>'''| '''<span style="color:#FF0000">PI13</olspan>''' test@test:~$ | '''cp -rf opizero2w_android12_patches/* H618-Android12-Src<span style="color:#FF0000">PWM3</span>''' | '''<span idstyle="compile-the-source-code-of-android-12color:#FF0000">7</span>'''|-| style="text-align: left;"|| style= Compile the source code of Android 12 =="text-align: left;"|| '''GND'''| '''Android12 is compiled on an x86_64 computer with Ubuntu 22.04 installed. Other versions of Ubuntu system package dependencies may have some differences. The image download address of the Ubuntu 22.04 amd64 version is as follows:9'''|-[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.iso226''']| '''PH2'''| '''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.UART5_TX'''| '''11'''# First install the software packages needed to compile Android12 source code|-| '''227'''test@test:~$ | '''sudo apt-get updatePH3'''| '''UART5_RX'''test@test:~$ | '''13'''sudo apt|-get install -y git gnupg flex bison gperf build-essential \| '''261'''| '''PI5'''| '''zip curl zlib1gUART2_TX'''| '''15'''|-dev gcc| style="text-multilib g++align: left;"|| style="text-multilib libc6align: left;"|| '''3.3V'''| '''17'''|-dev| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-i386 \| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''lib32ncurses521'''|-dev x11proto| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|-core| style="text-dev libx11align: left;"|| style="text-dev lib32z1align: left;"|| '''GND'''| '''25'''|-dev ccache \| '''266'''| '''PI10'''| '''libgl1TWI2-mesa-dev libxml2-utils xsltproc unzip u-boot-tools python-is-python3 \SDA'''| '''27'''|-| '''libssl-dev libncurses5 clang gawk256'''| '''PI0'''<ol start| style="2text-align: left;" || '''29'''|-| '''271'''| '''PI15'''| style="listtext-style-typealign: decimalleft;">|| '''31'''|-| '''<lispan style="color:#FF0000"><p>Then compile the code in the longan folder, which mainly contains u-boot and linux kernel268</pspan>'''| '''<ol span style="list-style-typecolor: lower-alpha;#FF0000">PI12<li/span>First run '''./build.sh config| ''' to set compilation options</lispan style="color:#FF0000">PWM2</olspan>'''| '''</lispan style="color:#FF0000">33</olspan>'''|-| '''258'''| '''PI2'''test@test| style="text-align:~$ left;"|| '''35'''cd H618|-Android12| '''272'''| '''PI16'''| style="text-Src/longanalign: left;"|| '''37'''|-test@test| style="text-align:~/H618left;"|| style="text-Android12-Src/longan$ align: left;"|| '''./build.sh configGND'''| '''39'''Welcome to mkscript setup progress|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"All available platform:|-| '''Pin'''0. android| '''Function'''| '''GPIO'''1| '''GPIO NO. linux'''|-Choice [android]: | '''02'''| '''5V'''All available ic| style="text-align:left;"|| style="text-align: left;"|0. h618|-| '''4'''Choice [h618]: | '''05V'''| style="text-align: left;"|All available board| style="text-align:left;"||-0. ft| '''6'''| '''GND'''1. p1| style="text-align: left;"|| style="text-align: left;"|2. p2|-| '''8'''3. p7| '''UART0_TX'''| '''PH0'''4. p7l| '''224'''|-5. perf1| '''10'''| '''UART0_RX'''6. perf2| '''PH1'''| '''225'''7. perf3|-| '''12'''8. qa| style="text-align: left;"|| '''PI1'''Choice [p2]: | '''2257'''|-All available flash:| '''14'''| '''GND'''0. default| style="text-align: left;"|| style="text-align: left;"|1. nor|-| '''<span style="color:#FF0000">16</span>'''Choice [default]| '''<span style="color: #FF0000">PWM4</span>'''0| '''<span style="color:#FF0000">PI14</span>'''| '''<span style="color:#FF0000">270</span>'''All available kern_ver:|-| '''18'''0. linux| style="text-5.4align: left;"|| '''PH4'''| '''228'''Choice [linux|-5.4]: | '''020'''| '''GND'''All available arch| style="text-align:left;"|| style="text-align: left;"|0. arm|-| '''22'''1. arm64| '''UART2_RX'''| '''PI6'''Choice [arm64]: | '''1262'''|-| '''......24'''| '''SPI1_CS0'''*** Default configuration is based on | '''PH5''sun50iw9p1smp_h618_android_defconfig'| '''229'''#|-| '''26'''# configuration written to .config| '''SPI1_CS1'''| '''PH9'''#| '''233'''|-make[1]: Leaving directory | '''28'''| '''/home/test/H618TWI2-Android12-Src/longan/out/kernel/buildSCL'''| '''PI9'''make: Leaving directory | '''265'''/home/test/H618|-Android12-Src/longan/kernel/linux-5.4| '''30'''| '''GND'''INFO| style="text-align: clean buildserverleft;"| INFO| style="text-align: prepare_buildserverleft;"||-| '''<ol startspan style="2color:#FF0000" >32</span>'''| '''<span style="list-style-typecolor: lower-alpha;#FF0000">PWM1<li/span>Then run the '''./build.sh| ''' script to start compilation.</lispan style="color:#FF0000">PI11</olspan>''' test@test| '''<span style="color:~#FF0000">267</H618span>'''|-Android12-Src/longan$ | '''./build.sh34'''| '''GND'''<ol start| style="3text-align: left;" || style="listtext-align: left;"||-| '''36'''| style="text-typealign: lowerleft;"|| '''PC12'''| '''76'''|-alpha| '''38'''| style="text-align: left;">|<li>After compilation is completed, you will see the following output</li></ol>| '''PI4'''| '''260'''sun50iw9p1 compile Kernel successful|-| '''40'''INFO| style="text-align: Prepare toolchain ...left;"|| '''PI3'''| '''......259'''|}</div>
INFO<ol start="2" style="list-style-type: build kernel OKdecimal;"><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>
INFO[[File: build rootfs ..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
INFO: build lichee OK.
 
INFO: ----------------------------------------
 
<ol start="3" style="list-style-type: decimal;">
<li>Then use the following command to compile the Android source code and generate the final Android image</li></ol>
 
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 start="4" style="list-style-type: decimal;">
<li><p>The storage path of the Android image generated by compilation is:</p>
<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"
|-
| '''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

Navigation menu