0

I'm using nano to access MPU 6050 chip. However, it took 5ms to update the loop and was costing me lots of time. So I wanted to find out if there's a way to accelerate the I2C bus speed.

Eventually, I read that the I2C bus speed for MPU 6050 was only at 400kHz. But that's seemed enough, as reading all 12 registry would only cost around 0.00026s, i.e. 0.26 ms.

I used the command found here Start I2C communication at an external event

Wire.setClock(400000);

It reduced timing form 5.6 ms to 4ms. However, when I tried to use the code

Wire.setClock(800000);

Amazingly, it still worked! It reduced timing from 4ms to 3.8 ms. And I still got the normal reading.

Is that the proper way to set the I2C bus speed for MPU 6050? Is there a way to do it by changing the register value? What's the maximum speed of I2C bus for MPU 6050?

  • invensense.com/wp-content/uploads/2015/02/… page 18 says f_SCL max 400kHz. The SPI bus interface can go up to 1 MHz instead :). Also note that I2C bus speed is one factor for execution time, the other being your processor speed and the instructions / length of the code needed by the MPU-6050 driver code to actually fetch the register contents and decode them. The transistors and internal logic in the chip might still do 500kHz, but that's beyond the specs of the datasheet. – Maximilian Gerhardt Feb 18 at 23:44
  • @MaximilianGerhardt So basically the chip could still function at 800 kHz? – ShoutOutAndCalculate Feb 18 at 23:50
  • Don't expect the chip to run at a bus speed faster than what the data sheet says. What @MaximilianGerhardt was suggesting was to connect it via SPI rather than I2C if you want faster communications. Also, the two setClock() calls you quoted are setting the same speed... – romkey Feb 19 at 0:44
  • The MPU will stretch the clock signal to stay inside the max frequency, so you will not get significantly faster than 400kHz with I2C. – chrisl Feb 19 at 7:32
  • @chrisl but look, it worked!and if you computing the time reduction it's approximately at the same range as expected. – ShoutOutAndCalculate Feb 19 at 16:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.