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

Avatar
Please consider registering
guest
sp_LogInOut Log In sp_Registration Register
Register | Lost password?
Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Feed Topic RSS sp_TopicIcon
I2C message limit?
September 30, 2015
8:57 pm
Avatar
Jim.UF
Member
Members
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
Avatar
Steffan
Admin
Forum Posts: 408
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:

#define TWI_BUFFER_LENGTH 32

Here is some additional info:

http://forum.arduino.cc/index......ic=54439.0

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
Avatar
Jim.UF
Member
Members
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.
Jim

Forum Timezone: UTC 0
Most Users Ever Online: 100
Currently Online:
5
Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
miche91: 33
scottj: 28
scadao: 23
Member Stats:
Guest Posters: 5
Members: 202
Moderators: 0
Admins: 3
Forum Stats:
Groups: 1
Forums: 2
Topics: 266
Posts: 1222
Newest Members:
pujacontrol
Administrators: geadmin: 22, filipealtoe: 96, Steffan: 356