Raspberry Pi 5 and Arducams

its probably because the example is using too many buffers.
find the method
cam.configureStill(width, height, formats::BGR888, 1, 0);
the third parameter, 1 in my case is number of buffers, yours is probably 4, set it to 1
no actually in your case its the variable buffer_count=4 on row 699 in method create_preview_configuration

u cant have that many buffers at max res on 64mp

myself had such issue that when i tried to run my c++ code i got error:

[1:37:46.727672352] [2588]  INFO Camera camera.cpp:1183 configuring streams: (0) 9152x6944-BGR888
[1:37:46.727826852] [2590]  INFO RPI pisp.cpp:1397 Sensor: /base/axi/pcie@120000/rp1/i2c@80000/arducam_64mp@1a - Selected sensor format: 9152x6944-SRGGB10_1X10 - Selected CFE format: 9152x6944-PC1R
[1:37:49.459734129] [2590] ERROR V4L2 v4l2_videodevice.cpp:1697 /dev/video34[49:cap]: Failed to queue buffer 2: Invalid argument
[1:37:49.459870721] [2590] ERROR RPISTREAM rpi_stream.cpp:276 Failed to queue buffer for ISP Output1

since libcamera-jpeg worked just fine then i compared its full output to the errored ouput

[1:35:52.275891309] [2548]  INFO Camera camera.cpp:1183 configuring streams: (0) 9152x6944-YUV420 (1) 9152x6944-RGGB16_PISP_COMP1
[1:35:52.283990476] [2551]  INFO RPI pisp.cpp:1397 Sensor: /base/axi/pcie@120000/rp1/i2c@88000/arducam_64mp@1a - Selected sensor format: 9152x6944-SRGGB10_1X10 - Selected CFE format: 9152x6944-PC1R

and i noticed that my code was using BGR888 but libcamera-jpeg used YUV420 after chaning pixel format to YUV420 I wasnt getting the error anymore.

Some folks over on picamera2 helped me not get errors and it indeed was about changing the type of buffer to YUV

so i can do this
capture_config = picam2.create_still_configuration(main={“size”: (9152, 6944), “format”: “YUV420”}, buffer_count=1)

and it works but i have to convert that YUV file to something

though it led to an inconsistency between @Edward 's example of the full res data speed

in their example they have that you can capture full res images to memory once every 2 seconds or so

but when i tried this, it would take8-9 seconds

it turned out i could just add a really long timer (25 seconds) after start, and then i could take the photo in just 3 seconds!

I know the image isn’t actually exposing for 3 seconds, so it would be nice to find a way to turn on my lights just for the time the pixels are actually being exposed to save electricity in the field

How should we properly configure it to work on Pi5 Bookworm? Is there a PiVariety packages for Pi5? Thanks.

1 Like

i just followed @henri 's instructions above

1 Like

if u look edwards c++ example its constantly polling frameData from the sensor. u only need to turn on lights when capture starts and turn them off once frameData has been read to memory. Also if u still want to capture RGB i think its possible to capture 2 images at smaller res and pass crop rectangle to libcamera and then combine the left and right image into one afterwards.

anyways whats the lightson() function in python? u have a camera that has flash integrated into it or using additional lightsource?

what is the 25 seconds for?

yeah i implemented edward’s example, but with the capture_array but it still took 3-4 seconds

the reason for the 25 second wait is because after the camera starts it needs to sit and set up all its stuff, or else when you go to capture_array for the first image it will take like 10 seconds

if you check out our thread here, you will see some good advanced ways to capture a photo and reduce the time spent actually leaving lights on

2 Likes

the power supply was not the issue. tested with official RPI power supply and undervoltage errors disappeared. the lines appeared due to fluorescent tube light in the ceiling. kinda similar how when shutter speed is in sync with helicopter blade the appear not moving but if they are off the blade seem moving in weird way on video. turning off the light fixed the problem.

1 Like

its the interference pattern of the fluorescent tube light in the ceiling

