cancel
Showing results for 
Search instead for 
Did you mean: 

HSE Config

greg_t
Associate II
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
1 REPLY 1
brazov22
Associate II
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