Difference between revisions of "Template:FriendlyCoreAllwinnerH3/zh"
Line 128: | Line 128: | ||
| NanoPi-R1 = | | NanoPi-R1 = | ||
===使用RTC=== | ===使用RTC=== | ||
− | NanoPi-R1提供了RTC电池接口,使用系统的RTC功能需要连接CR2032带线RTC纽扣电池给板子的RTC电路供电,电池连接如下图所示: | + | NanoPi-R1提供了RTC电池接口,使用系统的RTC功能需要连接CR2032带线RTC纽扣电池给板子的RTC电路供电,电池连接如下图所示:<br /> |
[[File:NanoPi R1-RTC-BAT.png|frameless|350px|]]<br /> | [[File:NanoPi R1-RTC-BAT.png|frameless|350px|]]<br /> | ||
[http://wiki.friendlyarm.com/wiki/images/c/c5/1.25mm-2A.pdf RTC电池座尺寸规格书] | [http://wiki.friendlyarm.com/wiki/images/c/c5/1.25mm-2A.pdf RTC电池座尺寸规格书] | ||
***待完善**** | ***待完善**** | ||
}} | }} |
Revision as of 04:56, 29 September 2019
Contents
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 就能浏览摄像头采集的画面了,效果如下:
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:
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
5 FriendlyCore下使用4G模块EC20
5.1 第0步:将SIM卡插入到EC20中
5.2 第1步:在开发板上编译quectel-CM命令行拨号程序
输入以下命令,编译并安装quectel-CM到 /usr/bin/ 目录:
git clone https://github.com/friendlyarm/quectel-cm.git cd quectel-cm/ make cp quectel-CM /usr/bin/
5.3 第2步:创建udhcpc script
quectel-CM程序会将运营商返回的IP、DNS等作为参数调用udhcpc script,这个脚本是不存在的,我们需要自已创建一个,请用你熟悉的编辑器创建一个新文件,文件名为:/usr/share/udhcpc/default.script,内容如下:
#!/bin/sh # udhcpc script edited by Tim Riker <Tim@Rikers.org> [ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1 RESOLV_CONF="/etc/resolv.conf" [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" [ -n "$subnet" ] && NETMASK="netmask $subnet" case "$1" in deconfig) /sbin/ifconfig $interface 0.0.0.0 ;; renew|bound) /sbin/ifconfig $interface $ip $BROADCAST $NETMASK if [ -n "$router" ] ; then echo "deleting routers" while route del default gw 0.0.0.0 dev $interface ; do : done for i in $router ; do route add default gw $i dev $interface done fi echo -n > $RESOLV_CONF [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF for i in $dns ; do echo adding dns $i echo nameserver $i >> $RESOLV_CONF done ;; esac exit 0
保存后,再用以下命令赋于可执行权限:
chmod 755 /usr/share/udhcpc/default.script
5.4 第3步:开始4G拨号
输入以下命令启动拨号:
quectel-CM &
拨号成功,屏幕会输出IP地址等信息,如下所示:
root@NanoPC-T4:~# quectel-CM & [1] 5364 root@NanoPC-T4:~# [05-15_08:23:13:719] WCDMA<E_QConnectManager_Linux&Android_V1.1.34 [05-15_08:23:13:720] quectel-CM profile[1] = (null)/(null)/(null)/0, pincode = (null) [05-15_08:23:13:721] Find /sys/bus/usb/devices/3-1 idVendor=2c7c idProduct=0125 [05-15_08:23:13:722] Find /sys/bus/usb/devices/3-1:1.4/net/wwan0 [05-15_08:23:13:722] Find usbnet_adapter = wwan0 [05-15_08:23:13:723] Find /sys/bus/usb/devices/3-1:1.4/usbmisc/cdc-wdm0 [05-15_08:23:13:723] Find qmichannel = /dev/cdc-wdm0 [05-15_08:23:13:739] cdc_wdm_fd = 7 [05-15_08:23:13:819] Get clientWDS = 18 [05-15_08:23:13:851] Get clientDMS = 2 [05-15_08:23:13:884] Get clientNAS = 2 [05-15_08:23:13:915] Get clientUIM = 1 [05-15_08:23:13:947] Get clientWDA = 1 [05-15_08:23:13:979] requestBaseBandVersion EC20CEFHLGR06A01M1G_OCPU_BETA1210 [05-15_08:23:14:043] requestSetEthMode QMUXResult = 0x1, QMUXError = 0x46 [05-15_08:23:14:075] requestGetSIMStatus SIMStatus: SIM_READY [05-15_08:23:14:107] requestGetProfile[1] cmnet///0 [05-15_08:23:14:139] requestRegistrationState2 MCC: 460, MNC: 0, PS: Attached, DataCap: LTE [05-15_08:23:14:171] requestQueryDataCall IPv4ConnectionStatus: DISCONNECTED [05-15_08:23:14:235] requestRegistrationState2 MCC: 460, MNC: 0, PS: Attached, DataCap: LTE [05-15_08:23:14:938] requestSetupDataCall WdsConnectionIPv4Handle: 0xe16e4540 [05-15_08:23:15:002] requestQueryDataCall IPv4ConnectionStatus: CONNECTED [05-15_08:23:15:036] ifconfig wwan0 up [05-15_08:23:15:052] busybox udhcpc -f -n -q -t 5 -i wwan0 [05-15_08:23:15:062] udhcpc (v1.23.2) started [05-15_08:23:15:077] Sending discover... [05-15_08:23:15:093] Sending select for 10.22.195.252... [05-15_08:23:15:105] Lease of 10.22.195.252 obtained, lease time 7200 [05-15_08:23:15:118] deleting routers SIOCDELRT: No such process [05-15_08:23:15:132] adding dns 221.179.38.7 [05-15_08:23:15:132] adding dns 120.196.165.7
5.5 测试4G连接
ping一个域名,看看DNS解析是否已经在工作了:
root@NanoPC-T4:~# ping www.baidu.com PING www.a.shifen.com (183.232.231.174) 56(84) bytes of data. 64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=1 ttl=56 time=74.3 ms 64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=2 ttl=56 time=25.1 ms 64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=3 ttl=56 time=30.8 ms 64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=4 ttl=56 time=29.1 ms 64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=5 ttl=56 time=29.2 ms
5.6 测试4G的网速
wget -O - https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python
得到的测试结果类拟如下这样:
Retrieving speedtest.net configuration... Testing from China Mobile Guangdong (117.136.40.167)... Retrieving speedtest.net server list... Selecting best server based on ping... Hosted by ChinaTelecom-GZ (Guangzhou) [2.51 km]: 62.726 ms Testing download speed................................................................................ Download: 32.93 Mbit/s Testing upload speed................................................................................................ Upload: 5.58 Mbit/s