/
i.MX 8M Mini daA4200-30mci dart Basler camera support

i.MX 8M Mini daA4200-30mci dart Basler camera support

This document is a guideline how to get support for Basler MIP-CSI camera for the i.MX 8M Mini based congatec module #051204 SMX8-Mini/Quad-4G eMMC16 DP. The guide describes how to download and install necessary tools and drivers to Congates Linux distribution based on Yocto project.
The first section contains information how to get supporting software packages. The second section describes how to incorporate camera support to Yocto build environment. The third section provides quick user guide for Basler camera supporting software and the last section describes how to build device trees for other i.MX 8M Mini modules.

1. Basler Camera Support Download Instructions

1.1 Linux Yocto

Congatec software package supporting i.MX 8M Mini modules is based on Yocto Project Linux distribution. Available Yocto distributions are listed in the table bellow. It is recommended to download specific version of manifest.

Yocto Version

Yocto BSP guide

Recommended Manifest Tag

GIT SHA String

Yocto Version

Yocto BSP guide

Recommended Manifest Tag

GIT SHA String

Yocto 2.5 (Sumo)

i.MX 8M Mini Yocto 2.5 (Sumo)

rel_cgtsx8m_20-06-16-0

0c25c4a26150ea730a48412db0d24239c0cdf22d

Yocto 3.0 (Zeus)

i.MX 8M Mini Yocto 3.0 (Zeus)

rel_cgtsx8m_21-03-16-0

40fe41cd40b8bfda0517c692ee15c5984efd6184

Please follow instructions in Yocto BSP guide to download and install necessary tools and Yocto source tree.

1.2 Congatec MIPI-CSI Supporting Package for Basler Camera

To enable Basler camera support it is necessary to download additional Yocto meta data layers. The first layer "meta-basler-cgt" provided by Congatec contains kernel driver, kernel patches and configuration updates. Suported Yocto BSP are listed in the table bellow together with related GIT branches and commit SHA hashes.
The branch is referenced as <congatec-branch> and the SHA hash is referenced as <commit-SHA>.

Yocto Version

Congatec Banch

GIT SHA String

Yocto Version

Congatec Banch

GIT SHA String

Yocto 2.5 (Sumo)

cgtimx8mm__imx_4.14.98_2.0.0_ga

1cbd6cef4d9a73a476868ff5613dce205d7fddf7

Yocto 3.0 (Zeus)

cgtimx8mm__imx_5.4.47_2.2.0

eb7e5728a06c7231ea2f9f5ffb1febe25f306bcd

The directory containing downloaded Yocto project source is referenced as ~/<yocto-dir>

Meta data source tree that collect all recipes needed to build final image is located in subdirectory: ~/<yocto-dir>/sources. Balser camera supporting yocto meta data layers must be stored in this directory.

This is an example how to add meta-basler-cgt layer to Yocto:

For latest version of meta-basler-cgt:

$ cd ~/<yocto-dir>/sources $ git clone <https://git.congatec.com/arm-nxp/imx8-family/yocto/meta-basler-cgt> $ cd meta-basler-cgt $ git checkout --track origin/<congatec-branch>

And for partikular version, additoinally this command:

$ git checkout <commit-SHA>

1.3 Basler Camera Supporting Package

Basler camera utilities - can be downloaded from Basler web pages. The name of supporting software package is Camera Enablement Package for NXP®s i.MX8 applications processor series and approppriate links are in the table bellow.
Note: To download Basler utilities it is necessary to register on Basler website and accept license terms.

Yocto Version

Basler Download Link

Yocto Version

Basler Download Link

Yocto 2.5 (Sumo)

Basler package v.1.4.0

Yocto 3.0 (Zeus)

Basler package v.1.6.0

Store the Basler supporting in <yocto-dir>/sources directory and unpack it.
Note: supposing that package format is tar gzip

$ cd <yocto-dir>/sources $ tar -xzf <package-name>.tar.gz

