cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U5 ADC hangs at calibration

ASimo.3
Associate III

I have a nucleo-U575ZI-Q and can run the examples for the ADCs just fine. However when I try and make my own project using STM32CubeMX the code hangs at the ADC calibration. I've gone over the settings a dozen times and compared them against the example and cannot find anything different. Any insight would be helpful. Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
ASimo.3
Associate III

Ok I figure it out. But this really should be noted somewhere in the examples. This line needs run before the ADC usage. HAL_PWREx_EnableVddA(); Im sure there are other ways to setup the Voltage reference, but in the simplest case this works. In the example projects it is buried in stm32u5xx_hal_msp.c here:

void HAL_MspInit(void)
{
  /* USER CODE BEGIN MspInit 0 */
 
  /* USER CODE END MspInit 0 */
 
  __HAL_RCC_PWR_CLK_ENABLE();
 
  /* System interrupt init*/
 
  /* USER CODE BEGIN MspInit 1 */
   HAL_PWREx_EnableVddA();
   HAL_PWREx_EnableVddIO2();
  /* USER CODE END MspInit 1 */
}

CubeMX doesnt seem to generate this, it looks like whoever made the example stashed those lines there.

View solution in original post

2 REPLIES 2
ASimo.3
Associate III

Ok I figure it out. But this really should be noted somewhere in the examples. This line needs run before the ADC usage. HAL_PWREx_EnableVddA(); Im sure there are other ways to setup the Voltage reference, but in the simplest case this works. In the example projects it is buried in stm32u5xx_hal_msp.c here:

void HAL_MspInit(void)
{
  /* USER CODE BEGIN MspInit 0 */
 
  /* USER CODE END MspInit 0 */
 
  __HAL_RCC_PWR_CLK_ENABLE();
 
  /* System interrupt init*/
 
  /* USER CODE BEGIN MspInit 1 */
   HAL_PWREx_EnableVddA();
   HAL_PWREx_EnableVddIO2();
  /* USER CODE END MspInit 1 */
}

CubeMX doesnt seem to generate this, it looks like whoever made the example stashed those lines there.

Hi @ASimo.3​ ,

The sequence to be applied in order to enable analog peripherals is described in page 371 of RM0456 (paragraph: Peripheral voltage monitoring (PVM)).

So, in your case, only HAL_PWREx_EnableVddA() is required unless you need to use one of the pins GPIOG[15:2].

I confirm that this needs to be generated by STM32CubeMX, so thanks for bringing this issue to our attention. I reported issue internally.

Internal ticket number: 143303 (This is an internal tracking number and is not accessible or usable by customers).

-Amel

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.