[RDK X5] Integrating Sony IMX296 Global Shutter Sensor

[RDK X5] Integrating Sony IMX296 Global Shutter Sensor: VIN RAW capture OK, need guidance on HW ISP tuning profile, 54MHz MCLK configuration, and BPU zero-copy pipeline

Hello, We are integrating a Sony IMX296 (Global Shutter, 1440x1080 @ 30/60fps, RAW10, 1-lane MIPI CSI-2) sensor on the RDK X5 board. The primary use-case is real-time high-speed object detection and tracking with YOLO running on the BPU. Global Shutter is strictly required to eliminate rolling shutter distortion at high target velocities.
We have achieved raw data acquisition via the VIN block, but we are facing blockers with the Hardware ISP, MCLK configuration, and direct zero-copy feeding into the BPU.

  1. Hardware & System Setup
  • Board: D-Robotics RDK X5 (Horizon X5 SoC, BPU Platform v1.3.6, HBRT v3.15.55.0, DNN v1.24.5)

  • Sensor: Sony IMX296 (Mono/Color, 1440x1080, 1-lane MIPI CSI-2, Bayer RGGB)

  • Interface: I2C Bus 6 (Address 0x1a), MIPI RX PHY 0

  • Framework: Hobot Multimedia Framework (multimedia_samples, libcam.so, libimx296.so, srcampy)

    What Works

    1. I2C Communication & Initialization:

      • Custom sensor shared library (libimx296.so) successfully built and loaded under index 47.

      • I2C register writes/reads on bus 6 at 0x1a execute without errors.

    2. VIN DMA Capture:

      • Direct acquisition via get_vin_data -s 47 captures raw frames stably (1440x1080, RAW10, 16-bit stride 2880, frame size 3110400 bytes).
    3. Software Debayer & Stream:

      • Software processing (manual BLC subtraction = 60 LSB, OpenCV cv::cvtColor(..., COLOR_BayerRG2BGR)) yields valid, clean image frames and streams properly via HTTP.

Issue A: Hardware ISP & VSE Pipeline Crash

When running single_pipe_vin_isp_vse -s 47, the pipeline fails to retrieve frames from VSE channels due to null memory buffers:

Using index:47 sensor_name:imx296-1440x1080-60fps config_file:linear_1440x1080_raw10_60fps_2lane.c
[INFO] RDK board_id is 302, so skip csi test for index 1 and index 3
mipi mclk is not configed.
Searching camera sensor on device: /proc/device-tree/soc/cam/vcon@0 i2c bus: 6 mipi rx phy: 0
INFO: Found sensor_name:imx296-1440x1080-60fps on mipi rx csi 0, i2c addr 0x1a, config_file:linear_1440x1080_raw10_60fps_2lane.c
csi0 ignore mclk ex attr, because not config mclk.
hbn_vnode_set_ochn_attr: 0, 1440x1080
hbn_vnode_set_ochn_attr: 1, 512x480
hbn_vnode_set_ochn_attr: 2, 224x224
hbn_vnode_set_ochn_attr: 3, 64x64
hbn_vnode_set_ochn_attr: 4, 480x480
hbn_vnode_set_ochn_attr: 5, 2880x2160
hbn_vnode_getframe VSE channel 0 failed
hbn_vnode_getframe VSE channel 1 failed
hbn_vnode_getframe VSE channel 2 failed
[ERROR][utils/mem_log.c:94] [MEM_ALLOCATOR] <hb_mem_invalidate_buf_with_vaddr:3470> Invalid NULL virtual address.
=== Frame Info ===
Frame ID: 0
Buffer Index: 0
=== Graphic Buffer ===
Virtual Addresses: (nil) (nil) (nil)
Physical Addresses: 0 0 0

Issue B: srcampy.Camera() Auto-Probe Failure

Running mipi_camera.py scans standard sensors (sc230ai, imx219, imx477, etc.) and aborts with:

ERROR [CamInitParam][0283] No camera sensor found, please check whether the camera connection or video_idx is correct.
ERROR [OpenCamera][0495] CamInitParam failed error(-1)

Issue C: Host MCLK Configuration (24 MHz vs 54 MHz)

The mainline Linux / Raspberry Pi reference driver for IMX296 uses fixed PLL configurations for INCK:

  • 37.125 MHz (INCKSEL = {0x80, 0x0b, 0x80, 0x08}, CTRL418C = 116)

  • 54.000 MHz (INCKSEL = {0xb0, 0x0f, 0xb0, 0x0c}, CTRL418C = 168)

  • 74.250 MHz (INCKSEL = {0x80, 0x0f, 0x80, 0x0c}, CTRL418C = 232)

