Using PWM peripheral to output fixed number of pulses

I am attempting to control 3x stepper motor drivers with a STEP + DIR inputs. For this I need to be able to create a pulse train with 50% duty cycle with a fixed number of pulses. It appears there should be a way to do this with the PWM peripheral (1 PWM per output). Timing and outputting the exact number of pulses is critical for this application.

My current plan is to setup 3x PWM peripherals with an appropriate COUNTERTOP, PRESCALER, and COMP values for the frequency and 50% duty cycle. On a stepper motor command, set SEQ[0].CNT to the number of pulse I wish to generate and start SEQ0. The SEQEND0 event will be used to notify the system the move has been complete.

I have a few questions:
1.) What is the best way prevent the EasyDMA from incrementing memory space for each PWM CNT (each pulse has the same duty cycle)?

2.) Should I use the SEQEND0_STOP Short to disable the PWM when the CNT is reached?

3.) Is there a way to read what the current count value while the PWM peripheral is running?

Note: Settings are being controlled directly through register writes

Thanks!

Parents Reply Children
Related