1 Introduction

Overview

Front

Back

The NanoPC-T4 is by far the smallest RK3399 based high-performance ARM board with popular ports and interfaces. Its software is fully open source. It is as small as 100 x 64 mm. It has 4GB LPDDR3 RAM, 16GB eMMC flash, onboard 2.4G & 5G dual-band WiFi module and a full standard M.2 PCIe interface which supports an NVME SSD high-speed hard drive. The NanoPC-T4 supports GPU and VPU acceleration and works with Android 7.1 and Lubuntu Desktop.

The RK3399 SoC has an internal Mali-T860 GPU which has powerful capabilities of processing 3D and HD H.265/H2.64 video streams. It supports dual camera inputs, dual ISP interface capable of doing image processing up to 13MPix/s. The NanoPC-T4 is a perfect platform for AI and deep learning applications. It can be widely used in advertisement machines, game machines, video conference applications, surveillance systems, clusters, VR/AR applications, machine vision applications and etc.

6.2.2 Flash Image to eMMC with eflasher and SD card

Get an 8G SDHC card and backup its data if necessary;

Download and extract the rk3399-eflasher-OSNAME-YYYYMMDD.img.zip and win32diskimager;

Run the win32diskimager utility under Windows as administrator. On the utility's main window select your SD card's drive, the wanted image file EFlasher and click on "write" to start flashing the SD card. Under Linux run "dd" to flash the rk3399-eflasher-OSNAME-YYYYMMDD.img file to your SD card;

Take out the SD and insert it to NanoPC-T4's microSD card slot;

Press and hold NanoPC-T4's Power button and wait until the PWR LED is on which indicates the system is booted from the SD card and the EFlasher utility will be automatically launched. You can work with the EFlasher in multiple ways:

1: Connect an LCD or HDMI monitor to your board and work with EFlasher's GUI. If the LCD doesn't support touch functions you need to connect a USB mouse to your board and proceed;
2: Connect your board to a LAN, login onto the board with SSH and type "eflasher" in a commandline utility and proceed with prompts;(Note: when you login with SSH the username is root and the password is fa. Your board's IP address can be found by checking the router's system)
3: Login onto your board via a serial terminal and type "eflasher" to proceed;
4: Connect a lcd2usb to NanoPC-T4, press the K1 button on the LCD2USB board to select your wanted OS and press the K2 button to confirm. The installation process will be shown on lcd2usb;

After installation is done press the Power button to turn off the board and take out the SD card from NanoPC-T4;

Press and hold the Power button to turn on your board and it will be booted from eMMC;

Download DriverAssitant_v4.5.tgz, extract it and install it on a Windows PC;

Download your wanted image from images-for-eflasher and extract it. For example the image for Android 7 is "android-nougat-images.tgz". You can ignore the "idbloader.img" and "info.conf" files.

Download AndroidTool_Release_v2.54.zip, extract it and run AndroidTool.exe as administrator.

Import a parameter.txt for sections and configure a file for each section if needed:

Connect a DC power cord and an HDMI monitor to your NanoPC-T4, connect your NanoPC-T4 to a PC with a Type-C cable. Press and hold the Recovery button and the Power button for at least 1.5 seconds AndroidTools will prompt that a LOADER device is found

a) If eMMC hasn't been flashed with an image or the image inside is removed or damaged this eMMC will be recognized as a MASKROM device;
b) You can hold both the BOOT button and the Power button for at least 5 seconds to force the board to enter the MASKROM mode;
c) If your system shows "no device is found" you need to check if you have installed a driver or if your Type-C cable works and then try it again;
d) If your system is booted successfully you can run "reboot loader" on your board via adb or SSH and force your board to enter the LOADER mode.

Click on "Run" to download your wanted image to eMMC. A while later after the image is flashed successfully your board will be rebooted automatically.

If you want to update your system e.g. you want to replace the Linux system on your board with an Android system, you need to erase your eMMC by following the steps below:

Go to "Update Firmware" -> Select "MiniLoaderAll.bin" and then click on "Erase Flash"

Linux_Upgrade_Tool is a Linux utility provided by Rockchip. You need to use it together with a Type-C cable. It can be used to install an image to eMMC, delete image files from eMMC, read from and write to eMMC and etc.

Install upgrade_tool: download Linux_Upgrade_Tool_1.27.rar, extract it and set upgrade_tool's access right

If the image's MiniLoaderAll.bin has a different version or the image you want to flash to eMMC is different from the image that already exists in eMMC you need to erase eMMC and then flash your new image to it.
Boot your board and enter the LOADER mode, run the following commands to erase eMMC. If a prompt shows "Download Boot Start" and it lasts for 10 seconds you need to press the Reset button and run the following commands again.

