2018-09-20 4:49 PM
Hello ,
When I debug the ADC1, In function HAL_ADC_Init(), it was blocked in " Enable ADC internal voltage regulator " because of the failure of verification ADC voltage regulator,.Here I attached the original code:
if (HAL_IS_BIT_CLR(hadc->Instance->CR, ADC_CR_ADVREGEN))
{
/* Enable ADC internal voltage regulator */
SET_BIT(hadc->Instance->CR, ADC_CR_ADVREGEN);
/* Delay for ADC stabilization time */
/* Wait loop initialization and execution */
/* Note: Variable divided by 2 to compensate partially */
/* CPU processing cycles. */
wait_loop_index = (ADC_STAB_DELAY_US * (SystemCoreClock / (1000000 * 2)));
while(wait_loop_index != 0)
{
wait_loop_index--;
}
}
/* Verification that ADC voltage regulator is correctly enabled, whether */
/* or not ADC is coming from state reset (if any potential problem of */
/* clocking, voltage regulator would not be enabled). */
if (HAL_IS_BIT_CLR(hadc->Instance->CR, ADC_CR_ADVREGEN))
{
/* Update ADC state machine to error */
SET_BIT(hadc->State, HAL_ADC_STATE_ERROR_INTERNAL);
/* Set ADC error code to ADC IP internal error */
SET_BIT(hadc->ErrorCode, HAL_ADC_ERROR_INTERNAL);
tmp_hal_status = HAL_ERROR;
}
I'm not sure whether the ADC1 is damaged or not.
look forward to you answers.
Thanks!
2022-05-03 1:29 AM
Hello,
It's seams that I have the same issue did you find any solution ?
Thanks
2022-05-25 12:45 PM
In my case, calling
__HAL_RCC_ADC_CLK_ENABLE()
prior to
HAL_ADC_Init()
fixed the issue.
I'm using STM32L4.