Go Down

Topic: Wire library uses a 32 byte buffer (Read 390 times) previous topic - next topic

sullah55

Hi,
I am using Arduino UNO with Xsense MTi-1 Series, when i retrieving data from MTi-1 series through Arduino by using I2C, so i am only getting 32 bytes of data each time were i should get 68 byte of data, i also contacted the Xsens team and their reply is as below:

I think I have identified the cause of the problem: As stated on https://www.arduino.cc/en/Reference/Wire, the Wire library uses a 32 byte buffer, which is why you are only able to receive 32 bytes of data each time.

This is a very common issue and I suggest to have a look at the Arduino forums for possible solutions. Unfortunately Xsens cannot provide you with further support on this.

Could you please help me if there is any way we can increase the size of buffer so i can retrieve the full amount of data ?

regards,
Saqib

Budvar10

There is the BUFFER_LENGTH defined in Wire.h. Just change this value from 32 to 64.
Arduino clone with ATmega1284P   http://forum.arduino.cc/index.php?topic=277260.0

robtillaart

There is the BUFFER_LENGTH defined in Wire.h. Just change this value from 32 to 64.
to 70 so the 68 byte message + length fit in.
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

sullah55

#3
Mar 22, 2018, 04:01 pm Last Edit: Mar 22, 2018, 04:14 pm by sullah55
Hi, thanks for your reply, however its read only so I can't make any changes on it ? I mean the file Wire.h is  read only, so I can copy to a different location and amended there but can't do any changes inside there.

robtillaart

You should ask someone with administrator rights on your PC to make the changes.
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Perehama

copy the wire library and rename all files, particularly Wire.h. Change all #include statements that refer to the Wire library parts, namely twi.c, twi.h, Wire.cpp and Wire.h, to refer to the newly renamed files. Make the edit to BUFFER_LENGTH as previously suggested. Place this folder in your Documents>Arduino>libraries. Restart your Arduino IDE. You should see the newly named library in your list. Include it instead of Wire.h.
F=C/V=(A*s)/V=J/V^2=(W*s)/V^2=(N*m)/V^2=C^2/J=C^2/(N*m)=(s^2*C^2)/(m^2*Kg)=s/Ω=1/(Ω*Hz)=s^2/H

Go Up