GPIO pin status after setting the direction to output

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

GPIO pin status after setting the direction to output

592 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Florian Kohl on Thu Oct 16 06:50:32 MST 2014
I have a question concerning the LPC1549 run on the board LPCXpresso1549 OM13056.

If the direction of a GPIO pin is set to output, e.g. for PIO0_3

LPC_GPIO->DIR[0] |= 1UL << 3

the LED turns on, as the coressponding pin (LPC_GPIO->B[0][3]) is initialized with 0.
Why the pin is initialized with 0, when the direction is set to output?

In some examples the direction is set to output and after that the pin is set to 1 again.
But this produces a short 0, which I would like to avoid.
Is it possible to initialize the pin with 1, when the direction is set to output?

Best regards, Florian
Labels (1)
0 Kudos
2 Replies

548 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Florian Kohl on Thu Nov 20 09:54:16 MST 2014
Hello Paul,

many thanks for your reply.
That works out fine.

Still, I am a little confused about the sentence in UM10736, chapter 10.6.2 GPIO output:
"  1. the pin must be selected for GPIO operation
   2. the pin must be selected for output
   If either or both of these conditions are not met, writing to the pin has no effect.  "

"Has no effect" hence means that the bit is not driven to the output, if condition 1. and/or 2. are not met.
However writing to it does change the state in any case. Is that correct?

Regards
Florian






0 Kudos

548 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_Paul on Thu Oct 16 09:30:06 MST 2014
Hello Forian
Try setting the state of pin PIO0_3 to a 1, then set it to an output.

Regards
Paul
0 Kudos