Dear TI,
I am trying to use "Single Pulse Mode" to generate single pulses, and it doesn't work - I'm getting pulses of strange length and invalid polarity. Please, let me know how is the pulse length configured in this mode.
I have assumed that it will be exactly like for "usual" operation of DPWM in any other mode, except that the pulses will need to get triggered by software. I have already learned, that the triggering is done by toggling PWM_EN bit.
In my case the line idles high, so the pulse pulls it low for its duration (PWM_x_INV = 1).
In "continuous mode" (in particular this is Multi-output Mode, PWM_MODE = 2), the pulses are generated correctly, for example:
Here fsw = 20kHz, duty cycle = 25%. The pulses are "negative" as configured and expected.
I expected that transition, directly from that operational continuous mode, into "Single Frame Mode" could be like this:
PWM_EN = 0
SFRAME_EN = 1
I also set a counter (just a global variable) to the number of desired pulses. Then the main loop of my firmware checks this counter, and if it is non-zero it does:
PWM_EN = 0
decrement the counter
PWM_EN = 1
But in this case I can see no pulses generated at all.
I have also tried to define pulse length independently of the previously running continuous mode, by adding after SFRAME_EN:
PRD = (1 << 14) - 1
EV1 = 0
EV2 = (pulse_length_in_us * 250) << 4
EV3 = EV4 = PRD
Then pulses get generated, but with incorrect width and polarity. For example, for pulse length = 4us, the memory debugger shows:
but here is what is generated:
This pulse has ca. 62us (less than 65.5us, which would be the whole PRD), and is "active high", while it should be inverted and "active low".
This pulse gets even a bit longer if I write
EV2 = pulse_length_in_us * 250
(with no bit shift "<< 4").
Please, let me know what is wrong.
Best regards,
Adam