cancel
Showing results for 
Search instead for 
Did you mean: 

Timer don't work when set ARR=0

mkari
Associate III

Hi

When I want timer count (CNT register) until ​5000 for overflow , Set ARR = 5000-1; now I want timer count until 1 So I have to set value ARR = 1_1 (ARR = 0) But When Set ARR = 0 timer don't work and don't have interrupt. Why??

​how to set ARR For that evry input pulse one overflow interrupt??

Tanks

7 REPLIES 7
berendi
Principal

The counter is "blocked" when ARR=0, this is explicitly stated in the reference manual (see the ARR register description).

You can use the trigger interrupt (TIM_DIER_TIE) instead.

You can make the Prescaler smaller, to zero for no division. The period needs some range to work with.

Interrupting beyond a few hundred KHz is probably going to saturate the processor.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Tanks

I want ​to have a overflow interrupt

For every clack that comes into the CNT counter.

P​ay attention to pictur

:backhand_index_pointing_down::backhand_index_pointing_down:

Please answer:pensive_face:​

Which part can you not understand?

It looks like a basic timer (TIM6/TIM7), right?

You want an interrupt with a certain frequency, and the prescaler is set to that frequency. According to the reference manual it's not possible.

Set the prescaler to the half of its present value, and set ARR=1. You will get an interrupt with the frequency you want.

mkari
Associate III

Yes it's true

I use this method.

But that has complicated the program.