I tried this in a RP5 4GB and is not working in the following version of OS

  • Linux raspberrypi 6.1.0-rpi7-rpi-2712 #1 SMP PREEMPT Debian 1:6.1.63-1+rpt1 (2023-11-24) aarch64 (the default from bookworm lite available online)
  • Linux raspberrypi 6.1.0-rpi8-rpi-2712 #1 SMP PREEMPT Debian 1:6.1.73-1+rpt1 (2024-01-25) aarch64 (the version available today 2024-01-31)

That tell me that something that change during this time is breaking the camera, additionally to the fact that /boot/config.txt was moved to /boot/firmware/config.txt

my config.txt is still in the boot folder
what camera are you using?

Arducam 64mp from Arducam (arducam-64mp hawkeyes)

FYI: i also tried the camera in another raspberry (3) and is working

from http://rptl.io/configtxt :

Blockquote
Prior to Bookworm , Raspberry Pi OS stored the boot partition at /boot/ . Since Bookworm , the boot partition is located at /boot/firmware/ .

ok yeah u are correct but i still have symlink config.txt → firmware/config.txt in the boot folder.

you are saying u followed my guide and your camera still not working?
how is it not working, what error are u getting?

send me contents of your config.txt and
sudo dmesg | grep arducam

Exactly. the camera work in RP3 (with another cable for compatibility) but doesn’t work in RP5 with the original and new UC-376 cable from Arducam.

x@raspberrypib1:~ $ libcamera-still --list-cameras
No cameras available!
x@raspberrypib1:~ $ dmesg | grep -i arducam
[    2.577933] rp1-cfe 1f00128000.csi: found subdevice /axi/pcie@120000/rp1/i2c@80000/arducam_64mp@1a
[    2.698772] arducam_64mp 4-001a: failed to read chip id 4136, with error -5
[    2.700619] arducam_64mp: probe of 4-001a failed with error -5

the content of my config.txt

 #For more options and information see
# http://rptl.io/configtxt
# Some settings may impact device functionality. See link above for details

# Uncomment some or all of these to enable the optional hardware interfaces
dtparam=i2c_arm=on
dtparam=i2s=on
dtparam=spi=on
dtparam=i2c1=on
dtparam=i2c4=on

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

# Additional overlays and parameters are documented
# /boot/firmware/overlays/README

# Automatically load overlays for detected cameras
camera_auto_detect=1

# Automatically load overlays for detected DSI displays
display_auto_detect=1

# Automatically load initramfs files, if found
auto_initramfs=1

# Enable DRM VC4 V3D driver
dtoverlay=vc4-kms-v3d
max_framebuffers=2

# Don't have the firmware create an initial video= setting in cmdline.txt.
# Use the kernel's default instead.
disable_fw_kms_setup=1

# Run in 64-bit mode
arm_64bit=1

# Disable compensation for displays with overscan
disable_overscan=1

# Run as fast as firmware / board allows
arm_boost=1

[cm4]
# Enable host mode on the 2711 built-in XHCI USB controller.
# This line should be removed if the legacy DWC2 controller is required
# (e.g. for USB device mode) or if USB support is not required.
otg_mode=1

[all]
dtoverlay=vc4-kms-v3d,cma-512
dtoverlay=arducam-64mp

FYI, the output of i2detect . From this post should be only the motor who is recognized? but if Im unplug the camera is still there…

x@raspberrypib1:~ $ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --  
x@raspberrypib1:~ $ sudo i2cdetect -y 4
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- UU -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --   

I recheck in the RP3 and the camera and motor are there…

raspberry@raspberrypi:~ $ i2cdetect -y 11
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- UU -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --  

but similar to the RP5 , when I remove the camera, RP3 is still reserving c00 … I’m confuse

i dont know then, only thing i can reccommend is to try everything from scratch, reflash and reinstall drivers/tools with the python scripts…
maybe try desktop instead of lite os this time and see what happens. if still not work u need to get help from arducam people