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.

TMS320F2812: How to stop EV Timer and prevent future interrupt from now on.

Part Number: TMS320F2812

Hello,

In my project, I use an EV Timer. I want to stop (disable) it in an interrupt handler, e.g. XINT1_Handler.

That is,

XINT1_Handler {

...

// 1. Disable EV Timer using register;
EvaRegs.T1CON.all = 0x1200; // 2. Clear EV IFR
EvaRegs.EVAIFRA.all = BIT7; ... }

'1. EvaRegs.T1CON.all = 0x1200;' Stop the timer and the counter is HOLD according to datasheet 'SPRU065‘ and 

'2. EvaRegs.EVAIFRA.all = BIT7;' Clear IFR for possible future interrupt.

The question is if there is a chance (though very small) that:

'EvaRegs.T1CON.all = 0x1200;' is called exactly when the timer counts to pre-defined max value (should give interrupt on next clock cycle according to'SPRU065‘), and then

’EvaRegs.EVAIFRA.all = BIT7;‘ is called (which allows future interrupt), and finally 

The last interrupt is sent to PIE (and CPU), ALTHOUGH the timer has been stopped by me.

I want to avoid this situation. That is: when EV Timer is stopped, absolutely no future interrupt is issued until I turn it on again. But, is this possible?

PS: Mask the interrupt (IMR) is not a good idea because when you mask it out, the pending one (from last time) get serviced.

Thanks,

Guan

  • Boshen,

    In the very small chance that the interrupt is triggered while you are disabling the Timer, there is a slight chance (depending upon timing) the last ISR will execute. In the ISR the IFR will then be cleared by the PieCtrlRegs.PIEACK instruction. After this point the IFR should be clear and not set again until you enable the Timer.

    I hope this helps. If this answers your question, please click the green "Verified Answer" button. Thanks.

    - Ken
  • Boshen,

    It's been a while since I have heard from you last. Therefore, I am assuming that my last reply resolve your issue. If this isn’t the case, please reject this resolution or reply to this thread. If this thread locks, please make a new thread describing the current status of your issue. Thank you.

    - Ken