Difference between revisions of "Template:FriendlyCoreAllwinnerH3"

From FriendlyELEC WiKi
Jump to: navigation, search
(updated by API)
(updated by API)
 
(30 intermediate revisions by 4 users not shown)
Line 1: Line 1:
===Connect to DVP Camera CAM500B===
 
 
{{#switch: {{{1}}}
 
{{#switch: {{{1}}}
  | NanoPi-M1 = {{FriendlyCoreAllwinner-DVPCam|NanoPi-M1}}
+
  | NanoPi-M1 =  
  | NanoPi-M1-Plus = {{FriendlyCoreAllwinner-DVPCam|NanoPi-M1-Plus}}
+
===Connect to DVP Camera CAM500B===
  | NanoPi-NEO-Air =  {{FriendlyCoreAllwinner-DVPCam|NanoPi-NEO-Air}}
+
{{FriendlyCoreAllwinner-DVPCam|NanoPi-M1}}
 +
  | NanoPi-M1-Plus =  
 +
===Connect to DVP Camera CAM500B===
 +
{{FriendlyCoreAllwinner-DVPCam|NanoPi-M1-Plus}}
 +
  | NanoPi-NEO-Air =   
 +
===Connect to DVP Camera CAM500B===
 +
{{FriendlyCoreAllwinner-DVPCam|NanoPi-NEO-Air}}
 +
| NanoPi-Duo2 = 
 +
===Connect to DVP Camera OV5640===
 +
{{FriendlyCoreAllwinner-DVPCam|NanoPi-Duo2}}
 
}}
 
}}
  
 
===Connect to USB Camera(FA-CAM202)===
 
===Connect to USB Camera(FA-CAM202)===
The FA-CAM202 is a 200M USB camera, 连接测试USB摄像头的方法请参考 <连接DVP摄像头模块(CAM500B)> 章节。<br>
+
The FA-CAM202 is a 200M USB camera. Connect your board to camera module. Then boot OS, connect your board to a network, log into the board as root and run "mjpg-streamer":
请自行修改start.sh, 确保使用正确的/dev/videoX节点, 下列命令可以用来确定FA-CAM202摄像头的video节点:
+
<syntaxhighlight lang="bash">
 +
$ cd /root/C/mjpg-streamer
 +
$ make
 +
$ ./start.sh
 +
</syntaxhighlight>
 +
 
 +
You need to change the start.sh script and make sure it uses a correct /dev/videoX node. You can check your camera's node by running the following commands:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ apt-get install v4l-utils
 
$ apt-get install v4l-utils
$ v4l2-ctl -d /dev/video1 -D
+
$ v4l2-ctl -d /dev/video0 -D
 
Driver Info (not using libv4l2):
 
Driver Info (not using libv4l2):
 
         Driver name  : uvcvideo
 
         Driver name  : uvcvideo
         Card type    : HC 3358+2100: HC 3358+2100
+
         Card type    : HC 3358+2100: HC 3358+2100 / USB 2.0 Camera: USB 2.0 Camera
 
         Bus info      : usb-1c1b000.usb-1
 
         Bus info      : usb-1c1b000.usb-1
 
...
 
...
 +
</syntaxhighlight>
 +
The above messages indicate that "/dev/video0" is camera's device node.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">
 +
$ ./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
 
</syntaxhighlight>
 
</syntaxhighlight>
  
===命令行查看CPU工作温度===
+
start.sh runs the following two commands:
在串口终端执行如下命令,可以快速地获取CPU的当前温度和运行频率等信息:
+
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
$ cpu_freq
+
export LD_LIBRARY_PATH="$(pwd)"
CPU0 online=1 temp=26581 governor=ondemand cur_freq=480000
+
./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"
CPU1 online=1 temp=26581 governor=ondemand cur_freq=480000
+
</syntaxhighlight>
CPU2 online=1 temp=26581 governor=ondemand cur_freq=480000
+
Here are some details for mjpg_streamer's major options:<br>
CPU3 online=1 temp=26581 governor=ondemand cur_freq=480000
+
-i: input device. For example "input_uvc.so" means it takes input from a camera;<br>
 +
