Changes

Jump to navigation Jump to search
Line 44: Line 44:     
==== Overview ====
 
==== 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'''.
+
This section describes how to update the OKMX8MPQ-C 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.
 
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.
   −
This chapter describes the released files, which were compiled based on the image of OKMX8MP-C_Linux5.4.70+Qt5.15.0 version.
+
The released files were compiled based on the image of OKMX8MP-C_Linux5.4.70+Qt5.15.0 version.
<br />
+
 
 +
==== BSP package introduction ====
 +
 
 +
===== i.MX platform bsp =====
 +
<nowiki>https://github.com/veyeimaging/nxp_i.mx_veye_bsp</nowiki>
 +
 
 +
includes:
 +
 
 +
* driver source code
 +
* i2c toolkits
 +
* application demo
 +
 
 +
===== Folinx i.MX platform bsp =====
 +
https://github.com/veyeimaging/forlinx_nxp_i.mx
 +
 
 +
includes:
 +
 
 +
* prebuild linux kernel:Image
 +
* prebuild dtb for different boards
 +
* dts source code
 +
 
 +
==== Burn the Forlinx standard system ====
 +
Refer to : ''OKMX8MPQ-C_Linux5.4.70+Qt5.15.0Manual_V1.2_20230406.pdf''
 +
 
 +
Burn the standard system provided by Forlinx to the board.
 +
 
 +
==== Using prebuilt Image and dtb file ====
 +
The Image and dtb files of the OKMX8MPQ-C board are saved in the FAT partition of emmc. After the system is started, it is automatically mounted to the ''/run/media/mmcblk2p1/'' directory.
 +
 
 +
On HOST PC:
 +
 
 +
<code>git clone <nowiki>https://github.com/veyeimaging/forlinx_nxp_i.mx.git</nowiki></code>
 +
 
 +
Extract the kernel Image, and copy the Image and dtb files to the OKMX8MPQ-C board.
 +
 
 +
<code>cp <your path>/Image /run/media/mmcblk2p1/</code>
 +
 
 +
<code>cp <your path>/OK8MP-C.dtb /run/media/mmcblk2p1/</code>
 +
 
 +
Reboot OKMX8MPQ-C board.
 +
 
 +
=== Applications and Test ===
 +
 
 +
==== Check system status ====
 +
Run the following command to confirm whether the camera is probed.
 +
 
 +
* VEYE-MIPI-IMX327S,VEYE-MIPI-IMX462,VEYE-MIPI-IMX385
 +
 
 +
<code>dmesg | grep veye</code>  
 +
 
 +
The output message appears as shown below:
 +
 
 +
<code>[    2.806555] veyecam2m 1-003b:  camera id is veyecam2m</code>
 +
 
 +
<code>[    2.816868] veyecam2m 1-003b: sensor is IMX327</code>
 +
 
 +
<code>[    2.821323] veyecam2m 1-003b: board type is ONE board</code>
 +
 
 +
<code>[    2.826981] veyecam2m 1-003b: veyecam2m camera probed</code>
 +
 
 +
<code>[    6.055710] mx8-img-md: Registered sensor subdevice: veyecam2m 1-003b (1)</code>
 +
 
 +
<code>[    6.150181] mx8-img-md: created link [veyecam2m 1-003b] => [mxc-mipi-csi2.1]</code>
 +
 
 +
It can be seen that the VEYE-MIPI-IMX327S camera has been identified on i2c-1.
 +
 
 +
Once the camera is correctly recognized, a device node named /dev/video0 will be generated.
 +
 
 +
* List the formats supported by the camera
 +
 
 +
<code>v4l2-ctl --list-formats-ext -d /dev/video0</code>
 +
 
 +
<code>ioctl: VIDIOC_ENUM_FMT</code>
 +
 
 +
<code>        Type: Video Capture Multiplanar</code>
 +
 
 +
<code>        [0]: 'RGBP' (16-bit RGB 5-6-5)</code>
 +
 
 +
<code>                Size: Discrete 1920x1080</code>
 +
 
 +
<code>        [1]: 'RGB3' (24-bit RGB 8-8-8)</code>
 +
 
 +
<code>                Size: Discrete 1920x1080</code>
 +
 
 +
<code>        [2]: 'BGR3' (24-bit BGR 8-8-8)</code>
 +
 
 +
<code>                Size: Discrete 1920x1080</code>
 +
 
 +
<code>        [3]: 'YUYV' (YUYV 4:2:2)</code>
 +
 
 +
<code>                Size: Discrete 1920x1080</code>
 +
 
 +
<code>        [4]: 'YUV4' (32-bit A/XYUV 8-8-8-8)</code>
 +
 
 +
<code>                Size: Discrete 1920x1080</code>
 +
 
 +
<code>        [5]: 'NV12' (Y/CbCr 4:2:0)</code>
 +
 
 +
<code>                Size: Discrete 1920x1080</code>
 +
 
 +
<code>        [6]: 'YM24' (Planar YUV 4:4:4 (N-C))</code>
 +
 
 +
<code>                Size: Discrete 1920x1080</code>
 +
 
 +
<code>        [7]: 'XR24' (32-bit BGRX 8-8-8-8)</code>
 +
 
 +
<code>                Size: Discrete 1920x1080</code>
 +
 
 +
<code>        [8]: 'AR24' (32-bit BGRA 8-8-8-8)</code>
 +
 
 +
<code>                Size: Discrete 1920x1080</code>
 +
 
 +
In fact, the camera only provides UYVY data format, and the ISI module in i.MX 8M Plus provides data format conversion function, so /dev/video0 has so many output formats.
 +
 
 +
=== Video Stream test ===
 +
 
 +
==== Preview (VEYE-MIPI-CAM@1080p mode) ====
 +
<code>gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw, format=NV12, width=1920, height=1080,framerate=30/1 ! autovideosink -v</code>
 +
 
 +
or
 +
 
 +
<code>gst-launch-1.0 v4l2src device=/dev/video0 io-mode=4 ! video/x-raw, format=NV12, width=1920, height=1080,framerate=30/1 ! imxvideoconvert_g2d ! queue ! video/x-raw, format=RGB16, width=1920, height=1080 ! waylandsink</code>
 +
====Snap a picture (VEYE-MIPI-CAM@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>
 +
 
 +
==== v4l2grab snap a picture(VEYE-MIPI-CAM@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, please use -b 1 for OKMX8MPQ-C.
 +
 
 +
*VEYE series
 +
 
 +
Video Control Toolkits Manual :[http://wiki.veye.cc/index.php/VEYE-MIPI-290/327_i2c/ VEYE-MIPI-327 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 ''OKMX8MPQ-C_Linux5.4.70+Qt5.15.0_manual_V1.2_20230406.pdf''  to deploy the development environment.
 +
 
 +
==== Build Forlinx version kernel ====
 +
Compile the standard version according to the above document.
 +
 
 +
====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/i2c'', 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/forlinx_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 > I2C Encoders, decoders, sensors and other helper chips'' .
 +
====Build====
 +
Refer to the official documentation and compile to obtain Image and dtb output.

Navigation menu