SOM-RK3399

From FriendlyARM WiKi
Jump to: navigation, search

查看中文

Contents

1 Introduction

Front
Back
Overview
  • The SOM-RK3399 is a 260-pin high performance ARM module designed and developed by FriendlyElec. It is based on Rockchip’s 64-bit hexa-core RK3399 SoC. The regular version has 2GB DDR3 RAM, 16GB Flash, onboard 2x2 MIMO dual-antenna WiFi module. Its dimension is 69.6 x 50 mm. It has a TypeC power port and USB-C display port, and can work by itself without a carrier board.
  • The SOM-RK3399 module has various interfaces and ports. It can drive a 4-channel NVMe high speed SSD hard disk by working with a carrier board and the read/write rate can reach up to 1GB/s. It can drive dual-MIPI WDR cameras. It has an eDP interface, MIPI interface, USB 3.0, two USB 2.0 interfaces and other interfaces such as I2C, I2S, SPI, PWM, GPIO, serial and etc.
  • The SOM-RK3399 can run popular OS systems such as Android 8.1, Ubuntu 18.04, Armbian and Buildroot smoothly. It has well established software support. Especially it has NN SDK packages for neural networks in Android 8.1, VPU hardware encoding/decoding in Qt-5.10, and GPU graphic acceleration. It supports development of dynamic GUI with Qt Quick. It is a perfect platform for startups to develop applications and prototypes in facial detection, machine vision, VR, autonomous-driving, deep learning, AI and etc.

2 Hardware Spec

  • SoC: Rockchip RK3399
    • CPU: big.LITTLE,Dual-Core Cortex-A72(up to 2.0GHz) + Quad-Core Cortex-A53(up to 1.5GHz)
    • GPU: Mali-T864 GPU,supports OpenGL ES1.1/2.0/3.0/3.1, OpenCL, DX11, and AFBC
    • VPU: 4K VP9 and 4K 10bits H265/H264 60fps decoding, Dual VOP, etc
  • PMU: RK808-D PMIC, cooperated with independent DC/DC, enabling DVFS, software power-down, RTC wake-up, system sleep mode
  • RAM: Dual-Channel 2GB DDR3
  • Flash: 16GB eMMC 5.1 Flash
  • Ethernet: Native Gigabit Ethernet
  • Wi-Fi/BT: 802.11a/b/g/n/ac, Bluetooth 4.1, Wi-Fi and Bluetooth combo module, 2x2 MIMO, dual antenna interface
  • Video Input: one or two 4-Lane MIPI-CSI, dual ISP, up to 13MPix/s,supports simultaneous input of dual camera data
  • Video output
    • HDMI: HDMI 2.0a, supports 4K@60Hz,HDCP 1.4/2.2
    • DP on Type-C: DisplayPort 1.2 Alt Mode on USB Type-C
    • LCD Interface: one eDP 1.3(4-Lane,10.8Gbps), one or two 4-Lane MIPI-DSI
  • USB
    • USB 2.0: 2 independent native USB 2.0 Host
    • USB 3.0: 1 native USB 3.0 Host
    • USB Type-C: Supports USB3.0 Type-C and DisplayPort 1.2 Alt Mode on USB Type-C
  • PCIe: PCIe x4, compatible with PCIe 2.1, Dual operation mode;
  • SDIO/MMC: 1x SDIO/MMC for SD Card
  • GPIOs, I2S, I2C, PWM, UART, SPI, ADCs
    • 2 X 1.8V I2C, 1 x 3V I2C
    • 1 x 3V UART/SPI
    • 2 x PWM
    • 1 x IR-RX
    • 1 x SPDIF_TX
    • 1 x 1.8V I2S,
    • 6 x 1.8V GPIOs, 8 x 3V GPIOs
    • ADC: 3 x 1.8V ADC inputs
  • Debug: one Debug UART, 3V level, 1500000bps
  • Keys: PowerKey, Reset, Recovery
  • LED: 1 x power LED and 1 x GPIO Controlled LED
  • Power supply: DC 12V/1A
  • PCB: 8 Layer, 50 mm x 69.6 mm, 260 Pin edge connector
  • Ambient Operating Temperature: -20℃ to 70℃

3 Diagram, Layout and Dimension

SOM-RK3399 1904-layout.jpg

