Changes

Jump to navigation Jump to search
Line 19: Line 19:  
|VEYE series
 
|VEYE series
 
|VEYE-MIPI-IMX385
 
|VEYE-MIPI-IMX385
|Processing
+
|Done
 
|ADP-TWG
 
|ADP-TWG
 
|-
 
|-
Line 43: Line 43:  
=== Upgrade Mendel Linux system ===
 
=== Upgrade Mendel Linux system ===
   −
==== overview ====
+
==== Overview ====
<br />
+
This section describes how to update the Coral dev board 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(in deb format), 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
 +
 
 +
=====google Coral Dev board bsp=====
 +
https://github.com/veyeimaging/google_coral_i.mx
 +
 
 +
includes:
 +
 
 +
*prebuild linux kernel and dtb:linux-image-4.14.98-imx_12-2_arm64.deb
 +
*dts source code
 +
*defconfig and rules file for build system
 +
 
 +
==== Flash the Coral standard system ====
 +
Refer to:
 +
 
 +
https://coral.ai/docs/dev-board/get-started/#flash-the-board
 +
 
 +
Flash the standard system provided by google to the board.
 +
 
 +
==== Install MDT and connect the board via MDT ====
 +
Refer to:
 +
 
 +
https://coral.ai/docs/dev-board/get-started/#install-mdt
 +
 
 +
https://coral.ai/docs/dev-board/get-started/#connect-via-mdt
 +
 
 +
==== Using prebuilt Image and dtb file (deb file) ====
 +
On HOST PC:
 +
 
 +
<code>git clone <nowiki>https://github.com/veyeimaging/google_coral_i.mx.git</nowiki></code>
 +
 
 +
* list device
 +
 
 +
<code>mdt devices</code>
 +
 
 +
one coral board appears like this:
 +
 
 +
<code>deft-kid                (192.168.0.122)</code>
 +
 
 +
* push deb file to coral board
 +
 
 +
<code>cd google_coral_i.mx/linux-image-deb/</code>
 +
 
 +
<code>mdt push linux-image-4.14.98-imx_12-2_arm64.deb</code>
 +
 
 +
* Log in Coral board via mdt
 +
 
 +
<code>mdt shell</code>
 +
 
 +
* Install deb file
 +
 
 +
<code>sudo dpkg -i linux-image-4.14.98-imx_12-2_arm64.deb</code>
 +
 
 +
Pay attention to the log information, it can be installed correctly normally.
 +
 
 +
* Overwrite the dtb file
 +
 
 +
In coral board shell,
 +
 
 +
<code>cd /boot/</code>
 +
 
 +
<code>sudo cp fsl-imx8mq-phanbell-<camera_name>.dtb fsl-imx8mq-phanbell.dtb</code>
 +
 
 +
camera_name could be veye327,csimx307,cssc132.
 +
 
 +
* Reboot coral dev board
 +
 
 
=== Applications and Test ===
 
=== Applications and Test ===
 +
The following commands are all executed on coral board.
 +
 +
==== 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 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  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 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</code>
 +
 +
or:
 +
 +
<code>v4l2-ctl --list-devices</code>
 +
 +
You should see the camera listed as <code>/dev/video0:</code>
 +
 +
<code>i.MX6S_CSI (platform:30a90000.csi1_bridge):</code>
 +
 +
<code>/dev/video0</code>
 +
 +
The camera use i2c-1.
 +
====List the modes supported by the camera====
 +
<code>v4l2-ctl --list-formats-ext -d /dev/video0</code>
 +
 +
==== Gstreamer usage examples ====
    +
===== Install gstreamer tools =====
 +
<code>sudo apt-get update</code>
 +
 +
<code>sudo apt-get install gstreamer1.0-tools gstreamer1.0-alsa gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav</code>
 +
 +
If you have built the entire mendel tree, there is another way:
 +
 +
On Host PC:
 +
 +
<code>source build/setup.sh</code>
 +
 +
<code>j product</code>
 +
 +
<code>cd packages/bsp/</code>
 +
 +
