raspberrypi / picamera2

New libcamera based python library
BSD 2-Clause "Simplified" License
889 stars 188 forks source link

[BUG] Official Rasp Pi Cam v2.1 has Started to Not Respond (Dequeue timer of 1000000.00us has expired!) #873

Open MSaviorTR opened 11 months ago

MSaviorTR commented 11 months ago

Hello everyone! I just encountred an issue. I was using my Official Raspberry Pi Camera v2.1 (IMX219) on Rasp Pi 4 (Bullseye) with picamera2 and it started to not respond. I have tried it with another Rasp Pi 4 (Bookworm) and it couldn't solve the problem. I just wonder that is about hardware or something else like shortcircuit etc. I also changed the CSI cable. What could be the issue if it is about hardware?

Some details:

mehdi@raspberrypi:~ $ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
mehdi@raspberrypi:~ $ uname -a
Linux raspberrypi 6.1.0-rpi6-rpi-v8 #1 SMP PREEMPT Debian 1:6.1.58-1+rpt2 (2023-10-27) aarch64 GNU/Linux
mehdi@raspberrypi:~ $ apt list python3-picamera2
Listing... Done
python3-picamera2/stable,stable,now 0.3.14-1 all [installed]
mehdi@raspberrypi:~ $ libcamera-hello --version
libcamera-apps build: f8b05c47894c 23-10-2023 (09:45:08)
libcamera build: v0.1.0+99-4a23664b

I'm using my Rasp Pi 4 directly not remotely and it is desktop environment. I didn't change anything about configuration on Rasp Pi, I have done a clean OS installation. The ribbon cable was 20cm and I have changed it too with 30cm new one.

I share with you some codes and their outputs.

Code:

libcamera-hello --list-cameras

Output:

Available cameras
-----------------
0 : imx219 [3280x2464 10-bit RGGB] (/base/soc/i2c0mux/i2c@1/imx219@10)
    Modes: 'SRGGB10_CSI2P' : 640x480 [206.65 fps - (1000, 752)/1280x960 crop]
                             1640x1232 [41.85 fps - (0, 0)/3280x2464 crop]
                             1920x1080 [47.57 fps - (680, 692)/1920x1080 crop]
                             3280x2464 [21.19 fps - (0, 0)/3280x2464 crop]
           'SRGGB8' : 640x480 [206.65 fps - (1000, 752)/1280x960 crop]
                      1640x1232 [83.70 fps - (0, 0)/3280x2464 crop]
                      1920x1080 [47.57 fps - (680, 692)/1920x1080 crop]
                      3280x2464 [21.19 fps - (0, 0)/3280x2464 crop]

Code:

libcamera-hello

Output:

Made X/EGL preview window
[0:17:02.894240160] [2375]  INFO Camera camera_manager.cpp:284 libcamera v0.1.0+99-4a23664b
[0:17:02.956052281] [2379]  WARN RPiSdn sdn.cpp:39 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[0:17:02.958270878] [2379]  WARN RPI vc4.cpp:390 Mismatch between Unicam and CamHelper for embedded data usage!
[0:17:02.959262075] [2379]  INFO RPI vc4.cpp:444 Registered camera /base/soc/i2c0mux/i2c@1/imx219@10 to Unicam device /dev/media1 and ISP device /dev/media0
[0:17:02.959378815] [2379]  INFO RPI pipeline_base.cpp:1142 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
Mode selection for 1640:1232:12:P
    SRGGB10_CSI2P,640x480/0 - Score: 4504.81
    SRGGB10_CSI2P,1640x1232/0 - Score: 1000
    SRGGB10_CSI2P,1920x1080/0 - Score: 1541.48
    SRGGB10_CSI2P,3280x2464/0 - Score: 1718
    SRGGB8,640x480/0 - Score: 5504.81
    SRGGB8,1640x1232/0 - Score: 2000
    SRGGB8,1920x1080/0 - Score: 2541.48
    SRGGB8,3280x2464/0 - Score: 2718
Stream configuration adjusted
[0:17:02.961646282] [2375]  INFO Camera camera.cpp:1181 configuring streams: (0) 1640x1232-YUV420 (1) 1640x1232-SBGGR10_CSI2P
[0:17:02.962187853] [2379]  INFO RPI vc4.cpp:608 Sensor: /base/soc/i2c0mux/i2c@1/imx219@10 - Selected sensor format: 1640x1232-SBGGR10_1X10 - Selected unicam format: 1640x1232-pBAA
[0:17:04.054080068] [2379]  WARN V4L2 v4l2_videodevice.cpp:2007 /dev/video0[17:cap]: Dequeue timer of 1000000.00us has expired!
[0:17:04.054175105] [2379] ERROR RPI pipeline_base.cpp:1374 Camera frontend has timed out!
[0:17:04.054197512] [2379] ERROR RPI pipeline_base.cpp:1375 Please check that your camera sensor connector is attached securely.
[0:17:04.054219827] [2379] ERROR RPI pipeline_base.cpp:1376 Alternatively, try another cable and/or sensor.
ERROR: Device timeout detected, attempting a restart!!!

Code:

from picamera2 import Picamera2

picam2 = Picamera2()
picam2.start()
picam2.capture_file("img.png")

