2025-06-25 7:46 AM - last edited on 2025-06-25 7:53 AM by mƎALLEm
Hi
I am facing one issue I am trying to run Timer2 and as soon I have enable the by setting CR1 register bit CEN, My all flags in SR is getting set even I have enabled only(UIE) so my UIF flag bit in SR register must set but it is setting all (CC4IF CC3IF CC2IF CC1IF) .
Can you help me to understand is it normal or why it was happened?
B.R
Ashish
2025-06-25 8:27 AM
The flags get set regardless of whether or not the interrupt for that flag is enabled.
CCxIF flags will be set if CCRx = 0 and the counter is started with the channel in output mode (default). If the interrupt is not enabled, it will not fire as a result of these flags. This is the expected behavior and no action is required.
2025-06-25 11:04 PM - edited 2025-06-25 11:29 PM
Hi
Thansks for your reply .
I have another doubt which I am facing I am running timer1 at 1MHZ clock frequency so When I loaded value in ARR with (999) which represents me 1ms delay(Which is fine I am able to generate 1ms delay).
But when I am loading 999 value in CCR1 register instead of in ARR register (Note : I am getting delay of 500 microseconds and total wave is 1ms so I want to know Why is it working like this can you help me with understanding.)
NOTE: I am working with downcounter and in my ARR register value is 0xFFFF.
I have attached screenshots of registers for better understanding.
B.R
Ashish
2025-06-26 6:52 AM
The Reference Manual goes into detail into how to timer operates.
Why are you loading 500 in CCR1? What is your goal here?
The screenshots show CCR1 is not 500.