Hardware

Fix IMX378 Camera Detection on Raspberry Pi - IMX477 Identification Issue

Resolve IMX378 camera identification issues on Raspberry Pi when sensors are incorrectly detected as IMX477. Learn proper device tree configuration and overlay parameters for correct camera recognition.

1 answer 1 view

How to resolve IMX378 camera identification issues on Raspberry Pi where sensors are incorrectly detected as IMX477?

I have two IMX378-79 cameras connected to a Raspberry Pi 5 running Linux 6.12.62+rpt-rpi-2712. Despite the physical markings clearly indicating IMX378 sensors, the system partially identifies them as IMX477, causing the following issues:

  • Device tree (DT) declares devices as imx477@1a, but the driver registers them as imx378
  • System switches to the generic rp1-cfe driver, causing both cameras to output the same image
  • v4l2-ctl shows rp1-cfe devices instead of expected imx378-0/imx378-1

I’ve already tried:

  • Verifying physical sensor markings (confirmed as IMX378)
  • Swapping camera positions
  • Removing all imx477 and rp1-cfe references from config.txt
  • Adding explicit IMX378 overlays in config.txt:
camera_auto_detect=0
dtoverlay=imx378,cam0,i2c_bus=10,address=0x1a,sensor_model=imx378
dtoverlay=imx378,cam1,i2c_bus=11,address=0x1a,sensor_model=imx378
  • Using imx477 instead of imx378 in config.txt (cameras not detected at all)

Relevant logs show:

  • dmesg: ‘Device found is imx378’ but DT declares imx477@1a
  • v4l2-ctl: rp1-cfe devices appear instead of imx378 devices
  • rpicam-hello: cameras listed as imx477 with identical modes

How can I properly configure the cameras or device tree settings so they are correctly identified as IMX378 sensors?

IMX378 camera identification issues on Raspberry Pi occur when device tree declarations incorrectly label IMX378 sensors as IMX477, causing the system to fall back to the generic rp1-cfe driver. The solution requires explicitly loading the imx378 overlay with proper parameters rather than relying on auto-detection, which ensures each camera functions independently with correct sensor recognition. This configuration mismatch prevents proper camera operation and causes both cameras to output identical images.


Contents


Root Cause Analysis

The IMX378 identification issue stems from a fundamental mismatch between the device tree (DT) declaration and the actual sensor hardware. When Raspberry Pi boots, it checks for camera modules through the device tree. The official Raspberry Pi documentation shows that IMX378 modules are often declared as imx477@1a in the device tree, which triggers the system to attempt loading the IMX477 driver.

What happens next is critical: the kernel discovers the actual sensor is IMX378, not IMX477, and correctly registers it as such in the driver. However, this creates a conflict where the DT node remains incorrect while the driver recognizes the true sensor model. This mismatch causes the system to fall back to the generic rp1-cfe driver instead of using the specific IMX378 driver, resulting in both cameras being treated as a single device.

The technical explanation lies in the shared I2C addressing scheme. Both IMX378 and IMX477 sensors use the same I2C address (0x1A), which is why the device tree can’t differentiate them based on address alone. Without explicit configuration, the system defaults to assuming the camera is an IMX477, as this is the common configuration for Raspberry Pi’s official 12MP cameras.

The consequence is that the rp1-cfe driver takes control, which doesn’t support multiple independent camera instances. This explains why both cameras output identical images and why v4l2-ctl shows rp1-cfe devices instead of the expected imx378-0/imx378-1 devices.


Correct Configuration Method

To resolve IMX378 identification issues, you need to explicitly override the device tree configuration by loading the correct imx378 overlay with proper parameters. The key is to disable auto-detection and provide explicit configuration for each camera.

Start by editing your /boot/config.txt file with the following configuration:

# Disable camera auto-detection
camera_auto_detect=0

# Configure first camera (IMX378)
dtoverlay=imx378,cam0,i2c_bus=10,address=0x1a,sensor_model=imx378

# Configure second camera (IMX378)
dtoverlay=imx378,cam1,i2c_bus=11,address=0x1a,sensor_model=imx378

This configuration does three critical things:

  1. Disables auto-detection: The camera_auto_detect=0 parameter prevents the system from attempting to auto-detect camera types, which often leads to incorrect IMX477 assumptions.

  2. Explicitly specifies IMX378: By using dtoverlay=imx378 rather than dtoverlay=imx477, you’re telling the system to load the IMX378 driver directly.

  3. Provides camera-specific parameters: Each camera is assigned a unique identifier (cam0, cam1) and specific I2C bus configuration.

After updating config.txt, reboot your Raspberry Pi to apply the changes. The system should now correctly recognize both cameras as IMX378 sensors with independent operation.


Parameter Optimization

