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.

Piccolo ePWM reenable after Trip/Comparator event on next timer underflow

Hi all,

I am using the Piccolo 28035 comparators for current limiting via trip events.

Switching off works fine.

The problem is the PWM reenable/switch on sequence:
I would like to keep the PWM switched off for several ePWM periods and switch it on via software.
So CBC does not work; I have to use OSHT trip/DCEVT.
But when reenabling the PWM via TZCLR, it is reenabled IMMEDIATELY, not on the next timer underflow like in CBC.
This leads to unpredictable PWM duty cycles.
The same happens when reenabling the PWM by setting TZCTL to "none" (disabling trip zone for this PWM): The PWM is immediately reenabled.

My question is: Is there a way to reenable the PWM after a OSHT trip event on the next timer underflow (not immediately)?

  • Hi Stephan,

    You could generate an interrupt @PWM underflow (or slightly before underflow to compensate ISR latency) and clear the TZFLG in this interrupt subroutine.

    Best regards

    Andreas

  • Hi Andreas,

    thanks for the quick proposal.

    How would I generate an interrupt slightly before underflow :-) ?

    Generating an interrupt at underflow would work, but may never be delayed (due to all ints disabled or interrupt prio). And it adds additional calculation overhead.

    I am still looking for a simpler solution.

    And - as proposal to the TI documentation guys: Could this reenable behaviour be added to the ePWM datasheet? This would make it clear without having to test it.
    Actually, this is only documented for CBC.

  • Hi Stephan,

    Not sure if this is feasible for you, but if one of your compare registers is free, you can use it to trigger an interrupt just before interrupt occurs... Of course an easier, less cycle hungry solution would be nice!

    Andreas

  • Finally, I found a solution by myself:

    When I want to reenable the PWM after several PWM periods, I simply force a CBC trip via TZFRC and then reenable the PWM via TZCLR.
    This reenables PWM, but only after the next timer underflow.