How to debug I2C?

I’m trying to interface TX2 with a PWM controller over I2C, and the board is not being detected using sudo i2cdetect -r -y 1.

I’ve confirmed the PWM controller is correctly powered, and an oscilloscope shows that the I2C bus is outputting… something… when I run i2cdetect, but what should I be looking for? How do I debug that output that is showing up on the bus, and confirm whether it’s correct? How can I tell whether there is something coming back from the PWM controller? Is there some SYN/ACK pattern I can look for?

hello roach374,

you could use the i2c tools to write something for testing.
or, you could write some kernel code to test your i2c device, please refer to sensor driver’s kernel code for example. thanks


Sorry, maybe I wasn’t being clear. When I run i2cdetect on the TX2, it does not detect the device on the I2C bus. Nothing. However, when I hook up a scope to the I2C bus, I see something happening on the bus when I run i2cdetect. PRoblem is, I have no idea what’s happening. What bytes are being output on the bus, or how to troubleshoot why the TX2 is not seeing my I2C device.

So my question is: Using an oscilloscope attached to the I2C bus in question, what should I see when I run i2cdetect?

hello roach374,

there should be device registration process in the kernel initialization stage,
may I know is there any “i2c no acknowledgement” failure message shown?
also, please double check the regulator settings of your i2c device.

Hi JerryChang,

When I run “dmesg | grep i2c”, I get this:

[    0.199791] iommu: Adding device 3160000.i2c to group 3
[    0.200029] iommu: Adding device c240000.i2c to group 4
[    0.200245] iommu: Adding device 3180000.i2c to group 5
[    0.200454] iommu: Adding device 3190000.i2c to group 6
[    0.200740] iommu: Adding device 31b0000.i2c to group 7
[    0.200951] iommu: Adding device 31c0000.i2c to group 8
[    0.201167] iommu: Adding device c250000.i2c to group 9
[    0.201373] iommu: Adding device 31e0000.i2c to group 10
[    3.191566] i2c /dev entries driver

Can you confirm I’m looking in the right place? Doesn’t look like there are any errors in dmesg.


It looks like the SCL and SDA pins are swapped on my carrier board (Sprocket Carrier). When I switched them, everything works fine. That’ll teach me to trust datasheets.

It took me plugging in a logic analyzer to see that thee signals were reversed.