Top Bottom
Pin# Assignment Pin Type If Not Use Description Pin# Assignment Pin Type If Not Use Description
1 VCC_IN Power IN / 12V Power Input 2 VCC_IN Power IN / 12V Power Input
3 VCC_IN Power IN / 4 VCC_IN Power IN /
5 VCC_IN Power IN / 6 VCC_IN Power IN /
7 VCC_IN Power IN / 8 VCC_IN Power IN /
9 GND Power / System Ground(0V) 10 GND Power / System Ground(0V)
11 GND Power / 12 GND Power /
13 VCC5V0_SYS Power OUT float 5V Power Output,2A max. Auto on when system power on, and off when system power off. 14 PWR_KEY In float System Power Key signal, active low, internal pulled up to 3.3V with 10K
15 VCC5V0_SYS Power OUT float 16 VDC_ONOFF In float Power On Mode Select, float for Auto Start,short to GND for PowerKey Mode
17 VCC5V0_SYS Power OUT float 18 RTC_BATT_IN Power IN float RTC backup battery(3V)input,backup current is 25uA
19 VCC5V0_SYS Power OUT float 20 RECOVERY In float System RECOVERY Key signal,acticve low
21 VCC3V3_SYS Power OUT float 3.3V Power Output,1A max. Auto on when system power on, and off when system power off. 22 RESET_IN_H In float RESET signal, acticve hight
23 VCC3V3_SYS Power OUT float 24 GND Power / System Ground(0V)
25 VCC3V3_SYS Power OUT float 26 ADC_IN0 In float 0V to 1.8V inputs of RK3399 SoC ADC
27 VCC3V3_SYS Power OUT float 28 ADC_IN2 In float
29 VCC_1V8 Power OUT float 1.8V Power Output,200mA max. Auto on when system power on, and off when system power off. 30 ADC_IN3 In float
31 VCC_1V8 Power OUT float 32 GND Power / System Ground(0V)
33 VCC3V3_S3 Power OUT float 3.3V Power Output,100mA max. Auto on when system power on, and off when system sleep or power off. 34 GPIO1_A0 In/Out float 3V GPIO. Linux GPIO 32
35 GND Power / System Ground(0V) 36 GPIO1_A1 In/Out float 3V GPIO. Linux GPIO 33
37 GPIO0_A2 In/Out float 1.8V GPIO. Linux GPIO 2 38 GPIO1_A3 In/Out float 3V GPIO. Linux GPIO 35
39 GPIO2_A2 In/Out float 1.8V GPIO. Linux GPIO 2 40 GPIO1_A4 In/Out float 3V GPIO. Linux GPIO 36
41 GPIO2_A3 In/Out float 1.8V GPIO. Linux GPIO 67 42 GPIO1_C2 In/Out float 3V GPIO . Linux GPIO 50
43 GPIO2_A4 In/Out float 1.8V GPIO. Linux GPIO 68 44 GPIO1_C6 In/Out float 3V GPIO. Linux GPIO 54
45 GPIO2_A5 In/Out float 1.8V GPIO. Linux GPIO 69 46 GPIO1_C7 In/Out float 3V GPIO . Linux GPIO 55
47 GPIO2_A6 In/Out float 1.8V GPIO. Linux GPIO 70 48 GPIO1_D0 In/Out float 3V GPIO . Linux GPIO 56
49 IR_RX In float Infrared Receiver input, 1.8V level 50 GPIO4_C5/SPDIF_TX In/Out float 3V GPIO . Linux GPIO 149. or SPDIF Output
51 GND Power / System Ground(0V) 52 UART2DBG_TX Out float Debug UART TX, 1500000bps, 3V level
53 I2C1_SCL Out float I2C1 clock, 1.8V level, open drian with 2.2K pulled internal 54 UART2DBG_RX In float Debug UART RX, 1500000bps, 3V level
55 I2C1_SDA In/Out float I2C1 data, 1.8V level, open drian with 2.2K pulled internal 56 SPI1_CSn0 Out float SPI1 chip select, 3V level
57 I2C2_SDA In/Out float I2C2 data, 1.8V level, open drian with 2.2K pulled internal 58 SPI1_TXD/UART4_TX Out float SPI1 MOSI, or UART4 TX,3V level
59 I2C2_SCL Out float I2C2 clock, 1.8V level, open drian with 2.2K pulled internal 60 SPI1_RXD/UART4_RX In float SPI1 MISO, or UART4 RX,3V level
61 I2C7_SCL_HDMI Out float I2C7 clock, 1.8V level, for HDMI EDID CLK, open drian with 2.2K pulled internal 62 SPI1_CLK Out float SPI1 Clock, 3V level
63 I2C7_SDA_HDMI In/Out float I2C7 data, 1.8V level, for HDMI EDID DATA, open drian with 2.2K pulled internal 64 GND Power / System Ground(0V)
65 GND Power / System Ground(0V) 66 GPIO4_C1/I2C3_SCL In/Out float I2C3 clock, 3V level,open drian. or GPIO,Linux GPIO 145
67 I2S0_SCLK Out float I2S0 continuous serial clock, 1.8V level 68 GPIO4_C0/I2C3_SDA In/Out float I2C3 data, 3V level,open drian. or GPIO,Linux GPIO 144
69 I2S0_LRCK_RX Out float I2S0 word select for input data, 1.8V level 70 I2C4_TPSCL Out float I2C4 clock,3V level, open drian with 2.2K pulled up,for touch panel
71 I2S0_LRCK_TX Out float I2S0 word select for output data, 1.8V level 72 I2C4_TPSDA In/Out float I2C4 data,3V level, open drian with 2.2K pulled up,for touch panel
73 I2S0_SDI0 In float I2S0 serial data, 1.8V level 74 GND Power / System Ground(0V)
75 I2S0_SDI1SDO3 In/out float I2S0 serial data, 1.8V level 76 HP_DET_H In Pull up to VCC3V3_SYS headphone insert detect, active hight
77 I2S0_SDI2SDO2 In/out float I2S0 serial data, 1.8V level 78 GPIO4_D5_LCD_BL_EN Out float LCD backlight on/off control, active hight, 3V level
79 I2S0_SDI3SDO1 In/out float I2S0 serial data, 1.8V level 80 GPIO4_D6_LCD_RST_H Out float LCD reset, active hight, 3V level.
81 I2S0_SDO0 out float I2S0 serial data, 1.8V level 82 GPIO1_B5_TP_RST Out float Touch panel reset, active low, 3V level
83 GND Power / System Ground(0V) 84 GPIO1_C4_TP_INT In float Touch panel IRQ, active low, 3V level
85 I2S_CLK out float I2S Mclk for I2S0 and I2S1 86 GND Power / System Ground(0V)
87 GND Power / System Ground(0V) 88 PWM0_BL Out float PWM0 for LCD backlight dimming
89 I2S1_SCLK Out float I2S1 continuous serial clock, 1.8V level 90 GPIO4_C6/PWM1 Out float PWM1 for cooling fan control
91 2S1_LRCK_RX Out float I2S1 word select for input data, 1.8V level 92 GND Power / System Ground(0V)
93 I2S1_LRCK_TX Out float I2S1 word select for output data, 1.8V level 94 VCC3V0_SD Power Out float 3V power out for SD card.
95 I2S1_SDI0 In float I2S0 serial data, 1.8V level 96 GND Power / System Ground(0V)
97 I2S1_SDO0 Out float I2S0 serial data, 1.8V level 98 SDMMC0_D0 In/Out float SD card Data0
99 MIPI_CSI0_RST Out float Camera Reset for MIPI CSI0, 1.8V level 100 SDMMC0_D1 In/Out float SD card Data1
101 MIPI_CSI0_PWN Out float Camera Power Down for MIPI CSI0, 1.8V level 102 SDMMC0_D2 In/Out float SD card Data2
103 MIPI_CSI1_RST Out float Camera Reset for MIPI CSI1, 1.8V level 104 SDMMC0_D3 In/Out float SD card Data3
105 MIPI_CSI1_PWN Out float Camera Power Down for MIPI CSI1, 1.8V level 106 SDMMC0_CMD Out float SD card CMD
107 VCC1V8_CAM Power Out float Power Out for Camera IO 108 SDMMC0_DET_L In float SD card detect
109 GND Power / System Ground(0V) 110 GND Power / System Ground(0V)
111 GPIO2_B3_CIF_CLKOUTA Out float MCLK for camera sensor 112 SDMMC0_CLK Out float SD card Clock
113 GND Power / System Ground(0V) 114 GND Power / System Ground(0V)
115 MIPI_RX0_D3N In float MIPI CSI0 negative differential data line 116 MIPI_TX1/RX1_D0N In/Out float MIPI CSI1/DSI1 negative differential data line
117 MIPI_RX0_D3P In float MIPI CSI0

positive differential data line

118 MIPI_TX1/RX1_D0P In/Out float MIPI CSI1/DSI1

positive differential data line

119 GND Power / System Ground(0V) 120 GND Power / System Ground(0V)
121 MIPI_RX0_D2N In float MIPI CSI0 negative differential data line 122 MIPI_TX1/RX1_D1N In/Out float MIPI CSI1/DSI1 negative differential data line
123 MIPI_RX0_D2P In float MIPI CSI0

positive differential data line

124 MIPI_TX1/RX1_D1P In/Out float MIPI CSI1/DSI1

positive differential data line

125 GND Power / System Ground(0V) 126 GND Power / System Ground(0V)
127 MIPI_RX0_CLKN In float MIPI CSI0 negative differential clock line 128 MIPI_TX1/RX1_CLKN In/Out float MIPI CSI1/DSI1 negative differential clock line
129 MIPI_RX0_CLKP In float MIPI CSI0

positive differential clock line

130 MIPI_TX1/RX1_CLKP In/Out float MIPI CSI1/DSI1

positive differential clock line

131 GND Power / System Ground(0V) 132 GND Power / System Ground(0V)
133 MIPI_RX0_D1N In float MIPI CSI0 negative differential data line 134 MIPI_TX1/RX1_D2N In/Out float MIPI CSI1/DSI1 negative differential data line
135 MIPI_RX0_D1P In float MIPI CSI0

positive differential data line

136 MIPI_TX1/RX1_D2P In/Out float MIPI CSI1/DSI1

positive differential data line

137 GND Power / System Ground(0V) 138 GND Power / System Ground(0V)
139 MIPI_RX0_D0N In float MIPI CSI0 negative differential data line 140 MIPI_TX1/RX1_D3N In/Out float MIPI CSI1/DSI1 negative differential data line
141 MIPI_RX0_D0P In float MIPI CSI0

positive differential data line

142 MIPI_TX1/RX1_D3P In/Out float MIPI CSI1/DSI1

positive differential data line

