cancel
Showing results for 
Search instead for 
Did you mean: 

Switching between the system clock sources

nanayakkaraan
Associate II
Posted on November 19, 2010 at 05:42

Switching between the system clock sources

3 REPLIES 3
Posted on May 17, 2011 at 14:15

I think you are one of a handful using the STM32L

The sequence will likely go

 Enable HSI

 Wait for HSI to start

 Switch to HSI

 Wait for HSI to become source

 Disable other clocks (MSI, etc)

There should be examples of this, or other clock switches, in the STM32L or other STM32 series parts.

The reverse sequence will likely go

 Enable MSI

 Wait for MSI to start

 Switch to MSI

 Wait for MSI to become source

 Disable other clocks (HSI, etc)

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
picguy2
Associate II
Posted on May 17, 2011 at 14:15

Just do it.  But do understand that some processors and debuggers can do bad stuff.

I’m a “just do it�? kind of guy.  But that cost me $49+s/h on a non-ST demo board.  I stopped the clock leaving the debugger no way to recover.  Thereafter I first prove that I can read a push button on the demo board and loop waiting until it is released before going on.  If I kill something real bad I can boot with the button pressed and stop things before my code messes up.

It’s only a little code and can be left in production code.  Pull the pin up.  Then when needed ground the pin.  Program then waits before any clock changing.
nanayakkaraan
Associate II
Posted on May 17, 2011 at 14:15

Hello clive1,

Thank you for replying. 🙂

Will give it a try later.