Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

max9295 12-0044: max9295_write_reg:i2c write failed, 0x10 = 21 #246

Open
chenx915 opened this issue Dec 10, 2024 · 6 comments
Open

max9295 12-0044: max9295_write_reg:i2c write failed, 0x10 = 21 #246

chenx915 opened this issue Dec 10, 2024 · 6 comments
Assignees

Comments

@chenx915
Copy link

We were trying to adapt the D457 to the Jetson ORIN NX platform, and during the process of migrating the driver, we found that the I2C address of the camera could only be queried once.

MAX9296 and INTEL realsense D457 GMSL were used
image

[    6.384383] max9296 12-004a: [MAX9296]: probing GMSL Deserializer
[    6.384431] max9296 12-004a: max9296_probe:  success
[    6.385744] max9295 12-0044: [MAX9295]: probing GMSL Serializer
[    6.385777] max9295 12-0044: max9295_probe: success
[    6.385803] max9295 12-0042: [MAX9295]: probing GMSL Serializer
[    6.385823] max9295 12-0042: max9295_probe: success
[    6.386986] d4xx 9-001a: Probing driver for D45x
[    6.387061] ----plink----ds5_board_setup----ifdef--
[    6.387065] serializer reg: 0x44
[    6.387072] state->g_ctx.csi_mode: 0x1
[    6.387074] ----plink----state->g_ctx.num_csi_lanes----: 0x2
[    6.725794] max9295 12-0044: max9295_write_reg:i2c write failed, 0x10 = 21
[    6.725911] max9295 12-0044: max9295_setup_control: ERROR: ser device not found
[    6.725913] d4xx 9-001a: gmsl serializer setup failed
[    6.728330] tegra194-pcie 141e0000.pcie: Phy link never came up
[    6.759090] d4xx 9-001a: ds5_serdes_setup gmsl serdes setup failed
[    6.759183] d4xx: probe of 9-001a failed with error -121
[    6.759222] d4xx 10-001a: Probing driver for D45x
[    6.759312] ----plink----ds5_board_setup----ifdef--
[    6.759314] serializer reg: 0x44
[    6.759326] state->g_ctx.csi_mode: 0x1
[    6.759327] ----plink----state->g_ctx.num_csi_lanes----: 0x2
[    6.759328] ----plink----cannot handle more than 24 D457 cameras----
[    6.792664] d4xx 10-001a: ds5_read(): i2c read failed -121, 0x5020
[    6.796690] systemd-journald[250]: Received client request to flush runtime journal.
[    6.825849] d4xx 10-001a: ds5_read(): i2c read failed -121, 0x5020
[    6.859037] d4xx 10-001a: ds5_read(): i2c read failed -121, 0x5020
[    6.892656] d4xx 10-001a: ds5_read(): i2c read failed -121, 0x5020
[    6.925859] d4xx 10-001a: ds5_read(): i2c read failed -121, 0x5020
[    6.959075] d4xx 10-001a: ds5_read(): i2c read failed -121, 0x5020
[    6.959086] d4xx 10-001a: ds5_probe(): cannot communicate with D4XX: -121 on addr: 0x1a
[    6.965197] d4xx: probe of 10-001a failed with error -121
[    6.966493] d4xx 11-001a: Probing driver for D45x
[    6.971640] ----plink----ds5_board_setup----ifdef--
[    6.971646] serializer reg: 0x44
[    6.971666] state->g_ctx.csi_mode: 0x1
[    6.971668] ----plink----state->g_ctx.num_csi_lanes----: 0x2
[    6.971669] ----plink----cannot handle more than 24 D457 cameras----
[    6.974472] d4xx 11-001a: ds5_read(): i2c read failed -121, 0x5020
[    6.974826] d4xx 11-001a: ds5_read(): i2c read failed -121, 0x5020
[    6.975163] d4xx 11-001a: ds5_read(): i2c read failed -121, 0x5020
[    6.975504] d4xx 11-001a: ds5_read(): i2c read failed -121, 0x5020
[    6.975835] d4xx 11-001a: ds5_read(): i2c read failed -121, 0x5020
[    6.976167] d4xx 11-001a: ds5_read(): i2c read failed -121, 0x5020
[    6.976168] d4xx 11-001a: ds5_probe(): cannot communicate with D4XX: -121 on addr: 0x1a
[    6.982940] d4xx: probe of 11-001a failed with error -121
[    6.983610] d4xx 12-001a: Probing driver for D45x
[    6.985919] ----plink----ds5_board_setup----ifdef--
[    6.985925] serializer reg: 0x44
[    6.985943] state->g_ctx.csi_mode: 0x1
[    6.985945] ----plink----state->g_ctx.num_csi_lanes----: 0x2
[    6.985946] ----plink----cannot handle more than 24 D457 cameras----
[    7.020168] d4xx 12-001a: ds5_read(): i2c read failed -121, 0x5020
[    7.053388] d4xx 12-001a: ds5_read(): i2c read failed -121, 0x5020
[    7.053826] tegra-soc-hwpm f100000.hwpm: Adding to iommu group 25
[    7.078197] scare-pigeon 13e00000.host1x:vi0-thi@15f00000: Adding to iommu group 26
[    7.086559] d4xx 12-001a: ds5_read(): i2c read failed -121, 0x5020
@chenx915
Copy link
Author

