大家好:
我现在遇到一个问题,我的工程是用超声波测量距离,当超声波信号线对地短路或对电源短路时,信号线会被拉高或拉低。我现在用FTM模块来捕捉信号变化计算距离。当短路时FTM将不会触发中断(边沿触发),现在我想将FTM的信号PIN(PTB2)初始化为GPIO来捕捉信号来判断异常,但是失败了,GPIO功能无法使用,这里面是不是有什么注意的地方
已经调用FTM_DRV_DeinitInputCapture(),FTM_DRV_Deinit()。
非常感谢大家回答!
解決済! 解決策の投稿を見る。
Please read the value of PTB directly without modify it as GPIO. You can also confirm it during debug by Port Data Input Register (PDIR).
Hi Robin_Shen,
PTB2 is used as an input to FTM,. however,when PTB2 is converted to GPIO,I can't read the IO state.
Hi SZB,
PINS_DRV_ReadPins(PTB);无法返回正确值吗?
根据提示只要该引脚的方向是输入即可获取正确的值。查(Port Data Direction Register (PDDR))寄存器。
当然还要确保PTB口的时钟门是开启的,查PCC PORTB Register (PCC_PORTB)寄存器。
Best Regards,
Robin
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Robin_Shen,
PTB2 is used as an input to FTM,. however,when PTB2 is converted to GPIO,I can't read the IO state.
Please read the value of PTB directly without modify it as GPIO. You can also confirm it during debug by Port Data Input Register (PDIR).