OV5647 Camera Timeout No Image

Camera model
I've tried two different cameras, one is this one

and the other appears to be a generic OV5647 style.

What is the problem?
On CLI, the camera "times out" and never shows any images. In Octopi stream, it's just black. Never any image data.

What did you already try to solve it?

In a nutshell:

  • Updated everything - apt update
  • raspi-config to enable legacy camera
  • Used multi-meter to continuity check every pin of the ribbon cable
  • Ensured ribbon cable plugged in correctly on Rpi board and camera module
  • Tested 2 different cameras
  • Ensured 5v/2a power supply
  • Over-volt'd pi core from 1.2 to 1.3
  • Enabled/disabled Galmor (no effect)
  • Enabled i2c
  • Rebooted many, many times

Logs

This is using legacy camera mode:

# libcamera-jpeg --list-cameras
ERROR: the system appears to be configured for the legacy camera stack

# vcgencmd get_camera
supported=1 detected=1, libcamera interfaces=0

# raspistill -o foo.jpg
Camera control callback  cmd=0x4f525245
mmal: No data received from sensor. Check all connections, including the Sunny one on the camera board
mmal: Aborting program

This is non-legacy mode:

# vcgencmd get_camera
supported=1 detected=0, libcamera interfaces=1

# libcamera-hello -v3
Options:
    verbose: 3
    info_text:#%frame (%fps fps) exp %exp ag %ag dg %dg
    timeout: 5000
    width: 0
    height: 0
    output:
    post_process_file:
    rawfull: 0
    preview: default
    qt-preview: 0
    transform: identity
    roi: all
    metering: centre
    exposure: normal
    ev: 0
    awb: auto
    flush: false
    wrap: 0
    brightness: 0
    contrast: 1
    saturation: 1
    sharpness: 1
    framerate: 30
    denoise: auto
    viewfinder-width: 0
    viewfinder-height: 0
    tuning-file: (libcamera)
    lores-width: 0
    lores-height: 0
    autofocus-range: normal
    autofocus-speed: normal
    autofocus-window: all
    mode: unspecified
    viewfinder-mode: unspecified
    metadata:
    metadata-format: json
No connector ID specified.  Choosing default from list:
Connector 32 (crtc 0): type 11, 0x0
Preview window unavailable
Running without preview window
Opening camera...
[0:10:40.808067847] [889]  INFO Camera camera_manager.cpp:299 libcamera v0.0.3+40-9b860a66
[0:10:40.893928921] [890]  INFO RPI raspberrypi.cpp:1425 Registered camera /base/soc/i2c0mux/i2c@1/ov5647@36 to Unicam device /dev/media3 and ISP device /dev/media0
Acquired camera /base/soc/i2c0mux/i2c@1/ov5647@36
Configuring viewfinder...
Viewfinder size chosen is 1296x972
[0:10:40.895901679] [889]  INFO Camera camera.cpp:1028 configuring streams: (0) 1296x972-YUV420
[0:10:40.896591139] [890]  INFO RPI raspberrypi.cpp:805 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 1296x972-SGBRG10_1X10 - Selected unicam format: 1296x972-pGAA
Camera streams configured
Available controls:
    AeEnable : [false..true]
    ExposureTime : [92..760636]
    ScalerCrop : [(0, 0)/128x128..(0, 0)/2592x1944]
    AnalogueGain : [1.000000..63.937500]
    AeMeteringMode : [0..3]
    ColourGains : [0.000000..32.000000]
    ExposureValue : [-8.000000..8.000000]
    Sharpness : [0.000000..16.000000]
    Contrast : [0.000000..32.000000]
    NoiseReductionMode : [0..4]
    FrameDurationLimits : [23123..760729]
    Brightness : [-1.000000..1.000000]
    AwbMode : [0..7]
    AwbEnable : [false..true]
    ColourCorrectionMatrix : [-16.000000..16.000000]
    AeExposureMode : [0..3]
    Saturation : [0.000000..32.000000]
    AeConstraintMode : [0..3]
Buffers allocated and mapped
Viewfinder setup complete
Requests created
Camera started!
[0:10:42.562570200] [890]  WARN V4L2 v4l2_videodevice.cpp:2007 /dev/video0[12:cap]: Dequeue timer of 1520000.00us has expired!
[0:10:42.562782069] [890] ERROR RPI raspberrypi.cpp:1875 Unicam has timed out!
[0:10:42.562869827] [890] ERROR RPI raspberrypi.cpp:1876 Please check that your camera sensor connector is attached securely.
[0:10:42.562955658] [890] ERROR RPI raspberrypi.cpp:1877 Alternatively, try another cable and/or sensor.
ERROR: Device timeout detected, attempting a restart!!!
Camera stopped!
Requests created
Camera started!

