Difference between revisions of "FriendlyCore (based on ubuntu-core with Qt)"

From FriendlyELEC WiKi
Jump to: navigation, search
(Only Support H5 Platform)
(updated by API)
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
[[FriendlyCore (based on ubuntu-core with Qt)/zh|查看中文]]
 
[[FriendlyCore (based on ubuntu-core with Qt)/zh|查看中文]]
 
==Introduction==
 
FriendlyCore is a light Linux system without X-windows, based on ubuntu core, It uses the Qt-Embedded's GUI and is popular in industrial and enterprise applications.
 
 
Besides the regular Ubuntu core's features our FriendlyCore has the following additional features:
 
* it supports our LCDs with both capacitive touch and resistive touch(S700, X710, HD702, S430, HD101 and S70)
 
* it supports WiFi
 
* it supports Ethernet
 
* it supports Bluetooth and has been installed with bluez utilities
 
* it supports audio playing
 
* it supports Qt5.9 EGLES and OpenGL ES1.1/2.0 (Only for S5P4418/S5P6818)
 
  
 
==Download Image Files==
 
==Download Image Files==
You can click this [http://dl.friendlyarm.com url] to download an image file for a board on the board's download page.
+
You can click this [http://download.friendlyelec.com url] to download an image file for a board on the board's download page.
 
+
==Work with FriendlyCore==
+
===FriendlyCore's User Accounts===
+
* If your board is connected to an HDMI monitor you need to use a USB mouse and keyboard.
+
* If you need to do kernel development you need to connect a serial communication board to your board and access your board from a serial terminal.
+
* 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
+
<syntaxhighlight lang="bash">
+
$ sudo apt-get update
+
</syntaxhighlight>
+
 
+
===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.
+
<syntaxhighlight lang="bash">
+
$ sudo npi-config
+
</syntaxhighlight>
+
Here is how npi-config's GUI looks like:<br />
+
[[File:npi-config.jpg|frameless|500px|npi-config]]<br />
+
 
+
===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:
+
<syntaxhighlight lang="bash">
+
$ df -h
+
</syntaxhighlight>
+
 
+
===WiFi===
+
You can use the NetworkManager utility in FriendlyCore to manager its network. You can run "nmcli" in the commandline utility to start it. Here are the commands to start a WiFi connection:
+
* Check device list
+
<syntaxhighlight lang="bash">
+
sudo nmcli dev
+
</syntaxhighlight>
+
Note: if the status of a device is "unmanaged" it means that device cannot be accessed by NetworkManager. To make is accessed you need to clear the settings under "/etc/network/interfaces" and reboot your system.
+
 
+
* Start WiFi
+
<syntaxhighlight lang="bash">
+
sudo nmcli r wifi on
+
</syntaxhighlight>
+
 
+
* Scan Surrounding WiFi Sources
+
<syntaxhighlight lang="bash">
+
sudo nmcli dev wifi
+
</syntaxhighlight>
+
 
+
* Connect to a WiFi Source
+
<syntaxhighlight lang="bash">
+
sudo nmcli dev wifi connect "SSID" password "PASSWORD"
+
</syntaxhighlight>
+
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<br />
+
If a connection succeeds it will be automatically setup on next system reboot.<br />
+
<br />
+
For more details about NetworkManager refer to this link: [[Use NetworkManager to configure network settings]]<br />
+
 
+
* Use USB WiFi
+
Our OS system has support for popular USB WiFi drivers. Many USB WiFi modules are plug and play with our system. Here is a list of models we tested;
+
::{| class="wikitable"
+
|-
+
|Number||Model     
+
|-
+
|1  ||  RTL8188CUS 802.11n WLAN Adapter   
+
|-
+
|2  ||  RT2070 Wireless Adapter   
+
|-
+
|3  ||  RT2870/RT3070 Wireless Adapter
+
|-
+
|4  ||  RTL8192CU Wireless Adapter
+
|-
+
|5  ||  mi WiFi mt7601
+
|}
+
 
+
===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]]。
+
 
+
===Bluetooth===
+
If your board has an onboard bluetooth module you can search for surrounding bluetooth devices by running the following command:<br/>
+
<syntaxhighlight lang="bash">
+
hcitool scan
+
</syntaxhighlight>
+
You can run "hciconfig" to check bluetooth's status.
+
 
