Difference between revisions of "VEYE CS Camera on MYIR i.MX8 board"
(Created page with " <br />") |
|||
(15 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | [[VEYE CS Camera on MYIR i.MX8 board/zh|查看中文]] | ||
+ | === Overview === | ||
+ | MYD-JX8MX development board from MYIR Technology uses i.MX8M processor, MYD-C8MMX uses i.MX8M Mini processor. | ||
+ | On the basis of MYIR's official SDK(L4.19.35 version), 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 | ||
+ | !Adaptor board | ||
+ | |- | ||
+ | |VEYE series | ||
+ | |VEYE-MIPI-IMX327S | ||
+ | |Done | ||
+ | |ADP-MYiR | ||
+ | |- | ||
+ | |VEYE series | ||
+ | |VEYE-MIPI-IMX385 | ||
+ | |Done | ||
+ | |ADP-MYiR | ||
+ | |- | ||
+ | |VEYE series | ||
+ | |VEYE-MIPI-IMX462 | ||
+ | |Done | ||
+ | |ADP-MYiR | ||
+ | |- | ||
+ | |CS series | ||
+ | |CS-MIPI-IMX307 | ||
+ | |Done | ||
+ | |ADP-MYiR | ||
+ | |- | ||
+ | |CS series | ||
+ | |CS-MIPI-SC132 | ||
+ | |Done | ||
+ | |ADP-MYiR | ||
+ | |} | ||
+ | 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 === | ||
+ | We use [[ADP-MYiR Adapter Board for MYiR-tech|ADP-MYiR]] to connnect MYD-J8XMX board. | ||
+ | [[File:MYiR-MYD-J8XMX connection .jpg|alt=MYiR-MYD-J8XMX connection overview|center|thumb|800x800px|MYiR-MYD-J8XMX connection overview]] | ||
+ | [[File:MYiR MYD-JX8MX connection details.jpg|alt=MYiR MYD-JX8MX connection details|center|thumb|800x800px|MYiR MYD-JX8MX connection details]] | ||
+ | <br /> | ||
+ | |||
+ | === Upgrade MYD-JX8MX system === | ||
+ | |||
+ | ==== Overview ==== | ||
+ | This section describes how to update the MYD-JX8MX 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 | ||
+ | |||
+ | ===== MYiR i.MX platform bsp ===== | ||
+ | https://github.com/veyeimaging/myir_nxp_i.mx | ||
+ | |||
+ | includes: | ||
+ | |||
+ | * prebuild linux kernel:Image | ||
+ | *prebuild dtb for different boards | ||
+ | * dts source code | ||
+ | |||
+ | ==== Burn the MYIR standard system ==== | ||
+ | Refer to : ''MYD-JX8MX-Software-Manual-zh-V1.3.pdf'' | ||
+ | |||
+ | Burn the standard system provided by MYIR to the board. | ||
+ | |||
+ | ==== Using prebuilt Image and dtb file ==== | ||
+ | The Image and dtb files of the MYD-JX8MX board are saved in the FAT partition of emmc. After the system is started, it is automatically mounted to the ''/run/media/mmcblk0p1/'' directory. | ||
+ | |||
+ | On HOST PC: | ||
+ | |||
+ | <code>git clone <nowiki>https://github.com/veyeimaging/myir_nxp_i.mx.git</nowiki></code> | ||
+ | |||
+ | Extract the kernel Image, and copy the Image and dtb files to the MYD-JX8MX board. | ||
+ | |||
+ | <code>cp <your path>/Image /run/media/mmcblk0p1/</code> | ||
+ | |||
+ | <code>cp <your path>/myb-fsl-imx8mq-evk-veye327.dtb /run/media/mmcblk0p1/myb-fsl-imx8mq-evk.dtb</code> | ||
+ | |||
+ | Reboot MYD-JX8MX board. | ||
+ | |||
+ | === 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/1>-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/1>-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/1>-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 or video1</code> | ||
+ | |||
+ | The cameras of the two MIPI-CSI2 interfaces are identified and mounted to i2-0 and i2c-1 respectively. | ||
+ | |||
+ | ==== 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> | ||
+ | |||
+ | *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> | ||
+ | |||
+ | ==== I2C 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-290/327 i2c/|VEYE-MIPI-327 I2C]] | ||
+ | |||
+ | * CS series | ||
+ | |||
+ | Video Control Toolkits Manual :[[CS-MIPI-X i2c|CS-MIPI-X I2C]] | ||
+ | |||
+ | === Build the drivers from source === | ||
+ | The following operations are done on Ubuntu Host PC. | ||
+ | |||
+ | ==== Set up the Host PC environment ==== | ||
+ | Refer to the official document ''MYD-JX8MX-Software-Manual-zh-V1.3.pdf'' to deploy the development environment. | ||
+ | |||
+ | Note that you don't have to use yocto if you only want to compile kernel, Of course, there is no problem with using yocto. | ||
+ | |||
+ | ===== Cross-compiling Toolchain ===== | ||
+ | There is a compiler tool chain installation script in the ''03-Tools'' directory, which can be executed directly. | ||
+ | |||
+ | <code>./fsl-imx-xwayland-glibc-x86_64-meta-toolchain-aarch64-toolchain-4.19-warrior.sh</code> | ||
+ | |||
+ | After installing the compilation tool chain, execute the following command to configure the compilation environment: | ||
+ | |||
+ | <code>source /opt/fsl-imx-xwayland/4.19-warrior/environment-setup-aarch64-poky-linux</code> | ||
+ | |||
+ | ==== Build MYIR version kernel ==== | ||
+ | Copy the officially provided fsl-release-yocto.tar.gz to the development host and extract it. | ||
+ | |||
+ | The source code for linux is already available in the ''fsl-release-yocto/linux-imx'' directory. | ||
+ | |||
+ | <code>cd fsl-release-yocto/linux-imx</code> | ||
+ | |||
+ | <code>make ARCH=arm64 CROSS_COMPILE=aarch64-poky-linux- defconfig</code> | ||
+ | |||
+ | <code>make ARCH=arm64 CROSS_COMPILE=aarch64-poky-linux- -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. | ||
+ | |||
+ | Merge the Config and Makefile in the same path. Add the corresponding camera driver. | ||
+ | |||
+ | *dts file | ||
+ | |||
+ | <code>git clone <nowiki>https://github.com/veyeimaging/myir_nxp_i.mx.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 === | ||
+ | MYIR official site:http://www.myir-tech.com/ | ||
+ | |||
+ | MYD-JX8MX : http://down.myir-tech.com/MYD-JX8MX/ | ||
<br /> | <br /> |
Latest revision as of 11:17, 24 August 2021
1 Overview
MYD-JX8MX development board from MYIR Technology uses i.MX8M processor, MYD-C8MMX uses i.MX8M Mini processor.
On the basis of MYIR's official SDK(L4.19.35 version), 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.1 Camera module list
Series | Model | Status | Adaptor board |
---|---|---|---|
VEYE series | VEYE-MIPI-IMX327S | Done | ADP-MYiR |
VEYE series | VEYE-MIPI-IMX385 | Done | ADP-MYiR |
VEYE series | VEYE-MIPI-IMX462 | Done | ADP-MYiR |
CS series | CS-MIPI-IMX307 | Done | ADP-MYiR |
CS series | CS-MIPI-SC132 | Done | ADP-MYiR |
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
We use ADP-MYiR to connnect MYD-J8XMX board.
3 Upgrade MYD-JX8MX system
3.1 Overview
This section describes how to update the MYD-JX8MX 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 MYiR i.MX platform bsp
https://github.com/veyeimaging/myir_nxp_i.mx
includes:
- prebuild linux kernel:Image
- prebuild dtb for different boards
- dts source code
3.3 Burn the MYIR standard system
Refer to : MYD-JX8MX-Software-Manual-zh-V1.3.pdf
Burn the standard system provided by MYIR to the board.
3.4 Using prebuilt Image and dtb file
The Image and dtb files of the MYD-JX8MX board are saved in the FAT partition of emmc. After the system is started, it is automatically mounted to the /run/media/mmcblk0p1/ directory.
On HOST PC:
git clone https://github.com/veyeimaging/myir_nxp_i.mx.git
Extract the kernel Image, and copy the Image and dtb files to the MYD-JX8MX board.
cp <your path>/Image /run/media/mmcblk0p1/
cp <your path>/myb-fsl-imx8mq-evk-veye327.dtb /run/media/mmcblk0p1/myb-fsl-imx8mq-evk.dtb
Reboot MYD-JX8MX board.
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/1>-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/1>-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/1>-003b
- Run the following command to check the presence of video node.
ls /dev/video*
The output message appears as shown below.
video0 or video1
The cameras of the two MIPI-CSI2 interfaces are identified and mounted to i2-0 and i2c-1 respectively.
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
- 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 I2C 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 Set up the Host PC environment
Refer to the official document MYD-JX8MX-Software-Manual-zh-V1.3.pdf to deploy the development environment.
Note that you don't have to use yocto if you only want to compile kernel, Of course, there is no problem with using yocto.
5.1.1 Cross-compiling Toolchain
There is a compiler tool chain installation script in the 03-Tools directory, which can be executed directly.
./fsl-imx-xwayland-glibc-x86_64-meta-toolchain-aarch64-toolchain-4.19-warrior.sh
After installing the compilation tool chain, execute the following command to configure the compilation environment:
source /opt/fsl-imx-xwayland/4.19-warrior/environment-setup-aarch64-poky-linux
5.2 Build MYIR version kernel
Copy the officially provided fsl-release-yocto.tar.gz to the development host and extract it.
The source code for linux is already available in the fsl-release-yocto/linux-imx directory.
cd fsl-release-yocto/linux-imx
make ARCH=arm64 CROSS_COMPILE=aarch64-poky-linux- defconfig
make ARCH=arm64 CROSS_COMPILE=aarch64-poky-linux- -j4
5.3 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.
Merge the Config and Makefile in the same path. Add the corresponding camera driver.
- dts file
git clone https://github.com/veyeimaging/myir_nxp_i.mx.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.4 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.5 Build
make Image dtbs -j4
6 References
MYIR official site:http://www.myir-tech.com/
MYD-JX8MX : http://down.myir-tech.com/MYD-JX8MX/