Figure 22. Clock switching flowchart (automatic mode example)
Reset
MCU in Run mode with HSI/8
Write target clock source in CLK_SWR
Target clock source ready after
CLK_SWR
CLK_CMSR
SWBSY
0
Set SWEN bit in CLK_SWCR
Target clock source powered on
SWBSY
1
stabilization time
Switch busy
MCU in Run mode
with new master clock source
SOFTWARE ACTIONHARDWARE ACTION
Reset switch busy flag
Update clock master status
Clear SWIF flag
Set SWIEN bit in CLK_SWCR to enable interrupt if suitable
Interrupt if activated
SWIF
1
Switch done