2020-07-27 08:21 AM
In STM8S_StdPeriph_Lib V2.3.0 (last version?) in file stm8s_clk.h in CLK_Flag_TypeDef
are wrong defined
CLK_FLAG_CCOBSY = 0x0504
CLK_FLAG_CCORDY = 0x0502
it should be
CLK_FLAG_CCOBSY = 0x0540
CLK_FLAG_CCORDY = 0x0520
according to header file definitions
#define CLK_CCOR_CCOBSY ((uint8_t)0x40) /*!< Configurable clock output busy */
#define CLK_CCOR_CCORDY ((uint8_t)0x20) /*!< Configurable clock output ready */
that mistake leads to unpredictable behavior because it reads CCOSEL bits combination instead of flag status !