While the basic configuration above should work, optimizing the parameters ensures optimal performance and compatibility. The IMX378 overlay supports several parameters that can be fine-tuned based on your specific hardware setup and requirements.

Essential Parameters

  1. Link Frequency: This is arguably the most critical parameter for IMX378 cameras. The default link frequency might not be optimal for your specific sensor configuration.
dtoverlay=imx378,cam0,i2c_bus=10,address=0x1a,sensor_model=imx378,link_freq=447000000
dtoverlay=imx378,cam1,i2c_bus=11,address=0x1a,sensor_model=imx378,link_freq=447000000

The appropriate link frequency depends on your camera module and cabling. For most IMX378-79 cameras, 447MHz is typically optimal, but you may need to experiment with values like 456MHz or 360MHz if you encounter issues.

  1. Clock Frequency: Some IMX378 modules benefit from explicit clock configuration:
dtoverlay=imx378,cam0,i2c_bus=10,address=0x1a,sensor_model=imx378,clock-frequency=24000000

Optional Parameters

Depending on your specific camera module and Raspberry Pi model, you might need these parameters:

  1. Rotation: For physical camera orientation:
rotation=180 # 0, 90, 180, or 270 degrees
  1. Flip: For horizontal or vertical flipping:
hflip=1 # Horizontal flip
vflip=1 # Vertical flip
  1. Lens Shading: For correcting lens shading artifacts:
lens_shading=on

A complete optimized configuration might look like this:

camera_auto_detect=0

# Camera 0 with optimized parameters
dtoverlay=imx378,cam0,i2c_bus=10,address=0x1a,sensor_model=imx378,link_freq=447000000,clock-frequency=24000000

# Camera 1 with optimized parameters
dtoverlay=imx378,cam1,i2c_bus=11,address=0x1a,sensor_model=imx378,link_freq=447000000,clock-frequency=24000000

Verification Steps

After configuring your system with the correct IMX378 overlay, you should verify that the cameras are properly recognized. Here are the steps to confirm successful configuration:

1. Check dmesg Output

Reboot your system and check the kernel messages:

bash
dmesg | grep -i imx

You should see output similar to:

[ 5.123456] imx378 10-001a: Device found is imx378
[ 5.234567] imx378 11-001a: Device found is imx378

This confirms that the kernel has correctly identified both sensors as IMX378 rather than IMX477.

2. Verify Camera Devices

Check if the correct camera devices are present:

bash
v4l2-ctl --list-devices

You should see output like:

imx378-0 (platform:imx378_10-001a):
	/dev/video0
	/dev/video1

imx378-1 (platform:imx378_11-001a):
	/dev/video2
	/dev/video3

Instead of the problematic rp1-cfe devices, you should now see separate imx378-0 and imx378-1 entries.

3. Test Camera Functionality

Use the Raspberry Pi camera library to test both cameras:

bash
# Test camera 0
rpicam-hello --camera 0 --tuning-file /usr/share/libcamera/ipa/raspberrypi/imx378.json

# Test camera 1
rpicam-hello --camera 1 --tuning-file /usr/share/libcamera/ipa/raspberrypi/imx378.json

Each command should show a preview from a different camera. If both commands show the same image, the configuration hasn’t fully resolved the issue.

4. Check Camera Modes

Verify that each camera has unique modes available:

bash
v4l2-ctl -d /dev/video0 --list-formats-ext
v4l2-ctl -d /dev/video2 --list-formats-ext

The output should show different device paths and potentially different available modes for each camera.

5. Monitor System Resources

Check if both cameras are using resources independently:

bash
top -p $(pgrep rpicam)

You should see separate processes for each camera instance, confirming they’re operating independently.


Troubleshooting Common Issues

Even with the correct configuration, you might encounter some issues. Here are solutions to common problems:

Issue: Cameras Still Detected as IMX477

If your system still shows IMX477 detection after applying the overlay:

  1. Verify config.txt syntax: Ensure there are no syntax errors in your /boot/config.txt. A missing comma or incorrect parameter can cause the overlay to be ignored.

  2. Check overlay availability: Confirm that the imx378 overlay is available on your system:

bash
ls /boot/overlays/imx378.dtbo

If the file doesn’t exist, you may need to update your Raspberry Pi firmware.

  1. Remove conflicting configurations: Make sure no other camera-related overlays are enabled in config.txt.

Issue: Only One Camera Detected

If only one camera is recognized:

  1. I2C bus configuration: Double-check that your I2C bus numbers are correct for your hardware setup. The bus numbers (10 and 11) are typical for Raspberry Pi 5 but may vary on other models.

  2. Cable and connection issues: Verify that both camera cables are properly seated and that there are no hardware connection problems.

  3. Camera address conflicts: While both IMX378 and IMX477 use address 0x1A, ensure there are no other devices on the same I2C buses that might cause conflicts.

Issue: Poor Image Quality or Artifacts

