Orange Pi Zero2 User manual

Orange Pi Zero 2
User Manual

1
Content
1. Basic features of Orange Pi Zero 2.................................................................................................. 3
1.1. What is Orange Pi Zero 2?.................................................................................................3
1.2. The uses of Orange Pi Zero 2...............................................................................................3
1.3. Who’s it for?.........................................................................................................................3
1.4. Hardware Specification of Orange Pi Zero 2.......................................................................4
1.5. Top and bottom views of Orange Pi Zero 2.........................................................................5
1.6. Orange Pi Zero 2 interface details....................................................................................... 6
2. Introduction to the use of the development board.......................................................................... 7
2.1. Prepare the necessary accessories........................................................................................7
2.2. Download the image and relevant documents...................................................................10
2.3. Method to flash Linux image to MicroSD card based on Windows PC........................... 11
2.4. Method to flash Linux image to MicroSD card based on Ubuntu PC.............................. 13
2.5. Method of flashing Android firmware to MicroSD card...................................................15
2.6. Start the Orange Pi development board.............................................................................18
2.7. How to use the debug serial port?......................................................................................19
2.7.1. Debug serial port connection instructions.............................................................. 19
2.7.2. How to use the debug serial port on the Ubuntu platform?....................................20
2.7.3. How to use the debug serial port on the Windows platform?................................ 22
3. Linux OS instructions....................................................................................................................25
3.1. Supported Linux distribution types and kernel versions................................................... 25
3.2. linux4.9 kernel driver adaptation status.............................................................................25
3.3. Linux OS default login account and password..................................................................25
3.4. Onboard LED light display description.............................................................................25
3.5. Instructions for the automatic login of Linux desktop version OS................................... 26
3.6. Start the rootfs in the auto-expanding TF card for the first time.......................................27
3.7. How to modify the linux log level (loglevel)?...................................................................27
3.8. Ethernet port test................................................................................................................ 28
3.9. SSH remote login development board...............................................................................29
3.9.1. SSH remote login development board under Ubuntu.............................................29
3.9.2. SSH remote login development board under Windows......................................... 30
3.10. HDMI display test............................................................................................................31
3.11. HDMI resolution setting.................................................................................................. 31
3.12. How to modify the width and height of Framebuffer?..................................................32
3.13. WIFI connection test........................................................................................................34
3.13.1. Test method of Linux server version image......................................................... 34
3.13.2. Test method of Linux desktop version image.......................................................37
3.14. How to use Bluetooth?...................................................................................................39
3.14.1. Test method of desktop version image................................................................. 39
3.14.2. How to use the server version image?................................................................42
3.15. USB interface test............................................................................................................ 44

2
3.15.1. Connect mouse or keyboard test...........................................................................44
3.15.2. Connect USB storage device test..........................................................................44
3.16. USB camera test...............................................................................................................45
3.17. 13 Pin transfer board interface pin description................................................................47
3.18. Audio test..........................................................................................................................48
3.18.1. Headphone jack play audio test............................................................................ 48
3.18.2. HDMI audio playback test....................................................................................50
3.19. IR receiving test............................................................................................................... 50
3.20. Hardware watchdog test...................................................................................................51
3.21. Temperature sensor.......................................................................................................... 52
3.22. How to install Docker...................................................................................................... 53
3.23. 26pins GPIO, I2C, UART, SPI test..................................................................................54
3.23.1. 26 Pins description................................................................................................54
3.23.2. Install wiringOP....................................................................................................54
3.23.3. Test common GPIO port....................................................................................... 55
3.23.4. SPI test.................................................................................................................. 57
3.23.5. I2C test.................................................................................................................. 58
3.23.6. UART test..............................................................................................................59
3.24. Method of redirecting kernel console output to serial port ttyS5....................................60
3.25. SPI Nor Flash test............................................................................................................ 61
4. Linux SDK instructions.................................................................................................................63
4.1. Get the source code of Linux SDK....................................................................................63
4.2. Download the compilation toolchain.................................................................................64
4.3. Compile u-boot...................................................................................................................65
4.4. Compile the Linux kernel.................................................................................................. 69
4.5. Compile rootfs....................................................................................................................73
4.6. Compile linux image..........................................................................................................75
5. Android OS instructions................................................................................................................ 77
5.1. Supported Android version................................................................................................ 77
5.2. Android 10 feature adaptation............................................................................................77
5.3. Onboard LED light display description.............................................................................78
5.4. How to use ADB?...............................................................................................................78
5.4.1. Open USB debugging option..................................................................................78
5.4.2. Use data cable to connect adb debugging...............................................................79
5.4.3. Use network connection adb debugging.................................................................80
5.5. How to use a USB camera................................................................................................. 81
5.6. Android OS ROOT description..........................................................................................82
6. Android SDK instructions.............................................................................................................84
6.1. Download the source code of android SDK...................................................................... 84
6.2. Build android compilation environment............................................................................85
6.3. Compile android image......................................................................................................86
6.3.1. Compile the kernel..................................................................................................86
6.3.2. Compile android source code................................................................................. 87

