Libcamera works on 16MP IMX519 single camera but not on 16MP IMX519 Quad Camera Kit

  1. Where did you get the camera module(s)?
    Amazon US

  2. Model number of the product(s)?

  • Arducam 16MP Autofocus Quad-Camera Kit for Raspberry Pi, 16MP IMX519 Autofocus Synchronized Raspberry Pi Camera, Compatible with Nvidia Jetson Nano/Xavier NX
  • 1x Arducam 16MP IMX519 Autofocus Camera
  1. What hardware/platform were you working on?
    Raspberry Pi 4 (8GB), Buster OS

  2. Instructions you have followed. (link/manual/etc.)
    Cytron Arducam IMX519 Tutorial for Raspberry Pi Buster OS

  3. Problems you were having?
    After installing the camera driver as the tutorial, I am able to run the IMX519 camera using libcamera-still --autofocus. I expected the same to happen when I change the camera to the IMX519 Quad Camera Kit. This is the output when I ran the same command using the Quad Camera Kit

[0:12:40.372187163] [2922]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0
[0:12:40.406252271] [2924]  WARN CameraSensorProperties camera_sensor_properties.cpp:141 No static properties available for 'imx519'
[0:12:40.406372028] [2924]  WARN CameraSensorProperties camera_sensor_properties.cpp:143 Please consider updating the camera sensor properties database
[0:12:40.532135609] [2924] ERROR DelayedControls delayed_controls.cpp:87 Delay request for control id 0x009a090a but control is not exposed by device /dev/video0
[0:12:40.536880624] [2922]  INFO Camera camera.cpp:937 configuring streams: (0) 2328x1748-YUV420
[0:12:40.537833000] [2924]  INFO RPI raspberrypi.cpp:122 Mode: 4656x3496 fmt RG10 Score: 2519 (best 2519)
[0:12:40.537935832] [2924]  INFO RPI raspberrypi.cpp:122 Mode: 3840x2160 fmt RG10 Score: 2148.24 (best 2148.24)
[0:12:40.537980999] [2924]  INFO RPI raspberrypi.cpp:122 Mode: 2328x1748 fmt RG10 Score: 1500 (best 1500)
[0:12:40.538023072] [2924]  INFO RPI raspberrypi.cpp:122 Mode: 1920x1080 fmt RG10 Score: 3819.24 (best 1500)
[0:12:40.538064590] [2924]  INFO RPI raspberrypi.cpp:122 Mode: 1280x720 fmt RG10 Score: 5819.24 (best 1500)
[0:12:40.538110145] [2924]  INFO RPI raspberrypi.cpp:122 Mode: 4656x3496 fmt pRAA Score: 2019 (best 1500)
[0:12:40.538151645] [2924]  INFO RPI raspberrypi.cpp:122 Mode: 3840x2160 fmt pRAA Score: 1648.24 (best 1500)
[0:12:40.538192422] [2924]  INFO RPI raspberrypi.cpp:122 Mode: 2328x1748 fmt pRAA Score: 1000 (best 1000)
[0:12:40.538233569] [2924]  INFO RPI raspberrypi.cpp:122 Mode: 1920x1080 fmt pRAA Score: 3319.24 (best 1000)
[0:12:40.538274273] [2924]  INFO RPI raspberrypi.cpp:122 Mode: 1280x720 fmt pRAA Score: 5319.24 (best 1000)
[0:12:40.538574843] [2924]  INFO RPI raspberrypi.cpp:624 Sensor: /base/soc/i2c0mux/i2c@1/imx519@1a - Selected mode: 2328x1748-pRAA
[0:12:40.595522958] [2928]  INFO IPARPI raspberrypi.cpp:633 Request ctrl: AfTrigger = 1
[0:12:40.595764863] [2928]  INFO IPARPI raspberrypi.cpp:633 Request ctrl: Sharpness = 1.000000
[0:12:40.595884120] [2928]  INFO IPARPI raspberrypi.cpp:633 Request ctrl: Saturation = 1.000000
[0:12:40.595943231] [2928]  INFO IPARPI raspberrypi.cpp:633 Request ctrl: Contrast = 1.000000
[0:12:40.596032211] [2928]  INFO IPARPI raspberrypi.cpp:633 Request ctrl: Brightness = 0.000000
[0:12:40.596089025] [2928]  INFO IPARPI raspberrypi.cpp:633 Request ctrl: FrameDurationLimits = [ 33333, 33333 ]
[0:12:40.596213042] [2928]  INFO IPARPI raspberrypi.cpp:633 Request ctrl: NoiseReductionMode = 3
[0:12:40.596360170] [2928]  INFO IPARPI raspberrypi.cpp:633 Request ctrl: AeMeteringMode = 0
[0:12:40.596528075] [2928]  INFO IPARPI raspberrypi.cpp:633 Request ctrl: AeExposureMode = 0
[0:12:40.596587130] [2928]  INFO IPARPI raspberrypi.cpp:633 Request ctrl: ExposureValue = 0.000000
[0:12:40.596654444] [2928]  INFO IPARPI raspberrypi.cpp:633 Request ctrl: AwbMode = 0
[0:12:40.598863601] [2924]  INFO RPISTREAM rpi_stream.cpp:122 No buffers available for ISP Output0
[0:12:40.598937693] [2924]  INFO RPISTREAM rpi_stream.cpp:122 No buffers available for ISP Output0
[0:12:40.598972470] [2924]  INFO RPISTREAM rpi_stream.cpp:122 No buffers available for ISP Output0
  1. The dmesg log from your hardware?
    This is the output when I ran the command dmesg | grep -E "imx477|imx219|arducam|imx519"
