2023-04-12 02:52 AM
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?
Solved! Go to Solution.
2023-04-12 04:32 AM
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.
2023-04-12 04:32 AM
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.