3
1. Basic features of Orange Pi Zero 2
1.1. What is Orange Pi Zero 2?
Orange Pi is an open-source single board computer, a new generation of ARM64
development board, which can run OS such as Android 10.0, Ubuntu and Debian, and
so on. Orange Pi Zero 2 uses the Allwinner H616 system-on-chip and has
512MB/1GB DDR3 memory
1.2. The uses of Orange Pi Zero 2
We can use it to build:
●A computer
●A wireless server
●Games
●Music and Sounds
●HD video
●A Speaker
......
Pretty much anything else, because Orange Pi Zero2 is open source
1.3. Who’s it for?
Orange Pi Zero 2 is for anyone who wants to start creating with technology – not just
consuming it. It's a simple, fun, useful tool that you can use to start taking control of
the world around you.

4
1.4. Hardware Specification of Orange Pi Zero 2
Hardware Specification
CPU
Allwinner H616 64-bit 1.5GHz high-performance Quad-core Cortex-
A53 processor
GPU
Mali G31 MP2
Supports OpenGL ES 1.0/2.0/3.2、OpenCL 2.0
Memory(SDRAM)
512MB/1GB DDR3 (Shared with GPU)
Onboard Storage
MicroSD card slot、2MB SPI Flash
Onboard Network
Support 1000M/100M/10M Ethernet
Onboard WIFI+BT
• AW859A Chip
• Support IEEE 802.11 a/b/g/n/ac
• Support BT5.0
Video Outputs
• Micro HDMI 2.0a up to 4K@60fps
• TV CVBS output, Support PAL/NTSC (Via 13pin interface
board)
Audio output
• Micro HDMI
• 3.5mm audio port (Via 13pin interface board)
Power Source
Type-C interface 5V/2A input
USB 2.0 Ports
3*USB 2.0 HOST(Two of them are via 13pin interface board)
26pin header
with I2C, SPI, UART and multiple GPIO ports
13pin header
with 2*USB Host, IR pin, Tv-out 、Audio (no MIC) and 3 GPIO
ports
Debug serial port
UART-TX、UART-RX and GND
LED
Power led & Status led
IR receiver
Support IR remote control (via 13pin interface board)
Supported OS
Android10.0、Ubuntu、Debian
Appearance specification
Dimension
85mm×56mm
Weight
30g
range Pi™ is a trademark of the Shenzhen Xunlong Software CO., Limited

5
1.5. Top and bottom views of Orange Pi Zero 2
Top view
Bottom view:

6
1.6. Orange Pi Zero 2 interface details

