This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

UCD3138A: UCD3138 single frame mode and pulse length

Part Number: UCD3138A

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

  • Hello,

    An expert is looking into this issue and will respond.
  • I've taken a look on a chip, and I don't think that inverting the outputs will work with the single frame. The high that you're getting is the time between Event 2 and the end of the period. And if you toggled an I/O line when you start the single frame, you'd probably see that the time between the start and the high pulse is the proper pulse width for your active low. The problem is that with PWM_EN at 0, the PWM_A_INV bit is also disabled. So when you do PWM_EN, you simultaneously turn on the DPWM and enable PWM_A_INV. So the signal goes from 0 to 0, so nothing happens. PWM_A_INV is a bit problematic anyway, because until you can turn it on, the DPWM outputs stay low after reset.
  • Hi Ian,
    thank you for the explanation. It is very important to know that PWM_A_INV is valid only for PWM_EN==1, because it also affects the pins in GPIO mode! I believe the documentation doesn't state that clearly (enough). Now I can see that my code has some parts which do something else than I expected, and I wasn't aware of this.
    Best regards,
    Adam