7 Work with FriendlyDesktop

Arduino

Firefox

Scratch

FriendlyDesktop is a light-weighted Ubuntu desktop system. It is based on LXDE and has the following features:Latest Version － Based on Ubuntu 18.04 64Various Development Utilities － It is compatible with FriendlyCore and has integrated an optimized Qt5.10, QtCreator and Arduino IDE.Light-weighted － it consumes relatively less CPU resources than a common desktop system. When a system's RAM is sufficient it can achieve much better performance.Less Power Consumption － it consumes relatively less power or resources than a common desktop system to achieve the same performance.Compact and Neat － its desktop is based on GTK+ 2 and it supports multiple languages.Easy to Use － its GUI looks similar to MS Windows'.Customizable － Users can customize LXDE's GUI.Compatible － it is compatible with freedesktop.org.
FriendlyELEC has optimized support for Mali GPU and VPU in FriendlyDesktop for RK3399 and integrated drivers for X.org. FriendlyDesktop supports Hardware Cursor, OpenGL graphic acceleration, 4K video playing with hardware decoding.

7.1 Account & Password

Regular Account:

User Name: pi
Password: pi

Root:

User Name: root
Password: fa

7.2 WiFi Connection

Click on the icon on the top right in the FriendlyDesktop's main window, select your wanted WiFi hotspot and proceed with prompts

7.3 HDMI/DP LCD Resolution

7.4 Adjust HDMI overscan

Open the command line terminal and enter the command to operate, Note:
1) You need to login to the desktop;
2) If you are using ssh terminal, please use the same username as the desktop login. The default is pi. You cannot use the root user. you also need to assign the DISPLAY variable:

exportDISPLAY=:0.0

7.4.1 Query which resolutions the display supports

xrandr -q

7.4.2 Set resolution

For example set to 1920X1080@60Hz:

xrandr --output HDMI-1--mode 1920x1080 --refresh60

7.4.3 Adjust the HDMI overscan

For example, the transformation scaling horizontal coordinates by 0.8, vertical coordinates by 1.04 and moving the screen by 35 pixels right and 19 pixels down:

xrandr --output HDMI-1--transform0.80,0,-35,0,1.04,-19,0,0,1

7.4.4 Automatic adjustment at boot

Edit ~/.config/autostart/lxrandr-autostart.desktop，Write the full xrandr command to the key at the beginning of "Exec= as shown below：

7.5 eDP LCD Display Rotation

If you want to rotate an eDP LCD's display you can do it by commanding "xrotate.sh" to rotate its display to 90/180/270 degrees.
You can rotate display clockwise by 90 degrees by running the following command as root. This command calls lightdm to make your change effective immediately:

sudo xrotate.sh -m CW -r

For more details about its options you can run "xrotate -h".
Note: this command doesn't support HDMI display's rotation. If you want to rorate an HDMI's display you need to refer to X11's tech documents and make changes in "/etc/X11/xorg.conf".

Note: when you play a video with hardware decoding your player's display window doesn't rotate with your LCD's display

7.6 Test OpenGL ES

You can test it by clicking on the Terminator icon to start a commandline utility in the System Tools and run the following commands:

taskset -c4-5 glmark2-es2

7.7 4K Video Playing

7.7.1 Play with Qt Player with Hardware Decoding

FriendlyDesktop has integrated a Qt5-VideoPlayer utility. This utility has support for Rockchip's gstreamer plug-in and supports 4K video playing with hardware decoding. You can start it by following the steps below:
On FriendlyDesktop's main window open "Sound & Video" and click on "Qt5-VideoPlayer".

On the player's main window click on the bottom left's "Open" button to load a video file and double-click on its name on the file list to start video playing. Here is how it looks like. You can set the display window to full screen and adjust the volume:

7.7.2 Play with Linux Command

You can play it by running the following command in a commandline utility:

gst-player.sh

By default its voice will be output to audio jack. You can locate this script by commanding "which gst-player.sh". You can customize its behavior by making changes in this script.

7.8 Work with USB Camera

Connect a USB camera e.g. Logitech C270/C920 to a board that runs FriendlyDesktop. After your system is booted click on the "Other" menu option in the main window to start "xawtv" and you will be able to preview with this camera.

7.9 File Transfer with Bluetooth

Click on the "Preferences" in the main window's menu to start Bluetooth Manager and click on "Search" to search surrounding Bluetooth devices. Click on your wanted device, pair the device with your board and you will be able to do file transfer, here is how it looks like:

7.10 Install OpenCV

