Difference between revisions of "Template:FriendlyCoreAllwinnerH3/zh"

From FriendlyELEC WiKi
Jump to: navigation, search
(updated by API)
Line 1: Line 1:
===Run Qt Demo===
+
===运行Qt示例程序===
Run the following command:<br />
+
执行以下命令:<br />
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ sudo /opt/QtE-Demo/run.sh
 
$ sudo /opt/QtE-Demo/run.sh
 
</syntaxhighlight>
 
</syntaxhighlight>
Here is what you expect to see. This is [https://github.com/friendlyarm/QtE-Demo an open source QtDemo]:<br />
+
运行结果如下,这是一个[https://github.com/friendlyarm/QtE-Demo 开源的QtDemo]:<br />
 
[[File:K2-QtE.png|frameless|400px|K2-QtE]]<br />
 
[[File:K2-QtE.png|frameless|400px|K2-QtE]]<br />
  
===Connect to DVP Camera CAM500B===
+
===连接DVP摄像头模块(CAM500B)===
Note: this function is only supported in Linux-3.4.y<br>
+
:该功能仅支持使用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>
+
CAM500B是一款500万像素摄像头模块,以DVP并行信号输出,详细信息请参考[[Matrix - CAM500B/zh|Matirx-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":
+
连接开发板和CAM500B,然后上电启动系统,连接网络,以root用户登录终端并编译运行mjpg-streamer:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ cd /root/mjpg-streamer
 
$ cd /root/mjpg-streamer
Line 16: Line 16:
 
$ ./start.sh
 
$ ./start.sh
 
</syntaxhighlight>
 
</syntaxhighlight>
The mjpg-streamer application is an open source video steam server. After it is successfully started the following messages will be popped up:
+
mjpg-streamer是一个开源的网络视频流服务器,在板子上成功运行mjpg-streamer后会打印下列信息:
 
<syntaxhighlight lang="bash">  
 
<syntaxhighlight lang="bash">  
 
  i: Using V4L2 device.: /dev/video0
 
  i: Using V4L2 device.: /dev/video0
Line 29: Line 29:
 
</syntaxhighlight>
 
</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>
+
假设开发板的IP地址为192.168.1.230,在PC的浏览器中输入 192.168.1.230:8080 就能浏览摄像头采集的画面了,效果如下:<br>
 
[[File:mjpg-streamer-cam500a.png|frameless|400px|mjpg-streamer-cam500a]] <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:
+
mjpg-streamer是用libjpeg对摄像头数据进行软编码,你可以使用ffmpeg对摄像头数据进行硬编码,这样能大大降低CPU的占用率并提高编码速度:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
$ ffmpeg -t 30 -f v4l2 -channel 0 -video_size 1280x720 -i /dev/video0 -pix_fmt nv12 -r 30 \
+
$ 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
        -b:v 64k -c:v cedrus264 test.mp4
+
 
</syntaxhighlight>
 
</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.
+
默认会录制30秒的视频,输入q能终止录制。录制完成后会在当前目录生成一个名为test.mp4的视频文件,可将其拷贝到PC上进行播放验证。
  
===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
 
</syntaxhighlight>
 
</syntaxhighlight>
  
===Check System Information with Rpi-Monitor===
+
===通过Rpi-Monitor查看系统状态===
Our OS contains the Rpi-Monitor utility with which users can check system information and status.<br>
+
系统里已经集成了Rpi-Monitor,该服务允许用户在通过浏览器查看开发板系统状态。<br>
In our case our board's IP was 192.168.1.230 and we typed the following IP in a browser:
+
假设开发板的IP地址为192.168.1.230,在PC的浏览器中输入下述地址:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
192.168.1.230:8888
 
192.168.1.230:8888
 
</syntaxhighlight>
 
</syntaxhighlight>
We were directed to the following page:<br>
+
可以进入如下页面:<br>
 
[[File:rpi-monitor.png|frameless|500px|rpi-monitor]] <br>
 
[[File:rpi-monitor.png|frameless|500px|rpi-monitor]] <br>
Users can easily check these system information and status.
+
用户可以非常方便地查看到系统负载、CPU的频率和温度、可用内存、SD卡容量等信息。
  
===Access GPIO Pins/Wirings with WiringNP===
+
===通过WiringNP测试GPIO===
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.<br>
+
wiringPi库最早是由Gordon Henderson所编写并维护的一个用C语言写成的类库,除了GPIO库,还包括了I2C库、SPI库、UART库和软件PWM库等,由于wiringPi的API函数和arduino非常相似,这也使得它广受欢迎。
FriendlyElec integrated this utility in FriendlyCore system allowing users to easily access GPIO pins. For more details refer to WiringNP [[WiringNP:_WiringPi_for_NanoPi_NEO/NEO2|WiringNP]]<br />
+
wiringPi库除了提供wiringPi类库及其头文件外,还提供了一个命令行工具gpio:可以用来设置和读写GPIO管脚,以方便在Shell脚本中控制GPIO管脚。<br>
 +
我们在FriendlyCore系统中集成了这个工具以便客户测试GPIO管脚。详细信息请参看 [[WiringNP:_WiringPi_for_NanoPi_NEO/NEO2|WiringNP]]<br />

Revision as of 07:14, 25 December 2017

1 运行Qt示例程序

执行以下命令:

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

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

2 连接DVP摄像头模块(CAM500B)

注:该功能仅支持使用Linux-3.4.y的系统固件。
CAM500B是一款500万像素摄像头模块,以DVP并行信号输出,详细信息请参考Matirx-CAM500B
连接开发板和CAM500B,然后上电启动系统,连接网络,以root用户登录终端并编译运行mjpg-streamer:

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

mjpg-streamer是一个开源的网络视频流服务器,在板子上成功运行mjpg-streamer后会打印下列信息:

 
 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

假设开发板的IP地址为192.168.1.230,在PC的浏览器中输入 192.168.1.230:8080 就能浏览摄像头采集的画面了,效果如下:
mjpg-streamer-cam500a
mjpg-streamer是用libjpeg对摄像头数据进行软编码,你可以使用ffmpeg对摄像头数据进行硬编码,这样能大大降低CPU的占用率并提高编码速度:

$ 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

默认会录制30秒的视频,输入q能终止录制。录制完成后会在当前目录生成一个名为test.mp4的视频文件,可将其拷贝到PC上进行播放验证。

3 命令行查看CPU工作温度

在串口终端执行如下命令,可以快速地获取CPU的当前温度和运行频率等信息:

$ cpu_freq

4 通过Rpi-Monitor查看系统状态

系统里已经集成了Rpi-Monitor,该服务允许用户在通过浏览器查看开发板系统状态。
假设开发板的IP地址为192.168.1.230,在PC的浏览器中输入下述地址:

192.168.1.230:8888

可以进入如下页面:
rpi-monitor
用户可以非常方便地查看到系统负载、CPU的频率和温度、可用内存、SD卡容量等信息。

5 通过WiringNP测试GPIO

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