Search by Tags

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

 

Article updated at 22 Jun 2022
Subscribe for this article updates

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

    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

    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

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

Note: 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

    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

    E Con Camera Cable Connection To Verdin Development Board


  • Verdin Development Board Connection upside view

    Verdin Development Board Connection

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.

Warning: Picture still to be provided.

Torizon 5.0.0+

The camera works both with the Toradex BSP Layers and Reference Images for Yocto Project and Torizon. The camera device driver and device tree are integrated into the Toradex BSP Layers and the binaries are deployed to the reference images. The next sections explain how to use the camera.

Note: e-con Systems and Toradex are working on a Partner Demo Container for a great out-of-the-box experience. Subscribe to our developer website updates or contact our sales team to stay up-to-date.

Using Toradex Easy Installer, install pre-build TorizonCore image (Toradex Download Links (Torizon, Linux BSP, WinCE and Partner Demos)) on the board.

Device tree Overlay - TorizonCore Builder

To apply and deploy the Device Tree Overlay you need to follow one of the approaches on Device Tree Overlays on Torizon. You have to enable the device tree overlay apalis-imx8_ar0521_overlay.dtbo (if you are using and Apalis module).

Note: Suggestion: use the Approach 1: Applying a Device Tree and Device Tree Overlays to a Custom Image Using the Build Command

After applying the device tree overlay, reboot the board and check if the driver is properly installed.

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

Camera Usage

To start the camera usage, you first need to build a container with GStreamer and V4L2-utils. So, it's recommended to follow the steps:

  • Develop a Dockerfile running the installation of GStreamer and its plugins and V4L2-utils. The article How to use Gstreamer on TorizonCore is going to be very helpful and you can develop your Dockerfile based on the Sample Dockerfile.
  • Build the Dockerfile using Docker build command.
  • Push the image to your Dockerhub account.

The following Dockefile is an example of a one that can be used to fulfill the requirements:

Click here to see the Dockerfile

Then, build it and push:

$ docker build -f Dockerfile -t <your-dockerhub-username>/<Dockerfile-name> .
$ docker push <your-dockerhub-username>/<Dockerfile-name>

After these steps, you can start properly working on your device. So, make sure that there is no container running on Torizon by stopping them all.

# docker stop $(docker ps -a -q)
d942c0b4c5f1
3bff2f66a8d8
61dab378a9eb
f8eca0e69f26
1455a33e6d78
cd529e7f036d 

Because the camera application container also needs a Weston container running at the same time, launch the Weston container.

# docker run -e ACCEPT_FSL_EULA=1 -d --rm --name=weston --net=host --cap-add CAP_SYS_TTY_CONFIG \
             -v /dev:/dev -v /tmp:/tmp -v /run/udev/:/run/udev/ \
             --device-cgroup-rule='c 4:* rmw' --device-cgroup-rule='c 13:* rmw' \
             --device-cgroup-rule='c 199:* rmw' --device-cgroup-rule='c 226:* rmw' \
             torizon/weston-vivante:$CT_TAG_WESTON_VIVANTE --developer weston-launch \
             --tty=/dev/tty7 --user=torizon

# docker ps
CONTAINER ID        IMAGE                      COMMAND                  CREATED             STATUS              PORTS               NAMES
473d395c761d        torizon/weston-vivante:2   "/usr/bin/entry.sh -…"   7 seconds ago       Up 5 seconds                            weston

Now pull the container from your Dockerhub account and then, finally, launch the container where you going to run the pipeline.

# docker pull <your-dockerhub-username>/<Dockerfile-name>

# docker run --rm -it --privileged \
    -v /tmp:/tmp \
    -v /var/run/dbus:/var/run/dbus \
    -v /dev/galcore:/dev/galcore \
    --device /dev/video0 \
    --device-cgroup-rule='c 199:* rmw' \
    <your-dockerhub-username>/<Dockerfile-name>

Here are some considerations:

  • Make sure to pass the right camera device. In this case, was /dev/video0. If you are not sure which device is a camera capture device, pass under the argument --device all the devices available to be used.
  • Make sure to give extended privileges to this container passing the --privileged argument.
  • Don't forget to replace <your-dockerhub-username>/<Dockerfile-name> with your container.

Then, once you are inside the container, enable the streaming by running 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