2. Build Instructions

2.1 Configuration of the Build Directory and Environment

Downloaded Yocto source contains ....-setup-release.sh script (depending on Yocto version). This script prepares and configures build environment.
To make build process easier Congatec Basler Camera supporting package contains updated version setup script that is located in ~/<yocto-dir>/sources/meta-basler-cgt. The name of this script depends on Yocto version (listed in the table bellow).

Yocto Version

Env. Setup Script Name

Yocto Version

Env. Setup Script Name

Yocto 2.5 (Sumo)

fsl-setup-release.sh

Yocto 3.0 (Zeus)

imx-setup-release.sh

Update link to ....-setup-release.sh :

An example for Yocto 3.0:

Now it is possible to setup environment:

The script takes three inputs in this example - machine the build is being made for (variable MACHINE), distribution to use (variable DISTRO) and name of the build directory (the -b parameter).

2.1 Image Build

To build the image launch the Bitbake tool with name of image. Only supported image for Congates Basler demo is cgt-image-validation-imx-basler

The build process takes several hours depending on the build hardware.

2.2 Images

After the bitbake finishes, the following files can be found in the ~/<yocto-dir>/<build-dir>/tmp/deploy/images/imx8mm-cgt-sx8m-basler/ subdirectory of the build folder. The name of final SD card image differs in each Yocto version:

Yocto Version

SD Card Image Name

Yocto Version

SD Card Image Name

Yocto 2.5 (Sumo)

<bitbake image name>-<Machine Identification>.sdcard.bz2

Yocto 3.0 (Zeus)

<bitbake image name>-<Machine Identification>.wic.bz2

3. Quick User Guide

Congatec Yocto BSP Linux boots (in default configuration) graphical environment - Weston. Basler demo build contains additionally a launcher icon for Basler Pylon demo application. The icon for Pylon application is visible on the top left corner just beside launcher for Weston terminal. To launch the Pylon application click once to the camera icon.

After a while the screen of Pylon application is opened. Pylon applicaton start with greeting window that contains useful notes about application and updates. Close this window to continue.

Select your camera in the list on the top left listing window and click to red power button on top left side - follow arrows.

Setup of camera hardware takes several seconds. After camera is activated, camera control menu is unshaded. Click to the button with camera symbol. The output of the camera will be showed on right window.

4. Adjustments

To provide support for other Congatec i.MX 8M Mini modules it is necessary to change device kernel tree configuration.
Kernel sources can be found inside Yocto build tree at location:
~/<yocto-dir>/<build-dir>/tmp/work/imx8mm_cgt_basler-poky-linux/linux-congatec/<kernel-version>/git
To build device tree for the kernel it is necessary to install device tree compiler.

Device tree structure depends on Yocto version. Next sections describes how to adjust and compile device tree for supported Yocto.
Compiled device tree file basler-demo.dtb need to be coppied to SD card "boot" partition.
U-boot needs to be reconfigured for new DTB. To do that interrupt boot sequence inside ubuoot. Then update kernel DTB setting. The guide how to work with U-boot bootloader is at: i.MX 8M Mini Bootloader

4.1 DTB for Yocto 2.5 (Sumo)

The location of kernel source code is: ~/<yocto-dir>/<build-dir>/tmp/work/imx8mm_cgt_basler-poky-linux/linux-congatec/4.14.98-r0/git

Congatec provides several predefined device trees for diferrent display configuration:

DTB file name

Description

DTB file name

Description

imx8mm-cgtsx8m.dts

General DTB included by all particular device tree files

 

 

imx8mm-cgtsx8m-640x480.dts

LVDS 640x480, spwg data map, rgb24 color depth

imx8mm-cgtsx8m-800x600.dts

LVDS 800x600, spwg data map, rgb24 color depth

imx8mm-cgtsx8m-1024x768.dts

LVDS 1024x768, spwg data map, rgb24 color depth

