Skip to main content
MrEmou
Associate
April 12, 2023
Solved

STM32F407 Timer Update Frequency is Divided by Two

  • April 12, 2023
  • 1 reply
  • 1230 views

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?

This topic has been closed for replies.
Best answer by MrEmou

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.

1 reply

MrEmou
MrEmouAuthorBest answer
Associate
April 12, 2023

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.