Skip to main content
Version: 6

First Steps with CSI Camera Set 5MP AR0521 Color (Linux)

info

This page has not been fully updated to reflect the changes made in Toradex Linux BSP 6. Some information may still apply to Toradex Linux BSP 6 configurations. If you encounter issues, please Send Feedback.
If you are using version 5 LTS, please visit the 5 LTS version documentation.

Introduction

This article provides information on how to start working with the CSI Camera Set 5MP AR0521 Color, which includes how to set up the hardware (wiring), install, and configure the necessary drivers for a touch demo.

e-con Camera and adapter

Getting Started

What I need to order

The CSI Camera Set 5MP AR0521 Color can be ordered with many Toradex computers on modules and carrier boards. See the compatible products.

CSI Camera Set 5MP AR0521 Front View Connected to Toradex Board

Where do I order

All the products can be ordered online in the Toradex Webshop.

Cable Connection

This topic provides pin connection details regarding connecting the CSI Camera Set 5MP AR0521 Color to the carrier boards.

CSI Camera Set 5MP AR0521 module, cables, adapter, and carrier board

info

The flat ribbon cable, used to connect the carrier board and the camera adaptor is very fragile. If your camera does not work, make sure to test the cable connections on the flat cable.

Please refer to the below instructions for connecting the display to your specific carrier board.

Connections on Ixora

See the picture below for the direct connection from the camera to the Ixora board. Make sure to connect the pin 1 side of the CSI camera to the respective pin 1 of the carrier board (MIPI-CSI Connector X28).

CSI Camera Set 5MP AR0521 Connection to Ixora

Connections on Verdin Development Board

Connect the camera to the Verdin Development Board as indicated in the figure below. The MIPI-CSI Camera Interface is on connector X47. Make sure to connect the pin 1 side of the CSI camera to the respective pin 1 of the carrier board.

Camera Connection to Verdin Development Board

Verdin Development Board Connection upside view

Connections on Dahlia Carrier Board

Connect the camera to the Dahlia Board, as indicated in the figure below. The MIPI-CSI Camera Interface is on connector X16.

caution

Picture still to be provided.

First steps on BSP and Reference Images

The CSI Camera AR0521 is fully supported to be used with Apalis iMX8. Which means that the camera device driver and device tree are integrated into the Toradex BSP Layers and the binaries are deployed to the reference images, so being able to work both with the Toradex BSP Layers and Reference Images for Yocto Project and Torizon.

When it comes to Verdin SoMs, full support is still a work in progress. However, if you want to develop your applications with Verdin iMX8M Plus, Toradex provides a tested device tree overlay: verdin-imx8mp_ar0521_overlay.dts.

The next sections explain how to use the camera with the refered modules.

info

Support was added from the BSP version 5.0.0+devel-202008 onwards.

Install the Toradex Reference Multimedia pre-built image using the Toradex Easy Installer.

Device Tree Overlay

Apalis iMX8

  1. Via serial terminal or ssh, access the board and enable the device-tree overlay already available at /boot/overlay by writing the .dtbo name to the overlays.txt file. To write in the overlays.txt you can use vi and paste apalis-imx8_ar0521_overlay.dtbo on the variable fdt_overlays.
# ls /boot/overlays
apalis-imx8_ar0521_overlay.dtbo display-dpi-lt170410_overlay.dtbo
apalis-imx8_atmel-mxt_overlay.dtbo display-edt5.7_overlay.dtbo
apalis-imx8_hdmi_overlay.dtbo display-edt7_overlay.dtbo
apalis-imx8_lvds_overlay.dtbo display-fullhd_overlay.dtbo
apalis-imx8_mezzanine-can_overlay.dtbo display-lt161010_overlay.dtbo
apalis-imx8_mezzanine_lvds_overlay.dtbo display-lt170410_overlay.dtbo
apalis-imx8_mezzanine_ov5640_overlay.dtbo display-vga_overlay.dtbo
apalis-imx8_ov5640_overlay.dtbo touch-atmel-mxt_overlay.dtbo

# vi /boot/overlays.txt

fdt_overlays=apalis-imx8_hdmi_overlay.dtbo apalis-imx8_ar0521_overlay.dtbo
  1. Sync the changes and reboot the board.
# sync

# reboot

Verdin iMX8M Plus

  1. Download the device tree overlay for Verdin iMX8M Plus: verdin-imx8mp_ar0521_overlay.dts.

  2. Build the device tree overlay binary accordingly to the instructions in the section Manual Device Tree Overlays Compilation in the article Build U-Boot and Linux Kernel from Source Code.

  3. Deploy the binary to the board using scp, an USB stick or SD card.

$ scp verdin-imx8mp_ar0521_overlay.dtbo root@<board-ip>:/home
verdin-imx8mp_ar0521_overlay.dtbo
  1. Via serial terminal or ssh, access the board. Copy the .dtbo to the /boot/overlays directory.
# cp /home/verdin-imx8mp_ar0521_overlay.dtbo /boot/overlays

