Difference between revisions of "Template:FriendlyCoreAllwinnerH5/zh"

From FriendlyELEC WiKi
Jump to: navigation, search
(updated by API)
(updated by API)
Line 62: Line 62:
 
系统将在10秒之后重启。
 
系统将在10秒之后重启。
  
 +
 +
{{#switch: {{{1}}}
 +
| NanoPi-NEO2-Black =
 +
<!-- do nothing -->
 +
| #default =
 
===测试红外接收===
 
===测试红外接收===
 
{{Linux-IR-Receiver/zh}}
 
{{Linux-IR-Receiver/zh}}
 +
}}
  
 
===读取CHIP ID===
 
===读取CHIP ID===

Revision as of 08:03, 17 October 2019


1 连接USB摄像头模块(FA-CAM202)

FA-CAM202是一款200万像素的USB摄像头模块, 连接测试USB摄像头的方法请参考本页面<连接DVP摄像头模块(CAM500B)>章节或者Matrix - CAM500B页面
请自行修改start.sh, 确保使用正确的/dev/videoX节点, 下列命令可以用来确定FA-CAM202摄像头的video节点:

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

上述信息表示/dev/video1是FA-CAM202的设备节点。

2 查看CPU温度和频率

  • 命令行查看:
$ 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

上述信息表示当前有4个CPU核心在线, 温度均约为26.5摄氏度, 运行的策略均为根据需求来决定运行频率, 当前的运行频率均为480MHz。


3 测试看门狗

使用下列命令可以测试看门狗功能:

$ 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

系统将在10秒之后重启。


4 测试红外接收

注意: 请先检查红外接收器是否存在。
红外接收功能默认是关闭的, 可以通过npi-config使能:

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

重启系统, 然后使用下列命令测试红外接收:

$ 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   # 使能紅外协议
$ ir-keytable -t
Testing events. Please, press CTRL-C to abort.

ir-keytable -t用于检查是否有接收到红外信号, 使用任意遥控器发送按键信息给红外接收器, 可以看到类似下列信息:

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 读取CHIP ID

对于全志H2+/H3/H5/芯片,CPU里内置了16 Byte的CHIP ID,在Linux-4.14下可以使用下列命令读取:

$ 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"即为16 Byte的CHIP ID。

CHIP ID相关驱动代码位于: ./drivers/nvmem/sunxi_sid.c

6 通过WiringNP测试GPIO

wiringPi库最早是由Gordon Henderson所编写并维护的一个用C语言写成的类库,除了GPIO库,还包括了I2C库、SPI库、UART库和软件PWM库等,由于wiringPi的API函数和arduino非常相似,这也使得它广受欢迎。 wiringPi库除了提供wiringPi类库及其头文件外,还提供了一个命令行工具gpio:可以用来设置和读写GPIO管脚,以方便在Shell脚本中控制GPIO管脚。
我们在FriendlyCore系统中支持了这个工具以便客户测试GPIO管脚。详细信息请参看 WiringNP

7 运行Qt示例程序

执行以下命令:

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

运行结果如下,这是一个开源的QtDemo:
K2-QtE

8 Docker在arm64系统下的安装与使用

8.1 安装 Docker

执行下列命令:

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

8.2 测试 Docker

执行下列命令运行一个简单的docker image:

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