[    5.960389] imx519 10-001a: Device found is imx519
[   31.710452] imx519_vddl: disabling
[   31.710466] imx519_vdig: disabling
[   31.710475] imx519_vana: disabling

This is the output when I ran the command uname -a

Linux raspberrypi 5.10.17-v8+ #1414 SMP PREEMPT Fri Apr 30 13:23:25 BST 2021 aarch64 GNU/Linux

This is the output when I ran the command cat /etc/os-release

PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

This is the output when I ran the command cat /proc/meminfo

MemTotal:        7947692 kB
MemFree:         5137520 kB
MemAvailable:    6035236 kB
Buffers:           49860 kB
Cached:          1218808 kB
SwapCached:            0 kB
Active:           565912 kB
Inactive:        1853804 kB
Active(anon):       1228 kB
Inactive(anon):  1454384 kB
Active(file):     564684 kB
Inactive(file):   399420 kB
Unevictable:      200844 kB
Mlocked:              96 kB
SwapTotal:        102396 kB
SwapFree:         102396 kB
Dirty:               304 kB
Writeback:             0 kB
AnonPages:       1351760 kB
Mapped:           331908 kB
Shmem:            304568 kB
KReclaimable:      58060 kB
Slab:             100904 kB
SReclaimable:      58060 kB
SUnreclaim:        42844 kB
KernelStack:        7296 kB
PageTables:        24932 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     4076240 kB
Committed_AS:    5276008 kB
VmallocTotal:   262930368 kB
VmallocUsed:       13880 kB
VmallocChunk:          0 kB
Percpu:              704 kB
CmaTotal:         262144 kB
CmaFree:          223620 kB

This is the output when I ran the command cat /boot/config.txt

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

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
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

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

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

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

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

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

# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18

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

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

# Enable DRM VC4 V3D drive
dtoverlay=vc4-kms-v3d
max_framebuffers=2
arm_64bit=1
dtoverlay=imx519
start_x=1
gpu_mem=128

  1. Troubleshooting attempts you’ve made?
    To ensure that it is not hardware error, I tried the same Quad Camera Kit on my Jetson Nano and the output works as expected when visualized from gstreamer.

  2. What help do you need?
    Please provide guidance to properly install the driver to make the camera work on the Rasp Pi 4 (BusterOS) as I require this particular OS to run ROS.

Hi,
I’m sorry to tell you that we do not support the kernel version you are using. You can check the suitable version in the link below:
https://github.com/ArduCAM/Arducam-Pivariety-V4L2-Driver/releases/download/install_script/imx519_kernel_driver_low_speed_links.txt

Hey Dion,
I have reinstalled a kernel & its corresponding driver using the txt file above. This is the error that I get after running the command libcamera-still -t 0, and the libcamera-app GUI shows a blank/black output.

Made X/EGL preview window
[0:03:54.403915584] [1811]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3866-0c55e522
[0:03:54.424611600] [1812]  WARN CameraSensorProperties camera_sensor_properties.cpp:174 No static properties available for 'imx519'
[0:03:54.424706827] [1812]  WARN CameraSensorProperties camera_sensor_properties.cpp:176 Please consider updating the camera sensor properties database
[0:03:54.455802121] [1812]  INFO RPI raspberrypi.cpp:1374 Registered camera /base/soc/i2c0mux/i2c@1/imx519@1a to Unicam device /dev/media3 and ISP device /dev/media0
[0:03:54.456610320] [1811]  INFO Camera camera.cpp:1035 configuring streams: (0) 2328x1748-YUV420
[0:03:54.457087751] [1812]  INFO RPI raspberrypi.cpp:761 Sensor: /base/soc/i2c0mux/i2c@1/imx519@1a - Selected sensor format: 2328x1748-SRGGB10_1X10 - Selected unicam format: 2328x1748-pRAA
[0:04:17.154646314] [1812]  WARN V4L2 v4l2_videodevice.cpp:1803 /dev/video0[17:cap]: Zero sequence expected for first frame (got 2)
[0:04:17.154897004] [1812]  WARN V4L2 v4l2_videodevice.cpp:1803 /dev/video1[18:cap]: Zero sequence expected for first frame (got 2)
[0:04:17.155895910] [1816] ERROR IPARPI cam_helper.cpp:181 Embedded data buffer parsing failed
[0:04:32.047853642] [1816] ERROR IPARPI cam_helper.cpp:181 Embedded data buffer parsing failed
[0:04:32.748057825] [1816] ERROR IPARPI cam_helper.cpp:181 Embedded data buffer parsing failed
[0:04:44.576254153] [1816] ERROR IPARPI cam_helper.cpp:181 Embedded data buffer parsing failed

