cancel
Showing results for 
Search instead for 
Did you mean: 

Not getting ADC ready signal (ADRDY bit) after enable STM32U5A5

mohan-ltts
Associate II

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;

HAL_PWREx_EnableVddA();
RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
 
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADCDAC;
PeriphClkInit.AdcDacClockSelection = RCC_ADCDACCLKSOURCE_HSI;
if ( HAL_RCCEx_PeriphCLKConfig( &PeriphClkInit ) != HAL_OK )
{
printk( "ADC Peripheral clock enable failed \n" );
}
 __HAL_RCC_ADC1_CLK_ENABLE();

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.

8 REPLIES 8

Do you have the analog voltage domain isolation removed, i.e. PWR_SVMCR.ASV set?

JW

yes PWR_SVMCR.ASV set

mohanltts_0-1739876818347.png

 

Saket_Om
ST Employee

Hello @mohan-ltts 

Please refer to the example Projects/NUCLEO-U575ZI-Q/Examples/ADC/ADC_SingleConversion_TriggerSW_IT to correctly set up your configuration.

If your question is answered, please close this topic by clicking "Accept as Solution".

Thanks
Omar

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

The linked example uses the U575 and ADC1. Probably worth checking out.

If you feel a post has answered your question, please click "Accept as Solution".

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).

If your question is answered, please close this topic by clicking "Accept as Solution".

Thanks
Omar

ADC clock enabled and running?

Read out and check/post ADC registers content.

JW

ADC clock enabled.

mohanltts_0-1739970729419.png