cancel
Showing results for 
Search instead for 
Did you mean: 

Stm32f407vgtx Timer Funtionality

Ash1
Associate III

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

3 REPLIES 3
TDK
Super User

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.

If you feel a post has answered your question, please click "Accept as Solution".
Ash1
Associate III

image.pngimage.pngimage.pngHi 

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

TDK
Super User

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.

If you feel a post has answered your question, please click "Accept as Solution".