Pages: [1]   Go Down
Author Topic: I2C buffer limit  (Read 1766 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can someone edit the library reference page to make it clear that there's a hard-coded 32byte limit on I2C message sizes? I had to google around ambiguously before I found that info on a blog somewhere.

As an aside, would it be difficult to make the buffer size configurable? I imagine it's limited to save memory, but in this case I'd be happy to spare the memory to avoid having to write a multi-transaction wrapper to get my bytes through.
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16518
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The " #define BUFFER_LENGTH 32 " is located in the Wire.h file in your arduino core folder. I'm sure you could edit it to a larger size to meet your requirements. Note that this is used twice, once for a rec buffer and once for a transmit buffer so go easy on size increase.

Lefty

Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 549
Posts: 46090
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Note that this is used twice, once for a rec buffer and once for a transmit buffer so go easy on size increase.
Earlier this week, it was mentioned that there are some intermediate buffers, too, for a total of 5 buffers that size. Seems overkill to me, but I haven't looked at the code to see if it is true, and, if so, necessary.
Logged

Worcester, MA
Offline Offline
God Member
*****
Karma: 2
Posts: 623
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Note that this is used twice, once for a rec buffer and once for a transmit buffer so go easy on size increase.
Earlier this week, it was mentioned that there are some intermediate buffers, too, for a total of 5 buffers that size. Seems overkill to me, but I haven't looked at the code to see if it is true, and, if so, necessary.
The second one is in twi.h   
Logged

I2C GPS Shield

Checkout my Open Source GPS Tracker on Kickstarter

London
Offline Offline
Faraday Member
**
Karma: 8
Posts: 6240
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The second one is in twi.h   

the buffers are defined in twi.c
Logged

Pages: [1]   Go Up
Jump to: