kplindegaard / smbus2

A drop-in replacement for smbus-cffi/smbus-python in pure Python
MIT License
243 stars 68 forks source link

Workarounds for 32 byte I2C block size limitation dictated by SMBus #99

Open altineller opened 11 months ago

altineller commented 11 months ago

Hello,

I am reading i2c data from my custom device as:

status = bus.read_i2c_block_data(0x3C, 0xA0, STATUS_BUFFER_SIZE)

Where 0x3c is the address, and 0xa0 is the offset.

I needed to read 64 bytes, and discovered the 32 bytes block size limit, so:

status64 = i2c_msg.read(0x3C, STATUS_BUFFER_SIZE) but this omits the offset.

how can I make > 32bytes reads by using i2c_msg and still be able to use this offset.

Best Regards, C.

kplindegaard commented 11 months ago

Would two calls cut it? First one to address/offset 0xA0 and the second to 0xC0?

For some devices that works perfectly fine, but I guess that depends.