I2C message limit? | Arduino Compatible Compiler for LabVIEW Discussions | Forum


Please consider registering

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —

— Match —

— Forum Options —

Minimum search word length is 4 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
I2C message limit?
September 30, 2015
8:57 pm
Forum Posts: 17
Member Since:
September 24, 2015
sp_UserOfflineSmall Offline

Using the I2C Master/Slave examples I’m seeing problems when the message length goes over 32 characters (code mod to add characters to the message attached). The first thing to get ‘lost’ is the LF, so the received serial monitor messages start overwriting. 

Is there a limitation (Arduino, compiler, or otherwise) I don’t know about, or something more basic?

October 1, 2015
3:17 am
Forum Posts: 305
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

Yes, there is a 32 byte limit on I2C transactions.  This is a limitation of the Arduino Wire library.  You could increase the buffer size by changing the following:

1) In Arduino\hardware\arduino\avr\libraries\Wire\Wire.h increase the size in the following line:

#define BUFFER_LENGTH 32

2) In Arduino\hardware\arduino\avr\libraries\Wire\utility\twi.h increase the size in the following line:


Here is some additional info:


Keep in mind this is modifiying the original Arduino library and an upgrade of the Arduino IDE would revert these changes.  It would be advisable to limit transactions to less than the 32 byte buffer size if possible.

October 1, 2015
4:27 pm
Forum Posts: 17
Member Since:
September 24, 2015
sp_UserOfflineSmall Offline

Thanks Steffan,
I agree with limiting messages to <32 bytes, sending multiple messages if necessary. 

The Arduino IDE is as close to an ‘operating system’ as one gets for this board, and messing with the OS is always iffy when you build and maintain production systems.

Forum Timezone: UTC 0

Most Users Ever Online: 33

Currently Online:
1 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

John: 18


Dan6077: 11

Member Stats:

Guest Posters: 0

Members: 80

Moderators: 0

Admins: 3

Forum Stats:

Groups: 1

Forums: 2

Topics: 58

Posts: 289

Newest Members: Travlissah, viktorIcera, HowardClouG, Dianecet, Produktnaodchudzaniex

Administrators: geadmin: 5, filipealtoe: 35, Steffan: 89