Can Arduino Uno *R3* handle TWI_BUFFER_LENGTH 64?

Hi,

Can the Arduino Uno R3 handle an i2c buffer size of 64?

I've read some places that the Uno is limited to 32 but other places show that it can handle size 64.

If it can be changed to 64 then I'm also generally confused about how to go about it. Namely which of these do I need to change: TWI_BUFFER_LENGTH, BUFFER_LENGTH, OVERIDE_B_LENGTH, and where?

I plan on doing an elaborate explanation on this thread (for other non-programmers like me) once I understand this myself.

Thanks in advance,
riqi

I plan on doing an elaborate explanation on this thread (for other non-programmers like me) once I understand this myself.
Good plan, but start with exploring the "open software" concept and check the appropriate library source code ( google github) to find out WHERE to modify the buffer size.

As long as you don't want the memory for anything else, and you don't exceed 256 bytes, I can't really see why not - it isn't any kind of hardware restrictiion

Hi, (using Arduino Uno R3)

I've done some research and I have learned that there are five Wire library buffers stored in the 2048 bytes of Arduino SRAM. So I can use a larger buffer than the standard 32 bytes as long as I don't run out of SRAM. I'm not using any other types of communication. What else uses the SRAM? What about arrays I defined in my code? Are they stored in the Flash Memory where the program is stored?

I believe I only need to change two constants in twi.h and Wire.h in order to change the i2c buffer length from 32 to 64:

#define TWI_BUFFER_LENGTH 64 (../arduino/libraries/Wire/utility/twi.h)
#define BUFFER_LENGTH 64 (../arduino/libraries/Wire/Wire.h)

Is this correct? I don't want to brick my Arduino.

Thanks in advance,
riqi

Go ahead and try your code.
Afterall the compiler will tell what is wrong, and block the your code upload to the Arduino

You wont brick your Arduino with any code, unless you shortcircuit pins defined as outputs, with external wires.

Show us your full code, once you get stuck in problems.

there are five Wire library buffers stored in the 2048 bytes of Arduino SRAM.

Looks that way. Ahh, layering...

avr-nm -SC --size-sort *.elf |grep -i ' b '
  :
0080016b 00000020 B TwoWire::rxBuffer
0080018e 00000020 B TwoWire::txBuffer
008001c5 00000020 b twi_masterBuffer
00800209 00000020 b twi_rxBuffer
008001e7 00000020 b twi_txBuffer

BTW, the R3 is identical to previous Arduinos in this respect. The only thing different is the connector pins for I2C near the USB connector, and they are just "copies" of pins that already appeared elsewhere (A5, A6.) (although, the exact operation of the I2C libraries MIGHT be dependent on IDE version.)