2021-12-24 04:32 PM
Using the code fragment below I would expect the code to hang if it got an error during the clock switch or it actually switched to the LSI clock. But the test code keeps running and starts blinking an LED.
CLK_LSICmd(ENABLE);
CLK_ClockSwitchCmd(ENABLE);
if (SUCCESS != CLK_ClockSwitchConfig(
CLK_SWITCHMODE_AUTO,
CLK_SOURCE_LSI,
DISABLE,
CLK_CURRENTCLOCKSTATE_DISABLE))
{
for (;;) ;
}
if (CLK_GetSYSCLKSource() != CLK_SOURCE_HSI) for (;;) ;
2022-01-12 02:06 AM
Hello,
System clock switch to LSI can be done only if LSI is enabled within option bytes (please have a look LSI_EN_OPT_BIT on figure 20 within RM0016 reference manual), otherwise this change will be ignored.
Could you please check your settings within option bytes and try to execute your code?
Best Regards,
Artur Iwanicki,
/STMicroelectronics/