Question
Why does I2C get stuck with HAL_BUSY state?
Hi, I am trying to read MPU6050 FIFO data with STM32F103C8T6 after I get an interrupt from MPU6050. All works well at start, but after some time I2C gets stuck with HAL_BUSY state and never recovers from it. Here is my code:
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
uint16_t count = MPU6050_GetFIFOCount(); // uses HAL_I2C_Mem_Read
if (count == MPU6050_DMP_PACKET_SIZE)
{
// uses HAL_I2C_Mem_Read_DMA non-blocking to read 28 bytes
HAL_I2C_Mem_Read_DMA(&hi2c1, MPU6050_ADDRESS, MPU6050_RA_FIFO_R_W, 1, fifoBuffer, MPU6050_DMP_PACKET_SIZE);
}
else if (count > MPU6050_DMP_PACKET_SIZE)
{
MPU6050_ResetFIFO(); // uses HAL_I2C_Mem_Write
}
}Am I doing something wrong? What could be causing I2C get stuck with HAL_BUSY state and never recover?
