AnsweredAssumed Answered

STM32F4 Discovery change timer ARR on the fly

Question asked by hribar.anze on Dec 10, 2014
Latest reply on Dec 11, 2014 by hribar.anze
Hello everyone!

I am experiencing problem with my discovery board. 
I am trying to accelerate my stepper motor, so when i push the button, i decrease value in TIM2 ARR with this command:

uSeconds-=20;
TIM_SetAutoreload(TIM2, uSeconds);

TIM2 is configured so that every 1 unit in arr means 1uS.

So when i push the button, i decrease value in ARR and stepper motor speeds up. 
This actualy works, but when i push multiple times, the motor stops (so timere stops giving impulses). 

Where is the problem? 

The same thing hapens, when i try to accelerate the motor with other timer, so every 1ms tim4 changes ARR value of tim2. For some time it actually accelerates, but then it stops....And at random time...

I am very confused about this and i would really appreciate your help!

Thanks in advance!

Anže

Outcomes