2021-10-29 04:12 AM
Hi,
I am using one I2C based peripherals with Interrupt enabled.
While using "HAL_I2C_Master_Transmit" and "HAL_I2C_Master_Receive", it seems to work properly with ISR.
But, when I am using the following I2C_DMA:
HAL_I2C_Master_Receive_DMA(&hi2c4, MPU_DEVICE_ADDR, mpu_datapair, 14);
It doesn't return updated values, it reads once and stops after that.
CubeIDE configuration includes:
Controller:
ISR for reference here:
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
UNUSED(GPIO_Pin);
if (GPIO_Pin == GPIO_PIN_12)
{
HAL_I2C_Master_Receive_DMA(&hi2c4, MPU_DEVICE_ADDR, mpu_datapair, 14);
}
}
I have also tried "HAL_I2C_Master_Transmit_DMA" for transmitting address, but no luck so far.
Any help would be much apreciated.
2021-10-29 11:16 AM
Do you call MX_DMA_Init before MX_ADC_Init?
2021-11-01 12:45 AM
Hi TDk,
Thanks for your reply.
I am not using ADC, but I2C.
2021-11-01 04:11 AM
Hi @Community member ,
@TDK means that maybe you have the DMA initialization issue (using CubeMx v6.3.0) which needs to be before any other peripheral initialization.
So, in this case try update the line MX_DMA_Init(); before any other peripheral initialization.
I'll be waiting for your feedback.
When your issue is solved, please close this topic by choosing Select as Best. This will help other users find that answer faster.
Imen
2021-11-01 06:44 AM
Do you call MX_DMA_Init before MX_I2C_Init?