NanoPi K1 Plus

From FriendlyARM WiKi
Jump to: navigation, search

查看中文

Introduction

NanoPi K1 Plus1.jpg
NanoPi K1 Plus2.jpg
NanoPi K1 Plus3.jpg
  • The NanoPi K1 Plus uses the Allwinner 64-bit quad-core Cortex™-A53 H5 SoC. It can run either a 64-bit OS or a 32-bit OS. It has NEON multi-media engine and a hex-core Mali450 GPU. It supports various video formats and has strong HD encoding/decoding capabilities.
  • The NanoPi K1 Plus has 2GB DDR3 RAM, onboard WiFi, DVP camera interface, Gbps Ethernet, USB, HDMI, infrared remote control, 3.5mm audio jack, I2S and etc. It can boot from a TF card and supports an external eMMC module.
  • The NanoPi K1 Plus has the same dimension as RPi 3. Its 40-Pin GPIO pin-header is compatible with RPi 3's GPIO pin-header. It works with any RPi housing.
  • A Ubuntu Core image and an Armbian image are ready for the NanoPi K1 Plus.

Hardware Spec

  • CPU: Allwinner H5, Quad-core 64-bit high-performance Cortex™-A53
  • GPU: Hexa-core Mali450
  • DDR3 RAM: 2GB
  • Ethernet: 10/100/1000M Ethernet using RTL8211E IC
  • Wireless: 802.11 b/g/n and onboard PCB antenna
  • Infrared: Onboard infrared receiver
  • Audio: 3.5mm audio jack/Via HDMI
  • Mic: onboard microphone
  • eMMC: onboard eMMC interface
  • I2S: onboard I2S interface(7Pin, 2.54mm pin-header)
  • MicroSD Slot: MicroSD card slot
  • USB Host: 3 x USB 2.0 Host, type A port
  • DVP Camera interface: 24-Pin, 0.5mm pitch FPC seat
  • MicroUSB: 1 x USB 2.0, OTG, for power input and data transmission
  • HDMI: HDMI Type-A port. It supports 4K@30fps dsplay
  • Video Output: HDMI 1.4. It supports 4K@30fps display, CVBS
  • GPIO Pin-header: 40 Pin,2.54mm pitch pin-header containing I2C, GPIO, UART, PWM, SPDIF, SPI and etc
  • Serial Debug Port: 4Pin, 2.5mm pitch pin-header
  • Button: 1 x GPIO button(user configurable)
  • LED: 1 x power LED and 1 x status LED
  • Power Interface: MicroUSB
  • PCB Size:56 x 85mm, 6-layer, ENIG
  • Power: DC 5V/2A

Diagram, Layout and Dimension

Layout

NanoPi-K1-Plus Interface Layout
  • GPIO Pin Spec
Pin# Name Linux gpio Pin# Name Linux gpio
1 SYS_3.3V 2 VDD_5V
3 I2C0_SDA / GPIOA12 4 VDD_5V
5 I2C0_SCL / GPIOA11 6 GND
7 GPIOG11 203 8 UART1_TX / GPIOG6 198
9 GND 10 UART1_RX / GPIOG7 199
11 UART2_TX / GPIOA0 0 12 GPIOA6 6
13 UART2_RTS / GPIOA2 2 14 GND
15 UART2_CTS / GPIOA3 3 16 UART1_RTS / GPIOG8 200
17 SYS_3.3V 18 UART1_CTS / GPIOG9 201
19 SPI0_MOSI / GPIOC0 64 20 GND
21 SPI0_MISO / GPIOC1 65 22 UART2_RX / GPIOA1 1
23 SPI0_CLK / GPIOC2 66 24 SPI0_CS / GPIOC3 67
25 GND 26 SPDIF-OUT / GPIOA17 17
27 I2C1_SDA / GPIOA19 / PCM0_CLK / I2S0_BCK 19 28 I2C1_SCL / GPIOA18 / PCM0_SYNC / I2S0_LRCK 18
29 GPIOA20 / PCM0_DOUT / I2S0_SDOUT 20 30 GND
31 GPIOA21 / PCM0_DIN/ I2S0_SDIN 21 32 GPIOA7 7
33 GPIOA8 8 34 GND
35 UART3_CTS / SPI1_MISO / GPIOA16 16 36 UART3_TX / SPI1_CS / GPIOA13 13
37 GPIOA9 9 38 UART3_RTS / SPI1_MOSI / GPIOA15 15
39 GND 40 UART3_RX / SPI1_CLK / GPIOA14 14


  • eMMC Connector Pin Spec
