Hi all, My question is about the stm8 series. I am currently working with stm8s001jm3 and am trying to generate 2 MHz from a pin. The problem is that I can only generate a maximum of 380 kHz, although I have set everything correctly.
Im using the COSMIC Toolchain with the standard library.
Here is the setting:
##########################################################
void clock_init(void)
{
CLK_DeInit();
CLK_HSECmd(DISABLE);
CLK_LSICmd(DISABLE);
CLK_HSICmd(ENABLE);
while(CLK_GetFlagStatus(CLK_FLAG_HSIRDY) == FALSE);
CLK_ClockSwitchCmd(ENABLE);
CLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV1);
CLK_SYSCLKConfig(CLK_PRESCALER_CPUDIV1);
CLK_ClockSwitchConfig(CLK_SWITCHMODE_AUTO, CLK_SOURCE_HSI,
DISABLE, CLK_CURRENTCLOCKSTATE_ENABLE);
CLK_PeripheralClockConfig(CLK_PERIPHERAL_TIMER1, ENABLE);
}
##############################################################
who has experience with this processor and can help me ?