cancel
Showing results for 
Search instead for 
Did you mean: 

MPU6050 I2C accelerometer and gyro readings returning odd values with stm32l432kc nucleo board

Susano
Associate II

I have implemented a small I2C driver for stm32l432kc board and tried to use it to read from a couple of MPUs I have first:

  • I can read single WHO_AM_I register correctly giving 0x68 asserted in the debugger
  • I can write to the POWER_MGMT_1 register to wake up the device and read back the new values

what is going wrong is that:

  • the readAcc and readGyro functions returning either constant nonsense or zeros randomly
  • I also noticed that it creates an arbitration loss in the start of some runs only in the first read or write and if it doesn't happen it never again

I don't have analyzers to check the bus so I hope I am missing something obvious any idea about what might be the problem would be really appreciated

 acc and gyro readings screen shot :0693W00000YA1QLQA1.png

1 REPLY 1
Susano
Associate II

The problem was just using an unsigned buffer to store the values which resulted in negative values to be represented out of range, The zeros and the arbtration loss was because a small timeout delay was needed for the MPU after each transmission