0
\$\begingroup\$

I am using an STM microchip to communicate with an IMU over I2C. I am requesting 3 axis of acceleration information from the IMU (x,y,z). I have the ODR Selection frequency set at 1.66 kHz. Currently the acceleration values don't always update every 1 ms (I have a timer set to send the acceleration data out over UART every 1 ms). The I2C baud rate is set as fast as it can go. Currently about 1 every 3 data points does not update. Any thoughts on initially where I can start looking for a solution?

I can add some of the code that I'm using. However, I don't think would be helpful to just lay it all in here. I am more looking for a trouble shooting starting point, or maybe some common mistake I might be making.

\$\endgroup\$
  • 3
    \$\begingroup\$ Did you check the signal integrity of the I2C lines (rise time) with a scope? \$\endgroup\$ – Voltage Spike Jul 18 at 15:27
  • 3
    \$\begingroup\$ Are you sure that you set the I2C to the lesser of the max speed of the MCU and the accelerometer chip? What is the maximum sample rate of the accelerometer chip? How do you know that they aren't updating and it's not that they simply have the same value from one millisecond to the next? It may help to add the specific accelerometer chip PN and the MCU PN so we can read datasheets. \$\endgroup\$ – Ron Beyer Jul 18 at 15:45
  • 2
    \$\begingroup\$ How many characters are you sending via the UART, and at what baud rate? You say the I2C baud rate is set "as fast as it can go"...how fast is that? How much of this communication is handled by interrupts? \$\endgroup\$ – Elliot Alderson Jul 18 at 15:45
  • \$\begingroup\$ As Ron mentioned, datasheet links would be helpful. \$\endgroup\$ – JYelton Jul 18 at 16:15

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.