Difference between revisions of "Template:FriendlyCoreAllwinnerH3/zh"

From FriendlyELEC WiKi
Jump to: navigation, search
(updated by API)
 
(75 intermediate revisions by 3 users not shown)
Line 1: Line 1:
===Run Qt Demo===
+
{{#switch: {{{1}}}
Run the following command:<br />
+
| NanoPi-M1 =  
 +
===连接DVP摄像头模块(CAM500B)===
 +
{{FriendlyCoreAllwinner-DVPCam/zh|NanoPi-M1}}
 +
| NanoPi-M1-Plus =
 +
===连接DVP摄像头模块(CAM500B)===
 +
{{FriendlyCoreAllwinner-DVPCam/zh|NanoPi-M1-Plus}}
 +
| NanoPi-NEO-Air = 
 +
===连接DVP摄像头模块(CAM500B)===
 +
{{FriendlyCoreAllwinner-DVPCam/zh|NanoPi-NEO-Air}}
 +
| NanoPi-Duo2 = 
 +
===连接DVP摄像头模块(OV5640)===
 +
{{FriendlyCoreAllwinner-DVPCam/zh|NanoPi-Duo2}}
 +
}}
 +
===连接USB摄像头模块(FA-CAM202)===
 +
FA-CAM202是一款200万像素的USB摄像头模块,连接开发板和摄像头,然后上电启动系统,连接网络,以root用户登录终端并编译运行mjpg-streamer:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
$ sudo /opt/QtE-Demo/run.sh
+
$ cd /root/C/mjpg-streamer
</syntaxhighlight>
+
Here is what you expect to see. This is [https://github.com/friendlyarm/QtE-Demo an open source QtDemo]:<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
 
$ make
 
$ ./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:
+
请自行修改start.sh, 确保使用正确的/dev/videoX节点, 下列命令可以用来确定摄像头的video节点:
<syntaxhighlight lang="bash">  
+
<syntaxhighlight lang="bash">
 +
$ apt-get install v4l-utils
 +
$ v4l2-ctl -d /dev/video0 -D
 +
# fa-cam202有2个型号
 +
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
 +
...
 +
</syntaxhighlight>
 +
上述信息表示/dev/video0是摄像头的设备节点。mjpg-streamer是一个开源的网络视频流服务器,在板子上成功运行mjpg-streamer后会打印下列信息:
 +
<syntaxhighlight lang="bash">
 +
$ ./start.sh
 
  i: Using V4L2 device.: /dev/video0
 
  i: Using V4L2 device.: /dev/video0
 
  i: Desired Resolution: 1280 x 720
 
  i: Desired Resolution: 1280 x 720
Line 28: Line 44:
 
  o: commands..........: enabled
 
  o: commands..........: enabled
 
</syntaxhighlight>
 
</syntaxhighlight>
 
+
start.sh脚本里执行了下列2个命令:
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">
 
<syntaxhighlight lang="bash">
$ ffmpeg -t 30 -f v4l2 -channel 0 -video_size 1280x720 -i /dev/video0 -pix_fmt nv12 -r 30 \
+
export LD_LIBRARY_PATH="$(pwd)"
        -b:v 64k -c:v cedrus264 test.mp4
+
./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"
 
</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.
+
mjpg_streamer相关参数的含义如下:<br>
 +
-i: 选择输入插件,input_uvc.so表示从摄像头采集数据;<br>
 +
-o: 选择输出插件,output_http.so表示使用http协议传输数据;<br>
 +
-d: 输入插件的子参数,指定摄像头设备节点;<br>
 +
-y: 输入插件的子参数,指定摄像头采集数据的格式,1:yuyv, 2:yvyu, 3:uyvy 4:vyuy,如果不使用-y参数,则表示采集MJPEG格式;<br>
 +
-r: 输入插件的子参数,指定摄像头采集分辨率;<br>
 +
-f: 输入插件的子参数,指定想使用的摄像头采集fps,具体是否支持依赖于驱动;<br>
 +
-q: 输入插件的子参数,指定libjpeg软编码的图像质量;<br>
 +
-n: 输入插件的子参数, 禁止dynctrls功能;<br>
 +
-fb: 输入插件的子参数, 指定是否在/dev/fbX上显示采集的图像;<br>
 +
-w: 输出插件的子参数, 指定包含网页的目录;<br><br>
 +
成功运行start.sh脚本后,假设开发板的IP地址为192.168.1.230,在PC的浏览器中输入 192.168.1.230:8080 就能浏览摄像头采集的画面了,效果如下:<br>
 +
[[File:mjpg-streamer-cam500a.png|frameless|400px|mjpg-streamer-cam500a]] <br>
  
===Check CPU's Working Temperature===
+
===查看CPU温度和频率===
You can use the following command to read H3's temperature and frequency
+
命令行查看:
<syntaxhighlight lang="bash">
+
<syntaxhighlight lang="text">
cpu_freq
+
$ 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
 
</syntaxhighlight>
 
</syntaxhighlight>
 
+
上述信息表示当前有4个CPU核在线, 温度均约为26.5摄氏度, 运行的策略均为根据需求来决定运行频率, 当前的运行频率均为624MHz,设置频率的命令如下:
===Check System Information with Rpi-Monitor===
+
<syntaxhighlight lang="text">
Our OS contains the Rpi-Monitor utility with which users can check system information and status.<br>
+
$ cpu_freq -s 1008000
In our case our board's IP was 192.168.1.230 and we typed the following IP in a browser:
+
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
 +
</syntaxhighlight>
 +
上述命令将4个CPU核的频率设置为1008MHz。<br>
 +
<!--
 +
===通过Rpi-Monitor查看系统状态===
 +
系统里已经集成了Rpi-Monitor,该服务允许用户在通过浏览器查看开发板系统状态。<br>
 +
假设开发板的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卡容量等信息。
 +
-->
 +
 
 +
{{#switch: {{{1}}}
 +
| NanoPi-M1 =
 +
| NanoPi-M1-Plus =
 +
===测试红外接收===
 +
{{Linux-IR-Receiver/zh}}
 +
}}
 +
 
 +
{{#switch: {{{1}}}
 +
| NanoPi-R1
 +
| NanoPi-R1S-H3
 +
| NanoPi-R1S-H5
 +
| NanoPi-Duo2
 +
| ZeroPi =
 +
<!-- do nothing -->
 +
| #default =
 +
===运行Qt示例程序===
 +
执行以下命令:<br />
 +
<syntaxhighlight lang="bash">
 +
$ sudo /opt/QtE-Demo/run.sh
 +
</syntaxhighlight>
 +
运行结果如下,这是一个[https://github.com/friendlyarm/QtE-Demo 开源的QtDemo]:<br />
 +
[[File:K2-QtE.png|frameless|400px|K2-QtE]]<br />
 +
}}
 +
{{UbuntuXenial-Armhf-Install-Docker/zh}}
  
===Access GPIO Pins/Wirings with WiringNP===
+
{{#switch: {{{1}}}
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>
+
| NanoPi-R1 =  
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 />
+
===使用RTC===
 +
NanoPi-R1提供了RTC电池接口,使用系统的RTC功能需要连接CR2032带线RTC纽扣电池给板子的RTC电路供电,电池连接如下图所示:<br />
 +
[[File:NanoPi R1-RTC-BAT.png|frameless|350px|]]<br />
 +
[http://wiki.friendlyelec.com/wiki/images/c/c5/1.25mm-2A.pdf RTC电池座尺寸规格书]
 +
***待完善****
 +
}}

Latest revision as of 06:33, 4 July 2022

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

FA-CAM202是一款200万像素的USB摄像头模块,连接开发板和摄像头,然后上电启动系统,连接网络,以root用户登录终端并编译运行mjpg-streamer:

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

请自行修改start.sh, 确保使用正确的/dev/videoX节点, 下列命令可以用来确定摄像头的video节点:

$ apt-get install v4l-utils
$ v4l2-ctl -d /dev/video0 -D
# fa-cam202有2个型号
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
	...

上述信息表示/dev/video0是摄像头的设备节点。mjpg-streamer是一个开源的网络视频流服务器,在板子上成功运行mjpg-streamer后会打印下列信息:

$ ./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脚本里执行了下列2个命令:

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"

mjpg_streamer相关参数的含义如下:
-i: 选择输入插件,input_uvc.so表示从摄像头采集数据;
-o: 选择输出插件,output_http.so表示使用http协议传输数据;
-d: 输入插件的子参数,指定摄像头设备节点;
-y: 输入插件的子参数,指定摄像头采集数据的格式,1:yuyv, 2:yvyu, 3:uyvy 4:vyuy,如果不使用-y参数,则表示采集MJPEG格式;
-r: 输入插件的子参数,指定摄像头采集分辨率;
-f: 输入插件的子参数,指定想使用的摄像头采集fps,具体是否支持依赖于驱动;
-q: 输入插件的子参数,指定libjpeg软编码的图像质量;
-n: 输入插件的子参数, 禁止dynctrls功能;
-fb: 输入插件的子参数, 指定是否在/dev/fbX上显示采集的图像;
-w: 输出插件的子参数, 指定包含网页的目录;

成功运行start.sh脚本后,假设开发板的IP地址为192.168.1.230,在PC的浏览器中输入 192.168.1.230:8080 就能浏览摄像头采集的画面了,效果如下:
mjpg-streamer-cam500a

2 查看CPU温度和频率

命令行查看:

$ 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

上述信息表示当前有4个CPU核在线, 温度均约为26.5摄氏度, 运行的策略均为根据需求来决定运行频率, 当前的运行频率均为624MHz,设置频率的命令如下:

$ 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

上述命令将4个CPU核的频率设置为1008MHz。


3 运行Qt示例程序

执行以下命令:

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

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

4 Docker在armhf系统下的安装与使用

4.1 安装 Docker

执行下列命令:

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

4.2 测试 Docker

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

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