Pi camera module 3 - libcamera cant detect camera

I broke my old pi camera module 2 which I had hooked up to octoprint for print monitoring/timelapses. I broke it basically the same week that the pi camera module 3 came out, and thought that the autofocus would be really nice. So, I bought one to replace it.

Long story short, after months of troubleshooting, I cannot for the life of me get libcamera to detect the camera. libcamera-hello comes back with ERROR: *** no cameras available *** ; and cam -l just says available cameras: with nothing to follow.

I thought that the OS updates just lagged the release a bit, so here I am 6 months later and still no luck. I think imx708 drivers are installed, as I remember running some sort of command with | grep imx and imx708 was on the list it returned.

I tried a fresh install of dietpi on a separate microSD card and reinstalled libcamera and had the same issue. I imaged it with raspbian and it worked perfectly on the first boot up. That rules out any ribbon cable issues and hardware issues. Seems to me like something I’m missing with the DietPi OS.

Any ideas? Thanks in advance!

Required Information

  • DietPi version | G_DIETPI_VERSION_CORE=8
    G_DIETPI_VERSION_SUB=18
    G_DIETPI_VERSION_RC=2
    G_GITBRANCH=‘master’
    G_GITOWNER=‘MichaIng’

  • Distro version | bullseye 0

  • Kernel version | Linux DietPi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux

  • Architecture | armhf

  • SBC model | RPi 4 Model B (aarch64)

  • Power supply used | 5V 1A RAVpower

  • SD card used | 32GB SanDisk extreme

Additional Information (if applicable)

  • Software title | libcamera
  • Was the software title installed freshly or updated/migrated? both
  • Can this issue be replicated on a fresh installation of DietPi? yes
  • /boot/config.txt under RPi camera module:
    - start_x=1
    - camera_auto_detect=1 (have also tried with camera_auto_detect=0 with no luck)
    -dietpi config:
    - RPi Codecs: [On]
    - RPi Camera: [On]

Steps to reproduce

  1. libcamera-hello

Expected behaviour

should be getting a short video clip of live camera (when using the lite desktop)

Actual behaviour

[31:16:57.607391446] [26928] INFO Camera camera_manager.cpp:299 libcamera v0.0.4+22-923f5d70
ERROR: *** no cameras available ***

Extra details

Using pi camera module 3
Does not work on my current dietpi install
does not work on new SD card with fresh dietpi install
WORKS on fresh install of raspbian

maybe something @MichaIng could have a look in.

Did you enabled I2C and the camera module in dietpi-config? Also the shared GPU memory should be raised, when using the camera module. (can also be done with dietpi-config).

And what gives you vcgencmd get_camera?

Thanks, yes I2C is enabled, camera module is enabled.

vcgencmd get_camera returns:
supported=1 detected=0 libcamera interfaces=1

Interestingly, if i change /boot/config.txt to say camera_auto_detect=0, then run the vcgencmd, I get:
supported=1 detected=1 libcamera interfaces=0

In either case, I still get the same result of no available camera from cam -l or libcamera_hello.

This looks promising.

I checked the official wiki.
https://www.raspberrypi.com/documentation/computers/camera_software.html#getting-started
Can you make sure (dietpi-config > Display Options) that you are using vc4-fkms-v3d or vc4-kms-v3d.
Can you also provide the full output of /boot/config.txt

cat /boot/config.txt

I am not really sure where in dietpi-config that i set vc4-fkms-v3d or vc4-kms-v3d

I did find in the /boot/config.txt #dtoverlay=vc4-kms-v3d, and I tried uncommenting that and rebooting, but still the same error.

# Docs: https://www.raspberrypi.com/documentation/computers/config_txt.html
# Overlays: https://github.com/raspberrypi/firmware/blob/13fbbc4f5ea698353486915986de8b48f18018f6/boot/overlays/README

#-------Display---------
# Max allocated framebuffers: Set to "0" in headless mode to reduce memory usage
# - Defaults to "2" on RPi4 and "1" on earlier RPi models
#max_framebuffers=0

# If you get no picture, set the following to "1" to apply most compatible HDMI settings.
#hdmi_safe=1

# Uncomment to adjust the HDMI signal strength if you have interferences, blanking, or no display.
# - Ranges from "0" to "11", use values above "7" only if required, e.g. with very long HDMI cable.
# - Default on first RPi1 A/B is "2", else "5", on RPi4 this setting is ignored.
#config_hdmi_boost=5

# Uncomment if HDMI display is not detected and composite is being outputted.
#hdmi_force_hotplug=1

