PIN脚功能切换

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
1,888件の閲覧回数
SZB
Contributor I

大家好:

     我现在遇到一个问题,我的工程是用超声波测量距离,当超声波信号线对地短路或对电源短路时,信号线会被拉高或拉低。我现在用FTM模块来捕捉信号变化计算距离。当短路时FTM将不会触发中断(边沿触发),现在我想将FTM的信号PIN(PTB2)初始化为GPIO来捕捉信号来判断异常,但是失败了,GPIO功能无法使用,这里面是不是有什么注意的地方

已经调用FTM_DRV_DeinitInputCapture(),FTM_DRV_Deinit()。

 

非常感谢大家回答!

0 件の賞賛
返信
1 解決策
1,853件の閲覧回数
Robin_Shen
NXP TechSupport
NXP TechSupport

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).

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
1,874件の閲覧回数
SZB
Contributor I

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.

0 件の賞賛
返信
1,879件の閲覧回数
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi SZB,

PINS_DRV_ReadPins(PTB);无法返回正确值吗?

根据提示只要该引脚的方向是输入即可获取正确的值。查(Port Data Direction Register (PDDR))寄存器。

当然还要确保PTB口的时钟门是开启的,查PCC PORTB Register (PCC_PORTB)寄存器。

PINS_DRV_ReadPins.png

Best Regards,
Robin

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信
1,870件の閲覧回数
SZB
Contributor I

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.

0 件の賞賛
返信
1,854件の閲覧回数
Robin_Shen
NXP TechSupport
NXP TechSupport

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).

0 件の賞賛
返信