Teensy 4.x I2Cdev vs. Wire?

Status
Not open for further replies.

TeensyDigital

Well-known member
I've got three sensors on my I2C bus that use three different libraries. I am trying to optimize every microsecond on the read/write speed and I noticed a considerable difference in one of the sensors when it runs stand-alone vs. running after one of the other two had been initialized. The libraries for two of the sensors use Wire and the third uses I2Cdev. The I2Cdev sensor read time increases 4X if I initialize either of the two wire sensors first (even though the wire sensor traffic is 100% idle).

Is it bad form to run I2Cdev and Wire libraries in the same sketch? I can easily rewrite the I2Cdev library (or the other two libraries to I2Cdev), but before I do I thought i'd check with the brain trust. These libraries have been operating just fine together, but there is a 1300 microsecond difference in read time when Wire is fired up with I2Cdev.

For reference I'm running my bus at 400Khz using an ADXL375, a LSM6DSO32 IMU, and a MS5607 pressure sensor.

Thanks,

Mike
 
I resolved my own question regarding performance. I was setting my Wire clock speed and then initiating each sensor. The sensors that use wire, call another Wire.begin() and reset the clock speed to 100khz. So, duh. I reset the clock speed after initializing them and all is fast and fine again.

But, my broader question still stands. Are there other implications of using I2Cdev and standard Wire in the same sketch on a T4? I had never considered it. All is working well for me, but am I missing something?

Thanks
 
Status
Not open for further replies.
Back
Top