Difference between revisions of "NanoPi K1 Plus"
(→Introduction) |
(updated by API) |
||
Line 197: | Line 197: | ||
|} | |} | ||
− | {{BurnOS-Allwinner | + | {{BurnOS-Allwinner|NanoPi-K1-Plus}} |
− | {{FriendlyCoreGeneral | + | {{FriendlyCoreGeneral|NanoPi-K1-Plus}} |
− | {{FriendlyCoreAllwinnerH5 | + | {{FriendlyCoreAllwinnerH5|NanoPi-K1-Plus}} |
===播放和录制音频=== | ===播放和录制音频=== | ||
Line 241: | Line 241: | ||
* H5 Datasheet: [http://wiki.friendlyarm.com/wiki/images/d/de/Allwinner_H5_Datasheet_V1.0.pdf Allwinner_H5_Datasheet_V1.0.pdf] | * H5 Datasheet: [http://wiki.friendlyarm.com/wiki/images/d/de/Allwinner_H5_Datasheet_V1.0.pdf Allwinner_H5_Datasheet_V1.0.pdf] | ||
− | {{H5ChangeLog | + | {{H5ChangeLog}} |
Revision as of 04:01, 19 April 2018
Contents
- 1 Introduction
- 2 资源特性
- 3 接口布局和尺寸
- 4 快速入门
- 5 Work with FriendlyCore
- 5.1 Introduction
- 5.2 System Login
- 5.3 Configure System with npi-config
- 5.4 Develop Qt Application
- 5.5 Setup Program to AutoRun
- 5.6 Extend TF Card's Section
- 5.7 Transfer files using Bluetooth
- 5.8 WiFi
- 5.9 Ethernet Connection
- 5.10 WiringPi and Python Wrapper
- 5.11 Custom welcome message
- 5.12 Modify timezone
- 5.13 Set Audio Device
- 5.14 Connect to DVP Camera CAM500B
- 5.15 Connect to USB Camera(FA-CAM202)
- 5.16 Check CPU's Working Temperature
- 5.17 Test Watchdog
- 5.18 Test Infrared Receiver
- 5.19 Read CHIP ID
- 5.20 Access GPIO Pins/Wirings with WiringNP
- 5.21 Run Qt Demo
- 5.22 How to install and use docker (for arm64 system)
- 5.23 播放和录制音频
- 6 如何编译FriendlyCore系统
- 7 使用扩展配件及编程示例
- 8 3D 打印外壳
- 9 资源链接
1 Introduction
- NanoPi K1 Plus采用了采用全志64位四核Cortex™-A53处理器H5,包含64和32bit两种运行模式,集成了高性能NEON多媒体处理引擎,并内置六核Mali450 GPU,支持众多视频格式,具备超强的多格式高清视频硬件编码器/解码解码能力。
- NanoPi K1 Plus配备2GB DDR3内存,板载WiFi模块、DVP摄像头、带有千兆以太网、USB、HDMI、红外遥控、3.5mm耳机接口、I2S等接口,支持TF卡启动运行系统,并可扩展eMMC模块。
- NanoPi K1 Plus尺寸与树莓派3相同,40Pin GPIO接口与之兼容,可搭配树莓派外壳使用。
- 可支持运行Ubuntu Core,Armbian等嵌入式操作系统。
2 资源特性
- CPU: Allwinner H5, Quad-core 64-bit high-performance Cortex™-A53
- GPU: Hexa-core Mali450
- DDR3 RAM: 2GB
- 以太网: 10/100/1000M 以太网口, 采用RTL8211E网络传输芯片
- Wireless:802.11 b/g/n 板载PCB天线
- 红外:板载红外接收模块
- 音频:3.5mm耳机座/Via HDMI
- Mic:板载咪头
- eMMC: 板载eMMC模块接口
- I2S:板载I2S接口(7Pin, 2.54mm排针)
- MicroSD Slot: MicroSD卡槽一个
- USB Host: 3 x USB 2.0 Host, 标准A型接口
- DVP Camera接口:24 Pin, 0.5mm间距竖直贴片FPC座
- MicroUSB: 1 x USB 2.0, 有OTG功能, 可作为电源输入和数据传输
- HDMI: HDMI Type-A型口接口, 支持4K@30fps显示
- 视频输出:HDMI 1.4 支持4K@30fps显示,CVBS
- GPIO扩展接口: 40 Pin,2.54mm排针, 包含I2C、GPIO、UART、PWM、SPDIF、SPI等
- 调试串口:4Pin,2.5mm单排针
- 按键:GPIO按键一个(用户自定义其功能)
- LED:电源指示灯一个, 系统状态指示灯一个
- 电源接口:MicroUSB接口
- PCB Size:56 x 85mm,6层,沉金工艺
- 供电: DC 5V/2A
3 接口布局和尺寸
3.1 接口布局
- GPIO管脚定义
Pin# Name Linux gpio Pin# Name Linux gpio 1 SYS_3.3V 2 VDD_5V 3 I2C0_SDA / GPIOA12 4 VDD_5V 5 I2C0_SCL / GPIOA11 6 GND 7 GPIOG11 203 8 UART1_TX / GPIOG6 198 9 GND 10 UART1_RX / GPIOG7 199 11 UART2_TX / GPIOA0 0 12 GPIOA6 6 13 UART2_RTS / GPIOA2 2 14 GND 15 UART2_CTS / GPIOA3 3 16 UART1_RTS / GPIOG8 200 17 SYS_3.3V 18 UART1_CTS / GPIOG9 201 19 SPI0_MOSI / GPIOC0 64 20 GND 21 SPI0_MISO / GPIOC1 65 22 UART2_RX / GPIOA1 1 23 SPI0_CLK / GPIOC2 66 24 SPI0_CS / GPIOC3 67 25 GND 26 SPDIF-OUT / GPIOA17 17 27 I2C1_SDA / GPIOA19 / PCM0_CLK / I2S0_BCK 19 28 I2C1_SCL / GPIOA18 / PCM0_SYNC / I2S0_LRCK 18 29 GPIOA20 / PCM0_DOUT / I2S0_SDOUT 20 30 GND 31 GPIOA21 / PCM0_DIN/ I2S0_SDIN 21 32 GPIOA7 7 33 GPIOA8 8 34 GND 35 UART3_CTS / SPI1_MISO / GPIOA16 16 36 UART3_TX / SPI1_CS / GPIOA13 13 37 GPIOA9 9 38 UART3_RTS / SPI1_MOSI / GPIOA15 15 39 GND 40 UART3_RX / SPI1_CLK / GPIOA14 14
- eMMC接口管脚定义
Pin# Name Pin# Name 1 eMMC_D0 2 eMMC_D1 3 eMMC_D2 4 eMMC_D3 5 eMMC_D4 6 eMMC_D5 7 eMMC_D6 8 eMMC_D7 9 eMMC_DS 10 GND 11 eMMC_CMD 12 eMMC_CLK 13 NC 14 GND 15 NC 16 1.8V OUT 17 eMMC_RST 18 3.3V OUT 19 GPIOY_5 20 GND
- Debug Port(UART0)
Pin# Name 1 GND 2 VDD_5V 3 UART_TX 4 UART_RX
- 7Pin I2S接口定义
Pin# Name 1 GND 2 SYS_3.3V 3 I2S0_BCK 4 I2S0_LRCK 5 I2S0_SDOUT 6 I2S0_SDIN 7 I2S_MCLK
- 说明
- SYS_3.3V: 3.3V电源输出
- VDD_5V: 5V电源输入/输出。输入范围:4.7~5.6V
- 全部信号引脚均为3.3V电平
- 更详细的信息请查看原理图:Schematic_NanoPi-K1_Plus-1712_20171214.pdf
3.2 机械尺寸
4 快速入门
4.1 准备工作
要开启你的NanoPi K1 Plus新玩具,请先准备好以下硬件
- NanoPi K1 Plus主板
- microSD卡/TF卡: Class10或以上的 8GB SDHC卡
- 一个MicroUSB接口的外接电源,要求输出为5V/2A
- 一台支持HDMI输入的显示器或者电视
- 一套USB键盘鼠标
- 一台电脑,需要联网,建议使用Ubuntu 16.04 64位系统
'
4.2 经测试使用的TF卡
制作启动的TF卡时,建议Class10或以上的 8GB SDHC卡。以下是经友善之臂测试验证过的高速TF卡:
- SanDisk闪迪 TF 8G Class10 Micro/SD 高速 TF卡:
- SanDisk闪迪 TF128G 至尊高速MicroSDXC TF 128G Class10 48MB/S:
- 川宇 8G手机内存卡 8GTF卡存储卡 C10高速class10 micro SD卡:
4.3 安装系统
4.3.1 下载系统固件
首先访问下载地址下载需要的固件文件(officail-ROMs目录)和烧写工具(tools目录):
使用以下固件: nanopi-k1-plus_friendlycore-xenial_4.x.y_YYYYMMDD.img.zip 基于UbuntuCore构建的FriendlyCore系统固件,使用Linux-4.x内核 nanopi-k1-plus_ubuntu-oled_4.x.y_YYYYMMDD.img.zip OLED系统固件,使用Linux-4.x内核,配合NanoHat OLED使用 nanopi-k1-plus_ubuntu-tft_4.x.y_YYYYMMDD.img.zip 默认支持Matrix - 2'8 SPI Key TFT的系统固件,使用Linux-4.x.y内核 nanopi-k1-plus_eflasher_4.x.y_YYYYMMDD.img.zip eflasher系统固件,使用Linux-4.x内核 烧写工具: win32diskimager.rar Windows平台下的系统烧写工具,Linux平台下可以用dd命令烧写系统
4.3.2 Linux
4.3.2.1 Flash to TF
- FriendlyCore / Debian / Ubuntu / OpenWrt / DietPi are all based on a same Linux distribution and their installation methods are the same.
- Extract the Linux image and win32diskimager.rar files. Insert a TF card(at least 8G) into a Windows PC and run the win32diskimager utility as administrator. On the utility's main window select your TF card's drive, the wanted image file and click on "write" to start flashing the TF card.
Take "nanopi-k1-plus_sd_friendlycore-xenial_4.14_arm64_YYYYMMDD.img" as an example here is the installation window. Other image files are installed on the similar window:
After it is installed you will see the following window:
- Insert this card into your board's BOOT slot and power on (with a 5V/2A power source). If the PWR LED is on and the STAT LED is blinking this indicates your board has successfully booted.
4.3.2.2 Flash to eMMC
4.3.2.2.1 Flash OS with eflasher Utility
- For more details about eflasher refer to the wiki link: EFlasher。
- Extract the eflasher Image and win32diskimager.rar files. Insert a TF card(at least 4G) into a Windows PC and run the win32diskimager utility as administrator. On the utility's main window select your TF card's drive, the wanted image file and click on "write" to start flashing the TF card.
- Insert this card into your board's BOOT slot and power on (with a 5V/2A power source). If the green LED is on and the blue LED is blinking this indicates your board has successfully booted.
- If your board doesn't support HDMI or no monitor is connected you can select an OS by running the following command:
$ su root
$ eflasher
The password for "root" is "fa".
We take "nanopi-k1-plus_eflasher_friendlycore-xenial_4.14_arm64_YYYYMMDD.img" as an example. After you run the "eflasher" command you will see the following messages:
Type "1", select writing friendlycore system to eMMC you will see the following messages:
Type "yes" to start installation:
After it is done power off the system, take off the TF card, power on again your system will be booted from eMMC.
- If you want to flash other system to eMMC you can download the whole images-for-eflasher directory and extract the package under that directory to the FRIENDLYARM partition of an installation SD card.
4.3.2.2.2 Flash OS to eMMC on PC
- An OS image for eMMC is the same as the one for an SD card. Extract an image package and flash utility. Insert an eMMC module(in a MicroSD to eMMC adapter) to a Windows PC. Run the win32diskimager utility as administrator. On the win32diskimager's main window select your MicroSD to eMMC adapter's drive, a wanted OS image and click "Write" to start flashing.
- After flash is done take out the MicroSD to eMMC adapter. Take the eMMC module off the adapter, insert this module to the board's eMMC slot and power up the board. If the PWR LED is solid on and the STAT LED is flashing it means your board has been successfully booted.
- When both an SD card and an eMMC module are connected to a board the board will be booted from the SD card first and if that fails it will be booted from eMMC.
4.3.3 Android
4.3.3.1 Flash to TF
Note:before make a MicroSD card to an Android image card you need to format this card.
- On a Windows PC run the HDDLLF.4.40 utility as administrator. Insert a TF card(at least 8G) into this PC and format it. After formatting is done take out the TF card, insert it into the PC again and format it with Windows internal format utility to format it to FAT32. After this formatting is done take out the card.
- Extract the the Android image and PhoenixCard_V310.rar . Insert the TF card you made in the previous step into a Windows PC and run the PhoenixCard_V310 utility as administrator. On the utility's main window select your TF card's drive, the wanted image file and click on "write" to start flashing the TF card.
(In the screenshot an Android image file for the NanoPi M1 Plus was selected. You need to select a correct image file for your board.)
- Insert this card into your board' BOOT slot and power on (with a 5V/2A power source). If the green LED is on and the blue LED is blinking this indicates your board has successfully booted.
4.3.3.2 Flash to eMMC
4.3.3.2.1 Install Android to eMMC from TF Card
- Extract an Android image file and the flashing utility PhoenixCard_V310.rar, insert a TF card(at least 8G) to a windows PC and run PhoenixCard as administrator. On the PhoenixCard Window select your TF card's device and your wanted Android image file, set the mode to "卡量产(factory production)" and click on "烧录(Flash)" to start flashing the Android image to TF card.
(In the screenshot an Android image file for the NanoPi M1 Plus was selected. You need to select a correct image file for your board.)
- After flashing is done, the TF card has the ability to burn the Android system to eMMC. Take out the TF card and insert it to your board's TF card slot. Connect your board to an HDMI monitor, power on your board(note:you need a 5V/2A power adapter) and you will see a green process bar on the HDMI monitor. After flashing is done take out the TF card and reboot your board and it will be rebooted from eMMC.
5 Work with FriendlyCore
5.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 FriendlyCore has the following additional features:
- it integrates Qt4.8;
- it integrates NetworkManager;
- it has bluez and Bluetooth related packages;
- it has alsa packages;
- it has npi-config;
- it has RPiGPIO, a Python GPIO module;
- it has some Python/C demo in /root/ directory;
- it enables 512M-swap partition;
5.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:
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:
- 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
5.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:
5.4 Develop Qt Application
Please refer to: How to Build and Install Qt Application for FriendlyELEC Boards
5.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.
5.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
5.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
5.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.
5.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。
5.10 WiringPi and Python Wrapper
- WiringNP: NanoPi NEO/NEO2/Air GPIO Programming with C
- RPi.GPIO : NanoPi NEO/NEO2/Air GPIO Programming with Python
5.11 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
5.12 Modify timezone
For exampe, change to Shanghai timezone:
sudo rm /etc/localtime sudo ln -ls /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
5.13 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。
5.14 Connect to DVP Camera CAM500B
For NanoPi-K1-Plus the CAM500B can work with Linux-4.14 Kernel.
The CAM500B camera module is a 5M-pixel camera with DVP interface. For more tech details about it you can refer to Matrix - CAM500B.
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 : sun6i-video Card type : sun6i-csi Bus info : platform:camera Driver version: 4.14.0 ...
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:
The mjpg-streamer utility uses libjpeg to software-encode steam data. The Linux-4.14 based ROM currently doesn't support hardware-encoding. If you use a H3 boards with Linux-3.4 based ROM you can use the ffmpeg utility to hardware-encode stream data and this can greatly release CPU's resources and speed up encoding:
$ 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
By default it records a 30-second video. Typing "q" stops video recording. After recording is stopped a test.mp4 file will be generated.
5.15 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.
5.16 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.
5.17 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.
5.18 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.19 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.
5.20 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
5.21 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:
5.22 How to install and use docker (for arm64 system)
5.22.1 How to Install Docker
Run the following commands:
sudo apt-get update sudo apt-get install docker.io
5.22.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
5.23 播放和录制音频
使用下列步骤测试播放和录制音频。
查看系统里的声卡设备:
$ aplay -l **** List of PLAYBACK Hardware Devices **** card 0: Codec [H3 Audio Codec], device 0: CDC PCM Codec-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0
全志H5和H3这两款CPU内部都自带了同一个codec设备,在主线内核中被命名为[H3 Audio Codec],请根据实际打印信息确定[H3 Audio Codec]对应的card设备。
播放音频:
$ aplay /root/Music/test.wav -D plughw:0
参数-D plughw:0表示使用设备card 0,请根据aplay -l的实际打印信息选择正确的card设备。
录制音频:
$ arecord -f cd -d 5 test.wav
6 如何编译FriendlyCore系统
6.1 使用开源社区主线BSP
K1 Plus现已支持使用64位Linux内核,并使用64位Ubuntu Core 16.04,关于H5芯片系列开发板使用主线U-boot和Linux-4.x.y的方法,请参考维基:Mainline U-boot & Linux
7 使用扩展配件及编程示例
7.1 Matrix - 2'8 SPI Key TFT显示模块
Matrix-2'8_SPI_Key_TFT模块是一款2.8英寸的TFT 触摸LCD,模块采用ST7789S驱动IC和XPT2046电阻式触摸IC,屏幕分辨率为240*320,采用SPI控制接口,模块还包含3个独立按键,可根据需要自定义功能。详见:Matrix - 2'8 SPI Key TFT
8 3D 打印外壳
9 资源链接
9.1 手册原理图等开发资料
- Schematic: Schematic_NanoPi-K1_Plus-1712_20171214.pdf
- Dimensions: Dimensions_NanoPi_K1_Plus-V1.0-1712_pcb(dxf).rar
- H5 Datasheet: Allwinner_H5_Datasheet_V1.0.pdf