Pin# Name Pin# Name
1 eMMC_D0 2 eMMC_D1
3 eMMC_D2 4 eMMC_D3
5 eMMC_D4 6 eMMC_D5
7 eMMC_D6 8 eMMC_D7
9 eMMC_DS 10 GND
11 eMMC_CMD 12 eMMC_CLK
13 NC 14 GND
15 NC 16 1.8V OUT
17 eMMC_RST 18 3.3V OUT
19 GPIOY_5 20 GND
  • Debug Port(UART0)
Pin# Name
1 GND
2 VDD_5V
3 UART_TX
4 UART_RX
  • 7Pin I2S Pin Spec
Pin# Name
1 GND
2 SYS_3.3V
3 I2S0_BCK
4 I2S0_LRCK
5 I2S0_SDOUT
6 I2S0_SDIN
7 I2S_MCLK
Notes
  1. SYS_3.3V: 3.3V power output
  2. VDD_5V: 5V power input/output. Input power range: 4.7~5.6V
  3. All signal pins are 3.3V
  4. For more details refer to :Schematic_NanoPi-K1_Plus-1712_20171214.pdf

Board Dimension

NanoPi_K1_Plus_V1.0_1712 Dimensions

For more details refer to:NanoPi_K1_Plus_V1.0_1712_dxf.zip

Get Started

Essentials You Need

Before starting to use your NanoPi K1 Plus get the following items ready

  • NanoPi K1 Plus
  • MicroSD/TF Card: Class 10 or Above, minimum 8GB SDHC
  • A DC 5V/2A power cord with MicroUSB port is a must
  • HDMI monitor
  • USB keyboard, mouse and possible a USB hub(or a TTL to serial board)
  • A host computer running Ubuntu 16.04 64 bit system

TF Cards We Tested

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

Install OS

Download Image Files

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

Image Files:
nanopi-k1-plus_friendlycore-xenial_4.x.y_YYYYMMDD.img.zip FriendlyCore(based on UbuntuCore), kernel:Linux-4.x
nanopi-k1-plus_ubuntu-tft_4.x.y_YYYYMMDD.img.zip FriendlyElec's 2.8'TFT supported image file, kernel: Linux-4.x.y Matrix - 2'8 SPI Key TFT
nanopi-k1-plus_eflasher_4.x.y_YYYYMMDD.img.zip eflasher image file, kernel: Linux-4.x
Flash Utility:
win32diskimager.rar Windows utility. Under Linux users can use "dd"

Linux

Boot from TF
  • FriendlyCore / Debian / Ubuntu are all based on a same Linux distribution and their installation methods are the same.
  • Extract the Linux image and win32diskimager.rar files. Insert a TF card(at least 8G) 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.
  • Insert this card into your board's BOOT slot and power on (with a 5V/2A power source). If the PWR LED is on and the STAT LED is blinking this indicates your board has successfully booted.
Boot from eMMC
Flash OS with eflasher Utility
  • For more details about eflasher refer to the wiki link: EFlasher
  • Extract the eflasher Image 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.
  • Insert this card into your board's BOOT 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 board has successfully booted.
  • Connect the board to an HDMI monitor or an LCD and a USB mouse, and select an OS to start installation.

nanopi-k1-plus-eflasher

  • If your board doesn't support HDMI or no monitor is connected you can select an OS by running the following command:
$ su root
$ eflasher

The password for "root" is "fa".Type a number and enter to select an OS, then type "yes" and enter to start installation:
eflasher-console
After installation is done shutdown the system, take out the TF card, power on your board again and it will boot from eMMC.

  • If you want to flash other OS image to eMMC download the whole directory "images-for-eflasher" in the CD and extract the packages in the directory to the "FRIENDLYARM" section in your SD card.
Flash OS to eMMC on PC
  • An OS image for eMMC is the same as the one for an SD card. Extract an image package and flash utility. Insert an eMMC module(in a MicroSD to eMMC adapter) to a Windows PC. Run the win32diskimager utility as administrator. On the win32diskimager's main window select your MicroSD to eMMC adapter's drive, a wanted OS image and click "Write" to start flashing.

EMMC module 1.jpgEMMC module 4.jpg

  • After flash is done take out the MicroSD to eMMC adapter. Take the eMMC module off the adapter, insert this module to the board's eMMC slot and power up the board. If the PWR LED is solid on and the SATA LED is flashing it means your board has been successfully booted.
  • When both an SD card and an eMMC module are connected to a board the board will be booted from the SD card first and if that fails it will be booted from eMMC.

Work with FriendlyCore

Introduction

FriendlyCore is a light Linux system without X-windows, based on ubuntu core, It uses the Qt-Embedded's GUI and is popular in industrial and enterprise applications.

Besides the regular Ubuntu core's features our FriendlyCore has the following additional features:

  • it supports our LCDs with both capacitive touch and resistive touch(S700, X710, HD702, S430, HD101 and S70)
  • it supports WiFi
  • it supports Ethernet
  • it supports Bluetooth and has been installed with bluez utilities
  • it supports audio playing
  • it supports Qt5.9 EGLES and OpenGL ES1.1/2.0 (Only for S5P4418/S5P6818)

FriendlyCore's User Accounts

  • If your board is connected to an HDMI monitor you need to use a USB mouse and keyboard.
  • 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 board to a PC via the PSU-ONECOM and you can power on your board from either the PSU-ONECOM or its MicroUSB:

For example, NanoPi-M1:
PSU-ONECOM-M1.jpg
You can use a USB to Serial conversion board too.
Make sure you use a 5V/2A power to power your board from its MicroUSB port:
For example, NanoPi-M1:
USB2UART-NEO2.jpg

  • FriendlyCore User Accounts:

Non-root User:

   User Name: pi
   Password: pi

Root:

   User Name: root
   Password: fa

The system is automatically logged in as "pi". You can do "sudo npi-config" to disable auto login.

  • Update packages
$ sudo apt-get update

Configure System with npi-config

The npi-config is a commandline utility which can be used to initialize system configurations such as user password, system language, time zone, Hostname, SSH switch , Auto login and etc. Type the following command to run this utility.

$ sudo npi-config

Here is how npi-config's GUI looks like:
npi-config

Develop Qt Application

Please refer to: How to build Qt application

Setup Program to AutoRun

You can setup a program to autorun on system boot with npi-config:

sudo npi-config

Go to Boot Options -> Autologin -> Qt/Embedded, select Enable and reboot.

Extend TF Card's Section

When FriendlyCore is loaded the TF card's section will be automatically extended.You can check the section's size by running the following command:

$ df -h

WiFi

For either an SD WiFi or a USB WiFi you can connect it to your board in the same way. The APXX series WiFi chips are SD WiFi chips. By default FriendlyElec's system supports most popular USB WiFi modules. Here is a list of the USB WiFi modules we tested:

Index Model
1 RTL8188CUS/8188EU 802.11n WLAN Adapter
2 RT2070 Wireless Adapter
3 RT2870/RT3070 Wireless Adapter
4 RTL8192CU Wireless Adapter
5 mi WiFi mt7601

