cancel
Showing results for 
Search instead for 
Did you mean: 

Reading from IMU at specific frequency

jagauthier
Associate III

Greetings,

I have an i2c connected IMU. I've connected it to a DMA channel and reading/writing like that. However, IMUs have a capability to run at a specific output data rate (ODR). In other architectures I would connect the interrupt pin to an external interrupt and when data is ready the interrupt handler reads the data, and then that clears the interrupt.

The interrupt is fired at the ODR so the data is received by the application exactly how it's supposed to be.

I'm wondering how this is done with DMA. I don't know how/when the data is read, or if reading the data would clear the interrupt when it was supposed to, etc.

Interested in hearing how to accomplish this.

1 REPLY 1
TDK
Guru

You can set up a timer to trigger an interrupt at the desired rate, and then initiate the I2C transfer from within that interrupt. If you're using HAL, there will be another interrupt at the end of the transfer that you can use to process the data.

If you feel a post has answered your question, please click "Accept as Solution".