7
2. Introduction to the use of the development board
2.1. Prepare the necessary accessories
1) MicroSD card, a high-speed card above class 10 with a minimum capacity of 8GB,
it is recommended to use SanDisk’s MicroSD card. Orange Pi uses SanDisk’s
MicroSD card with all the tests. Other brands of TF cards may cause the OS to fail to
start.
2) TF card reader used to read and write MicroSD card
3) Micro HDMI to HDMI cable used to connect the development board to an HDMI
monitor or TV for display

8
4) Power Supply: Using a USB Type C interface data cable and a 5V/2A or 5V/3A
high-quality power adapter
5) 13-Pin expansion board
a. The expansion board is as shown in the following picture
b. The 13-Pin header on the Orange Pi Zero 2 development board can be
connected to an expansion board to expand the functions that are not on the
development board. The expansion board includes functions
1
MIC
Not Support
2
Analog audio and
video output interface
Can be used to connect headphones to play music,
or connect to the TV through AV cable to output
analog audio and video signals (Android OS only)
3
USB2.0 x 2
Used to connect USB keyboard, mouse and USB
storage device
4
IR function
Android OS can be controlled by IR remote control
c. The schematic diagram of the 13-Pin header on the Orange Pi Zero 2
development board is shown below

9
6) USB mouse and keyboard, as long as it is a standard USB mouse and keyboard, the
mouse and keyboard can be used to control the Orange Pi development board
7) IR remote control mainly used to control the Android OS
8) 100M or 1000M network cable used to connect the development board to the
Internet
9) AV cable, if you want to display video through the CVBS interface instead of
HDMI interface, then you need to connect the development board to the TV through
the AV cable
10) USB to TTL module and DuPont cable. When using the serial port debugging

10
function, you need USB to TTL module and DuPont cable to connect the development
board and the computer
11) A personal computer with Ubuntu and Windows operating OS
1
Ubuntu14.04 PC
Optional, used to compile Android source code
2
Ubuntu18.04 PC
Optional, used to compile Linux source code
3
Windows PC
Used to flash Android and Linux images
2.2. Download the image and relevant documents
1) The download URL of the Chinese version is
http://www.orangepi.cn/downloadresourcescn/
2) The download URL of the English version is
http://www.orangepi.org/downloadresources/
3) The information mainly contains
a. Android source code: saved on Baidu Cloud Disk and Google Cloud Disk
b. Linux source code: saved on GitHub, the link URL is
https://github.com/orangepi-xunlong/orangepi-build
c. User manual and schematic diagram: chip related data manual will also be
placed here

11
d. Official tools: mainly include the software needed during the use of the
development board
e. Android image: saved on Baidu Cloud Disk and Google Cloud Disk
f. Ubuntu image: saved on Baidu Cloud Disk and Google Cloud Disk
g. Debian image: saved on Baidu Cloud Disk and Google Cloud Disk
2.3. Method to flash Linux image to MicroSD card based on
Windows PC
1) First, prepare a MicroSD card with 8GB or larger capacity. The transmission speed
of the MicroSD card must be above class10. It is recommended to use a brand
MicroSD card such as SanDisk.
2) Then use a card reader to insert the MicroSD card into the computer
3) Then format the MicroSD card
a. You can use the SD Card Formatter software to format the MicroSD card, the
download URL is
https://www.sdcard.org/downloads/formatter/eula_windows/SDCardFormatterv5_Win
EN.zip
b. After downloading, just unzip and install, then open the software
c. If the computer has only inserted a MicroSD card, the “Select card” column
will display the drive letter of the MicroSD card. If the computer has multiple
USB storage devices inserted, you can select the drive letter corresponding to
the MicroSD card through the drop-down box
d. Then click "Format", a warning box will pop up before formatting, and
formatting will start after selecting "Yes (Y)"

