Shenzhen Orange Pi Zero Plus2 User Manual

Orange Pi Manual Copy right by Shenzhen Xunlong Software Co., Ltd
1
Orange Pi Zero Plus2(H5)
User Manual
www.orangepi.org www.xunlong.tv
Orange Pi Manual Copy right by Shenzhen Xunlong Software Co., Ltd
2
Contents
I. Orange Pi Introduction...........................................................................................................................3
II. Using Method Introduction...................................................................................................................8
III. Linux Kernel Source Code Compilation...........................................................................................36
1. Download Linux Source Code............................................................................................ 36
IV. Android Kernel Source Code Compilation.......................................................................................42
1. Install JDK...........................................................................................................................42
2. Install Platform Supported Software...................................................................................43
3. Download Android Source Package....................................................................................43
4. Install Compiler Tool Chain................................................................................................ 44
5. Compile Lichee Source Code..............................................................................................44
6. Compile Command of Android Code..................................................................................44
V. Use Project Configuration Files..........................................................................................................48
1. sys_config.fex Introduction.................................................................................................48
2. Examples..............................................................................................................................48
VI. OrangePi Driver development...........................................................................................................51
1. Device Driver and Application Programming.....................................................................51
2. Compile device driver......................................................................................................... 54
3. Cross compiler Application Program..................................................................................56
4. Running Driver and Application......................................................................................... 58
VII. Using Debug tools on OrangePi...................................................................................................... 60
1. Operation Steps on Windows.............................................................................................. 60
2. Operation Steps on Linux....................................................................................................64
www.orangepi.org www.xunlong.tv
Orange Pi Manual Copy right by Shenzhen Xunlong Software Co., Ltd
3
I. Orange Pi Introduction
1. What is Orange Pi Zero Plus2?
2. What can I do with Orange Pi Zero Plus2?
A computer
A wireless server
Games
Music and sounds
HD video
A speaker
Android
Scratch
......
3. Whom is it for?
4. Hardware specification of Orange Pi Zero Plus2
Hardware specification
CPU
Quad-core 64bit Cortex-A53
GPU
Mali450 GPU
Memory (SDRAM)
512MB DDR3 (shared with GPU)
On-board Storage
TF card (Max. 32GB) /eMMC flash(8GB)
It’s an open-source single-board computer. It can run Android 4.4(H3 version)/Android 5.1(H5 version) , Ubuntu, Debian, Rasberry Pi Image, it uses the AllWinner H3/H5 SoC, and has 512MB DDR3 SDRAM.
You can use it to build…
Pretty much anything else, because Orange Pi Zero Plus2 is open source
Orange Pi Zero Plus2 is for anyone who wants to create with technology– not just consuming. It's a simple, fun, useful tool and you can use it to take control of the world around you.
www.orangepi.org www.xunlong.tv
Orange Pi Manual Copy right by Shenzhen Xunlong Software Co., Ltd
4
On-board Wifi
AP6212, IEEE 802.11 b/g/n,BT4.2
Video Input
A CSI input connector Camera
Supports 8-bit YUV422 CMOS sensor interface
Supports CCIR656 protocol for NTSC and PAL
Supports SM pixel camera sensor Supports video capture solution up to 1080p@30fps
Video Outputs
Supports HDMI output with HDCP
Supports HDMI CEC
Supports HDMI 30 function
Power Source
USB OTG input can supply power
USB 2.0 Ports
one USB 2.0 OTG
Low-level peripherals
26 Pins Header,compatible with Raspberry Pi B+
13 Pins Header,with 2x USB, IR pin, AUDIO(MIC, AV)
GPIO(1x3) pin
UART, ground.
LED
Power led & Status led
Supported OS
Android Lubuntu, Debian, Raspberry Pi Image
Interface definition
Product size
46mm × 48mm
Weight
36g
Orange Pi™ is a trademark of the Shenzhen Xunlong Software CO., Limited
www.orangepi.org www.xunlong.tv
Orange Pi Manual Copy right by Shenzhen Xunlong Software Co., Ltd
5
Top view
Bottom view
www.orangepi.org www.xunlong.tv
Orange Pi Manual Copy right by Shenzhen Xunlong Software Co., Ltd
6
5. GPIO Specifications
Interface instructions
A 26-pin GPIO interface on the Orange Pi Zero Plus2 is the same as Model A and Model B of Raspberry Pi. The picture below is GPIO pin define of Orange Pi Zero Plus2.
www.orangepi.org www.xunlong.tv
Orange Pi Manual Copy right by Shenzhen Xunlong Software Co., Ltd
7
OrangePi_zeroplus2(H5)
CON3-P01
VCC-3V3
CON3-P02
VCC-5V
CON3-P03
TWI0-SDA
PA12
CON3-P04
VCC-5V
CON3-P05
TWI0-SCK
PA11
CON3-P06
GND
CON3-P07
PWM1
PA6
CON3-P08
UART2_TX
PA0
CON3-P09
GND
CON3-P10
UART2_RX
PA1
CON3-P11
S-TWI-SCK
PL0
CON3-P12
PD11
PD11
CON3-P13
S-TWI-SDA
PL1
CON3-P14
GND
CON3-P15
UART2_CTS
PA3
CON3-P16
TWI1-SDA
PA19
CON3-P17
VCC3V3-EXT
CON3-P18
TWI1-SCK
PA18
CON3-P19
SPI1_MOSI
PA15
CON3-P20
GND
CON3-P21
SPI1_MISO
PA16
CON3-P22
UART2_RTS
PA2
CON3-P23
SPI1_CLK
PA14
CON3-P24
SPI1_CS
PA13
CON3-P25
GND
CON3-P26
PD14
PD14
6. Specification of CSI Camera Connector
The CSI Camera Connector is a 24-pin FPC connector which can connect external camera module with proper signal pin mappings. The pin of CIS connector can be defined as follows. The connector marked with "CON 1" on the Orange Pi Zero Plus2 is camera connector.
www.orangepi.org www.xunlong.tv
Orange Pi Manual Copy right by Shenzhen Xunlong Software Co., Ltd
8
CON1-P01
NC
CON1-P02
GND
CON1-P03
TWI2-SDA
PE13
CON1-P04
VCC-CSI
CON1-P05
TWI2-SCK
PE12
CON1-P06
CSI-RESET#
PE15
CON1-P07
CSI-VSYNC
PE3
CON1-P08
CSI-STBY-EN
PE15
CON1-P09
CSI-HSYNC
PE2
CON1-P10
VDD1V8-CSI
CON1-P11
VCC-CSI
CON1-P12
CSI-D7
PE11
CON1-P13
CSI-MCLK
PE1
CON1-P14
CSI-D6
PE10
CON1-P15
GND
CON1-P16
CSI-D5
PE9
CON1-P17
CSI-PCLK
PE0
CON1-P18
CSI-D4
PE8
CON1-P19
CSI-D0
PE4
CON1-P20
CSI-D3
PE7
CON1-P21
CSI-D1
PE5
CON1-P22
CSI-D2
PE6
CON1-P23
GND
CON1-P24
AFVCC-CSI
II. Using Method Introduction
Orange Pi Zero Plus2-CSI
Follow these steps, you can configure and run your Orange Pi in a very short period of time. Boot your Orange Pi need to complete the following steps.
www.orangepi.org www.xunlong.tv
Orange Pi Manual Copy right by Shenzhen Xunlong Software Co., Ltd
9
1. Step 1: Prepare Accessories Needed
No.
Items
Requirements and Instructions
1
TF card
8GB min.; class 10. Branded TF cards would be reference which are much more reliable.
2
HDMI to HDMI
cable or HDMI to
DVI cable
HDMI to HDMI cable is used to connect HD TV or HD monitor
3
AV video cable
A standard AV video cable can be used to connect stimulated monitor if a HDMI monitor is unavailable.
4
Keyboard and
mouse
Any keyboard and mouse with USB port is applicable; Keyboard and mouse are high-power, so a USB concentrator is required.
5
Ethernet
cable/USB
WiFi(Optional)
Network is optional, It makes more convenient to
mount and upgrade software in your Orange Pi PC.
6
DC power adapter
5V/2V min. high qualified power adapter, OTG can used a power supply.
7
Audio cable
(Optional)
You can select an audio cable with 3.5mm jack to feel stereo audio.
You need at least some accessories like the following if it is your first time to use the Orange Pi(we would suggest you using the Expansion board at the same time).
HDMI to HDMI cable HDMI to DVI cable AV video cable
TF card DC power adapter Expansion Board
www.orangepi.org www.xunlong.tv
Orange Pi Manual Copy right by Shenzhen Xunlong Software Co., Ltd
10
2. Step 2: Prepare a TF Card or EMMC Image
1) Write Linux into TF Card Based on Windows Platform
a. Inserting the TF card into the computer, the capacity of the card must be
b. Formatting the TF card.
i Download tools for formatting TF card, such as TF Formatter, it
ii Unzip the downloaded files, and run setup.exe
iii In the options settings select the "format" button for quick
In order to use Orange Pi normally, you must install the operating system into TF card first.
bigger than the operating system, usually requires 8GB or bigger.
could be downloaded from:
https://www.sdcard.org/downloads/formatter_4/eula_windows/
formatting. "Format size adjustment" select "(ON)"
www.orangepi.org www.xunlong.tv
Orange Pi Manual Copy right by Shenzhen Xunlong Software Co., Ltd
11
iv Make sure the inserted TF card disk are in accordance with the
v Click the "Format" button.
c. Download the operating system image file from the download page, the
d. Unzip the downloaded file (in addition to the Android system, this
e. Right click to download the file, select "Unzip file" to write image to TF
i Download tools to write image,such as Win32 Diskimager, here is the
ii Select the image file path that has been unzipped.
iii Click "Write" button and wait for the image to write.
iv After the image is written, click "Exit" button.
chosen disk.
page address is as following:
http://www.orangepi.org/downloadresources
method can be used to burn to write, the Android system need another
burn, the following will introduce)
card
download page:
http://sourceforge.net/projects/win32diskimager/files/Archive/
www.orangepi.org www.xunlong.tv
Orange Pi Manual Copy right by Shenzhen Xunlong Software Co., Ltd
12
2) Write Linux into TF card based on Linux platform?
a. Inserting the TF card into the computer, the capacity of the card must be
b. Formatting the TF card.
i Run fdisk –l order to make sure TF disk.
ii Run umount /dev/sdxx to uninstall all partitions of TF Card.
iii Run sudo fdisk /dev/sdx order. Use o command to delete all
iv Run sudo mkfs.vfat /dev/sdx1 command to format the TF card
c. Download the OS image from download page
d. Unzip and right click the downloaded file, select " Unzip file"
e. Write image to TF card
i Run sudo fdisk –l order to make sure the TF card disk
ii make sure the image file hash key is the same as download page
iii Run umount /dev/sdxx order to uninstall all partitions in TF Card
iv Run sudo dd bs=4M if=[path]/[imagename] of=/dev/sdx to write
3) Use PhoenixCard tool to write Android image into TF card
larger than the operating system image, usually requires 4GB or greater
capacity.
partitions of TF Card, and then us n order to add a new partition, finally use w command to save and exit.
partition set up last step to FAT32 form(according to your TF card disk to replacex). Or you could skip this step since command in Linux will format TF card automatic.
http://www.orangepi.org/`downloadresources
mention(optional). It will output sha1sum [path]/[imagename], which should be same as the image paye "SHA-1"
down image file. Wait for the image to write. If it cannot work at 4M, then replace a 1M which takes more time. You can run sudo pkill –USR1 –n –x dd order to monitoring procedure.
It is impossible for Android image to be written into TF card by using
dd command under Linux or using Win32 Diskimager under Windows. Here
www.orangepi.org www.xunlong.tv
Orange Pi Manual Copy right by Shenzhen Xunlong Software Co., Ltd
13
a. Download the Android OS image and PhoenixCard tool.
b. Format the TF card c. Please make sure the inserted TF card is in accordance with the chosen
d. Click "OK" button after successfully formatted the TF card to normal.
PhoenixCard tool is applicable for Android image writing.
Download PhoenixCard from here:
https://drive.google.com/file/d/0B_VynIqhAcB7NTg2UkRDdHRWX2s/
edit?usp=sharing
Download Android OS image from here:
http://www.orangepi.org/downloadresources/
TF card, click "restore" button for TF card formatting.
www.orangepi.org www.xunlong.tv
Orange Pi Manual Copy right by Shenzhen Xunlong Software Co., Ltd
14
e. Burn the Android OS image into your TF card. Please pay attention to
f. Click "Burn" button for writing to TF card and wait for it finish
g. Click "Exit" button after burn Android image to TF card successfully.
4) Write Armbian Image into TF Card
a. Insert TF card into computer, please note that the TF card capacity must
b. Download the OS image file from the download page:
c. Write the image into TF card.
the following with red marks.
bigger than the operating system image, usually need to be 8GB or
bigger.
http://www.armbian.com/download/
www.orangepi.org www.xunlong.tv
Orange Pi Manual Copy right by Shenzhen Xunlong Software Co., Ltd
15
i Download image writing tool such as Rufus, the download page:
ii Select the image file path that has been unzipped
iii Click "start" button and wait for the image to write.
https://rufus.akeo.ie/
www.orangepi.org www.xunlong.tv
Orange Pi Manual Copy right by Shenzhen Xunlong Software Co., Ltd
16
iv After the image is written, click "close" button
5) Write Android image into EMMC
a. Download corresponding Android image and Phoenix Card writing tool.
b. Formatting SD card.
c. Make sure the Disk is same as TF card, and start formatting SD card.
d. Write Android into TF card, please note the red mark, which is different
e. Power it on, you could found that the red LED on board is flashing
6) Write Linux image into EMMC
Steps for writing image into EMMC is almost the same with writing into
TF card.
from writing into TF card.
After written image with Card production, then exit.
which means the image is writing. When the LED is off, image written
finished. Take off the TF card, then power the board on, it should run.
www.orangepi.org www.xunlong.tv
Orange Pi Manual Copy right by Shenzhen Xunlong Software Co., Ltd
17
Method 1:
a. $ sudo OrangePi_FormatEMMC.sh Formatting EMMC
Method 2:
In this section would take image: ubuntu_server_zeroplus2_H5_V0_1.img as an example to illustrate how to write Linux image into EMMC. We would recommend you use the server version image since the RAM of zero plus2 is not too big.
$ sudo OrangePi_Install_OrangePi_2_EMMC.sh Writ image into EMMC
Wait for writing finish and re-boot
$ sudo OrangePi_Settings
www.orangepi.org www.xunlong.tv
Orange Pi Manual Copy right by Shenzhen Xunlong Software Co., Ltd
18
3. Step 3: Boot your Orange Pi
1) Hardware Connection Sketch Map
Select the fourth one Storage Setting
Select the first one, Format EMMC as Normal Storage First format EMMC Select fourth one, Install Image into EMMC Install image into EMMC and re-boot
www.orangepi.org www.xunlong.tv
Orange Pi Manual Copy right by Shenzhen Xunlong Software Co., Ltd
19
Orange Pi Zero Plus2 runs on Android 5.1 system
www.orangepi.org www.xunlong.tv
Orange Pi Manual Copy right by Shenzhen Xunlong Software Co., Ltd
20
Orange Pi Zero Plus2 runs on Debian system
Orange Pi Zero Plus2 runs on Ubuntu system
www.orangepi.org www.xunlong.tv
Orange Pi Manual Copy right by Shenzhen Xunlong Software Co., Ltd
21
2) Details of Booting Steps
a. Insert the TF card with written image in to the TF card slot.
b. You could use HDMI cable to connect your Orange Pi to HDMI TV
c. There is 13pin on board which you could connect to expansion board.
d. It is the network module on board, which you can access Orange Pi
e. You could connect to a power adapter on mic USB OTG with a
or monitor.
You could also use AV interface and audio interface to connect output video and audio to analog TV or display.
For expansion board, 2USB ports, mic and IR receiver are available.
to the wired network.
power adapter up to or bigger than 5V/2A. Avoid using smaller power GSM mobile phone charger, it is not able to output 2A even if it marked "5V/2A ".
Note: Micro-USB(OTG)cannot use as power input which may cause the fail boot of the OrangePi. Only the power interface could input power.
The Orange Pi will boot in a few minutes If the above steps are successful. There will be graphical interface in he monitor. It may take a
www.orangepi.org www.xunlong.tv
Loading...
+ 47 hidden pages