On FriendlyDesktop's main window click on System Tools -> Terminator to open a commandline utility and run the following commands to install OpenCV 3.4:

7.11 Develop Qt Applications

FriendlyDesktop has a Qt 5.10.0 which supports RK3399's OpenGL ES and Gstreamer 1.0 hardware acceleration and a QtCreator IDE which is ready and can be used to compile and run applications. Here is how it looks like:
When running the Qt app, you need to specify the platform parameter to xcb as follows:

./HelloQt --platform xcb

7.12 WiringPi and Python Wrapper

7.13 Switch audio default output device

7.13.1 Set the default output device

Edit the file /etc/pulse/default.pa and change the value of set-default-sink. When the value is 0, it means sound will output to HDMI, and 1 means it sound will output to the headphone jack, as shown below:

set-default-sink 0

7.13.2 Temporary switching during playback

This method is only valid for the current playback process:
Open the menu "Sound & Video" -> "PulseAudio Volume Control", click the "Built-in Audio Stereo" button on the interface to switch between different output devices, such as switching between HDMI and headphone jack.

7.15 Chromium web browser

7.16 Screen saver and auto sleep related settings

The screen saver configuration file is /etc/xdg/autostart/xset_command.desktop. The default factory settings are that the screen saver and DPMS are both closed. You can change the configuration by modifying this file.

7.17 Install Scratch

enter the following command:

sudoapt-get install scratch:arm64

7.18 Install Arduino IDE

enter the following command:

sudoapt-get install arduino:arm64

7.19 Using NVME SSD on FriendlyDesktop

8 Work with FriendlyCore

8.1 Introduction

FriendlyCore is a Ubuntu core based OS which doesn't have X Desktop. Its current version is 18.04

FriendlyCore targets enterprise users and is customized for industrial applications. FriendlyCore and Ubuntu base target different users. FriendlyCore has both a commandline utility and a two GUI utilities:
1）Qt 5.10.0 cuustomized for ROCKCHIP3399. It supports GPU and VPU acceleration and has modules like: QtQuick/QtWebEngine/QtMultimedia/WebGL and three display plug-ins:KMS, EGLFS and XCB;
2) Xorg system. It can run X11 applications and supports hardware acceleration;

FriendlyCore for RK3399 has the following features:

supports FriendlyElec's 7"LCD with capacitive touch - HD702. If a board is connected to both an LCD and an HDMI monitor the LCD and the HDMI monitor can be set to display either differently or the same;

supports Gstreamer 1.0 multi-media framework;

supports hard encoding video playing with either commandline utility or Qt player;

8.2 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

You can use a USB to Serial on NanoPC-T4：

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

$ sudoapt-get update

8.3 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:

8.4 Develop Qt Application

The Qt 5.10.0 FriendlyELEC ported for RK3399 supports the following plug-ins:KMS, EGLFS and XCB. All these three plug-ins support OpenGL ES and GPU hardware acceleration but in different ways:

KMS - it calls Linux kernel's DRM interface to display

EGLFS - it calls OpenGL ES interface to display

XCB - it runs on X11 server and is integrated in X11 windows system

Three plug-ins support different Qt features and here is a table:

Plug-in

OpenGL ES

QtWebEngine

QtMultimedia

Video Playing with Hardware Decoding

Different Display

KMS

Yes

No

Yes

No

Yes

EGLFS

Yes

No

Yes

No

No

XCB

Yes

Yes

Yes

Yes

Yes

We recommend to use KMS or XCB.

FriendlyCore has four scripts for setting Qt environmental variables for users and here is a table:

Script

Comment

/usr/bin/setqt5env-kms

set kms' environmental variables

/usr/bin/setqt5env-eglfs

set eglfs' environmental variables

/usr/bin/setqt5env-xcb

set xcb's environmental variables

/usr/bin/setqt5env-nogui

set environmental variables for a system without a Qt GUI

For instance, if you want to use KMS to display you can run the following commands:

. setqt5env-kms
./apps

(Note:there is a space between '.' and 's')

8.4.1 Setup Qt Development Envronment

FriendlyELEC developed two methods for RK3399 to cross-compile a Qt program:

8.4.2 Qt Demo

FriendlyCore has several Qt demo programs:

Qt QML: CinematicExperience

CinematicExperience is a utility for selecting a video file and it is developed with Qt QML.
This demo uses Qt QML's various features and runs very smoothly on RK3399. This performance is achieved by hardware and software optimization.
You can start it in a commandline utility by running the following commands:

cd/opt/Qt5_CinematicExperience
./run.sh

Here is what it looks like:

