Hi,
I am trying to implement some time services that involve using timer 1 with, potentially, any counter value. I mean that the counter register could be set to 1, 2, 3, etc. Ideally, I would need that when the counter reaches zero, the period is not reloaded but unfortunately I did not find a way to do it, and I think it is not possible. Then, it could happen (more likely when the counter register was set to a small value) that when the interrupt is serviced, another (same) interrupt is triggered. Right now, my approach to solve this problem is to stop the counter and clear any pending interrupt from timer 1, immediately after the ISR execution started:
static __interrupt void HandleTimerEventIsr(void) {
CpuTimer1Regs.TCR.bit.TSS = 1;
IFR &= 0xEFFF;
...
}
According to what I have read ("TMS320F2803x Piccolo Technical Reference Manual", "TMS320C28x Optimizing C/C++ Compiler User's Guide" and "TMS320C28x CPU and Instruction Set Reference Guide", apart from other questions in the forum), there should not be any problem with this approach. Anyway, I wanted to be sure that:
-No interrupt could be lost (I do not think so because the assembly generated instruction is an atomic AND).
-No other timer 1 interrupt could happen after this (for example, in a worst case scenario with the counter register set to 1, I am not sure if some internal latency between the counter reaching 0 and the interrupt being triggered could case that clearing this interrupt in IFR immediately after stopping the timer is not enough to avoid another same interrupt).
Thank you in advance!