Difference between revisions of "VEYE CS Camera on Firfly Boards"
(24 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | '''<big>How to use VEYE and CS series cameras on Firefly's RK35XX board | + | '''<big>How to use VEYE and CS series cameras on Firefly's RK35XX board</big>''' |
+ | |||
+ | [[VEYE CS Camera on Firfly Boards/zh|查看中文]] | ||
=== Overview === | === Overview === | ||
− | VEYE series and CS series cameras are the video streaming mode MIPI cameras we designed. This article takes Firefly's ROC-RK3566-PC board as an example to introduce how to connect VEYE and CS series cameras to RK3566/RK3568/RK3588 system. | + | VEYE series and CS series cameras are the video streaming mode MIPI cameras we designed. This article takes Firefly's ROC-RK3566-PC and ROC-RK3588S-PC board as an example to introduce how to connect VEYE and CS series cameras to RK3566/RK3568/RK3588 system. |
+ | |||
+ | We provide drivers for both Linux(Ubuntu) and Android. | ||
==== Camera Module List ==== | ==== Camera Module List ==== | ||
Line 22: | Line 26: | ||
|Done | |Done | ||
|} | |} | ||
+ | In addition, the driver for the Fpdlink connection mode has been finished on the Ubuntu system. | ||
+ | |||
=== Hardware Setup === | === Hardware Setup === | ||
− | VEYE series and CS series cameras are provided with Raspberry Pi compatible 15Pin FFC connector. An [[ADP-Tfirefly]] adapter board is required to adapt to the ROC- | + | VEYE series and CS series cameras are provided with Raspberry Pi compatible 15Pin FFC connector. An [[ADP-Tfirefly]] adapter board is required to adapt to the ROC-RK35xx-PC board. |
==== Connection of camera and ADP-Tfirefly ==== | ==== Connection of camera and ADP-Tfirefly ==== | ||
The two are connected using 1.0 mm pitch*15P FFC cable with opposite direction. The cable must be inserted with the silver contacts facing outside. | The two are connected using 1.0 mm pitch*15P FFC cable with opposite direction. The cable must be inserted with the silver contacts facing outside. | ||
+ | [[File:VEYE-MIPI-327S-ADP-Tfirefly 06.jpg|link=http://wiki.veye.cc/index.php/File:VEYE-MIPI-327S-ADP-Tfirefly%2006.jpg|center|thumb|800x800px|VEYE camera connect to ADP-Tfirefly]] | ||
==== Connection of ADP-Tfirefly and Firefly Board ==== | ==== Connection of ADP-Tfirefly and Firefly Board ==== | ||
The two are connected using 0.5 mm pitch*30P FFC cable with same direction. The cable must be inserted with the silver contacts facing inside. | The two are connected using 0.5 mm pitch*30P FFC cable with same direction. The cable must be inserted with the silver contacts facing inside. | ||
+ | [[File:VEYE-MIPI-327S-ADP-Tfirefly 05.jpg|link=http://wiki.veye.cc/index.php/File:VEYE-MIPI-327S-ADP-Tfirefly%2005.jpg|center|thumb|800x800px|ADP-Tfirefly connect to Firefly board]] | ||
==== Overall connection ==== | ==== Overall connection ==== | ||
− | + | [[File:VEYE-MIPI-327S-ADP-Tfirefly 04.jpg|link=http://wiki.veye.cc/index.php/File:VEYE-MIPI-327S-ADP-Tfirefly%2004.jpg|center|thumb|800x800px|Firefly Board and VEYE camera overall]] | |
+ | ==== FPD-Link III Camera Connection Diagram ==== | ||
+ | [[File:FPDLINK Camera to RK3588S.png|center|thumb|800x800px|FPDLINK Camera to RK3588S]] | ||
+ | <br /> | ||
=== Introduction to github repositories === | === Introduction to github repositories === | ||
− | https://github.com/veyeimaging/ | + | https://github.com/veyeimaging/rk35xx_firefly |
includes: | includes: | ||
Line 43: | Line 54: | ||
* application demo | * application demo | ||
− | In addition, a compiled linux kernel installation package is provided in the [https://github.com/veyeimaging/rk356x_firefly/releases releases]. | + | In addition, a compiled linux kernel installation package and Android image is provided in the [https://github.com/veyeimaging/rk356x_firefly/releases releases]. |
+ | |||
+ | === Ubuntu === | ||
− | === Upgrade Firefly Ubuntu | + | ==== Upgrade Firefly Ubuntu system(RK356x) ==== |
− | ==== Overview ==== | + | ===== Overview ===== |
This section describes how to update the RK35xx system to support our camera modules. | This section describes how to update the RK35xx system to support our camera modules. | ||
− | For | + | For the kernel version 4.19, we provide a deb installation package that can be installed directly. |
+ | |||
+ | For the kernel version 5.10, we provide a burning image. | ||
+ | |||
+ | For versions where no installer is provided, you will need to refer to later chapters to compile from the driver source code. | ||
Although we are now using Ubuntu system as an example to introduce, other Linux distributions can also refer to this article. | Although we are now using Ubuntu system as an example to introduce, other Linux distributions can also refer to this article. | ||
− | ====Burn Firefly standard system==== | + | ===== kernel version 5.10 ===== |
+ | For the ROC-RK3588S-PC, we have provided an image of the release system. | ||
+ | |||
+ | Download the latest released image file corresponding to the camera model you are using from https://github.com/veyeimaging/rk35xx_firefly/releases/ . | ||
+ | |||
+ | Refer to the [https://wiki.t-firefly.com/en/ROC-RK3566-PC/03-upgrade_firmware.html Firefly documentation] to burn in a standard system. | ||
+ | |||
+ | ===== kernel version 4.19 ===== | ||
+ | |||
+ | ======Burn Firefly standard system====== | ||
Refer to the [https://wiki.t-firefly.com/en/ROC-RK3566-PC/01-bootmode.html Firefly documentation] to burn in a standard system. | Refer to the [https://wiki.t-firefly.com/en/ROC-RK3566-PC/01-bootmode.html Firefly documentation] to burn in a standard system. | ||
− | ====Using prebuilt Image and dtb file==== | + | ======Using prebuilt Image and dtb file====== |
Using the compiled debain installation package | Using the compiled debain installation package | ||
− | On the RK35xx board, | + | On the RK35xx board, |
− | + | Download the latest rk356x_firefly_ubuntu.tar.gz from https://github.com/veyeimaging/rk35xx_firefly/releases/ . | |
<code>tar -xavf rk356x_firefly.tar.gz</code> | <code>tar -xavf rk356x_firefly.tar.gz</code> | ||
− | <code> | + | <code>cd rk356x_firefly/released_images/ROC-RK3566-PC/ubuntu/</code> |
<code>sudo dpkg -i linux-image-4.19.232_4.19.232-21_arm64.deb</code> | <code>sudo dpkg -i linux-image-4.19.232_4.19.232-21_arm64.deb</code> | ||
Line 71: | Line 97: | ||
If the version does not match, it needs to be compiled from the source code. | If the version does not match, it needs to be compiled from the source code. | ||
− | === Check system status === | + | ==== Upgrade Firefly Ubuntu system(RK358x) ==== |
+ | For the ROC-RK3588S-PC, we have provided an image of the release system. | ||
+ | |||
+ | Download the latest released image file corresponding to the camera model you are using from https://github.com/veyeimaging/rk35xx_firefly/releases/ . | ||
+ | |||
+ | Refer to the [https://wiki.t-firefly.com/en/ROC-RK3588S-PC/upgrade_bootmode.html Firefly documentation] to burn in a standard system. | ||
+ | |||
+ | ==== Check system status ==== | ||
Run the following command to confirm whether the camera is probed. | Run the following command to confirm whether the camera is probed. | ||
+ | |||
+ | * VEYE-MIPI-XXX | ||
+ | |||
+ | <code>dmesg | grep veye</code> | ||
+ | |||
+ | The output message appears as shown below: | ||
+ | |||
+ | <code>veyecam2m 4-003b: camera id is veyecam2m</code> | ||
+ | |||
+ | <code>veyecam2m 4-003b: sensor is IMX327</code> | ||
+ | |||
+ | * Run the following command to check the presence of video node. | ||
+ | |||
+ | <code>ls /dev/video0</code> | ||
+ | |||
+ | The output message appears as shown below. | ||
+ | |||
+ | <code>video0</code> | ||
+ | |||
+ | For ROC-RK3566-PC, the camera is connected to i2c-4, for ROC-RK3588S-PC to i2c-7. | ||
+ | |||
+ | ==== Application examples ==== | ||
+ | |||
+ | ===== v4l2-ctl ===== | ||
+ | |||
+ | ====== Install v4l2-utils ====== | ||
+ | <code>sudo apt-get install v4l-utils</code> | ||
+ | |||
+ | ====== List the data formats supported by the camera ====== | ||
+ | <code>v4l2-ctl --list-formats-ext</code> | ||
+ | |||
+ | ====== Snap YUV picture ====== | ||
+ | <code>v4l2-ctl --set-fmt-video=width=1920,height=1080,pixelformat='NV12' --stream-mmap --stream-count=100 --stream-to=nv12-1920x1080.yuv</code> | ||
+ | |||
+ | For RK3566, also: | ||
+ | |||
+ | <code>v4l2-ctl --set-fmt-video=width=1920,height=1080,pixelformat=UYVY --stream-mmap --stream-count=1 --stream-to=uyvy-1920x1080.yuv</code> | ||
+ | |||
+ | Play YUV picture | ||
+ | |||
+ | <code>ffplay -f rawvideo -video_size 1920x1080 -pix_fmt nv12 nv12-1920x1080.yuv</code> | ||
+ | |||
+ | ====== Check frame rate ====== | ||
+ | <code>v4l2-ctl --set-fmt-video=width=1920,height=1080,pixelformat=UYVY --stream-mmap --stream-count=-1 --stream-to=/dev/null</code> | ||
+ | |||
+ | ===== yavta ===== | ||
+ | <code>git clone <nowiki>https://github.com/veyeimaging/yavta.git</nowiki></code> | ||
+ | |||
+ | <code>cd yavta;make</code> | ||
+ | |||
+ | <code>./yavta -c1 -Fnv12-1920x1080.yuv --skip 0 -f NV12 -s 1920x1080 /dev/video0</code> | ||
+ | |||
+ | ===== gstreamer ===== | ||
+ | We provide several gstreamer routines that implement the preview, capture, and video recording functions. See the [https://github.com/veyeimaging/rk356x_firefly/tree/main/linux/samples samples] directory on github for details. | ||
+ | |||
+ | ===== Import to OpenCV ===== | ||
+ | First install OpenCV: | ||
+ | |||
+ | <code>sudo apt install python3-opencv</code> | ||
+ | |||
+ | We provide several routines to import camera data into opencv. See the [https://github.com/veyeimaging/rk356x_firefly/tree/main/linux/samples samples] directory on github for details. | ||
+ | |||
+ | In addition, this [https://wiki.t-firefly.com/en/Firefly-Linux-Guide/demo_OpenCV_support.html page] from Firefly has some reference value. | ||
+ | ==== Compile drivers and dtb from source code ==== | ||
+ | |||
+ | * RK356x | ||
+ | |||
+ | https://github.com/veyeimaging/rk35xx_firefly/tree/main/linux/drivers/rk356x | ||
+ | |||
+ | * RK358x | ||
+ | |||
+ | https://github.com/veyeimaging/rk35xx_firefly/tree/main/linux/drivers/rk358x | ||
+ | === i2c script for parameter configuration === | ||
+ | Because of the high degree of freedom of our camera parameters, we do not use V4L2 parameters to control, but use scripts to configure parameters. | ||
+ | |||
+ | https://github.com/veyeimaging/rk35xx_firefly/tree/main/i2c_cmd | ||
+ | |||
+ | using -b option to identify which bus you want to use. | ||
+ | |||
+ | *VEYE series | ||
+ | |||
+ | Video Control Toolkits Manual :[[VEYE-MIPI-290/327 i2c/|VEYE-MIPI-327 I2C]] | ||
+ | |||
+ | *CS series | ||
+ | |||
+ | Video Control Toolkits Manual :[[CS-MIPI-X i2c|CS-MIPI-X I2C]] | ||
+ | |||
+ | === Android === | ||
+ | |||
+ | ==== Update Android system ==== | ||
+ | |||
+ | * ROC-RK3566-PC | ||
+ | |||
+ | Download the latest rk356x_firefly_android.tar.gz from https://github.com/veyeimaging/rk35xx_firefly/releases/ | ||
+ | |||
+ | *ROC-RK3588S-PC | ||
+ | |||
+ | Download the latest rk358x_firefly_android.tar.gz from https://github.com/veyeimaging/rk35xx_firefly/releases/ | ||
+ | |||
+ | Burn the system refer to firefly's documentation. | ||
+ | |||
+ | ==== Check system status ==== | ||
+ | Login system via ADB, then run the following command to confirm whether the camera is probed. | ||
* VEYE-MIPI-XXX | * VEYE-MIPI-XXX | ||
Line 94: | Line 230: | ||
The camera can be seen connected to the i2c-4. | The camera can be seen connected to the i2c-4. | ||
− | === | + | ==== Application example ==== |
+ | The camera can be opened using the camera program that comes with the system. | ||
− | ==== | + | ====Compile system from source code==== |
− | + | * RK356x | |
− | + | https://github.com/veyeimaging/rk35xx_firefly/tree/main/android/rk356x/drivers | |
− | + | * RK358x | |
− | === | + | https://github.com/veyeimaging/rk35xx_firefly/tree/main/android/rk358x/drivers |
+ | |||
+ | === Known issues === | ||
− | + | # The VICAP module of RK3588 does not support outputting the UYVY format, so please use the NV12 format instead. | |
=== References === | === References === | ||
Line 113: | Line 252: | ||
https://wiki.t-firefly.com/en/ROC-RK3566-PC/ | https://wiki.t-firefly.com/en/ROC-RK3566-PC/ | ||
+ | |||
+ | *ROC-RK3588S-PC Manual | ||
+ | |||
+ | https://wiki.t-firefly.com/en/ROC-RK3588S-PC/ | ||
* Firefly Linux User Guide | * Firefly Linux User Guide | ||
Line 119: | Line 262: | ||
=== Document History === | === Document History === | ||
+ | |||
+ | * 2024-04-17 | ||
+ | |||
+ | Support kernel v5.10 on RK3566. | ||
+ | |||
+ | * 2023-05-22 | ||
+ | |||
+ | Support Fpdlink-III on ubuntu system. | ||
+ | |||
+ | *2022-12-28 | ||
+ | |||
+ | Add support for RK358x. | ||
+ | |||
+ | * 2022-12-06 | ||
+ | |||
+ | Support Android system. | ||
* 2022-10-22 | * 2022-10-22 | ||
Release 1st version. | Release 1st version. |
Latest revision as of 10:43, 17 April 2024
How to use VEYE and CS series cameras on Firefly's RK35XX board
1 Overview
VEYE series and CS series cameras are the video streaming mode MIPI cameras we designed. This article takes Firefly's ROC-RK3566-PC and ROC-RK3588S-PC board as an example to introduce how to connect VEYE and CS series cameras to RK3566/RK3568/RK3588 system.
We provide drivers for both Linux(Ubuntu) and Android.
1.1 Camera Module List
Series | Model | Status |
---|---|---|
VEYE Series | VEYE-MIPI-IMX327S | Done |
VEYE Series | VEYE-MIPI-IMX462 | Done |
VEYE Series | VEYE-MIPI-IMX385 | Done |
In addition, the driver for the Fpdlink connection mode has been finished on the Ubuntu system.
2 Hardware Setup
VEYE series and CS series cameras are provided with Raspberry Pi compatible 15Pin FFC connector. An ADP-Tfirefly adapter board is required to adapt to the ROC-RK35xx-PC board.
2.1 Connection of camera and ADP-Tfirefly
The two are connected using 1.0 mm pitch*15P FFC cable with opposite direction. The cable must be inserted with the silver contacts facing outside.
2.2 Connection of ADP-Tfirefly and Firefly Board
The two are connected using 0.5 mm pitch*30P FFC cable with same direction. The cable must be inserted with the silver contacts facing inside.
2.3 Overall connection
2.4 FPD-Link III Camera Connection Diagram
3 Introduction to github repositories
https://github.com/veyeimaging/rk35xx_firefly
includes:
- driver source code
- i2c toolkits
- application demo
In addition, a compiled linux kernel installation package and Android image is provided in the releases.
4 Ubuntu
4.1 Upgrade Firefly Ubuntu system(RK356x)
4.1.1 Overview
This section describes how to update the RK35xx system to support our camera modules.
For the kernel version 4.19, we provide a deb installation package that can be installed directly.
For the kernel version 5.10, we provide a burning image.
For versions where no installer is provided, you will need to refer to later chapters to compile from the driver source code.
Although we are now using Ubuntu system as an example to introduce, other Linux distributions can also refer to this article.
4.1.2 kernel version 5.10
For the ROC-RK3588S-PC, we have provided an image of the release system.
Download the latest released image file corresponding to the camera model you are using from https://github.com/veyeimaging/rk35xx_firefly/releases/ .
Refer to the Firefly documentation to burn in a standard system.
4.1.3 kernel version 4.19
4.1.3.1 Burn Firefly standard system
Refer to the Firefly documentation to burn in a standard system.
4.1.3.2 Using prebuilt Image and dtb file
Using the compiled debain installation package
On the RK35xx board,
Download the latest rk356x_firefly_ubuntu.tar.gz from https://github.com/veyeimaging/rk35xx_firefly/releases/ .
tar -xavf rk356x_firefly.tar.gz
cd rk356x_firefly/released_images/ROC-RK3566-PC/ubuntu/
sudo dpkg -i linux-image-4.19.232_4.19.232-21_arm64.deb
If the version does not match, it needs to be compiled from the source code.
4.2 Upgrade Firefly Ubuntu system(RK358x)
For the ROC-RK3588S-PC, we have provided an image of the release system.
Download the latest released image file corresponding to the camera model you are using from https://github.com/veyeimaging/rk35xx_firefly/releases/ .
Refer to the Firefly documentation to burn in a standard system.
4.3 Check system status
Run the following command to confirm whether the camera is probed.
- VEYE-MIPI-XXX
dmesg | grep veye
The output message appears as shown below:
veyecam2m 4-003b: camera id is veyecam2m
veyecam2m 4-003b: sensor is IMX327
- Run the following command to check the presence of video node.
ls /dev/video0
The output message appears as shown below.
video0
For ROC-RK3566-PC, the camera is connected to i2c-4, for ROC-RK3588S-PC to i2c-7.
4.4 Application examples
4.4.1 v4l2-ctl
4.4.1.1 Install v4l2-utils
sudo apt-get install v4l-utils
4.4.1.2 List the data formats supported by the camera
v4l2-ctl --list-formats-ext
4.4.1.3 Snap YUV picture
v4l2-ctl --set-fmt-video=width=1920,height=1080,pixelformat='NV12' --stream-mmap --stream-count=100 --stream-to=nv12-1920x1080.yuv
For RK3566, also:
v4l2-ctl --set-fmt-video=width=1920,height=1080,pixelformat=UYVY --stream-mmap --stream-count=1 --stream-to=uyvy-1920x1080.yuv
Play YUV picture
ffplay -f rawvideo -video_size 1920x1080 -pix_fmt nv12 nv12-1920x1080.yuv
4.4.1.4 Check frame rate
v4l2-ctl --set-fmt-video=width=1920,height=1080,pixelformat=UYVY --stream-mmap --stream-count=-1 --stream-to=/dev/null
4.4.2 yavta
git clone https://github.com/veyeimaging/yavta.git
cd yavta;make
./yavta -c1 -Fnv12-1920x1080.yuv --skip 0 -f NV12 -s 1920x1080 /dev/video0
4.4.3 gstreamer
We provide several gstreamer routines that implement the preview, capture, and video recording functions. See the samples directory on github for details.
4.4.4 Import to OpenCV
First install OpenCV:
sudo apt install python3-opencv
We provide several routines to import camera data into opencv. See the samples directory on github for details.
In addition, this page from Firefly has some reference value.
4.5 Compile drivers and dtb from source code
- RK356x
https://github.com/veyeimaging/rk35xx_firefly/tree/main/linux/drivers/rk356x
- RK358x
https://github.com/veyeimaging/rk35xx_firefly/tree/main/linux/drivers/rk358x
5 i2c script for parameter configuration
Because of the high degree of freedom of our camera parameters, we do not use V4L2 parameters to control, but use scripts to configure parameters.
https://github.com/veyeimaging/rk35xx_firefly/tree/main/i2c_cmd
using -b option to identify which bus you want to use.
- VEYE series
Video Control Toolkits Manual :VEYE-MIPI-327 I2C
- CS series
Video Control Toolkits Manual :CS-MIPI-X I2C
6 Android
6.1 Update Android system
- ROC-RK3566-PC
Download the latest rk356x_firefly_android.tar.gz from https://github.com/veyeimaging/rk35xx_firefly/releases/
- ROC-RK3588S-PC
Download the latest rk358x_firefly_android.tar.gz from https://github.com/veyeimaging/rk35xx_firefly/releases/
Burn the system refer to firefly's documentation.
6.2 Check system status
Login system via ADB, then run the following command to confirm whether the camera is probed.
- VEYE-MIPI-XXX
dmesg | grep veye
The output message appears as shown below:
veyecam2m 4-003b: camera id is veyecam2m
veyecam2m 4-003b: sensor is IMX327
- Run the following command to check the presence of video node.
ls /dev/video0
The output message appears as shown below.
video0
The camera can be seen connected to the i2c-4.
6.3 Application example
The camera can be opened using the camera program that comes with the system.
6.4 Compile system from source code
- RK356x
https://github.com/veyeimaging/rk35xx_firefly/tree/main/android/rk356x/drivers
- RK358x
https://github.com/veyeimaging/rk35xx_firefly/tree/main/android/rk358x/drivers
7 Known issues
- The VICAP module of RK3588 does not support outputting the UYVY format, so please use the NV12 format instead.
8 References
- ROC-RK3566-PC Manual
https://wiki.t-firefly.com/en/ROC-RK3566-PC/
- ROC-RK3588S-PC Manual
https://wiki.t-firefly.com/en/ROC-RK3588S-PC/
- Firefly Linux User Guide
https://wiki.t-firefly.com/en/Firefly-Linux-Guide/index.html
9 Document History
- 2024-04-17
Support kernel v5.10 on RK3566.
- 2023-05-22
Support Fpdlink-III on ubuntu system.
- 2022-12-28
Add support for RK358x.
- 2022-12-06
Support Android system.
- 2022-10-22
Release 1st version.