DUE I2C speed

Hi,
I'm using Arduino Due for a project with Pololu's MiniIMU v9 (Pololu - MinIMU-9 v2 Gyro, Accelerometer, and Compass (L3GD20 and LSM303DLHC Carrier)). I tried it first with my arduino mega 2560 rev2 and works a treat, even when powered from 3.3V. The problem is that, every time Arduino Due reads something via I2C from the IMU, it takes almost 0.01 seconds, which is unacceptable for my project. I've changed I2C clock frequency in the Wire library in order to see if it fixed something but it didn't work.
Any idea of what's happening?
Thanks in advance! :wink:

By the way, I've used as many pull-up resistor configurations as I dared, and nothing. It is still as slow as hell. Any ideas anywhere? :cold_sweat:

I have that IMU, when I get around to testing it on my DUE I'll let you know how it goes.

My tests of read/write on an I2C EEPROM are about the same for UNO and DUE at 100KHz and 400KHz. Here are read/write times in microseconds for small block read/writes.

  arduino uno  100KHz    400KHz    DUE  100Khz      400Khz
Bytes   write   read    write  read    write read   write read (microseconds)
10       1340   1480    1112  1176      1197 3124    775   339
20       2340   2500     780   840      2104 3124    775   573
30       3360   3512     448   504      3014 3127    775   806
  
 maple      100KHz        400KHz
Bytes   write   read      write  read   (microseconds)
10       1193   1306        308   336
20       2095   2202        535   561
30       2997   3100        761   791


Beaglebone  I2C @ 100Khz
bytes   write   read   (microseconds)
10       1320   1669
20       2245   2559
30       3128   3374

 Raspberry Pi  I2C @ 100KHz
10       1268    1449
20       2185    2357
30       3074    3268

With the DUE, you have to restart the IDE if you modify library settings, e.g. TWI_CLOCK in hardware/arduino/sam/libraries/Wire/Wire.h

Thanks, it seems to be solved =D!

Ooops, 100 Khz read column for DUE I2C test above is wrong. It has been corrected, current performance results are in I2Cperf.txt at

Hey guys,

I have a same problem and I am curious if and how you solved it.
Looks like i dont get the speed of I2C of my Due with the INA226 library not over a certain speed. An array with 20000 elements needs always 20s to get filled up with longs...it doesn't matter if the Wire.setClock() is Wire.setClock(100000) or Wire.setClock(400000)... but Wire.setClock(50000) slows it a lot to 40s... Please! I need help.

Why do you want an array of 20000 longs?

If you are simply storing the conversion results, it is going to be dependent on the conversion time.
And the chip does all the calculation and averaging for you anyway.

The bus speed will make little difference. i.e. if the conversion time is set for 2.116ms, 20000 conversions will take 43 seconds. Communicating on a 400kHz bus is 22.5us per byte. You can squeeze a lot of bytes into a 2.116ms interval.

Obviously a very short conversion and a very slow bus could clash. Why would you want to use inappropriate settings?

Pure speculation. I have never used this chip. Just had a brief glance at the data sheet

David.

CHeck Arduino/sketches/MultiSpeedI2CScanner at master · RobTillaart/Arduino · GitHub

Hello all,

I am a long time user of the Arduino and Galileo, made a lot of things with the IDE and the libraries, but this time, I feel really stupid...

I am trying to find the wire.h to change the TWI_CLOCK settings, but I simply can't find it for the SAM on my Mac.

I have the Arduino IDE for the Galileo, and I can find it in the package (/Contents/Ressources/Java/hardware/arduino/sam/libraries/wire.h), but I can't find it in the Arduino 1.6 package.

And the crazy thing is that I can compile a sketch on my Due using this library, so it's somewhere, but where????

And I just installed 1.6.7 on a Windows machine : same thing, no /sam directory...

If any of you has an idea of what I am doing wrong...

Thanks

Benoit