Skip to main content
Graduate
November 20, 2023
Solved

What will happen when I forget to call system clock configuration.

  • November 20, 2023
  • 3 replies
  • 1830 views

Hi People,

I need to know what will happen when I forget to set the clock configuration by using system clock configuration function. 

Is there any default clock configuration will set in the microcontroller when I forget to set clock configuration?

I'm raising this because I can able to feed the complied code which doesn't have a clock configuration. And still I can able to debug the uploaded code with stm32h7.

    This topic has been closed for replies.
    Best answer by STTwo-32

    Hello @SKuma.24 

    As you Can see in the RM0433 part 8.5.6 : "After a system reset, the HSI is selected as system clock and all PLLs are switched OFF". When you forget to call system clock configurations, a default system clock configuration is applied use the registers default parametres. You Can find more details in the reference manual of your MCU.

    Best Regards.

    STTwo-32

    3 replies

    Super User
    November 20, 2023

    i am just guessing:  might be, what CubeMx shows, when you start a project (and set nothing)

    AScha3_0-1700503089580.png

    HSI driving core and bus...otherwise no start code/your code could start ever.

    STTwo-32Answer
    Technical Moderator
    November 20, 2023

    Hello @SKuma.24 

    As you Can see in the RM0433 part 8.5.6 : "After a system reset, the HSI is selected as system clock and all PLLs are switched OFF". When you forget to call system clock configurations, a default system clock configuration is applied use the registers default parametres. You Can find more details in the reference manual of your MCU.

    Best Regards.

    STTwo-32

    Graduate II
    November 20, 2023

    MCU just continues clocking from HSI or MSI clock that it start with by default, and all the AHB / APB are basically at DIV1 settings.

    On H7 most will be running at 64 MHz HSI across all buses.

    Graduate II
    November 20, 2023

    You know, you can bring up a UART and print this stuff out

    void SystemDiagnostic(void)
    {
     printf("\n\nCore=%d, %d MHz\n", SystemCoreClock, SystemCoreClock / 1000000);
     CORECheck();
     IDCODECheck();
     FPUCheck();
     printf("APB1=%d\n", HAL_RCC_GetPCLK1Freq());
     printf("APB2=%d\n", HAL_RCC_GetPCLK2Freq());
    }