imx8mm-cgtsx8m-1280x720_default.dts

LVDS 1280x720, spwg data map, rgb24 color depth

imx8mm-cgtsx8m-1280x1024_experimental.dts

LVDS 1280x1024, spwg data map, rgb24 color depth, timing not guaranted

imx8mm-cgtsx8m-1280x1024_G170EG01.dts

LVDS 1280x1024, AUO G170EG01

imx8mm-cgtsx8m-1440x900_experimental.dts

LVDS 1440x900, spwg data map, rgb24 color depth, timing not guaranted

 

 

imx8mm-cgtsx8m-800x600_DP.dts

Display Port 800x600 fixed resolution

imx8mm-cgtsx8m-1280x720_DP_default.dts

Display Port 1280x720 fixed resolution

imx8mm-cgtsx8m-1680x1050_DP.dts

Display Port 1680x1050 fixed resolution

 

 

imx8mm-cgtsx8m-basler-camera-csi1-4ch.dts

Camera connected to CS1 - 4 channels (adjusted board *), Display Port, Resolution - Autodetection

imx8mm-cgtsx8m-basler-camera-csi0-2ch.dts

Camera on CS0 - 2 channels (default), Display Port, Resolution - Autodetection

To change dtb it is good practice to start with existing file - imx8mm-cgtsx8m-basler-camera-csi0-2ch.dts which contains a configuration for Basler camera. Copy this file to the same directory with diferrent name - referrenced as <DT-file-name>.dts.

Edit arch/arm64/boot/dts/congatec/<DT-file-name>.dts:
Remove or update display configuration node:

DTS file with removed display configuration part uses U-boot to configure display type and resolution. Display type is selected according to i.MX 8M Mini board version, resolution is set to default and could be updated manualy. Refer to the guide:
conga-SMX8-Mini Video Output.

Then compile device tree source and save the resulting DTB file to SD card boot partition. Finaly update fdt_file variable in U-boot shell.

4.2 DTB for Yocto 3.0 (Zeus)

Kernel sources can be found inside Yocto build tree at location:
~/<yocto-dir>/<build-dir>/tmp/work/imx8mm_cgt_basler-poky-linux/linux-congatec/linux-congatec-sx8m_5.4_r0/git
<br>
Congatec provides several predefined device trees for diferrent display configuration:

DTB file name

Description

DTB file name

Description

imx8mm-cgtsx8m.dts

General DTB included by all particular device tree files

 

 

imx8mm-cgtsx8m-800x600.dts

LVDS 800x600, spgw data map, rgb24 color depth

imx8mm-cgtsx8m-1024x768-JEIDA.dts

LVDS 1024x768, jeida data map, rgb24 color depth

imx8mm-cgtsx8m-1920x1080-2ch.dts

2 channels LVDS Full HD, spwg data map, rgb24 color depth

imx8mm-cgtsx8m-dp-1280x1024.dts

Display Port 128x1024, fixed resolution

imx8mm-cgtsx8m-dp.dts

Display Port, Autodetection

 

 

imx8mm-cgtsx8m-basler-csi0-2ch.dts

Camera on CSI0 - 2 channels, based on Display Port with autodetection

To change dtb it is good practice to start with existing file - imx8mm-cgtsx8m-basler-camera-csi0-2ch.dts which contains a configuration for Basler camera. Copy this file to the same directory with diferrent name - referrenced as <DT-file-name>.dts.

Edit arch/arm64/boot/dts/congatec/<DT-file-name>.dts:
To use one of pre-defined display configuration change include directive at the top of <DT-file-name.>dts file to one of predefined dts files. If Generad DTB is included, resolution is set by U-boot using autodetection or manual setting. You can also add a section with custom resolution definition to this file and include General DTB. Refer to the guide:
conga-SMX8-Mini Video Output.

Example of custom definition:

Then compile device tree source and save the resulting DTB file to SD card boot partition. Finaly update fdt_file variable in U-boot shell.