+
===Playing Audio===
+
You can play an audio file by running the following command:
+
<syntaxhighlight lang="bash">
+
aplay -t raw -c 2 -f S16_LE -r 44100 /root/test.pcm
+
</syntaxhighlight>
+
 
+
===HDMI Audio Output===
+
Our system's default audio output is the 3.5mm audio jack. You can turn on the HDMI audio by editing the /etc/asound.conf file:
+
<syntaxhighlight lang="bash">
+
pcm.!default {
+
    type hw
+
    card 1
+
    device 0
+
}
+
 
+
ctl.!default {
+
    type hw
+
    card 1
+
}
+
</syntaxhighlight>
+
card 0 points to the 3.5mm audio jack and card 1 points to the HDMI audio. You need to save your changes and reboot your system to make your changes take effect.
+
 
+
===Connect to USB Camera(FA-CAM202)===
+
The FA-CAM202 is a 200M USB camera.<br>
+
Refer to this link for more details on how to connect to a FA-CAM202:
+
[[NanoPi_M1#Connect_NanoPi_M1_to_DVP_Camera_CAM500B|Connect NanoPi M1 to DVP Camera CAM500B]] <br>
+
 
+
==Develop Qt Application==
+
Please refer to:  [[How to build Qt application]]
+
  
 +
{{FriendlyCoreGeneral}}
 
==Only Support S5P4418/S5P6818 Platform==
 
==Only Support S5P4418/S5P6818 Platform==
===Run Qt Demo===
+
{{FriendlyCoreS5Pxx18}}
Run the following command<br />
+
{{UbuntuXenial-Arm64-Install-Docker}}
<syntaxhighlight lang="bash">
+
{{UbuntuXenial-Armhf-Install-Docker}}
$ sudo qt5demo
+
==Only Support RK3399/S5P4418/S5P6818 Platform==
</syntaxhighlight>
+
{{FriendlyCoreRunX11Application}}
 
+
===Connect to DVP Camera CAM500B===
+
The CAM500B camera module is a 5M-pixel camera with DVP interface. For more tech details about it you can refer to [[Matrix - CAM500B]].<br>
+
Under Debian/Ubuntu a camera utility "nanocams" is available for previewing 40 frames and picture taking. You can try it by following the commands below
+
<syntaxhighlight lang="bash">
+
sudo nanocams -p 1 -n 40 -c 4 -o IMG001.jpg
+
</syntaxhighlight>
+
For more details about the usage of the nanocams run "nanocams -h".
+
You can get its source code from our git hub:
+
<syntaxhighlight lang="bash">
+
git clone https://github.com/friendlyarm/nexell_linux_platform.git
+
</syntaxhighlight>
+
 
+
 
==Only Support H3 Platform==
 
==Only Support H3 Platform==
 
+
{{FriendlyCoreAllwinnerH3}}
===Run Qt Demo===
+
Run the following command<br />
+
<syntaxhighlight lang="bash">
+
$ sudo /opt/QtE-Demo/run.sh
+
</syntaxhighlight>
+
Here is what you expect to observe. This is an [https://github.com/friendlyarm/QtE-Demo open source Qt Demo]:<br />
+
[[File:K2-QtE.png|frameless|400px|K2-QtE]]<br />
+
 
+
===Connect to DVP Camera CAM500B===
+
Note: this function is only supported in Linux-3.4.y<br>
+
The CAM500B camera module is a 5M-pixel camera with DVP interface. For more tech details about it you can refer to [[Matrix - CAM500B]].<br>
+
connect your H3 board to a CAM500B. Then boot OS, connect your board to a network, log into the board as root and run "mjpg-streamer":
+
<syntaxhighlight lang="bash">
+
$ cd /root/mjpg-streamer
+
$ make
+
$ ./start.sh
+
</syntaxhighlight>
+
The mjpg-streamer application is an open source video steam server. After it is successfully started the following messages will be popped up:
+
<syntaxhighlight lang="bash">
+
i: Using V4L2 device.: /dev/video0
+
i: Desired Resolution: 1280 x 720
+
i: Frames Per Second.: 30
+
i: Format............: YUV
+
i: JPEG Quality......: 90
+
o: www-folder-path...: ./www/
+
o: HTTP TCP port.....: 8080
+
o: username:password.: disabled
+
o: commands..........: enabled
+
</syntaxhighlight>
+
 
+
In our case the board's IP address was 192.168.1.230. We typed 192.168.1.230:8080 in a browser and were able to view the images taken from the camera's. Here is what you would expect to observe:<br>
+
[[File:mjpg-streamer-cam500a.png|frameless|400px|mjpg-streamer-cam500a]] <br>
+
The mjpg-streamer soft-encodes data with libjpeg and you can hard-encode its data with ffmpeg which will greatly increase CPU's efficiency and speed up data encoding:
+
<syntaxhighlight lang="bash">
+
$ ffmpeg -t 30 -f v4l2 -channel 0 -video_size 1280x720 -i /dev/video0 -pix_fmt nv12 -r 30 \
+
        -b:v 64k -c:v cedrus264 test.mp4
+
</syntaxhighlight>
+
By default it records a 30-second video. Typing "q" stops video recording. After recording is stopped a test.mp4 file will be generated.
+
 
+
===Check CPU's Working Temperature===
+
You can use the following command to read H3's temperature and frequency
+
<syntaxhighlight lang="bash">
+
cpu_freq
+
</syntaxhighlight>
+
 
+
===Check System Information with Rpi-Monitor===
+
Our OS contains the Rpi-Monitor utility with which users can check system information and status.<br>
+
In our case our board's IP was 192.168.1.230 and we typed the following IP in a browser:
+
<syntaxhighlight lang="bash">
+
192.168.1.230:8888
+
</syntaxhighlight>
+
We were directed to the following page:<br>
+
[[File:rpi-monitor.png|frameless|500px|rpi-monitor]] <br>
+
Users can easily check these system information and status.
+
 
+
 
==Only Support H5 Platform==
 
==Only Support H5 Platform==
 
+
{{FriendlyCoreAllwinnerH5}}
===Run Qt Demo===
+
Run the following command<br />
+
<syntaxhighlight lang="bash">
+
$ sudo /opt/QtE-Demo/run.sh
+
</syntaxhighlight>
+
Here is what you expect to observe. This is an [https://github.com/friendlyarm/QtE-Demo open source Qt Demo]:<br />
+
[[File:K2-QtE.png|frameless|400px|K2-QtE]]<br />
+
 
+
 
==Only Support S905 Platform==
 
==Only Support S905 Platform==
 
+
{{FriendlyCoreS905}}
===Run Qt Demo===
+
==Only Support H2 Platform==
Run the following command<br />
+
{{FriendlyCoreAllwinnerH2}}
<syntaxhighlight lang="bash">
+
$ sudo /opt/QtE-Demo/run.sh
+
</syntaxhighlight>
+
Here is what you expect to observe. This is an [https://github.com/friendlyarm/QtE-Demo open source Qt Demo]:<br />
+
[[File:K2-QtE.png|frameless|400px|K2-QtE]]<br />
+
 
+
==Setup Program to AutoRun==
+
You can setup a program to autorun on system boot with npi-config:
+
<syntaxhighlight lang="bash">
+
sudo npi-config
+
</syntaxhighlight>
+
 
+
Go to Boot Options -> Autologin -> Qt/Embedded, select Enable and reboot.
+
  
 
==Work with LCD==
 
==Work with LCD==

Latest revision as of 07:17, 21 February 2022

查看中文

Contents

1 Download Image Files

You can click this url to download an image file for a board on the board's download page.

2 Work with FriendlyCore

2.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)

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

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

  • FriendlyCore User Accounts:

Non-root User:

   User Name: pi
   Password: pi

Root:

   User Name: root
   Password: fa

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

  • Update packages
$ sudo apt-get update

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

2.4 Develop Qt Application

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

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

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

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

2.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
6 5G USB WiFi RTL8821CU
7 5G USB WiFi RTL8812AU

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.


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


2.10 Custom welcome message

The welcome message is printed from the script in this directory:

/etc/update-motd.d/

For example, to change the FriendlyELEC LOGO, you can change the file /etc/update-motd.d/10-header. For example, to change the LOGO to HELLO, you can change the following line:

TERM=linux toilet -f standard -F metal $BOARD_VENDOR

To:

TERM=linux toilet -f standard -F metal HELLO

2.11 Modify timezone

For exampe, change to Shanghai timezone:

sudo rm /etc/localtime
sudo ln -ls /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

2.12 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


3 Only Support S5P4418/S5P6818 Platform

3.1 Run Qt 5.10.0 Demo with GPU acceleration

Run the following command

$ sudo qt5demo

S5pxx18-QtE

3.2 Run Qt 5.10.0 Demo with OpenGL

Run the following command

. setqt5env
cd $QTDIR
cd /examples/opengl/qopenglwidget
./qopenglwidget

For more Qt 5.10.0 examples, please go to:
cd $QTDIR/examples/

3.3 Play HD Video with Hardware-decoding

gst-player is console player, it base on GStreamer, support VPU with Hardware-decoding:

sudo gst-player /home/pi/demo.mp4

The equivalent gsteamer command is as follows:

sudo gst-launch-1.0 filesrc location=/home/pi/demo.mp4 ! qtdemux name=demux demux. ! queue ! faad ! audioconvert ! audioresample ! alsasink device="hw:0,DEV=1" demux. ! queue ! h264parse ! nxvideodec ! nxvideosink dst-x=0 dst-y=93 dst-w=1280 dst-h=533

3.4 Connect to DVP Camera CAM500B

The CAM500B camera module is a 5M-pixel camera with DVP interface. For more tech details about it you can refer to Matrix - CAM500B.
Enter the following command to preview the video:

gst-launch-1.0 -e v4l2src device=/dev/video6 ! video/x-raw,format=I420,framerate=30/1,width=1280,height=720 ! nxvideosink

Enter the following command to start recording (VPU hardware encoding):

gst-launch-1.0 -e v4l2src device=/dev/video6 ! video/x-raw,format=I420,framerate=30/1,width=1280,height=720 ! tee name=t t. \
 ! queue ! nxvideosink t. ! queue ! nxvideoenc bitrate=12000000 ! mp4mux ! \
 filesink location=result_720.mp4

3.5 Power Off and Schedule Power On

“PMU Power Management” feature helps us to auto power on the board at a specific time, it is implemented by an MCU, support software power-off, and RTC alarm power-up functions.

Here’s a simple guide:
Turn on automatically after 100 seconds. (Time must be greater than 60 seconds.):

$ sudo echo 100 > /sys/class/i2c-dev/i2c-3/device/3-002d/wakealarm

After setting up the automatic boot, turn off board with the 'poweroff’ command:

$ sudo poweroff

Cancel automatic boot:

$ sudo echo 0 > /sys/class/i2c-dev/i2c-3/device/3-002d/wakealarm

Query the current settings, in the front is current time, followed by the time of automatic booting: If no automatic boot is set, it will display "disabled”.

$ sudo cat /sys/class/i2c-dev/i2c-3/device/3-002d/wakealarm


Note that some older versions of hardware may not support this feature, if you don't see this file node in your system:
/sys/class/i2c-dev/i2c-3/device/3-002d/wakealarm
your board may be it does not support this feature.

3.6 Installing and Using OpenCV 4.1.2

OpenCV has been pre-installed in FriendlyCore (Version after 20191126) and does not require manual installation.
Please refre this link: https://github.com/friendlyarm/install-opencv-on-friendlycore/blob/s5pxx18/README.md
Quick test:

. /usr/bin/cv-env.sh
. /usr/bin/setqt5env-eglfs
cd /usr/local/share/opencv4/samples/python
python3 turing.py

3.7 Installing and Using Caffe

git clone https://github.com/friendlyarm/install-caffe-on-friendlycore
cd install-caffe-on-friendlycore
sudo ./install-caffe.sh

3.8 How to install and use docker (for aarch64 system)

3.8.1 How to Install Docker

Run the following commands:

wget https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/arm64/containerd.io_1.2.6-3_arm64.deb
wget https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/arm64/docker-ce-cli_19.03.2~3-0~ubuntu-xenial_arm64.deb
wget https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/arm64/docker-ce_19.03.2~3-0~ubuntu-xenial_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-xenial_arm64.deb
sudo dpkg -i docker-ce_19.03.2~3-0~ubuntu-xenial_arm64.deb

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

3.9 How to install and use docker (for armhf system)

3.9.1 How to Install Docker

Run the following commands:

sudo apt-get update
sudo apt-get install docker.io

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

4 Only Support RK3399/S5P4418/S5P6818 Platform

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

5 Only Support H3 Platform

5.1 Connect to USB Camera(FA-CAM202)

The FA-CAM202 is a 200M USB camera. Connect your board to camera module. Then boot OS, connect your board to a network, log into the board as root and run "mjpg-streamer":

$ cd /root/C/mjpg-streamer
$ make
$ ./start.sh

You need to change the start.sh script and make sure it uses a correct /dev/videoX node. You can check your camera's node by running the following commands:

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

The above messages indicate that "/dev/video0" is camera's device node.The mjpg-streamer application is an open source video steam server. After it is successfully started the following messages will be popped up:

 
$ ./start.sh
 i: Using V4L2 device.: /dev/video0
 i: Desired Resolution: 1280 x 720
 i: Frames Per Second.: 30
 i: Format............: YUV
 i: JPEG Quality......: 90
 o: www-folder-path...: ./www/
 o: HTTP TCP port.....: 8080
 o: username:password.: disabled
 o: commands..........: enabled

start.sh runs the following two commands:

export LD_LIBRARY_PATH="$(pwd)"
./mjpg_streamer -i "./input_uvc.so -d /dev/video0 -y 1 -r 1280x720 -f 30 -q 90 -n -fb 0" -o "./output_http.so -w ./www"

Here are some details for mjpg_streamer's major options:
-i: input device. For example "input_uvc.so" means it takes input from a camera;
-o: output device. For example "output_http.so" means the it transmits data via http;
-d: input device's subparameter. It defines a camera's device node;
-y: input device's subparameter. It defines a camera's data format: 1:yuyv, 2:yvyu, 3:uyvy 4:vyuy. If this option isn't defined MJPEG will be set as the data format;
-r: input device's subparameter. It defines a camera's resolution;
-f: input device's subparameter. It defines a camera's fps. But whether this fps is supported depends on its driver;
-q: input device's subparameter. It defines the quality of an image generated by libjpeg soft-encoding;
-n: input device's subparameter. It disables the dynctrls function;
-fb: input device's subparameter. It specifies whether an input image is displayed at "/dev/fbX";
-w: output device's subparameter. It defines a directory to hold web pages;

In our case the board's IP address was 192.168.1.230. We typed 192.168.1.230:8080 in a browser and were able to view the images taken from the camera's. Here is what you would expect to observe:
mjpg-streamer-cam500a

5.2 Check CPU's Working Temperature

You can get CPU's working temperature by running the following command:

$ cpu_freq 
Aavailable frequency(KHz):
        480000 624000 816000 1008000
Current frequency(KHz):
        CPU0 online=1 temp=26548C governor=ondemand freq=624000KHz
        CPU1 online=1 temp=26548C governor=ondemand freq=624000KHz
        CPU2 online=1 temp=26548C governor=ondemand freq=624000KHz
        CPU3 online=1 temp=26548C governor=ondemand freq=624000KHz

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

$ cpu_freq -s 1008000
Aavailable frequency(KHz):
        480000 624000 816000 1008000
Current frequency(KHz):
        CPU0 online=1 temp=36702C governor=userspace freq=1008000KHz
        CPU1 online=1 temp=36702C governor=userspace freq=1008000KHz
        CPU2 online=1 temp=36702C governor=userspace freq=1008000KHz
        CPU3 online=1 temp=36702C governor=userspace freq=1008000KHz


5.3 Test Infrared Receiver

Note: Please Check your board if IR receiver exist.
By default the infrared function is disabled you can enable it by using the npi-config utility:

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

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

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

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

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

5.4 Run Qt Demo

Run the following command

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

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

5.5 How to install and use docker (for armhf system)

5.5.1 How to Install Docker

Run the following commands:

sudo apt-get update
sudo apt-get install docker.io

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

6 Only Support H5 Platform

6.1 Connect to USB Camera(FA-CAM202)

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

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

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

6.2 Check CPU's Working Temperature

You can get CPU's working temperature by running the following command:

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

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

6.3 Test Watchdog

You can test watchdog by running the following commands:

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

System will reboot in 10 seconds.

6.4 Test Infrared Receiver

Note: Please Check your board if IR receiver exist.
By default the infrared function is disabled you can enable it by using the npi-config utility:

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

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

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

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

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

6.5 Read CHIP ID

As for Allwinner H2+/H3/H5/ SoCs each of these CPUs has an internal 16-btye CHIP ID which can be read by running the following commands in the Linux-4.14 kernel:

$ apt-get install bsdmainutils
$ hexdump /sys/bus/nvmem/devices/sunxi-sid0/nvmem 
0000000 8082 0447 0064 04c3 3650 ce0a 1e28 2202
0000010 0002 0000 0000 0000 0000 0000 0000 0000
0000020 0000 0000 0000 0000 0000 0000 0000 0000
0000030 0000 0008 0508 0000 0000 0000 0000 0000
0000040 0000 0000 0000 0000 0000 0000 0000 0000

"8082 0447 0064 04c3 3650 ce0a 1e28 2202" is the 16-byte CHIP ID.

6.6 Access GPIO Pins/Wirings with WiringNP

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

6.7 Run Qt Demo

Run the following command

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

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

6.8 How to install and use docker (for arm64 system)

6.8.1 How to Install Docker

Run the following commands:

sudo apt-get update
sudo apt-get install docker.io

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

7 Only Support S905 Platform

7.1 Run Qt Demo

Run the following command

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

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

8 Only Support H2 Platform

8.1 Read CHIP ID

As for Allwinner H2+/H3/H5/ SoCs each of these CPUs has an internal 16-btye CHIP ID which can be read by running the following commands in the Linux-4.14 kernel:

$ apt-get install bsdmainutils
$ hexdump /sys/bus/nvmem/devices/sunxi-sid0/nvmem 
0000000 8082 0447 0064 04c3 3650 ce0a 1e28 2202
0000010 0002 0000 0000 0000 0000 0000 0000 0000
0000020 0000 0000 0000 0000 0000 0000 0000 0000
0000030 0000 0008 0508 0000 0000 0000 0000 0000
0000040 0000 0000 0000 0000 0000 0000 0000 0000

"8082 0447 0064 04c3 3650 ce0a 1e28 2202" is the 16-byte CHIP ID.

8.2 Boot System from SSD

A NanoPi-Duo can be booted from the SSD on a Mini Shield for NanoPi Duo. Booting OS from an SSD has the following benefits:
1) faster read/write;
2) much longer life time than a TF card;
3) more reliable than booting from a TF card;

You can install an OS to SSD by using the npi-config utility. Here are the steps to follow:

sudo npi-config

Enter the "Boot Options" menu, go to "Boot device" and you will see two options:
1) D1 Hard drive
2) D2 TF card
Select "D1 Hard drive" and proceed with its prompts.
Select "D2 TF card" to boot OS from a TF card.

If your npi-config doesn't have a "Boot device" menu it might be that your npi-config is out of date and you can update it by selecting "Update" in the menu.

8.3 How to install and use docker (for armhf system)

8.3.1 How to Install Docker

Run the following commands:

sudo apt-get update
sudo apt-get install docker.io

8.3.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 Work with LCD

If you connect your board to an LCD with capacitive touch panel in general that LCD's calibration is not required. However if your LCD is one with resistive touch panel you will have to do calibration which is triggered by running "/usr/bin/setqt4env" on your first system booting.

If you want to re-calibrate your LCD with resistive touch panel you need to delete the calibration file by using the following command:

rm /etc/pointercal

After you reboot your system you will enter the calibration process.

10 Q & A

  • When I compile my Qt program I get a message complaining that linking to libraries such as libts and libz failed

Your arm-linux-gcc 4.9.3 may not include these library files. You need to try downloading the compiler again.

  • Where should I get FriendlyCore's source code

We used the bin file released by UbuntuCore's official site. You can get its source code from http://packages.ubuntu.com/.

11 Update Log

11.1 July-20-2016

  • Released English version

11.2 July-20-2017

  • Added sections 6.1, 6.2 and 6.3

11.3 August-23-2017

  • Updated section 4