Open Drain GPIO Processor Expert

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

Open Drain GPIO Processor Expert

965 Views
joseph0577
Contributor III

I have a board where I need to configure a pin as open drain. I use Processor Expert to program, so I used the Init_GPIO componenet to configure the pin as open drain. Unfortunately, I was unable to disconnect the pin to allow it to go high using the BitIO_LDD PutVal function. I found a work around by calling DeInit whenever I wanted the line to go high and Init when I wanted the line to go low (I set the initial value of the component to '0'). However, I was wondering if there was a better way to control an open-drain GPIO using Processor Expert code. The pin in question is PTC16 on a K22FX512VMC12, and there is an external pull resistor to drive the line high (the line needs to go higher than the K22 can drive it).

Labels (1)
Tags (2)
0 Kudos
Reply
1 Reply

538 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Joseph Gray:

The Digital I/O pins of K22FX512VMC12 are 5V tolerant only when configured as inputs, not outputs. So you are right that you cannot have an output voltage higher than VDD. The workaround is to disable the pin so it has high impedance. Unfortunately Processor Expert does not provide an API for this, but you could add your own macros:

#define ENABLE_PIN      (PORT_PCR16 |= PORT_PCR_MUX(1))

#define DISABLE_PIN    (PORT_PCR16 &= !PORT_PCR_MUX_MASK)


Regards!,
Jorge Gonzalez

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

0 Kudos
Reply