ullix
April 20, 2020, 2:57pm
#1
I keep reading that the size limit for the Wire buffer on Arduino is 32 bytes (though some of these posts are pretty old).
When I look into the source code for Wire for an ESP32, I find this:
#define STICKBREAKER 'V1.1.0'
#define I2C_BUFFER_LENGTH 128
...
class TwoWire: public Stream
{
protected:
...
uint8_t rxBuffer[I2C_BUFFER_LENGTH];
...
uint8_t txBuffer[I2C_BUFFER_LENGTH];
and here from the library.properties:
name=Wire
version=1.0.1
author=Hristo Gochkov
Am I misinterpreting this, or is - at least on an ESP32 - the limit now 128 bytes?
Do I still need to include the 2 byte address in this buffer, so have only 126 bytes available?
ullix
April 25, 2020, 8:51am
#2
After several days of testing I am inclined to say that the buffer is 128 byte ( not 32) and it can be used for 126 bytes of payload. 2 bytes are still needed for address bytes.
J-M-L
April 25, 2020, 9:45am
#3
may be instead of testing for days, the easiest way was to check the ultimate documentation: the source code
==> used here for Rx and there for Tx
(which indeed differs from the AVR implementation where it is 32)
ullix
April 28, 2020, 8:04am
#4
J-M-L:
the easiest way was to check the ultimate documentation: the source code
==> used here for Rx and there for Tx
A truly great idea, which is why I actually began my post with exactly that one, as you can see when you read past the headline.
As I only saw comments and libs referring to the 32 byte limit, I wondered whether there was an additional limit somewhere deeper in the code.
So, thanks to the AVR reference link, which I found helpful.
J-M-L
April 28, 2020, 8:14am
#5
indeed did not read your post with enough attention. sorry for that.