Hi thee, I don’t know if this is the right place to be asking about this really, because the code I’m writing is dependent upon the espressif32 port and the ESP32 I2C Slave library.
So the espressif32 port declares
#define I2C_BUFFER_LENGTH 1024 in Wire.h, which leads me to conclude that the maximum size for the IIC buffer is 1024 bytes.
The ESP32 I2C Slave library redefines that
#define I2C_BUFFER_LENGTH 128 in WireSlave.h
I’ve rooted around the source for the library and can find no discernable reason why it has been redefined thus.
The net effect of this is that the iic message size is somewhat limited (to 128 bytes).
I’ve played around with the values (because it really does appear to be voodoo to me rather than something obviously mathematical), and I’ve settled on a redefinition of
#define I2C_BUFFER_LENGTH 1024 to match the underlying iic implementation.
The issue comes however when using this library and attempting to send a large amount of data. In fact, it cuts off at 251 bytes … which I cannot understand. I don’t know if I’m missing something really simple or if there are some specifics required at the OS level for large data packets.
I know it’s possible to send large data packeets over IIC since we use a NEO-8M GPS/GNSS module which communicates over IIC, and the data from that is I think in excess of 1024 bytes.