Photon interrupt latency

Our project uses pin change interrupts. We have done a lot of work and believe the interrupt latency is 1900 ns. The normal user living at the HAL abstraction cannot change interrupt levels. We are diving down to increase the priority of pin change interrupts. Nobody interrupts us. That’s when we get the 1900ns latency. By using whatever interrupt priority comes standard, the 1900ns sometimes jumps way up to many microseconds worst case. By boosting our priority level we get a VERY consistent 1900ns.

Once a pin interrupts we turn interrupts off, do some special stuff in tight loops for about 10 ms, and then turn interrupts back on. We hope no other system functions suffer from that 10ms dead time. We may have to go to 20ms of dead time. So far it seems to be ok.

Our overall events happen about once every couple seconds so the rest of the system gets plenty of time to do its work in the long run.

In a sense it’s a shame that latency takes so long. The hardware chip designers worked very hard to get the latency to a minimum of instruction cycles. And of course the software guys killed it. :wink: (Hey! That’s a joke. I worked on both hw and sw.)
–jim