Skip to main content
Visitor II
December 25, 2021
Question

LSI clock selection does not seem to work on STM8S207 Nucleo-32 board.

  • December 25, 2021
  • 1 reply
  • 685 views

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 (;;) ;

    This topic has been closed for replies.

    1 reply

    ST Employee
    January 12, 2022

    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/