cancel
Showing results for 
Search instead for 
Did you mean: 

Similar question to "I'm a STMCube Newbie. I'm under the impression when I set up the clocks in STM32CubeIDE, it should generate all the clock configurations. Right now I'm not getting the RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; Should it be there."

JChoi.12
Associate II

Does anyone have the same issue?

Link to a similar question:

https://community.st.com/s/question/0D53W0000260fFASAY/im-a-stmcube-newbie-im-under-the-impression-when-i-set-up-the-clocks-in-stm32cubeide-it-should-generate-all-the-clock-configurations-right-now-im-not-getting-the-rccperiphclkinittypedef-periphclkinit-0-should-it-be-there-see-clock-config

I also want the cubeMX to add "RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};"automatically command in "void SystemClock_Config(void)" function, but it isn't.

1 ACCEPTED SOLUTION

Accepted Solutions

In src folder you have generated file stm...._hal_msp.c and in it

for example

void HAL_LTDC_MspInit(LTDC_HandleTypeDef* hltdc)
{
  RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
  if(hltdc->Instance==LTDC)
  {
  /* USER CODE BEGIN LTDC_MspInit 0 */
 
  /* USER CODE END LTDC_MspInit 0 */
  /** Initializes the peripherals clock
  */
    PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
    PeriphClkInitStruct.PLLSAI.PLLSAIN = 66;
    PeriphClkInitStruct.PLLSAI.PLLSAIR = 2;
    PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_2;
    if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
    {
      Error_Handler();
    }
 

simply use Search in your project ...

View solution in original post

3 REPLIES 3
MM..1
Chief II

I mean this is in msp file under peripheral init...

I'm sorry, but would you be able to provide more detailed information?

In src folder you have generated file stm...._hal_msp.c and in it

for example

void HAL_LTDC_MspInit(LTDC_HandleTypeDef* hltdc)
{
  RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
  if(hltdc->Instance==LTDC)
  {
  /* USER CODE BEGIN LTDC_MspInit 0 */
 
  /* USER CODE END LTDC_MspInit 0 */
  /** Initializes the peripherals clock
  */
    PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
    PeriphClkInitStruct.PLLSAI.PLLSAIN = 66;
    PeriphClkInitStruct.PLLSAI.PLLSAIR = 2;
    PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_2;
    if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
    {
      Error_Handler();
    }
 

simply use Search in your project ...