143 GND Power / System Ground(0V) 144 GND Power / System Ground(0V)
Connector Key Connector Key
145 HDMI_CEC In/Out float HDMI CEC signal, 3V level 146 GND Power / System Ground(0V)
147 HDMI_HPD In float HDMI hot plug 148 MIPI_TX0_D3N Out float MIPI DSI0 negetive differential data line
149 GND Power / System Ground(0V) 150 MIPI_TX0_D3P Out float MIPI DSI0 positive differential data line
151 HDMI_TXCN Out float HDMI differential clock line negative 152 GND Power / System Ground(0V)
153 HDMI_TXCP Out float HDMI differential clock line positive 154 MIPI_TX0_D2N Out float MIPI DSI0 negetive differential data line
155 GND Power / System Ground(0V) 156 MIPI_TX0_D2P Out float MIPI DSI0 positive differential data line
157 HDMI_TX0N Out float HDMI differential data line negative 158 GND Power / System Ground(0V)
159 HDMI_TX0P Out float HDMI differential data line positive 160 MIPI_TX0_CLKN Out float MIPI DSI0 negetive differential clock line
161 GND Power / System Ground(0V) 162 MIPI_TX0_CLKP Out float MIPI DSI0 positive differential clock line
163 HDMI_TX1N Out float HDMI differential data line negative 164 GND Power / System Ground(0V)
165 HDMI_TX1P Out float HDMI differential data line positive 166 MIPI_TX0_D1N Out float MIPI DSI0 negetive differential data line
167 GND Power / System Ground(0V) 168 MIPI_TX0_D1P Out float MIPI DSI0 positive differential data line
169 HDMI_TX2N Out float HDMI differential data line negative 170 GND Power / System Ground(0V)
171 HDMI_TX2P Out float HDMI differential data line positive 172 MIPI_TX0_D0N Out float MIPI DSI0 negetive differential data line
173 GND Power / System Ground(0V) 174 MIPI_TX0_D0P Out float MIPI DSI0 positive differential data line
175 USB3.0/TYPE-C1_DP In/Out float TYPEC1 USB 2.0 data+ 176 GND Power / System Ground(0V)
177 USB3.0/TYPE-C1_DM In/Out float TYPEC1 USB 2.0 data- 178 PCIE_RX3_N In float PCIe negative differential data line
179 GND Power / System Ground(0V) 180 PCIE_RX3_P In float PCIe positive differential data line
181 USB3.0/TYPEC1_TX1P Out float TYPEC1 USB3.0 PHY0 SuperSpeed TX1P 182 GND Power / System Ground(0V)
183 USB3.0/TYPEC1_TX1M Out float TYPEC1 USB3.0 PHY0 SuperSpeed TX1M 184 PCIE_TX3N Out float PCIe negative differential data line
185 GND Power / System Ground(0V) 186 PCIE_TX3P Out float PCIe positive differential data line
187 USB3.0/TYPEC1_RX1P In float TYPEC1 USB3.0 PHY0 SuperSpeed RX1P 188 GND Power / System Ground(0V)
189 USB3.0/TYPEC1_RX1M In float TYPEC1 USB3.0 PHY0 SuperSpeed RX1M 190 PCIE_RX2_N In float PCIe negative differential data line
191 GND Power / System Ground(0V) 192 PCIE_RX2_P In float PCIe positive differential data line
193 TYPEC1_TX2P Out float TYPEC1 USB3.0 PHY0 SuperSpeed TX2P 194 GND Power / System Ground(0V)
195 TYPEC1_TX2M Out float TYPEC1 USB3.0 PHY0 SuperSpeed TX2M 196 PCIE_TX2N Out float PCIe negative differential data line
197 GND Power / System Ground(0V) 198 PCIE_TX2P Out float PCIe positive differential data line
199 TYPEC1_RX2P In float TYPEC1 USB3.0 PHY0 SuperSpeed RX2P 200 GND Power / System Ground(0V)
201 TYPEC1_RX2M In float TYPEC1 USB3.0 PHY0 SuperSpeed RX2M 202 PCIE_RX1_N In float PCIe negative differential data line
203 GND Power / System Ground(0V) 204 PCIE_RX1_P In float PCIe positive differential data line
205 TYPEC1_SBU1 In/Out float TYPEC1 SBU1 206 GND Power / System Ground(0V)
207 TYPEC1_SBU2 In/Out float TYPEC1 SBU2 208 PCIE_TX1N Out float PCIe negative differential data line
209 GND Power / System Ground(0V) 210 PCIE_TX1P Out float PCIe positive differential data line
211 TYPEC1_SBU1_DC Out float TYPEC1 SBU1 DC Bias 212 GND Power / System Ground(0V)
213 TYPEC1_SBU2_DC Out float TYPEC1 SBU2 DC Bias 214 PCIE_RX0_N In float PCIe negative differential data line
215 TYPEC1_U2VBUSDET In float TYPEC1 Vbus detect 216 PCIE_RX0_P In float PCIe positive differential data line
217 GND Power / System Ground(0V) 218 GND Power / System Ground(0V)
219 HOST0_DP In/Out float USB 2.0 Host0 data+ 220 PCIE_TX0N Out float PCIe negative differential data line
221 HOST0_DM In/Out float USB 2.0 Host0 data- 222 PCIE_TX0P Out float PCIe positive differential data line
223 GND Power / System Ground(0V) 224 GND Power / System Ground(0V)
225 HOST1_DP In/Out float USB 2.0 Host1 data+ 226 PCIE_REF_CLKN Out float PCIe negative differential reference clock line
227 HOST1_DM In/Out float USB 2.0 Host1 data- 228 PCIE_REF_CLKP Out float PCIe positive differential reference clock line
229 GND Power / System Ground(0V) 230 GND Power / System Ground(0V)
231 EDP_TX3N Out float eDP data line negative 232 LAN_LED0_BLINK Out float 10/100/1000M Ethernet Status LED0
233 EDP_TX3P Out float eDP data line positive 234 LAN_LED1_LINK Out float 10/100/1000M Ethernet Status LED1
235 GND Power / System Ground(0V) 236 GND Power / System Ground(0V)
237 EDP_TX2N Out float eDP data line negative 238 MDI3- In/Out float 10/100/1000M Ethernet MDI3-
239 EDP_TX2P Out float eDP data line positive 240 MDI3+ In/Out float 10/100/1000M Ethernet MDI3+
241 GND Power / System Ground(0V) 242 GND Power / System Ground(0V)
243 EDP_TX1N Out float eDP data line negative 244 MDI2- In/Out float 10/100/1000M Ethernet MDI2-
245 EDP_TX1P Out float eDP data line positive 246 MDI2+ In/Out float 10/100/1000M Ethernet MDI2+
247 GND Power / System Ground(0V) 248 GND Power / System Ground(0V)
249 EDP_TX0N Out float eDP data line negative 250 MDI1- In/Out float 10/100/1000M Ethernet MDI1-
251 EDP_TX0P Out float eDP data line positive 252 MDI1+ In/Out float 10/100/1000M Ethernet MDI1+
253 GND Power / System Ground(0V) 254 GND Power / System Ground(0V)
255 EDP_AUXP In/Out float eDP AUX line positive 256 MDI0- In/Out float 10/100/1000M Ethernet MDI0-
257 EDP_AUXN In/Out float eDP AUX line negative 258 MDI0+ In/Out float 10/100/1000M Ethernet MDI0+
259 GND Power / System Ground(0V) 260 GND Power / System Ground(0V)

4 Carrier Board

SOM-RK3399 Dev Kit 1904-layout.jpg

5 Get Started

5.1 Essentials You Need

Before starting to use your SOM-RK3399 get the following items ready

  • SOM-RK3399
  • Type-C cable
  • TF Card: Class 10 or Above, minimum 8GB SDHC
  • USB to serial adapter(optinal, for debugging or access from PC host)
  • A DC 12V/2A power is a must
  • HDMI monitor or LCD
  • USB keyboard, mouse and possible a USB hub(or a TTL to serial board)
  • A host computer running Ubuntu 18.04 64-bit system

6 Access hardware

6.1 Access Serial Interface

For now only UART4 is available for users:

Serial Interface Serial Device
UART0 Used by Bluetooth
UART1 Used by Gbps Ethernet
UART2 Used by Serial Debug Port
UART3 Used by Gbps Ethernet
UART4 Available, device name is /dev/ttyS4 (note: this is only applicable for ROM released after 20180618)

6.2 Flash Image to eMMC


