AnsweredAssumed Answered

Problem reading input port state while using KBI with FRDM-KE02Z40M

Question asked by gregs5451 on Mar 4, 2015
Latest reply on Mar 6, 2015 by gregs5451

Implementing a serial input decode routine.  Serial input is an asynchronous 18 bit non-standard signal.

Setup input pin with KBI interrupt on negative edges.  KBI interrupt routine looks for space pulse.  Works great. (Toggling an output pin to show synchronization)  After space pulse detection, enabling a compare timer to latch-in the port pin state.  (I do also have an issue with this timer pushing the sample time to the desired position, but there is adequate sample delay to get a valid read as-is.)  The problem seems to be when the GPIO port is read.  It always reads zero.  This seems strange because within the debugger, the input register appears to show the desired bit toggling states.  Ironicly, if I do an arbitrary read of the same register within the main() loop instead of inside the interrupt loop, where I need it, it appears to be reading data with the desired bit toggling.  I thought perhaps having the KBI enabled had something to do with it.  Does not seem to.  I've tried tying the pin to another input port just configured as an input only.  Same results.  Two PDIR bits toggle, but the bits I want always read zero.  I've tried all sorts of different troubleshooting.  It always comes back to the same conclusion.  Not being able to read the port pin data while within the interrupt loop?