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: eCAP Spurious interrupt

Part Number: TMS320F28388D
Other Parts Discussed in Thread: C2000WARE

Tool/software:

Hi,

I'm using eCAP for my project to capture the duty of a PWM in continuous mode.

Wrap after 2 events. First event: rising edge / second event: falling edge. 

Generating interrupt on first event (rising edge). Reset the counter on rising edge.

I noticed an important thing that is not mentioned in the datasheet.

If I clear the global INT flag bit before the serviced event (CEVT1 in my application) flag, an other interrupt pulse is generated and so a second interrupt occurs right after the first one.

It doesn't change the result of CAP registers but it's wasting processor ressources.

So serviced event flag MUST ABSOLUTELY BE CLEARED before global INT flag to avoid this spurious interrupt.

I let you confirm this behavior but it's not expressly in the TRM. And worst, it's doing wrong in the workshop Lab7 (forTMS320F379D) from where I started my project.

Please confirm if I'm right or if I miss something.

Regards,

Adrien

  • Hi Adrien,

    That is correct. You'll clear the event interrupts, then clear the global interrupt like our examples do in the ecap/ folder within our C2000WARE SDK.

    This diagram show cases this. If you clear the INT flag before the CEVT events, you've essentially caused the MUX selection to choose one of the CAPEVT which has not been serviced and will cause another interrupt to occur.

    Can you link me the workshop you're referring to?

    Best,

    Ryan Ma

  • Hi Ryan,

    I'm referring to a former workshop for TMS320F2837xD which was named "TMS320F2837xD Microcontroller Workshop" which was very well done and useful to get started with TMS320. And in the Lab7, it clears INT flag before CEVT flag.

    I imported the example of SDK v5_04_00_00 and I think there is the same problem, INT flag is cleared before CEVT flag and so a second interrupt will be generated right after the first one and I'm not sure this is the expected behavior.

    Two interrupts generated:

    Reverse the two lines as shown by the red arrow and only one interrupt will be generated (expected behavior):

    I noticed that in my application by toggling a GPIO in an eCAP isr and I can see on the scope it's toggling two times if I clear INT flaf before CEVT flag whereas it's only toggling one time when I clear CEVT flag before INT flag (expected behavior).

    Can you confirm this and correct the example if it's not the expected behavior ? It's not documented anywhere.

    Thanks,

    Regards,

    Adrien

  • I imported the example of SDK v5_04_00_00 and I think there is the same problem, INT flag is cleared before CEVT flag and so a second interrupt will be generated right after the first one and I'm not sure this is the expected behavior.

    Which example are you referring to? I am looking at ex2 for the eCAP.

    This is the expected behavior.

    Best,

    Ryan Ma

  • Hi Ryan,

    The example I'm referring to is in the SDK 5_04_00_00 / C2000Ware / training / device / f2838x / control_peripherals / lab_ePwm_eCap.

    In this example, it's not correct (flag INT cleared before flag CEVT). And I was using this example as a starter base.

    I just found an other example for TSM320F2837x devices where it's correct.

    Thanks for you support,

    Adrien