Page 1 of 1

STM8S HSI clock init bug/typo

Posted: Mon Feb 20, 2012 1:58 pm
by cwia
It seems the HSI clock initialization is not correct in os\hal\platforms\STM8S\hal_lld.c

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.)

Re: STM8S HSI clock init bug/typo

Posted: Mon Feb 20, 2012 2:12 pm
by Giovanni
Thanks for finding, it will be fixed in next version.

Like you pointed out the code probably is not required but it is safer to assume the state is not 100% reliable, especially when the code is being debugged.

Giovanni