# Uncomment to disable HDMI even if plugged, e.g. to force composite output.
#hdmi_ignore_hotplug=1

# Uncomment to force a console size. By default it will be display's size minus overscan.
#framebuffer_width=1280
#framebuffer_height=720

# Uncomment to enable SDTV/composite output on RPi4. This has no effect on previous RPi models.
#enable_tvout=1
# SDTV mode
#sdtv_mode=0

# Uncomment to force a specific HDMI mode (this will force VGA).
#hdmi_group=1
#hdmi_mode=1

# Uncomment to force an HDMI mode rather than DVI. This enables HDMI audio in DMT modes.
#hdmi_drive=2

# Set "hdmi_blanking=1" to allow the display going into standby after 10 minutes without input.
# With default value "0", the display shows a blank screen instead, but will not go into standby.
# NB: Some legacy OpenMAX applications (OMXPlayer) cannot wake screens from real standby.
hdmi_blanking=1

# Set to "1" if your display has a black border of unused pixels visible.
disable_overscan=1

# Uncomment the following to adjust overscan.
# Use positive numbers if console goes off screen, and negative if there is too much border.
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# Rotation
#display_hdmi_rotate=0
#lcd_rotate=0

#-------RPi camera module-------
start_x=1
#disable_camera_led=1
camera_auto_detect=0

#-------GPU memory splits-------
gpu_mem_256=128
gpu_mem_512=128
gpu_mem_1024=128

#-------Boot splash screen------
disable_splash=1

#-------Onboard sound-----------
dtparam=audio=on

#-------I2C-------------
dtparam=i2c_arm=on
#dtparam=i2c_arm_baudrate=100000

#-------SPI-------------
#dtparam=spi=off

#-------Serial/UART-----
# NB: "enable_uart=1" will enforce "core_freq=250" on RPi models with onboard WiFi.
enable_uart=1

#-------SD card HPD-----
# Comment to enable SD card hot-plug detection, while booting via USB or network.
# NB: This causes constant CPU load and kernel errors when no SD card is inserted.
dtparam=sd_poll_once

#-------Overclock-------
temp_limit=75
initial_turbo=20

#over_voltage=0
#arm_freq=1500
#core_freq=500

#over_voltage_min=0
#arm_freq_min=300
#core_freq_min=250
#sdram_freq_min=400
dtoverlay=disable-wifi
#dtoverlay=imx708
#dtoverlay=vc4-kms-v3d

Under Display options.

But in the file output you posted it is still commented. But anyway, try to change it via dietpi-config.

Yes, sorry. I commented it out again after trying both dtoverlay=vc4-kms-v3d and dtoverlay=vc4-fkms-v3d, which both did not change the errors i received. The file output i posted was after i tried both options, they did nothing, so i changed it back.

Also, I changed it via dietpi-config. Still receiving the same error with no “Available cameras:” listed with cam -l

Got it figured out. It seems like the combination of all of these settings in the /boot/config.txt file are important:

start_x=1
camera_auto_detect=0
dtoverlay=imx708
dtoverlay=vc4-kms-v3d

up until this point, I’ve had each of those set, but not all at the same time. It seems like they all must be set this way to work.

Thanks for your help @Jappe!

1 Like

It is modern vs legacy camera interface:

  • The legacy camera interface, still used/needed for some camera software, requires start_x=1 to be set and does not work if KMS is enabled, but only with the legacy framebuffer graphics stack (no dtoverlay=vc4-kms-v3d).
  • The modern camera stack only works with KMS (dtoverlay=vc4-kms-v3d) enabled. camera_auto_detect=1 enables modern camera support in a generic way, so the camera model is automatically detected and no dedicated overlay needs to be enabled explicitly.

I am not sure about fake KMS (dtoverlay=vc4-fkms-v3d), to be true, whether it allows cameras to work the modern or legacy way or both or none.

In your case, settings are a little contradicting. I guess it works only because you explicitly enabled the overlay for your particular camera model (dtoverlay=imx708), together with KMS, which might override the legacy extended firmware flag start_x=1, or the latter does not break the modern one, but is just unnecessary. However, this is the cleanest way it should work:

dtoverlay=vc4-kms-v3d
camera_auto_detect=1

or

dtoverlay=vc4-kms-v3d
dtoverlay=imx708

start_x=1 should be commented, removed or set to start_x=0.

I aim since a longer time to add a choice for legacy vs modern camera support, but didn’t find the time yet to implement it: DietPi-Config | RPi: Add modern RPi camera module support · Issue #5127 · MichaIng/DietPi · GitHub