12
e. After formatting the MicroSD card, the message shown below will pop up,
click OK
4) Download the Linux operating OS image file compression package you want to
flash from download page of the Orange Pi official website, and then use the
decompression software to decompress it. In the decompressed file, the file ending
with ".img" is the operating OS image file, with a normal size Are above 1GB
5) Use Win32Diskimager to burn Linux image to MicroSD card
a. The download page of Win32Diskimager is
http://sourceforge.net/projects/win32diskimager/files/Archive/
b. Install directly after downloading, the Win32Diskimager interface is shown
below
a) First, select the path of the image file
b) Then confirm that the drive letter of the MicroSD card is consistent with
the one displayed in the "Device" column
c) Finally, click "write" to start flash

13
c. After the image is written, click the "Exit" button to exit, and then you can
pull out the MicroSD card and insert it into the development board to boot
2.4. Method to flash Linux image to MicroSD card based on
Ubuntu PC
1) First, prepare a Micro card with 8GB or larger capacity. The transmission speed of
the MicroSD card must be above class10. It is recommended to use a brand MicroSD
card such as SanDisk.
2) Then use a card reader to insert the MicroSD card into the computer
3) Download balenaEtcher software, the download URL is
https://www.balena.io/etcher/
4) After entering the balenaEtcher download page, please select the Linux version of
the software through the drop-down box to download

14
5) After downloading, use unzip to decompress. The decompressed balenaEtcher-
1.5.109-x64.AppImage is the software needed to burn Linux image
test@test:~$ unzip balena-etcher-electron-1.5.109-linux-x64.zip
Archive: balena-etcher-electron-1.5.109-linux-x64.zip
inflating: balenaEtcher-1.5.109-x64.AppImage
test@test:~$ ls
balenaEtcher-1.5.109-x64.AppImage balena-etcher-electron-1.5.109-linux-x64.zip
6) Download the Linux operating OS image file compression package you want to
burn from the Orange Pi data download page, and then use the decompression
software to decompress it. In the decompressed file, the file ending with ".img" is the
operating OS image file. The size is generally above 1GB
a. The decompression command of the compressed package at the end of 7z is
as follows:
test@test:~$ 7z x Orangepizero2_2.0.8_ubuntu_bionic_server_linux4.9.170.7z
test@test:~$ ls Orangepizero2_2.0.8_ubuntu_bionic_server_linux4.9.170.*
Orangepizero2_2.0.8_ubuntu_bionic_server_linux4.9.170.7z
Orangepizero2_2.0.8_ubuntu_bionic_server_linux4.9.170.img.sha # Checksum file
Orangepizero2_2.0.8_ubuntu_bionic_server_linux4.9.170.img #Image file
7) After decompressing the image, you can first use the sha256sum -c *.sha command
to calculate whether the checksum is correct. If the prompt is successful, it means that
the downloaded image is correct, and you can safely flash it to the MicroSD card. If
the checksum does not match, it means there is a problem with the downloaded image,
please try to download again
test@test:~$ sha256sum -c *.sha
Orangepizero2_2.0.8_ubuntu_bionic_server_linux4.9.170.img: success
8) Then double-click balenaEtcher-1.5.109-x64.AppImage on the graphical interface
of Ubuntu PC to open balenaEtcher (no installation required), the opened interface is
as shown in the figure below
a. First, select the path of the Linux image file
b. Then select the device number of the TF card
c. Finally, click Flash to start burning

15
9) The writing process will prompt the writing speed and remaining time
10) After burning, the following interface will be displayed, then you can unplug the
MicroSD card from the computer and insert it into the development board to start
2.5. Method of flashing Android firmware to MicroSD card
The Android image can only be flashed to MicroSD card using PhoenixCard

