meta-raspberrypi icon indicating copy to clipboard operation
meta-raspberrypi copied to clipboard

Raspberry 5 camera doesn't work

Open al1img opened this issue 1 year ago • 8 comments

Camera doesn't work on Raspberry 5

Steps to reproduce the issue:

  1. Set MACHINE = "raspberrypi5"
  2. Add libcamera-apps to the target image: IMAGE_INSTALL:append = "libcamera-apps"

Describe the results you received:

libcamera-hello displays image from camera.

Describe the results you expected:

[0:17:43.474887809] [833]  INFO Camera camera_manager.cpp:284 libcamera v0.2.0+46-075b54d5-dirty (2024-03-30T18:04:07+00:00)
Preview window unavailable
ERROR: *** no cameras available ***

Additional information you deem important (e.g. issue happens only occasionally):

Camera is detected by kernel:

[    2.130214] platform 1f00110000.csi: Fixed dependency cycle(s) with /axi/pcie@120000/rp1/i2c@88000/ov5647@36
[    5.397222] rp1-cfe 1f00110000.csi: found subdevice /axi/pcie@120000/rp1/i2c@88000/ov5647@36
[    5.463006] rp1-cfe 1f00110000.csi: Using sensor ov5647 6-0036 for capture

Additional details (revisions used, host distro, etc.):

I've also tried switching libcamera recipe to https://github.com/raspberrypi/libcamera repo. Result is the same: no cameras available.

al1img avatar Mar 30 '24 18:03 al1img

I was able to run libcamera-apps successfully but I am currently struggling for preview window. What is missing in the libcamera recipe is libpisp which is required for pi5 and these changes are not yet up-streamed.

AshishShrikhande2408 avatar Jan 11 '25 09:01 AshishShrikhande2408

I was able to run libcamera-apps successfully but I am currently struggling for preview window. What is missing in the libcamera recipe is libpisp which is required for pi5 and these changes are not yet up-streamed.

What did you do to get libcamera-apps to detect your cam? I'm in the same boat...

OK, guess I figured it out, for RPi5 (and CM5 variants) libpisp is needed as an IPA / processing pipeline, this isn't (yet) upstreamed to upstream libcamera, support for it only lives in rpidistro libcamera, nor is there a recipe for libpisp yet in the rpi layer.

gizahNL avatar Mar 14 '25 10:03 gizahNL

I'll write up a draft MR where libcamera can be pulled from rpi-distro sources as an option and be build with libpisp

gizahNL avatar Mar 14 '25 10:03 gizahNL

I had success using that version: https://github.com/openembedded/meta-openembedded/blob/scarthgap/meta-multimedia%2Frecipes-multimedia%2Flibcamera%2Flibcamera_0.4.0.bb

thomas-roos avatar Mar 14 '25 10:03 thomas-roos

I had success using that version: https://github.com/openembedded/meta-openembedded/blob/scarthgap/meta-multimedia%2Frecipes-multimedia%2Flibcamera%2Flibcamera_0.4.0.bb

I tried upgrading libcamera to upstream 0.4.0 before commenting here, it didn't seem to fix it for me, I've just created a PR which does fix it for me.

gizahNL avatar Mar 14 '25 13:03 gizahNL

This bbappend is not good: https://github.com/agherzan/meta-raspberrypi/blob/master/dynamic-layers/multimedia-layer/recipes-multimedia/libcamera/libcamera_%25.bbappend

RPI5 has a new hardware block (pisp), and vc4 does not apply; pre-RPI5.

Yocto master does not allow auto-wrapping for meson projects, so a seperate libpisp recipe is required. Also the build variable -Dipas= is not being set. Not having a signed ipa module causes it to run in a sandbox, slowing performance. Also LIBCAMERA_PIPELINES as default - auto will cause many un-needed drivers to be built/load/enumerate; unneeded bloat.

The meta-oe multimedia libcamera recipe should rename LIBCAMERA_PIPELINES to LIBCAMERA_EXTRA, and directly set both pipelines and ipas variables; e.g -Dpipelines=rpi/pisp -Dipas=rpi/pisp, with a default value of -Dpipelines=auto; thus not breaking anything.

We also should consider the note in this section https://www.raspberrypi.com/documentation/accessories/camera.html#connecting-the-cameras

Meaning we should be appending ,always-on in /boot/config.txt based on the camera type.

e.g.

dtoverlay=imx477,always-on

I almost have it working with master + libcamera/pisp tip of tree, hitting Unable to acquire a CFE instance. https://github.com/raspberrypi/libcamera/issues/298

jwinarske avatar Aug 23 '25 00:08 jwinarske

@agherzan I have cameras working on a raspberrypi5 with meta-raspberrypi master.

  • If you attempt to use upstream libcamera on master with rpi5 it will fail with Unable to acquire a CFE instance
  • Use of the raspberrypi linux kernel requires using the raspberrypi5 libcamera fork, next branch. It will not work with the oe-core libcamera recipe as-is in master; not tested else where but pretty sure this is the case for all other branches.
  • Adding a libpisp recipe was required.

I propose the following changes to meta-raspberrypi master:

  1. rpi-libcamera recipe. Uses the raspberrypi libcamera fork, next branch.
  2. libpisp recipe.
  3. Set PREFERRED_PROVIDER_libcamera=rpi-libcamera

Let me know if that works, if so I will submit the PR.

jwinarske avatar Aug 25 '25 22:08 jwinarske

@jwinarske look at: https://github.com/agherzan/meta-raspberrypi/pull/1436 ;)

Haven't had time yet to make the requested changes (holidays + OSS Europe now), somewhere next week most likely.

gizahNL avatar Aug 26 '25 06:08 gizahNL