MX8 Basler Camera: Difference between revisions

From Variscite Wiki
No edit summary
No edit summary
(41 intermediate revisions by 4 users not shown)
Line 3: Line 3:
--> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{#lst:B2QT_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{#lst:B2QT_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{PageHeader|{{#var:HARDWARE_NAME}} Basler Camera}} {{DocImage|category1=Yocto|category2={{#var:HARDWARE_NAME}}}} __toc__
--> {{PageHeader|{{#var:HARDWARE_NAME}} Basler Camera using CEP}} {{DocImage|category1=Yocto|category2={{#var:HARDWARE_NAME}}}} __toc__


= Introduction =
= Introduction =


The following instructions will allow you to add support for the Basler MIPI camera to your Yocto images.<br>
The following instructions will allow you to add CEP (Camera Enablement Package) support for the Basler MIPI camera to your Yocto images.<br>
This will allow you to stream images/video from a Basler camera(s) connected to a Variscite evaluation kit.<br>
This will allow you to stream images/video from a Basler camera(s) connected to a Variscite evaluation kit.<br>
== Available Basler cameras ==
* [https://www.variscite.com/product/accessories/vcam-ar1335b-i-mx8-camera-board/ VCAM-AR1335B] (daA4200-30mci): supported
* [https://www.variscite.com/product/accessories/vcam-ar0821b-camera-board/ VCAM-AR0821B] (daA3840-mc): {{#ifeq: {{#var:META_BASLER_SUPPORT_AR0821}} | | '''not''' }} supported


= Download Variscite Yocto BSP =  
= Download Variscite Yocto BSP =  
Line 15: Line 20:
Execute steps 1-4.3 to download the BSP sources, but don't start bitbake yet.
Execute steps 1-4.3 to download the BSP sources, but don't start bitbake yet.


{{#ifeq: {{#var:HARDWARE_NAME}} | DART-MX8M-PLUS |
= Download and install Basler meta layers =  
= Download and install Basler meta layers =  
{{#ifeq: {{#var:FSL_BSP_VERSION}}|L5.4.70_2.3.0|
{{#if: {{#var:META_BASLER_BRANCH}}|
  $ git clone https://github.com/varigit/meta-basler-imx8 -b 1.2.0.12-imx8mp-5.4.70-2.3.0 ../sources/meta-basler-imx8
  $ git clone https://github.com/varigit/meta-basler-imx8 -b {{#var:META_BASLER_BRANCH}} ../sources/meta-basler-imx8
  $ git clone https://github.com/varigit/meta-basler-tools -b 1.2.0.12-imx8mp-5.4.70-2.3.0 ../sources/meta-basler-tools
  $ git clone https://github.com/varigit/meta-basler-tools -b {{#var:META_BASLER_BRANCH}} ../sources/meta-basler-tools
|
  }}<!--
  $ git clone https://github.com/varigit/meta-basler-imx8 -b 1.3.1.9-imx8mp-5.4.70-2.3.2 ../sources/meta-basler-imx8
  -->{{#ifeq: {{#var:YOCTO_NAME}} | Sumo |
  $ git clone https://github.com/varigit/meta-basler-tools -b 1.3.1.9-imx8mp-5.4.70-2.3.2 ../sources/meta-basler-tools
}}
|
{{#ifeq: {{#var:YOCTO_NAME}} | Sumo |
= Download and install Basler meta layers =
 
  $ wget ftp://customerv:Variscite1@ftp.variscite.com/Basler/Software/basler-dart-bcon-mipi-imx8-cep_1.5.0-for-imx-4.14.98-2.0.0_ga_sumo.tar.gz
  $ wget ftp://customerv:Variscite1@ftp.variscite.com/Basler/Software/basler-dart-bcon-mipi-imx8-cep_1.5.0-for-imx-4.14.98-2.0.0_ga_sumo.tar.gz
  $ mkdir basler-dart-bcon-mipi-imx8-cep_1.5.0-for-imx-4.14.98-2.0.0_ga_sumo
  $ mkdir basler-dart-bcon-mipi-imx8-cep_1.5.0-for-imx-4.14.98-2.0.0_ga_sumo
  $ tar xf basler-dart-bcon-mipi-imx8-cep_1.5.0-for-imx-4.14.98-2.0.0_ga_sumo.tar.gz -C basler-dart-bcon-mipi-imx8-cep_1.5.0-for-imx-4.14.98-2.0.0_ga_sumo
  $ tar xf basler-dart-bcon-mipi-imx8-cep_1.5.0-for-imx-4.14.98-2.0.0_ga_sumo.tar.gz -C basler-dart-bcon-mipi-imx8-cep_1.5.0-for-imx-4.14.98-2.0.0_ga_sumo
  $ mv basler-dart-bcon-mipi-imx8-cep_1.5.0-for-imx-4.14.98-2.0.0_ga_sumo/meta-basler* ../sources
  $ mv basler-dart-bcon-mipi-imx8-cep_1.5.0-for-imx-4.14.98-2.0.0_ga_sumo/meta-basler* ../sources
= Download and install Variscite kernel patches =
  $ wget ftp://customerv:Variscite1@ftp.variscite.com/Basler/Software/sumo-fsl-4.14.98-cep-1.5.0/meta-variscite-imx-basler.tar.gz
  $ wget ftp://customerv:Variscite1@ftp.variscite.com/Basler/Software/sumo-fsl-4.14.98-cep-1.5.0/meta-variscite-imx-basler.tar.gz
  $ tar xf meta-variscite-imx-basler.tar.gz -C ../sources/
  $ tar xf meta-variscite-imx-basler.tar.gz -C ../sources/
| {{#ifeq: {{#var:YOCTO_NAME}} | Dunfell |
}}
= Download and install Basler meta layers =


$ git clone https://github.com/varigit/meta-basler-imx8 -b 1.6.0-imx8m-5.4-2.1.x ../sources/meta-basler-imx8
$ git clone https://github.com/varigit/meta-basler-tools -b 1.6.0-imx8m-5.4-2.1.x ../sources/meta-basler-tools
}}}}}}
{{#ifeq: {{#var:HARDWARE_NAME}} | DART-MX8M-PLUS |
= Customize configuration files =
= Customize configuration files =


== Customize bblayers.conf ==
== Customize bblayers.conf ==
Add the following lines to conf/bblayers.conf under your Yocto build directory:
Add the following lines to conf/bblayers.conf under your Yocto build directory:
<pre>
BBLAYERS += " ${BSPDIR}/sources/meta-basler-imx8 "
BBLAYERS += " ${BSPDIR}/sources/meta-basler-imx8 "
BBLAYERS += " ${BSPDIR}/sources/meta-basler-tools/meta-basler-common "<!--
BBLAYERS += " ${BSPDIR}/sources/meta-basler-tools/meta-basler-common "
-->{{#ifeq: {{#var:YOCTO_NAME}} | Sumo |<br>BBLAYERS += " ${BSPDIR}/sources/meta-variscite-imx-basler "}}
</pre>
 
== Customize local.conf ==
Add the following to conf/local.conf under your Yocto build directory:<br>
<br>
Add Basler software and driver:
{{#ifeq: {{#var:FSL_BSP_VERSION}}|L5.4.70_2.3.0|
<pre>
IMAGE_INSTALL_append = " \
        basler-camera-driver \
        pylon \
        python3-pypylon \
        gentl-producer \
        kernel-module-isp-vvcam \
        imx8mp-modprobe-config \
        basler-camera \
        isp-imx \
        xauth \
"
PREFERRED_VERSION_isp-imx                = "4.2.2.8+basler"
PREFERRED_VERSION_basler-camera          = "4.2.2.8+basler"
PREFERRED_VERSION_kernel-module-isp-vvcam = "4.2.2.8+basler"
</pre>
|
<pre>
IMAGE_INSTALL_append = " \
        kernel-module-basler-camera \
        pylon \
        python3-pypylon \
        gentl-producer \
        kernel-module-isp-vvcam \
        imx8mp-modprobe-config \
        basler-camera \
        isp-imx \
        xauth \
"
PREFERRED_VERSION_isp-imx                 = "4.2.2.13+basler"
PREFERRED_VERSION_basler-camera          = "4.2.2.13+basler"
PREFERRED_VERSION_kernel-module-isp-vvcam = "4.2.2.13+basler"
</pre>
}}
| {{#ifeq: {{#var:YOCTO_NAME}} | Sumo |
= Customize configuration files =


== Customize bblayers.conf ==
Add the following lines to conf/bblayers.conf
<pre>
BBLAYERS += " ${BSPDIR}/sources/meta-basler-imx8 "
BBLAYERS += " ${BSPDIR}/sources/meta-basler-tools/meta-basler-common "
BBLAYERS += " ${BSPDIR}/sources/meta-variscite-imx-basler "
</pre>
|
Add the following lines to conf/bblayers.conf
<pre>
${BSPDIR}/sources/meta-basler-imx8 \
${BSPDIR}/sources/meta-basler-tools/meta-basler-common \
</pre>
}}
== Customize local.conf ==
== Customize local.conf ==
Add the following to conf/local.conf under your Yocto build directory:<br>
Add the following to conf/local.conf under your Yocto build directory:
<br>
{{#lst:Yocto_Platform_Customization|{{#var:META_BASLER_LOCALCONF_SECTION}}}}
Add Basler software and driver:
<pre>
IMAGE_INSTALL_append = " \
        basler-camera-driver \
        pylon \
        python3-pypylon \
        gentl-producer \
        xauth \
"
MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "kernel-module-basler-camera-driver"
</pre>
}}
 
= Build Yocto image =
= Build Yocto image =
Continue following {{Varlink|Yocto_Build_Release|{{#var:RELEASE_LINK}}|Build Yocto from source code}} from where you left off, to bitbake and install an image.
Continue following {{Varlink|Yocto_Build_Release|{{#var:RELEASE_LINK}}|Build Yocto from source code}} from where you left off, to bitbake and install an image.
Line 134: Line 53:


  $ export DISPLAY=:0.0
  $ export DISPLAY=:0.0
  $ GENICAM_GENTL64_PATH=/opt/dart-bcon-mipi/lib /opt/{{#ifeq: {{#var:YOCTO_NAME}}|Dunfell|pylon|pylon6}}/bin/pylonviewer 2>/dev/null &
  $ /usr/bin/pylon
 
= Using the pypylon Python 3 interface to Basler camera =
{{#ifeq: {{#var:HARDWARE_NAME}} | DART-MX8M-PLUS |
This interface lets you configure the camera and acquire video and images from a Python application. You can also type commands in an interactive Python session.
= Running gstreamer =
All software needed is already installed in the Yocto image generated following instructions on this page.<br/>
For more information and sample code refer to the [https://github.com/basler/pypylon pypylon page on Github].<br/>
Before starting Python run the following command at the shell prompt:


$ export GENICAM_GENTL64_PATH=/opt/dart-bcon-mipi/lib
{{#if: {{#var:BASLER_GSTREAMER_SECTION}} |
= Running GStreamer =
The following commands apply to [https://www.variscite.com/product/accessories/vcam-ar0821b-camera-board/ VCAM-AR0821B] (daA3840-mc) only.<br>
Run the following command at the shell prompt:
Run the following command at the shell prompt:
{{#ifeq: {{#var:FSL_BSP_VERSION}}|L5.4.70_2.3.0|
{{#lst:Yocto_Platform_Customization|{{#var:BASLER_GSTREAMER_SECTION}}}}
$ gst-launch-1.0 -v v4l2src device=/dev/video0 ! waylandsink sync=false
|
* 1920x1080@30fps:
# gst-launch-1.0 -v v4l2src device=/dev/video0 ! "video/x-raw,format=YUY2,width=1920,height=1080" ! waylandsink sync=false
* 3840x2160@30fps:
# gst-launch-1.0 -v v4l2src device=/dev/video0 ! "video/x-raw,format=YUY2,width=3840,height=2160" ! waylandsink sync=false
}}
}}
|}}
{{#if: {{#var:BASLER_SWITCH_CAM_SECTION}} |
= Switching between different Basler cameras =


= Using prebuilt recovery SD card images =
The Yocto image built supports the
 
[https://www.variscite.com/product/accessories/vcam-ar1335b-i-mx8-camera-board/ VCAM-AR1335B] (daA4200-30mci)
{{#ifeq: {{#var:HARDWARE_NAME}} | DART-MX8M-MINI |
camera by default.<br>
Prebuilt recovery SD card image with Basler camera support can be downloaded from ftp://customerv:Variscite1@ftp.variscite.com/Basler/Software/DART-MX8M-MINI/{{#ifeq: {{#var:YOCTO_NAME}} | Sumo |
In order to use the [https://www.variscite.com/product/accessories/vcam-ar0821b-camera-board/ VCAM-AR0821B] (daA3840-mc)
sumo-fsl-4.14.98-mx8mm-v2.5 | {{#ifeq: {{#var:YOCTO_NAME}} | Dunfell | dunfell-fsl-5.4.x-mx8mm-v6.5}}}}
camera you need to run the following commands at the shell prompt:
{{#lst:Yocto_Platform_Customization|{{#var:BASLER_SWITCH_CAM_SECTION}}}}
The above changes become effective after reboot.
}}
{{#if: {{#var:BASLER_RECOVERY_SD_PATH}} |
= Prebuilt recovery SD card image =
A prebuilt recovery SD card image with Basler camera support can be downloaded from:<br>


|{{#ifeq: {{#var:HARDWARE_NAME}} | DART-MX8M |
ftp://customerv:Variscite1@ftp.variscite.com/Basler/Software/{{#var:BASLER_RECOVERY_SD_PATH}}
Prebuilt recovery SD card image with Basler camera support can be downloaded from ftp://customerv:Variscite1@ftp.variscite.com/Basler/Software/DART-MX8M/{{#ifeq: {{#var:YOCTO_NAME}} | Sumo | sumo-fsl-4.14.98-mx8mq-v2.5 | {{#ifeq: {{#var:YOCTO_NAME}} | Dunfell |dunfell-fsl-5.4.x-mx8mq-v6.2 }}}}


|{{#ifeq: {{#var:HARDWARE_NAME}} | DART-MX8M-PLUS |
'''Note:''' Some web browsers have removed FTP support. Please see our [[FTP|FTP wiki page]].<br>
{{#ifeq: {{#var:FSL_BSP_VERSION}}|L5.4.70_2.3.0|
Prebuilt recovery SD card image with Basler camera support can be downloaded from ftp://customerv:Variscite1@ftp.variscite.com/Basler/Software/DART-MX8M-PLUS/zeus-fsl-5.4.70-mx8mp-v2.1
|
Prebuilt recovery SD card image with Basler camera support can be downloaded from ftp://customerv:Variscite1@ftp.variscite.com/Basler/Software/DART-MX8M-PLUS/zeus-fsl-5.4.70-mx8mp-v2.3
}}
}}
}}}}}}

Revision as of 20:00, 18 January 2022

DART-MX8M-MINI Basler Camera using CEP

Introduction

The following instructions will allow you to add CEP (Camera Enablement Package) support for the Basler MIPI camera to your Yocto images.
This will allow you to stream images/video from a Basler camera(s) connected to a Variscite evaluation kit.

Available Basler cameras

Download Variscite Yocto BSP

Please follow Build Yocto from source code.
Execute steps 1-4.3 to download the BSP sources, but don't start bitbake yet.

Download and install Basler meta layers

$ wget ftp://customerv:Variscite1@ftp.variscite.com/Basler/Software/basler-dart-bcon-mipi-imx8-cep_1.5.0-for-imx-4.14.98-2.0.0_ga_sumo.tar.gz
$ mkdir basler-dart-bcon-mipi-imx8-cep_1.5.0-for-imx-4.14.98-2.0.0_ga_sumo
$ tar xf basler-dart-bcon-mipi-imx8-cep_1.5.0-for-imx-4.14.98-2.0.0_ga_sumo.tar.gz -C basler-dart-bcon-mipi-imx8-cep_1.5.0-for-imx-4.14.98-2.0.0_ga_sumo
$ mv basler-dart-bcon-mipi-imx8-cep_1.5.0-for-imx-4.14.98-2.0.0_ga_sumo/meta-basler* ../sources
$ wget ftp://customerv:Variscite1@ftp.variscite.com/Basler/Software/sumo-fsl-4.14.98-cep-1.5.0/meta-variscite-imx-basler.tar.gz
$ tar xf meta-variscite-imx-basler.tar.gz -C ../sources/

Customize configuration files

Customize bblayers.conf

Add the following lines to conf/bblayers.conf under your Yocto build directory:

BBLAYERS += " ${BSPDIR}/sources/meta-basler-imx8 "
BBLAYERS += " ${BSPDIR}/sources/meta-basler-tools/meta-basler-common "
BBLAYERS += " ${BSPDIR}/sources/meta-variscite-imx-basler "

Customize local.conf

Add the following to conf/local.conf under your Yocto build directory:

IMAGE_INSTALL_append = " \
	basler-camera-driver \
	pylon \
	python3-pypylon \
	gentl-producer \
	xauth \
"
MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "kernel-module-basler-camera-driver"

Build Yocto image

Continue following Build Yocto from source code from where you left off, to bitbake and install an image.

Running Basler camera application

Run the following commands at the shell prompt:

$ export DISPLAY=:0.0
$ /usr/bin/pylon

Using the pypylon Python 3 interface to Basler camera

This interface lets you configure the camera and acquire video and images from a Python application. You can also type commands in an interactive Python session. All software needed is already installed in the Yocto image generated following instructions on this page.
For more information and sample code refer to the pypylon page on Github.
Before starting Python run the following command at the shell prompt:

$ export GENICAM_GENTL64_PATH=/opt/dart-bcon-mipi/lib


Prebuilt recovery SD card image

A prebuilt recovery SD card image with Basler camera support can be downloaded from:

ftp://customerv:Variscite1@ftp.variscite.com/Basler/Software/DART-MX8M-MINI/sumo-fsl-4.14.98-mx8mm-v2.5/dart-mx8mm-basler-cep-1.5-recovery-sd.v25.img.gz

Note: Some web browsers have removed FTP support. Please see our FTP wiki page.