6.2.1 Download Image and Utilities

Visit download link to download image files and utilities.

Image Files
rk3399-eflasher-android8-YYYYMMDD.img.zip Android 8.1 image file
rk3399-eflasher-android7-YYYYMMDD.img.zip Android 7.1.2 image file
rk3399-eflasher-buildroot-YYYYMMDD.img.zip Buildroot image file with Qt5-wayland (base on Rockchip Linux SDK)
rk3399-eflasher-friendlydesktop-bionic-4.4-arm64-YYYYMMDD.img.zip 64-bit FriendlyDesktop image file based on Ubuntu desktop 18.04 64bit
rk3399-eflasher-friendlycore-bionic-4.4-arm64-YYYYMMDD.img.zip 64-bit FriendlyCore image file(Qt 5.10.0) based on Ubuntu core 18.04 64bit
rk3399-eflasher-lubuntu-desktop-xenial-4.4-armhf-YYYYMMDD.img.zip Lubuntu Desktop(with Qt 5.10.0)
Flash Utility:
win32diskimager.rar Windows utility. Under Linux users can use "dd"

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 SOM-RK3399's microSD card slot;
  • Power on SOM-RK3399 and it will be booted from your SD card and the EFlasher utility will be automatically launched. You can work with the EFlasher in multiple ways:

1: Connect an HDMI monitor and a USB mouse to your board and work with EFlasher's GUI;
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 SOM-RK3399, 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 turn off the board and take out the SD card from SOM-RK3399, power on the board and it will be booted from eMMC;

6.2.3 Flash Image under Windows with Type-C Cable

Visit download link to download Windows utilities and image files:

Image Files
rk3399-typec-android8-YYYYMMDD.img.zip Android 8.1 image file
rk3399-typec-android7-YYYYMMDD.tgz Android 7.1.2 Image File
rk3399-typec-friendlycore-bionic-4.4-arm64-YYYYMMDD.tgz FriendlyCore Image File(Qt 5.10)
rk3399-typec-friendlydesktop-bionic-4.4-arm64-YYYYMMDD.tgz FriendlyDesktop with X Window
rk3399-typec-lubuntu-desktop-YYYYMMDD.tgz Lubuntu Desktop with X Window
Flash Utility:
AndroidTool_Release_v2.54.zip Windows utility provided by Rockchip
DriverAssitant_v4.5.tgz USB driver for Windows provided by Rockchip. This is needed when using AndroidTool to flash OS

Video Tutorial:
https://www.youtube.com/watch?v=Wh7gyIjB9UY

Here are the steps:

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

Download Android Image

  • Connect a DC power cord and an HDMI monitor to your SOM-RK3399, connect your SOM-RK3399 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"
Rk-clean-emmc.png

6.2.4 Flash Image to eMMC under Linux with Type-C Cable

Visit download link to download Windows utilities and image files

Image Files
rk3399-typec-android8-YYYYMMDD.img.zip Android 8.1 image file
rk3399-typec-android7-YYYYMMDD.tgz Android 7.1.2 Image File
rk3399-typec-friendlycore-bionic-4.4-arm64-YYYYMMDD.tgz FriendlyCore Image File(Qt 5.10)
rk3399-typec-friendlydesktop-bionic-4.4-arm64-YYYYMMDD.tgz FriendlyDesktop with X Window
rk3399-typec-lubuntu-desktop-YYYYMMDD.tgz Lubuntu Desktop with X Window
Flash Utility:
Linux_Upgrade_Tool_1.27.rar Linux utility provided by Rockchip

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
 sudo cp upgrade_tool /usr/local/sbin
 sudo chown root:root /usr/local/sbin/upgrade_tool
 sudo chmod 0755 /usr/local/sbin/upgrade_tool
  • Download your wanted image from images-for-eflasher and extract it. For example the image for Lubuntu is "lubuntu-desktop-images.tgz".
  • Refer to the steps in "Flash Image to eMMC with AndroidTool" to boot your board and force it to enter either LOADER or MASKROM mode;
  • Linux: Run the following commands to flash Linux to eMMC and reboot your board:
 sudo upgrade_tool ul MiniLoaderAll.bin
 sudo upgrade_tool di -p parameter.txt
 sudo upgrade_tool di uboot uboot.img
 sudo upgrade_tool di trust trust.img
 sudo upgrade_tool di resource resource.img
 sudo upgrade_tool di kernel kernel.img
 sudo upgrade_tool di boot boot.img
 sudo upgrade_tool di rootfs rootfs.img
 sudo upgrade_tool RD
  • Android 7: Run the following commands to flash Android 7 to eMMC and reboot your board:
sudo upgrade_tool ul MiniLoaderAll.bin
sudo upgrade_tool di -p parameter.txt
sudo upgrade_tool di uboot uboot.img
sudo upgrade_tool di trust trust.img
sudo upgrade_tool di misc misc.img
sudo upgrade_tool di resource resource.img
sudo upgrade_tool di kernel kernel.img
sudo upgrade_tool di boot boot.img
sudo upgrade_tool di recovery recovery.img
sudo upgrade_tool di system system.img
sudo upgrade_tool RD
  • Android 8: Run the following commands to flash Android 8 to eMMC and reboot your board:
sudo upgrade_tool ul MiniLoaderAll.bin
sudo upgrade_tool di -p parameter.txt
sudo upgrade_tool di uboot uboot.img
sudo upgrade_tool di trust trust.img
sudo upgrade_tool di misc misc.img
sudo upgrade_tool di resource resource.img
sudo upgrade_tool di kernel kernel.img
sudo upgrade_tool di boot boot.img
sudo upgrade_tool di recovery recovery.img
sudo upgrade_tool di system system.img
sudo upgrade_tool di vendor vendor.img
sudo upgrade_tool di oem oem.img
sudo upgrade_tool RD

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.

 sudo upgrade_tool EF MiniLoaderAll.bin

If it succeeds you will see a prompt showing "Erase flash ok."

6.3 Boot from SD Card

Get the following files from here download link:

  • Get an 8G SDHC card and backup its data if necessary.
Image Files
rk3399-sd-buildroot-linux-4.4-arm64-YYYYMMDD.img.zip Buildroot image file with Qt5-wayland (base on Rockchip Linux SDK)
rk3399-sd-friendlydesktop-bionic-4.4-arm64-YYYYMMDD.img.zip FriendlyDesktop image file with X Window (base on Ubuntu 18.04 64bit)
rk3399-sd-friendlycore-bionic-4.4-arm64-YYYYMMDD.img.zip FriendlyCore with Qt 5.10.0 (base on Ubuntu core) image file
rk3399-sd-lubuntu-desktop-xenial-4.4-armhf-YYYYMMDD.img.zip Lubuntu Desktop image file with X Window
Flash Utility:
win32diskimager.rar Windows utility. Under Linux users can use "dd"
  • Extract these files. Insert an SD card(at least 8G) into a Windows PC and run the win32diskimager utility as administrator. On the utility's main window select your SD card's drive, the wanted image file and click on "write" to start flashing the SD card.
  • Insert this card into your board's boot slot and power on, If the PWR LED is on and LED1 is blinking this indicates your board has successfully booted.
  • The Android system does not support starting from the SD card. If you need to run the Android system, please buy the eMMC module, and then burn the Android system to the eMMC to run, referring to the following section.


7 Work with FriendlyDesktop

Friendlydesktop-home.png

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 64
    Various 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

Open the system's menu and go to Perferences -> Monitor Settings to customize your settings.
Recommended resolution: 1920x1080@60Hz

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:

export DISPLAY=: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 --refresh 60

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 --transform 0.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:

[Desktop Entry]
Type=Application
Name=LXRandR autostart
Comment=Start xrandr with settings done in LXRandR
Exec=sh -c 'xrandr --output HDMI-1 --mode 1920x1080 --refresh 50 --transform 1.04,0,-35,0,1.05,-30,0,0,1'
OnlyShowIn=LXDE

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 -c 4-5 glmark2-es2

