Skip to main content
JChoi.12
Associate
March 12, 2023
Solved

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 th

  • March 12, 2023
  • 1 reply
  • 1126 views

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.

This topic has been closed for replies.
Best answer by MM..1

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

1 reply

MM..1
Chief III
March 12, 2023

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

JChoi.12
JChoi.12Author
Associate
March 12, 2023

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

MM..1
MM..1Best answer
Chief III
March 12, 2023

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