First Steps with Framos FSM:GO CSI Optical Sensor Modules (Torizon)
Introduction
This article provides information on how to start working with the Framos FSM:GO Optical Sensor Modules on Torizon.
The following topics will be covered:
Hardware Setup
What I need to order
You can have the FSM:GO CSI Optical Sensor Modules working with specific Toradex computers on modules and carrier boards. See the compatible products.
An adapter board is also required to connect the Framos Optical Sensor Modules to the Toradex Boards.
The following list describes all components that you should order:
- Camera Module
Currently the FSM:GO has three options of cameras available:
- FSM:GO IMX662 (2MP/2K optical sensor module) - 58°, 86° and 137°lens angles available.
- FSM:GO IMX676 (12MP/1:1 format optical optical sensor module) - 16°, 92°, 102° and 185°lens angles available.
- FSM:GO IMX678 (8MP/4K optical sensor sensor module) - 54°, 100° and 110°lens angles available.
- Adapter Board and accessories
You can use the adapter board and the accessories for any of the three camera models described above.
- FPA-A/P24-V0X (adapter board).
- FMA-CBL-FFC24-0.2m-V1A (cable).
- FMA-SCW-01-KIT (screws, nuts, and spacers for adapter board and sensor board fitting).
Where do I order
You can order the Toradex computer on Modules and the carrier boards online in the Toradex Webshop.
You can order the Framos sensor modules and the needed accessories by directly contacting Framos.
The flat ribbon cable (used to connect the carrier board and the camera adaptor) is fragile. If your camera does not work, make sure to test the cable connections on the flat cable.
Please refer to the instructions below for connecting the camera module to your specific carrier board.
Connection to Verdin Development Board
Please disconnect any power and USB cables from the board before connecting the flat cable to the MIPI-CSI bus to avoid any damage to the camera!
Connect the camera to the Verdin Development Board, assuring that the flat cable contacts are on the correct side, as indicated in the figures below. The MIPI-CSI Camera Interface is on connector X47.
Software Setup
Generating Device Tree Overlay using TorizonCore Builder
You will need to generate and apply specific camera device tree overlays using the TorizonCore Builder tool to an existing Torizon OS image. Please run the following steps:
- To install TorizonCore Builder please follow the steps from this section (If you already have it installed on your computer, you can skip this step).
Clone the
torizon-samples
repository Torizon Samples Repository. It contains a downloader script to fetch all repositories and source files required for the setup:$ git clone https://github.com/toradex/torizon-samples -b bookworm
Copy the downloader script
download.sh
from the previously cloned repository to thetcbdir
folder (where TorizonCore Builder was installed).Assuming that this folder is
/home/tcbdir
, run:$ cp torizon-samples/isp/imx8mp/framos/download.sh ~/tcbdir
If you chose another location for the
tcbdir
folder, please change the above command accordingly.
Run the downloader script to fetch the linux source code and the device trees repository, passing the Torizon OS version as argument:
$ ./download.sh linux 7
After that, run again the downloader script, but using the option to download the camera driver source code from your choice.
(Replace
imxXXX
by the available FSM:GO Camera options -imx662
,imx676
orimx678
):$ ./download.sh driver 7 imxXXX
- Next, you will need to place a Torizon OS image (.tar file or folder) inside the
tcbdir
folder. If still do not have one, you can download it on our download links section.
Create the
tcbuild.yaml
file, inside thetcbdir
folder. You can use the following example with the imx662 camera as base, setting thelocal
fields for the Torizon OS image input and output. If you are using a different camera, please replace every mention toimx662
with the model of your choice:input:
easy-installer:
local: <NAME OF THE TORIZON OS IMAGE FOLDER OR .TAR FILE>
customization:
device-tree:
include-dirs:
- linux/include/
# >> Custom device tree source:
custom: linux/arch/arm64/boot/dts/freescale/imx8mp-verdin-wifi-dev.dts
overlays:
add:
- device-trees/overlays/verdin-imx8mp_imx662_overlay.dts
- device-trees/overlays/verdin-imx8mp_hdmi_overlay.dts
kernel:
modules:
- source-dir: imx662-driver/
autoload: false
output:
easy-installer:
# >> Output directory of the customized image (REQUIRED):
local: <NAME OF THE OUTPUT FOLDER FOR THE CUSTOMIZED IMAGE WITH THE OVERLAY>If you need more information on how to prepare the
tcbuild.yaml
, please see the TorizonCore Builder Tool "Build" command article.Build the custom image with TorizonCore Builder:
$ torizoncore-builder build
After finishing the build process, get the image on the output folder you specified on the
tcbuild.yaml
file and install it on your board using the Toradex Easy Installer.
Docker containers
You will have to launch three different containers on your board to use the FSM:GO cameras on Torizon:
A Weston container, required for displaying the video image;
A container for building and running the isp-imx application which will interface with the camera drivers;
A Gstreamer for running the video pipeline.
The Weston container can be directly launched on the target board, while the isp-imx and the Gstreamer containers need to be built first on your host computer and pushed to Dockerhub.
For the next steps, make sure that you have a DockerHub account. Then, replace all <your-dockerhub-username>
placeholders with the name of your account for the commands below.
Building containers
isp-imx :
1.1. You need to enable Arm emulation to build the
isp-imx
container on your host computer:$ docker run --rm -it --privileged torizon/binfmt
1.2 The torizon-samples repository that was cloned on the previous previous section has Dockerfiles for building the
isp-imx
application required for running the video stream. On this repository, navigate to the folder for your Torizon OS version:$ cd torizon-samples/isp/imx8mp/framos/Torizon7/isp-imx
1.3 Build container image:
$ docker build -t <your-dockerhub-username>/torizon7-isp-imx .
1.4 Once the build is finished, push the image to your Dockerhub account:
$ docker push <your-dockerhub-username>/torizon7-isp-imx
Gstreamer :
2.1. Starting from the torizon-samples repository that you cloned before as your current directory, navigate to the gstreamer demo folder:
$ cd gstreamer/bash/simple-pipeline
2.2 Build the container image:
$ docker build --build-arg BASE_NAME=wayland-base-vivante --build-arg IMAGE_ARCH=linux/arm64/v8 -t <your-dockerhub-username>/gst_example .
2.3 Once the build is finished, push the image to your Dockerhub account:
$ docker push <your-dockerhub-username>/gst_example
For detailed information about the Gstreamer Dockerfile used on this build, refer to How to use Gstreamer on Torizon OS.
Launching Containers on Your Board
For this phase, you have two possible options for launching the containers:
- Launching one container at a time, executing individual
docker run
commands for each one. - Running all the containers through the docker compose tool after sending a
docker-compose.yaml
file to the board. See this section.
Both approaches are explained on the next sections.
If you wish to launch each container individually, please make sure to run the commands in the correct order, which is specified below. Otherwise, you might be not able to run the video pipeline properly due to dependency issues between the containers!
On your board, launch the Weston Container:
$ docker run -e ACCEPT_FSL_EULA=1 -e WESTON_DISABLE_ATOMIC=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-imx8:4 --developer --tty=/dev/tty7
Check the current instantiated video devices:
$ ls /dev/video*
A list of the video devices should appear, similar as the example below:
/dev/video0 /dev/video1
Launch the isp-imx container:
$ docker run -e ACCEPT_FSL_EULA=1 -d --rm --privileged --name=isp-imx --net=host --cap-add CAP_SYS_TTY_CONFIG \
-v /tmp:/tmp -v /var/run/dbus:/var/run/dbus -v /dev:/dev -v /sys:/sys -v /lib/modules:/lib/modules \
<your-dockerhub-username>/torizon7-isp-imx /build-isp-imx/opt/imx8-isp/bin/start_isp.shCheck again the current instantiated video devices using
ls /dev/video*
. If the isp-imx container started successfully, a new /dev/video device should appear./dev/video0 /dev/video1 /dev/video2
Launch the Gstreamer container:
$ docker run --rm -it --entrypoint '/bin/bash' -v /tmp:/tmp -v /var/run/dbus:/var/run/dbus -v /dev:/dev -v /sys:/sys \
--device-cgroup-rule='c 81:* rmw' --device-cgroup-rule='c 199:* rmw' --device-cgroup-rule='c 226:* rmw'\
<your-dockerhub-username>/gst_example
If you need additional information on how to run containers on Torizon, you can check this article.
Camera Usage
After launching the Gstreamer container, a new bash shell will appear, in which you should run a Gstreamer pipeline.
A good GStreamer pipeline to test this camera can be seen below. Please note that the device /dev/video2
should be replaced with the one that appeared after launching the isp-imx
container on the previous step:
gst-launch-1.0 v4l2src device=/dev/video2 ! video/x-raw,width=1920,height=1080 ! fpsdisplaysink text-overlay=false video-sink=waylandsink sync=false -v
For more details about using Video4Linux and GStreamer tools to interact with cameras and collect video frames, see Cameras on Toradex System on Modules.
Using Docker Compose
As an alternative for launching the containers individually, you can use docker compose to run all the containers at once.
You can use for this the docker-compose.yaml
file provided in the torizon-samples repository. Please make sure to fill in your Dockerhub username on the places indicated on the yaml
file.
You can either create a new file on your board and copy the contents from the repository file, or send it directly to the board using scp:
scp docker-compose.yaml torizon@<board-ip>:/home/torizon
After that, on the board, navigate to the folder where the file was placed and launch the containers with the following command:
docker-compose up
Please notice that when using this method, the camera should start streaming the video once the last container (gstreamer) is launched.
Having Trouble?
Please contact our technical support. Various options for technical support are mentioned in the article below.