2023-10-31 09:24 AM
I am loading and running example "ADC_DMA_Transfer" on NUCLEO-U575ZI-Q board but failed go through on function call
MX_ADC4_Init();
Step into this function, the software trapped in the ADC calibration process.
if (HAL_ADCEx_Calibration_Start(&hadc4, ADC_CALIB_OFFSET, ADC_SINGLE_ENDED) != HAL_OK)
{
Error_Handler();
}
The software failed to start calibration and then tangled in Error_Handler() permanently.
I searched through the early post but didn't find right solution.
Any thought on this issue? Thanks.
Solved! Go to Solution.
2023-10-31 12:18 PM
Hi, I found the issue, it is related to my hardware board. After I fixed the hardware (on power section) the ADC is working fine.
Appreciate your help.
2023-10-31 11:16 AM - edited 2023-10-31 11:16 AM
Hello @hguan
Could you check which kind of errors do you get from HAL? Is it linked to configuration/DMA error?
Could you share more details to reproduce the error?
Dump errors from registers view as well to make sure they are linked properly.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-10-31 11:53 AM
Thank you for your quick response.
The dead loop happened during function call of HAL_ADCEx_Calibration_Start(...) within
stm32u5xx_hal_adc_ex.c.
Inside the HAL_ADCEx_Calibration_Start(...), it calls LL_ADC_IsCalibrationOnGoing(...)
/* Wait for calibration completion */
while (LL_ADC_IsCalibrationOnGoing(hadc->Instance) != 0UL)
{
wait_loop_index++;
if (wait_loop_index >= ADC_CALIBRATION_TIMEOUT)
{
/* Update ADC state machine to error */
ADC_STATE_CLR_SET(hadc->State, HAL_ADC_STATE_BUSY_INTERNAL, HAL_ADC_STATE_ERROR_INTERNAL);
__HAL_UNLOCK(hadc);
return HAL_ERROR;
}
}
The function LL_ADC_IsCalibrationOnGoing(...) always return non-zero value:
READ_BIT(ADCx->CR, ADC_CR_ADCAL) = 0x80000000
Once the timeout reaches ADC_CALIBRATION_TIMEOUT, it returns HAL_ERROR to the caller and then the software hungs up in the
Error_Handler().
The hardware board in my test is using STM32U575VIT6Q, not the evaluation board NUCLEO-U575ZI-Q.
2023-10-31 12:18 PM
Hi, I found the issue, it is related to my hardware board. After I fixed the hardware (on power section) the ADC is working fine.
Appreciate your help.