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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
1,481 次查看
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 项奖励
回复
1 解答
1,290 次查看
gregs5451
Contributor III

Problem solved.  Timing issue.

在原帖中查看解决方案

0 项奖励
回复
2 回复数
1,291 次查看
gregs5451
Contributor III

Problem solved.  Timing issue.

0 项奖励
回复
1,290 次查看
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 项奖励
回复