Friendlydesktop-glmark-es.png
Friendlydesktop-glmark-es2-score.jpg

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:
Friendlydesktop-player.jpg

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

Insert the USB camera (such as Logitech C270/C920) into the development board. Double click the "USB Camera" icon on desktop will pop up the luvcview gui (need to use the 2019/05/11+ version firmware).
the luvcview tool is an open source software that you can compile yourself:

git clone https://github.com/ksv1986/luvcview
cd luvcview
make

View the usage of luvcview:

./luvcview -h

Parameter Description:

luvcview version 0.2.1
Usage: uvcview [-h -d -g -f -s -i -c -o -C -S -L -l -r]
-h print this message
-d /dev/videoX use videoX device
-g use read method for grab instead mmap
-w disable SDL hardware accel.
-f video format default jpg others options are yuv jpg
-i fps use specified frame interval
-s widthxheight use specified input size
-c enable raw frame capturing for the first frame
-C enable raw frame stream capturing from the start
-S enable raw stream capturing from the start
-o avifile create avifile, default video.avi
-L query valid video formats
-l query valid controls and settings
-r read and set control settings from luvcview.cfg

To preview USB camera (640x360@30fps), you can use the following command:

./luvcview -d /dev/video8 -i 30 -s 640x360

As you can see from the output of luvcview, hardware acceleration has been turned on:

pi@NanoPC-T4:/etc/xrdp$ luvcview -d /dev/video8 -i 30 -s 640x360
luvcview version 0.2.1
 interval: 30 fps
Hardware acceleration available
video /dev/video8

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:
Friendlydesktop-ble-sendfile.jpg

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:

su -
cd /root/
git clone https://github.com/friendlyarm/install-opencv-on-friendlycore
cd install-opencv-on-friendlycore
./install-opencv.sh
cp examples/cv-env.sh /usr/bin/

After installation is done compile it and test it by running a facial recognition test case:

su -
cd /usr/local/share/OpenCV/samples/cpp
g++ -ggdb facedetect.cpp -o facedetect `pkg-config --cflags --libs /usr/local/lib/pkgconfig/opencv.pc`
. setqt5env
./facedetect --cascade="/usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt.xml" --nested-cascade="/usr/local/share/OpenCV/haarcascades/haarcascade_eye.xml" --scale=1.3 /usr/local/share/OpenCV/samples/data/data/lena.jpg

Here is how it looks like:
Friendlydesktop-opencv.png

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:
Friendlydesktop-qtcreator.png
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.14 Play RTSP video stream (or IP Camera)

Open a command line terminal and enter the following command:

gst-launch-1.0 rtspsrc location="rtsp://admin:12345@192.168.1.120:554/live/main" ! rtph264depay ! decodebin ! rkximagesink

Change the address after rtsp:// to the real address.

7.15 Chromium web browser

Chromium web browser has enabled hardware acceleration by default, supports WebGL, and can view hardware acceleration details by entering the URL chrome://gpu, as shown below:
Chromium-gpu.png

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:

sudo apt-get install scratch:arm64

7.18 Install Arduino IDE

enter the following command:

sudo apt-get install arduino:arm64


7.19 Using NVME SSD on FriendlyDesktop

Please see this article: Linux-Using-NVME-SSD

8 Work with FriendlyCore

8.1 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 Qt 5.10.0 EGLES and OpenGL ES1.1/2.0 (Only for S5P4418/S5P6818)

8.2 System Login

  • 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 SOM-RK3399:
Somrk3399usb2serialport.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

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:
npi-config

8.4 Develop Qt Application

Please refer to: How to Build and Install Qt Application for FriendlyELEC Boards

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

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:

Service Name: OBEX Object Push
Service RecHandle: 0x1000b
Service Class ID List:
  "OBEX Object Push" (0x1105)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 12
  "OBEX" (0x0008)
Profile Descriptor List:
  "OBEX Object Push" (0x1105)
    Version: 0x0100

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:

obexftp --nopath --noconn --uuid none --bluetooth -b 2C:8A:72:1D:46:02 -B 12 -put example.jpg

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:

apt-get install bluetooth bluez obexftp openobex-apps python-gobject ussp-push

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.

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:

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

8.11 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.12 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:

/home/pi/.config/mpv/mpv.conf

The contents of the mpv.conf file are as follows:

vo=gpu
gpu-context=drm
hwdec=rkmpp
demuxer-max-bytes=41943040
demuxer-max-back-bytes=41943040
drm-osd-plane-id=1
drm-video-plane-id=0
audio-device=alsa/default:CARD=rockchiphdmi

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 Using Camera on Linux (MIPI Camera OV13850 & OV4689, and webcam logitect C920)

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


FriendlyELEC provides some scripts use 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:

