VEYE CS Camera on AVNET Maaxboard

From wiki_veye
Jump to navigation Jump to search

查看中文

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

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.

2 Hardware Setup

 
Maaxboard connection overview
 
MaaxBoard connection details

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