Electronic – How many bytes can be sent in a single i2c message

i2c

I've been working with i2c lately between a beaglebone and an Atmel 328P where the Atmel controls a number of devices under the direction of the beaglebone. In order to accomplish what I've done so far I have been using the Adafruit_I2C library for Python.

From what I understand about i2c (I have read numerous articles about the protocol) all the comms that happen between the start and stop conditions (not counting the control bits) is simply a 7 bit address and a number of 8 bit bytes for the payload. Nowhere have I ever seen anything about how long this payload can be. That is what I am specifically after.

Now in using the Adafruit library it makes a number of assumptions. Specifically, all of its functions are modelled around reading or writing values (usually 8 or 16 bits) into or out of registers (on the addressed chip). They also have a writeList() function, which presumably they intended to write to a number of consecutive registers.

Their writeList() function though can only handle a maximum of 32 bytes of data. I am wondering: is this a real limitation of i2c or is it an arbitrary limit set in their library?

Best Answer

This 32 byte limitation is not a real limitation of the I2C bus. It's just a software limitation in the library that you are using.

To give you an counter-example, there is an EEPROM chip with I2C interface, which has a 128 byte write buffer (24LC512). This EEPROM is not an exception, it's just one example.

As far as I know, I2C spec doesn't have the limit on the number of bytes after the address byte.