QQt WebEngine: web browser

Qt WebEngine uses Chromium and supports HTML5.
You can start it by running the following commands:

cd/opt/qt5-brower
./run.sh

Here is what it looks like:

Note:Qt WebEngine depends on the Xcb plug-in.

Qt Different Display

This demo shows that when a board is connected to an HDMI monitor and an eDP LCD these two devices display differently. You can start it by running the following commands:

cd/opt/qt5-multi-screen-demo
./run.sh

Here is what it looks like:

Qt Multimedia: qt5-player with hard decoding

The qt5-player works with Rockchip's gstreamer plug-in and supports 4K video playing. Since Rockchip's plug-in only supports output images to an X11 window the qt5-player needs to use XCB for display.
You can start the demo by running the following commands:

cd/opt/qt5-player
./run.sh

Here is what it looks like. You can set it to display in full-screen and adjust the voice's volume:

Qt WebGL demo: nmapper

Qt WebGL allows you to remotely access a Qt program running on your board.
Before you run the demo you need to connect your board to the internet and run the following commands:

cd/opt/qt5-nmapper
./run-with-webgl.sh

You can open a browser on another device, type the IP address of your board on the browser's address bar, enter and you will be able to see a Qt GUI. Here is what it looks like:

Qt VNC demo: Smart home applicance GUI

Qt VNC allows you to run a program as a VNC Server on your board and you can access the program from a VNC client on another device. This program can be developed with either QtWidgets or QML.
You can start it by running the following commands:

cd/opt/qt5-smarthome
./run-with-vnc.sh

Start a VNC viewer on a smart phone or mobile device and type your board's IP address and port number 5900. For instance if your board's IP address is 192.168.1.100 you can type "192.168.1.100:5900", enter and you will see the following GUI:

8.4.3 Play with Dual Cameras under Qt

This sample shows how to connect dual cameras to the board and play with them. Before run the sample make sure you connect dual cameras and an LCD to your board. In general popular UVC cameras should work however we suggest users use the following modules which we have tested:

8.5 Setup Program to AutoRun

8.6 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

8.7 Transfer files using Bluetooth

Take the example of transferring files to the mobile phone. First, set your mobile phone Bluetooth to detectable status, then execute the following command to start Bluetooth search.：

hcitool scan

Search results look like：

Scanning ...
2C:8A:72:1D:46:02 HTC6525LVW

This means that a mobile phone named HTC6525LVW is searched. We write down the MAC address in front of the phone name, and then use the sdptool command to view the Bluetooth service supported by the phone：

sdptool browser 2C:8A:72:1D:46:02

Note: Please replace the MAC address in the above command with the actual Bluetooth MAC address of the mobile phone.
This command will detail the protocols supported by Bluetooth for mobile phones. What we need to care about is a file transfer service called OBEX Object Push. Take the HTC6525LVW mobile phone as an example. The results are as follows：

As can be seen from the above information, the channel used by the OBEX Object Push service of this mobile phone is 12, we need to pass it to the obexftp command, and finally the command to initiate the file transfer request is as follows：

Note: Please replace the MAC address, channel and file name in the above command with the actual one.

After executing the above commands, please pay attention to the screen of the mobile phone. The mobile phone will pop up a prompt for pairing and receiving files. After confirming, the file transfer will start.

Bluetooth FAQ：
1) Bluetooth device not found on the development board, try to open Bluetooth with the following command：

rfkill unblock 0

2) Prompt can not find the relevant command, you can try to install related software with the following command：

8.8 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:

Change to root

$ su root

Check device list

$ 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

$ nmcli r wifi on

Scan Surrounding WiFi Sources

$ nmcli dev wifi

Connect to a WiFi Source

$ 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.

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:

$ apt-get install linux-firmware

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

8.9 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。

8.10 WiringPi and Python Wrapper

8.11 Select the system default audio device

You can set the system default audio device by following the steps below.
Use the following command to view all the sound card devices in the system (Note: different development boards will have different results):

SPDIF (Note: temporarily unavailable, because the hardware is not exported)...

To configure the audio output to the 3.5mm jack, modify the configuration file /etc/asound.conf and modify it to the following:

defaults.pcm.card 0
defaults.pcm.device 0

To configure to output audio to HDMI, change the defaults.pcm.card above to 1.
Note that some boards do not have a Realtek sound card (no 3.5mm jack interface), so the card number of the HDMI device will be 0, so the configuration should be based on the result of the aplay -l command.

8.12 Run the X11 application

FriendlyCore system built-in lightweight Xorg，although there is no window manager, you can still run a single X-Windows application，For example, the program to run is ~/YourX11App，use the following command：

