- 1 Introduction
- 2 Hardware Features
- 3 Diagram, Layout and Dimension
- 4 Get Started
- 5 Make OS Image
- 5.1 Install Cross Compiler
- 5.2 Compile U-Boot
- 5.3 Compile Linux kernel
- 5.4 Make File System
- 5.5 Make an Installation MicroSD Card with Your Own Files
- 6 Related Links
- 7 NanoPi Applications
- 8 Resources
The NanoPi is a low power consumption, Samsung S3C2451 based ARM SOC that FriendlyARM developed for Linux hackers, makers and hobbyists. Its size is only half of the Raspberry Pi(RPi) and its GPIO pin is compatible with the RPi’s. The NanoPi integrates both the WiFi and Bluetooth 4.0. It has a DVP camera interface and full color LCD interface. It boots Linux/Debian quickly from a TF card. These features make it a good platform for applications in IOT, unmanned vehicles, robotics, image processing and human machine interaction.
- CPU: Samsung S3C2451, 400Mhz
- RAM: 64M DDR2
- Integrated SDIO WiFi and Bluetooth
- USB Type A x1
- Debugging Serial Port x1
- microSD Slot x1
- microUSB x1: for power and data transmission. It can be configured as a serial port or Ethernet
- LCD Interface: 0.5 mm pitch SMT FPC seat, for full-color LCD (RGB: 8-8-8)
- DVP Camera interface：0.5mm spacing FPC socket. It includes ITU-R BT 601/656 8-bit, I2C and IO
- GPIO1: 2.54mm spacing 40pin, compatible with Raspberry Pi's GPIO. It includes UART, SPI, I2C, IO etc
- GPIO2: 2.54mm spacing 12pin. It includes I2S, I2C, UART etc.
- PCB dimension: 75 x 30 mm
- Power: DC 5V
- Bootloader and OS: u-boot, Linux-4.1, Debian8 jessie, Rabbit linux
Diagram, Layout and Dimension
- GPIO1 Pin Spec
- GPIO2 Pin Spec
Pin# Name Pin# Name 1 VDD_5V 2 VDD_SYS_3.3V 3 TXD2 4 RXD2 5 SDA0 6 SCL0 7 IISSDO0 8 IISSDI0 9 IISSCLK0 10 IISLRCK0 11 IISCDCLK0 12 DGND
- Debug Port CON1（UART0）
Pin# Name 1 DGND 2 VDD_5V 3 TXD0 4 RXD0
- DVP Camera IF Pin Spec
Pin# Name 1, 2 VDD_SYS_3.3V 7,9,13,15,24 DGND 3 SCL0 4 SDA0 5 GPH13 6 GPJ12 8 XCLK 10 NC 11 VSYNC 12 HREF 14 PCLK 16-23 Data bit7-0
- RGB LCD IF Pin Spec
Pin# Name 1, 2 VDD_5V 11，20，29 DGND 3-10 Blue LSB to MSB 12-19 Green LSB to MSB 21-28 Red LSB to MSB 30 GPG12 31 GPG2 32 XnRSTOUT Form CPU 33 VDEN 34 VSYNC 35 HSYNC 36 LCDCLK 37，38，39，40 XM，XP，YM，YP
- VDD_SYS_3.3V: 3.3V power output
- 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-1507-Schematic.pdf
- For more details please refer to the document：NanoPi-1507-Dimesions(dxf).zip
Essentials You Need
Before play with your NanoPi please get the following items ready
- Class 8, microSD card/TF card: >= 4GB
- microUSB cable
- a Host running Ubuntu and connected to the internet
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) Flash Firmware to MicroSD Card
git clone https://github.com/friendlyarm/sd-fuse_nanopi.git cd sd-fuse_nanopi su ./fusing.sh /dev/sdx
(Note: you need to replace "/dev/sdx" with the device name in your system)
If you cannot get these files from github you can get them from our source: .
If you have problems with using the "fusing.sh" script you can download our "NanoPi-fuser-win32.zip" and use it to make your SD card in Windows. Here is the download:.
Insert this MicroSD card to your NanoPi, connect it to a PC via a MicroUSB cable the NanoPi will be automatically powered on. If you can see the blue LED flashing it means your board is running now. By default we install Debian. It would be better if you connect your NanoPi to an LCD since this helps you set up your NanoPi more easily and conveniently.
Log on NanoPi via MicroUSB
After connecting your NanoPi to you PC host (running Ubuntu) please type "dmesg" in your PC's command line. If you can find the following messages it means your NanoPi is correctly connected to your host and runs well:
[12601.100339] usb 2-1.7: Product: FriendlyARM Gadget v2.4 [12601.100343] usb 2-1.7: Manufacturer: Linux 4.1.2-FriendlyARM with s3c-hsudc [12601.103192] cdc_acm 2-1.7:2.0: This device cannot do calls on its own. It is not a modem. [12601.103368] cdc_acm 2-1.7:2.0: ttyACM0: USB ACM device [12601.105300] cdc_ether 2-1.7:2.2 usb0: register 'cdc_ether' at usb-0000:00:1d.0-1.7, CDC Ethernet Device, 46:a1:e7:6d:5c:32
If you command "ifconfig" and find a "usb0" device you can SSH to 192.168.100.1 to log on your NanoPi:
After it prompts you to input your password you can try "fa"
After SSH to your NanoPi please check the WiFi interface first. The "wlan" device is WiFi.
By default the WiFi device is "wlan0". You need to create a configuration file under "/etc/network/interfaces.d/" for WiFi:
Here is a sample wlan0 file:
auto lo iface lo inet loopback auto wlan0 iface wlan0 inet dhcp wpa-driver wext wpa-ssid YourWiFiESSID wpa-ap-scan 1 wpa-proto RSN wpa-pairwise CCMP wpa-group CCMP wpa-key-mgmt WPA-PSK wpa-psk YourWiFiPassword
Please replace "YourWiFiESSID" and "YourWiFiPassword" with your WiFiESSID and password. After save and close the file you can connect to your WiFi source by running the following command:
After you power on your board it will automatically connect to your WiFi source.
Please note that if you use one TF card to boot multiple boards the WiFi device name will likely be named to "wlan1", "wlan2" and etc. You can reset it to "wlan0" by deleting the contents of the following file and reboot your board: /etc/udev/rules.d/70-persistent-net.rules
Setup Wi-Fi AP
By default a NanoPi is set to a WiFi AP. The default AP name is "nanopi-wifiap" and the password is "123456789".
The WiFi's working mode can be checked by running the following command:
If the result is "2" it means it is currently working as a WiFi AP.
If the board is not working as a WiFi AP you can set it by running the following commands:
The WiFi AP's name and password can be configured by editing the file "/etc/hostapd/hostapd.conf".
In our Debian Jessie we include bluetooth packages: bluetooth, bluez, obexftp and etc
We will show how to transfer files between a NanoPi and a cellphone
In this example we used an MX4 cellphone, enabled its bluetooth and made it searchable by other devices. Firstly we typed the following commands in the NanoPi to search its nearby bluetooth devices:
The listed search result above indicated that our MX4 phone was found and its MAC was 8C:BE:BE:C5:2C:C7. We ran "sdptool" to list all the protocols it supported:
sdptool browse 8C:BE:BE:C5:2C:C7
What we would like to test was its file transfer function therefore we must find out whether "OBEX File Transfer" was supported:
- Service Name: OBEX File Transfer
- Service RecHandle: 0x1000c
- Service Class ID List:
- "OBEX File Transfer" (0x1106)
- Protocol Descriptor List:
- "L2CAP" (0x0100)
- "RFCOMM" (0x0003)
- Channel: 11
- "OBEX" (0x0008)
- Language Base Attr List:
- code_ISO639: 0x454e
- encoding: 0x6a
- base_offset: 0x100
- Profile Descriptor List:
- "OBEX File Transfer" (0x1106)
- Version: 0x0100
- Service Name: OBEX File Transfer
Here we found out that "OBEX File Transfer" was supported and we could use "obexftp" to start our file transfers. The following commands listed all the files under the root directory of the phone:
obexftp -b 8C:BE:BE:C5:2C:C7 -c / -l
The following commands downloaded "/Adnroid/djaof.dll" from the phone to the NanoPi:
obexftp -b 8C:BE:BE:C5:2C:C7 -c /Android -g djaof.dll
The following commands uploaded "hello.txt" from the NanoPi to the "/Android" directory of the phone
obexftp -b 8C:BE:BE:C5:2C:C7 -c /Android -p hello.txt
Setup iBeacon Transmitter
The iBeacon technology enables smartphones, tablets and other devices to perform actions when in close proximity to an iBeacon transmitter. Please run the following commands to setup a NanoPi to an iBeacon transmitter:
hciconfig hci0 up hciconfig hci0 leadv 3 hciconfig hci0 noscan hcitool -i hci0 cmd 0x08 0x0008 1E 02 01 1A 1A FF 4C 00 02 15 63 6F 3F 8F 64 91 4B EE 95 F7 D8 CC 64 A8 63 B5 00 00 00 00 C8
If this is setup correctly on a NanoPi it will broadcast its presence to nearby portable electronic devices. If a nearby Android device or iPhone has the "locate Beacon" application installed it will be able to measure the distance between itself to the NanoPi. If you want enable the indoor positioning function you will need to setup multiple iBeacon transmitters.
Communicate with Cellphone via Bluetooth BLE
The function requires a BLE service be started on the NanoPi.
The BLE service's code is open source. Please follow the steps below to get it:
git clone https://github.com/friendlyarm/ble-peripheral-service-demo.git
Please run the following build.sh script which will generate a "nanopi_ble_server" executable if it is successful:
We assume your cross compiler is installed at "/opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-gcc". If it is not installed under this directory you need to make changes in the script accordingly.
After a "nanopi_ble_server" is generated please copy it to the NanoPi and execute the following commands:
hciconfig hci0 down service bluetooth stop chmod 755 nanopi_ble_server ./nanopi_ble_server
Now please install a BLE Scanner application on an Android phone or a Lightblue application on an iPhone which will be used to test the function.
We have an open source Android Demo on GitHub too，It is under "android/BLETest". This demo shows how a cellphone communicates(transmits data to/receives data from) with the NanoPi via BLE.
NanoPi's output messages are as follows:
Install Debian Packages
We provide a Debian Jessie image. You can install Jessie's packages by commanding "apt-get". If this is your first installation you need to update the package list by running the following command:
Or you can try a complete command set
apt-get update apt-get dist-upgrade apt-get autoremove
You can install your preferred packages. For example if you want to install an FTP server you can do this:
apt-get install vsftpd
Note: you can change your download server by editting "/etc/apt/sources.list". You can get a complete server list from . You need to select the one with "armel".
Make OS Image
Install Cross Compiler
Download and untar cross compiler file:
git clone https://github.com/friendlyarm/prebuilts.git tar xvzf prebuilts/gcc/arm-linux-gcc-4.4.3.tar.gz -C /
It will ease your future development work if you add compiler's path to "PATH". You can do it by first opening "~/.bashrc" and then appending the following lines:
Run "~/.bashrc" to make your changes in effect right away:
We assume you would use a 32-bit compiler. However if your host runs a 64-bit Linux you need to install some extra packages. For example if your host runs a Debian 8 Jessie desktop 64 bit system you will need to install the following packages:
dpkg --add-architecture i386 apt-get update apt-get install build-essential gcc-multilib rpm libstdc++6:i386 libgcc1:i386 zlib1g:i386 libncurses5:i386
Download U-Boot source code and compile it. Please note it is in the branch "nanopi":
git clone https://github.com/friendlyarm/uboot_nanopi.git cd uboot_nanopi git checkout nanopi make nanopi_config make
After your compilation succeeds a u-boot.bin will be generated. If you want to test it please flash it to your MicroSD card by running the "fusing.sh" script.
If your SD card's device name is "/dev/sdd" please run the following command as "root":
su ./fusing.sh /dev/sdd
Note: this operation will remove all the data in the SD card.
Compile Linux kernel
Please download kernel source code and compile it
git clone https://github.com/friendlyarm/linux-4.x.y.git cd linux-4.x.y git checkout nanopi-v4.1.y make nanopi_defconfig touch .scmversion make
The kernel that the NanoPi uses is "nanopi-v4.1.y". Please make sure you get the correct branch. After your compilation succeeds a new file "arch/arm/boot/zImage" will be generated
Compile Kernel Modules
In general kernel compilation generates kernel modules such as ipv6, netfilter and etc. If you want to add your own modules to the kernel or you changed your kernel configurations you need to recompile these new modules and pack them as a new "kernel-modules.tgz" to replace the corresponding file "basefs/kernel-modules.tgz" in "Rootfs"
please run the following commands as root to install ".ko" to /tmp/nanopi-modules:
make INSTALL_MOD_PATH=/tmp/nanopi-modules modules_install
Please strip your kernel modules and create a new package
cd /tmp/nanopi-modules/lib/ find . -name \*.ko | xargs arm-linux-strip --strip-unneeded tar czvf kernel-modules.tgz modules/
If you want to test your newly generated kernel modules you can copy them to your MicroSD card's "rootfs/lib": We assume your MicroSD card was already mounted to "/media/fa/NANOPI" please run the following commands as root:
rm -rf /media/fa/NANOPI/lib/modules/ tar xzvf kernel-modules.tgz -C /media/fa/NANOPI/lib/
Make File System
File System for Debian
By default we install a Debian system to the NanoPi, which can be obtained from the following repository:
git clone https://github.com/friendlyarm/sd-fuse_nanopi.git cd sd-fuse_nanopi/prebuilt/ ls -l rootfs.tgz
If you want to customize it you can uncompress "rootfs.tgz", edit its components and tar it. Here is an example showing how you can do it:
tar xzf rootfs.tgz dpkg -i --force-all --root=./rootfs /tmp/qtembedded-4.8.5_armel.deb tar czf rootfs.tgz rootfs
File System for Rabbit Linux
Another Linux system we provide is Rabbit Linux which is open source. You can work on it as "root" by following the steps below:
git clone https://github.com/friendlyarm/rootfs_nanopi.git cd rootfs_nanopi git checkout nanopi su make && make install && make strip
If the compilation is successful you will observe the following messages:
RootFS (core) successfully installed to: /tmp/FriendlyARM/nanopi/rootfs Copyright 2015 FriendlyARM (http://www.arm9.net/)
The information above indicates that the generated file system is located under "/tmp/FriendlyARM/nanopi/rootfs". We will make it a package by running the following commands:
cd /tmp/FriendlyARM/nanopi tar czvf rootfs.tgz rootfs/
Make an Installation MicroSD Card with Your Own Files
Make Your Own System
Please download the SD card fuse utility and switch to the correct "master" branch:
git clone https://github.com/friendlyarm/sd-fuse_nanopi.git cd sd-fuse_nanopi git checkout master
Under "sd-fuse_nanopi" there is a "prebuilt" which contains the files that a system needs:
Kernel Command Parameters: sdenv.raw
Linux Kernel: zImage
File System Package: rootfs.tgz
You can replace one or multiple of these files with the ones you generated on your own in the previous steps and then run the following command to flash them to your MicroSD card. Please note that you need to run these commands under the "sd-fuse_nanopi" directory.
su ./fusing.sh /dev/sdx
(Note: please replace /dev/sdx with your SD card's device name)
After it is done you can play with your new OS with this card.
Change U-Boot Environment Variables
After you boot your NanoPi you can check the U-Boot environment variables by running the following command:
If you want to change variables (e.g. adding an LCD variable) you can do it this way:
fw_setenv bootargs root=/dev/mmcblk0p2 rootfstype=ext4 init=/sbin/init console=ttySAC0,115200 lcd=S70
If you want to port an existing SD card's all environment variables you can to insert it to a host and export its environment variables to a new sdenv.raw by running the following commands and then replace the "prebuilt/sdenv.raw" with this new file:
cd sd-fuse_nanopi ./readenv.sh /dev/sdd cp sdenv.raw prebuilt/
Comments on SD Card's "RAW" File
There is a known issue with the S3C2451: when iROM boots with SDHC card, calculated card size is smaller than original card size, exactly 1024 blocks so SDHC card has additional reserved blocks(512Kbyte). The S3C2451's iROM reads a bootloader from the end of an SD card. The results in an issue that when the iROM reads a regular SD card and an SDHC card of the same size it will get different positions. In addition different SD cards have different sizes. Therefore it is impossible to create a universal RAW file for all SD cards.
If you have multiple SD cards of the same size and one of them is flashed with a complete system you can use "dd" under Linux to read its data and save it as a RAW file and then dump it to all the other SD cards.
For an SD card whose size is greater than 8 GB it takes much longer time to write a RAW file to it. On general our rootfs is only about 23 MB it will be much faster to run a script file making an SD card.
Connect TFT LCD
The NanoPi can work with FriendlyARM's LCDs: H43,S70,A70,W50,A97,L80,G10,A56,W101,W35,P43,P35,TD35.
Please follow the steps below:
1) If you connect your NanoPi to a PC host via a mini USB cable its power may not be enough and you will need to connect an additional 5V 2A power to the board's GPIO's VDD_5V and DGND;
2) You need to add an LCD variable in U-boot. For example if you want to connect your NanoPi to an S70 LCD you can do it this way:
Firstly list the current environment variables:
Here is the list
bootargs=root=/dev/mmcblk0p2 rootfstype=ext4 init=/sbin/init console=ttySAC0,115200
Append "lcd=S70" to "bootargs=" and reset the list with "fw_setenv"
fw_setenv bootargs root=/dev/mmcblk0p2 rootfstype=ext4 init=/sbin/init console=ttySAC0,115200 lcd=S70
Reboot your board you will see Debian on the LCD.
Download Qt and tslib Packages:
apt-get update apt-get install qtembedded apt-get install friendlyarm-tslib
The qtemebdded is the library Qt4 relies on. The friendlyarm-tslib is the library touch functions and screen calibration rely on.
Run Qt Sample Application:
. /usr/bin/setqt4env /usr/local/Trolltech/QtEmbedded-4.8.5-arm/examples/tetrix -qws
The setqt4env script sets the environmental variables which Qt and tslib rely on. If it is run on a platform for the first time a screen calibration GUI will be launched. Users need to go through a five-point calibration process to calibrate the screen.
The tetrix application is a game developed in Qt4 and it runs as follows.
Connect Matrix DIY Modules