Skip to main content
deep_rune
Associate III
September 3, 2020
Solved

STM32L412KB clock options

  • September 3, 2020
  • 3 replies
  • 774 views

Im using a STM32L412KB for the first time and Im a little confused about the clock options. I can't seem to change the clock speed (input frequency) in cubeIDE, it's always stuck on 8MHz. However I notice there is an internal oscillator - does this mean I don't have to use an external crystal? This would be very good for my design, but I'm not sure - what are the disadvantages of using an internal oscillator?

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

As I recall this L4 has a MSI clock sources as well as the HSI, and the MSI starts the part.

The MSI can be trimmed via the LSE (32.768 KHz) crystal.

Things like CAN and USB need an accurate clock source, as do things like radio/networking applications. If you have an existing clock source, like a TCXO, you can use that in many cases.

3 replies

TDK
September 3, 2020

If you're talking about the crystal clock speed, you need to enable it under RCC settings before you can change the value.

You can use the internal oscillator (HSI). The drawback is that it's less accurate.

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

As I recall this L4 has a MSI clock sources as well as the HSI, and the MSI starts the part.

The MSI can be trimmed via the LSE (32.768 KHz) crystal.

Things like CAN and USB need an accurate clock source, as do things like radio/networking applications. If you have an existing clock source, like a TCXO, you can use that in many cases.

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

The L412K has no HSE OSC_IN/OSC_OUT pins. But is has LSE OSC32 pins and you can use a 32768 Hz crystal or oscillatot to (PLL?) control MSI.

But the datasheets could be more specific about what the LSE controll of MSI can achieve.