Skip to main content
KHuyn
Associate III
September 8, 2019
Solved

What will happen if I turn on multiple System Clock source on(MSI - HSI - HSE )

  • September 8, 2019
  • 3 replies
  • 1705 views

Hello every one.

I am working with the STM32L4R5ZI. By default, it will uses MSI as the system clock source at 4Mhz.

My question is: what will happen if I turn on HSI or/and HSE without turning the other clock source off?

Thank you in advance?

This topic has been closed for replies.
Best answer by Piranha

Setting HSION bit in RCC_CR register only turns on that oscillator, but doesn't select it as a system clock. The same is true for other oscillators. System clock is selected with RCC_CFGR register SW bits and You can't select multiple sources there.

3 replies

Tesla DeLorean
Guru
September 8, 2019

You'll have multiple clocks ticking, one of which you are clocking the rest of the part with.​

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
KHuyn
KHuynAuthor
Associate III
September 9, 2019

Thank you for your reply, but I don't quit get your explanation :(

Piranha
Principal III
September 9, 2019

Turning on/off oscillators and selecting system clock are two different and to some extent unrelated things. But of course the oscillator, selected as a system clock at that particular moment, must be on.

KHuyn
KHuynAuthor
Associate III
September 9, 2019

0690X00000AQtR4QAL.png

Sorry, my question was unclear. Yes, I was asking what happen when more than 2 clock sources are selected, what is the SYSCLK will be eventually?

Say that I set the HSION = 1 in RCC->CR to select HSI as my desired clock source, but forgot to turn off MSION in my code(which is selected as default).

Hope that is more clear.

Thank

Tesla DeLorean
Guru
September 9, 2019

The mux can select only one source. You can have other clocks​ running.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Piranha
PiranhaBest answer
Principal III
September 9, 2019

Setting HSION bit in RCC_CR register only turns on that oscillator, but doesn't select it as a system clock. The same is true for other oscillators. System clock is selected with RCC_CFGR register SW bits and You can't select multiple sources there.

KHuyn
KHuynAuthor
Associate III
September 9, 2019

Thank you. That clears my mind.