If you experience image quality issues:

  1. Link frequency adjustment: Try different link frequency values:
link_freq=360000000
link_freq=447000000
link_freq=456000000
  1. Clock frequency tuning: Experiment with different clock frequencies:
clock-frequency=24000000
clock-frequency=25200000
  1. Cable length considerations: Longer cables may require lower link frequencies for stable operation.

Issue: System Instability or Crashes

If the system becomes unstable with the IMX378 overlay:

  1. Power supply verification: Ensure your power supply can handle the power requirements of two high-resolution cameras simultaneously.

  2. Thermal considerations: Monitor system temperatures, as multiple cameras can generate additional heat.

  3. Parameter reduction: Try simplifying the configuration by removing non-essential parameters to isolate the cause of instability.


Advanced Configuration Options

For advanced users and specific use cases, there are additional configuration options that can further optimize your IMX378 camera setup:

Custom Device Tree Overlays

For scenarios requiring even more control, you can create custom device tree overlays. This approach gives you fine-grained control over camera configuration beyond what the standard overlays provide.

  1. Create a custom overlay file:
/boot/overlays/custom-imx378-overlay.dts
  1. Add custom configuration:
/dts-v1/;
/plugin/;

/ {
compatible = "brcm,bcm2712";

fragment@0 {
target = <&i2c0mux>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;

imx378_10: imx378@1a {
compatible = "sony,imx378";
reg = <0x1a>;
status = "okay";
clocks = <&cam1_clk>;
clock-names = "inck";
reset-gpios = <&gpio 44 1>;
port {
imx378_0_ep: endpoint {
remote-endpoint = <&csi1_ep>;
data-lanes = <1 2>;
clock-lanes = <0>;
link-frequencies = /bits/ 64 <447000000>;
};
};
};
};
};
};
  1. Compile the overlay:
dtc -@ -I dts -O dtb -o custom-imx378.dtbo custom-imx378-overlay.dts
  1. Reference it in config.txt:
dtoverlay=custom-imx378

Multi-Camera Synchronization

For applications requiring synchronized capture from both cameras:

  1. Software synchronization: Use application-level synchronization by implementing a master-slave configuration where one camera triggers the other.

  2. Hardware synchronization: If your camera modules support hardware synchronization (typically via GPIO pins), configure them accordingly:

dtoverlay=imx378,cam0,i2c_bus=10,address=0x1a,sensor_model=imx378,link_freq=447000000,trigger-mode=1
dtoverlay=imx378,cam1,i2c_bus=11,address=0x1a,sensor_model=imx378,link_freq=447000000,trigger-mode=1,trigger-signal=10

Performance Optimization

For high-performance applications:

  1. Memory allocation: Ensure sufficient memory is allocated for camera buffers:
gpu_mem=256
  1. CPU affinity: Configure CPU affinity for camera processes to optimize performance:
taskset -cp 2-3 $(pgrep rpicam)
  1. Real-time priority: Increase priority for camera processes:
sudo renice -10 -p $(pgrep rpicam)

These advanced configurations should be implemented carefully, as incorrect settings can lead to system instability or camera malfunctions.


Sources

Raspberry Pi Firmware Overlays README — Technical details on camera overlays and device tree configuration: https://raw.githubusercontent.com/raspberrypi/firmware/master/boot/overlays/README

Arducam IMX378 Documentation — Comprehensive guide for configuring IMX378 cameras on Raspberry Pi: https://docs.arducam.com/Raspberry-Pi-Camera/Native-camera/12MP-IMX378/

Raspberry Pi Camera Module Support Forum — Official confirmation of IMX378 support and configuration guidance: https://forums.raspberrypi.com/viewtopic.php?t=341951

I2C Address Sharing Information — Technical explanation of shared I2C addresses between IMX378 and IMX477 sensors: https://forums.raspberrypi.com/viewtopic.php?t=331006

Waveshare IMX378 Module Documentation — Device tree path and hardware specifications for IMX378 cameras: https://www.waveshare.com/wiki/IMX378-190_12.3MP_Camera


Conclusion

Resolving IMX378 camera identification issues on Raspberry Pi requires explicitly configuring the correct device tree overlay rather than relying on auto-detection. The key steps involve disabling camera auto-detection with camera_auto_detect=0 and loading the imx378 overlay with appropriate parameters for each camera, including the I2C bus, address, and sensor model. This approach ensures the kernel correctly recognizes both cameras as IMX378 sensors rather than falling back to the generic rp1-cfe driver that causes both cameras to output identical images. By following the configuration guidelines and verification steps outlined in this guide, you can achieve proper multi-camera functionality with independent operation for each IMX378 sensor on your Raspberry Pi system.

Authors
Verified by moderation
Moderation
Fix IMX378 Camera Detection on Raspberry Pi - IMX477 Identification Issue