The RDK X5 default VPF environment outputs 24 MHz MCLK by default or shows csi0 ignore mclk ex attr, because not config mclk.

4.Configuring MCLK Output to 54 MHz:

What is the correct way on RDK X5 to configure the hardware MCLK pin to output 54 MHz (or 37.125 MHz)? Is this configured via vin_attr_ex_t (mclk_ex_attr.mclk_freq = 54000000) or does it require modifying the device tree / clock provider node?

  1. ISP Tuning Profile for Custom Sensors:

    The Hardware ISP pipeline fails because there is no tuning profile in /etc/cam/ or /usr/hobot/lib/sensor/ for IMX296. Is there a default/generic RAW10 Bayer profile available, or can we run the HW ISP in a basic bypass/linear mode without a full calibration binary?

  2. Recommended Zero-Copy Pipeline (VIN → BPU) without HW ISP:

    If the Hardware ISP cannot be used without a proprietary tuning profile, what is the official, lowest-latency architecture to route VIN DMA buffers (hb_mem / ION) directly into the BPU model input (hbDNNInfer with NV12 or RAW tensor) with minimal CPU overhead?

    3.Recommended Zero-Copy Pipeline (VIN → BPU) without HW ISP:

    If the Hardware ISP cannot be used without a proprietary tuning profile, what is the official, lowest-latency architecture to route VIN DMA buffers (hb_mem / ION) directly into the BPU model input (hbDNNInfer with NV12 or RAW tensor) with minimal CPU overhead?

Any reference examples, header configurations, or guidance would be greatly appreciated.

Hello

RDK X5 does not currently support IMX296, so the system does not include a corresponding ISP tuning file. Therefore, the error that occurs when single_pipe_vin_isp_vse is run directly is expected.

For example, the sensor configuration for IMX219 specifies the corresponding tuning file:

/app/multimedia_samples/vp_sensors/imx219/linear_1920x1080_raw10_30fps_2lane.c

static camera_config_t imx219_camera_config = {
        .name = "imx219",
        .addr = 0x10,
        .sensor_mode = 1,
        .fps = SENSOE_FPS,
        .format = RAW10,
        .width = SENSOR_WIDTH,
        .height = SENSOR_HEIGHT,
        .gpio_enable_bit = 0x01,
        .gpio_level_bit = 0x00,
        .mipi_cfg = &imx219_mipi_config,
        .calib_lname = "/usr/hobot/lib/sensor/imx219_1920x1080_tuning.json",
};

There is currently no dedicated tuning file for IMX296. For initial ISP pipeline functionality testing, you can use the file provided by the system:

/usr/hobot/lib/sensor/dummy_tuning.json

Note that dummy_tuning.json is intended primarily for pipeline verification. It has not been specifically tuned for IMX296, so image quality, color reproduction, black-level correction (BLC), auto white balance (AWB), and related results are not guaranteed.

Prerequisites for Adding a New Sensor and Running mipi_camera.py

The IMX219 sensor adaptation code is located at:

${BSP Code}/source/hobot-spdev/src/vp_sensors/imx219

After modifying or adding a sensor configuration, recompile hobot-spdev, install the generated .deb package, and then run the Python sample program for verification.

How Can MCLK Be Configured to 54 MHz?

The MIPI MCLK signal on RDK X5 passes through a TXS0104E level-shifting device. According to the official Texas Instruments specifications, the maximum data rate of the TXS0104E in push-pull mode is 24 MHz. Therefore, the existing RDK X5 hardware is not suitable for directly outputting a 54 MHz MCLK signal.

For CMOS sensors such as IMX296 that require a 54 MHz input clock, customers are advised to use one of the following solutions:

  • Add a PLL to the CMOS sensor module to multiply a lower-frequency MCLK signal up to 54 MHz.
  • Use a separate external oscillator on the CMOS sensor module to provide a 54 MHz clock.

Subject: RDK X5 — custom Sony IMX296 integration: VIN/RAW works, Python Camera Framework autodetect does not see sensor

We have successfully integrated Sony IMX296 on RDK X5 at the low-level Camera/VIN layer.

Working:

  • I2C6, address 0x1A

  • MIPI HOST0 / PHY0

  • external 54 MHz sensor clock

  • sensor HAL / imx296_utility.c

  • sensor_module_t

  • libimx296.so

  • cammod_imx296

  • vp_sensors

  • get_vin_data -s 42

  • RAW10 capture at 1456x1088, 60 fps

