I have a STM32W rfckit 950 REV-A.
I' m using the STM32W108xx_SimpleMAC_V2.0.1 library.
I' d like to use a timer to switch a LED with a frequency of 1 Hz.
I' m using an interrupt service routine which should start at the timer update event.
This is my configuration:
Here the interrupt function:
I noticed that, as soon as the timer gets to 0, many of the pending interrupt register bits are set (I was expecting only the UIF).
Then, the function TIM_ClearITPendingBit doesn't work properly because it doesn't clear all ISR register bits (it clears just one at a time, while the others get set at each function call).
I found this turnaround is currently working:
I have 2 questions:
1) Why do I have to write 1s to get 0s in the register?
2) Is this the best way to do it, or am I missing something in the configuration of timer and interrupts?
Thank you and regards.