cancel
Showing results for 
Search instead for 
Did you mean: 

Can anyone explain how to enable the ADC Clock Source on an STM32H753ZI using STM32 Cube?

LNash.1
Associate II

I'm new to Cube IDE and Cube MX but I've been trying to create a simple project based on an STM32H753ZI to investigate ADC capture.

Having enabled a few channels on ADC3 I looked in the clock tree to find the ADC clock speed but it's greyed out. When I hover over the ADC Clock Mux section I get a message saying "ADC Clock Source is not available" and to configure one in the Pinout Tab ADC.

I can't see any options that mention anything to do with a clock in the ADC section (or , I've seen screenshots from the STM32H743 where there is a "Clock Prescaler" option under ADC_Settings, but I don't see this option in my case. I've seen that sometimes options only become visible when other options have first been set, so hopefully this is something simple that I've overlooked.

Any help would be welcomed.

15 REPLIES 15
SChen.10
Associate II

Thanks for the information. I downloaded the earlier version of CubeIDE and CubeMX but they don't allow me to open the files created by a new version. I have too much invested in the current project so I guess I am stuck with my method until the newer version fixes the problem.

I wish there were errata sheets of the software tools (maybe there are I didn't know) so I wouldn't spend so much time fighting the tools.

>  but they don't allow me to open the files created by a new version.

Edit the .ioc file and change the Cube version to what matches your older CubeMX.

(of course, keep a backup).

Chances are it will open.

Hansel
Senior

It's been two months and a new version of cubeMX still hasn't been pushed. When is this expected to be fixed and made available to the community?

willcfj
Senior

Thanks for this post! After several hours of analyzing got enough for a decent Google search and presto, this thread! Kind of OK if every once in a while the problem isn't my coding! Alas too late to revert to an older CubeMX, so will go work on other parts of the project until the fix comes out. Hopefully soon though, it has been a while.

will

Thanks for that !

I was able to configure the ADC clock by modifying HAL_ADC_MspInit(ADC_HandleTypeDef* hadc) function in stm32h7xx_hal_msp.c

void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc)
{
  GPIO_InitTypeDef GPIO_InitStruct = {0};
  if(hadc->Instance==ADC1)
  {
  /* USER CODE BEGIN ADC1_MspInit 0 */
	RCC_PeriphCLKInitTypeDef PerifClkInitStruct = {0};
	PerifClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_ADC;
	PerifClkInitStruct.AdcClockSelection = RCC_ADCCLKSOURCE_PLL2;
	if(HAL_RCCEx_PeriphCLKConfig(&PerifClkInitStruct) != HAL_OK){
		Error_Handler();
	}
 
  /* USER CODE END ADC1_MspInit 0 */
    /* Peripheral clock enable */
    __HAL_RCC_ADC12_CLK_ENABLE();
 
    __HAL_RCC_GPIOA_CLK_ENABLE();
    __HAL_RCC_GPIOB_CLK_ENABLE();
    /**ADC1 GPIO Configuration
    PA4     ------> ADC1_INP18
    PB0     ------> ADC1_INN5
    PB0     ------> ADC1_INP9
    PA3     ------> ADC1_INP15
    PB1     ------> ADC1_INP5
    */
    GPIO_InitStruct.Pin = CUR_FMC_3V3_Pin|CUR_BUS_3V3_Pin;
    GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
 
    GPIO_InitStruct.Pin = CUR_BUS_12V0_Pin|CUR_FMC_12V0_Pin;
    GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
 
  /* USER CODE BEGIN ADC1_MspInit 1 */
 
  /* USER CODE END ADC1_MspInit 1 */
  }
 
}

I didn't touch the clock divider value (PLL2M, PLL2N..) or any other field, just configure the AdcClockSelection field.

Now the DAC is working !

SChen.10
Associate II

Just updated STM32CubeMX from Version 6.5.0 to 6.6.1.

After migrating the project to the newer version, I agreed to run the automatic clock issues solver and the ADC clock is properly configured now.