2021-06-04 12:38 PM
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.
2021-06-04 01:45 PM
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.