Part Number: TM4C1294NCPDT
Other Parts Discussed in Thread: LM3S1968
I'm developing some example code for a class and came across something I didn't expect.
I ported some timer interrupt code in C from an LM3S1968 which accesses the GPTM registers directly, not through the PDL. The last line in the Timer2A Time-out interrupt handler does this:
TIMER2_ICR_R = TIMER_ICR_TATOCINT;
What I discovered is the interrupt fires once, but then immediately fires again after exiting the handler. Setting a breakpoint at the first instruction of the handler shows the TIMER_MIS and TIMER_RIS both with 0x01 on the first interrupt, and both with 0x0 on the second. If I insert a few instructions after the write to the ICR register, no second interrupt occurs.
I checked the GPTM, NVIC and Exception Model sections of the datasheet but didn't see any warning about extra clock cycles being needed after clearing flags.
Am I missing something elsewhere?