Skip to main content
Visitor II
July 25, 2011
Question

HSE Config

  • July 25, 2011
  • 1 reply
  • 616 views
Posted on July 25, 2011 at 17:35

I need to config my stm8s105k6 to work with oscillator of 16Mhz

my code :

CLK_ClockSwitchCmd ( ENABLE );

 CLK->SWR  = 0xB4;

 CLK->SWR  = 0xB4;

 while ( !(CLK->CMSR == 0xB4 ) );

I get stuck behind the while loop

Am I missing something ?

#hse-config
    This topic has been closed for replies.

    1 reply

    Visitor II
    July 26, 2011
    Posted on July 26, 2011 at 08:22

    you're missing at the beginning:

    /* Enables Clock switch */

    CLK->SWCR |= CLK_SWCR_SWEN;

    or better use:

    CLK_ClockSwitchConfig(CLK_SWITCHMODE_AUTO, CLK_SOURCE_HSE, DISABLE, DISABLE);

    brazov