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.

TMS320F28388D: How to use DC PWM to compare two signals as "AND" ?

Part Number: TMS320F28388D

Good afternoon.
There are two pulse signals at the PWM (DC) input. And I need to get the clock signal on the base timer only when they match.

Is it possible to set up a digital comparator so that it works like a logical "AND" for two pulse signals?


For example.

When two pulses arrive at the same time, the digital comparator generates a sync pulse for the base timer.

If the pulses diverge in duration, then the digital comparator did not generate anything.

  • Hello,

    The simplest way to implement this would be to set:

    • ePWMx.TZDCSEL[DCAEVT1] = 0b101 (DCAH goes low AND DCAL goes high)
    • ePWMx.DCTRIPSEL[DCAHCOMPSEL] = First input
    • ePWMx.DCTRIPSEL[DCALCOMPSEL] = Second input

    Now, DCAEVT1 is generated if the DCAL input signal goes high and the DCAH input signal goes low. Now, configure the DCAH input signal to be inverted, usually done via the XBARs

    • ePWM_XBAR.TRIPOUTINV[First input] = 0x1

    Now, DCAEVT1 should be triggered when both of your inputs are high at the same time.

    There are several other ways to set this up, if you so desire:

    • The CLB peripheral is the perfect tool for any boolean logic.
    • The CMPSS peripheral can usually be used to simplify hardware comparisons.
    • Set up (~Input 1 OR ~Input 2) as a singular input into the DC submodule via the XBARs. When this goes low, both of your input signals are high. This requires less config on the ePWM side, but a tad more on the XBAR side.

    Regards,
    Jason Osborn