The last 8 lines of the output above repeat every 5s until ctrl-c

In both cases, legacy/non-legacy, using either program caused the little led on both camera modules to light up. But then no data was seemingly received from the camera and the timeout errors were shown. Pressing ctrl-c to cancel either program made the light go off.

Additional information about your setup

  • Raspberry Pi 3B v1.2
  • Octopi (whatever latest version downloaded via Rpi Imager as of 3hrs ago)
# lsb_release -a
No LSB modules are available.
Distributor ID:	Raspbian
Description:	Raspbian GNU/Linux 11 (bullseye)
Release:	11
Codename:	bullseye

# uname -a
Linux dragonface 5.15.84-v7+ #1613 SMP Thu Jan 5 11:59:48 GMT 2023 armv7l GNU/Linux

I'm happy to provide and/or test any crazy configs or help from the community. I've been at this for a solid 4hrs and am wits-end.

Try going into /boot/config.txt and commenting out the following:
#camera_auto_detect=1
reboot

I did that and this is the result:

$ libcamera-hello --list-cameras
No cameras available!

It should be noted in my massive output above, that the cameras are properly detected, so disabling camera detection makes them no longer visible.

One additional test I did today was to connect each camera to a Rasberry Pi Zero W. Using the same SD card as on the 3b, the cameras worked perfectly on the Zero W. The issue is specifically with the 3b.

I hate to say this, but I suggest going back one revision of Octopi/Octoprint at this time. I think the latest and greatest version isn't quite ready for primetime for cameras.

Download this version:
OctoPi 0.18.0 with OctoPrint 1.8.6 (build 20221018093204)

Extract it, and use the Pi imager, scroll down to the bottom of "Choose Operating System" to "Use Custom (Select custom .img from your computer)".

You won't be using the libcamera libraries, just the old ffmpeg (which works). From there I wrote up a guide for Picam's and the OV5647 motorized focusing camera here:
Raspberry Pi Camera Module V2.1 only 640 x 480 mode

As for the IR settings... You got me there, as I don't have that option with my camera.

Well, I don't think it's Octopi. I used the official latest Raspian image and got the same result. Both cameras worked fine on the Pi Z W, neither worked on the 3b. I used the same SD on both so I know it's not a software-related issue.

I didn't mention anything about IR, nor do I plan on using IR with octopi. Would that be so you can film in the dark?

Using legacy camera mode? I tried that too on the 3b. Same result, even with the legacy raspicam software.

If it works just fine using libcamera, latest everything on the Pi Z W, why would I need to use older software on the 3b? Shouldn't the same software work there too?

I'm suggesting it as a process of elimination. There have been big changes from "Buster" to "Bullseye" Raspian builds, especially in regard to cameras and different Pi boards.

The link I gave, uses "Buster" Raspian-lite, and that has been around for a while that it has matured, and a lot of bugs/issues have been ironed out.

If, that fails, then I would be looking at a hardware issue on your 3B. Your 3B just might have a bad camera port (it happens) or a bad ribbon cable.

I mentioned the IR, because you linked to a Night Vison camera which uses infrared. Some of those cameras you can toggle some software settings to improve daytime images and do other things.

Also, these little cameras and the camera port are REALLY susceptible to static electricity. So, there is a good possibility that the port is fried sadly.

Well, I did as you suggested and tried your linked version of Octoprint, and followed your guide. End result was the same.

pi@raspicam:~ $ raspistill -o file.jpg
Camera control callback  cmd=0x4f525245mmal: No data received from sensor. Check all connections, including the Sunny one on the camera board
^Cmmal: Aborting program

Interestingly, the little LED on the camera lights up as if everything is ok, but after 5s or so, you get the message above.

I guess at this point it is a hardware issue with this 3b board since both cameras work just fine on my Pi Z W using the latest 'bullseye' based image. I have another 3b board that runs my media center. I'll try swapping them this weekend and see if the cameras work on that board. If not, then something really funky is going on.

Ugh. So frustrating. I tried the older software linked above on a 3b (original) and 1 of the two cameras worked just fine. So I tried that camera on the 3b+ using same SD card and no joy. Boggles the mind. Both cameras worked fine on the Pi Zero W with latest software, only 1 camera worked on 3B with older software, neither camera works on 3B+ with older & newer software.

I have one more 3B+ in my inventory (currently functioning as media center) to try to truly see if this is a hardware issue.