cd /tmp/
git clone https://github.com/friendlyarm/gst-camera-sh.git
sudo cp gst-camera-sh/*.sh /usr/bin/

There are three scripts:
gst-camera.sh: preview, photo and video of a single camera
dual-camera.sh: preview two cameras
stop-gst-camera.sh: stop preview

9.1.1 Options in "gst-camera.sh"

Options Comment
--index or -i Camera's index, it can be either 0 or 1. When two cameras are connected to a board you need to specify 1 to access the second camera.
--action or -a Specify an action, it can be "preview" to preview, "photo" to take a picture or "video" to record video
--output or -o Specify an output file to save a picture when taking a picture or video file when recording video
--verbose or -v If it is specified as "yes" it will output the complete command when "gst-launch-1.0" is called
-x Using the rkximagesink plugin, the preview image will be output to the X11 window for the FriendlyDesktop and Lubuntu systems
-g Using the glimagesink plugin, the preview image will be output to the X11 window for the FriendlyDesktop and Lubuntu systems
-k Using the kmssink plugin, the preview image will be output directly to the screen for the FriendlyCore system

The script gst-camera.sh will automatically recognize OV13850, OV4689 and C920 camera, and then pass the appropriate parameters to gst-launch-1.0.

9.1.2 Usage of gst-camera.sh

  • Preview
gst-camera.sh --action preview
  • Picture Taking

You can run the following command to take a picture and save it as a "1.jpg" file,

gst-camera.sh -a photo -o 1.jpg
  • Preview and Record

You can run the following command to record video and save your video to a "1.ts" file. Hardware encoding is activated when it is recording video.

gst-camera.sh --action video -output 1.ts


  • Show Complete Command

If you add the "--verbose yes" option it will show a complete gsteamer command.

gst-camera.sh --action video --output 1.ts --verbose yes

Here is the complete gsteamer command you will see:

gst-launch-1.0 rkisp num-buffers=512 device=/dev/video0 io-mode=1 ! \
    video/x-raw,format=NV12,width=1280,height=720,framerate=30/1 ! \
        mpph264enc ! queue ! h264parse ! mpegtsmux ! \
        filesink location=/tmp/camera-record.ts
  • Preview dual camera

Connect two mipi cameras, or one mipi camera and one usb camera (tested only: Logitech C920 pro), call the following command:

dual-camera.sh

Note: It is recommended to test this on FriendlyDesktop.

9.1.3 gst-launch-1.0 parameter description

Preview camera on FriendlyDesktop:

gst-launch-1.0 rkisp device=/dev/video1 io-mode=4 ! video/x-raw,format=NV12,width=1280,height=720,framerate=30/1 ! rkximagesink

Important parameters

parameter description
device preview device(selfpath): /dev/video1 and /dev/video5, picture device(mainpath): /dev/video0 and /dev/video4, webcam device: /dev/video8
io-mode 1: memory map, 4:dmabuf
rkximagesink/glimagesink/kmssink rkximagesink for FriendlyDesktop, kmssink for FriendlyCore, glimagesink for webcam on FriendlyDesktop

9.1.4 Access the camera in OpenCV

MIPI camera:

cv.VideoCapture('rkisp device=/dev/video1 io-mode=4 ! video/x-raw,format=NV12,width=640,height=480,framerate=30/1 ! videoconvert ! appsink', cv.CAP_GSTREAMER)

USB camera:

cv.VideoCapture('rkisp device=/dev/video8 io-mode=4 ! videoconvert ! video/x-raw,format=NV12,width=640,height=480,framerate=30/1 ! videoconvert ! appsink', cv.CAP_GSTREAMER)


Please refer to the sample code here for details:https://github.com/friendlyarm/install-opencv-on-friendlycore/tree/rk3399/examples

9.1.5 Camera application tutorial: Push video stream

Please refre this guide: How to setup RTMP server on NanoPC-T4

9.1.6 Reference resource

http://blog.iotwrt.com/media/2017/10/01/camera/ http://www.360doc.com/content/16/1019/17/496343_599664458.shtml

9.2 How to install and use docker

9.2.1 How to Install Docker

Run the following commands:

wget https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/arm64/containerd.io_1.2.6-3_arm64.deb
wget https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/arm64/docker-ce-cli_19.03.2~3-0~ubuntu-bionic_arm64.deb
wget https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/arm64/docker-ce_19.03.2~3-0~ubuntu-bionic_arm64.deb
sudo dpkg -i containerd.io_1.2.6-3_arm64.deb
sudo dpkg -i docker-ce-cli_19.03.2~3-0~ubuntu-bionic_arm64.deb
sudo dpkg -i docker-ce_19.03.2~3-0~ubuntu-bionic_arm64.deb

9.2.2 Test Docker installation

Test that your installation works by running the simple docker image:

git clone https://github.com/friendlyarm/debian-jessie-arm-docker
cd debian-jessie-arm-docker
./rebuild-image.sh
./run.sh

9.3 Using ffmpeg (video hardware decoding)

Both FriendlyCore and FriendlyDesktop systems are built-in ffmpeg, with bin file, static libraries, and header files, all stored in the /usr/ffmpeg-rkmp directory.
ffmpeg supports the RockChip MPP video decoder, for details, please refer to: https://trac.ffmpeg.org/wiki/HWAccelIntro

Test the decoding performance of 4K video:

/usr/ffmpeg-rkmp/bin/ffmpeg -benchmark -loglevel 48 -vcodec h264_rkmpp -i 4K-Chimei-inn-60mbps.mp4 -map 0:v:0 -f null -

The results are shown below:
Rk3399-ffmpeg-fps.jpg
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.

9.4 Connect NVME SSD High Speed Hard Disk

We suggest you switch to "root" by running the following command:

su -

The password for "root" is "fa".

9.4.1 Detection of SSD

root@FriendlyELEC:~# cat /proc/partitions 
major minor  #blocks  name
   1        0       4096 ram0
 259        0  125034840 nvme0n1

If there is a nvme0n1 device node it means an SSD is recognized.

9.4.2 Partition of SSD

To mount an SSD under Linux we re-partition it as one section by running the following command:

(echo o; echo n; echo p; echo 1; echo ""; echo ""; echo w; echo q) | fdisk /dev/nvme0n1

If you want to re-partition it to multiple sections you can run "fdisk /dev/nvme0n1". For more detail about this command refer to the fdisk's manual.

9.4.3 Format Section to EXT4

After an SSD is successfully partitioned you can check its sections by running "cat /proc/partitions". The /dev/nvme0n1p1 section is used to store data:

root@FriendlyELEC:~# cat /proc/partitions
major minor  #blocks  name
 
   1        0       4096 ram0
 259        0  125034840 nvme0n1
 259        2  125033816 nvme0n1p1


The following command formats a section to ext4:

mkfs.ext4 /dev/nvme0n1p1

9.4.4 Auto Mount SSD on System Startup

Before we mount an SSD's section you need to know its Block ID. You can check it by running "blkid":

blkid /dev/nvme0n1p1
/dev/nvme0n1p1: UUID="d15c4bbf-a6c3-486f-8f81-35a8dbd46057" TYPE="ext4" PARTUUID="887628f0-01"

Add a "Block ID" to "/etc/fstab" and here is what it looks like

UUID=<Block ID> /media/nvme ext4 defaults 0 0

You need to replace <Block ID> with the UUID obtained by running "blkid". To mount the SSD in our example we made the "/etc/fstab" file as follows:

UUID=d15c4bbf-a6c3-486f-8f81-35a8dbd46057 /media/nvme ext4 defaults 0 0

We want to mount an SSD to "/media/nvme" but this directory doesn't exist. Therefore we create it and change its access right by running the following commands:

mkdir /media/nvme
chmod 777 /media/nvme

Run "mount" to check if the SSD is mounted successfully:

mount /media/nvme

You can reboot your board to check if your SSD will be automatically mounted:

reboot

9.5 Fan speed setting

The fan uses PWM to automatically adjust the speed. It determines the fan switch and the fan speed according to the current CPU temperature. If the current CPU temperature is not high, the fan will be turned off or rotated at a lower speed (reducing unnecessary environmental noise). ),
If you want the fan to start working immediately, you can use the following command to get the CPU running at high load immediately. This is one way to test if the fan works:

cpuburn

if you want to change the speed regulation behavior of the fan, please modify the following file:

/usr/bin/start-rk3399-pwm-fan.sh

Need to cancel the boot automatically start the fan (such as you need to connect the other PWM device), please enter the following command:

systemctl stop pwm-fan
systemctl disable pwm-fan

Or delete the two files below:

/etc/systemd/system/pwm-fan.service
/etc/systemd/system/multi-user.target.wants/pwm-fan.service

9.6 Using 4G Module EC20 on Linux

Please see this article: How to use 4G Module on SOM-RK3399

10 Buildroot Linux

Buildroot is a simple, efficient and easy-to-use tool to generate embedded Linux systems through cross-compilation. It contains a boot-loader, kernel, rootfs, various libraries and utilities(e.g. qt, gstreamer, busybox etc).

FriendlyELEC's Buildroot is based on Rockchip's version which is made with linux-sdk and maintained with git. FriendlyELEC's version is synced with Rockchip's version;


Here is what Buildroot for RK3399 looks like

  • Rk3399-buildroot-home.jpg
  • Rk3399-buildroot-console.jpg

  • Rk3399-buildroot-camera.jpg
  • Rk3399-buildroot-player.jpg


For a more detailed description of the Buildroot system, please refer to: Buildroot for RK3399

11 Work with Lubuntu

See here: Lubuntu desktop 16.04 for RK3399
Using NVME SSD on Lubuntu: Linux-Using-NVME-SSD

12 Work with Android 8.1

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

12.1 Connect MIPI Camera to SOM-RK3399

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.


12.2 Use dual MIPI camera preview and video

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

git clone https://github.com/friendlyarm/Dual-Camera.git -b working-branch

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:
Android dual camera demo.jpg
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.

12.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;

12.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.:

12.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:

TfLiteCameraDemo.png
For a detailed description of the Android NN SDK, you can refer to this document:[RK3399_Android8.1_AndroidNN_SDK_V1.0_20180605发布说明.pdf]
TfLiteCameraDemo sample source code download link:[TfLiteCameraDemo source code]

12.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/

12.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
Screen Zoom click the four arrow buttons in the middle to adjust the zoom
Display Rotation for horizontal and vertical screen switching

12.8 Screen rotation

go to Android Settings -> Display -> Advanced -> HDMI & Rotation to set it up.

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

wm rotation 90

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

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

12.11 Custom logo and boot animation

12.11.1 On/Off

Change:
BOOT_SHUTDOWN_ANIMATION_RINGING := false
to:
BOOT_SHUTDOWN_ANIMATION_RINGING := true
in device/rockchip/common/BoardConfig.mk file.

12.11.2 Boot animation

Create or replace the following files in the Android source code directory:
kernel/logo.bmp
kernel/logo_kernel.bmp
device/rockchip/common/bootshutdown/bootanimation.zip

12.11.3 Shutdown animation

Create or replace the following files in the Android source code directory:
device/rockchip/common/bootshutdown/shutdownanimation.zip

12.11.4 How to make animation

Please refre to:http://blog.sina.com.cn/s/blog_4960586c0100vu5v.html

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

12.13 Navigate Android with Remote Control

The SOM-RK3399 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.
Rc100remotecontroller.png

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

12.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:
Android8-usbcamera-setting.png;
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.

12.15 Using 4G Module EC20 on Android

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

12.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:

BOARD_HAS_GPS := false

to

BOARD_HAS_GPS := true

and recompile Android。

12.16 Using SSD on Android

12.16.1 Step1: Format SSD as ext4

These steps need to be operated under the LINUX system.

For the convenience of operation, please switch to the root user with the following command on the terminal:

su -

The default password for the root user is fa.

12.16.1.1 Detection of SSD
root@FriendlyELEC:~# cat /proc/partitions 
major minor  #blocks  name
   1        0       4096 ram0
 259        0  125034840 nvme0n1

If there is a nvme0n1 device node it means an SSD is recognized.

12.16.1.2 Partition of SSD

To mount an SSD under Linux we re-partition it as one section by running the following command:

(echo o; echo n; echo p; echo 1; echo ""; echo ""; echo w; echo q) | fdisk /dev/nvme0n1

If you want to re-partition it to multiple sections you can run "fdisk /dev/nvme0n1". For more detail about this command refer to the fdisk's manual.

12.16.1.3 Format partition to EXT4

After an SSD is successfully partitioned you can check its partitions by running "cat /proc/partitions". The /dev/nvme0n1p1 partition is used to store data:

root@FriendlyELEC:~# cat /proc/partitions
major minor  #blocks  name
 
   1        0       4096 ram0
 259        0  125034840 nvme0n1
 259        2  125033816 nvme0n1p1


The following command formats a section to ext4:

mkfs.ext4 /dev/nvme0n1p1 -L SSD

12.16.2 Step2: Auto Mount SSD on Android System Startup

Android will automatically mount the SSD as an external storage device. No additional settings are required. Open the built-in Files application of Android and you can see that the SSD device is mounted:
Android8-files-ssd.jpg
third-party software can recognize SSDs normally.

12.17 Fan speed setting

The fan uses PWM to achieve automatic speed regulation. It determines the fan switch and the fan speed according to the current CPU temperature. If the current CPU temperature is not high, the fan will be turned off or rotated at a lower speed (reducing unnecessary environment). Noise), if you want to change the fan's speed behavior, please modify the following files in the Android bsp source code:

device/rockchip/rk3399/nanopc-t4/pwm_fan.sh

Need to cancel the boot automatically start the fan (such as you need to connect other PWM devices), please modify the following files in the Android bsp source code:

device/rockchip/rk3399/init.rk3399.rc

After modifying the source code, you need to recompile Android.

13 Work with Android7.1

See here: Android7

14 Make Your Own OS Image

14.1 Setup Development Environment

In order to compile an Android image we suggest you do it on a 64 bit Ubuntu 16.04 system and install the following packages:

sudo apt-get install bison g++-multilib git gperf libxml2-utils make python-networkx zip
sudo apt-get install flex curl libncurses5-dev libssl-dev zlib1g-dev gawk minicom
sudo apt-get install openjdk-8-jdk
sudo apt-get install exfat-fuse exfat-utils device-tree-compiler liblz4-tool

For more details refer to https://source.android.com/source/initializing.html;
Or you can do it in Docker: friendlyelec-android-docker

14.2 Install Cross Compiler

14.2.1 Install aarch64-linux-gcc 6.4

This compiler can be used to compile a Linux kernel and u-boot. You can do it by running the following commands:

git clone https://github.com/friendlyarm/prebuilts.git -b master --depth 1
cd prebuilts/gcc-x64
cat toolchain-6.4-aarch64.tar.gz* | sudo tar xz -C /

Add the compiler's directory to the PATH variable by appending the following lines to the ~/.bashrc file:

export PATH=/opt/FriendlyARM/toolchain/6.4-aarch64/bin:$PATH
export GCC_COLORS=auto

Run the ~/.bashrc script to make it effective in the current commandline. Note: there is a space after ".":

. ~/.bashrc

This is a 64 bit compiler and cannot work on a 32 bit Linux system. You can test if your compiler is installed correctly by running the following commands:

aarch64-linux-gcc -v
Using built-in specs.
COLLECT_GCC=aarch64-linux-gcc
COLLECT_LTO_WRAPPER=/opt/FriendlyARM/toolchain/6.4-aarch64/libexec/gcc/aarch64-cortexa53-linux-gnu/6.4.0/lto-wrapper
Target: aarch64-cortexa53-linux-gnu
Configured with: /work/toolchain/build/aarch64-cortexa53-linux-gnu/build/src/gcc/configure --build=x86_64-build_pc-linux-gnu
--host=x86_64-build_pc-linux-gnu --target=aarch64-cortexa53-linux-gnu --prefix=/opt/FriendlyARM/toolchain/6.4-aarch64
--with-sysroot=/opt/FriendlyARM/toolchain/6.4-aarch64/aarch64-cortexa53-linux-gnu/sysroot --enable-languages=c,c++
--enable-fix-cortex-a53-835769 --enable-fix-cortex-a53-843419 --with-cpu=cortex-a53
...
Thread model: posix
gcc version 6.4.0 (ctng-1.23.0-150g-FA)

14.3 Compile Android8.1 Source Code

14.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:

tar xvzf /path/to/netdisk/sources/rk3399-android-8.1.git-YYYYMMDD.tgz
cd rk3399-android-8.1
./sync.sh
  • git clone from gitlab

SOM-RK3399 source code is maintained in gitlab, You can download it by running the following command:

git clone https://gitlab.com/friendlyelec/rk3399-android-8.1 --depth 1 -b master

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

14.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 SOM-RK3399:
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 SOM-RK3399 and reflash Android
Here is an alternative guide to update OS: sd-fuse_rk3399

14.4 Compile Android7 Source Code

14.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:

tar xvzf /path/to/netdisk/sources/rk3399-android-7.git-YYYYMMDD.tgz
cd rk3399-nougat
./sync.sh
  • git clone from gitlab

SOM-RK3399 source code is maintained in gitlab, You can download it by running the following command:

git clone https://gitlab.com/friendlyelec/rk3399-nougat --depth 1 -b nanopc-t4-nougat

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

14.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 SOM-RK3399:
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 SOM-RK3399 and reflash Android
Here is an alternative guide to update OS: sd-fuse_rk3399

14.5 Compile FriendlyCore/FriendlyDesktop/Lubuntu/EFlasher Kernel Source Code

git clone https://github.com/friendlyarm/kernel-rockchip --depth 1 -b nanopi4-linux-v4.4.y kernel-rockchip
cd kernel-rockchip
export PATH=/opt/FriendlyARM/toolchain/6.4-aarch64/bin/:$PATH
make ARCH=arm64 nanopi4_linux_defconfig
make ARCH=arm64 nanopi4-images

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:

# for Lubuntu
cp kernel.img resource.img /media/FRIENDLYARM/lubuntu/
 
# for FriendlyCore
cp kernel.img resource.img /media/FRIENDLYARM/friendlycore-arm64/
 
# for FriendlyDesktop
cp kernel.img resource.img /media/FRIENDLYARM/friendlydesktop-arm64/

Or you can use a USB Type-C cable and the Linux_Upgrade_Tool utility to update system.

14.6 Compile FriendlyCore/FriendlyDesktop/Lubuntu/EFlasher U-boot Source Code

git clone https://github.com/friendlyarm/uboot-rockchip --depth 1 -b nanopi4-v2014.10_oreo
cd uboot-rockchip
export PATH=/opt/FriendlyARM/toolchain/6.4-aarch64/bin/:$PATH
make CROSS_COMPILE=aarch64-linux- rk3399_defconfig
make CROSS_COMPILE=aarch64-linux-

After compilation is done a uboot.img, a trust.img and a rk3399_loader_v1.22.119.bin will be generated. You need to rename the rk3399_loader_v1.22.119.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:

# for Lubuntu
cp uboot.img trust.img /media/FRIENDLYARM/lubuntu
cp rk3399_loader_v1.22.119.bin /media/FRIENDLYARM/lubuntu/MiniLoaderAll.bin
 
# for FriendlyCore
cp uboot.img trust.img /media/FRIENDLYARM/friendlycore-arm64
cp rk3399_loader_v1.22.119.bin /media/FRIENDLYARM/friendlycore-arm64/MiniLoaderAll.bin
 
# for FriendlyDesktop
cp uboot.img trust.img /media/FRIENDLYARM/friendlydesktop-arm64
cp rk3399_loader_v1.22.119.bin /media/FRIENDLYARM/friendlydesktop-arm64/MiniLoaderAll.bin

Or you can use a USB Type-C cable and the Linux_Upgrade_Tool utility to update system.

14.7 Make Bootable SD Card for Mass Production

If you need to make a bootable SD card for mass production you can refer to this github link:sd-fuse_rk3399

15 Access hardware

15.1 Access Serial Interface

For now only UART4 is available for users:

Serial Interface Serial Device
UART0 Used by Bluetooth
UART1 Used by Gbps Ethernet
UART2 Used by Serial Debug Port
UART3 Used by Gbps Ethernet
UART4 Available, device name is /dev/ttyS4 (note: this is only applicable for ROM released after 20180618)

16 Source code repositories

SOM-RK3399's source code repositories
Android 8.1 Uboot

https://gitlab.com/friendlyelec/rk3399-android-8.1/tree/master/u-boot

Android 8.1 Linux-4.4.y Kernel

https://gitlab.com/friendlyelec/rk3399-android-8.1/tree/master/kernel

Android 8.1 BSP

https://gitlab.com/friendlyelec/rk3399-android-8.1
netdisk location: sources/rk3399-android-8.1.git-YYYYMMDD.tgz

Android 7.1.2 Uboot

https://gitlab.com/friendlyelec/rk3399-nougat/tree/nanopc-t4-nougat/u-boot

Android 7.1.2 Linux-4.4.y Kernel

https://gitlab.com/friendlyelec/rk3399-nougat/tree/nanopc-t4-nougat/kernel

Android 7.1.2 BSP

https://gitlab.com/friendlyelec/rk3399-nougat
netdisk location: sources/rk3399-android-7.git-YYYYMMDD.tgz

FriendlyCore/FriendlyDesktop/Lubuntu Uboot

https://gitlab.com/friendlyelec/rk3399-android-8.1/tree/master/u-boot

FriendlyCore/FriendlyDesktop/Lubuntu Linux-4.4.y Kernel

https://github.com/friendlyarm/kernel-rockchip

17 More OS Support

17.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;
  • Download DietPi_NanoPCT4-ARMv8-Stretch DietPi_NanoPCT4-ARMv8-Stretch, extract it, enter "Image_and_Tools" and run "AndroidTool.exe" as administrator
  • It is assumed that the section configuration(parameter.txt) is imported and here is a table:

AndroidTools DI 02.png

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

Dietpi-login-01.png
Login User Name:root
Password:dietpi

17.2 WiFi

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

   --> Network Options:Adapters 
       --> WiFi  Change Wireless Network Settings
           --> Scan  Scan and Connect

Select a WiFi hotspot, type its password and connect
Dietpi-dietpi-config-01.png

18 Link to Rockchip Resources

19 Schematic, PCB CAD File

20 Update Log

(Note: The following content is translated by Google translate)

20.1 2019-09-26

  • FriendlyCore/FriendlyDesktop:

Fix Qt5 demo touch screen related issue

20.2 2019-09-03

  • Android 8.1:

1) Upgrade Android8.1_SDK to Rockchip v8.20_20190801 (Kernel: 4.4.167)
2) Increase the recording volume by 15dB
3) Fixed an issue where some HDMI display scales were not displayed correctly
4) USB Host: Enable DWC3's AutoRetry feature to improve the stability of some USB3.0 industrial cameras

  • FriendlyCore/FriendlyDesktop:

1) Merge the official kernel update and upgrade the kernel to 4.4.179
2) USB Host: Enable DWC3's AutoRetry feature to improve the stability of some USB3.0 industrial cameras
3) Fixed HDMI IN issue

  • Buildroot:

1) Upgrade Buildroot's version to Rockchip_v2.2.0_20190628
2) Merge the official kernel update and upgrade the kernel to 4.4.179
3) Fix bluetooth issue

20.3 2019-07-18

  • FriendlyCore/FriendlyDesktop/Lubuntu:

1) Modify SDIO's maximum frequency to 150M to improve Wi-Fi performance
2) Fixed some unrecognized problems with NVMe M.2 SSDs, improving compatibility

  • Android 8

1) Modify SDIO's maximum frequency to 150M to improve Wi-Fi performance
2) Bluetooth BLE enabled

20.4 2019-06-25

Linux(Ubuntu 16.04/18.04) uses OverlayFS to enhance filesystem stability.

20.5 2019-05-23

  • Ubuntu 18.04(FriendlyCore, FriendlyDesktop):

1) Fix the Pulseaudio issue
2) Fix the Bluetooth issue

20.6 2019-05-11

  • Android 8.1:

1) Added support for PWM fan, support fan speed control
2) Add SSD support (Note: SSD partition needs to be ext4 format)

  • FriendlyCore, FriendlyDesktop:

1) Kernel version updated to v4.4.167
2) the isp driver of the camera is upgraded from cif_isp10 to rk_isp1, supporting dual mipi cameras to work at the same time
3) OpenCV is upgraded to the latest version 4.1, supporting dual mipi camera and USB camera (logitech C920)
4) 4G network support is added to the Linux system (module: Quectel EC20)
5) Add Aanopc-t4 PWM fan support

  • EFlasher system:

1) Reduced file system size
2) The network configuration is changed from DHCP to static IP address (192.168.1.231)

20.7 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

20.8 2018-12-19

  • Android 8.1 update is as follows:

1) Update the AOSP source version to Android8.1-SDK v5.00-20181109
2) Add HDMI resolution and HDMI overscan setting UI
3) Add audio output settings, you can set the default output to headphones or HDMI
4) Add OV13850 and wide dynamic OV4689 camera support

  • FriendlyCore is updated as follows:

1) Added OV13850 and wide dynamic OV4689 camera support
2) Added ffmpeg support, provides static libraries and header files, supports 4K hardware decoding (does not support hardware encoding)
3) Added mpv player, supports 4K hardware decoding

  • FriendlyDesktop is updated as follows:

1) Added OV13850 and wide dynamic OV4689 camera support
2) Add Chrome-browser browser, support web page 1080P hardware decoding, support WebGL
3) Added ffmpeg support, provides static libraries and header files, supports 4K hardware decoding (does not support hardware encoding)
4) Fix the volume adjustment Issue
5) Set the audio output channel to HDMI by default (can be modified by /etc/pulse/default.pa)
6) Optimize the local player, associated with the mp4 file
7) Automatically enable swap partitioning for NEO4
8) Fix the issue of hostapd related issues
9) Adjust DPMS settings, turn off automatic sleep by default

  • Lubuntu updated as follows:

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

20.9 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

20.10 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

20.11 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)
  • FriendlyDesktop defaults to HDMI resolution of 1080P