Reinitilaization of ADC3 in DMA mode not working
Hey Guys,
Iam using a STM32F429IDISCOVERY board with ADC3 in dma mode. Sometimes on special usage circumstances ( a lot of stuff is happening in parallel) there is an overrun error, because the processor is not fast enough to get the packages. Normally I just want the ADC to stop and reinitialize again, but sadly this is not working correctly. I use the follwoing ADC error callback fucntion which should handle the problem but after it is executed the HAL status is ok but the ADC is not converting data and streaming it via DMA.
void HAL_ADC_ErrorCallback(ADC_HandleTypeDef *hadc) //todo: implement ADC error handling
{
if(hadc->Instance == ADC3)
{
ADC_Error3++;
HAL_ADC_Stop_DMA(&hadc3);
if(HAL_ADC_Start_DMA(&hadc3, (uint32_t *)&ADC3ConvertedData, \
ADC3_CONVERTED_DATA_BUFFER_SIZE) != HAL_OK)
{
Error_Handler();
}
}
if(hadc->Instance == ADC1)
{
ADC_Error1++;
HAL_ADC_Stop_DMA(&hadc3);
if(HAL_ADC_Start_DMA(&hadc1, (uint32_t *)&ADC1ConvertedData, \
ADC1_CONVERTED_DATA_BUFFER_SIZE) != HAL_OK)
{
Error_Handler();
}
}
}so the Error_Handler() gets not called but ADC isn't working either. Anyone an idea where the problem lies? As far as I have seen the HAL_ADC_Stop_DMA() routine, the interrupt flags get reset.
best regards
Benjamin