Radxa IMX219 camera

Hi, I’m trying to activate the Radxa IMX219 camera, but my Dragon board doesn’t detect it. Has anyone had the same issue?

Yes I faced the same initially. You need to strictly follow the instructions here in the wiki, starting from the dtb overlays setup (please carefully check the connector number) to the setup of the YAML file in qcam and launch of qcam to see your camera’s image displayed in a window. I got the camera to display up to 960x720 at 60 FPS, then above it would progressively slow down a little bit (e.g. 56 FPS at 1024x768, I counted a limit of around 44M pixels/s).

You will never get a usable /dev/video0 device, this thing only works via libcamera and the qcam utility that comes with it. There will be some sub-devices (e.g. some controls are listed with “v4l2-ctl -l -d /dev/v4l-subdev27”), not sure if they’re usable.

By the way, issuing “dmesg | grep imx” under kernel 6.18.2-3 should show you something like this:

[   18.210863] imx219 18-0010: supply VANA not found, using dummy regulator
[   18.210933] imx219 18-0010: supply VDIG not found, using dummy regulator
[   18.210951] imx219 18-0010: supply VDDL not found, using dummy regulator

Overall I was quite disappointed because I thought a regular program relying on v4l2 could use this camera and that’s not the case (at least on this board). There’s “libcamerify” which is an ugly wrapper based on LD_PRELOAD which didn’t work with any of the utilities I tried (honestly, as any such wrapper usually). Thus I’ll turn to a USB camera for my experiments to stop wasting my time on code porting, and might reconsider trying to port to this libcamera once my project finally works.

Hi. Everything is works.

My workflow:

  1. Follow instruction from Getting Started — libcamera
  2. Turn on Dgstreamer=enabled and continue install from instruction Radxa Camera 8M 219 | Radxa Docs

meson setup build --wipe \
-Dpipelines=simple \
-Dcam=enabled \
-Dgstreamer=enabled \
-Dv4l2=enabled \
-Dlc-compliance=disabled \
-Dqcam=enabled

  1. In python .venv modify pyvenv.cfg file (include-system-site-packages = true) for use ubunto open cv lib that include Dgstreamer suport, after do code “sudo apt install python3-opencv”
  2. To find your cameras name run “gst-device-monitor-1.0 Video/Source” or “cam -l“ and you should have something like this:

[6:49:07.421346922] [81483] INFO Camera camera_manager.cpp:340 libcamera v0.7.1+35-2bace926
[6:49:07.450042956] [81484] WARN CameraSensor camera_sensor_legacy.cpp:355 ‘imx219 21-0010’: Recommended V4L2 control 0x009a0922 not supported
[6:49:07.450130300] [81484] WARN CameraSensor camera_sensor_legacy.cpp:427 ‘imx219 21-0010’: The sensor kernel driver needs to be fixed
[6:49:07.450146811] [81484] WARN CameraSensor camera_sensor_legacy.cpp:429 ‘imx219 21-0010’: See Documentation/sensor_driver_requirements.rst in the libcamera sources for more information
[6:49:07.451756709] [81484] WARN CameraSensor camera_sensor_legacy.cpp:595 ‘imx219 21-0010’: Failed to retrieve the camera location
[6:49:07.451799730] [81484] WARN CameraSensor camera_sensor_legacy.cpp:617 ‘imx219 21-0010’: Rotation control not available, default to 0 degrees
[6:49:07.458292813] [81484] INFO IPAProxy ipa_proxy.cpp:184 Using tuning file /usr/local/share/libcamera/ipa/simple/imx219.yaml
[6:49:07.461391932] [81484] INFO Camera camera_manager.cpp:223 Adding camera ‘/base/soc@0/cci@ac4b000/i2c-bus@1/camera@10’ for pipeline handler simple
Available cameras:
1: ‘imx219’ (/base/soc@0/cci@ac4b000/i2c-bus@1/camera@10)

where is my camera name /base/soc@0/cci@ac4b000/i2c-bus@1/camera@10

  1. Create file /usr/local/share/libcamera/ipa/simple/imx219.yaml with settings from exemple

My python:

import cv2
import time
import libcamera as lc
#print(cv2.getBuildInformation())
# Define the GStreamer pipeline that talks to libcamera

# This automatically handles the Qualcomm ISP and converts it to BGR for OpenCV

gstreamer_pipeline = (
'libcamerasrc camera-name=“/base/soc@0/cci@ac4b000/i2c-bus@1/camera@10” ! ’
'video/x-raw, width=640, height=480 ! ’ # Set your desired resolution here
'videoconvert ! ’
'video/x-raw, format=BGR ! ’ # OpenCV expects BGR format
‘appsink drop=true max-buffers=1 emit-signals=true sync=false’
)

# Pass the pipeline string to OpenCV instead of an integer index
cap = cv2.VideoCapture(gstreamer_pipeline, cv2.CAP_GSTREAMER)
if not cap.isOpened():
print(“Error: Could not open camera pipeline via GStreamer.”)
exit()
# Video properties for the output file

