Hi, I’m trying to get my IMX219 camera working on a Raspberry Pi 4 and it just won’t start. I’m running the C example in RaspberryPi/Motorized_Focus_Camera/C (the ./manualFocus executable). After I got back from a trip it stopped starting the camera altogether. The last line I get is:
ERROR: *** failed to start camera ***
Any idea what’s going on? It used to work before. Do I need to change something in my config?
Hey, happy to help. First, can you confirm which camera module you’re actually using? Is it an Arducam IMX219, the standard Raspberry Pi camera, or something else? The reason I ask is that different modules can need different config entries.
Also, while you’re at it, could you paste the full terminal output you get when you run ./manualFocus? Not just the last line, the whole thing from the top. That will tell me a lot about what’s failing.
It’s an IMX219 lens on a Raspberry Pi 4. Here’s the full output:
~/Downloads/RaspberryPi/Motorized_Focus_Camera/C $ ./manualFocus
Hardare version: d03114
Please press up and down key
Made X/EGL preview window
[2:51:41.692786852] [16938] INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3544-22656360
[2:51:41.742723101] [16939] WARN RPI raspberrypi.cpp:1241 Mismatch between Unicam and CamHelper for embedded data usage!
[2:51:41.743403519] [16939] INFO RPI raspberrypi.cpp:1356 Registered camera /base/soc/i2c0mux/i2c@1/imx219@10 to Unicam device /dev/media2 and ISP device /dev/media0
[2:51:41.744204546] [16938] INFO Camera camera.cpp:1029 configuring streams: (0) 1640x1232-YUV420
[2:51:41.744635022] [16939] INFO RPI raspberrypi.cpp:760 Sensor: /base/soc/i2c0mux/i2c@1/imx219@10 - Selected sensor format: 1640x1232-SBGGR10_1X10 - Selected unicam format: 1640x1232-pBAA
[2:51:42.873448161] [16939] ERROR V4L2 v4l2_videodevice.cpp:1852 /dev/video0[16:cap]: Failed to start streaming: Input/output error
ERROR: *** failed to start camera ***
I haven’t really tried anything yet, I don’t know where to start.
Thanks, that output is really useful. A couple of things stand out: libcamera detects and registers the sensor fine (imx219@10 on the Unicam device), configures the streams, picks the formats, and then dies at the V4L2 layer with Failed to start streaming: Input/output error on /dev/video0.
One thing I want to rule out first: did you ever add a dtoverlay entry for your sensor in /boot/config.txt? On a Pi 4 with these Arducam IMX219 modules, the sensor usually has to be explicitly enabled there. If the overlay isn’t set, the sensor can register with libcamera but still fail to stream exactly like this.
Can you open /boot/config.txt and tell me what camera-related lines are in it?
Hmm, I’m not sure. Where exactly should I look? Do you mean the lines that start with dtoverlay=? There are a few in there and I don’t know which ones matter. Can you tell me which one I’m supposed to have for an IMX219?
Yes, the lines starting with dtoverlay=. That’s the mechanism that tells the Pi which camera sensor is attached and how it’s wired.
For an IMX219 you’d normally have something like dtoverlay=xxxx (the exact name depends on your specific module and driver, so please check the one that matches your camera rather than copying blindly). Also make sure you don’t have a conflicting entry (like camera_auto_detect=0 with no matching overlay, or two overlays for the same CSI port).
So, to summarize what I need from you:
Which camera are you using? (you said IMX219, just confirming)
Have you enabled your sensor by adding dtoverlay=xxxx in /boot/config.txt?
Paste the camera-related lines from your /boot/config.txt.
Once I see those I can point you at the right next step.
That’s very likely the source of the problem. There’s no camera dtoverlay enabled at all in that file, so even though libcamera can see and register the imx219@10 sensor, the sensor isn’t properly enabled at the platform level, which is consistent with the V4L2 Failed to start streaming: Input/output error you’re seeing.
Try adding the correct overlay for your IMX219 module under the [all] section, for example dtoverlay=xxxx (use the overlay name that matches your exact camera module, not a guess), then reboot.
Before you do that, can you also tell me a bit more about the hardware? Specifically:
The exact model/marking on the camera module or its adapter board
Which CSI port it’s connected to on the Pi 4
What OS image you’re running (uname -a and the output of cat /etc/os-release if you can)
I want to make sure I give you the right overlay name rather than sending you down another dead end.
OK, I can grab those. But before I go editing things, are you sure the missing dtoverlay is the cause? The camera clearly shows up in the log as a registered camera, so it seems weird that it’s not enabled. Is there any other reason it could fail at the streaming step?
Fair question. Registration and streaming are two different stages. libcamera registering the sensor just means the sensor was detected on the I2C bus and a media pipeline was built. Actually starting the stream goes through the V4L2/Unicam capture path, and that’s the part that requires the sensor to be properly enabled and configured via the overlay. That’s why you can get a clean registration and then an Input/output error the moment it tries to start capturing on /dev/video0.
So I’m not confirming the root cause yet, it’s the leading suspect, not a proven answer. There could be other contributors (wrong overlay name for the module, bad/loose ribbon cable, conflicting overlays, wrong CSI port, a libcamera/driver mismatch), which is exactly why I’m asking for the hardware details and OS version before you change anything.
Go ahead and send me the camera module model, which CSI port it’s on, and the OS info, and we’ll take it from there.
Perfect, that matches everything in your log. To wrap up where we are for now:
Status: root cause not yet confirmed, we’re still gathering info.
Leading suspect: the sensor isn’t enabled because there’s no dtoverlay=xxxx camera entry in /boot/config.txt. That lines up with libcamera seeing imx219@10 but V4L2 failing with Failed to start streaming: Input/output error and the app printing failed to start camera.
Next steps: confirm your exact module model, add the correct dtoverlay=xxxx under [all] in /boot/config.txt, reboot, then re-run ./manualFocus and paste the full output again.
If it still fails after adding the right overlay, post the new log and we’ll check for cable/port issues and any conflicting overlays.
No fix is confirmed yet, so don’t be surprised if the first overlay name doesn’t do it, just send the results back and we’ll keep digging.