<code>mdt install ./gstreamer1.0-tools_1.14.4+imx-3_arm64.deb</code>
 +
 +
===== Gstreamer test =====
 +
<code>export DISPLAY=:0</code>
 +
 +
* Preview (VEYE-MIPI-IMX327S,CS-MIPI-IMX307 @1080p mode)
 +
 +
<code>gst-launch-1.0 v4l2src device=/dev/video0 io-mode=0 ! video/x-raw,width=1920,height=1080 ! glimagesink</code>
 +
 +
* Preview  example 2 (VEYE-MIPI-IMX327S,CS-MIPI-IMX307 @1080p mode)
 +
 +
<code>gst-launch-1.0 v4l2src device=/dev/video0 io-mode=0 ! video/x-raw,width=1920,height=1080 ! fpsdisplaysink videosink=glimagesink sync=false text-overlay=false -v</code>
 +
 +
*Preview example 3(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 io-mode=0 ! video/x-raw,width=1280,height=720,framerate=60/1 ! fpsdisplaysink videosink=glimagesink sync=false text-overlay=false -v</code>
 +
 +
* Preview (CS-MIPI-SC132 @1280*1080 mode 45fps)
 +
 +
<code>gst-launch-1.0 v4l2src device=/dev/video0 io-mode=0 ! video/x-raw,width=1280,height=1080,framerate=45/1 ! fpsdisplaysink videosink=glimagesink sync=false text-overlay=false -v</code>
 +
 +
* Preview (CS-MIPI-SC132 @1080*1280 mode 45fps)
 +
 +
<code>gst-launch-1.0 v4l2src device=/dev/video0 io-mode=0 ! video/x-raw,width=1280,height=1080,framerate=45/1 ! fpsdisplaysink videosink=glimagesink sync=false text-overlay=false -v</code>
 +
 +
* Snap a jpeg picture (CS-MIPI-IMX307 @1080p mode)<br /><code>gst-launch-1.0 v4l2src device=/dev/video0 io-mode=2 num-buffers=1 ! video/x-raw,width=1920,height=1080 ! jpegenc ! filesink location=frame_captured_1920x1080.jpg</code>
 +
 +
On host pc, you can use this cmd to pull the file to host:
 +
 +
<code>mdt pull frame_captured_1920x1080.jpg .</code>
 +
 +
* Snap 3 raw yuv picture (CS-MIPI-IMX307 @1080p mode)
 +
 +
<code>gst-launch-1.0 v4l2src device=/dev/video0 io-mode=2 num-buffers=3 ! video/x-raw,width=1920,height=1080 ! multifilesink location=frames_captured_1920x1080_YUYV_%d.raw</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. (The i2c bus is 1 on coral dev board.)
 +
 +
*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 ===
 
=== Build the drivers from source ===
 +
The following operations are done on Ubuntu Host PC.
 +
 +
==== Set up the Host PC environment ====
 +
Refer to this page to set up the development environment:https://coral.googlesource.com/docs/+/refs/heads/master/GettingStarted.md.
 +
 +
==== Build google standard  version kernel ====
 +
Complete the Build the tree steps according to the guide above.
 +
 +
==== 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'', replace the source code of the camera driver in the corresponding directory. The kernel version is 4.14.98 now.
 +
 +
Merge the Config and Makefile  in the same path. Add the corresponding camera driver.
 +
 +
*dts file and pakages build config file
 +
 +
<code>git clone <nowiki>https://github.com/veyeimaging/google_coral_i.mx.git</nowiki></code>
 +
 +
The path of 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.
 +
 +
The path of packages build is :''packages/linux-imx/debian/,''places the ''defconfig'' and ''rules'' in this path''.''
 +
 +
==== Build ====
 +
<code>m docker-linux-imx</code>
 +
 +
==== Install the new kernel ====
 +
<code>j product</code>
 +
 +
<code>cd packages/bsp/</code>
 +
 +
<code>mdt install ./linux-image-4.14.98-imx_12-2_arm64.deb</code>
    
=== References ===
 
=== References ===

Navigation menu