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.

Setup multiple Comparators to trip one PWM?

Hi,

I am referring to this

https://e2e.ti.com/support/microcontrollers/c2000/f/171/t/66370

quite old post.

I would also like to setup 2 comparators to trip one PWM, f.e. to do overvoltage and current limit protection.

In the referred post, EPWM4A is tripped by Comparator 1 and EPWM4B is tripped b Comparator 3 as one shot events.

What if we want to trip both EPWM4A AND EPWM4B by Comparator 1+3? Or simply trip EPWM4A by Comparator 1+3? This does not seem to be possible by software.

Of course, we can use Comparator 1 to trip EPWM4A via DCAEVT1 and use Comparator 3 output on Pin to feed a TZ event input, but this requires a hardware change.

Regards, Stephan

  • Hi Stephan,

    Can you tell us which part you are using?

    Thanks,

    Kris

  • Stephan,

    I believe you are using the F28035 based on previous posts, but please let me know if it this incorrect as some of our later devices feature additional ways to do this.

    Another clarification I need to ask about is what you mean by Comparator 1+3. Do you mean that the channel will trip if either Comparator 1 or Comparator 3 fires or will Comparator 1 and Comparator 3 both be in a known state? I believe you are looking for either comparator to trip the PWM so I will continue on that premise. If both comparators will be in a known state, then we can reduce the number of DCEVTs required.

    What you will want to do is use multiple DCEVTs, one for the Comparator 1 output and one for the Comparator 3 output. If you want to apply them to both the A and B channels, you will need to use multiple DCEVTs for both channels since DCAEVTs only apply to the A channel and DCBEVTs only apply to the B channel. You can then enable allof these via the TZSEL register for EPWM4.


    You then can go to the TZCTL register to determine which channels are affected by the trip and how they should react (forced high, forced low, high impedance, or do nothing). If you don't want a channel to be tripped, just program it to do nothing and it will continue operating as normal.

    Please let me know if you have any additional questions.

    Kris
  • Kris,
    thanks for the infos.
    Yes, we are using the F28035 in the actual project, but we are also using the F28062/69 and the F28075, so solutions for these devices would be fine, too. For the moment, we should focus on the F28035.

    What I mean with Comparator 1+3 is that for implementing f.e. an overcurrent and overvoltage supervision for PWM4 A+B, it should trip if either of the comparators reach their limit (logical OR).
    I think that we can get a logical AND with the TZDCSEL DCxEVTy setting to 5 (DCxL = high, DCxH = low), but that is not what we need.

    How do I set up multiple DCEVTs? From my understanding, there are 4 DCEVTs, DCAEVT1+2, DCBEVT1+2. This means 2 DCEVTs per PWM channel (A/B). DCEVT1 can only generate a one-shot OST trip event, DCEVT2 can only generate a cycle-by-cycle CBC trip event.
    So how can we force PWM4 to permanently switch off (OST) when comparator1 or comparator3 fires? We can generate a CBC interrupt and force PWM4 to permanently switch off by software force, but that does not seem to be what you mean.
    Or, how can we force PWM4 to switch off cycle-by-cycle (CBC) when comparator1 or comparator3 fires? We can generate an OST interrupt and force PWM4 to switch off by software force, but that takes a lot of execution time for higher interrupt rates.

    So I would be glad if you could explain your proposed solution in more detail, maybe with some code/register examples.

    Stephan
  • Stephan,

    Your understanding is exactly correct. If you need them both to be either CBC or OSHT, then you will need to add some software in on top of it.  The solution will be the same for both the F2803x and F2806x devices.

    For F2807x we added some more advanced logic to make this possible through hardware.  Take a look at pg 1502 here www.ti.com/.../spruhm9b.pdf

    You'll see that we've added a trip combinational input which allows you to OR signals to define a DC event.

    Regards,

    Kris

  • Kris,
    thanks for the info/confirmation.
    Yes, the F2807x is quite more advanced....

    Stephan