Note |
---|
Important Note The documented BSP is a preliminary version with restrictions and can change at any time. |
This document is a guideline how to get support for Basler daA3840-30mc MIPI-CSI camera for the i.MX 8M Plus based congatec modules #051320/1/2 SMX8P. The guide describes how to download and install necessary tools and drivers to Congatec 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 Basler camera modules.
1. Basler Camera Support Download Instructions
1.1 Linux Yocto
Congatec software package supporting i.MX 8M Plus modules is based on Yocto Project Linux distribution. Manifest file to dedicated Yocto distributions are listed in the table bellow. It is recommended to download specific version of manifest.
Yocto Version | Yocto BSP guide | Repo Manifest File | Recommended Manifest Tag | GIT SHA String | Notes |
---|---|---|---|---|---|
Yocto 3.0 (Zeus) | cgtimx8mp-basler__imx-5.4.70-2.3.0.xml | N/A | 99f02100c3af09f238f22b2fb3520a10816d6c89 | SX8P & QX8P X | |
Yocto 3.0 (Zeus) | cgtqx8p-basler__imx-5.4.70-2.3.2__ea.xml | N/A | cbe243556714a0847798831d7e008a16345a7771 | QX8P A |
The repo tool dowloads all files into the working directory, so it is a good idea to create a dedicated directory for the purpose, e.g.
Code Block | ||
---|---|---|
| ||
$ mkdir ~/yocto
$ cd ~/yocto |
To download Basler enabled Congatec Yocto distribution use latest repo tools:
Code Block | ||
---|---|---|
| ||
$ repo init -u git@git.congatec.com:arm-nxp/imx8-family-ea/imx8m/manifest-imx8m-ea \
-b cgtimx8mp__imx-linux-zeus \
-m <Repo Manifest File>
$ repo syncgit log |
Please follow instructions in paragraph 2 and Yocto BSP guide for additional detail (link is in the table above).
1.2 Basler Camera Supporting Package
Basler camera utilities and supporting libraries - can be downloaded from Basler web pages. The name of supporting software package is Camera Enablement Package for NXP®s i.MX 8M Plus Applications Processor | GA 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 | Notes |
---|---|---|
Yocto 3.0 (Zeus) | SX8P & QX8P X | |
Yocto 3.0 (Zeus) | QX8P A |
Store the Basler supporting in <yocto-dir>/sources
directory and unpack it.
Note: supposing that package format is tar gzip
Code Block | ||
---|---|---|
| ||
$ 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 3.0 (Zeus) | cgt-imx-setup-release.sh |
Update link to ....-setup-release.sh :
To setup environment use these commands:
Code Block | ||
---|---|---|
| ||
$ cd <yocto-dir>
$ MACHINE='<Machine Identification>' DISTRO=fsl-imx-xwayland source <env-setup-script-name> -b <build-dir>
[ ! ] EULA accept needed for next step. |
Module | Machine Identification |
---|---|
conga-SMX8-Plus | imx8mp-cgt-sx8p-basler |
conga-QMX8-Plus | imx8mp-cgtqx8p-basler |
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.2 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
Code Block | ||
---|---|---|
| ||
$ bitbake fsl-image-validation-imx |
The build process takes several hours depending on the build hardware.
Some hosting operating system could have a problem to build this image - see Yocto BSP guide for details.
2.3 Images
After the bitbake finishes, the following files can be found in the ~/<yocto-dir>/<build-dir>/tmp/deploy/images/<Machine Identification>/
subdirectory of the build folder. The name of final SD card image differs in each Yocto version:
Yocto Version | SD Card Image Name |
---|---|
Yocto 3.0 (Zeus) |
|
3. Quick User Guide
Basler daA3840-30mc MIPI-CSI camera can be used with Gstreamer linux tool or Basler Pylon gui
###LIMITATION on SX8P:
current basler camera driver supports only MIPI CSI0 port on SoC, which is routed to X58 connector on SMC carrier board.
(X58 is usually referenced as CSI1, which could lead to confusion)
Bring up steps:
connect camera to SMC X58 connector
boot the system
after system is online the camera is ready to use
command to use camera with gst-launch:
Code Block | ||
---|---|---|
| ||
$gst-launch-1.0 -v v4l2src device=/dev/video0 ! waylandsink |
or you can use Basler Pylon software:
Code Block | ||
---|---|---|
| ||
export WAYLAND_DISPLAY=wayland-0
export DISPLAY=:0
GENICAM_GENTL64_PATH=/opt/dart-bcon-mipi/lib /opt/pylon6/bin/pylonviewer |
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.
Current image contains several dtb configuration files:
DTB file name | Description |
---|---|
imx8mp-cgtsx8p-basler_vvcam_csi0.dtb | [DEFAULT] DTB with Basler daA3840-30mc camera on CSI0 support |
imx8mp-cgtsx8p-basler_cam_csi0.dtb | DTB with Basler daAXXXX-XXmci camera on CSI0 support |
imx8mp-cgtsx8p-basler_cam_csi1.dtb | DTB with Basler daAXXXX-XXmci camera on CSI1 support |
imx8mp-cgtsx8p.dtb | DTB without Basler camera support |
imx8mp-cgtqx8p-basler-csi0.dtb | DTB with Basler daAXXXX-XXmci camera on CSI0 support |
imx8mp-cgtqx8p-basler-csi1.dtb | DTB with Basler daAXXXX-XXmci camera on CSI1 support |
It is possible to change dtb in uboot section by the command:
Code Block | ||
---|---|---|
| ||
u-boot$ env set fdt_file <name of fdt file> |
It is possible to build own DTB. 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.
Code Block | ||
---|---|---|
| ||
sudo apt-get 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
Code Block | ||
---|---|---|
| ||
$ env set fdt_file basler-demo.dtb
$ saveenv
$ boot |
4.1 DTB for Yocto 3.0 (Zeus)
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
To change dtb source file [*.dts] it is good to start with some existing file e.g.- imx8mp-cgtsx8p.dts
. Copy this file to the same directory with diferrent name - referrenced as <DT-file-name>.dts
.
Code Block | ||
---|---|---|
| ||
cd ~/<yocto-dir>/<build-dir>/tmp/work/imx8mp_cgt_sx8p-poky-linux/linux-congatec-sx8p/5.4-r0/git
cp arch/arm64/boot/dts/congatec/imx8mp-cgtsx8p.dts arch/arm64/boot/dts/congatec/<DT-file-name>.dts |
Edit arch/arm64/boot/dts/congatec/<DT-file-name>.dts
:
Add Basler camera configuration at the end of DTS file:
(This is an example for Basler camera daA3840-30mc connected to CSI0 port of SoC (X58 on SMC board which is marked as CSI1)
Code Block |
---|
&i2c3 {
status = "okay";
/delete-node/ov5640_mipi@3c;
basler_camera_vvcam@36 {
compatible = "basler,basler-camera-vvcam", "basler-camera-vvcam";
reg = <0x36>;
csi_id = <0x00>;
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
basler_ep_0: endpoint {
data-lanes = <1 2 3 4>;
clock-lanes = <0>;
link-frequencies = /bits/ 64 <248000000>;
remote-endpoint = <&mipi_csi0_ep>;
};
};
};
};
&mipi_csi_1 {
status = "disabled";
/delete-node/port@1;
/delete-node/port@0;
};
&mipi_csi_0 {
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
/delete-node/port@1;
/delete-node/port@0;
port@0 {
reg = <0>;
mipi_csi0_ep: endpoint {
remote-endpoint = <&basler_ep_0>;
data-lanes = <4>;
csis-hs-settle = <16>;
};
};
};
&gpio1 {
camera-power {
gpio-hog;
gpios = <14 0>;
output-low;
line-name = "camera-power-gpio";
};
};
&gpio4 {
camera-rst {
gpio-hog;
gpios = <2 0>;
output-low;
line-name = "camera-reset-gpio";
};
};
&cameradev {
status = "okay";
};
&isi_0 {
status = "disabled";
};
&isi_1 {
status = "disabled";
};
&isp_0 {
status = "okay";
};
&isp_1 {
status = "disabled";
};
&dewarp_0 {
status = "okay";
id = <0>;
};
&dewarp_1 {
status = "disabled"
};
|
There is another example for Basler Camera module that is equiped with internal ISP (inside camera) like daA4200-30mci. This type do not use ISP integrated on imx8mp SoC an it needs to download ISP firmware to camera.
Due this fact this camera can be used only with attached PylonWiever software from Basler.
Code Block |
---|
&i2c3 {
status = "okay";
/delete-node/ov5640_mipi@3c;
basler_camera@36 {
compatible = "basler,basler-camera", "basler-camera";
reg = <0x36>;
csi_id = <0x00>;
status = "okay";
port@0 {
basler_ep_0: endpoint {
data-lanes = <1 2 3 4>;
clock-lanes = <0>;
link-frequencies = /bits/ 64 <248000000>;
remote-endpoint = <&mipi_csi0_ep>;
};
};
};
};
&mipi_csi_1 {
status = "disabled";
/delete-node/port@1;
/delete-node/port@0;
};
&mipi_csi_0 {
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
/delete-node/port@0;
/delete-node/port@1;
port@0 {
reg = <0>; /* need to bind camera to CSI */
mipi_csi0_ep: endpoint {
remote-endpoint = <&basler_ep_0>;
data-lanes = <4>;
csis-hs-settle = <16>;
// csis-clk-settle = <4>;
};
};
};
&gpio1 {
camera-power {
gpio-hog;
gpios = <14 0>;
output-low;
line-name = "camera-power-gpio";
};
};
&gpio4 {
camera-rst {
gpio-hog;
gpios = <2 0>;
output-low;
line-name = "camera-reset-gpio";
};
};
&cameradev {
status = "okay";
};
&isi_0 {
status = "okay";
fsl,chain_buf;
};
&isi_1 {
status = "disabled";
};
&isp_0 {
status = "disabled";
};
&isp_1 {
status = "disabled";
};
&dewarp_0 {
status = "disabled";
};
&dewarp_1 {
status = "disabled";
};
|
Then compile device tree source and save the resulting DTB file to SD card boot partition. Finaly update fdt_file
variable to basler-demo.dtb in U-boot shell.
Code Block | ||
---|---|---|
| ||
cpp -nostdinc -I include -undef -x assembler-with-cpp arch/arm64/boot/dts/congatec/<DT-file-name> > temporary.dts
dtc -O dtb -o basler-demo.dtb -I dts temporary.dts |