2025-02-18 02:45 AM - edited 2025-02-18 04:09 AM
I am working with STM32 U5A5 series of STM32 controllers and currently facing one issue with ADC1, Getting timeout when we try to enable ADC(this issue we are getting only for ADC1 and ADC4 is working as expected).
Below are the code
hadc1.Instance = ADC1;
hadc1.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV1;
hadc1.Init.Resolution = ADC_RESOLUTION_14B;
hadc1.Init.GainCompensation = 0;
hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT;
hadc1.Init.ScanConvMode = ADC_SCAN_DISABLE;
hadc1.Init.EOCSelection = ADC_EOC_SINGLE_CONV;
hadc1.Init.LowPowerAutoWait = DISABLE;
hadc1.Init.ContinuousConvMode = DISABLE;
hadc1.Init.NbrOfConversion = 1;
hadc1.Init.DiscontinuousConvMode = DISABLE;
hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START;
hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;
hadc1.Init.DMAContinuousRequests = DISABLE;
hadc1.Init.LeftBitShift = ADC_LEFTBITSHIFT_NONE;
if (HAL_ADC_Init(&hadc1) != HAL_OK)
{
Error_Handler();
}
__HAL_RCC_GPIOC_CLK_ENABLE();
/** Configure Regular Channel
*/
sConfig.Channel = ADC_CHANNEL_4;
sConfig.Rank = ADC_REGULAR_RANK_1;
sConfig.SamplingTime = ADC_SAMPLETIME_5CYCLE;
sConfig.SingleDiff = ADC_SINGLE_ENDED;
sConfig.OffsetNumber = ADC_OFFSET_NONE;
sConfig.Offset = 0;
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
{
Error_Handler();
}
HAL_ADCEx_Calibration_Start( &hadc1, ADC_CALIB_OFFSET, ADC_SINGLE_ENDED );
Inside HAL_ADCEx_Calibration_Start function ADC_Enable(hadc) is called there we are getting timeout.
can anyone please help me to figure out what is missed. Same code is working fine with U575 series but getting timeout issue for U5A5 series.
2025-02-18 03:02 AM
Do you have the analog voltage domain isolation removed, i.e. PWR_SVMCR.ASV set?
JW
2025-02-18 03:07 AM
yes PWR_SVMCR.ASV set
2025-02-18 05:19 AM
Hello @mohan-ltts
Please refer to the example Projects/NUCLEO-U575ZI-Q/Examples/ADC/ADC_SingleConversion_TriggerSW_IT to correctly set up your configuration.
2025-02-18 05:22 AM - edited 2025-02-18 05:24 AM
Hello @Saket_Om ,
In U575 board it is working as expected and with U5A5 board only we are getting timeout issue.
Any changes we need specific to U5A5 board compare to U575?
Thanks,
Mohan
2025-02-18 05:46 AM
The linked example uses the U575 and ADC1. Probably worth checking out.
2025-02-18 05:53 AM
Hello @mohan-ltts
I have reported your issue internally. However, if you can share your project, we will be able to assist you more effectively.
Internal ticket number: 203506 (This is an internal tracking number and is not accessible or usable by customers).
2025-02-18 05:53 AM
ADC clock enabled and running?
Read out and check/post ADC registers content.
JW
2025-02-19 05:13 AM
ADC clock enabled.