S32K118, PTB12, how to configure the push-pull output GPIO pin as open-drain output

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

S32K118, PTB12, how to configure the push-pull output GPIO pin as open-drain output

696 次查看
GAC-Lamp-Knight
Contributor II

Hello NXP engineer:
As indicated in the subject, my peripheral circuit has a pull-up resistor. I want to configure the IO as open-drain when not using the pin, providing output through the pull-up resistor. When the pull-up output is not needed, I want to pull the level low to 0V through the pin. I'm wondering if this can be achieved on the S32K1; the pin I'm currently using is PTB12.
If this function can be implemented, how should I configure my components and write the program?

0 项奖励
回复
1 回复

682 次查看
PetrS
NXP TechSupport
NXP TechSupport

Hi,

the ports in the GPIO mode do not support Open-drain. It is only available when a port is routed to a module that supports that, like LPI2C.
The easiest workaround could be configure the pin as input, initialize output value in PDOR register as ‘0’ and then use register PDDR (Data Direction) to switch between levels (either Hi-Z or ‘0’ output). The only disadvantage is that you need to ensure that the output value in PDOR register is not set to ‘1’ by mistake because it would lead to short circuit, depending on circuit connected.

BR, Petr

0 项奖励
回复