2

I'm working in a project and I need to send more than 32 bytes from Raspberry Pi 3 to Arduino and viceversa.

My first question is: Why this limit of 32 bytes on SMBus? There is some technical reason?

I can't find any good solution about this.

My second question is: Which is the best way to transfer more than 32 bytes between the 2 devices via I2C using SMBus or other? Using some kind of custom protocol?

An example is well accepted. Thanks in advance

1

Send 32 bytes at a time, in sequence.

Have a look at the TLV format for an easy way to make a custom protocol.

There are several python packages to help you set up an encoder and a parser, for example construct or Simple TLV Parser, but if you want to keep it simple, you can probably build your own in a few lines of code.

1

SMBus does have a 32 byte limit. I2C has no limit. It may be because SMBus has timeouts whereas I2C doesn't, but that's just me thinking out loud.

A solution is to use I2C rather than SMBus.

There are a variety of ways to use I2C rather than SMBus from Python.

As I wrote pigpio I will point out that one of the simplest is to use the pigpio Python module and the i2c_read_device and i2c_write_device methods.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.