Changes

Jump to: navigation, search

Orange Pi Zero 2W

10,258 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;"
== Compilation system requirements ==
The Linux SDK, '''orangepi-build''', only supports running on X64 computers with '''<span style="color:#FF0000">Ubuntu 22.04</span>''' installed. Therefore, before downloading orangepi-build, please first ensure that the Ubuntu version installed on your computer is Ubuntu 22.04. The command to check the Ubuntu version installed on the computer is as follows. If the Release field does not display '''<span style="color:#FF0000">22.04</span>''', it means that the Ubuntu version currently used does not meet the requirements. Please change the system before performing the following operations.
{| class="wikitable" style="width:800px;"
|-
|
test@test:~$ '''lsb_release -a'''
Description: Ubuntu 22.04 LTS
Release: '''<span style="color:#FF0000">22.04</span>'''
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:
{| class="wikitable" style="width:800px;"
|-
|
[https://repo.huaweicloud.com/ubuntu-releases/21.04/ubuntu-21.04-desktop-amd64.iso '''https://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/22.04/ubuntu-22.04-desktop-amd64.iso''']
|}
After installing Ubuntu 22.04 on your computer or virtual machine, please first set the software source of Ubuntu 22.04 to Tsinghua source (or other domestic sources that you think is fast), otherwise it is easy to make errors due to network reasons when installing the software later. The steps to replace Tsinghua Source are as follows:
<ol style="list-style-type: lower-alpha;">
<li>For the method of replacing Tsinghua Source, please refer to the instructions on this page.</li></ol>
{| class="wikitable" style="width:800px;"
|-
|
[https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/ '''https://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></ol>
[[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></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~$ '''sudo mv /etc/apt/sources.list cat /etc/apt/sources.list.bak'''
test@test:~$ '''sudo vim /etc/apt/sources.list'''
'''# ''' The source code image is commented by default to improve apt update speed. You can uncomment it yourself if necessary.
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
'''# ''' deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
'''# ''' deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
'''# ''' deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
'''# ''' deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
# Pre-release software source, not recommended to be enabled
'''# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy''' Pre-proposed main restricted universe multiverserelease software source, not recommended to be enabled
'''# ''' deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
'''#''' deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
|}
</ol>
<ol start="4" style="list-style-type: lower-alpha;">
<li>After the replacement, you need to update the package information and ensure that no errors are reported.</li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~$ '''sudo apt-get update'''
|}</ol>
<ol start="5" style="list-style-type: lower-alpha;">
<li>'''<span style="color:#FF0000">In addition, since the source code of the kernel and Uboot are stored on GitHub, it is very important to ensure that the computer can download the code from GitHub normally when compiling the image.</span>'''</li></ol>
<span id="obtain-the-source-code-of-linux-sdk"></span>
 
== Obtain the source code of linux sdk ==
Linux sdk refers to the orangepi-build set of codes. Orangepi-build is modified based on the armbian build compilation system. Multiple versions of Linux images can be compiled using orangepi-build. Use the following command to download the orangepi-build code:
{| class="wikitable" style="width:800px;"
|-
|
test@test:~$ '''sudo apt-get update'''
test@test:~$ '''git clone https://github.com/orangepi-xunlong/orangepi-build.git -b next'''
|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note that when using the H618 Soc development board, you need to download the source code of the <span style="color:#FF0000">next </span> branch of orangepi-build. The above git clone command needs to specify the branch of the orangepi-build source code as next.'''</big>
<div class="figure">
[[File:zero2w-img272.png|center|800px]]
</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>|}
The u-boot and linux kernel versions currently used by the H618 series development boards are as follows:
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''branch'''
|}
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''The branch mentioned here is not the same thing as the branch of orangepi-build source code, please don't get confused. This branch is mainly used to distinguish different kernel source code versions.'''
'''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.'''</big>|}
After downloading, the following files and folders will be included:
<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$ '''ls'''
'''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-color:#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>|}
'''If you downloaded the orangepi-build code from github, after downloading, you may find that orangepi<span id="download-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.'''"></span>
<span id="download-the-cross-compilation-tool-chain"></span>
=== Download the cross-compilation tool chain ===
The mirror URL of the cross-compilation tool chain in China is the open source software mirror site of Tsinghua University:
{| class="wikitable" style="width:800px;"
|-
|
[https://mirrors.tuna.tsinghua.edu.cn/armbian-releases/_toolchain/ '''https://mirrors.tuna.tsinghua.edu.cn/armbian-releases/_toolchain/''']
|}
After toolchains is downloaded, it will contain multiple versions of cross-compilation t'''toolchain''':
{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''ls toolchains/'''
gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu gcc-linaro-4.9.4-2017.01-x86_64_aarch64-linux-gnu gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabi
gcc-arm-11.2-2022.02-x86_64-arm-none-linux-gnueabihf gcc-linaro-4.9.4-2017.01-x86_64_armx86_64_aarch64-linux-gnueabi gcc-linaro-aarch64-none-elf-4.8-2013.11_linuxgnu
gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu gcc-linaro-57.54.01-20172019.1002-x86_64_arm-linux-gnueabihf gcc-linaro-arm-linux-gnueabihf-4.8-2014.04_linuxgnueabi
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 gcc-arm-9.2-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_linux gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf  gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu  gcc-linaro-arm-none-eabi-4.8-2014.04_linux|}
The cross-compilation tool chain used to compile the H618 Linux kernel source code is:
<ol style="list-style-type: lower-alpha;">
<li>linux5.4</li></ol>{| class="wikitable" style="width:800px;" |-|
'''gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu'''
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>linux6.1</li></ol>{| class="wikitable" style="width:800px;" |-|
'''gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu'''
|}</ol>
The cross-compilation tool chain used to compile the H618 u-boot source code is:
<ol style="list-style-type: lower-alpha;">
<li>v2018.05</li></ol>{| 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: lower-alpha;">
<li>v2021.07</li></ol>{| 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>
<span id="orangepi-build-complete-directory-structure-description"></span>
=== orangepi-build complete directory structure description ===
<ol style="list-style-type: lower-alpha;">
<li><p>The git warehouse where the linux kernel source code is stored is as follows. Please note that the branch of the linux-orangepi warehouse is switched to</p>
<ol style="list-style-type: lower-alphanone;"><li>a) Linux5.4</li></ol></li></ol>{| class="wikitable" style="width:800px;" </li></ol>|-|
https://github.com/orangepi-xunlong/linux-orangepi/tree/'''orange-pi-5.4-sun50iw9'''
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>b) Linux6.1</li></ol>{| class="wikitable" style="width:800px;" |-|
https://github.com/orangepi-xunlong/linux-orangepi/tree/'''orange-pi-6.1-sun50iw9'''
|}</ol></li></ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li><p>The git warehouse where the u-boot source code is stored is as follows. Please note that the branch of the u-boot-orangepi warehouse is switched to</p>
<ol style="list-style-type: lower-alpha;">
<li>a) v2018.05</li></ol></li></ol>{| 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;">
<li>b) v2021.07</li></ol>{| class="wikitable" style="width:800px;" |-|
https://github.com/orangepi-xunlong/u-boot-orangepi/tree/'''v2021.07-sunxi'''
|}</ol></li></ol></li></ol>
<ol start="2" style="list-style-type: decimal;">
<li><p>When orangepi-build is run for the first time, it will download the cross-compilation tool chain, u-boot and linux kernel source code. After successfully compiling a linux image, the files and folders that can be seen in orangepi-build are:</p>
<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>{| class="wikitable" style="width:800px;" |-|
test@test:~/orangepi-build$ '''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>
<span id="compile-u-boot"></span>
 
== Compile u-boot ==
# 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 '''U-boot package''' and press Enter</li></ol>
<div class="figure">
[[File:zero2w-img274.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 u-boot</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></liol style="list-style-type: lower-alpha;"></olli> <blockquotep>a. If the development board you purchased has a memory size of 1.5GB, please select the first option.</p></li> b. <li><p>If the development board you purchased has 1GB or 2GB or 4GB memory size, please choose the second option.</blockquotep><p>[[File:zero2w-img277.png]]</p></li></ol></li></ol>
<ol start="6" style="list-style-type: decimal;">
<li><p>Then it will start to compile u-boot. Some of the information prompted when compiling the next branch is as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li>Version of u-boot source code</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Compiling u-boot [ '''v2021.07''' ]
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>Version of the cross-compilation tool chain</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Compiler version [ '''aarch64-linux-gnu-gcc 11''' ]
|}</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>Path to the compiled u-boot deb package</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Target directory [ '''orangepi-build/output/debs/u-boot''' ]
|}</ol>
<ol start="4" style="list-style-type: lower-alpha;">
<li>The package name of the compiled u-boot deb package</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] File name [ '''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb''' ]
|}</ol>
<ol start="5" style="list-style-type: lower-alpha;">
<li>Compilation time</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Runtime [ '''1 min''' ]
|}</ol>
<ol start="6" style="list-style-type: lower-alpha;">
<li>Repeat the command to compile u-boot. Use the following command without selecting through the graphical interface. You can start compiling u-boot directly.</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=u-boot''' ]
|}</ol></li></ol>
<ol start="7" style="list-style-type: decimal;">
<li>View the compiled u-boot deb package</li></ol>{| 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>
<ol start="8" style="list-style-type: decimal;">
<li>When the orangepi-bulid compilation system compiles the u-boot source code, it will first synchronize the u-boot source code with the u-boot source code of the github server. Therefore, if you want to modify the u-boot source code, you first need to turn off the download and update function of the source code. ('''You need to completely compile u-boot before you can turn off this function, otherwise it will prompt that the source code of u-boot cannot be found'''), otherwise the modifications will be restored. The method is as follows:</li>
<ol start="8" style="list-style-type: decimal;"><li>When the orangepi-bulid compilation system compiles the u-boot source code, it will first synchronize the u-boot source code with Set the IGNORE_UPDATES variable in 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 uuserpatches/config-boot before you can turn off this function, otherwise it will prompt that the source code of u-boot cannot be founddefault.conf'''), otherwise the modifications will be restored. The method is as follows:</li></ol>to &quot;yes&quot;
<blockquote>Set the IGNORE_UPDATES variable in u'''userpatches/config{| class="wikitable" style="width:800px;" |-default.conf''' to &quot;yes&quot;</blockquote>|
test@test:~/orangepi-build$ '''vim userpatches/config-default.conf'''
......
IGNORE_UPDATES=&quot;'''<span style="color:#FF0000">yes</span>'''&quot;
......
|}</ol>
<ol start="9" style="list-style-type: decimal;">
<li><p>When debugging u-boot code, you can use the following method to update u-boot in the linux image for testing</p>
<ol style="list-style-type: lower-alpha;">
<li>First upload the compiled deb package of u-boot to the Linux system of the development board.</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~/orangepi-build$ '''cd output/debs/u-boot'''
'''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></ol>{| 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></ol>{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''sudo nand-sata-install'''
|}</ol>
<ol start="4" style="list-style-type: lower-alpha;">
<li>Then select '''5 Install/Update the bootloader on SD/eMMC'''</li></ol>
[[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></ol>
[[File:zero2w-img279.png]]
</ol>
<ol start="6" style="list-style-type: lower-alpha;">
<li>Press the Enter key again to start updating u-boot. After the update is completed, the following information will be displayed.</li></ol>
[[File:zero2w-img280.png]]
</ol>
<ol start="7" style="list-style-type: lower-alpha;">
<li>Then you can restart the development board to test whether the u-boot modification has taken effect.</li></ol>
</li></ol>
<span id="compile-the-linux-kernel"></span>
<span id="compile-the-linux-kernel"></span>
== Compile the linux kernel ==
# 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 '''Kernel package''' and press Enter</li></ol>
<div class="figure">
[[File:zero2w-img281.png]]
</div></ol>
<ol start="3" style="list-style-type: decimal;">
<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]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then select the model of the development board</li></ol>
[[File:zero2w-img275.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<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 code
::b. The next branch will compile the linux6.1 kernel source code</blockquote>[[File:zero2w-img276.png]]
::[[File:zero2w-img276.png]]
</ol>
<ol start="6" style="list-style-type: 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.</li></ol>
[[File:zero2w-img283.png]]
<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></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~/orangepi-build$ '''sudo ./build.sh KERNEL_CONFIGURE=no'''
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<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-img284.png]]
</ol></ol>
<ol start="7" style="list-style-type: decimal;">
<li><p>Part of the information prompted when compiling the next branch kernel source code is explained as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li>Version of the linux kernel source code</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Compiling current kernel [ '''6.1.31''' ]
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>The version of the cross-compilation tool chain used</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Compiler version [ '''aarch64-linux-gnu-gcc 11''' ]
|}</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>The default configuration file used by the kernel and the path where it is stored are as follows</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Using kernel config file [ '''orangepi-build/external/config/kernel/linux-6.1-sun50iw9-next.config''' ]
|}</ol>
<ol start="4" style="list-style-type: lower-alpha;">
<li>The path to the kernel-related deb package generated by compilation</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Target directory [ '''output/debs/''' ]
|}</ol>
<ol start="5" style="list-style-type: lower-alpha;">
<li>The package name of the kernel image deb package generated by compilation</li></ol>{| 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</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Runtime [ '''10 min''' ]
|}</ol>
<ol start="7" style="list-style-type: lower-alpha;">
<li>Finally, the compilation command to repeatedly compile the last selected kernel will be displayed. Use the following command without selecting through the graphical interface, and you can directly start compiling the kernel source code.</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=kernel KERNEL_CONFIGURE=no''' ]
|}</ol></li></ol>
<ol start="8" style="list-style-type: decimal;">
<li><p>View the kernel-related deb package generated by compilation</p>
<li><p>'''linux-dtb-next-sun50iw9_x.x.x_arm64.deb''' Contains dtb files used by the kernel</p></li>
<li><p>'''linux-headers-next-sun50iw9_x.x.x_arm64.deb''' Contains kernel header files</p></li>
<li><p>'''linux-image-next-sun50iw9_x.x.x_arm64.deb''' Contains kernel images and kernel modules</p></li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~/orangepi-build$ '''ls output/debs/linux-*'''
output/debs/linux-image-next-sun50iw9_x.x.x_arm64.deb
|}
</ol>
</li></ol>
<ol start="9" style="list-style-type: decimal;">
<li>When the orangepi-bulid compilation system compiles the linux kernel source code, it will first synchronize the linux kernel source code with the linux kernel source code of the github server. Therefore, if you want to modify the linux kernel source code, you first need to turn off the update function of the source code ('''it needs to be completely compiled once This function can only be turned off after obtaining the Linux kernel source code, otherwise it will prompt that the source code of the Linux kernel cannot be found'''), otherwise the modifications will be restored. The method is as follows:</li>
<ol start="9" style="list-style-type: decimal;"><li>When Set the orangepiIGNORE_UPDATES variable in '''userpatches/config-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 serverdefault. Therefore, if you want to modify the linux kernel source code, you first need to turn off the update function of the source code (conf'''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>&quot;yes&quot;
<blockquote>Set the IGNORE_UPDATES variable in '''userpatches/config{| class="wikitable" style="width:800px;" |-default.conf''' to &quot;yes&quot;</blockquote>|
test@test:~/orangepi-build$ '''vim userpatches/config-default.conf'''
IGNORE_UPDATES=&quot;'''<span style="color:#FF0000">yes</span>'''&quot;|}</ol>
<ol start="10" style="list-style-type: decimal;">
<li><p>If the kernel is modified, you can use the following method to update the kernel and kernel module of the development board Linux system</p>
<ol style="list-style-type: lower-alpha;">
<li>Upload the compiled deb package of the Linux kernel to the Linux system of the development board</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~/orangepi-build$ '''cd output/debs'''
'''linux-image-next-sun50iw9_x.x.x_arm64.deb root@192.168.1.xxx:/root'''
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>Install the deb package of the new linux kernel just uploaded.</li></ol>{| 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: lower-alpha;">
<li>Then restart the development board and check whether the kernel-related modifications have taken effect.</li></ol>{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''sudo''' '''reboot'''
|}
</ol>
</li></ol>
<span id="compile-rootfs"></span>
<span id="compile-rootfs"></span>
== Compile rootfs ==
# 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>
{| 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></ol>
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''Functions on the development board'''
| '''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>'''| '''11'''|| '''12'''| <span style="text-aligncolor: left;#FF0000"|| '''PI1'''| '''257>11</span>'''
|-
| '''<span style="color:#FF0000">227</span>'''| '''<span style="color:#FF0000">PH3</span>'''| '''<span style="color:#FF0000">UART5_RX</span>'''| '''13'''|| '''14'''| '''GND'''| <span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"|>13</span>'''
|-
| '''<span style="color:#FF0000">261</span>'''| '''<span style="color:#FF0000">PI5</span>'''| '''<span style="color:#FF0000">UART2_TX</span>'''| '''<span style="color:#FF0000">15'''|| '''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'''
| '''PH8'''
| '''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'''
|
| '''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>The device node corresponding to uart2 is '''/dev/ttyAS2''', and the device node corresponding to uart5 is'''/dev/ttyAS5'''</li></ol> apollomargin-p2right:/ # ls /dev/ttyAS* /dev/ttyAS0 /dev/ttyAS1 '''/dev/ttyAS2 /dev/ttyAS5''' <ol start="3" style="list-style-type: decimal20px;"><li>First open wiringOP APP on the desktop</li></ol> [[File:zero2wtext-img351.png]] <ol start="4" style="list-style-typealign: decimalcenter;"><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="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></ol> [[File:zero2w-img362.png]] <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></ol> [[File:zero2w-img363.png]] <ol start="10" style="list-style-type: decimal;"><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 number'''| '''GPIO'''| '''Function'''| '''pin'''|| '''pinPin'''| '''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'''
| '''PH1'''
| '''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'''
| '''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'''
| '''PI11'''
| '''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 '''/dev/ttyAS2''' or'''/dev/ttyAS5''' node in the upper left cornerselection box</p><p>[[File:zero2w-img361. If png]]</p></li><li><p>Enter the baud rate you test want to set in the onboard SPIFlash directlyedit box, just keep and then click the default '''/dev/spidev0.0OPEN'''button to open the uart node. If After the opening is successful, the '''w25qxxOPEN''' module is connected to button becomes unselectable, and the 40pin spi1 cs0, then please select'''/dev/spidev1.0CLOSE''', if the w25qxx module is connected to the 40pin spi1 cs1, then please select button and '''/dev/spidev1.1SEND'''button become selectable.</p><div class="figure"/li>
[[File:zero2w-img366img362.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]]</divol></liol start="10" style="list-style-type: decimal;"><li><p>Then click If everything is normal, the '''OPEN''' button to initialize received string will be displayed in the SPI</p>receiving box</li></ol>
[[File:zero2w-img367img364.png]]</ol><span id="pin-spi-test-method"></span>
<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></ol>= 40pin SPI test method ===
[[File:zero2w-img368.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
<ol start="9" div style="list-style-typedisplay: decimalflex;"><li>Finally, the APP will display the read ID information of the onboard SPI Flash.</li></ol> [[File:zero2w-img369.png]] <ol start:{| class="10wikitable" style="listwidth:390px;margin-styleright: 20px;text-typealign: decimalcenter;"><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 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'''
| '''PH7'''
| '''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'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''16'''
| '''PWM4'''
| '''PI14'''
| '''270'''
|-
| '''18'''
| style="text-align: left;"|
| '''PH4'''
| '''228'''
|-
| '''20'''
| '''GND'''
| '''39'''
|
| '''40'''
| style="text-align: left;"|
| style="text-align: left;"||-| '''PI322'''| '''259UART2_RX'''|}'''PI6'''| '''262'''<ol start="2" style="list|-style| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-type: decimal;"><li>The device node corresponding to i2c1 is | '''26'''| '''/dev/i2c-1SPI1_CS1''', and the device node corresponding to i2c2 is | '''/dev/i2c-2PH9'''</li></ol>| '''233'''apollo|-p2:/ # | '''28'''| '''ls /dev/i2cTWI2-*SCL'''| '''PI9'''| '''/dev/i2c265'''|-1 /dev/i2c-2| '''30''' /dev/i2c-5| '''GND'''<ol start| style="3text-align: left;" || style="list-styletext-typealign: decimalleft;">||-| '''32'''| '''PWM1'''<li>First open wiringOP APP on the desktop</li></ol>| '''PI11'''| '''267'''[[File:zero2w|-img351.png]]| '''34'''| '''GND'''<ol start| style="4text-align: left;" || style="listtext-style-typealign: decimalleft;">||-<li>Then click the | '''I2C_TEST36''' button to open the i2c test interface</li></ol> [[File:zero2w-img370.png]] <ol start="5" | style="listtext-style-typealign: decimalleft;">|| '''PC12'''| '''76'''|}<li>The i2c test interface of wiringOP is shown in the figure below</lidiv></ol> [[File:zero2w-img371.png]]
<ol start="62" style="list-style-type: decimal;"><li>Then click The device node corresponding to SPI1 CS0 is '''/dev/spidev1.0''', and the device node selection box in 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 upper left corner w25qxx module to select the i2c you want 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 testSPI0, 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</olli>
[[File:zero2w-img372img351.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="76" style="list-style-type: decimal;"><li><p>Then connect an i2c 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 i2c pinspi1 cs0, then please select'''/dev/spidev1. Here we take 0''', if the ds1307 rtc w25qxx module as an exampleis connected to the 40pin spi1 cs1, then please select '''/dev/spidev1.1'''</lip></oldiv class="figure">
[[File:zero2w-img178img366.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><p>The i2c address of Then fill in the ds1307 rtc module is 0x68. After connecting the linesbytes that need to be sent, we can use such as reading the '''i2cdetect -y 1''' or '''i2cdetect -y 2''' command on the serial port command line to check whether the i2c address ID information of the ds1307 rtc module can be scanned. If you can see onboard SPIFlash, filling in 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>0x9f in data[[File:zero2w-img373.png]0]</p></li><li><p>Then set the i2c address to 0x68 in wiringOP, and then click the '''OPENTRANSFER''' 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-img375img368.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</pol><ol start="9" style="list-style-type: lower-alphadecimal;"><li><p>We first set Finally, the APP will display the address read ID information of the register to be written to 0x1conboard SPI Flash.</pli><p>[[File:zero2w-img376img369.png]]</p></li><li><p>Then set the value to be written to 0x55</pol><p>[[Fileol start="10" style="list-style-type:zero2w-img377.png]]</p></lidecimal;"><li><p>Then click If the '''WRITE BYTE''' button w25qxx module connected to perform 40pin SPI1 is read, the writing action</p><p>[[File:zero2w-img378ID information of the onboard SPI Flash is also similar.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 span id="pin-i2c read and write -test has passed.</p><p>[[File:zero2w-img379.png]]</pmethod"></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>'''| '''<span style="color:#FF0000">3</span>'''|-| '''4'''| '''5V'''| <span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"||-| '''>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;"|
| '''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'''
|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''40Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|
| style="text-align: left;"|
|-| '''PI34'''| '''2595V'''|}style="text-align: left;"| <ol start| style="2text-align: left;" ||-| '''6'''| '''GND'''| style="listtext-align: left;"|| style="text-typealign: decimalleft;">||-| '''8'''| '''UART0_TX'''| '''PH0'''| '''224'''|-| '''10'''| '''UART0_RX'''<li>First click the wiringOP icon to open wiringOP APP</li></ol>| '''PH1'''| '''225'''[[File:zero2w|-img351.png]]| '''12'''<ol start="3" | style="list-styletext-typealign: decimalleft;">|<li>Then click the | '''PWM_TESTPI1''' button on the main interface of wiringOP to enter the PWM test interface</li></ol>| '''257'''[[File:zero2w|-img380.png]]| '''14'''<ol start| '''GND'''| style="4text-align: left;" || style="list-styletext-typealign: decimalleft;">||-<li>The PWM test interface is as follows</li></ol>| '''16'''| '''PWM4'''<div class="figure">| '''PI14'''| '''270'''[[File:zero2w|-img381.png]]| '''18'''</div><ol start="5" | style="list-styletext-typealign: decimalleft;">|<li>Then set which PWM you want to use in the Channel. The default is PWM1. If you want to set it to PWM2, just enter 2 in the Channel. PWM3 and PWM4 and so on.</li></ol>| '''PH4'''| '''228'''[[File:zero2w|-img382.png]]| '''20'''| '''GND'''<ol start| style="6text-align: left;" || style="listtext-style-typealign: decimalleft;">||-| '''22'''| '''UART2_RX'''| '''PI6'''| '''262'''|-| '''24'''<li>Then you can set the PWM period. The default configuration is | '''50000nsSPI1_CS0'''. The converted PWM frequency is | '''20KHzPH5'''</li></ol>| '''229'''[[File:zero2w|-img383.png]]| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''<ol start="7" span style="list-style-typecolor: decimal;#FF0000">28<li/span>Then click the '''EXPORT| '''button to export PWM</lispan style="color:#FF0000">TWI2-SCL</olspan>''' [[File:zero2w-img384.png]] | '''<ol start="8" span style="list-style-typecolor: decimal;#FF0000">PI9<li/span>Then drag the progress bar below to change the PWM duty cycle, and then check '''Enable| ''' to output the PWM waveform.</lispan style="color:#FF0000">265</olspan>''' [[File:zero2w|-img385.png]]| '''30'''<ol start| '''GND'''| style="9text-align: left;" || style="list-styletext-typealign: decimalleft;">||-| '''32'''<li>Then use an oscilloscope to measure the corresponding pins in the 40pin development board and you can see the following waveform.</li></ol>| '''PWM1'''| '''PI11'''[[File:zero2w| '''267'''|-img386.png]]| '''34'''<span id| '''GND'''| style="howtext-toalign: left;"|| style="text-compile-android-12-source-codealign: left;"></span>||-= | '''How to compile Android 12 source code36''' = <span id| style="downloadtext-the-source-code-of-android-12align: left;"></span>|| '''PC12'''| '''76'''== Download the source code of Android 12 ==|-| '''38'''<ol | style="listtext-style-typealign: decimalleft;">|| '''PI4'''| '''260'''|-<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>| '''40'''<ol | style="list-styletext-typealign: lower-alphaleft;">|| '''PI3'''| '''259'''<li>Google Cloud Drive</li></ol>|}</lidiv></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 The device node corresponding to i2c1 is correct. If it is incorrect, please download the source code again. Here's how to check the MD5 checksum:<''/li><dev/ol> test@test:~$ i2c-1'''md5sum -c H618-Android12-Src.tar.gz.md5sum, and the device node corresponding to i2c2 is ''' H618/dev/i2c-Android12-Src.tar.gzaa: '''OK2'''</li>{| class="wikitable" style="width:800px;" H618|-Android12| apollo-Src.tar.gzabp2: / # '''OKls /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>Then you need to merge multiple compressed files into one, and then extract First open wiringOP APP on the Android source code. The command looks like this:desktop</li></ol> test@test:~$ '''cat H618-Android12-Src.tar.gza* &gt; H618-Android12-Src.tar.gz''' test@test:~$ '''tar -xvf H618-Android12-Src.tar.gz'''
[[File:zero2w-img351.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then unzip click the compressed package of the files modified by Orange Pi Zero2w</li></ol> test@test:~$ '''tar zxf opizero2w_android12_patches.tar.gzI2C_TEST''' button to open the i2c test@test:~$ '''ls''' '''opizero2w_android12_patches''' opizero2w_android12_patches.tar.gzinterface</li>
[[File:zero2w-img370.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>Then copy The i2c test interface of wiringOP is shown in the files modified by Orange Pi Zero2w to the Android source codefigure below</li></ol>
test@test[[File:~$ '''cp zero2w-rf opizero2w_android12_patchesimg371.png]]</* H618ol><ol start="6" style="list-Android12style-Srctype: 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]]<span id/ol><ol start="compile-the7" style="list-sourcestyle-code-of-android-12type: decimal;"><li>Then connect an i2c device to the 40pin i2c pin. Here we take the ds1307 rtc module as an example.</spanli>== Compile the source code of Android 12 ==
[[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 '''Android12 is compiled i2cdetect -y 2''' command on an x86_64 computer with Ubuntu 22the serial port command line to check whether the i2c address of the ds1307 rtc module can be scanned.04 installedIf you can see the address 0x68, it means that the ds1307 rtc module is wired correctly. Other versions of Ubuntu system package dependencies may have some differences</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. The image download png]]</p></li><li><p>Then set the i2c address of to 0x68 in wiringOP, and then click the Ubuntu 22'''OPEN''' button to open i2c</p><p>[[File:zero2w-img374.04 amd64 version 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>
[https://repo.huaweicloud.com/ubuntu-releases/22.04/ubuntu-22.04.2<span id="pin-desktoppwm-amd64.iso '''https:test"><//repo.huaweicloud.com/ubuntu-releases/22.04/ubuntu-22.04.2-desktop-amd64.iso''']span>
'''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.'''=== 40pin PWM test ===
# First install As can be seen from the software packages needed to compile Android12 source codetable below, the available pwm are pwm1, pwm2, pwm3 and pwm4.
test@test<div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align:~$ center;"|-| '''GPIO NO.'''| '''GPIO'''| '''Function'''| '''sudo apt-get updatePin'''|-| style="text-align: left;"|test@test| style="text-align:~$ left;"|| '''3.3V'''| '''1'''sudo apt|-get install | '''264'''| '''PI8'''| '''TWI1-y git gnupg flex bison gperf buildSDA'''| '''3'''|-essential \| '''263'''| '''PI7'''| '''zip curl zlib1gTWI1-dev gccSCL'''| '''5'''|-multilib g++| '''<span style="color:#FF0000">269</span>'''| '''<span style="color:#FF0000">PI13</span>'''| '''<span style="color:#FF0000">PWM3</span>'''| '''<span style="color:#FF0000">7</span>'''|-multilib libc6| style="text-devalign: left;"|| style="text-i386 \align: left;"|| '''GND'''| '''9'''|-| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''lib32ncurses5|-dev x11proto| '''261'''| '''PI5'''| '''UART2_TX'''| '''15'''|-core| style="text-dev libx11align: left;"|| style="text-dev lib32z1align: left;"|| '''3.3V'''| '''17'''|-dev ccache \| '''231'''| '''PH7'''| '''SPI1_MOSI'''| 'libgl1''19'''|-mesa| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|-dev libxml2| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|-utils xsltproc unzip u| style="text-bootalign: left;"|| style="text-tools pythonalign: left;"|| '''GND'''| '''25'''|-is| '''266'''| '''PI10'''| '''TWI2-python3 \SDA'''| '''27'''|-| '''libssl-dev libncurses5 clang gawk256'''| '''PI0'''<ol start| style="2text-align: left;" || '''29'''|-| '''271'''| '''PI15'''| style="list-styletext-typealign: decimalleft;">|| '''31'''|-| '''<li><pspan style="color:#FF0000">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'''test@test| '''PI2'''| 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;"|| '''GND'''| '''./build.sh config39'''|}Welcome to mkscript setup progress{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-All available platform:| '''Pin'''| '''Function'''| '''GPIO'''0| '''GPIO NO. android'''|-1. linux| '''2'''| '''5V'''| style="text-align: left;"|Choice [android]| style="text-align: left;"||-| '''04'''| '''5V'''All available ic| style="text-align:left;"|| style="text-align: left;"|0. h618|-| '''6'''Choice [h618]: | '''0GND'''| style="text-align: left;"|All available board| style="text-align:left;"||-| '''8'''| '''UART0_TX'''0. ft| '''PH0'''| '''224'''1. p1|-| '''10'''2. p2| '''UART0_RX'''| '''PH1'''3. p7| '''225'''|-4. p7l| '''12'''| style="text-align: left;"|5. perf1| '''PI1'''| '''257'''6. perf2|-| '''14'''7. perf3| '''GND'''| style="text-align: left;"|8. qa| style="text-align: left;"||-Choice [p2]| '''<span style="color: #FF0000">16</span>'''| '''2<span style="color:#FF0000">PWM4</span>'''| '''<span style="color:#FF0000">PI14</span>'''All available flash| '''<span style="color:#FF0000">270</span>'''|-0. default| '''18'''| style="text-align: left;"|1. nor| '''PH4'''| '''228'''Choice [default]: |-| '''020'''| '''GND'''All available kern_ver| style="text-align:left;"|| style="text-align: left;"|0. linux|-5.4| '''22'''| '''UART2_RX'''| '''PI6'''| '''262'''Choice [linux|-5.4]: | '''024'''| '''SPI1_CS0'''All available arch:| '''PH5'''| '''229'''0. arm|-| '''26'''1. arm64| '''SPI1_CS1'''| '''PH9'''Choice [arm64]: | '''1233'''|-| '''......28'''| '''TWI2-SCL'''*** Default configuration is based on | '''PI9''sun50iw9p1smp_h618_android_defconfig'| '''265'''#|-| '''30'''# configuration written to .config| '''GND'''| style="text-align: left;"|#| style="text-align: left;"||-make[1]| '''<span style="color: Leaving directory #FF0000">32</span>'''| '''<span style="color:#FF0000">PWM1</homespan>'''| '''<span style="color:#FF0000">PI11</testspan>'''| '''<span style="color:#FF0000">267</H618span>'''|-Android12-Src/longan/out/kernel/build| '''34'''| '''GND'''| style="text-align: left;"|make| style="text-align: Leaving directory left;"||-| ''/home/test/H618'36'''| style="text-Android12align: left;"|| '''PC12'''| '''76'''|-Src/longan/kernel/linux| '''38'''| style="text-5.4align: left;"|| '''PI4'''| '''260'''|-| '''40'''INFO| style="text-align: clean buildserverleft;"|| '''PI3'''| '''259'''|}INFO: prepare_buildserver</div> <ol start="2" style="list-style-type: lowerdecimal;"><li>First click the wiringOP icon to open wiringOP APP</li> [[File:zero2w-img351.png]]</ol><ol start="3" style="list-style-alphatype: decimal;"><li>Then run click the '''./build.shPWM_TEST''' script button on the main interface of wiringOP to start compilation.enter the PWM test interface</li></oltest@test[[File:~/H618-Android12zero2w-Src/longan$ '''img380.png]]</build.sh'''ol><ol start="34" style="list-style-type: lower-alphadecimal;"><li>After compilation The PWM test interface is completed, you will see the following outputas follows</li> </oldiv class="figure"sun50iw9p1 compile Kernel successful INFO[[File: Prepare toolchain ... '''......''' INFO: build kernel OKzero2w-img381.png]]
INFO</div></ol><ol start="5" style="list-style-type: build rootfs 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></ol>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''cd H618-Android12-Src''' test@test:~/H618-Android12-Src$ '''source build/envsetup.sh''' test@test:~/H618-Android12-Src$ '''lunch apollo_p2-userdebug''' test@test:~/H618-Android12-Src$ '''make -j8''' test@test:~/H618-Android12-Src$ '''pack'''|}</ol><ol start="4" style="list-style-type: decimal;"><li><p>The storage path of the Android image generated by compilation is:</p>{| class="wikitable" style="width:800px;" |-| <p>'''longan/out/h618_android12_p2_uart0.img'''</p>|}</li></ol> <span id="appendix"></span> = '''Appendix''' = <span id="user-manual-update-history"></span>== User manual update history == {| class="wikitable" style="width:800px;text-align: center;"|-| '''Version'''| '''Date'''| '''Release Notes'''|-| v1.0| 2023-09-14| initial version|} <span id="image-update-history"></span>== Image update history == {| class="wikitable" style="width:800px;"|-| style="text-align: center;"| '''Date''' | style="text-align: center;"| '''Release Notes'''|-| 202 3style="text-align: center;"| 2023-09-14| orangepizero2w_1.0.0_debian_bullseye_server_linux5.4.125.7z orangepizero2w_1.0.0_ubuntu_focal_server_linux5.4.125.7z orangepizero2w_1.0.0_ubuntu_focal_desktop_xfce_linux5.4.125.7z orangepizero2w_1.0.0_debian_bullseye_desktop_xfce_linux5.4.125.7z  orangepizero2w_1.0.0_ubuntu_jammy_server_linux6.1.31.7z orangepizero2w_1.0.0_debian_bookworm_server_linux6.1.31.7z orangepizero2w_1.0.0_debian_bullseye_server_linux6.1.31.7z orangepizero2w_1.0.0_ubuntu_jammy_desktop_xfce_linux6.1.31.7z orangepizero2w_1.0.0_debian_bookworm_desktop_xfce_linux6.1.31.7z orangepizero2w_1.0.0_debian_bullseye_desktop_xfce_linux6.1.31.7z  OrangePi_Zero2w_Android12_v1.0.tar.gz 
Opios-arch-aarch64-xfce-opizero2w-23.09-linux6.1.31.img.xz

Navigation menu