Difference between revisions of "NanoPi 2"

From FriendlyELEC WiKi
Jump to: navigation, search
(Resources)
(Resources)
Line 302: Line 302:
 
* [Dimensions]( [http://wiki.friendlyarm.com/wiki/images/4/45/NanoPi-2-1507-Dimesions%28dxf%29.zip NanoPi-2-1507-Dimesions(dxf).zip ])
 
* [Dimensions]( [http://wiki.friendlyarm.com/wiki/images/4/45/NanoPi-2-1507-Dimesions%28dxf%29.zip NanoPi-2-1507-Dimesions(dxf).zip ])
 
* [S5P4418 User Manual]( [http://wiki.friendlyarm.com/wiki/images/3/3d/SEC_Users_Manual_S5P4418_Users_Manual_Preliminary_Ver.0.10.pdf S5P4418_Users_Manual_Preliminary_Ver.0.10.pdf ])
 
* [S5P4418 User Manual]( [http://wiki.friendlyarm.com/wiki/images/3/3d/SEC_Users_Manual_S5P4418_Users_Manual_Preliminary_Ver.0.10.pdf S5P4418_Users_Manual_Preliminary_Ver.0.10.pdf ])
 +
* [AP6212 Datasheet]( [http://wiki.friendlyarm.com/wiki/images/5/57/AP6212_V1.1_09022014.pdf AP6212_V1.1_09022014.pdf ])

Revision as of 09:35, 30 October 2015

查看中文

1 Introduction

  • The NanoPi2 is a high performance ARM Board developed by FriendlyARM for Hobbysts, Makers and Hackers for IOT projects. It features Samsung’s Cortex-A9 Quad Core S5P4418@1.4GHz SoC and 1G 32bit DDR3 RAM. It has built-in WiFi and Bluetooth which supports 802.11 b/g/n and Bluetooth 4.0. It boots Android and Debian from a TF card. It integrates an HDMI and LCD interface. Its adoption of the Raspberry Pi’s GPIO pin header makes it compatible with both Raspberry Pi’s external GPIO modules and Arduino’s shield boards. Its PCB dimension is 75 x 40 mm.

2 Features

  • CPU: S5P4418, 1.4GHz
  • RAM: 1GB DDR3
  • Built in SDIO WiFi and Bluetooth module
  • USB 2.0 Type A x 1
  • Debug Serial Port/UART0 x 1
  • microSD Slot x 2
  • microUSB x 1: for data transmission and power input
  • LCD Interface: 0.5mm spacing FPC socket, full color LCD (RGB:8-8-8)
  • HDMI: HDMI 1.4A, Type-A, 1080P60
  • DVP Camera Interface: 0.5mm spacing FPC socket. It includes ITU-R BT 601/656 8-bit, I2C and IO
  • GPIO: 2.54mm spacing 40pin, compatible with Raspberry Pi's GPIO. It includes UART, SPI, I2C, IO etc
  • Button: User Button x 1, Reset Button x 1
  • LED: LED for Power Indication x 1, User LED x 1
  • PCB Dimension: 75 x 40mm
  • Power: DC 5V/2A
  • OS: Android, Debian

3 Diagram, Layout and Dimension

3.1 Layout

NanoPi 2接口布局
NanoPi 2 MicroSD
  • GPIO Pin Spec
Pin# Name Pin# Name
1 VDD_SYS_3.3V 2 VDD_5V
3 I2C0_SDA 4 VDD_5V
5 I2C0_SCL 6 DGND
7 GPIOB28 8 UART3_TXD
9 DGND 10 UART3_RXD
11 GPIOB29 12 GPIOB26
13 GPIOB30 14 DGND
15 GPIOB31 16 PWM2
17 VDD_SYS_3.3V 18 GPIOB27
19 SPI0_MOSI 20 DGND
21 SPI0_MISO 22 PWM0
23 SPI0_CLK 24 SPI0_CS
25 DGND 26 PWM1
27 I2C1_SDA 28 I2C1_SCL
29 GPIOC8 30 DGND
31 SPI2_CLK 32 GPIOC28
33 SPI2_CS 34 DGND
35 SPI2_MOSI 36 GPIOC7
37 SPI2_MISO 38 ALIVEGPIO2
39 DGND 40 ALIVEGPIO3
  • Debug Port CON1(UART0)
Pin# Name
1 DGND
2 VDD_5V
3 TXD0
4 RXD0
  • DVP Camera Interface Pin Spec
Pin# Name
1, 2 VDD_SYS_3.3V
7,9,13,15,24 DGND
3 SCL0
4 SDA0
5 GPIOB14
6 GPIOB16
8,10 NC
11 VSYNC
12 HREF
14 PCLK
16-23 Data bit7-0
  • RGB LCD Interface Pin Spec
Pin# Name
1, 2 VDD_5V
11,20,29, 37,38,39,40, 45 DGND
3-10 Blue LSB to MSB
12-19 Green LSB to MSB
21-28 Red LSB to MSB
30 GPIOB25
31 GPIOC15
32 XnRSTOUT Form CPU
33 VDEN
34 VSYNC
35 HSYNC
36 LCDCLK
41 SCL2
42 SDA2
43 GPIOC16
44 NC
Note
  1. VDD_SYS_3.3V: 3.3V power output
  2. VDD_5V: 5V power input/output. When the external device’s power is greater than the MicroUSB’s the external device is charging the board otherwise the board powers the external device. The input range is 4.7V ~ 5.6V
  3. For more details please refer to the document:NanoPi-2-1507-Schematic.pdf

3.2 Board Dimension

NanoPi 2 Dimension

For more details please refer to the document:NanoPi-2-1507-Dimesions(dxf).zip

4 Get Started

4.1 Essentials You Need

Before play with your NanoPi2 please get the following items ready

  • NanoPi 2
  • microSD Card/TFCard: Class 10 or Above, minimum 8GB SDHC
  • microUSB cable
  • A Host running Ubuntu 14.04 64 bit system

4.2 Make an Installation MicroSD Card

  • 1) Insert your microSD card to your host running Ubuntu and check your SD card's device name
dmesg | tail

Search the messages output by "dmesg" for similar words like "sdc: sdc1 sdc2". If you can find them it means your SD card is recognized as "/dev/sdc". Or you can check that by commanding "cat /proc/partitions".

  • 2) Download Firmware Package
git clone https://github.com/friendlyarm/sd-fuse_nanopi2.git
cd sd-fuse_nanopi2
  • 3) Flash Android Firmware to MicroSD Card
su
./fusing.sh /dev/sdx

(Note: you need to replace "/dev/sdx" with the device name in your system) When you do “git clone” you have to hit “Y” within 10 seconds after it prompts you to download image files otherwise you will miss the download.

  • 4) Flash Debian Firmware to MicroSD Card
./fusing.sh /dev/sdx debian

4.3 Run Android

Insert a MicroSD card with Android image files to your NanoPi2, connect the NanoPi2 to an HDMI monitor and a 5V/2A power source the NanoPi2 will be automatically powered on. If you can see the blue LED flashing it means your board is working and you will see Android loading on the HDMI monitor. If at the same time you connect your NanoPi2 to a PC running Ubuntu and Minicom via a serial cable you will see system messages output to the PC’s minicom terminal.

5 Make Your Own OS Image

5.1 Setup Development Environment

5.2 Install Cross Compiler

FriendlyARM has an open source Android package which contains a working cross compiler. You can set it up in the "PATH" variable:

export PATH=/opt/FriendlyARM/s5p4418/android/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin:$PATH
arm-eabi-gcc -v

The “/opt/FriendlyARM/s5p4418/android” is where Android source code package is located.
When you use this compiler please specify the option "CROSS_COMPILE=arm-eabi-".

5.3 Compile U-Boot

Download the U-Boot source code and compile it. Please note the github's branch is s5p4418-nanopi2:

git clone https://github.com/friendlyarm/uboot_nanopi2.git
cd uboot_nanopi2
git checkout s5p4418-nanopi2
make s5p4418_nanopi2_config
make CROSS_COMPILE=arm-eabi-

After your compilation succeeds a u-boot.bin will be generated. If you want to test it please flash it to your installation MicroSD card via fastboot.
Warning: you cannot update this MicroSD card by commanding "dd". This command which will cause trouble when booting the NanoPi2.

5.4 Prepare mkimage

You need the mkimage utility to compile a U-Boot source code package. Please make sure this utility works well on your host before you start compiling a uImage.
You can install this utility by either commanding "sudo apt-get install u-boot-tools" or following the commands below:

cd uboot_nanopi2
make tools
mkdir -p /usr/local/sbin && cp -v tools/mkimage /usr/local/sbin

5.5 Compile Linux kernel

5.5.1 Compile Kernel

  • Download Kernel Source Code
git clone https://github.com/friendlyarm/linux-3.4.y.git
cd linux-3.4.y
git checkout s5p4418-nanopi2

The NanoPi2's kernel source code lies in the "s5p4418-nanopi2" branch.

  • Compile Android Kernel
make nanopi2_android_defconfig
touch .scmversion
make CROSS_COMPILE=arm-eabi- uImage
  • Compile Debian Kernel
make nanopi2_linux_defconfig
touch .scmversion
make CROSS_COMPILE=arm-eabi- uImage

After your compilation succeeds a uImage will be generated in the "arch/arm/boot/" directory.

5.5.2 Compile Kernel Modules

Android contains kernel modules which are in the "/lib/modules" directory in the system section. If you want to add your own modules to the kernel or you changed your kernel configurations you need to recompile these new modules.
Compile Original Kernel Modules:

cd linux-3.4.y
make CROSS_COMPILE=arm-eabi- modules

Here we have two new modules and we can compile them by following the commands below:

cd /opt/FriendlyARM/s5p4418/android
./vendor/friendly-arm/build/common/build-modules.sh

The "/opt/FriendlyARM/s5p4418/android" directory points to the top directory of Android source code. You can get more details by specifying option "-h".
After your compilation succeeds new modules will be generated

5.6 Compile Android

  • Install Cross Compiler

We recommend installing 64 bit Ubuntu 14.04 on your PC host.

sudo apt-get install zlib1g-dev:i386
sudo apt-get install bison g++-multilib git gperf libxml2-utils make python-networkx zip
sudo apt-get install flex libncurses5-dev zlib1g-dev gawk minicom

For more details please refer to https://source.android.com/source/initializing.html

  • Download Source Code

You need to use repo to get the Android source code. Please refer to https://source.android.com/source/downloading.html

mkdir android && cd android
repo init -u git@github.com:friendlyarm/android_manifest.git -b nanopi2-kitkat
repo sync

The "android" directory is the working directory. To initialize repo you can do "HTTPS clone URL".

  • Compile System Package
source build/envsetup.sh
lunch aosp_nanopi2-userdebug
make -j8

After your compilation succeeds an image will be generated in the "out/target/product/nanopi2/" directory.

6 Resources