Problem:

  • Python hobot_vio/libsrcampy.so does not detect IMX296.

  • During open_cam(..., video_idx=-1, ...), Camera Framework scans sensors on I2C6/PHY0 and reports many supported sensors (sc1330t, imx219, imx477, etc.), but never reports imx296.

  • Runtime ends with No camera sensor found.

  • libimx296.so is present in /usr/hobot/lib/sensor/, exports cammod_imx296 and imx296, and has no unresolved dependencies.

We need help identifying the exact runtime registration/list mechanism used by the Python Camera Framework and determining why an already installed libimx296.so is not included in the autodetection candidates.

Please indicate the exact source file/configuration/package that must be modified/rebuilt to register a new sensor for libsrcampy/Python Camera API.

imx296_utility.c
imx296_setting.h
linear_1456x1088_raw10_60fps_1lane.c

get_vin_data -s 42
python test_cam.py
nm -D libimx296.so
ldd libimx296.so

IMX296_RDK_X5_integration_status_.pdf (90.4 KB)

A single RAW10 frame was successfully captured from VIN and dumped to a .raw file. However, the RAW data has not yet been decoded and visually validated. No PNG/RGB image has been produced yet.

To run mipi_camera.py, follow these steps:

1. Sync the BSP source code

First, sync the RDK X5 BSP source code on the development machine:

https://github.com/D-Robotics/x5-rdk-gen

2. Add the Sensor configuration

The prerequisite for running mipi_camera.py is that the new Sensor must first be registered in the vp_sensors list of hobot-spdev.

Using IMX219 as an example, its Sensor adaptation code is located at:

${BSP Code}/source/hobot-spdev/src/vp_sensors/imx219

When adding a new Sensor:

  • Add the corresponding Sensor configuration directory and configuration file under vp_sensors.
  • Declare the corresponding vp_sensor_config_t in vp_sensors.c.
  • Add the Sensor configuration to vp_sensor_config_list[].

Using IMX219 as an example:

extern vp_sensor_config_t imx415_linear_3480x2160_raw10_60fps_4lane;
extern vp_sensor_config_t sc850sl_linear_3840x2160_raw10_30fps_4lane;
extern vp_sensor_config_t shw3g_linear_2064x1552_raw12_30fps_4lane;
+extern vp_sensor_config_t imx219_linear_1920x1080_raw10_30fps_2lane;

vp_sensor_config_t *vp_sensor_config_list[] = {
        ...
        &imx415_linear_3480x2160_raw10_60fps_4lane,
        &sc850sl_linear_3840x2160_raw10_30fps_4lane,
        &shw3g_linear_2064x1552_raw12_30fps_4lane,
+       &imx219_linear_1920x1080_raw10_30fps_2lane,
};

Corresponding configuration file:

source/hobot-spdev/src/vp_sensors/imx219/
└── linear_1920x1080_raw10_30fps_2lane.c

Therefore, installing the Sensor HAL shared library alone is not sufficient. To allow mipi_camera.py / the Python Camera API to automatically scan and recognize the new Sensor, the Sensor must also be registered in hobot-spdev’s vp_sensor_config_list[].

3. Build hobot-spdev

After modifying the Sensor configuration, rebuild it from the BSP root directory:

cd ~/rdk_source_code/rdkx5_main
sudo ./mk_debs.sh hobot-spdev

A new hobot-spdev installation package will be generated after the build succeeds.

4. Install the hobot-spdev DEB package

The generated package is located at:

deploy/deb_pkgs/hobot-spdev_3.0.9-20260821120609_arm64.deb

Copy the .deb package to the RDK X5 and install it:

sudo dpkg -i hobot-spdev_3.0.9-20260821120609_arm64.deb

After installation, run the Python example again:

python3 mipi_camera.py

Hi, integrating an IMX296 camera on an RDK X5 V1.0 running RDK 3.5 / Ubuntu 22.04, and we need help finishing the integration.

Our final goal is to get:

IMX296 → VIN → ISP → VSE → NV12 → Python Camera → YOLO → tracking

with 1456×1088, RAW10, 60 FPS, a real color image, stable YOLO detection, and tracking.