This is the output when I ran the command dmesg | grep -E "imx477|imx219|arducam|imx519"

[    9.380303] imx519 10-001a: Device found is imx519
[    9.384052] imx519 10-001a: Consider updating driver imx519 to match on endpoints

This is the output when I ran the command uname -a

Linux raspberrypi 5.15.61-v7l+ #1579 SMP Fri Aug 26 11:13:03 BST 2022 armv7l GNU/Linux

This is the output when I ran the command cat /proc/meminfo

MemTotal:        8088492 kB
MemFree:         6822296 kB
MemAvailable:    7207744 kB
Buffers:           25920 kB
Cached:           754988 kB
SwapCached:            0 kB
Active:           216420 kB
Inactive:         760652 kB
Active(anon):       1476 kB
Inactive(anon):   380000 kB
Active(file):     214944 kB
Inactive(file):   380652 kB
Unevictable:      141640 kB
Mlocked:              16 kB
HighTotal:       7458816 kB
HighFree:        6317368 kB
LowTotal:         629676 kB
LowFree:          504928 kB
SwapTotal:        102396 kB
SwapFree:         102396 kB
Dirty:               324 kB
Writeback:             0 kB
AnonPages:        337816 kB
Mapped:           316464 kB
Shmem:            185312 kB
KReclaimable:      21484 kB
Slab:              44832 kB
SReclaimable:      21484 kB
SUnreclaim:        23348 kB
KernelStack:        2760 kB
PageTables:        12000 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     4146640 kB
Committed_AS:    2615120 kB
VmallocTotal:     245760 kB
VmallocUsed:        6148 kB
VmallocChunk:          0 kB
Percpu:              448 kB
CmaTotal:         327680 kB
CmaFree:          287696 kB

This is the output when I ran the command cat /boot/config.txt

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

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=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

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

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

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

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

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

# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18

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

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

# Automatically load overlays for detected cameras
camera_auto_detect=1

# Automatically load overlays for detected DSI displays
display_auto_detect=1

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

# Disable compensation for displays with overscan
disable_overscan=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]

[pi4]
# Run as fast as firmware / board allows
arm_boost=1

[all]
dtoverlay=imx519

Appreciate any help!

Hi,
Please install the libcamera from Arducam website:
https://docs.arducam.com/Raspberry-Pi-Camera/Native-camera/Libcamera-User-Guide/

And then try the libcamera command again to see if the problem is solved.

Hey Dion, it works now. Thank you!

I have one more question. After setting up libcamera-app, I need a python API to retrieve the video streams, this is what I have tried. Can you please point me to a right direction?

I have followed this how-to-use-code-to-access-libcamera-c-python tutorial.

This is the output when I ran python3 capture_demo.py

[0:19:31.039913866] [3292]  WARN IPAManager ipa_manager.cpp:149 No IPA found in '/usr/local/lib/arm-linux-gnueabihf/libcamera'
[0:19:31.040294770] [3292]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0
[0:19:31.062477062] [3293]  WARN CameraSensorProperties camera_sensor_properties.cpp:141 No static properties available for 'imx519'
[0:19:31.062559709] [3293]  WARN CameraSensorProperties camera_sensor_properties.cpp:143 Please consider updating the camera sensor properties database
[0:19:31.062928465] [3293] ERROR RPI raspberrypi.cpp:1030 Failed to load a suitable IPA library
Segmentation fault

@yqchau

I have followed this how-to-use-code-to-access-libcamera-c-python tutorial.

This topic is no longer recommended and I have unpinned it. If other users accidentally use it later, I will consider deleting this post.

If you use libcamera_python.zip in the post, please delete it first

sudo apt remove libcamera

You can refer to the tutorial in the link below to use
https://docs.arducam.com/Raspberry-Pi-Camera/Native-camera/PiCamera2-User-Guide/

Hey Edward, I have already spent too much time figuring this out and I need help for Python API access to the camera stream. I am currently using Buster OS because I need it for ROS 1, so please guide me on how can I have access to the legacy Python APIs.

uname -a

