In this article, I will explain how to set up the iMX8M Plus to use the 4K Dart BCON Basler Camera module.
Requirements:
Basler Camera Specifications and Manuals:
Steps
After setting up the hardware we will need to turn on the iMX8M Plus and follow these steps:
1. Stop the boot process on Uboot by pressing any key.
2. Use the following command to list interfaces.
=> mmc list
Output example
=> FSL_SDHC: 1 (SD)
=> FSL_SDHC: 2
The above command will show you the device number in this example for SD, the device number is 1.
3. Then use fatls <interface> <device[:partition]> [<directory>]
fatls mmc 1:1
(Device 1 : Partition 1)
With this command, we will be able to list device tree files.
=> fatls mmc 1:1
4. Select imx8mp-evk-basler.dtb or imx8mp-evk-dual-basler.dtb and use the command editenv fdtfile.
=> editenv fdtfile
Output example
edit: imx8mp-evk-basler.dtb
5. In edit command line put the selected device tree (*.dtb).
6. Use saveenv command to save environment and continue with the boot process.
7. Using the terminal and go to /opt/imx8-isp/bin and execute the script run.sh.
$ ./run.sh -c basler_1080p60 -lm
8. Use the command gst-device-monitor-1.0 to list devices. Here you will find the path to the camera device.
$ gst-device-monitor-1.0
Output example
Device found:
name : VIV
class : Video/Source
caps : video/x-raw, format=YUY2, width=[ 176, 4096, 16 ], height=[ 144, 3072, 8 ], pixel-aspect-ratio=1/1, framerate={ (fraction)30/1, (fraction)29/1, (fraction)28/1, (fraction)27/1, (fraction)26/1, (fraction)25/1, (fraction)24/1, (fraction)23/1, (fraction)22/1, (fraction)21/1, (fraction)20/1, (fraction)19/1, (fraction)18/1, (fraction)17/1, (fraction)16/1, (fraction)15/1, (fraction)14/1, (fraction)13/1, (fraction)12/1, (fraction)11/1, (fraction)10/1, (fraction)9/1, (fraction)8/1, (fraction)7/1, (fraction)6/1, (fraction)5/1, (fraction)4/1, (fraction)3/1, (fraction)2/1, (fraction)1/1 } ...
properties:
udev-probed = true
device.bus_path = platform-vvcam-video.0
sysfs.path = /sys/devices/platform/vvcam-video.0/video4linux/video2
device.subsystem = video4linux
device.product.name = VIV
device.capabilities = :capture:
device.api = v4l2
device.path = /dev/video2
v4l2.device.driver = viv_v4l2_device
v4l2.device.card = VIV
v4l2.device.bus_info = platform:viv0
v4l2.device.version = 393473 (0x00060101)
v4l2.device.capabilities = 2216693761 (0x84201001)
v4l2.device.device_caps = 69206017 (0x04200001)
gst-launch-1.0 v4l2src device=/dev/video2 ! ...
9. Finally, use gstreamer to verify proper operation. (With this gstreamer pipeline you will see a new window with the camera output. Then, just rotate the lens to acquire the correct focus)
$ gst-launch-1.0 -v v4l2src device=/dev/video2 ! "video/x-raw,format=YUY2,width=1920,height=1080" ! queue ! imxvideoconvert_g2d ! waylandsink
Basic description of Gstreamer Pipeline
gst-launch-1.0 -v: The option -v enables the verbose mode to get detailed information of process.
v4l2src device=/dev/video2: Select input device in this case the camera is on path /dev/video3.
"video/x-raw,format=YUY2,width=1920,height=1080": Received format from camera.
queue: This command is a buffer between camera recording process and the following image process, this command help us to interface two process and prevent blocking where each process has different speeds, in other words, when a process A is faster than process B.
imxvideoconvert_g2d: This proprietary plugin uses hardware acceleration to perform rotation, scaling, and color space conversion on video frames.
waylandsink : This command creates its own window and renders the decoded frames processed previously.
10. Result
I hope this article will be helpful.
Best regards, Brian.