16
software under the Windows platform, but cannot be burned under Linux
platform
1) First, prepare a MicroSD card with 8GB or larger capacity. The transmission speed
of the TF card must be above class10. It is recommended to use a brand MicroSD
card such as SanDisk.
2) Then use a card reader to insert the MicroSD card into the computer
3) Download the Android 10 OS and PhoenixCard flashing tool from Orange Pi's data
download page. Please make sure that the PhonenixCard tool version is
PhonenixCard-v4.2.3. Tools below this version will have problems flashing to the
Android 10 OS.
4) Use the decompression software to decompress the downloaded Android OS
compressed package. In the decompressed file, the file ending with ".img" is the
Android image file
5) Use decompression software to decompress PhonenixCard-v4.2.3.zip, this software
does not need to be installed, you can find PhoenixCard in the decompressed folder
and open it
6) After opening PhoenixCard, if the MicroSD card is recognized normally, the drive
letter and capacity of the MicroSD card will be displayed in the middle list. Please
make sure that the displayed drive letter is consistent with the drive letter of the
MicroSD card you want to burn. If there is no display, you can try to remove and
insert the MicroSD card, or click the Refresh Drive letter button in PhoenixCard
7) After confirming the drive letter, format the MicroSD card first, click the "Restore"
button in PhoenixCard, or use the aforementioned SD Card Formatter to format the

17
MicroSD card
8) Then start to write the Android OS to MicroSD card
a. First, select the path of the Android image in the "Image" column
b. Select "Start up" in "Type of Making Card"
c. Then click the "Burn" button to start burning

18
9) After burning, the PhoenixCard will display as shown in the figure below. At this
time, click the "Close" button to exit PhoenixCard, and then you can unplug the
MicroSD card from the computer and insert it into the development board to start
2.6. Start the Orange Pi development board
1) Insert MicroSD card with well-flashed image into the MicroSD card slot of the
Orange Pi development board
2) The development board has a Micro HDMI interface, you can connect the
development board to a TV or HDMI display through a Micro HDMI to HDMI cable
3) Connect the USB mouse and keyboard to control the Orange Pi development board
4) The development board has an Ethernet port, which can be plugged into the
network cable for Internet access
5) A high-quality power adapter with a 5V/2A (5V/3A is also available) USB Type C
interface
a. Remember not to plug in the 12V power adapter, if you plug in the
12V power adapter, it will burn the development board
b. Many unstable phenomena during OS power-on and startup are
caused by power supply problems, so a reliable power adapter and USB
Type C data cable are very important
6) Then turn on the power adapter switch, if everything is normal, the HDMI display

19
can see the OS startup screen at this time
7) If you want to view the output information of the OS through the debug serial port,
please use the serial cable to connect the development board to the computer. For the
connection method of the serial port, please refer to the section on the use of the
debug serial port
2.7. How to use the debug serial port?
2.7.1. Debug serial port connection instructions
1) First, you need to prepare a USB to TTL module. This module can be bought in
Orange Pi stores. If there are other similar USB to TTL modules, you can also insert
the USB end of the USB to TTL module into the USB port of the computer
2) The corresponding relationship between the debug serial port GND, TX, and RX
pins of the development board is shown in the figure below
3) The GND, TX, and RX pins of the USB to TTL module need to be connected to the
debug serial port of the development board through a Dupont cable
a. Connect the GND of the USB to TTL module to the GND of the board
b. Connect the RX of the USB to TTL module to the TXD of the board
c. Connect the TX of the USB to TTL module to the RX of the board
4) The schematic diagram of connecting the USB to TTL module to the computer and
the Orange Pi development board is shown below
Table of contents
Other Orange Pi Computer Hardware manuals
Popular Computer Hardware manuals by other brands

Cypress Semiconductor
Cypress Semiconductor CY7C1345G Specification sheet

Intel
Intel SL6VU - Celeron 2.40GHz 400MHz 128KB Socket 478... specification

IBT Technologies
IBT Technologies IB980 user manual

BE QUIET!
BE QUIET! DARK ROCK PRO 4 user manual

Bitspower
Bitspower Sedna 303C installation guide

HP
HP USB 3.0 4-Port SuperSpeed PCIe x1 Card user guide