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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

Jump to solution
788 Views
gregs5451
Contributor III

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?

0 Kudos
1 Solution
597 Views
gregs5451
Contributor III

Problem solved.  Timing issue.

View solution in original post

0 Kudos
2 Replies
598 Views
gregs5451
Contributor III

Problem solved.  Timing issue.

0 Kudos
597 Views
Paul_Tian
NXP Employee
NXP Employee

Would you please share your project? I would like to check on my FRDM-KE02Z40M.

Best Regards

Paul

0 Kudos