Can someone take a look?

@taeyeon-toofon
Copy link

I have a same issue and changed different D457, but it didn't work.
image

@Arun-Prasad-V
Copy link

Hi @chenx915 . Are you using Intel's deserializer board https://store.intelrealsense.com/buy-intel-realsense-des457.html or different?
If different, I hope you would have updated the device tree accordingly.

@taeyeon-toofon
Copy link

taeyeon-toofon commented Dec 18, 2024

Hello @Arun-Prasad-V , Maybe my case is different from chenx915, but I am using Intel's deserializer board and I got that error. I am using Orin AGX, JetPack 6.0, and LI-JTX1-SUB-ADTP board.

Currently, I am using 81c2304 commit. Because when I used latest dev branch code(61afe61), I can not get any message for d4xx.

nvidia@ubuntu:~$ sudo dmesg | grep tegra-capture-vi
[    9.357521] platform 13e00000.host1x:nvcsi@15a00000: Fixing up cyclic dependency with tegra-capture-vi

nvidia@ubuntu:~$ sudo dmesg | grep d4xx
[Empty]

But 81c2304 shows the correct output as like Read me file. So I am using this commit now and got that i2c read fail error. Please let me know if you have any suggestions. Thank you very much.

@Arun-Prasad-V
Copy link

Maybe my case is different from chenx915, but I am using Intel's deserializer board and I got that error. I am using Orin AGX, JetPack 6.0, and LI-JTX1-SUB-ADTP board.

Hi @taeyeon-toofon, this setup is running fine from our side. If you trying it for the first time, please make sure the camera D457 is in MIPI mode (there will be a switch at the back of camera where we can switch between USB and MIPI mode).

To confirm FW is already running fine in D457 camera, you can switch to USB mode and connect it through Type-C cable. Ignore the dmesg logs for this case and open "realsense-viewer" and check if it is detected as D455 camera properly.

Also, try powering off both Jetson and deserializer and wait for a minute and power ON. Because, sometimes power cycling deserializer along with Jetson helps smooth initialization.

If you are still facing issues, please create a separate ticket (as your setup is different from this ticket) and share dmesg log.

@sammychentw
Copy link

sammychentw commented Dec 23, 2024

Hi, @Arun-Prasad-V :

I got same I2C write fail in Jetpack 6.0(L4T 36.3, Kernel 5.15.136), too.

[Kernel dmesg log]
[   10.456682] [D457] max9296_setup_link()
[   10.456684] [D457] max9296_get_sdev_idx()
[   10.456686] [D457] max9296_write_link(link=0x00000001)
[   10.456688] [D457] max9296_write_reg(addr=0x0010,val=0x0001)
[   10.457257] max9296 2-0048: max9296_write_reg:i2c write failed, 0x10 = 1
[   10.457372] [D457] max9296_write_reg(addr=0x0010,val=0x0021)
[   10.458635] max9296 2-0048: max9296_write_reg:i2c write failed, 0x10 = 21
[   10.674991] d4xx 2-001a: gmsl serializer setup failed

I try to add some debug function to ds5_probe() in d4xx.c,
and I found that the max9296_write_reg() use regmap_write() to I2C write 0x48 0x10 1 and I2C write 0x48 0x10 21,
and it will be get i2c write failed in Jetpack6.

#define MAX9296_CTRL0_ADDR 0x10

max9296_write_link () {
max9296_write_reg(dev, MAX9296_CTRL0_ADDR, 0x01);
max9296_write_reg(dev, MAX9296_CTRL0_ADDR, 0x21);
}

static int max9296_write_reg(struct device *dev, u16 addr, u8 val)
{
	struct max9296 *priv;
	int err;
	printk( "[D457] %s(addr=0x%04X,val=0x%04X)\n",__func__, addr, val);

	priv = dev_get_drvdata(dev);

	err = regmap_write(priv->regmap, addr, val);
	if (err)
		dev_err(dev, "%s:i2c write failed, 0x%x = %x\n", __func__, addr, val);

	/* delay before next i2c command as required for SERDES link */
	usleep_range(100, 110);

	return err;
}

I do the i2c read 0x48 success in the same place of ds5_probe() in Jetpack6.
It seem regmap_write 0x48 0x10 0x01 issue in Jetpack6, but it is working in Jetpack5.
I see the regmap_write 0x48, 0x40, 0x42 get NAK in logic analyzer:
1

I am using the v1.0.1.25 tag for Jetpack 6.0 on Intel Realsense mipi platform driver GitHub:
Intel Realsense mipi platform driver GitHub - v1.0.1.25 tag
https://github.com/IntelRealSense/realsense_mipi_platform_driver/blob/r/1.0.1.25/README_JP6.md

Could you help to solve the regmap_write 0x48 I2C write failed issue for Intel D457 in Jetpack 6.0(L4T 36.3, Kernel 5.15.136)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants