cancel
Showing results for 
Search instead for 
Did you mean: 

TIM2_ClearFlag(...) does not clear CCxOF overcapture flags

holojupe
Associate

 I am developing an application on STM8S003 using Standard Peripheral Library (V2.3.1). I noticed that TIM2_ClearFlag(...) function does not clear the overcapture flags (CCxOF) in the TIM2_SR2 register. When I examined the source code of the function I saw the line below:

TIM2->SR2 = (uint8_t)(~((uint8_t)((uint8_t)TIM2_FLAG >> 8)));

I think there is a downcasting which wipes out the flag information. My fix is;

TIM2->SR2 = (uint8_t)(~((uint8_t)(TIM2_FLAG >> 8)));

 Am I right or missing something ? Is there a page like known issues about this library?

Thank you in advance

0 REPLIES 0