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.

TMS320F28P650DK: Can ECAP be used to detect if a time between edges is over a value?

Part Number: TMS320F28P650DK

Tool/software:

Hi champs,

I am asking this for our customer.

The user wants to use a HW-based method to detect if the time between rising and falling edges is over a value? If yes, then generate an ISR.

Questions.

1. ECAP has an overflow ISR. Is this overflow condition configurable? Or is this overflow always triggered when the counter is from 0xFFFFFFFF to 0x00000000?

2. If 1 is not, is there any method to use ECAP to do this by only HW event to generate an ISR rather than by if-else codes in an ISR for this?

3. If 2 is not, is there any other HW module except CLB that can be used for this purpose?

  • Hi Wayne,

    Yes for F28P65x, this eCAP has the signal monitoring unit that can generate an interrupt if a pulse width is outside of a given range.

    Best,

    Ryan Ma

  • Hi Ryan,

    This looks useful.

    One major goal is to resolve the break detection of A, B, Z that we discussed in this post

    https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1505113/tms320f28p650dk-eqep-watchdog

    However, based on the doc in TRM 21.5.13.2 Edge Monitoring below, I am still concerned about using it.

    It has to be synced with an EPWM and the counter cannot be reset on any capture event.

    But now, the pulses come from the motor encoder with changing speed and the user does not know its speed. It seems hard to sync with a known EPWM.

    The ideal case is to reset the counter on a capture event on rising edge/falling edge and to just monitor if the incremental counter is out of range.

    Do you think it possible to do so with this ECAP?

  • Hi Wayne,

    Working on trying to see if you can use this for the customer's use case.

    Best,

    Ryan Ma

  • Hi Ryan,

    Do you have any update about my question above?

    "The ideal case is to reset the counter on a capture event on rising edge/falling edge and to just monitor if the incremental counter is out of range.

    Do you think it possible to do so with this ECAP?"

  • Hi Wayne,

    Apologize I'm still trying to find some answers for you. Today is a TI India holiday, so I hope I can hear back tomorrow.

    Best,

    Ryan Ma

  • Hi Wayne,

    Confirmed the following with our team. For edge monitoring we need to sync with PWM sync event as it tells the window where the edge should come later after sync pulse , if edge doesn’t come it will report error.

    1. This synchronization is to ensure both PWM and ECAP are starting together.
    2. Once they start together, ECAP waits for min threshold to cross, to check for edge. Here if either edge come / syncin comes it will move back to idle state
    3. Once MIN threshold is crossed, if edge didn’t come and max threshold is crossed, it goes and asserts error. If edge comes the state machine moves back to idle state.

     

    If we reset on a edge capture, in edge capturing mode, we cannot measure consecutive edges. Also error detection , only happens when counter overflows max threshold.

    Best,

    Ryan Ma

  • Hi Ryan,

    In summary, 

    ECAP capture reset cannot be used for this purpose.

    EQEP capture should be used for QCLK derived from either input A or B. So it cannot be used for break detection for A or B alone.

    Therefore, it seems only CLB is proper for this purpose. 

    Is it right?

  • Hi Wayne,

    Correct eCAP capture reset cannot be used.

    CLB may be the way to go. I would suggest starting another thread so we can assign the new thread for our CLB expert if you have any questions regarding this use case. We can close this thread for now.

    Best,

    Ryan Ma