-o: output device. For example "output_http.so" means the it transmits data via http;<br>
 +
-d: input device's subparameter. It defines a camera's device node;<br>
 +
-y: input device's subparameter. It defines a camera's data format: 1:yuyv, 2:yvyu, 3:uyvy 4:vyuy. If this option isn't defined MJPEG will be set as the data format;<br>
 +
-r: input device's subparameter. It defines a camera's resolution;<br>
 +
-f: input device's subparameter. It defines a camera's fps. But whether this fps is supported depends on its driver;<br>
 +
-q: input device's subparameter. It defines the quality of an image generated by libjpeg soft-encoding;<br>
 +
-n: input device's subparameter. It disables the dynctrls function;<br>
 +
-fb: input device's subparameter. It specifies whether an input image is displayed at "/dev/fbX";<br>
 +
-w: output device's subparameter. It defines a directory to hold web pages;<br><br>
 +
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>
 +
 
 +
===Check CPU's Working Temperature===
 +
You can get CPU's working temperature by running the following command:
 +
<syntaxhighlight lang="text">
 +
$ 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>
 +
This message means there are currently four CPUs working. All of their working temperature is 26.5 degree in Celsius and each one's clock is 624MHz.<br>
 +
Set CPU frequency:
 +
<syntaxhighlight lang="text">
 +
$ 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
 
</syntaxhighlight>
 
</syntaxhighlight>
上述信息表示当前有4个CPU核心在线, 温度均约为26.5摄氏度, 运行的策略均为根据需求来决定运行频率, 当前的运行频率均为480MHz。
 
  
 +
<!--
 
===Check System Information with Rpi-Monitor===
 
===Check System Information with Rpi-Monitor===
 
Our OS contains the Rpi-Monitor utility with which users can check system information and status.<br>
 
Our OS contains the Rpi-Monitor utility with which users can check system information and status.<br>
Line 39: Line 100:
 