. /usr/bin/setqt5env-xcb
startx ~/YourX11App -geometry 1280x800

Note that there is a space between "." and /usr/bin/setqt5env-xcb. In addition, the resolution after -geometry should be changed to the actual resolution of your screen.

8.13 Mpv hardware decoding video player

FriendlyCore comes pre-installed with the ffmpeg-based command line video player mpv, which also includes libmpv.
The mpv player supports Rockchip MPP video decoder, so it supports 4K hardware decoding. There are many parameters of mpv. In order to simplify the use, we provide a script start-mpv. After simplification, there is only one parameter: video file name, as follows:

start-mpv /home/pi/demo.mp4

It should be noted that the pi user needs to log in during playback, because there are no mpv related settings in other users' directories. Of course, you can copy one from the pi user directory. The mpv settings file is stored in the following path：

These will be passed as parameters to mpv. When the value of hwdec is rkmpp, it means using hardware decoding, audio-device is used to specify the audio output device, and the default output is to HDMI. You can use the following command to query which audio devices are in the system：

mpv --audio-device=help

Another important parameter is drm-osd-size. When playing video in full screen, drm-osd-size is specified as the resolution of the screen. This parameter is automatically obtained by start-mpv and passed to mpv, start-mpv script will do one more important thing. It needs to ensure that the libmali library in the system uses the correct version, because mpv renders the image through gbm, so libmali.so needs to use this version: libmali-midgard-t86x -r14p0-gbm.so, which means that this version of mpv can only be used under FriendlyCore, can not be used under X11 Desktop.
Mpv official use guide：https://github.com/mpv-player/mpv/wiki

9 Features applicable to FriendlyDesktop and FriendlyCore

9.1 Work with MIPI Camera OV13850 and MIPI WDR Camera OV4689 Under Linux

Hardware Setting:
The Camera module can be connected to a MIPI port:

FriendlyELEC provides a test script "gst-camera.sh" to test a camera's functions. You can run it in a commandline to test picture taking and video recording.
You may try update this script to the lastest version by using the following commands:

If only one camera is connected, no matter which CSI interface is connected, the device (selfpath) used for preview is /dev/video0, and the device (mainpath) used for photographing is /dev/video2, if 2 cameras are connected at the same time. The camera nodes corresponding to the CSI1 interface are /dev/video0 and /dev/video2, and CSI2 corresponds to /dev/video4 and /dev/video6, Note: When taking pictures, io-mode needs to be specified as 1.

sensor-id

If only one camera is connected, the sensor-id is 1 regardless of which CSI interface is connected. If two cameras are connected at the same time, the camera of the CSI1 interface is 1, and the camera of the CSI2 interface is 5.

path-iqf

Specify the camera's tuning xml file. When the camera is OV4689, you need to specify /etc/cam_iq/rk-ov4689.xml. When the camera is OV13850, you need to specify /etc/cam_iq/rk-rk-ov13850.xml.

rkximagesink or kmssink

rkximagesink for FriendlyDesktop, will display on X11 window, kmssink for FriendlyCore, directly display on the screen

The results are shown below:
To play the video, you can use the ffmpeg-based player mpv. The 4K video used for the above test can be found in the test-video directory of the network disk. The network address is http://dl.friendlyarm.com/nanopct4.

10 Work with Lubuntu

11 Work with Android 8.1

FriendlyElec provides a full Android8.1 BSP for NanoPC-T4. The source code is hosted at gitlab.com and is open source. The BSP supports GPU and VPU hardware acceleration.

11.1 Connect MIPI Camera to NanoPC-T4

FriendlyElec developed a MIPI camera CAM1320 for board and it works under Android. You can use this camera to take pictures and record video. The operation is straightforward. You just need to connect the camera at your board's MIPI interface, boot your board to Android and start Android's camera app.
The board has two MIPI interfaces: one front camera and the other rear camera：MIPI-CSI1 <--> Android rear cameraMIPI-CSI2 <--> Android front camera

How to connect：

11.2 Use dual MIPI camera preview and video

Download the sample source code below from github and compile and run it：

After the application is installed, you need to Set Android permissions to make the demo run normally. The method is enter system ui: Settings -> Apps & notifications -> Dual Camera -> Permissions, Select the following permissions：

Camera
Microphone
Storage

The gui looks like this：
Click the "CAPTURE VIDEO" button on the gui to record the video (two cameras at the same time), and the video file will be saved to the following location.：/storage/emulated/0/Download/dualcamera_h264.mp4.
Known issue：
Recorded video file will play faster than normal, may need to adjust some parameters of mediacodec.