# ls /boot/overlays/verdin-imx8mp_ar0521_overlay.dtbo
/boot/overlays/verdin-imx8mp_ar0521_overlay.dtbo
  1. Add the verdin-imx8mp_ar0521_overlay.dtbo name to the file overlays.txt.
# vi /boot/overlays.txt 

fdt_overlays=verdin-imx8mp_native-hdmi_overlay.dtbo verdin-imx8mp_lt8912_overlay.dtbo verdin-imx8mp_ar0521_overlay.dtbo
  1. Sync the changes and reboot the board.
# sync

# reboot

Camera Usage

After the reboot, you can verify that the camera driver is starting correctly:

# dmesg | grep ar0521
[ 7.045228] ar0521 5-0042: Current Firmware Version - (1150CU96RKV1901110d381894XXXXXXX)
[ 11.646248] mx8-img-md: Registered sensor subdevice: ar0521 5-0042 (1)
[ 11.750804] mx8-img-md: created link [ar0521 5-0042] => [mxc-mipi-csi2.1]

To check which /dev/video* is a capture device by getting driver information, you need to use the video-for-linux control (v4l2-ctl) command from v4l2 utils. In this case, the capture device is on /dev/video0.

# ls /dev/video*
/dev/video0 /dev/video1 /dev/video12 /dev/video13 /dev/video2

# v4l2-ctl -d0 -D
Driver Info:
Driver name : mxc-isi-cap
Card type : mxc-isi-cap
Bus info : platform:58140000.isi:cap_devic
Driver version : 5.4.161
Capabilities : 0x84201000
Video Capture Multiplanar
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04201000
Video Capture Multiplanar
Streaming
Extended Pix Format
Media Driver Info:
Driver name : mxc-md
Model : FSL Capture Media Device
Serial :
Bus info :
Media version : 5.4.161
Hardware revision: 0x00000000 (0)
Driver version : 5.4.161
Interface Info:
ID : 0x03000014
Type : V4L Video
Entity Info:
ID : 0x00000012 (18)
Name : mxc_isi.4.capture
Function : V4L2 I/O
Pad 0x01000013 : 0: Sink
Link 0x02000021: from remote pad 0x100000e of entity 'mxc_isi.4': Data, Enabled
info

Note that the video device can be in any of the listed video devices. So, check all of them to make sure to use the right one in the pipeline.

To enable the streaming, run a Gstreamer pipeline on the terminal:

# gst-launch-1.0 v4l2src device='/dev/video0'  ! "video/x-raw, format=RGB16, framerate=30/1, width=1920, height=1080" ! fpsdisplaysink video-sink=waylandsink text-overlay=false sync=false -v
Click here to see the Gstreamer command output
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0/GstWaylandSink:waylandsink0: sync = false
/GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-raw, format=(string)R[G Bh1960,6 .f5r3a2m5e5r4a]t es=t(rferaamcdtbi[o0n])=300,/ 1m,o dew=id3t
=(int)1920, height=(int)1080, colorimetry=(string)sRGB, interlace-mode=(string)progressive
Setting pipeline to PLAYING ...
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw, format=(string)RGB16, framerate=(fraction)30/1, width=(int)1920, height=(int)1080, colorimetry=(string)sRGB, interlace-mode=(string)progressive
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0.GstGhostPad:sink.GstProxyPad:proxypad0: caps = video/x-raw, format=(string)RGB16, framerate=(fraction)30/1, width=(int)1920, height=(int)1080, colorimetry=(string)sRGB, interlace-mode=(string)progressive
New clock: GstSystemClock
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0/GstWaylandSink:waylandsink0.GstPad:sink: caps = video/x-raw, format=(string)RGB16, framerate=(fraction)30/1, width=(int)1920, height=(int)1080, colorimetry=(string)sRGB, interlace-mode=(string)progressive
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0.GstGhostPad:sink: caps = video/x-raw, format=(string)RGB16, framerate=(fraction)30/1, width=(int)1920, height=(int)1080, colorimetry=(string)sRGB, interlace-mode=(string)progressive
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-raw, format=(string)RGB16, framerate=(fraction)30/1, width=(int)1920, height=(int)1080, colorimetry=(string)sRGB, interlace-mode=(string)progressive
[ 906.532557] streamdb[1]=1, mode=3
[ 906.658370] streamdb[2]=2, mode=3
[ 906.661706] streamdb[3]=3, mode=3
[ 906.708655] input fmt YUV4
[ 906.714672] output fmt RGBP
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0/GstWaylandSink:waylandsink0: sync = false
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 32, dropped: 0, current: 62.91, average: 62.91
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 56, dropped: 0, current: 47.37, average: 55.16
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 87, dropped: 0, current: 59.26, average: 56.55
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 118, dropped: 0, current: 61.07, average: 57.67
^Chandling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 0:00:02.720832534
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Total showed frames (125), playing for (0:00:02.721266280), fps (45.934).
Freeing pipeline ...
Send Feedback!