cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with Code Generation in STM32CubeIDE for STM32H747

SSerg.4
Associate II

Hi everyone,

I'm working on a project with STM32CubeIDE and an STM32H747 microcontroller. I've configured the clock sources in the .ioc file as follows:

  • High Speed Clock (HSE): BYPASS Clock Source

  • Low Speed Clock (LSE): Crystal/Ceramic Resonator

     

    SSerg4_0-1741119975325.png

     

When I generate the code, the process appears to complete successfully, as I don't receive any error messages. However, when I check the SystemClock_Config function, I don't see the clock configurations that I set. Here is the generated code:

 

void SystemClock_Config(void)
{
  RCC_OscInitTypeDef RCC_OscInitStruct = {0};
  RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};

  /** Supply configuration update enable
  */
  HAL_PWREx_ConfigSupply(PWR_SMPS_2V5_SUPPLIES_LDO);

  /** Configure the main internal regulator output voltage
  */
  __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);

  while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {}

  /** Initializes the RCC Oscillators according to the specified parameters
  * in the RCC_OscInitTypeDef structure.
  */
  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
  RCC_OscInitStruct.HSIState = RCC_HSI_DIV1;
  RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
  {
    Error_Handler();
  }

  /** Initializes the CPU, AHB and APB buses clocks
  */
  RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
                              |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2
                              |RCC_CLOCKTYPE_D3PCLK1|RCC_CLOCKTYPE_D1PCLK1;
  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
  RCC_ClkInitStruct.SYSCLKDivider = RCC_SYSCLK_DIV1;
  RCC_ClkInitStruct.AHBCLKDivider = RCC_HCLK_DIV1;
  RCC_ClkInitStruct.APB3CLKDivider = RCC_APB3_DIV1;
  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
  RCC_ClkInitStruct.APB4CLKDivider = RCC_HCLK_DIV1;

  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK)
  {
    Error_Handler();
  }}

It seems that the settings for HSE and LSE are not included. Can anyone help me understand why this is happening and how I can fix it?

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
AScha.3
Chief III

Hi,

you enabled HSE + LSE - ok.

But what you set/use in clock configuration ? -> This is what is used then in your program. (= generated code).

So show clock tree...   HSI is used - right ?

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

2 REPLIES 2
AScha.3
Chief III

Hi,

you enabled HSE + LSE - ok.

But what you set/use in clock configuration ? -> This is what is used then in your program. (= generated code).

So show clock tree...   HSI is used - right ?

If you feel a post has answered your question, please click "Accept as Solution".

you are right, I enabled HSE in the clock tree and I noticed the changes in the Code Generator. Thanks, problem solved.