11.3 Change system language

The default system language of Android system is English. For example, if we want to set it to Chinese, the steps are as follows:
1) Go to Android settings：Settings -> System -> Languages & Input -> Languages;
2）Click "Add a language", Select "简体中文", and then select "中国";
3) At this time, there will be two languages, Chinese and English. Drag the Chinese item to the top of the list. Note that if you are using a mouse, drag it by placing the mouse pointer on the right side of the list item. On the icon and then press the middle mouse button to drag;

11.4 Android8.1 hardware access

You can use the FriendlyThings SDK to access and control hardware resources on the motherboard in the Android App, such as Uart, SPI, I2C, GPIO and other interfaces. For details, please refer to the following two documents.：

11.5 Android Neural Networks SDK Sample

Android8.1 BSP comes pre-installed with Rockchip's Android NN SDK for Android 8.1, supporting GPU acceleration.。
Sample program for Android NN pre-installed in the Android8 firmware we provide：TfLiteCameraDemo，This is a MobileNet classifier demo using Rockchip AndroidNN GPU acceleration，The camera module is required to be connected to the motherboard during operation. The USB camera and CSI camera are supported，The sample program is launched by clicking the "TfLiteCameraDemo" icon on the home page. The running effect is as follows：

11.6 Using the adb

1. The first time you start the system, if you need to change the system files, you need to turn off security verification (note: apk installation does not need to be closed), and restart after turning off security verification

adb root
adb disable-verity
adb reboot

2. After restarting, get root and remount /system to enable write permissions

adb root
adb remount

3. Upload a file

adb push example.txt /system/

11.7 HDMI resolution and overscan setting

If an HDMI display device is connected, go to Android Settings -> Display -> Advanced -> HDMI & Rotation to set it up.

HDMI Resolution

The default is Auto, you can manually set the display resolution, up to 4K resolution

11.8 Screen rotation

Use the following command in shell to test screen rotation (Settings not saved)：

wm rotation 90

11.9 Switch audio output channel

You can configure the audio output to the HDMI or headphone jack, Setting interface entry method: Android Settings -> Accessibility -> Force audio output.
If the Force audio output menu item is gray, that is, it is in an unselectable state, the hardware you are using will automatically detect the headphone plug-in status and automatically switch the audio channel without setting.

11.10 Adjust the volume of the recording

1) First use the amix command to adjust the volume of the recording through the serial port or the adb shell with root privileges, for example:

Amix "IN2 Boost"
Amix "ADC Capture Volume"

The above command is used to view the current settings.
2) After debugging, modify the value of the corresponding configuration item in the rt5651_main_mic_capture_controls array in the hardware/rockchip/audio/tinyalsa_hal/codec_config/rt5651_config.h file, compile the Android source code and test it.

11.11.4 How to make animation

11.12 Remove Google Framework

If you don't need to use the google service, you can delete the Google framework to save system resources by deleting the following directory in the Android source code and recompiling Android:
vendor/google

11.13 Navigate Android with Remote Control

The NanoPC-T4 supports the FriendlyARM RC-100 remote control under Android. To get a better experience your can connect your T4 to an HDMI monitor and navigate Android.

Here is a table for the remote control's keys and corresponding functions:

Key

Function

Up

Navigate - Up

Down

Navigate - Down

Left

Navigate - Left

Right

Navigate - Right

OK

Confirm

-

Volume -

+

Volume +

Mute

Mute

Menu

Android Menu

Home

Android Home

Return

Android Return

F1

Pull-Down Android Message Bar

F2

Android Screenshot

F3

Switch between mouse and key

11.14 Work with USB Camera to Take Pictures and Record Video

FriendlyELEC's Android system supports picture taking and video recording with a USB camera, Android's camera app has these functions. When you use the app to take pictures or record video you need to be aware of the following two things:
1) Make sure your camera's resolution works. We suggest you try a camera with a lower CIF resolution first. If it works you may switch to a camera with a higher resolution:;
2）A USB camera cannot work simultaneously with a MIPI camera. Plug and play is not supporter for camera modules. After you connect a camera to a board you need to reboot your board to enable the camera.

Here are the camera modules we tested: Logitech C270 and LogitechC922 PRO
In our test the resolution was 1080P when we used a Logitech C922 PRO to take pictures or record video.

11.15 Work with 4G Module EC20 under Android

11.15.1 Hardware Setup

Connect an EC20 module to a USB to miniPCIe board and connect the board to an ARM board's USB Host. Here is a hardware setup:
Power on the board and you will be able to surf the internet with the 4G module like using an Android phone.

11.15.2 Activate EC20's GPS Functions

