PIN脚功能切换

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

PIN脚功能切换

Jump to solution
1,151 Views
SZB
Contributor I

大家好:

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

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

 

非常感谢大家回答!

0 Kudos
1 Solution
1,116 Views
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).

View solution in original post

0 Kudos
4 Replies
1,137 Views
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 Kudos
1,142 Views
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 Kudos
1,133 Views
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 Kudos
1,117 Views
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 Kudos