2020-04-28 11:17 PM
hi,
I am working on a stepper motor driver with stm32f407. Facing a challenge in generating exact number of steps for driving the motor. Now what i have done is, i shorted a pwm generating pin with input capture and stops the pwm generation once the input capture reaches the pulse count.
my question is
Thanks
2020-04-28 11:30 PM
please let me know if you want more description!.
2020-04-28 11:47 PM
The'F4 is not the best for this purpose.
Use one-pulse mode in a timer which has RCR - in 'F4, only TIM1 and TIM8, and they have only 8-bit RCR.
Other option is to gate one timer from other through internal master-slave connection, or stop one timer from other using DMA after a precalculated time or after having counted pulses through internal master-slave connection or through external connection as you've done it.
JW
2020-04-29 12:38 AM
> i shorted a pwm generating pin with input capture and stops the pwm generation once the input capture reaches the pulse count.
You could do this internally with a slave timer. Read timer functional description / timer synchronization / using one timer as prescaler for another timer in the reference manual. See the example there, TIM1 as master providing the PWM signal and the pulses for the TIM2 counter.
If that works, move on to the next example Using one timer to enable another timer in the reference manual, but swap TIM1 and TIM2, so that TIM2 would be the master, generating a PWM signal which is used internally to gate the TIM1 counter. As TIM2 is using TIM1 as its clock source, set the PWM duty cycle (compare register) to the number of pulses required.
2020-06-18 12:01 AM
Hi :)
I'm facing the same problem as AP.2 previously.
I'm beginner in STM32 Programming. I'm using a Nucleo F446RE.
So i want to generate an exact amount of inpulsion with a predetermined frequencie.
I' ve done some reasearchs about the one pulse mode but I don't think it really corespond to what i want to do.
So does it exist a way to trigger a series of pulse that are only generate by hardware so my main is not block?
G.Anto.2
2020-06-18 12:23 AM
I believe what has been written above by berendi and me still pertains.
One-pulse mode using RCR is still the easiest way. Try.
JW
2020-06-18 12:34 AM
Ok :) i don't really no what RCR is but i will try my best if it's the easiest way ^^
thanks you for replying so fast :D
GAnto.2
2020-06-18 12:55 AM
Repetition Count Register.
Read the TIM1/TIM8 chapter in Reference Manual.
JW