Skip to main content
Visitor II
October 31, 2023
Solved

ADC_DMA_Transfer example on NUCLEO-U575ZI-Q board failure to go through

  • October 31, 2023
  • 1 reply
  • 1392 views

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.

    This topic has been closed for replies.
    Best answer by hguan

    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.

    1 reply

    Technical Moderator
    October 31, 2023

    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. 

     

    hguanAuthor
    Visitor II
    October 31, 2023

    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.