Linux raspberrypi 5.10.63-v7l+ #1496 SMP Wed Dec 1 15:58:56 GMT 2021 armv7l GNU/Linux

cat /etc/os-release

PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

I have installed the camera driver using https://github.com/ArduCAM/Arducam-Pivariety-V4L2-Driver/releases/download/install_script/imx519_kernel_driver_low_speed_links.txt, and Libcamera using the official website libcamera and libcamera-apps - Arducam Wiki.

The Libcamera versions from dpkg -l | grep libcamera

ii  libcamera-apps                         0.0.4                                   armhf        libcamera-apps
ii  libcamera-dev                          0.0.3                                   armhf        libcamera

Currently, the camera and autofocus works well when I ran libcamera-still -t 5000 --autofocus.

I need an API, ideally in Python for me to bridge it over to a ROS node. If the libcamera command is working well, there’s no way that there isnt an easy way for me to have access to the camera stream…

Appreciate any help.

@yqchau

Do you have the following version installed?

Since this has been deprecated, I strongly discourage its use.

But I will try it for you, on your system version, and give you a reference of the whole process.

1 Like

Hey @Edward, yes I have installed libcamera-1.0.1. I know and have tried Bullseye OS + Picamera and it works seamlessly, but unfortunately I need to run on Buster.

I appreciate your time & help, hope to hear back soon.

Hey @Edward, I haven’t heard back from you since. Are there any updates from your side?

@yqchau

This support is indeed a bit troublesome. Now I have finally prepared the environment and am testing it.

1 Like

Hey @Edward, just in case a C++ API makes your life easier, I would accept it as an alternative. Otherwise, Python is still preferred.

Thank you!

@yqchau

I tried it, and there are indeed some problems. I’ll investigate further and let you know.

Hi @yqchau,

I adapted for kernel version 5.10.63
Please try this:
libcamera-1.0.1-cp37-cp37m-manylinux_2_28_armv7l.whl (2.7 MB)

Hey @Edward,

The wheel file is not compatible with my system.

python3 -m pip install libcamera-1.0.1-cp37-cp37m-manylinux_2_28_armv7l.whl

Error:

libcamera-1.0.1-cp37-cp37m-manylinux_2_28_armv7l.whl is not a supported wheel on this platform.

Could it be that my kernel is Linux raspberrypi 5.10.63-v7l+ instead of Linux raspberrypi 5.10.63-v7l?

Hi @yqchau ,

This happens because the pip version is a bit old.
Please update it:

pip3 install -U pip

Hey @Edward, we’re one step closer but unfortunately I’m still unable to get the video streams from the API.

This is what I have done after successful installation of libcamera, which is following this particular tutorial.

git clone https://github.com/ArduCAM/RaspberryPi
cd RaspberryPi
git checkout legacy_version

cd Motorized_Focus_Camera
sudo chmod +x enable_i2c_vc.sh
./enable_i2c_vc.sh

## Reboot ##
cd RaspberryPi/Motorized_Focus_Camera/python
python3 Autofocus.py

The error message is:

mmal: mmal_vc_component_create: failed to create component 'vc.ril.camera' (1:ENOMEM)
mmal: mmal_component_create_core: could not create component 'vc.ril.camera' (1)
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/picamera/camera.py", line 456, in _init_camera
    self._camera = mo.MMALCamera()
  File "/usr/lib/python3/dist-packages/picamera/mmalobj.py", line 2279, in __init__
    super(MMALCamera, self).__init__()
  File "/usr/lib/python3/dist-packages/picamera/mmalobj.py", line 633, in __init__
    prefix="Failed to create MMAL component %s" % self.component_type)
  File "/usr/lib/python3/dist-packages/picamera/exc.py", line 184, in mmal_check
    raise PiCameraMMALError(status, prefix)
picamera.exc.PiCameraMMALError: Failed to create MMAL component b'vc.ril.camera': Out of memory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "Autofocus.py", line 41, in <module>
    camera = picamera.PiCamera()
  File "/usr/lib/python3/dist-packages/picamera/camera.py", line 431, in __init__
    self._init_camera(camera_num, stereo_mode, stereo_decimate)
  File "/usr/lib/python3/dist-packages/picamera/camera.py", line 460, in _init_camera
    "Camera is not enabled. Try running 'sudo raspi-config' "
picamera.exc.PiCameraError: Camera is not enabled. Try running 'sudo raspi-config' and ensure that the camera has been enabled.

Note that I have already enabled camera in sudo raspi-config. I really would appreciate it if you can give me a more comprehensive guide on how I can get the video streams…

@yqchau

Try using the examples in the compressed package directly.
The examples in the RaspberryPi repository have been upgraded to picamera2. is not compatible.

@Edward,

There are no examples nor any python source code in the unzipped wheel directory.