2019-02-22 08:47 AM
Hi,
I am using STM32F101VD to communicate via I2C with MPU6050 IMU device. Data transfer (reading and writing) is done using DMA. Additionally I connected one of my ST32's GPIO (configured as EXTI - Rising IT) to MPU's INT pin. I am using HAL libraries.
To sumarize... I execute data transfer with Transmit_DMA... When I get interrupt on INT pin from MPU6050 that data is ready I do Receive_DMA.
The whole process works just fine - data is transfered at constant speed. But periodicaly I get one corrupted data packet. So one set of 14 bytes has some bytes corrupted... how I know? Values are invalid... for the Temperature.... calculation gives me 97degC. Also gyro and accelerometer data is set to 0.
If MPU is set at 1kHz sampling rate it happens that every 10th or 12th data will be corrupted. I noticed this happens with any sampling rate. I2C clock is set at 400kHz.
I connected logic analyzer to the SCL, SDA and INT lines to inspect traffic. And it showed out that corrupted data is present on the bus.
MPU6050 INT pin is raising interrupts as expected. The length of the pulse is 48us and it's periodically. Works fine.
What could be wrong... data transfer is done with DMA so I don't really have direct access to that data itself. What could be causing that I get corrupted data periodically?
Any help, idea... much appreciated!
Thanks!