cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F407 Timer Update Frequency is Divided by Two

MrEmou
Associate II

Hello everyone. I'm trying to use the TIM6 as a timer at 1 kHZ. However the result I get is 500 Hz. I couldn't figure out why.

I maxed the CPU clock speed at 168kHZ, which gives me the result of 84MHz APB1 Timer Clock.

I calculated the auto reload value using 1000 = 84000000/((PSC + 1) * (ARR + 1)) and got PSC=1 and ARR= 41999

Could you please tell me what I have done wrong in this setup?

1 ACCEPTED SOLUTION

Accepted Solutions
MrEmou
Associate II

Solved:

Everything was correct all along.

I was toggling the LED inside the interrupt. Oscilloscope calculated the frequency according to the square pulse formed by toggling the LED twice. That caused the oscilloscope to calculate frequency as 500 Hz.

View solution in original post

1 REPLY 1
MrEmou
Associate II

Solved:

Everything was correct all along.

I was toggling the LED inside the interrupt. Oscilloscope calculated the frequency according to the square pulse formed by toggling the LED twice. That caused the oscilloscope to calculate frequency as 500 Hz.