2 Replies Latest reply on Jun 7, 2018 12:37 PM by megas__2774361

    I am using a MPU9250. If I get the values from polling they are ok, If I get them from an interrupt they are all wrong. Why?

    megas__2774361

      Hi Cypress community.

       

      I'm making a little robot that will use a MPU9250 for balance purposes, the brain of the robot is a CY8CKIT-059.

      They communicate by using SPI, the PSoC being the master and the MPU9250 the slave.

      I made some functions to write and read registers on the MPU9250, and they work fine, but only if I call them from the main infinite loop.

      I put a timer to dictate the sampling rate of the system, and I am using the terminal count interruption to call the functions in the correct amount of time.

      The problem is that the values of the accelerometers (x, y and z), and gyroscopes (planes xy, xz and yz), are all wrong, like all over the place, if they are read from the interrupt, but are totally OK if they are read from the infinite loop.

       

       

      What would be the cause or a possible solution?