How to work with i2c?

I am using pin number 27 and 28 on Jetson Nano and cannot read data via i2c. I have checked that the device I am connecting is working on Arduino and the data is okay.
I have tried to use smbus and busio (busio actually found the device on 0x2d) but then this error always comes:

Traceback (most recent call last):
  File "", line 11, in <module>
    bearing = bearing255()
  File "", line 7, in bearing255
    bear = bus.read_byte_data(address,5)
IOError: [Errno 110] Connection timed out

This is my code:

import smbus
bus = smbus.SMBus(0)
address = 0x2d

while True:
    bear = bus.read_byte_data(address, 5)
    print bear

Also, when I type

sudo i2cdetect -y -r 0

I can see the device at 0x2d but when I type that command again, it gets stuck at that address and I have to reset the connected device.

What the result if disconnect the device and run the i2cdetect command?

We found the problem, Jetson cannot read more than 1 byte via i2c whereas we were sending 5 bytes. I am quite surprised that I did not find information about that.

I think the Jetson can read more bytes, but perhaps your device doesn’t output more than one byte at a time?

STM32 (the device) outputs 5 bytes at a time. When I try to read 5 bytes, Jetson reads 1 byte and then crashes. If I output 1 byte at a time, Jetson reads it without a problem.

Try using the C I2C driver directly.

Also, put a 'scope or logic analyzer on the bus and look what’s happening. The SMBus has a 35 milliseconds timeout, so if you use the SMBus module to read an I2C device that uses clock stretching, that may cause a problem.

Hi,I’m tring to create a connection between Jetson Nano and ICN6211 chip by i2c.When I was using i2c-

tools to see the address of the ICN6211 by running “sudo i2cdetect -y 2” command,it scans all different

addresses and when it gets to the slave address,it cannot be writed or read.
I have pull-up resistors on SDA and SCl,but it didn’help.
I guess Jetson I2C device load error,but I don’t konw what happens that it’s not able to detect the slave


Hi 1624931902,

Please open a new topic for your issue. Thanks