Open main menu

Wiki-Orange Pi β

Changes

Orange Pi CM4

1,439 bytes added, 19:55, 19 September 2023
Download orangepi-build from github
<big>'''Top view:'''</big><br>
[[File:cm4-img3.png|800px]]
<big>'''Bottom view:'''</big>
[[File:cm4-img4.png|800px]]
<span id="top-and-bottom-views-of-the-orange-pi-cm4-base-board"></span>
<big>'''Top view:'''</big>
[[File:cm4-img5.png|800px]]
<big>'''Bottom view:'''</big>
[[File:cm4-img6.png|800px]]
<span id="the-interface-details-of-orange-pi-cm4"></span>
<div class="figure">
[[File:cm4-img7.png|800px]]
</div>
<span id="interface-details-of-orange-pi-cm4-base-board"></span>
 
=== Interface details of Orange Pi CM4 base board ===
<div class="figure">
[[File:cm4-img8.png|800px]]
</div>
</div></li>
<li><p>'''3.3V''' USB to TTL module and DuPont line, when using serial port debugging function, need USB to TTL module and DuPont line to connect the development board and computer</p>
<p>[[File:cm4-img19.png|350px]] [[File:cm4-img20.png|450px]]</p></li>
<li><p>Personal computer with Ubuntu and Windows operating systems installed</p>
<li><p>Click the &quot;'''Driver Installation'''&quot; button</p>
<p>[[File:cm4-img34.png]]</p></li>
<li><p>Wait for a period of time, the pop-up window will prompt &gt; &quot;'''Driver installation successful'''&quot;, and then click the &gt; &quot;'''OK'''&quot; button</p>
<p>[[File:cm4-img35.png]]</p></li></ol>
</li>
<li><p>Then start burning the Linux image to the SSD</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First, connect the development board to the Windows computer &gt; through the USB2.0 male-to-public data cable. The position of &gt; the USB2.0 burning interface on the development board is shown &gt; in the figure below</p>
<p>[[File:cm4-img38.png]]</p></li>
<li><p>Ensure that no TF card is inserted into the development board &gt; and no power supply is connected</p></li><li><p>Then press and hold the MaskROM button on the development board. &gt; The position of the MaskROM button on the development board is &gt; shown as follows:</p>
<p>[[File:cm4-img39.png]]</p></li>
<li><p>Then connect the Type-C interface to the development board, and &gt; power on, and then you can release the MaskROM button</p>
<p>[[File:cm4-img40.png]]</p></li>
<li><p>If the previous steps are smooth, the development board will &gt; enter '''MASKROM''' mode at this time, and the interface of the &gt; burning tool will prompt &quot;'''Found a MASKROM device'''&quot;.</p>
<p>[[File:cm4-img41.png]]</p></li>
<li><p>Then place the mouse cursor on the field below</p>
</div></li>
<li><p>Then click the right mouse button to pop up the selection &gt; interface as shown in the following figure</p>
<p>[[File:cm4-img43.png]]</p></li>
<li><p>Then select the '''Import configuration''' option</p>
<p>[[File:cm4-img44.png]]</p></li>
<li><p>Then go to the previously downloaded '''MiniLoader''' folder, &gt; select the '''rk356x_linux_pcie.cfg''' configuration file, and &gt; click '''Open'''</p>
<div class="figure">
<li><p>Then click on the location shown in the image below</p>
<p>[[File:cm4-img77.png]]</p></li>
<li><p>Select '''MiniLoaderAll.bin''' from the '''MiniLoader''' folder &gt; downloaded earlier, and then click '''<span class="mark">Open</span>'''</p>
<div class="figure">
<li><p>Then click on the location shown in the image below</p>
<p>[[File:cm4-img78.png]]</p></li>
<li><p>Then go to the previously downloaded '''MiniLoader''' folder, &gt; select '''rkspi_loader.img''', and click '''<span class="mark">Open</span>'''</p>
<div class="figure">
<li><p>Then click on the location shown in the image below</p>
<p>[[File:cm4-img80.png]]</p></li>
<li><p>Then select the path of the Linux image you want to burn and &gt; click '''<span class="mark">Open</span>'''</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
<li><p>Then select '''<span class="mark">Force Write to address</span>'''</p>
<p>[[File:cm4-img81.png]]</p></li>
<li><p>Click the Run button again to start burning the Linux image to &gt; the SSD</p>
<p>[[File:cm4-img82.png]]</p></li>
<li><p>The display log of the S.lux image after burning is shown in the &gt; following figure</p>
<p>[[File:cm4-img83.png]]</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|}
</li>
<li><p>After the image is burned, the Linux system in the SPIFlash+PCIe &gt; SSD automatically starts. If it does not start properly, power &gt; it on again.</p></li></ol>
</li></ol>
<div class="figure">
[[File:cm4-img390.png|center|790px]]
</div>
# According to the schematic diagram of the 40pin interface, the spi available for Orange Pi 3B is spi3
::[[File:cm4-img459.png]]
<ol start="2" style="list-style-type: decimal;">
<li>Here, the SPI interface is tested through the w25q64 module. First, the w25q64 device is connected to the SPI3 interface</li></ol>
[[File:cm4-img460.png]]
</ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then click the wiringOP icon to open the wiringOP APP</li></ol>
[[File:cm4-img444.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>The main interface of wiringOP APP is displayed as shown in the figure below, click the SPI_TEST button to open the SPI test interface</li></ol>
[[File:cm4-img461.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>Then click the '''OPEN''' button to initialize the SPI</li></ol>
[[File:cm4-img462.png]]
</ol>
<ol start="6" style="list-style-type: decimal;">
<li>Then fill in the bytes that need to be sent, such as reading the ID information of w25q64, fill in the address 0x9f in data[0], and then click the '''TRANSFER''' button</li></ol>
[[File:cm4-img463.png]]
</ol>
<ol start="7" style="list-style-type: decimal;">
<li>Finally, the APP will display the read ID information</li></ol>
[[File:cm4-img464.png]]
</ol>
<ol start="8" style="list-style-type: decimal;">
<li>The MANUFACTURER ID of the w25q64 module is EFh, and the Device ID is 4017h, corresponding to the value read above (h stands for hexadecimal)</li></ol>
[[File:cm4-img465.png]]
</ol>
<span id="pin-pwm-test"></span>
<span id="pin-pwm-test"></span>
=== 40pin PWM test ===
# Android enables '''PWM11''' by default, and the corresponding pin is located at 40pin as shown in the figure below
::[[File:cm4-img466.png]]
<ol start="2" style="list-style-type: decimal;">
<li>First click on the wiringOP icon to open the wiringOP APP</li></ol>
[[File:cm4-img444.png]]
</ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then click the '''PWM_TEST''' button on the main interface of wiringOP to enter the PWM test interface</li></ol>
[[File:cm4-img467.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>The base address corresponding to PWM11 is '''fe6f0030''', here pwmchip0 shows '''fdd70020.pwm''' on the right, then you need to click the drop-down option to select other pwmchips until '''fe6f0030.pwm''' is displayed on the right</li></ol>
[[File:cm4-img468.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>When the drop-down option selects '''pwmchip3''', the corresponding base address of PWM11 is '''fe6f0030''' on the right</li></ol>
[[File:cm4-img469.png]]
</ol>
<ol start="6" style="list-style-type: decimal;">
<li>Then confirm the PWM channel, the default is channel 0, and confirm the PWM cycle, the default configuration is '''50000ns''', converted to PWM frequency is '''20KHz''', you can modify it yourself, click the '''EXPORT''' button to export '''PWM11'''</li></ol>
[[File:cm4-img470.png]]
</ol>
<ol start="7" style="list-style-type: decimal;">
<li>Then drag the drag bar below to change the PWM duty cycle, and then check Enable to output the PWM waveform</li></ol>
[[File:cm4-img471.png]]
</ol>
<ol start="8" style="list-style-type: decimal;">
<li>Then use an oscilloscope to measure the No. 32 pin in the 40pin of the development board, and you can see the following waveform</li></ol>
[[File:cm4-img472.png]]
</ol>
<span id="how-to-use-adb"></span>
<span id="how-to-use-adb"></span>
== How to use ADB ==
=== The method of USB OTG mode switching ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''The development board has 4 USB interfaces, among which the USB interface marked in red box in the figure below can support both Host mode and Device mode, and the other 3 USB interfaces only support Host mode.'''</big>
[[File:cm4-img473.png|center]]
<big>'''The USB OTG interface defaults to Host mode, which can be used to connect USB devices such as mouse and keyboard. If you want to use ADB, you need to <span style="color:#FF0000">manually </span>switch to Device mode.'''</big>|}
<ol style="list-style-type: decimal;">
<li><p>Then select '''Developer options''' in the expanded column</p>
<p>[[File:cm4-img479.png]]</p></li>
<li><p>Finally find the '''USB OTG Mode Switch''' switch, '''<span style="color:#FF0000">turn on the switch to switch to Device mode, turn off the switch to switch to Host mode</span>'''</p></li></ol>
[[File:cm4-img480.png]]
</ol>
<span id="use-the-data-cable-to-connect-to-adb-debugging"></span>
<span id="use-the-data-cable-to-connect-to-adb-debugging"></span>
=== Use the data cable to connect to adb debugging ===
</div></li>
<li><p>Then refer to [[\lOrange Pi CM4#The method of USB OTG mode switching|'''the method of USB OTG mode switching''']] to switch USB OTG to Device mode</p></li>
<li><p>Then connect the development board to the Ubuntu PC through the USB2.0 male-to-male data cable. The position of the USB OTG interface on the development board is shown in the figure below:</p>
<p>[[File:cm4-img481.png]]</p></li>
<li><p>Then install the adb tool on the Ubuntu PC</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''sudo apt update'''</p>
<p>test@test:~$ '''sudo apt -y install adb'''</p>|}</li>
<li><p>You can view the identified ADB devices through the following command</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''adb devices'''</p>
<p>List of devices attached</p>
<p>S63QCF54CJ device</p>
<p>test@test:~$ '''lsusb'''</p>
<p>Bus 003 Device 006: ID 2207:0006</p>|}</li><li><p>Then you can log in to the android system through the adb shell on the Ubuntu PC</p></li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~$ '''adb shell'''
console:/ $
|}</ol>
<ol start="7" style="list-style-type: decimal;">
<li>Execute the following command to remount the Android system</li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~$ '''adb root'''
test@test:~$ '''adb remount'''
|}</ol>
<ol start="8" style="list-style-type: decimal;">
<li>Then you can transfer files to the Android system</li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~$ '''adb push example.txt /system/'''
|}
</ol>
<span id="use-network-connection-adb-debugging"></span>
<span id="use-network-connection-adb-debugging"></span>
=== Use network connection adb debugging ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Using the network adb does not require a data cable to connect the computer and the development board, but to communicate through the network, so first make sure that the wired or wireless network of the development board is connected, and then obtain the IP address of the development board, which will be used later.'''</big>|}
<ol style="list-style-type: decimal;">
<li><p>Make sure that the '''service.adb.tcp.port''' of the Android system is set to port number 5555</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>console:/ # '''getprop | grep &quot;adb.tcp&quot;'''</p>
<p>[service.adb.tcp.port]: ['''5555''']</p>|}</li><li><p>If '''service.adb.tcp.port''' is not set, you can use the following command to set the port number of network adb</p></li></ol>{| class="wikitable" style="width:800px;" |-|
console:/ # '''setprop service.adb.tcp.port 5555'''
console:/ # '''start adbd'''
|}</ol>
<ol start="3" style="list-style-type: decimal;">
<li><p>Install adb tool on Ubuntu PC</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''sudo apt update'''</p>
<p>test@test:~$ '''sudo apt install -y adb'''</p>|}</li>
<li><p>Then connect to the network adb on the Ubuntu PC</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''adb connect 192.168.1.xxx''' '''(IP地址需要修改为开发板的IP地址)'''</p>
<p>* daemon not running; starting now at tcp:5037</p>
<p>* daemon started successfully</p>
<p>connected to 192.168.1.xxx:5555</p>
 
 
<p>test@test:~$ '''adb devices'''</p>
<p>List of devices attached</p>
<p>192.168.1.xxx:5555 device</p>|}</li><li><p>Then you can log in to the android system through the adb shell on the Ubuntu PC</p></li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~$ '''adb shell'''
console:/ #
|}</ol>
<span id="how-to-compile-android11-source-code"></span>
</li>
<li><p>After downloading the sub-volume compression package of the Android 11 source code, please check whether the MD5 checksum is correct, if not, please download the source code again</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''md5sum -c RK356X_Android11.tar.gz.md5sum'''</p>
<pstyle="color:#FF0000">'''RK356X_Android11.tar.gz00: OK'''</p><pstyle="color:#FF0000">'''RK356X_Android11.tar.gz01: OK'''</p><pstyle="color:#FF0000">'''RK356X_Android11.tar.gz02: OK'''</p><pstyle="color:#FF0000">'''RK356X_Android11.tar.gz03: OK'''</p><pstyle="color:#FF0000">'''RK356X_Android11.tar.gz04: OK'''</p><pstyle="color:#FF0000">'''RK356X_Android11.tar.gz05: OK'''</p><pstyle="color:#FF0000">'''RK356X_Android11.tar.gz06: OK'''</p>|}</li><li><p>Then you need to merge multiple compressed files for decompression</p></li></ol>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''cat RK356X_Android11.tar.gz0gz<span style="color:#FF0000">0</span>* | tar -xvzf -'''|}</ol><span id="compile-the-source-code-of-android-11"></span>
<span id="compile-the-source-code-of-android-11"></span>
== Compile the source code of Android 11 ==
<ol style="list-style-type: decimal;">
<li><p>First install the software packages required to compile the Android11 source code</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''sudo apt-get update'''</p>
<p>test@test:~$ '''sudo apt-get install -y git gnupg flex bison gperf build-essential \'''</p>
<p>'''zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 libncurses5 \'''</p>
<p>'''lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev ccache \'''</p>
<p>'''libgl1-mesa-dev libxml2-utils xsltproc unzip liblz4-tool'''</p>|}</li>
<li><p>There is a build.sh compilation script in the source code, and the compilation parameters are as follows</p>
<ol style="list-style-type: lower-alpha;">
<li><p>-'''U''':Compile uboot</p></li><li><p>-'''K''':Compile kernel</p></li><li><p>-'''A''':compile android</p></li><li><p>-'''u''':Package and generate update.img and update_spi_nvme.img</p></li><li><p>-'''o''':Compile OTA package</p></li><li><p>-'''d''':Specify kernel dts</p></li></ol>
</li>
<li><p>Compile uboot, kernel, android and package them into update.img</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The command to compile and support HDMI 4K display mirroring &gt; (LCD is turned off by default) is as follows:</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''cd RK356X_Android11'''</p>
<p>test@test:~/ RK356X_Android11$ '''export BOARD=orangepi3b'''</p>
<p>test@test:~/ RK356X_Android11$ '''source build/envsetup.sh'''</p>
<p>test@test:~/ RK356X_Android11$ '''lunch rk3566_r-userdebug'''</p>
<p>test@test:~/ RK356X_Android11$ '''./build.sh -AUKu'''</p>|}</li>
<li><p>The command to compile and support LCD display mirroring (HDMI &gt; is disabled by default) is as follows:</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''cd RK356X_Android11'''</p>
<p>test@test:~/ RK356X_Android11$ '''export BOARD=orangepi3b'''</p>
<p>test@test:~/ RK356X_Android11$ '''source build/envsetup.sh'''</p>
<p>test@test:~/ RK356X_Android11$ '''lunch rk3566_r-userdebug'''</p>
<p>test@test:~/ RK356X_Android11$ '''./build.sh -AUKu'''</p>|}</li></ol>
</li>
<li><p>After the compilation is complete, the following information will be printed</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>********rkImageMaker ver 2.1********</p>
<p>Generating new image, please wait...</p>
<p>Making update_spi_nvme.img OK.</p>
<p>Make update image ok!</p>
<p>/wspace3/RK3566/RK356X_Android11</p>|}</li>
<li><p>The final image file will be placed in the '''rockdev/Image-rk3566_r/''' directory. Among them, '''update.img''' is the boot image that supports TF card and eMMC, and '''update_spi_nvme.img''' is the boot image of NVME SSD</p>
{| class="wikitable" style="width:800px;" |-| <p>[mailto:test@test:~OrangePi_4/rk3399-android-8.1$ test@test:~/RK356X_Android11$] '''cd rockdev/Image-rk3566_r'''</p><p>[mailto:test@test:~OrangePi_4/rk3399-android-8.1$ test@test:~/RK356X_Android11/rockdev/Image-rk3566_r $] '''ls update*'''</p><p>update.img update_spi_nvme.img</p>|}</li></ol>
<span id="appendix"></span>
== User Manual Update History ==
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''Version'''
<span id="image-update-history"></span>
 
== Image Update History ==
{| class="wikitable" style="width:800px;"
|-
| style="text-align:center;" | '''Date'''| style="text-align:center;" | '''Update Notes'''
|-
| style="text-align:center;" | 2023-08-29
|
Orangepicm4_1.0.0_ubuntu_focal_server_linux5.10.160.7z
Orangepicm4_1.0.0_debian_bookworm_desktop_xfce_linux5.10.160.7z
 
OrangePiCM4_RK3566_Android11_v1.0.0.tar.gz
OrangePiCM4_RK3566_Android11_lcd_spi-nvme_v1.0.0.tar.gz
 
* initial version
|-
| style="text-align:center;" | 2023-09-05| Opios-arch-aarch64-xfce-opicm4-23.09-linux5.10.160.img.xz 
* initial version
|}