What is already working:

  • IMX296 hardware is working.

  • I2C address: 0x1A

  • MIPI CSI: CSI0

  • The Python Camera API detects the sensor correctly:
    Found sensor name: imx296 ...

  • IMX296 was added to hobot-spdev/src/vp_sensors/imx296/

  • It was registered in vp_sensors.c and vp_sensor_config_list[]

  • hobot-spdev was successfully rebuilt and installed as a .deb

  • The correct sensor mode is 1456×1088, RAW10, 60 FPS, 1 lane

  • VIN initialization succeeds

  • We use DDR_MODE

  • According to the RDK 3.5 documentation, DDR mode uses VIN output channel 0 → ISP input channel 0, with ddr_en=1 and cim_isp_flyby=0

  • We compared our ISP initialization with the official RDK 3.5 create_isp_node() example, and the initialization sequence is essentially the same.

The current problem is that the pipeline stops when opening the ISP:

vp_isp_init:

hbn_vnode_open(HB_ISP, 0, AUTO_ALLOC_ID)

ret(-65566)

We confirmed from hbn_error.h that:

-65566 = HBN_STATUS_ISP_OPEN_ICHN_FAIL

After that, VSE also fails, the pipeline does not start, and Python eventually gets nv12_bytes=None, so YOLO cannot process the frame.

Current flow:

IMX296 detection  -  +

VIN +

ISP - X -65566

VSE - X

NV12 - X

YOLO - X

We also investigated the Device Tree and found that mipi_host0 does not contain pinctrl-names, pinctrl-0, pinctrl-1, or snrclk-idx. However, this is intentional in x5-rdk.dtsi: for the RDK X5, MCLK uses an external active crystal oscillator. So we are not treating this as a DTS error.

We have not created a fake IMX296 tuning JSON and do not want to do that without evidence.

What we need from you:

Please identify the exact reason why HB_ISP returns HBN_STATUS_ISP_OPEN_ICHN_FAIL for IMX296 on RDK 3.5.

In particular, please check whether there is any incorrect parameter in our IMX296 configuration, especially:

  • mipi_config

  • lane

  • mipiclk

  • linelenth

  • framelenth

  • settle

  • ipi_channel

  • vin_node_attr

  • vin_ichn_attr

  • vin_ochn_attr

  • isp_attr

  • isp_ichn_attr

  • isp_ochn_attr

We want a concrete fix, not a workaround. Please point out exactly what should be changed, where it should be changed, and why.

The goal is to finish the project with IMX296 working at 1456×1088 60 FPS, real color output, YOLO detection, and stable object tracking on the current RDK 3.5 system.

Hello. I am integrating an IMX296 sensor on the D-Robotics RDK X5 and have reached the following state.

What is already working:

  • Clean RDK X5 / Ubuntu RDK 3.5.0.

  • IMX296 is physically connected to CAM0 / CSI0.

  • The camera module has an external 54.000 MHz oscillator.

  • I2C address: 0x1A.

  • get_isp_data correctly detects the sensor:
    Found sensor_name: imx296 on mipi rx csi 0.

  • vp_sensor_config_t was added and registered for:
    1456x1088, RAW10, 60 FPS, 1 lane.

  • libimx296.so is now loaded successfully.

  • hbn_camera_create() succeeds.

  • VIN and ISP nodes are created successfully.

  • The IMX296 HAL is actually executed.

Current error:


[ERROR][][imx296_utility.c:189]
[imx296]: imx296 turning param ioctl failed -1

strace shows:


openat(..., "/dev/port_0", O_RDWR) = 24

ioctl(24,
      _IOC(_IOC_WRITE, 0x78, 0, 0x450),
      ...)
      = -1 EINVAL (Invalid argument)

So SENSOR_TURNING_PARAM / SENSOR_TUNING_PARAM on /dev/port_0 returns EINVAL.

The old IMX296 HAL contains:


sensor_turning_data_t turning_data;

memset(&turning_data, 0, sizeof(sensor_turning_data_t));
imx296_common_data_init(sensor_info, &turning_data);
imx296_param_init(sensor_info, &turning_data);

ioctl(sensor_info->sen_devfd,
      SENSOR_TURNING_PARAM,
      &turning_data);

The ioctl request size is 0x450 (1104 bytes).

My question

Could this be caused by the fact that libimx296.so comes from an older BSP while the current RDK X5 3.5.0 uses a different kernel/VIN driver ABI for SENSOR_TUNING_PARAM?

I would like to know whether:

  1. sensor_tuning_data_t / the ioctl ABI has changed;

  2. there are new mandatory fields in turning_data for the current kernel;

  3. SENSOR_TUNING_PARAM_EX or another interface is now required;

  4. there is an official example or recommended way to adapt the IMX296 HAL for the current RDK X5 3.5.0.

Goal: make SENSOR_TUNING_PARAM succeed and then continue to ISP output with IMX296 at 1456×1088 RAW10 60 FPS.

Thank you.