Output:

[0:20:10.649153027] [2590]  INFO Camera camera_manager.cpp:284 libcamera v0.1.0+99-4a23664b
[0:20:10.694692664] [2593]  WARN RPiSdn sdn.cpp:39 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[0:20:10.696823378] [2593]  WARN RPI vc4.cpp:390 Mismatch between Unicam and CamHelper for embedded data usage!
[0:20:10.697605708] [2593]  INFO RPI vc4.cpp:444 Registered camera /base/soc/i2c0mux/i2c@1/imx219@10 to Unicam device /dev/media1 and ISP device /dev/media0
[0:20:10.697658078] [2593]  INFO RPI pipeline_base.cpp:1142 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
[0:20:10.700525678] [2590]  INFO Camera camera_manager.cpp:284 libcamera v0.1.0+99-4a23664b
[0:20:10.741728777] [2596]  WARN RPiSdn sdn.cpp:39 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[0:20:10.743346882] [2596]  WARN RPI vc4.cpp:390 Mismatch between Unicam and CamHelper for embedded data usage!
[0:20:10.744156101] [2596]  INFO RPI vc4.cpp:444 Registered camera /base/soc/i2c0mux/i2c@1/imx219@10 to Unicam device /dev/media1 and ISP device /dev/media0
[0:20:10.744209638] [2596]  INFO RPI pipeline_base.cpp:1142 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
[0:20:10.750426632] [2590]  INFO Camera camera.cpp:1181 configuring streams: (0) 640x480-XBGR8888 (1) 640x480-SBGGR10_CSI2P
[0:20:10.750922056] [2596]  INFO RPI vc4.cpp:608 Sensor: /base/soc/i2c0mux/i2c@1/imx219@10 - Selected sensor format: 640x480-SBGGR10_1X10 - Selected unicam format: 640x480-pBAA
[0:20:11.822363193] [2596]  WARN V4L2 v4l2_videodevice.cpp:2007 /dev/video0[15:cap]: Dequeue timer of 1000000.00us has expired!
[0:20:11.822458841] [2596] ERROR RPI pipeline_base.cpp:1374 Camera frontend has timed out!
[0:20:11.822481804] [2596] ERROR RPI pipeline_base.cpp:1375 Please check that your camera sensor connector is attached securely.
[0:20:11.822505044] [2596] ERROR RPI pipeline_base.cpp:1376 Alternatively, try another cable and/or sensor.

I hope you guys can suggest any solutions. Thank you.

davidplowman commented 11 months ago

Thanks for the report. When having trouble with cameras I always recommend starting with a new OS installation just to be 100% sure that nothing has been altered or configured differently. Install the latest image, and let it perform its updates when it first boots. Change absolutely nothing at all and try running libcamera-hello. Does that work?

It sounds like you've tried swapping out the Pi and the ribbon cable. Do you have a spare camera that you could try? It would also be worth checking the power supply - what kind are you using?

These kind of errors are usually down to cables, connections, power supplies and more infrequently hardware that's actually broken. So those are definitely the things to check out first. Thanks!

MSaviorTR commented 11 months ago

Thanks for your reply!

Yes, I did a pure installation with official Rasp Pi imager and the final image is installed. Nothing has been changed even any configuration and the 'libcamera-hello' gives an output like above.

I have another Official Rasp Pi Camera v2.1 NoIR and it is working with both ribbon and both Rasp Pi 4's. Power supply is also official product of Raspberry(5.1V 3A).

So, if it is about hardware, then there could be any solution for that?

Thanks a lot!

davidplowman commented 11 months ago

Well, if one imx219 is working and another isn't, with exactly the same software, pi and cables, then that's pretty clear cut, I think - the non-working one must have an actual fault. If it's still within the warranty period I would hope you should be able to get a replacement from the supplier where you bought it?

MSaviorTR commented 11 months ago

I bought it from a non-official supplier and it is not seen possible to find information about the warranty certificate or its duration. So, can I do anything on my own?

davidplowman commented 11 months ago

Hmm, I'm not sure. I think it's very unlikely you can fix anything yourself, and Raspberry Pi can't accept stuff back that we didn't sell. So I think you would need to find a way to get in touch with the supplier. For what it's worth, having a spare camera to hand is probably not a bad investment, it does make it easier to verify if a module has failed, and prevents you from having "downtime" without a working camera if this is important to your application. Sorry not to be more help.

MSaviorTR commented 11 months ago

Ok, thank you so much. I thought, I can do something on it but I guess, I couldn't find a solution to fix it.

MSaviorTR commented 11 months ago

Ok, thank you so much. I thought, I can do something on it but I guess, I couldn't find a solution to fix it.

Nichervanibs commented 8 months ago

I have the same problem looking everywhere and trying every video on youtube still did not got any solution mine is just like your did you solve the problem

MSaviorTR commented 8 months ago

I have the same problem looking everywhere and trying every video on youtube still did not got any solution mine is just like your did you solve the problem

Actually, problem was about the sensor or the tiny ribbon cable of the sensor. I have changed it (not the board) and it is working now. I suggest that do not implement any procedure on the board and try another sensor, if you have, by pluggin out the old one.