[[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.
 
Users can easily check these system information and status.
 +
-->
  
===测试看门狗===
+
{{#switch: {{{1}}}
使用下列命令可以测试看门狗功能:
+
| NanoPi-R1 =  
<syntaxhighlight lang="bash">
+
<!-- don't have IR-Receiver-->
$ cd /root/demo/watchdog/
+
| #default =
$ gcc watchdog_demo.c -o watchdog_demo
+
===Test Infrared Receiver===
$ ./watchdog_demo /dev/watchdog0 10
+
{{Linux-IR-Receiver}}
Set timeout: 10 seconds
+
}}
Get timeout: 10 seconds
+
System will reboot in 10 second
+
</syntaxhighlight>
+
系统将在10秒之后重启.
+
 
+
===测试红外接收===
+
注意: 此章节仅适用于带有红外接收的板子(如NanoPi M1 / NanoPi M1 Plus等), 其他板子(如NanoPi NEO / NanoPi NEO Air等)则需要自行在GPIOL11引脚处接上红外接收器。<br>
+
红外接收功能默认是关闭的, 可以通过npi-config使能:
+
<syntaxhighlight lang="bash">
+
$ npi-config
+
    6 Advanced Options    Configure advanced settings
+
        A8 IR              Enable/Disable IR
+
            ir Enable/Disable ir[enabled]
+
</syntaxhighlight>
+
重启系统, 然后使用下列命令测试红外接收:
+
<syntaxhighlight lang="bash">
+
$ 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.
+
</syntaxhighlight>
+
ir-keytable -t用于检查是否有接收到红外信号, 使用任意遥控器发送按键信息给红外接收器, 可以看到类似下列信息:
+
<syntaxhighlight lang="bash">
+
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).
+
</syntaxhighlight>
+
 
+
===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.<br>
+
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 />
+
  
 +
{{#switch: {{{1}}}
 +
| NanoPi-R1
 +
| NanoPi-R1S-H3
 +
| NanoPi-R1S-H5
 +
| NanoPi-Duo2
 +
| ZeroPi =
 +
<!-- do nothing -->
 +
| #default =
 
===Run Qt Demo===
 
===Run Qt Demo===
 
Run the following command<br />
 
Run the following command<br />
Line 87: Line 125:
 
Here is what you expect to observe. This is an [https://github.com/friendlyarm/QtE-Demo open source Qt Demo]:<br />
 
Here is what you expect to observe. This is an [https://github.com/friendlyarm/QtE-Demo open source Qt Demo]:<br />
 
[[File:K2-QtE.png|frameless|400px|K2-QtE]]<br />
 
[[File:K2-QtE.png|frameless|400px|K2-QtE]]<br />
 +
}}
 +
 +
{{UbuntuXenial-Armhf-Install-Docker}}
 +
{{#switch: {{{1}}}
 +
| NanoPi-R1 =
 +
===Using RTC===
 +
NanoPi-R1提供了RTC电池接口,使用系统的RTC功能需要连接CR2032带线RTC纽扣电池给板子的RTC电路供电,电池连接如下图所示:<br />
 +
[[File:NanoPi R1-RTC-BAT-en.png|frameless|350px|]]<br />
 +
[http://wiki.friendlyelec.com/wiki/images/c/c5/1.25mm-2A.pdf Dimensional diagram of on board RTC battery connector ]
 +
***待完善****
 +
}}

Latest revision as of 06:33, 4 July 2022


1 Connect to USB Camera(FA-CAM202)

The FA-CAM202 is a 200M USB camera. Connect your board to camera module. Then boot OS, connect your board to a network, log into the board as root and run "mjpg-streamer":

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

You need to change the start.sh script and make sure it uses a correct /dev/videoX node. You can check your camera's node by running the following commands:

$ apt-get install v4l-utils
$ v4l2-ctl -d /dev/video0 -D
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
	...

The above messages indicate that "/dev/video0" is camera's device node.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
 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 runs the following two commands:

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"

Here are some details for mjpg_streamer's major options:
-i: input device. For example "input_uvc.so" means it takes input from a camera;
-o: output device. For example "output_http.so" means the it transmits data via http;
-d: input device's subparameter. It defines a camera's device node;
-y: input device's subparameter. It defines a camera's data format: 1:yuyv, 2:yvyu, 3:uyvy 4:vyuy. If this option isn't defined MJPEG will be set as the data format;
-r: input device's subparameter. It defines a camera's resolution;
-f: input device's subparameter. It defines a camera's fps. But whether this fps is supported depends on its driver;
-q: input device's subparameter. It defines the quality of an image generated by libjpeg soft-encoding;
-n: input device's subparameter. It disables the dynctrls function;
-fb: input device's subparameter. It specifies whether an input image is displayed at "/dev/fbX";
-w: output device's subparameter. It defines a directory to hold web pages;

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:
mjpg-streamer-cam500a

2 Check CPU's Working Temperature

You can get CPU's working temperature by running the following command:

$ 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

This message means there are currently four CPUs working. All of their working temperature is 26.5 degree in Celsius and each one's clock is 624MHz.
Set CPU frequency:

$ 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


3 Test Infrared Receiver

Note: Please Check your board if IR receiver exist.
By default the infrared function is disabled you can enable it by using the npi-config utility:

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

Reboot your system and test its infrared function by running the following commands:

$ 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   # Enable infrared
$ ir-keytable -t
Testing events. Please, press CTRL-C to abort.

"ir-keytable -t" is used to check whether the receiver receives infrared signals. You can use a remote control to send infrared signals to the receiver. If it works you will see similar messages as follows:

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

4 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

5 How to install and use docker (for armhf system)

5.1 How to Install Docker

Run the following commands:

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

5.2 Test Docker installation

Test that your installation works by running the simple docker image:

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