AnsweredAssumed Answered

PIT interrupt missed

Question asked by Larry Ober on Aug 18, 2016
Latest reply on Aug 19, 2016 by Larry Ober

On a KL05.. using PE, I set up an interrupt from a PIT. Within the ISR I toggle a port bit just to check the functionality. I find that the port bit does not change on every expected tic of the PIT. The timing is correct except that a state change is missed once in awhile. For example if I set the PIT to 1ms, sometimes there will be a 2, 3 or 4 ms interval instead of the expected 1ms. I can change the source to other timers and it makes no difference. I can also change the timer interval from 1ms to 100ms and it still will miss once in awhile.

The miss rate has to do with other code that is running. If I only have a while(1) loop it's fine. If I add almost anything within the while loop it will start to miss.

 

Originally I had a number of print statements and this seemed to make matters much worse. However even when I comment out almost the entire contents of the while loop it will still happen on occasion.

 

It seems like something else is messing with the timer or disabling the interrupts. Also, changing the priority has no effect. As far as I know, no other interrupts are enabled.

 

I'm stuck. Anyone have any ideas?

Outcomes