Difference between revisions of "VEYE CS Camera on AVNET Maaxboard"
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[VEYE CS Camera on AVNET Maaxboard/zh|查看中文]] | [[VEYE CS Camera on AVNET Maaxboard/zh|查看中文]] | ||
− | <br /> | + | The MIPI-CSI2 interface of Maaxboard is the same as that of Raspberry pi. VEYE-MIPI-327S, CS-MIPI-IMX307, CS-MIPI-SC132 can be directly connected to use without using the adapter board. |
+ | |||
+ | On the basis of Maaxboard official SDK, our camera module driver is added, and some application layer routines are provided. | ||
+ | |||
+ | In general, you only need to use the Image and dtb that we have compiled. Of course, you can also modify or recompile the driver according to our open source code. | ||
+ | ====Camera module list==== | ||
+ | {| class="wikitable" | ||
+ | |+Camera module dirver status list | ||
+ | !Series | ||
+ | !Model | ||
+ | !Status | ||
+ | |- | ||
+ | |VEYE series | ||
+ | |VEYE-MIPI-IMX327S | ||
+ | |Done | ||
+ | |- | ||
+ | |VEYE series | ||
+ | |VEYE-MIPI-IMX385 | ||
+ | |Done | ||
+ | |- | ||
+ | |VEYE series | ||
+ | |VEYE-MIPI-IMX462 | ||
+ | |Done | ||
+ | |- | ||
+ | |CS series | ||
+ | |CS-MIPI-IMX307 | ||
+ | |Done | ||
+ | |- | ||
+ | |CS series | ||
+ | |CS-MIPI-SC132 | ||
+ | |Done | ||
+ | |}VEYE and CS series camera modules are camera module with ISP functions build in. It output UYVY/YUYV data using MIPI-CSI2. We provide '''V4L2 interface''' for video streaming apps , and '''Video Control Toolkits (which is Shell Script)''' to control the camera module directly, which is called DRA(Directly Register Access). | ||
+ | |||
+ | Specifically, on this i.MX platform, the default driver configures the camera to YUYV format. | ||
+ | |||
+ | === Hardware Setup === | ||
+ | [[File:MaaxBoard连接整体图.jpg|alt=Maaxboard connection overview|center|thumb|800x800px|Maaxboard connection overview]] | ||
+ | [[File:MaaxBoard connection details.jpg|alt=MaaxBoard connection details|center|thumb|800x800px|MaaxBoard connection details]] | ||
+ | |||
+ | === Upgrade Maaxboard system === | ||
+ | |||
+ | ==== Overview ==== | ||
+ | This section describes how to update the Maaxboard system to support our camera module. To support our camera module, we need to update two parts of the system, '''Image''' and '''DTB'''. | ||
+ | |||
+ | In the Image, we added the camera driver, while the DTB indicates the camera model used. In general, you only need to use the Image and DTB, that we have prebuilt, and you don't need to build from source when it is not necessary. | ||
+ | |||
+ | ====BSP package introduction==== | ||
+ | =====i.MX platform bsp===== | ||
+ | https://github.com/veyeimaging/nxp_i.mx_veye_bsp | ||
+ | |||
+ | includes: | ||
+ | |||
+ | *driver source code | ||
+ | *i2c toolkits | ||
+ | *application demo | ||
+ | |||
+ | =====Maaxboard i.MX platform bsp===== | ||
+ | https://github.com/veyeimaging/avnet_maaxboard | ||
+ | |||
+ | includes: | ||
+ | |||
+ | *prebuild linux kernel:Image | ||
+ | *prebuild dtb for different boards | ||
+ | *dts source code | ||
+ | |||
+ | ==== Burn the Maaxboard standard system ==== | ||
+ | Maaxboard supports Linux Debain, Linux Yocto, and Android systems. Under the Linux system, Image and dtb are the same, we use the Debain system as an example. | ||
+ | |||
+ | Refer to the ''MaaXBoard-Linux-Debian-UserManual-V1.3-EN.pdf'' or ''MaaXBoard_Mini-Linux-Debian-UserManual-V1.1-CN.pdf'' documentation and burn the standard system. | ||
+ | |||
+ | ==== Using prebuilt Image and dtb file ==== | ||
+ | The Image and dtb files of the Maaxboard board are saved in the FAT partition of TF card. After the system is started, it is automatically mounted to the ''/boot/'' directory. | ||
+ | |||
+ | On HOST PC: | ||
+ | |||
+ | <code>git clone <nowiki>https://github.com/veyeimaging/avnet_maaxboard.git</nowiki></code> | ||
+ | |||
+ | Extract kernel Image, and put Image and em-sbc-imx8m- [camname] .dtb into the FAT partition of the TF card. | ||
+ | |||
+ | Modify the value of fdt_file in the uEnv.txt file to specify the camera model. | ||
+ | |||
+ | Then insert the TF card into the Maaxboard board and power it up again. | ||
+ | |||
+ | ===Applications and Test=== | ||
+ | ====Check system status==== | ||
+ | Run the following command to confirm whether the camera is probed. | ||
+ | |||
+ | *VEYE-MIPI-IMX327S | ||
+ | |||
+ | <code>dmesg | grep veye327</code> | ||
+ | |||
+ | The output message appears as shown below: | ||
+ | |||
+ | <code>camera veye327_mipi is found</code> | ||
+ | |||
+ | <code>Registered sensor subdevice: veye327_mipi 0-003b</code> | ||
+ | |||
+ | *CS-MIPI-IMX307 | ||
+ | |||
+ | <code>dmesg | grep csimx307</code> | ||
+ | |||
+ | The output message appears as shown below: | ||
+ | |||
+ | <code>camera csimx307_mipi is found</code> | ||
+ | |||
+ | <code>Registered sensor subdevice: csimx307_mipi 0-003b</code> | ||
+ | |||
+ | *CS-MIPI-SC132 | ||
+ | |||
+ | <code>dmesg | grep cssc132</code> | ||
+ | |||
+ | The output message appears as shown below: | ||
+ | |||
+ | <code>camera cssc132_mipi is found</code> | ||
+ | |||
+ | <code>Registered sensor subdevice: cssc132_mipi 0-003b</code> | ||
+ | |||
+ | *Run the following command to check the presence of video node. | ||
+ | |||
+ | <code>ls /dev/video*</code> | ||
+ | |||
+ | The output message appears as shown below. | ||
+ | |||
+ | <code>video0</code> | ||
+ | |||
+ | The cameras of the MIPI-CSI2 interface is identified and mounted to i2-0. | ||
+ | ====List the modes supported by the camera==== | ||
+ | <code>v4l2-ctl --list-formats-ext -d /dev/video<0/1></code> | ||
+ | ====Video Stream test==== | ||
+ | <code>export DISPLAY=:0</code> | ||
+ | |||
+ | *Preview (VEYE-MIPI-IMX327S,CS-MIPI-IMX307 @1080p mode) | ||
+ | |||
+ | <code>gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=1920,height=1080,framerate=(fraction)30/1' ! waylandsink</code> | ||
+ | |||
+ | * Frame rate display VEYE-MIPI-IMX327S,CS-MIPI-IMX307 @1080p mode) | ||
+ | |||
+ | <code>gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=1920,height=1080,framerate=(fraction)30/1' ! fpsdisplaysink video-sink=fakesink -v</code> | ||
+ | |||
+ | *Preview (CS-MIPI-IMX307 @1080p mode 10fps) | ||
+ | |||
+ | <code>gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=1920,height=1080,framerate=(fraction)10/1' ! waylandsink</code> | ||
+ | |||
+ | *Preview (CS-MIPI-IMX307 @720p mode 60fps) | ||
+ | |||
+ | <code>gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=1280,height=720,framerate=(fraction)60/1' ! waylandsink</code> | ||
+ | |||
+ | *Preview (CS-MIPI-SC132 @1280*1080 mode 45fps) | ||
+ | |||
+ | <code>gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=1280,height=1080,framerate=(fraction)45/1' ! waylandsink</code> | ||
+ | |||
+ | *Preview (CS-MIPI-SC132 @1080*1280 mode 45fps) | ||
+ | |||
+ | <code>gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=1080,height=1280,framerate=(fraction)45/1' ! waylandsink</code> | ||
+ | |||
+ | *Snap a picture (VEYE-MIPI-327S,CS-MIPI-IMX307 @1080p mode) | ||
+ | |||
+ | <code>gst-launch-1.0 v4l2src num-buffers=1 device=/dev/video0 ! 'video/x-raw, width=1920,height=1080' ! jpegenc ! filesink location=test_image.jpg</code> | ||
+ | |||
+ | *Snap a picture (CS-MIPI-IMX307 @720p mode) | ||
+ | |||
+ | <code>gst-launch-1.0 v4l2src num-buffers=1 device=/dev/video0 ! 'video/x-raw, width=1280,height=720' ! jpegenc ! filesink location=720p.jpg</code> | ||
+ | |||
+ | *Snap a picture (CS-MIPI-SC132 @1280*1080 mode) | ||
+ | |||
+ | <code>gst-launch-1.0 v4l2src num-buffers=1 device=/dev/video0 ! 'video/x-raw, width=1280,height=1080' ! jpegenc ! filesink location=test_image.jpg</code> | ||
+ | |||
+ | *v4l2grab snap a picture(VEYE-MIPI-327S,CS-MIPI-IMX307 @1080p mode) | ||
+ | |||
+ | <code>./v4l2grab -d /dev/video0 -W 1920 -H 1080 -I 30 -o picture.jpg</code> | ||
+ | ====Video Control Toolkits Manual==== | ||
+ | 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/nxp_i.mx_veye_bsp/tree/main/i2c_cmd | ||
+ | |||
+ | using -b option to identify which bus you want to use. | ||
+ | |||
+ | *VEYE series | ||
+ | |||
+ | Video Control Toolkits Manual :[http://wiki.veye.cc/index.php/VEYE-MIPI-290/327_i2c/ VEYE-MIPI-327 I2C] | ||
+ | |||
+ | *CS series | ||
+ | |||
+ | Video Control Toolkits Manual :[http://wiki.veye.cc/index.php/CS-MIPI-X_i2c CS-MIPI-X I2C] | ||
+ | ===Build the drivers from source=== | ||
+ | The following operations are done on ubuntu Host PC. | ||
+ | |||
+ | ==== Compile the standard version ==== | ||
+ | Refer to the official document ''MaaXBoard-Linux-Development_Guide-V1.1-EN.pdf''. | ||
+ | |||
+ | ===== Set up the Host PC environment ===== | ||
+ | <code>export PATH=$PATH:[REPLACE with your path]/toolchain/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/</code> | ||
+ | |||
+ | <code>export CC=aarch64-linux-gnu-gcc</code> | ||
+ | |||
+ | <code>export CROSS_COMPILE=aarch64-linux-gnu-</code> | ||
+ | |||
+ | <code>export ARCH=arm64</code> | ||
+ | |||
+ | *Maaxboard | ||
+ | |||
+ | <code>make bcm2711_defconfig</code> | ||
+ | |||
+ | <code>make -j4</code> | ||
+ | |||
+ | ==== patch code ==== | ||
+ | |||
+ | *Driver source code | ||
+ | |||
+ | <code>git clone <nowiki>https://github.com/veyeimaging/nxp_i.mx_veye_bsp.git</nowiki></code> | ||
+ | |||
+ | The source code path of the camera driver is: ''linux/drivers/media/platform/mxc/capture'', places the source code of the camera driver in the corresponding directory. | ||
+ | |||
+ | *Modify the the Makefile and Kconfig files | ||
+ | |||
+ | Modify the Config and Makefile in the same path. Add the corresponding camera driver. | ||
+ | |||
+ | * dts file | ||
+ | |||
+ | <code>git clone <nowiki>https://github.com/veyeimaging/avnet_maaxboard.git</nowiki></code> | ||
+ | |||
+ | The path to the dts file is: ''linux/arch/arm64/boot/dts/freescale'', places the dts file in this path. | ||
+ | |||
+ | Modify the Config and Makefile in the same path. Add the corresponding dts option. | ||
+ | ====Add compilation options==== | ||
+ | <code>make menuconfig</code> | ||
+ | |||
+ | Add the compilation options for the corresponding camera module driver, and the path is ''Device Drivers > Multimedia support > V4L platform devices > MXC Camera/V4L2 PRP Features support''. | ||
+ | ====Build==== | ||
+ | <code>make Image dtbs -j4</code> | ||
+ | ===References=== | ||
+ | Maaxboard embest-tech official site :https://www.avnet.com/wps/portal/us/products/new-product-introductions/npi/avnet-maaxboard/ | ||
+ | |||
+ | Maaxboard :http://Avnet.com/MAAXBOARD<br /> |
Latest revision as of 09:21, 28 September 2021
The MIPI-CSI2 interface of Maaxboard is the same as that of Raspberry pi. VEYE-MIPI-327S, CS-MIPI-IMX307, CS-MIPI-SC132 can be directly connected to use without using the adapter board.
On the basis of Maaxboard official SDK, our camera module driver is added, and some application layer routines are provided.
In general, you only need to use the Image and dtb that we have compiled. Of course, you can also modify or recompile the driver according to our open source code.
1 Camera module list
Series | Model | Status |
---|---|---|
VEYE series | VEYE-MIPI-IMX327S | Done |
VEYE series | VEYE-MIPI-IMX385 | Done |
VEYE series | VEYE-MIPI-IMX462 | Done |
CS series | CS-MIPI-IMX307 | Done |
CS series | CS-MIPI-SC132 | Done |
VEYE and CS series camera modules are camera module with ISP functions build in. It output UYVY/YUYV data using MIPI-CSI2. We provide V4L2 interface for video streaming apps , and Video Control Toolkits (which is Shell Script) to control the camera module directly, which is called DRA(Directly Register Access).
Specifically, on this i.MX platform, the default driver configures the camera to YUYV format.
2 Hardware Setup
3 Upgrade Maaxboard system
3.1 Overview
This section describes how to update the Maaxboard system to support our camera module. To support our camera module, we need to update two parts of the system, Image and DTB.
In the Image, we added the camera driver, while the DTB indicates the camera model used. In general, you only need to use the Image and DTB, that we have prebuilt, and you don't need to build from source when it is not necessary.
3.2 BSP package introduction
3.2.1 i.MX platform bsp
https://github.com/veyeimaging/nxp_i.mx_veye_bsp
includes:
- driver source code
- i2c toolkits
- application demo
3.2.2 Maaxboard i.MX platform bsp
https://github.com/veyeimaging/avnet_maaxboard
includes:
- prebuild linux kernel:Image
- prebuild dtb for different boards
- dts source code
3.3 Burn the Maaxboard standard system
Maaxboard supports Linux Debain, Linux Yocto, and Android systems. Under the Linux system, Image and dtb are the same, we use the Debain system as an example.
Refer to the MaaXBoard-Linux-Debian-UserManual-V1.3-EN.pdf or MaaXBoard_Mini-Linux-Debian-UserManual-V1.1-CN.pdf documentation and burn the standard system.
3.4 Using prebuilt Image and dtb file
The Image and dtb files of the Maaxboard board are saved in the FAT partition of TF card. After the system is started, it is automatically mounted to the /boot/ directory.
On HOST PC:
git clone https://github.com/veyeimaging/avnet_maaxboard.git
Extract kernel Image, and put Image and em-sbc-imx8m- [camname] .dtb into the FAT partition of the TF card.
Modify the value of fdt_file in the uEnv.txt file to specify the camera model.
Then insert the TF card into the Maaxboard board and power it up again.
4 Applications and Test
4.1 Check system status
Run the following command to confirm whether the camera is probed.
- VEYE-MIPI-IMX327S
dmesg | grep veye327
The output message appears as shown below:
camera veye327_mipi is found
Registered sensor subdevice: veye327_mipi 0-003b
- CS-MIPI-IMX307
dmesg | grep csimx307
The output message appears as shown below:
camera csimx307_mipi is found
Registered sensor subdevice: csimx307_mipi 0-003b
- CS-MIPI-SC132
dmesg | grep cssc132
The output message appears as shown below:
camera cssc132_mipi is found
Registered sensor subdevice: cssc132_mipi 0-003b
- Run the following command to check the presence of video node.
ls /dev/video*
The output message appears as shown below.
video0
The cameras of the MIPI-CSI2 interface is identified and mounted to i2-0.
4.2 List the modes supported by the camera
v4l2-ctl --list-formats-ext -d /dev/video<0/1>
4.3 Video Stream test
export DISPLAY=:0
- Preview (VEYE-MIPI-IMX327S,CS-MIPI-IMX307 @1080p mode)
gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=1920,height=1080,framerate=(fraction)30/1' ! waylandsink
- Frame rate display VEYE-MIPI-IMX327S,CS-MIPI-IMX307 @1080p mode)
gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=1920,height=1080,framerate=(fraction)30/1' ! fpsdisplaysink video-sink=fakesink -v
- Preview (CS-MIPI-IMX307 @1080p mode 10fps)
gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=1920,height=1080,framerate=(fraction)10/1' ! waylandsink
- Preview (CS-MIPI-IMX307 @720p mode 60fps)
gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=1280,height=720,framerate=(fraction)60/1' ! waylandsink
- Preview (CS-MIPI-SC132 @1280*1080 mode 45fps)
gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=1280,height=1080,framerate=(fraction)45/1' ! waylandsink
- Preview (CS-MIPI-SC132 @1080*1280 mode 45fps)
gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=1080,height=1280,framerate=(fraction)45/1' ! waylandsink
- Snap a picture (VEYE-MIPI-327S,CS-MIPI-IMX307 @1080p mode)
gst-launch-1.0 v4l2src num-buffers=1 device=/dev/video0 ! 'video/x-raw, width=1920,height=1080' ! jpegenc ! filesink location=test_image.jpg
- Snap a picture (CS-MIPI-IMX307 @720p mode)
gst-launch-1.0 v4l2src num-buffers=1 device=/dev/video0 ! 'video/x-raw, width=1280,height=720' ! jpegenc ! filesink location=720p.jpg
- Snap a picture (CS-MIPI-SC132 @1280*1080 mode)
gst-launch-1.0 v4l2src num-buffers=1 device=/dev/video0 ! 'video/x-raw, width=1280,height=1080' ! jpegenc ! filesink location=test_image.jpg
- v4l2grab snap a picture(VEYE-MIPI-327S,CS-MIPI-IMX307 @1080p mode)
./v4l2grab -d /dev/video0 -W 1920 -H 1080 -I 30 -o picture.jpg
4.4 Video Control Toolkits Manual
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/nxp_i.mx_veye_bsp/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
5 Build the drivers from source
The following operations are done on ubuntu Host PC.
5.1 Compile the standard version
Refer to the official document MaaXBoard-Linux-Development_Guide-V1.1-EN.pdf.
5.1.1 Set up the Host PC environment
export PATH=$PATH:[REPLACE with your path]/toolchain/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/
export CC=aarch64-linux-gnu-gcc
export CROSS_COMPILE=aarch64-linux-gnu-
export ARCH=arm64
- Maaxboard
make bcm2711_defconfig
make -j4
5.2 patch code
- Driver source code
git clone https://github.com/veyeimaging/nxp_i.mx_veye_bsp.git
The source code path of the camera driver is: linux/drivers/media/platform/mxc/capture, places the source code of the camera driver in the corresponding directory.
- Modify the the Makefile and Kconfig files
Modify the Config and Makefile in the same path. Add the corresponding camera driver.
- dts file
git clone https://github.com/veyeimaging/avnet_maaxboard.git
The path to the dts file is: linux/arch/arm64/boot/dts/freescale, places the dts file in this path.
Modify the Config and Makefile in the same path. Add the corresponding dts option.
5.3 Add compilation options
make menuconfig
Add the compilation options for the corresponding camera module driver, and the path is Device Drivers > Multimedia support > V4L platform devices > MXC Camera/V4L2 PRP Features support.
5.4 Build
make Image dtbs -j4
6 References
Maaxboard embest-tech official site :https://www.avnet.com/wps/portal/us/products/new-product-introductions/npi/avnet-maaxboard/
Maaxboard :http://Avnet.com/MAAXBOARD