Issue with i2c-2 (camera i2c)

Hello!

Given:
Ubuntu 22.04 LTS
JP 6.X Release 36.4
Jetson Orin AGX 64 GB Dev kit.

Due to the fact that after some actions with i2c-2 at the linux user space there was an error Remote I/O error. Can I have access from the user space to actions with i2c-2 (i2c-2 from the camera connector) without changes in the dtsi file?

On this particular interface there can be several i2c-2 addresses (8-bit addresses and values, and 16-bit addresses and values). I will give an example:

    const char *i2c_bus = "/dev/i2c-2";
	int i2c_handle = open(i2c_bus, O_RDWR);
	if (i2c_handle < 0) {
		printf("Error opening device, %d\n", errno);
        goto err_handler;
	}

	printf("OK!\n");

	int slave_address = ADDRESS1; //8 bit

	if (ioctl(fd, I2C_SLAVE, slave_address) < 0)
	{
		printf("Failed i2c address = %02X.\n", slave_address);
		goto err_handler;
	}

    retValue = writeRegister8Bit(i2c_handle, 0xXX, 0xYY); //write 8 bit data with 8 bit address
	if (retValue < 0)
	{
		printf("Failed i2c_write()\n");
		goto err_handler;
	}
....

    slave_address = ADDRESS2; //8 bit

	if (ioctl(fd, I2C_SLAVE, slave_address) < 0)
	{
		printf("Failed i2c address = %04X.\n", slave_address);
		goto err_handler;
	}

    retValue = writeRegister16Bit(i2c_handle, 0xXXXX, 0xYYYY); //write 16 bit data with 16 bit address
    if (retValue < 0)
    {
		printf("Failed i2c_write()\n");
		goto err_handler;
	}	      

Thanks!

*** Please note that this reply is generated by LLM automatically ***

Based on the provided context, I’ll try to provide a comprehensive answer to your question.

It appears that you are using a Jetson AGX Orin device with Ubuntu 22.04 LTS and JetPack 6.x. You are experiencing an error after performing some actions in the Linux user space, and you want to know if you can access the I2C2 interface from the camera connector without modifying the device tree file.

The Jetson AGX Orin platform uses a device tree to describe the hardware components and their connections. The device tree file is used to configure the hardware and provide information about the available interfaces, including I2C.

In your case, you want to access the I2C2 interface from the camera connector, which is likely connected to the MIPI CSI-2 interface. The MIPI CSI-2 interface is a standard for camera interfaces, and it uses I2C for control and configuration.

To access the I2C2 interface from the user space, you can use the Linux I2C subsystem, which provides a set of APIs and tools for interacting with I2C devices. However, to access the I2C2 interface from the camera connector, you may need to configure the device tree to enable the I2C2 interface and specify the correct I2C addresses.

The V4L2 Media-Controller component, which is mentioned in the context, provides a set of APIs for controlling and configuring camera devices, including access to the I2C interface. However, it’s not clear if the V4L2 Media-Controller component is enabled and configured correctly on your system.

To answer your question, it’s possible to access the I2C2 interface from the user space without modifying the device tree file, but it depends on the specific configuration and setup of your system. You may need to use the Linux I2C subsystem and V4L2 Media-Controller component to access the I2C2 interface, and you may need to configure the device tree to enable the I2C2 interface and specify the correct I2C addresses.

Here are some possible steps you can take to access the I2C2 interface from the user space:

  1. Check the device tree configuration: Verify that the device tree file is configured correctly to enable the I2C2 interface and specify the correct I2C addresses.
  2. Use the Linux I2C subsystem: Use the Linux I2C subsystem to access the I2C2 interface from the user space. You can use tools like i2cdetect and i2cget to detect and access I2C devices.
  3. Use the V4L2 Media-Controller component: If the V4L2 Media-Controller component is enabled and configured correctly on your system, you can use it to access the I2C2 interface and control the camera device.

In comparison to other platforms, the Jetson AGX Orin platform has a similar architecture and configuration to other NVIDIA Jetson platforms, such as the Jetson Xavier NX and Jetson Orin Nano. However, the specific configuration and setup of your system may vary depending on the platform and device tree configuration.

In summary, accessing the I2C2 interface from the user space on a Jetson AGX Orin device with Ubuntu 22.04 LTS and JetPack 6.x requires careful configuration and setup of the device tree and Linux I2C subsystem. You may need to use the V4L2 Media-Controller component and Linux I2C subsystem to access the I2C2 interface, and you may need to configure the device tree to enable the I2C2 interface and specify the correct I2C addresses.

*** Please give the thumbs up if you get answers you like. Or provide feedback to help us improve the answer. ***

hello demonoff2024,

may I know what’s the error reported?
it’s usually due to incorrect regulator settings for i2c communication failure.

BTW,
please refer to NVIDIA Jetson AGX Xavier Series and Jetson AGX Orin Series Camera Module Hardware Design Guide for [2.2.1 Single Camera Case] section.
it’s by default using CAM_I2C, which is i2c2 or, i2c@3180000 in software definition.
for instance,
$public_sources/kernel_src/hardware/nvidia/t23x/nv-public/nv-soc/tegra234-base-overlay.dtsi

        aliases {
                i2c0 = "/bus@0/i2c@3160000";
                i2c1 = "/bus@0/i2c@c240000";
                i2c2 = "/bus@0/i2c@3180000";

hello, JerryChang

We double-checked it with i2cdetect on the go and it turned out that the address ADDRESS2 does not exist. Since the address did not exist, we received the error: Failed to write to I2C device: Remote I/O error on the output.

hello demonoff2024,

as mentioned, it’s usually due to incorrect regulator settings for i2c communication failure.
you may review the board schematic for double check.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.