Open main menu

Wiki-Orange Pi β

Changes

Orange Pi Zero 2W

2,968 bytes added, 20:33, 27 September 2023
Download orangepi-build from github
<div class="figure">
[[File:zero2w-img3.png|800px]]
</div>
<div class="figure">
[[File:zero2w-img4.png|800px]]
</div>
<div class="figure">
[[File:zero2w-img5.png|800px]]
</div>
<span id="orange-pi-zero-2w-24pin-expansion-board-interface-details"></span>
 
== Orange Pi Zero 2w 24pin expansion board interface details ==
<div class="figure">
[[File:zero2w-img6.png|800px]]
</div>
[[File:zero2w-img7.png|800px]]
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
<div class="figure">
[[File:zero2w-img272.png|center|800px]]
</div>
<div style="display: flex;">
::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO NO.'''
# As can be seen from the table below, the Android12 TV system has i2c1 and i2c2 turned on by default.
<div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO serial numberNO.'''
| '''GPIO'''
| '''Function'''
| '''pin'''|| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO serial numberPin'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|
| '''2'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''<span style="color:#FF0000">264</span>'''| '''<span style="color:#FF0000">PI8</span>'''| '''<span style="color:#FF0000">TWI1-SDA</span>'''| '''3'''|| '''4'''| '''5V'''| <span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"|>3</span>'''
|-
| '''<span style="color:#FF0000">263</span>'''| '''<span style="color:#FF0000">PI7</span>'''| '''<span style="color:#FF0000">TWI1-SCL</span>'''| '''5'''|| '''6'''| '''GND'''| <span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"|>5</span>'''
|-
| '''269'''
| '''PWM3'''
| '''7'''
|
| '''8'''
| '''UART0_TX'''
| '''PH0'''
| '''224'''
|-
| style="text-align: left;"|
| '''GND'''
| '''9'''
|
| '''10'''
| '''UART0_RX'''
| '''PH1'''
| '''225'''
|-
| '''226'''
| '''UART5_TX'''
| '''11'''
|
| '''12'''
| style="text-align: left;"|
| '''PI1'''
| '''257'''
|-
| '''227'''
| '''UART5_RX'''
| '''13'''
|
| '''14'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''261'''
| '''UART2_TX'''
| '''15'''
|
| '''16'''
| '''PWM4'''
| '''PI14'''
| '''270'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|
| '''18'''
| style="text-align: left;"|
| '''PH4'''
| '''228'''
|-
| '''231'''
| '''SPI1_MOSI'''
| '''19'''
|
| '''20'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''232'''
| '''SPI1_MISO'''
| '''21'''
|
| '''22'''
| '''UART2_RX'''
| '''PI6'''
| '''262'''
|-
| '''230'''
| '''SPI1_CLK'''
| '''23'''
|
| '''24'''
| '''SPI1_CS0'''
| '''PH5'''
| '''229'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|
| '''26'''
| '''SPI1_CS1'''
| '''PH9'''
| '''233'''
|-
| '''<span style="color:#FF0000">266</span>'''| '''<span style="color:#FF0000">PI10</span>'''| '''<span style="color:#FF0000">TWI2-SDA</span>'''| '''<span style="color:#FF0000">27'''|| '''28'''| '''TWI2-SCL'''| '''PI9'''| '''265</span>'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|
| '''30'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|
| '''32'''
| '''PWM1'''
| '''PI11'''
| '''267'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''PC12'''
| '''76'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|
| '''40'''
| style="text-align: left;"|
| '''PI3'''
| '''259'''
|}
 <ol start{| class="2wikitable" style="list-style-typewidth: decimal390px;"><li>The device node corresponding to i2c1 is '''/dev/i2c-1''', and the device node corresponding to i2c2 is '''/dev/i2c-2'''</li></ol> apollo-p2:/ # '''ls /dev/i2c-*''' '''/dev/i2c-1 /dev/i2c-2''' /dev/i2c-5 <ol start="3" style="listmargin-style-typeright: decimal20px;"><li>First open wiringOP APP on the desktop</li></ol> [[File:zero2w-img351.png]] <ol start="4" style="list-styletext-typealign: decimalcenter;"><li>Then click the '''I2C_TEST''' button to open the i2c test interface</li></ol> [[File:zero2w-img370.png]] <ol start="5" style="list-style-type: decimal;"><li>The i2c test interface of wiringOP is shown in the figure below</li></ol> [[File:zero2w-img371.png]] <ol start="6" style="list-style-type: decimal;"><li>Then click the device node selection box in the upper left corner to select the i2c you want to test</li></ol> [[File:zero2w-img372.png]] <ol start="7" style="list-style-type: decimal;"><li>Then connect an i2c device to the 40pin i2c pin. Here we take the ds1307 rtc module as an example.</li></ol> [[File:zero2w-img178.png]] <ol start="8" style="list-style-type: decimal;"><li><p>The i2c address of the ds1307 rtc module is 0x68. After connecting the lines, we can use the '''i2cdetect -y 1''' or '''i2cdetect -y 2''' command on the serial port command line to check whether the i2c address of the ds1307 rtc module can be scanned. If you can see the address 0x68, it means that the ds1307 rtc module is wired correctly.</p><p>apollo-p2:/ # '''i2cdetect -y 1'''</p><p>'''Or'''</p><p>apollo-p2:/ # '''i2cdetect -y 2'''</p><p>[[File:zero2w-img373.png]]</p></li><li><p>Then set the i2c address to 0x68 in wiringOP, and then click the '''OPEN''' button to open i2c</p><p>[[File:zero2w-img374.png]]</p></li><li><p>After clicking the '''OPEN''' button to open i2c, the display is as follows</p><p>[[File:zero2w-img375.png]]</p></li><li><p>Then we test writing a value to the register of the rtc module, for example, writing 0x55 to the 0x1c address</p><ol style="list-style-type: lower-alpha;"><li><p>We first set the address of the register to be written to 0x1c</p><p>[[File:zero2w-img376.png]]</p></li><li><p>Then set the value to be written to 0x55</p><p>[[File:zero2w-img377.png]]</p></li><li><p>Then click the '''WRITE BYTE''' button to perform the writing action</p><p>[[File:zero2w-img378.png]]</p></li></ol></li><li><p>Then click the '''READ BYTE''' button to read the value of the 0x1c register. If it displays 0x55, it means that the i2c read and write test has passed.</p><p>[[File:zero2w-img379.png]]</p></li></ol> <span id="pin-pwm-test"></span>=== 40pin PWM test === # As can be seen from the table below, the available pwm are pwm1, pwm2, pwm3 and pwm4. {| 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;"|
| style="text-align: left;"|
|-
| '''263'''
| '''PI7'''
| '''TWI1-SCL'''
| '''5'''
|
| '''6'''
| '''GND'''
| style="text-align: left;"|
|-
| '''269'''
| '''PI13'''
| '''PWM3'''
| '''7'''
|
| '''8'''
| '''UART0_TX'''
| '''224'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''9'''
|
| '''10'''
| '''UART0_RX'''
| '''225'''
|-
| '''226'''
| '''PH2'''
| '''UART5_TX'''
| '''11'''
|
| '''12'''
| style="text-align: left;"|
| '''257'''
|-
| '''227'''
| '''PH3'''
| '''UART5_RX'''
| '''13'''
|
| '''14'''
| '''GND'''
| style="text-align: left;"|
|-
| '''261'''
| '''PI5'''
| '''UART2_TX'''
| '''15'''
|
| '''16'''
| '''PWM4'''
| '''270'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|
| '''18'''
| style="text-align: left;"|
| '''228'''
|-
| '''231'''
| '''PH7'''
| '''SPI1_MOSI'''
| '''19'''
|
| '''20'''
| '''GND'''
| style="text-align: left;"|
|-
| '''232'''
| '''PH8'''
| '''SPI1_MISO'''
| '''21'''
|
| '''22'''
| '''UART2_RX'''
| '''262'''
|-
| '''230'''
| '''PH6'''
| '''SPI1_CLK'''
| '''23'''
|
| '''24'''
| '''SPI1_CS0'''
| '''229'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''25'''
|
| '''26'''
| '''SPI1_CS1'''
| '''233'''
|-
| '''266'''| '''PI10'''| '''TWI2-SDA'''| '''27'''|| '''<span style="color:#FF0000">28</span>'''| '''<span style="color:#FF0000">TWI2-SCL</span>'''| '''<span style="color:#FF0000">PI9</span>'''| '''<span style="color:#FF0000">265</span>'''
|-
| '''256'''
| '''PI0'''
| style="text-align: left;"|
| '''29'''
|
| '''30'''
| '''GND'''
| style="text-align: left;"|
|-
| '''271'''
| '''PI15'''
| style="text-align: left;"|
| '''31'''
|
| '''32'''
| '''PWM1'''
| '''267'''
|-
| '''268'''
| '''PI12'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
|-
| '''258'''
| '''PI2'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''76'''
|-
| '''272'''
| '''PI16'''
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''260'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''39'''
|
| '''40'''
| style="text-align: left;"|
| '''259'''
|}
</div>
<ol start="2" style="list-style-type: decimal;">
<li>First click The device node corresponding to i2c1 is '''/dev/i2c-1''', and the wiringOP icon device node corresponding to open wiringOP APPi2c2 is '''/dev/i2c-2'''</li></ol>{| class="wikitable" style="width:800px;" |-| [[Fileapollo-p2:zero2w/ # '''ls /dev/i2c-img351.png]]*'''
'''<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 click the '''PWM_TEST''' button First open wiringOP APP on the main interface of wiringOP to enter the PWM test interfacedesktop</li></ol> [[File:zero2w-img380.png]]
[[File:zero2w-img351.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>The PWM Then click the '''I2C_TEST''' button to open the i2c test interface is as follows</li></ol>
<div class="figure"> [[File:zero2w-img381img370.png]] </divol>
<ol start="5" style="list-style-type: decimal;">
<li>Then set which PWM you want to use in the Channel. The default i2c test interface of wiringOP is PWM1. If you want to set it to PWM2, just enter 2 shown in the Channel. PWM3 and PWM4 and so on.figure below</li></ol> [[File:zero2w-img382.png]]
[[File:zero2w-img371.png]]
</ol>
<ol start="6" style="list-style-type: decimal;">
<li>Then click the device node selection box in the upper left corner to select the i2c you can set the PWM period. The default configuration is '''50000ns'''. The converted PWM frequency is '''20KHz'''want to test</li></ol> [[File:zero2w-img383.png]]
[[File:zero2w-img372.png]]
</ol>
<ol start="7" style="list-style-type: decimal;">
<li>Then click connect an i2c device to the '''EXPORT'''button to export PWM40pin i2c pin. Here we take the ds1307 rtc module as an example.</li></ol> [[File:zero2w-img384.png]]
[[File:zero2w-img178.png]]
</ol>
<ol start="8" style="list-style-type: decimal;">
<li>Then drag <p>The i2c address of the progress bar below to change ds1307 rtc module is 0x68. After connecting the PWM duty cyclelines, and then check we can use the '''i2cdetect -y 1''' or '''Enablei2cdetect -y 2''' command on the serial port command line to output check whether the i2c address of the ds1307 rtc module can be scanned. If you can see the address 0x68, it means that the PWM waveformds1307 rtc module is wired correctly.</lip>{| class="wikitable" style="width:800px;" |-| <p>apollo-p2:/ # '''i2cdetect -y 1'''</p><p>'''Or'''</olp><p>apollo-p2:/ # '''i2cdetect -y 2'''</p>|}<p>[[File:zero2w-img385img373.png]] <ol start="9" style="list-style-type: decimal;"/p></li><li><p>Then use an oscilloscope set the i2c address to measure the corresponding pins 0x68 in the 40pin development board wiringOP, and you can see then click the following waveform.'''OPEN''' button to open i2c</lip></olp> [[File:zero2w-img386img374.png]] <span id="how-to-compile-android-12-source-code"/p></spanli= <li><p>After clicking the '''How to compile Android 12 source codeOPEN''' =button to open i2c, the display is as follows</p><span id="downloadp>[[File:zero2w-the-source-code-of-android-12">img375.png]]</spanp>== Download the source code of Android 12 == <ol style="list-style-type: decimal;"/li><li><p>First download Then we test writing a value to the compressed package register of the Android 12 source code and the compressed package of rtc module, for example, writing 0x55 to the files modified by Orange Pi Zero2w from Google Cloud Drive0x1c address</p>
<ol style="list-style-type: lower-alpha;">
<li>Google Cloud Drive<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>
[[File:zero2w<span id="pin-img387.png]]pwm-test"></span>
<ol start="2" style="list-style-type: decimal;"><li>After downloading the compressed package of Android 12 source code, please check whether the MD5 checksum is correct. If it is incorrect, please download the source code again. Here's how to check the MD5 checksum:</li></ol>= 40pin PWM test ===
test@test:~$ '''md5sum -c H618-Android12-Src# As can be seen from the table below, the available pwm are pwm1, pwm2, pwm3 and pwm4.tar.gz.md5sum'''
H618<div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-Android12align: center;"|-Src| '''GPIO NO.tar'''| '''GPIO'''| '''Function'''| '''Pin'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.gzaa: 3V'''| '''1'''|-| '''OK264'''| '''PI8'''H618| '''TWI1-Android12SDA'''| '''3'''|-Src.tar.gzab: | '''OK263'''| '''PI7'''......| '''TWI1-SCL'''| '''5'''|-| '''<ol startspan style="3color:#FF0000" >269</span>'''| '''<span style="list-style-typecolor: decimal;#FF0000">PI13</span>'''| '''<lispan style="color:#FF0000">Then you need to merge multiple compressed files into one, and then extract the Android source code. The command looks like this:PWM3</lispan>'''| '''<span style="color:#FF0000">7</olspan>'''|-test@test| style="text-align: left;"|| style="text-align:~$ left;"|| '''GND'''| '''9'''|-| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''cat H618|-Android12| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-Src.tar.gza* &gt| '''261'''| '''PI5'''| '''UART2_TX'''| '''15'''|-| style="text-align: left; H618"|| style="text-Android12align: left;"|| '''3.3V'''| '''17'''|-Src.tar.gz| '''231'''| '''PH7'''test@test:~$ | '''SPI1_MOSI'''| '''19'''tar |-xvf H618| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|-Android12-Src.tar.gz| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|-<ol start| style="4text-align: left;" || style="list-styletext-typealign: decimalleft;">|| '''GND'''| '''25'''<li>Then unzip the compressed package of the files modified by Orange Pi Zero2w</li></ol>|-| '''266'''test@test:~$ | '''tar zxf opizero2w_android12_patches.tar.gzPI10'''| '''TWI2-SDA'''test@test:~$ | '''ls27'''|-| '''opizero2w_android12_patches256''' opizero2w_android12_patches.tar.gz| '''PI0'''<ol start| style="5text-align: left;" || '''29'''|-| '''271'''| '''PI15'''| style="list-styletext-typealign: decimalleft;">|| '''31'''|-| '''<lispan style="color:#FF0000">Then copy the files modified by Orange Pi Zero2w to the Android source code268</lispan>'''| '''<span style="color:#FF0000">PI12</olspan>''' test@test:~$ | '''cp -rf opizero2w_android12_patches/* H618-Android12-Src<span style="color:#FF0000">PWM2</span>''' | '''<span idstyle="compile-the-source-code-of-android-12color:#FF0000">33</span>'''|-| '''258'''| '''PI2'''| style== Compile the source code of Android 12 =="text-align: left;"|| '''35'''|-| '''Android12 is compiled on an x86_64 computer with Ubuntu 22.04 installed. Other versions of Ubuntu system package dependencies may have some differences. The image download address of the Ubuntu 22.04 amd64 version is as follows:272'''| '''PI16'''[https| style="text-align://repo.huaweicloud.com/ubuntuleft;"|| '''37'''|-releases/22.04/ubuntu| style="text-22.04.2align: left;"|| style="text-desktop-amd64.iso align: left;"|| '''GND'''| '''39'''https|}{| class="wikitable" style="width://repo.huaweicloud.com/ubuntu390px;margin-releases/22.04/ubunturight: 20px;text-22.04.2align: center;"|-desktop-amd64.iso| '''Pin''']| '''Function'''| '''GPIO''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'| '''GPIO NO.'''|-| '''2'''# First install the software packages needed to compile Android12 source code| '''5V'''| style="text-align: left;"|test@test| style="text-align:~$ left;"||-| '''sudo apt-get update4''' test@test:~$ | '''5V'''sudo apt| style="text-get install align: left;"|| style="text-y git gnupg flex bison gperf buildalign: left;"||-essential \| '''6''' | '''GND'''zip curl zlib1g| style="text-dev gccalign: left;"|| style="text-multilib g++align: left;"||-multilib libc6-dev-i386 \| '''8'''| '''UART0_TX'''| '''lib32ncurses5PH0'''| '''224'''|-dev x11proto-core-dev libx11-dev lib32z1-dev ccache \| '''10'''| '''UART0_RX'''| '''PH1'''| '''225'''libgl1|-mesa| '''12'''| style="text-dev libxml2-utils xsltproc unzip u-boot-tools python-is-python3 \align: left;"|| '''PI1'''| '''257'''|-| '''libssl-dev libncurses5 clang gawk14'''| '''GND'''<ol start| style="2text-align: left;" || style="listtext-style-typealign: decimalleft;">||-| '''<li><pspan style="color:#FF0000">Then compile the code in the longan folder, which mainly contains u-boot and linux kernel16</pspan>'''| '''<ol span style="list-style-typecolor: lower-alpha;#FF0000">PWM4<li/span>First run '''./build.sh config| ''' to set compilation options</lispan style="color:#FF0000">PI14</olspan>'''| '''</lispan style="color:#FF0000">270</olspan>'''|-| '''18'''test@test| style="text-align:~$ left;"|| '''cd H618-Android12-Src/longanPH4'''| '''228'''test@test:~/H618|-Android12-Src/longan$ | '''./build.sh config20'''| '''GND'''Welcome to mkscript setup progress| style="text-align: left;"| All available platform| style="text-align:left;"||-0. android| '''22'''| '''UART2_RX'''1. linux| '''PI6''' Choice [android]: | '''0262'''|-All available ic:| '''24'''| '''SPI1_CS0'''0. h618| '''PH5'''Choice [h618]: | '''0229'''|-All available board:| '''26'''| '''SPI1_CS1'''0. ft| '''PH9'''| '''233'''1. p1|-| '''28'''2. p2| '''TWI2-SCL'''| '''PI9'''3. p7| '''265'''|-4. p7l| '''30'''| '''GND'''5. perf1| style="text-align: left;"|| style="text-align: left;"|6. perf2|-| '''<span style="color:#FF0000">32</span>'''7. perf3| '''<span style="color:#FF0000">PWM1</span>''' 8. qa Choice [p2]| '''<span style="color: #FF0000">PI11</span>'''2| ''' All available flash<span style="color:#FF0000">267</span>'''|-0. default 1. nor| '''34'''Choice [default]: | '''0GND'''| style="text-align: left;"|All available kern_ver| style="text-align:left;"| 0. linux|-5.4| '''36'''Choice [linux| style="text-5.4]align: left;"|| '''0PC12'''| '''76'''All available arch:|-| '''38'''0. arm| style="text-align: left;"|| '''PI4'''1. arm64| '''260'''|-Choice [arm64]: | '''140'''| style="text-align: left;"|| '''......PI3''' *** Default configuration is based on | '''259''sun50iw9p1smp_h618_android_defconfig'|}#</div> # configuration written to .config # make[1]: Leaving directory '/home/test/H618<ol start="2" style="list-Android12style-Srctype: decimal;"><li>First click the wiringOP icon to open wiringOP APP</longan/out/kernel/build'li> make[[File: Leaving directory '/home/test/H618-Android12-Src/longan/kernel/linuxzero2w-5img351.4' INFO: clean buildserver INFO: prepare_buildserverpng]]</ol><ol start="23" style="list-style-type: lower-alphadecimal;"><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> [[File:zero2w-img380.png]]</ol><ol start="4" style="list-style-type: decimal;"><li>The PWM test@testinterface is as follows</li> <div class="figure"> [[File:~/H618zero2w-Android12-Srcimg381.png]] </longan$ '''.div></build.sh'''ol><ol start="35" style="list-style-type: lower-alphadecimal;"><li>After compilation Then set which PWM you want to use in the Channel. The default is completedPWM1. If you want to set it to PWM2, you will see just enter 2 in the following outputChannel. PWM3 and PWM4 and so on.</li> [[File:zero2w-img382.png]]</ol><ol start="6" style="list-style-type: decimal;">sun50iw9p1 compile Kernel successful<li>Then you can set the PWM period. The default configuration is '''50000ns'''. The converted PWM frequency is '''20KHz'''</li> INFO[[File: Prepare toolchain ..zero2w-img383.png]]</ol><ol start="7" style="list-style-type: decimal;"><li>Then click the '''......EXPORT''' INFO: build kernel OK.button to export PWM</li>
INFO[[File: build rootfs .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>
INFO[[File: skip make rootfs for androidzero2w-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'''|-| style="text-align: center;"| 2023-09-14| orangepizero2w_1.0.0_debian_bullseye_server_linux5.4.125.7z orangepizero2w_1.0.0_ubuntu_focal_server_linux5.4.125.7z orangepizero2w_1.0.0_ubuntu_focal_desktop_xfce_linux5.4.125.7z orangepizero2w_1.0.0_debian_bullseye_desktop_xfce_linux5.4.125.7z  orangepizero2w_1.0.0_ubuntu_jammy_server_linux6.1.31.7z orangepizero2w_1.0.0_debian_bookworm_server_linux6.1.31.7z orangepizero2w_1.0.0_debian_bullseye_server_linux6.1.31.7z orangepizero2w_1.0.0_ubuntu_jammy_desktop_xfce_linux6.1.31.7z orangepizero2w_1.0.0_debian_bookworm_desktop_xfce_linux6.1.31.7z orangepizero2w_1.0.0_debian_bullseye_desktop_xfce_linux6.1.31.7z  OrangePi_Zero2w_Android12_v1.0.tar.gz 
Opios-arch-aarch64-xfce-opizero2w-23.09-linux6.1.31.img.xz