frame_width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
frame_height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
fps = 30.0 # Matching the framerate from our input pipeline
# 3. Initialize VideoWriter (Using XVID codec for an .avi container, or mp4v for .mp4)
fourcc = cv2.VideoWriter_fourcc(*‘mp4v’)
out = cv2.VideoWriter(‘output_10s.mp4’, fourcc, fps, (frame_width, frame_height))
print(“Recording starting now for 10 seconds…”)
start_time = time.time()
frame_count = 0
try:
while True:
ret, frame = cap.read()
if not ret:
print(“Error: Failed to grab frame.”)
break
# Write the frame to the output file
out.write(frame)
frame_count += 1
# Check if 10 seconds have passed
elapsed_time = time.time() - start_time
if elapsed_time >= 10.0:
print(f"Finished! Recorded {frame_count} frames in {elapsed_time:.2f} seconds.")
break
finally:
# 4. Clean up everything safely
cap.release()
out.release()
cv2.destroyAllWindows()
print(“Video saved as ‘output_10s.mp4’”)

Hi Radxa team,

I am opening a new topic regarding the IMX219 camera on the Dragon Q6A.

I have been debugging this for quite some time and wanted to share the results of my testing.

Test 1: Basic libcamera Preview

gst-launch-1.0 libcamerasrc ! videoconvert ! autovideosink


Result:

WARN IPAManager ipa_manager.cpp:154 No IPA found in '/usr/lib/aarch64-linux-gnu/libcamera'
WARN CameraSensor camera_sensor.cpp:248 'imx219 20-0010': Recommended V4L2 control 0x009a0922 not supported
WARN CameraSensor camera_sensor.cpp:315 'imx219 20-0010': The sensor kernel driver needs to be fixed

ERROR:
streaming stopped, reason not-negotiated (-4)


The IMX219 sensor is detected, but the stream fails immediately.


Test 2: Direct V4L2 Bayer Test

gst-launch-1.0 v4l2src device=/dev/video0 ! \
video/x-bayer,format=bggr10,width=640,height=480 ! \
bayer2rgb ! videoconvert ! waylandsink


Result:

WARNING: erroneous pipeline:
could not link v4l2src0 to bayer2rgb0,
neither element can handle caps
video/x-bayer, format=(string)bggr10


This suggests the Bayer format exposed by the camera cannot be handled by the pipeline.


Test 3: libcamera Debug Logging

LIBCAMERA_LOG_LEVELS=Camera:DEBUG \
gst-launch-1.0 libcamerasrc ! fakesink


Result:

DEBUG Camera camera.cpp:1118 streams configuration:
(0) 640x480-SRGGB10_CSI2P

CRITICAL:
Unsupported media type: video/x-bayer

ERROR:
streaming stopped, reason not-negotiated (-4)


Additional GStreamer errors:

gst_structure_set: assertion 'structure != NULL' failed
gst_caps_get_structure: assertion 'index < GST_CAPS_LEN (caps)' failed
gst_event_new_caps: assertion 'gst_caps_is_fixed (caps)' failed
gst_pad_push_event: assertion 'GST_IS_EVENT (event)' failed


The stream is configured as:

640x480-SRGGB10_CSI2P


but GStreamer reports that video/x-bayer is unsupported and the pipeline terminates.


Additional Information

The camera is consistently detected as:

imx219 20-0010


and libcamera consistently reports:

Recommended V4L2 control 0x009a0922 not supported
The sensor kernel driver needs to be fixed
Failed to retrieve the camera location
Rotation control not available, default to 0 degrees


Summary

From what I can tell:

  • IMX219 is detected successfully.

  • libcamera can configure a raw Bayer stream (640x480-SRGGB10_CSI2P).

  • GStreamer fails during caps negotiation.

  • video/x-bayer appears to be the common point of failure.

  • All tested pipelines end with not-negotiated (-4).

Has anyone successfully brought up an IMX219 on the Dragon Q6A?

Are there additional kernel packages, firmware files, device-tree changes, ISP components, or newer builds required to get the camera working?

Any guidance would be greatly appreciated.

Thanks.

post by NANTHINI 2 mins ago

NANTHINI

2m

If you want to try it now, download the pre-built debs manually:

enable hardware-encoder:
https://docs.radxa.com/en/dragon/q6a/faq#why-does-q6a-reboot-immediately-when-using-the-hardware-encoder

https://github.com/chenchongbiao/libcamera/actions/runs/27256200300/artifacts/7527665865

Installation:

    unzip libcamera.zip
    cd libcamera
    sudo apt update
    sudo apt install ./*.deb
    sudo apt install -y gstreamer1.0-tools gstreamer1.0-plugins-base

Hardware-encoded recording examples:

    # H.264 1080p
    gst-launch-1.0 -e libcamerasrc \
        ! videoconvert ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1 \
        ! v4l2h264enc ! h264parse ! mp4mux \
        ! filesink location=/tmp/camera-h264.mp4

    # H.265 1080p
    gst-launch-1.0 -e libcamerasrc \
        ! videoconvert ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1 \
        ! v4l2h265enc ! h265parse ! mp4mux \
        ! filesink location=/tmp/camera-h265.mp4

    # Full resolution 3272×2464 H.264
    gst-launch-1.0 -e libcamerasrc \
        ! video/x-raw,width=3272,height=2464,framerate=30/1 \
        ! queue ! videoconvert ! video/x-raw,format=NV12 \
        ! queue ! v4l2h264enc ! h264parse ! mp4mux \
        ! filesink location=/tmp/camera-8mp.mp4


This was posted by Radxa team on the comment secction. This one still gives a black screen (or 0 B file).
Any Idea abut which part should i work on?
If any clear overview can be given, it would be preferred.
can @dmytro.lishchynskyi give your review on this.