By default GPS functions are disabled in Android. If GPS functions are enabled in Android but no GPS module is detected Android will continuously output log messages. After an EC20 module is connected you can enable GPS functions.
To enable the GPS functions open the "vendor/quectel/ec20/BoardConfigPartial.mk" file and change the following line:

13.3 Compile Android8.1 Source Code

13.3.1 Download Android8.1 Source Code

There are two ways to download the source code:

repo archive file on netdisk

Netdisk URL: Click here
File location on netdisk：sources/rk3399-android-8.1.git-YYYYMMDD.tgz (YYYYMMDD means the date of packaging)
After extracting the repo package from the network disk, you need to execute the sync.sh script, which will pull the latest code from gitlab:

13.3.2 Generate Image File

You can compile an Android source code and generate an image file:

cd rk3399-android-8.1
./build-nanopc-t4.sh -F-M

13.3.3 Update System with New Image

After compilation is done a new image file will be generated in the "rockdev/Image-nanopc_t4/" directory under Android 8.1's source code directory. You can follow the steps below to update the OS in NanoPC-T4:
1) Insert an SD card which is processed with EFlasher to an SD card reader and insert this reader to a PC running Ubuntu. The SD card's partitions will be automatically mounted;
2) Copy all the files under the "rockdev/Image-nanopc_t4/" directory to the SD card's android8 directory in the "FRIENDLYARM" partition;
3) Insert this SD card to NanoPC-T4 and reflash Android
Here is an alternative guide to update OS: sd-fuse_rk3399

13.4 Compile Android7 Source Code

13.4.1 Download Android7 Source Code

There are two ways to download the source code:

repo archive file on netdisk

Netdisk URL: Click here
File location on netdisk：sources/rk3399-android-7.git-YYYYMMDD.tgz (YYYYMMDD means the date of packaging)
After extracting the repo package from the network disk, you need to execute the sync.sh script, which will pull the latest code from gitlab:

13.4.2 Generate Image File

You can compile an Android7 source code and generate an image file:

cd rk3399-nougat
./build-nanopc-t4.sh -F-M

13.4.3 Update System with New Image

After compilation is done a new image file will be generated in the "rockdev/Image-nanopc_t4/" directory under Android7's source code directory. You can follow the steps below to update the OS in NanoPC-T4:
1) Insert an SD card which is processed with EFlasher to an SD card reader and insert this reader to a PC running Ubuntu. The SD card's partitions will be automatically mounted;
2) Copy all the files under the "rockdev/Image-nanopc_t4/" directory to the SD card's android8 directory in the "FRIENDLYARM" partition;
3) Insert this SD card to NanoPC-T4 and reflash Android
Here is an alternative guide to update OS: sd-fuse_rk3399

After compilation is done a kernel.img and a resource.img will be generated. You can simply copy them to replace the existing files in your eflasher SD card. We assume your SD card's FRIENDLYARM partition is mounted at the FRIENDLYARM directory and you can run the following commands to update system:

After compilation is done a uboot.img, a trust.img and a rk3399_loader_v1.12.109.bin will be generated. You need to rename the rk3399_loader_v1.12.109.bin to "MiniLoaderAll.bin" and copy it to replace the existing file in your eflasher SD card. We assume your SD card's FRIENDLYARM partition is mounted at the FRIENDLYARM directory. You can run the following commands to update system:

16 More OS Support

16.1 DietPi_NanoPCT4-ARMv8-Stretch

DietPi is a light-weighted system. Its image file can be as small as 345M bytes. It takes much less resources. It has a DietPi-RAMlog utility. These features allow users to exploit its huge potentials.
FriendlyElec doesn't provide technical support for DietPi.

Here are some steps to boot a DietPi:

Download DriverAssitant_v4.5.tgz, extract it and install it on a Windows PC;

It is assumed that the section configuration(parameter.txt) is imported and here is a table:

Connect a 12V/2A DC power cord and an HDMI monitor to your T4, connect your T4 to a PC with a Type-C cable. Press and hold the Recovery button and the Power button for at least 1.5 seconds AndroidTools will prompt that a LOADER device is found

a)If eMMC hasn't been flashed with an image or the image inside is removed or damaged this eMMC will be recognized as a MASKROM device;
b)You can hold both the BOOT button and the Power button for at least 5 seconds to force the board to enter the MASKROM mode;
c)If your system shows "no device is found" you need to check if you have installed a driver or if your Type-C cable works and then try it again;
d)If your system is booted successfully you can run "reboot loader" on your board via adb or SSH and force your board to enter the LOADER mode.

