I have written code that uses hardware interrupts generated when the RTI counter counts up to a value I write to the rtiREG1->CMP[0U].COMPx register. In main() I call rtiStartCounter().
I set the COMPx registers in an ISR associated with a transition on a GIO pin (I will call this my GIO ISR). My problem is that the ISR associated with the COMPx event (I will call this my RTI ISR) is running before I ever receive an interrupt on the GIO pin and this generates an unwanted interrupt. This unwanted RTI ISR runs at about 50 seconds after I load the code to the microcontroller and hit the green go arrow in CCS. I am assuming that this is occurring because once the RTI COMPx interrupt is enabled it will occur at the time that happens to be in the COMPx register (in my case that is 50000000 and I have a prescale factor of 100). But even if I had a zero in the COMPx it would still generate an interrupt after the time overfllows, right? So I am thinking that to prevent this unwanted interrupt from occurring I could place the call to rtiStartCounter in my GIO ISR. Alternatively within my RTI ISR I could read the value in the COMPx register and only execute the code within the RTI ISR if COMPx is not equal to 50000000 (or some other number).
Is there a better way to stop the effects of this unwanted interrupt?