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.

1 ACCEPTED SOLUTION

Accepted Solutions
SofLit
ST Employee

Hello,

It's a known bug in CubeMx. It will be fixed in coming versions of the tool.

Internal ticket number: 124251

So try to use older version of CubeMx.

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.

View solution in original post

15 REPLIES 15
SofLit
ST Employee

Hello,

It's a known bug in CubeMx. It will be fixed in coming versions of the tool.

Internal ticket number: 124251

So try to use older version of CubeMx.

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.

I didn't realise the CubeMX version was tied to the CubeIDE version (I was under the impression that you installed CubeMX separately). I've tried downloading en.st-stm32cubeide_1.8.0_11526_20211126_0815_x86_64.exe_v1.8.0.zip multiple times from the ST website but the file seems to be broken (7zip reports an error and Windows won't open the zip file either). Please can you ask someone to check this file please?

Hello,

You can download CubeMx separetly from this link and generate code for CubeIDE. Go to "Select version" menu to download an older version:

0693W00000LwRBkQAN.pngYou can open a new thread for the latest issue you reported.

Thank you for your understanding.

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.

Thank you, I have Cube MX v6.4.0 installed separately now. If I wish to use CubeMX from within CubeIDE (which is how I have been using it so far) the downloaded file for v1.8.0 seems broken. Please can you check this file please?

0693W00000LwRHEQA3.png

I just downloaded the file and unzipped it and there is no issue with the .exe file.

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.

That's very odd, I've just redownloaded the V1.8 installer again and the zip file is still corrupt. If I extract the zip file using 7zip (Windows native zip handler refuses to open the file) and run the installer I receive a message telling me the installer integrity check has failed.

0693W00000LwWUNQA3.pngI calculate the following hashes for the zip file I've downloaded:

"en.st-stm32cubeide_1.8.0_11526_20211126_0815_x86_64.exe_v1.8.0.zip"

MD5 f6fcfc8ed96ef7d516a2c7358cbaee7f

SHA256 fc5bbb9bf31dffcf6d6b1c9500a96f0a9e8c8d3d2214942b6c82eb0bf5a9ede5

Can you confirm the correct file hashes? Thanks.

I'm just curious, do you internally test the releases for these kind of issues? It's not the first time that I upgraded to latest "stable" version and some basic peripheral stopped working..

EDIT:

I tried to load the IOC file in older version of MX that I created in the new version and I'm not even allowed to do that. My configuration file has a lot of individually configured peripherals and I'm stuck at this version that does not allow me to use ADC. This is just not acceptable. I wish you could just open-source this tool so we can fix stuff ourselves..

EDIT 2:

You could bypass this check by modifying the line "MxCube.Version=6.5.0" to 6.4.0...

//cc @Community member​ 

SChen.10
Associate II

I have been fighting against the same problem for the last few weeks. At one point in time, the ADC clock was miraculously turned on in CubeMX. Instead of fighting another battle against CubeIDE/CubeMX installation, I saved the working version of the stm32h7xx_hal_msp.c and reused it over the new one created by CubeMX.

Attached are the diff screenshot and function code.

0693W00000Lxd8GQAR.png

void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc)
{
  GPIO_InitTypeDef GPIO_InitStruct = {0};
  RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
  if(hadc->Instance==ADC3)
  {
  /* USER CODE BEGIN ADC3_MspInit 0 */
 
  /* USER CODE END ADC3_MspInit 0 */
 
  /** Initializes the peripherals clock
  */
    PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_ADC;
    PeriphClkInitStruct.PLL2.PLL2M = 4;
    PeriphClkInitStruct.PLL2.PLL2N = 9;
    PeriphClkInitStruct.PLL2.PLL2P = 4;
    PeriphClkInitStruct.PLL2.PLL2Q = 2;
    PeriphClkInitStruct.PLL2.PLL2R = 2;
    PeriphClkInitStruct.PLL2.PLL2RGE = RCC_PLL2VCIRANGE_3;
    PeriphClkInitStruct.PLL2.PLL2VCOSEL = RCC_PLL2VCOMEDIUM;
    PeriphClkInitStruct.PLL2.PLL2FRACN = 3072;
    PeriphClkInitStruct.AdcClockSelection = RCC_ADCCLKSOURCE_PLL2;
    if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
    {
      Error_Handler();
    }
 
    /* Peripheral clock enable */
    __HAL_RCC_ADC3_CLK_ENABLE();
 
    __HAL_RCC_GPIOF_CLK_ENABLE();
    /**ADC3 GPIO Configuration
    PF10     ------> ADC3_INP6
    */
    GPIO_InitStruct.Pin = GPIO_PIN_10;
    GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
 
    /* ADC3 interrupt Init */
    HAL_NVIC_SetPriority(ADC3_IRQn, 5, 0);
    HAL_NVIC_EnableIRQ(ADC3_IRQn);
  /* USER CODE BEGIN ADC3_MspInit 1 */
 
  /* USER CODE END ADC3_MspInit 1 */
  }
 
}

Thank you for your help, I'm sure this will help others who find this post.

Following the advice of SofLit I'd downloaded V1.8 of the CubeIDE; the download now appears to now have been fixed.

en.st-stm32cubeide_1.8.0_11526_20211126_0815_x86_64.exe_v1.8.0.zip

MD5: 24db76ddbd4052e55b5f7537223d543d

SHA256: d5e520960b3d5ecef0f13609ac90ab82e93db13bd30b99f692458e28ca25d5d9