RPI3 bullseye image and libcamera

Hello,

Im currently trying to migrate a stack that runs on RPI3B+ running Debian buster to bullseye, one of the major changes from one to another is supposedly the migration from picamera stack to the standard libcamera stack.

When running a balena build with the bullseye base images i found out that these do not embark libcamera and when I install lib camera-tools and libcamera-apps and try to run libcamera-jpeg -o test.jpg I encounter an error telling me that the camera is configured using the legacy stack.

Is there a particular reason for balena bullseye builds for rpi3 to embark this legacy stack and how does one disable it in order to use the new one ?

Thanks !

1 Like

For what I understand, the legacy stack can be disabled by removing the start_x=1 in boot config.
But then I get the following:

root@bcbfa09:/usr/src/app# libcamera-still -t 5000 -o test.jpg -n
[0:11:30.018611852] [91]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3406-e96d0201
[0:11:30.058640208] [92]  WARN CameraSensor camera_sensor.cpp:208 'imx477 10-001a': Recommended V4L2 control 0x009a0922 not supported
[0:11:30.058729427] [92]  WARN CameraSensor camera_sensor.cpp:260 'imx477 10-001a': The sensor kernel driver needs to be fixed
[0:11:30.058777864] [92]  WARN CameraSensor camera_sensor.cpp:262 'imx477 10-001a': See Documentation/sensor_driver_requirements.rst in the libcamera sources for more information
[0:11:30.070694007] [92]  WARN CameraSensorProperties camera_sensor_properties.cpp:141 No static properties available for 'imx477'
[0:11:30.070796662] [92]  WARN CameraSensorProperties camera_sensor_properties.cpp:143 Please consider updating the camera sensor properties database
[0:11:30.070845673] [92]  WARN CameraSensor camera_sensor.cpp:407 'imx477 10-001a': Failed to retrieve the camera location
[0:11:30.070909006] [92] ERROR CameraSensor camera_sensor.cpp:551 'imx477 10-001a': Camera sensor does not support test pattern modes.
[0:11:30.150774209] [92] ERROR RPI raspberrypi.cpp:1239 Unicam driver does not use the MediaController, please update your kernel!
[0:11:30.156713348] [92] ERROR RPI raspberrypi.cpp:1138 Failed to register camera imx477 10-001a: -22
ERROR: *** no cameras available ***

Is it possible that the version of the kernel on the image is too old for imx477 support ? how does one update the kernel ?

1 Like

Hello @qpre thank you for posting this message.

We also discovered that bullseye might be missing some legacy camera drivers. We are researching on this. Let us know if you discover anything else :slight_smile:

Hello @mpous,

This is still ongoing on our side,
from what I’ve experienced/read:

  • the legacy stack works well if you enable start_x=1
  • the Unicam drivers for the libcamera stack with MediaController support seems to have been merged in the RapberryPi kernel a week ago in 5.10.75 but I don’t know how BalenaOS picks up updates on the upstream kernel.
1 Like

I am also interested in knowing how those updates flow. This is somewhat blocking a deploy we have in the pipeline, so happy to help/experiment.

From what I see on the Github, the right kernel and dtoverlays have been shipped with the latest release of balena-raspberrypi, I’ll test is as soon as I can update my device (I don’t know why, the dashboard does not allow me to select a revision other than the 2.83.21+rev1 that I’m currently running)

took me a while to understand it (I’m a bit slow in the mornings ˆˆ), turns out it got merged in the latest “meta-balena”/“balena-raspberry” but these updates are not systematically made available to through the dashboard and we’ll have to wait for a stable revision for raspberry pi to be delivered.

I don’t know if anyone has insights on how close they are to a stable release.

@qpre Thanks so much for this information. I am really eager to get the new camera stack rolling under balena management. Is there a way that I can compile/test this new pre-release version?

I’m trying to get libcamera working, too. In the balena-os/balena-raspberrypi repo, I see that the balena ci version bot created a new version (v2.91.1+rev2) an hour ago. Does this address the libcamera driver issues? How do I test this version on a raspberry pi zero 2 W? In the balena dashboard, the most recent release available for my device is v2.87.16+rev1. Thanks

I have some time allocated next week to sort this out. I might try doing an experimental build of BalenaOS, but that is TBD based on my time availability.

I figured out how to build and configure from the balena-os/balena-rasepberrypi source this morning. The most confusing part for me was configuring the image that was built from the barys script so I could access it in balenaCloud. Eventually I found the balena os configure cli command that worked for me.

I am still getting the “no cameras found” error from libcamera-hello.

Hey everyone,

I have created a sample app to showcase using libcamera-apps on balenaOS. You can find it here: GitHub - balena-io-playground/libcamera-apps: Example repo to showcase Raspberry Pi's new libcamera stack on balenaOS

let us know how it goes.

2 Likes

Hey Rahul !

Thanks a lot, I just tested it to be working on a RPI 3B+ with the imx477 :slight_smile:

Thanks for fixing this!!! It is working for me on a rpi zero 2 with an ov5647 (rpi v1) camera but not with an imx219 (rpi v2) camera yet. I am going to keep trying different dtoverlay combinations.