You can use the NetworkManager utility to manage network. You can run "nmcli" in the commandline utility to start it. Here are the commands to start a WiFi connection:

  • Check device list
sudo nmcli dev

Note: if the status of a device is "unmanaged" it means that device cannot be accessed by NetworkManager. To make it accessed you need to clear the settings under "/etc/network/interfaces" and reboot your system.

  • Start WiFi
sudo nmcli r wifi on
  • Scan Surrounding WiFi Sources
sudo nmcli dev wifi
  • Connect to a WiFi Source
sudo nmcli dev wifi connect "SSID" password "PASSWORD" ifname wlan0

The "SSID" and "PASSWORD" need to be replaced with your actual SSID and password.If you have multiple WiFi devices you need to specify the one you want to connect to a WiFi source with iface
If a connection succeeds it will be automatically setup on next system reboot.

For more details about NetworkManager refer to this link: Use NetworkManager to configure network settings

If your USB WiFi module doesn't work most likely your system doesn't have its driver. For a Debian system you can get a driver from Debian-WiFi and install it on your system. For a Ubuntu system you can install a driver by running the following commands:

$ sudo apt-get install linux-firmware

In general all WiFi drivers are located at the "/lib/firmware" directory.


Ethernet Connection

If a board is connected to a network via Ethernet before it is powered on it will automatically obtain an IP with DHCP activated after it is powered up. If you want to set up a static IP refer to: Use NetworkManager to configure network settings

Set Audio Device

If your system has multiple audio devices such as HDMI-Audio, 3.5mm audio jack and I2S-Codec you can set system's default audio device by running the following commands.

  • After your board is booted run the following commands to install alsa packages:
$ apt-get update
$ apt-get install libasound2
$ apt-get install alsa-base
$ apt-get install alsa-utils
  • After installation is done you can list all the audio devices by running the following command. Here is a similar list you may see after you run the command:
$ aplay -l
card 0: HDMI
card 1: 3.5mm codec
card 2: I2S codec

"card 0" is HDMI-Audio, "card 1" is 3.5mm audio jack and "card 2" is I2S-Codec. You can set default audio device to HDMI-Audio by changing the "/etc/asound.conf" file as follows:

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

If you change "card 0" to "card 1" the 3.5mm audio jack will be set to the default device.
Copy a .wav file to your board and test it by running the following command:

$ aplay /root/Music/test.wav

You will hear sounds from system's default audio device.
If you are using H3/H5/H2+ series board with mainline kernel, the easier way is using npi-config

Connect to USB Camera(FA-CAM202)

The FA-CAM202 is a 200M USB camera. You can refer to <Connect DVP Camera (CAM500B) to Board> on how to connect a USB camera to a board.
You need to change the start.sh script and make sure it uses a correct /dev/videoX node. You can check your FA-CAM202's node by running the following commands:

$ apt-get install v4l-utils
$ v4l2-ctl -d /dev/video1 -D
Driver Info (not using libv4l2):
        Driver name   : uvcvideo
        Card type     : HC 3358+2100: HC 3358+2100
        Bus info      : usb-1c1b000.usb-1
	...

Information above indicates that /dev/video1 is the device node of the FA-CAM 202.

Check CPU's Working Temperature with Commandline Utility

You can get CPU's working temperature by running the following command in a commandline utility:

$ cpu_freq
CPU0 online=1 temp=26581 governor=ondemand cur_freq=480000
CPU1 online=1 temp=26581 governor=ondemand cur_freq=480000
CPU2 online=1 temp=26581 governor=ondemand cur_freq=480000
CPU3 online=1 temp=26581 governor=ondemand cur_freq=480000

This message means there are currently four CPUs working. All of their working temperature is 26.5 degree in Celsius and each one's clock is 480MHz.

Check System Information with Rpi-Monitor

Our OS contains the Rpi-Monitor utility with which users can check system information and status.
In our case our board's IP was 192.168.1.230 and we typed the following IP in a browser:

