GPIO issues with TriState behaviour

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

GPIO issues with TriState behaviour

642 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by thomas.suwald on Tue Nov 09 09:34:34 MST 2010
Hi

I am trying to implement a real TriState-behaviour of an IO-port.

What I want to do:

- Set mode to input (=TriState)    (I am doing that on purpose, because another IO is now connected)
- Prepare new output value
- Set mode to output and output exactly that value

What I implemented
- Set mode to input
- Set to "No pull-ups, no schmitt-trigger"
- write data bit to IO-data-register
- set mode to output

What happens:
- output remains at ZERO while data bit is "1"

This is more than annoying, especially as this behaviour is completely different from an ordinary GPIO-implementation.

There is a contradiction between figure 6 (Standard I/O Pin Configuration) and chapter 9.3.1.
or at least chapter 9.3.1 is completely misleading. It is stated that only a read access updates the data register to the pin level. This is in reality not true. It is also stated that a write to the data register has no impact on the pin level in input mode, because the pin is electricaööy disconnected. So far so good.

But then it goes wrong: the data register "reflects the previous state of the pin if the pin is switched to GPIO output from GPIO input or another digital function". ???? From my perspective the input is always undefined w.r.t. the new output-function. The only value that is defined is the content of the data register.

I would judge this as a major bug! This stupit behaviour is unwanted. If there is a reason to have this feature pls. provide a bit to switch it off.


Best regards,

-Thomas
0 Kudos
Reply
1 Reply

590 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gbm on Tue Nov 09 12:53:16 MST 2010
LPC11xx ports are little tricky here.
When the pin is set to input, data written to it is ignored. When the pin is switched to output, it's output value is set to the logic level present on it (externally forced) while switching.
To switch from input to output without unwanted transients, do the following:
While the pin is still in input mode but not driven externally, set pullup (if the initial output value should be 1) or pulldown (for initial output 0). Alternatively, you may use the bus hold function  to keep the last externally-forced level. Then switch the direction to output. If you want to be double sure, set the output level again by writing to port register.
0 Kudos
Reply