STM8S HSI clock init bug/typo
Posted: Mon Feb 20, 2012 1:58 pm
It seems the HSI clock initialization is not correct in os\hal\platforms\STM8S\hal_lld.c
The ICKR should be set to CLK_ICKR_HSIEN. However, the code might not be needed at all (?), because the HSI is enabled by default at startup and the HSI RC output clock is not released until this bit is set by hardware (and there has been code already executed - stack init etc.)
Code: Select all
/* Makes sure that HSI is stable before proceeding.*/
CLK->ICKR |= CLK_ICKR_HSIRDY;
while ((CLK->ICKR & CLK_ICKR_HSIRDY) == 0)
;
The ICKR should be set to CLK_ICKR_HSIEN. However, the code might not be needed at all (?), because the HSI is enabled by default at startup and the HSI RC output clock is not released until this bit is set by hardware (and there has been code already executed - stack init etc.)