I am getting a spurious timer interrupt.
I am calling it "spurious" because I believe it should not occur until after the timer runs through its count period and times out. But it happens immediately.
It is more-or-less repeatable, occurring about 50% of the times that I attempt to reproduce it. It occurs during the startup logic of the program, just after I enable the interrupt, especially after flash programming the part via CCS to launch a debug session, but can occur after System Reset or Core Reset as well.
I believe this happens because GPTMRIS / GPTMMIS bit 0 is already on, possibly from a previous run through the program, or possibly because of my mistake. I have not yet traced the cause of this bit being 1.
The strange thing is, I believe that my timer setup code should be clearing this. I am using TivaWare calls only.
I was under the impression that calling TimerIntClear() before performing the sequence TimerIntEnable(), IntEnable(), TimerEnable(), should result in the interrupt NOT being triggered until AFTER the timer has timed out.
But apparently TimerIntClear() is not enough. What additional calls must I make prior to TimerIntEnable(), IntEnable(), TimerEnable() to avoid this problem?