192.168.1.230:8888

We were directed to the following page:
rpi-monitor
Users can easily check these system information and status.

Test Watchdog

You can test watchdog by running the following commands:

$ cd /root/demo/watchdog/
$ gcc watchdog_demo.c -o watchdog_demo
$ ./watchdog_demo /dev/watchdog0 10
Set timeout: 10 seconds
Get timeout: 10 seconds
System will reboot in 10 second

System will reboot in 10 seconds.

Test Infrared Receiver

Note: this only applies to boards(such as NanoPi M1, NanoPi M1 Plus and etc) that have an infrared receiver. If you want to test boards(such as NanoPi NEO, NanoPi NEO Air and etc) that don't have an infrared receiver but have infrared pins you need to connect an infrared module to pin GPIOL11.
By default the infrared function is disabled you can enable it by using the npi-config utility:

$ npi-config
    6 Advanced Options     Configure advanced settings
        A8 IR              Enable/Disable IR
            ir Enable/Disable ir[enabled]

Reboot your system and test its infrared function by running the following commands:

$ apt-get install ir-keytable
$ echo "+rc-5 +nec +rc-6 +jvc +sony +rc-5-sz +sanyo +sharp +mce_kbd +xmp" > /sys/class/rc/rc0/protocols   # Enable infrared
$ ir-keytable -t
Testing events. Please, press CTRL-C to abort.

"ir-keytable -t" is used to check whether the receiver receives infrared signals. You can use a remote control to send infrared signals to the receiver. If it works you will see similar messages as follows:

1522404275.767215: event type EV_MSC(0x04): scancode = 0xe0e43
1522404275.767215: event type EV_SYN(0x00).
1522404278.911267: event type EV_MSC(0x04): scancode = 0xe0e42
1522404278.911267: event type EV_SYN(0x00).

Access GPIO Pins/Wirings with WiringNP

The wiringPi library was initially developed by Gordon Henderson in C. It contains libraries to access GPIO, I2C, SPI, UART, PWM and etc. The wiringPi library contains various libraries, header files and a commandline utility:gpio. The gpio utility can be used to read and write GPIO pins.
FriendlyElec integrated this utility in FriendlyCore system allowing users to easily access GPIO pins. For more details refer to WiringNP WiringNP

Run Qt Demo

Run the following command

$ sudo /opt/QtE-Demo/run.sh

Here is what you expect to observe. This is an open source Qt Demo:
K2-QtE

Play & Record Audio

You can play and record audio by running the following commands
Check audio devices:

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Codec [H3 Audio Codec], device 0: CDC PCM Codec-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Both Allwinner H5 and H3 have an internal codec which is recognized as [H3 Audio Codec]. You need to use the actual device name that your [H3 Audio Codec] device is recognized as in your system.

Play Audio:

$ aplay /root/Music/test.wav -D plughw:0

Parameter "-D plughw:0" means the "card 0" device is used to play the audio file. You need to choose a device from the list obtained by running "aplay -l".
Record Audio:

$ arecord -f cd -d 5 test.wav

Compile FriendlyCore Source Code

Use Mainline BSP

K1 Plus now works with a 64-bit Linux kernel and a 64-bit Ubuntu Core 16.04 system. For more details on how to use a mainline U-boot and Linux-4.x.y refer to:Mainline U-boot & Linux

Work with External Modules

Matrix - 2'8 SPI Key TFT LCD Module

The Matrix-2'8_SPI_Key_TFT LCD module is a 2.8' TFT LCD module with resistive touch. It uses the ST7789S IC and XPT2046 resistive touch IC. The LCD's resolution is 240 * 320. Its interface is SPI. The module has three independent buttons which are user-configurable. For more details refer to:Matrix - 2'8 SPI Key TFT
File:Matrix-2'8_SPI_Key_TFT-1706

3D Printed Housing

Resources

Datasheet and Schematics


Update Log

April-19-2018

  • Released English Version