Go Down

Topic: Large File Transfers over Wire/I2C (Read 52 times) previous topic - next topic


I attempting to transmit a ~4kB image between two Adafruit M0 Feathers over i2C/Wire from a Slave device to a master. The images are already broken up into 320byte segments for other purposes but I was wondering if Wire can handle transfers of that size. It seems that wire has several 64 byte buffers but I couldn't find any more information on that and the Arduino reference isn't specific on Wire.write()'s behavior.

Would a call on the slave device like Wire.write(segment1,320) work? If not what would you recommend instead?


Aug 04, 2016, 09:54 pm Last Edit: Aug 04, 2016, 10:17 pm by DrDiettrich
The I2C protocol allows both ends to synchronize a transmission, so that buffer overruns will not normally occur. What can happen are timeouts, caused by a heavily loaded receiver.

Transmission of huge amounts of data should be secured against transmission errors. Information is typically sent in small packages, e.g. your 320 byte blocks, with a checksum on every package, and the receiver returns an acknowledge message on receipt of every package. In case of an error the package should be transmitted again, up to some predefined repeat count.

Block transfers have a size_t (long) count, so that it should be possible to transmit data packages of any size - up to the available RAM.

Go Up