Is quantity of Wire.requestFrom() limited?

Hi.
I'm wondering about Wire.requestFrom() and quantity param.
From my expieriance when I try to request too much bytes then arduino gonna crazy, sometime overwrite other variables etc.
When I research wire.cpp then I found this in requestFrom function:

if(quantity > BUFFER_LENGTH){
    quantity = BUFFER_LENGTH;
  }

However in references I did not found any info for quantity limits.

So did I need to change BUFFER_LENGTH to request for more bytes or its better to not request more than 32 bytes? Any why is not there in references any about that?

BUFFER_LENGTH is 32, at least on the AVR platform.

So did I need to change BUFFER_LENGTH to request for more bytes or its better to not request more than 32 bytes?

The later is true, don't request more than 32 bytes. I'm not aware of any sensor that would support more than 32 bytes in one request.

Any why is not there in references any about that?

Probably because the developers of the library never thought that someone might request more than 32 bytes?

So did I need to change BUFFER_LENGTH to request for more bytes or its better to not request more than 32 bytes?

The whole Wire class is based on the 32 byte limit. It will be very challenging to change that.

The I2C protocol is designed to share very small amounts of data between devices. If you think you need to share a novel, you need to rethink the use of I2C.

It sound like "Developers assume that beginners know that they know". I lost many hours because of lack of information about that limitation. Now when I know that then its easy to find it in google what I do wrong in my code. At the same time its much harder when you do not know what to look for.

Thanks.

The 32-byte BUFFER_LENGTH limitation of Wire.requestFrom() may be compromised with the program codes (non-portable) of the attached file. The program drives TWI Interface between Arduino UNO and 24C512 EEPROM (Fig-1).


Figure-1: TWI Bus connection between Arduino UNO and 24C512 EEPROM


Figure-2A: TWI Bus timing diagram showing BusEvents

multbyteWriteXY.ino (3.99 KB)