2015-01-22 04:57 PM
In the STM32F4xx HAL, file stm32f4xx_hal_adc.c
there is this code/* Check if ADC peripheral is disabled in order to enable it and wait during
Tstab time the ADC's stabilization */
if((hadc->Instance->CR2 & ADC_CR2_ADON) != ADC_CR2_ADON)
{
/* Enable the Peripheral */
__HAL_ADC_ENABLE(hadc);
/* Delay inserted to wait during Tstab time the ADC's stabilazation */
for(; i <= 540; i++)
{
__NOP();
}
}
1. The for loop seems to be missing ''i = 0'' but the local variable is declared and 0'd at the top of the function. The for loop thus assumes no prior use of i.
2. The time delay is done with a no-no CPU-speed dependent constant.
I wonder if this runs only when the ADC is initialized at startup. So it won't hurt too much if it's wrong.
This seem
2015-02-26 08:45 AM
Hi childress.steve,
The delay for ADC stabilization time has been improved since in the last HAL release (HAL STM32F4 v1.4).To reply to your question items: 1- The delay method has been reworked and do no more use a for() loop. 2- The delay is now taking into account CPU frequency, in order to not have unnecessary delay when CPU is running at low frequency.Best regards,Heisenberg.