Difference between revisions of "NanoPi A64"

From FriendlyELEC WiKi
Jump to: navigation, search
(Check CPU's Working Temperature)
(如何编译BSP)
Line 320: Line 320:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
==如何编译BSP==
+
==Make Your Own OS(Compile BSP)==
===准备工作===
+
===Preparations===
访问此处[https://pan.baidu.com/s/xxx 下载地址]的sources目录,下载源码nanopi-a64-bsp。<br>
+
Visit [https://pan.baidu.com/s/xxx download link] and go to the sources directory and download nanopi-a64-bsp.<br>
使用7-Zip工具解压后得到两个目录:lichee和android,也可以从github上克隆lichee源码:
+
Use the 7-zip utility to extract it and a lichee directory and an Android directory will be generated. Or you can get it from our github:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
git clone https://github.com/friendlyarm/a64_lichee.git lichee
 
git clone https://github.com/friendlyarm/a64_lichee.git lichee
 
</syntaxhighlight>
 
</syntaxhighlight>
注:lichee是全志为其CPU的板级支持包所起的项目名称,里面包含了U-boot,Linux等源码和众多的编译脚本。
+
Note: "lichee" is the project name named by Allwinner for its CPU's source code which contains the source code of U-boot, Linux kernel and various scripts.
  
编译全志A64的BSP源码包必须使用64bit的Linux PC系统,并安装下列软件包,下列操作均基于Ubuntu-14.04 LTS-64bit:
+
Compilation of the A64's BSP source code must be done under a PC running a 64-bit Linux.The following cases were tested on Ubuntu-14.04 LTS-64bit:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
sudo apt-get install gawk git gnupg flex bison gperf build-essential \
 
sudo apt-get install gawk git gnupg flex bison gperf build-essential \
Line 338: Line 338:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
===编译U-boot===
+
===Compile U-boot===
U-boot的源码目录为lichee/brandy/u-boot-2014.07,在brandy目录下有一个build.sh脚本可用于编译U-boot:
+
U-boot's source code is under the "lichee/brandy/u-boot-2014.07" directory and there is a "build.sh" script under the "brandy" directory, which is used to compile U-boot:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
cd lichee/brandy
 
cd lichee/brandy
 
./build.sh -p sun50iw1p1
 
./build.sh -p sun50iw1p1
 
</syntaxhighlight>
 
</syntaxhighlight>
注:lichee目录里内置了交叉编译器,当使用build.sh脚本进行源码编译时,会自动使用该内置的编译器,所以无需手动安装编译器。
+
Note: the "lichee" directory contains a cross-compiler which will be automatically run when you compile U-boot with "build.sh".
  
===编译Linux内核===
+
===Compile Linux Kernel===
Linux内核的源码目录为lichee/linux-3.10,在lichee目录下有一个build.sh脚本可用于编译Linux内核:
+
The Linux kernel's source code is under the "lichee/linux-3.10" directory. There is a "build.sh" file under the "lichee" directory", which is used to compile the kernel:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
cd lichee
 
cd lichee
 
echo -e "0\n2\n0\n1\n" | ./build.sh config && ./build.sh
 
echo -e "0\n2\n0\n1\n" | ./build.sh config && ./build.sh
 
</syntaxhighlight>
 
</syntaxhighlight>
生成的boot.img和内核驱动模块位于linux-3.10/output/目录下。
+
After the compilation is done a uImage and its kernel modules will be generated under "linux-3.10/output".
  
===打包系统组件===
+
===Package System Modules===
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
cd lichee
 
cd lichee
 
./build.sh pack
 
./build.sh pack
 
</syntaxhighlight>
 
</syntaxhighlight>
该命令会将所有编译生成的可执行文件(包括U-boot、Linux内核)和系统配置文件拷贝到lichee/tools/pack/out/目录以便进行统一管理。<br>
+
This command copies the generated executables including u-boot and Linux kernel and configuration files to the "lichee/tools/pack/out/" directory.<br>
: 只有运行该命令之后,才能生成能正常运行的U-boot文件。
+
Note: you will not get a workable U-boot if you don't do this.
  
===更新TF卡===
+
===Update U-boot on TF Card===
下列命令可用于更新TF卡上的U-boot:
+
Run the following commands to update the U-boot on your TF card:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
cd fa_tools
 
cd fa_tools
 
./fuse_uboot.sh /dev/sdx
 
./fuse_uboot.sh /dev/sdx
 
</syntaxhighlight>
 
</syntaxhighlight>
/dev/sdx请替换为实际的TF卡设备文件名。<br>
+
you need to replace "/dev/sdx" with the device name in your system.<br>
boot.img和内核模块均位于linux-3.10/output目录下,将boot.img拷贝到TF卡的boot分区的根目录即可更新内核。
+
The boot.img file and kernel modules are all under the "linux-3.10/output" directory. You can update the kernel on your TF card just by copying the boot.img file to your TF card's boot section.
  
===清理lichee源码===
+
===Clean Source Code===
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
./build.sh -p sun50iw1p1 -k linux-3.10 -b nanopi_a64 -m clean
 
./build.sh -p sun50iw1p1 -k linux-3.10 -b nanopi_a64 -m clean
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 17:03, 23 December 2016

查看中文

1 Introduction

Overview
Obverse
Reverse

The NanoPi A64 is a new board of high performance with low cost designed by FriendlyElec. It uses Allwinner’s A64 quad-core SoC(ARM Cortex-A53). FriendlyElec has made a UbuntuCore and a UbuntuMATE image files for it.

The NanoPi A64 is a small board with comprehensive interfaces, ports and features. It has Ethernet, IR receiver, Video/Audio input and output. It has onboard AXP803 PMU and WiFi. It takes power input from its MicroUSB port. It has MIPI-DSI and DVP interfaces, GPIO pin-header compatible with Raspberry Pi and a serial debug port.

2 Hardware Spec

  • CPU: Allwinner A64, Quad-core Cortex-A53@648MHz to 1.152GHz, DVFS
  • GPU: Mali400MP2, Supports OpenGL ES2.0, OpenVG1.1
  • DDR3 RAM: 1GB
  • Ethernet: One Gigabit Ethernet (RTL8211E)
  • PMU Power Management: AXP803, support software power-off
  • Wi-Fi: 802.11b/g/n
  • Audio Out/MIC: 3.5mm audio jack
  • IR Receiver: Onboard IR receiver
  • USB 2.0 Type A x 2
  • Serial Debug Port: 2.54mm pitch 4pin-header
  • microSD Slot x 1
  • microUSB x 1: only for power input
  • DVP Camera: 0.5mm pitch 24pin FPC seat
  • Video Out: 1.4 HDMI Type-A
  • MIPI DSI: 0.5mm pitch 30pin FPC seat
  • GPIO: 2.54mm pitch 40pin-header, compatible with Raspberry Pi's GPIO. It includes UART, SPI, I2C, PWM, IO etc
  • I2S: 7pin, 2.54mm pitch
  • Power Button x 1
  • LED: Power Indication x 1, System LED x 1
  • PCB : Six layer, ENIG
  • Dimension: 64 x 60mm
  • Power: DC 5V/2A
  • OS: Ubuntu-Core with QtE, Ubuntu-MATE

3 Diagram, Layout and Dimension

3.1 Layout

NanoPi A64 Layout
  • GPIO Pin Description
Pin# Name Pin# Name
1 SYS_3.3V 2 VDD_5V
3 GPIOE15/I2C2_SDA 4 VDD_5V
5 GPIOE14/I2C2_SCL 6 GND
7 GPIOD7 8 GPIOH4/UART3-TX
9 GND 10 GPIOH5/UART3-RX
11 GPIOB0/UART2-TX 12 GPIOL10/PWM_S
13 GPIOL8/I2C_S_SCL 14 GND
15 GPIOL9/I2C_S_SDA 16 GPIOH6/UART3-RTS
17 SYS_3.3V 18 GPIOH7/UART3-CTS
19 GPIOC0/SPI0-MOSI 20 GND
21 GPIOC1/SPI0-MISO 22 GPIOB1/UART2-RX
23 GPIOC2/SPI0-CLK 24 GPIOC3/SPI0-CS
25 GND 26 GPIOH8/SPDIF-OUT
27 GPIOH3/I2C1_SDA 28 GPIOH2/I2C1_SCL
29 GOIOH10 30 GND
31 GOIOH11 32 GPIOD4
33 GPIOD5 34 GND
35 GPIOD3/SPI1-MISO 36 GPIOD0/SPI1-CS
37 GPIOD6 38 GPIOD2/SPI1-MOSI
39 GND 40 GPIOD1/SPI1-CLK
  • Debug Port(UART0)
Pin# Name
1 GND
2 VDD_5V
3 UART0-TX
4 UART0-RX
  • I2S/PCM Pin Description
Pin# Name
1 GND
2 SYS_3.3V
3 GPIOB5/PCM0-BCLK
4 GPIOB4/PCM0-SYNC
5 GPIOB6/PCM0-DOUT
6 GPIOB7/PCM0-DIN
7 GPIOB3/I2S0-MCLK
  • DVP Camera IF Pin Description
Pin# Name Description
1, 2 SYS_3.3V 3.3V power output
7,9,13,15,24 GND Ground, 0V
3 CAM_SCL I2C Clock
4 CAM_SDA I2C Data
5 GPIOE17 Regular GPIO, control signals output to camera modules
6 GPIOE16 Regular GPIO, control signals output to camera modules
8 MCLK Clock signals output to camera modules
10 NC Not Connected
11 VSYNC Vertical synchronization to CPU from camera modules
12 HREF/HSYNC HREF/HSYNC signal to CPU from camera modules
14 PCLK PCLK signal to CPU from camera modules
16-23 Data bit7-0 data signals
  • MIPI-DSI Pin Description
Pin# Name Description
1, 2, 3 VDD_5V 5V power output
4,7,9,11,14,15,18,21,24,27,30 GND Ground, 0V
5 I2C0_SDA I2C Clock
6 I2C0_SCL I2C Data
8 GPIOL7 Regular GPIO
10 GPIOB2 Regular GPIO
12 GPIOL12 Regular GPIO
13 AP-RESET# System Reset
16 MIPI-DSI-D3N MIPI DSI data, negative differential signal
17 MIPI-DSI-D3P MIPI DSI data, positive differential signal
19 MIPI-DSI-D2N MIPI DSI data, negative differential signal
20 MIPI-DSI-D2P MIPI DSI data, positive differential signal
22 MIPI-DSI-D1N MIPI DSI data, negative differential signal
23 MIPI-DSI-D1P MIPI DSI data, positive differential signal
25 MIPI-DSI-D0N MIPI DSI data, negative differential signal
26 MIPI-DSI-D0P MIPI DSI data, positive differential signal
28 MIPI-DSI-CKN MIPI DSI clock, negative differential signal
29 MIPI-DSI-CKP MIPI DSI clock, positive differential signal
Note
  1. SYS_3.3V: 3.3V power output. In our test the real output was 3.1V
  2. VDD_5V: 5V power input/output. The input range is 4.7V ~ 5.6V. It can take power input from the MicroUSB or the VDD_5V pin from the Debug Port. The VDD_5V is connected to MicroUSB's VBUS
  3. All pins are 3.3V(In our test the real output was 3.1V), output current is 5mA
  4. For more details refer to the document schematics

3.2 Dimensional Diagram

NanoPi-A64-1610-Dimensions.png

For more details please refer to dimension file in dxf

4 Get Started

4.1 Essentials You Need

Before starting to use your NanoPi A64 get the following items ready

  • NanoPi A64
  • microSD Card/TFCard: Class 10 or Above, minimum 8GB SDHC
  • microUSB power. A 5V/2A power is a must
  • HDMI monitor
  • USB keyboard and mouse, and a USB HUB would be better
  • A Host computer running Ubuntu 14.04 64 bit system

4.2 TF Cards We Tested

To make your NanoPi A64 boot and run fast we highly recommend you use a Class10 8GB SDHC TF card or a better one. The following cards are what we used in all our test cases presented here:

  • SanDisk TF 8G Class10 Micro/SD TF card:

SanDisk MicroSD 8G

  • SanDisk TF128G MicroSDXC TF 128G Class10 48MB/S:

SanDisk MicroSD 128G

  • 川宇 8G C10 High Speed class10 micro SD card:

chuanyu MicroSD 8G

4.3 Make an Installation TF Card

4.3.1 Get Image File

Get the following files from download link to download image files (under the officail-ROMs directory) and the flashing utility(under the tools directory):

Image Files
nanopi-a64-core-qte-sd4g.img.zip a Light Ubuntu-core system with a Qt Embedded GUI library
nanopi-a64-ubuntu-mate-sd4g.img.zip Ubuntu with a MATE-desktop
Flash Utility:
win32diskimager.rar Windows utility. Under Linux users can use "dd"
PhoenixCard_V310.rar Windows utility for flashing Android image. Attention: the "dd" command under Linux doesn't work for flashing Android image
HDDLLF.4.40.exe Windows utility for formatting a TF card

4.3.2 Make Ubuntu-Core Image Card

  • Extract the nanopi-a64-core-qte-sd4g.img.zip and win32diskimager.rar files. Insert a TF card(at least 4G) into a Windows PC and run the win32diskimager utility as administrator. On the utility's main window select your TF card's drive, the wanted image file and click on "write" to start flashing the TF card.
  • After this writing process is done insert this card into your NanoPi A64's TF card slot and power on (with a 5V/2A power source). If the green LED is on and the blue LED is blinking this indicates your NanoPi A64 has successfully booted.

5 Work with Ubuntu-Core

5.1 Run Ubuntu-Core

  • Insert a TF card with UbuntuCore image files into your NanoPi A64, connect the board to a 5V/2A power source the board will be automatically powered on. If you can see the blue LED flashing it means your board is working and UbuntuCore is being loaded.

1) To make it easy you can connect an HDMI monitor, a USB mouse and keyboard to your A64 board. 2) If you want to do kernel development you need to use a serial communication board, ie a PSU-ONECOM board, which will allow you to operate the board via a serial terminal.

  • Here is a setup where we connect a NanoPi A64 to a PC via the PSU-ONECOM and you can power on your A64 from either the PSU-ONECOM or the board's MicroUSB:

PSU-ONECOM-NEO

  • It has two user names: root and fa and the password for both is "fa".
  • Update packages
sudo apt-get update

5.2 Extend TF Card's Section

We strongly recommend you to do this right after you have made an installation TF card since this will greatly enhance your A64's experience

  • Extend your card's rootfs section under a host PC:
sudo umount /dev/sdx?
sudo parted /dev/sdx unit % resizepart 2 100 unit MB print
sudo resize2fs -f /dev/sdx2

Note: you need to replace "/dev/sdx" with the device name in your system.

5.3 Login via SSH

If your NanoPi A64 is connected to a network via Ethernet before it is powered on it will automatically obtain an IP after it is powered up. If it is not connected via Ethernet or its DHCP is not activated obtaining an IP will fail and system will hang on for about 15 to 60 seconds. You can log into the board via SSH. In our test the IP address detected by our router was 192.168.1.230 and we ran the following command to log into the NanoPi NEO:

ssh root@192.168.1.230

The password is fa。

5.4 HDMI Audio Output

Our Ubuntu-Core system's default audio output is the 3.5mm audio jack. You can turn on the HDMI audio by editing the /etc/asound.conf file:

pcm.!default {
    type hw
    card 1
    device 0
}
 
ctl.!default {
    type hw
    card 1
}

card 0 points to the 3.5mm audio jack and card 1 points to the HDMI audio. You need to save your changes and reboot your system to make your changes take effect.

5.5 WiFi Connectivity

Make the following changes in the etc/wpa_supplicant/wpa_supplicant.conf file:

network={
        ssid="YOUR-WIFI-ESSID"
        psk="YOUR-WIFI-PASSWORD"
}

Note: the "YOUR-WIFI-ESSID" and "YOUR-WIFI-PASSWORD" need to be replaced with your actual ESSID and password.
Save, exit, reboot your system and run the following commands to turn on the WiFi:

ifdown wlan0
ifup wlan0

If your WiFi password has special characters or you don't want your password saved as plain text you can use "wpa_passphrase" to generate a psk for your WiFi password. Here is how you can do it:

wpa_passphrase YourWiFiESSID

Following the prompt type in your password and you will get a new password in the /etc/wpa_supplicant/wpa_supplicant.conf file. Now you can replace the existing password in the wlan0 file with the new one.

5.6 Check CPU's Working Temperature

You can use the following command to read A64's temperature and frequency

cpu_freq

6 Make Your Own OS(Compile BSP)

6.1 Preparations

Visit download link and go to the sources directory and download nanopi-a64-bsp.
Use the 7-zip utility to extract it and a lichee directory and an Android directory will be generated. Or you can get it from our github:

git clone https://github.com/friendlyarm/a64_lichee.git lichee

Note: "lichee" is the project name named by Allwinner for its CPU's source code which contains the source code of U-boot, Linux kernel and various scripts.

Compilation of the A64's BSP source code must be done under a PC running a 64-bit Linux.The following cases were tested on Ubuntu-14.04 LTS-64bit:

sudo apt-get install gawk git gnupg flex bison gperf build-essential \
zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
libgl1-mesa-dev g++-multilib mingw32 tofrodos \
python-markdown libxml2-utils xsltproc zlib1g-dev:i386

6.2 Compile U-boot

U-boot's source code is under the "lichee/brandy/u-boot-2014.07" directory and there is a "build.sh" script under the "brandy" directory, which is used to compile U-boot:

cd lichee/brandy
./build.sh -p sun50iw1p1

Note: the "lichee" directory contains a cross-compiler which will be automatically run when you compile U-boot with "build.sh".

6.3 Compile Linux Kernel

The Linux kernel's source code is under the "lichee/linux-3.10" directory. There is a "build.sh" file under the "lichee" directory", which is used to compile the kernel:

cd lichee
echo -e "0\n2\n0\n1\n" | ./build.sh config && ./build.sh

After the compilation is done a uImage and its kernel modules will be generated under "linux-3.10/output".

6.4 Package System Modules

cd lichee
./build.sh pack

This command copies the generated executables including u-boot and Linux kernel and configuration files to the "lichee/tools/pack/out/" directory.
Note: you will not get a workable U-boot if you don't do this.

6.5 Update U-boot on TF Card

Run the following commands to update the U-boot on your TF card:

cd fa_tools
./fuse_uboot.sh /dev/sdx

you need to replace "/dev/sdx" with the device name in your system.
The boot.img file and kernel modules are all under the "linux-3.10/output" directory. You can update the kernel on your TF card just by copying the boot.img file to your TF card's boot section.

6.6 Clean Source Code

./build.sh -p sun50iw1p1 -k linux-3.10 -b nanopi_a64 -m clean