Click on "Run" to download your wanted image to eMMC. A while later after the image is flashed successfully your board will be rebooted automatically.

Login User Name:root
Password:dietpi

16.2 WiFi

By default WiFi is not enabled. You can enable WiFi by running "dietpi-config".
dietpi-config

18 Schematic, PCB CAD File

19 Update Log

19.1 2019-03-08

Add Buildroot project：

Add Buildroot Linux system, based on Rockchip original RK3399 Linux SDK, project open source, please refer to the details：Buildroot for RK3399

Android 8.1 update is as follows:

1) Optimized LCD and HDMI screen rotation settings, support for command line operations (command: wm rotation 90)
2) Fix the problem that the microphone cannot sound after forcing the audio output to the headphones

FriendlyCore, FriendlyDesktop, Lubuntu is updated as follows:

1) Kernel version updated to v4.4.154
2) Docker support
3) Kernel configuration items are optimized to enable more features and device drivers
4) Fixed an issue where USB WiFi could not be used
5) Fix the stability problem of ISP camera

1) Added OV13850 and wide dynamic OV4689 camera support
2) Add Chrome-browser browser, support web page 1080P hardware decoding, support WebGL
3) Set the audio output channel to HDMI by default (can be modified by /etc/asound.conf)
4) Optimize the local hard disk player, associated with the local mp4 file, double-click the local video to start the local hard disk player playback (only mp4 files are supported)
5) Fixed some issues regarding the package error reported in the previous version
6) Adjust DPMS settings, turn off automatic sleep by default

19.3 2018-11-12

Android 8.1 update is as follows:

1) Add support for USB-C display
2) Add support for 4G network, the model number of the support module is: Quectel EC20
3) Add Android hardware access library FriendlyThing for programming various hardware resources under Android, such as Uart, SPI, I2C, GPIO, etc.
4) Optimize kernel configuration to improve PCIe performance, and connect NVME SSD will have a large performance improvement
5) Integrate the Google Play app store
6) Improve the underlying support of the camera so that it can automatically adapt to vertical screen (HD702E) and landscape (HDMI)
7) Fix the problem that the partition table is abnormal when Android8 is connected to NVME SSD and Android8 cannot be started.

Android 7.1 update is as follows:

1) Add support for 4G network, the model number of the support module is: Quectel EC20
2) Add Android hardware access library FriendlyThing for programming various hardware resources under Android, such as Uart, SPI, I2C, GPIO, etc.
3) Optimize kernel configuration to improve PCIe performance, and connect NVME SSD will have a large performance improvement
4) Improve the underlying support of the camera so that it can automatically adapt to vertical screen (HD702E) and landscape (HDMI)
5) Fix the problem that the partition table is abnormal when Android8 is connected to NVME SSD and Android8 cannot be started.

FriendlyCore and FriendlyDesktop are updated as follows:

1) Added support for OV13850 camera, provides gsteamer plugin to support ISP
2) Add WiringPi support for C language programming to access hardware resources such as GPIO
3) Added WiringPi-Python support for Python programming access to hardware resources such as GPIO
4) Optimize kernel configuration to improve PCIe performance, and connect NVME SSD will have a large performance improvement

19.4 2018-09-21

Added support for an eDP screen

Linux has enabled PCI-E to Sata function (AHCI SATA support)

SquashFS under Linux enables LZO/XZ/ZSTD compression support

19.5 2018-09-05

Add new OS: Android 8.1, the main features are as follows:

1) Support 2 CAM1320 (OV13850) at the same time, you can choose to switch between before and after camera use
2) Support USB camera (1 way, can not be used simultaneously with CAM1320)
3) Support AndroidNN GPU acceleration solution, which provides general acceleration support for AI related applications developed with AndroidNN API
4) Integrate the Tensorflow Lite item identification demo provided by Rockchip: TfLiteCameraDemo (connect CAM1320 or USB camera before starting)
5) Integrated Lightning is the default browser application (Note: Android official does not provide Browser application by default)
6) Support RC-100 infrared remote control, support pull-down notification bar, screen capture
7) Support Android full disk encryption function, system partition has Verity enabled, when using adb, adb root; adb disable-verity command disable Verity
8) Support MTP function, after connecting Type-C, you can enter Settings -> Connected devices -> USB to select the corresponding function
9) Upgrade the kernel version to 4.4.126
10) Update the AOSP source to the version android-8.1.0_r41 and update the August security patch

FriendlyCore adds Qt dual camera sample program: the example is located in /opt/dual-camera directory, run by run.sh (two USB cameras must be connected before starting, it is recommended to use Logitech C270 or Logitech C922 camera)