Difference between revisions of "Template:FriendlyCoreAllwinnerH3"

From FriendlyELEC WiKi
Jump to: navigation, search
(测试红外接收)
(updated by API)
Line 1: Line 1:
===Connect to DVP Camera CAM500B===
+
{{#switch: {{{1}}}
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>
+
| NanoPi-M1 = {{FriendlyCoreAllwinner-DVPCam|NanoPi-M1}}
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":
+
  | NanoPi-M1-Plus = {{FriendlyCoreAllwinner-DVPCam|NanoPi-M1-Plus}}
<syntaxhighlight lang="bash">
+
| NanoPi-NEO-Air = {{FriendlyCoreAllwinner-DVPCam|NanoPi-NEO-Air}}
$ 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>
+
mjpg-streamer是用libjpeg对摄像头数据进行软编码,Linux-4.x内核的ROM目前并不支持视频硬编码, 但是如果使用Linux-3.x内核的ROM的话, 则可以使用ffmpeg对摄像头数据进行硬编码,这样能大大降低CPU的占用率并提高编码速度:
+
<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.
+
  
 
===Connect to USB Camera(FA-CAM202)===
 
===Connect to USB Camera(FA-CAM202)===
Line 42: Line 18:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
===Check CPU's Working Temperature===
+
===命令行查看CPU工作温度===
You can use the following command to read H3's temperature and frequency
+
在串口终端执行如下命令,可以快速地获取CPU的当前温度和运行频率等信息:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
cpu_freq
+
$ 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
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
上述信息表示当前有4个CPU核心在线, 温度均约为26.5摄氏度, 运行的策略均为根据需求来决定运行频率, 当前的运行频率均为480MHz。
  
 
===Check System Information with Rpi-Monitor===
 
===Check System Information with Rpi-Monitor===

Revision as of 05:39, 9 April 2018


1 Connect to USB Camera(FA-CAM202)

The FA-CAM202 is a 200M USB camera, 连接测试USB摄像头的方法请参考 <连接DVP摄像头模块(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
	...

2 命令行查看CPU工作温度

在串口终端执行如下命令,可以快速地获取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 Check System Information with Rpi-Monitor

Our OS contains the Rpi-Monitor utility with which users can check system information and status.
In our case our board's IP was 192.168.1.230 and we typed the following IP in a browser:

192.168.1.230:8888

We were directed to the following page:
rpi-monitor
Users can easily check these system information and status.

4 测试看门狗

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

$ 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秒之后重启.

5 测试红外接收

注意: 此章节仅适用于带有红外接收的板子(如NanoPi M1 / NanoPi M1 Plus等), 其他板子(如NanoPi NEO / NanoPi NEO Air等)则需要自行在GPIOL11引脚处接上红外接收器。
红外接收功能默认是关闭的, 可以通过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).

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

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