Skip to main content
VNado.1
Associate III
November 30, 2020
Solved

How the System clock is set in the files? I see uint32_t SystemCoreClock = 4000000U in system_stm32l4xx.c however I had set 120MHz in CubeMX for SysClock...

  • November 30, 2020
  • 2 replies
  • 967 views

..

This topic has been closed for replies.
Best answer by Tesla DeLorean

It is a placeholder. The part doesn't start at 120 MHz.

Once you actually call code to configure the clock sources and PLL, it back computes the RCC/PLL settings and HSI, MSI and HSE, and writes a value to the variable.

2 replies

TDK
November 30, 2020

When the chip starts, it runs from the 4MHz clock.

The clock is changed in SystemClock_Config which is called from main. The SystemCoreClock variable is updated within the SystemClock_Config function.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Tesla DeLorean
Tesla DeLoreanBest answer
Guru
November 30, 2020

It is a placeholder. The part doesn't start at 120 MHz.

Once you actually call code to configure the clock sources and PLL, it back computes the RCC/PLL settings and HSI, MSI and HSE, and writes a value to the variable.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..