p2.9 as gpio on lpcxpresso1769

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

p2.9 as gpio on lpcxpresso1769

478 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dragilla on Mon Aug 27 12:04:41 MST 2012
Hi,
I'm trying to read p2.9 pin on my lpcxpresso1769.
I set it as input gpio and select pull-down.
But when I let it float my program shows 1.
Only when I connect it to ground it reads 0.
Shouldn't the internal pull-down malke it 0 when it's floating?

My code is very simple:
int main(void)
{
PINSEL_CFG_Type PinCfg; // Pin configuration
uint8_t x;

// set p2.9 as input
PinCfg.Funcnum = 0;
PinCfg.OpenDrain = 0;
PinCfg.Pinmode = PINSEL_PINMODE_PULLDOWN;
PinCfg.Portnum = 2;
PinCfg.Pinnum = 9;
PINSEL_ConfigPin(&PinCfg);

// setup pin direction
FIO_ByteSetDir(2, 1, 0b00000010, 0);

while(1) {
x = (FIO_ByteReadValue(2, 1) & 0b00000010) >> 1;
x = 0; // breakpoint here
}
}


Help me understand please.

regards,
--
Luke
0 Kudos
6 Replies

453 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dragilla on Tue Aug 28 01:55:23 MST 2012
Thank you for your patience - I really appreciate it :)
I was reading the lpc1769 manual and couldn't find any info. I forgot that I'm working with lpcxpresso board that has it's own schematics.
Anyways - thanks.
0 Kudos

453 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ex-kayoda on Mon Aug 27 13:34:15 MST 2012

Quote: dragilla
ps: If I don't use usb in my project I may safely solder out one of the two elements you mentioned, right?



Yes :)
0 Kudos

453 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dragilla on Mon Aug 27 13:28:04 MST 2012
Ok. Now I get it... thank you :)

ps: If I don't use usb in my project I may safely solder out one of the two elements you mentioned, right?
0 Kudos

453 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ex-kayoda on Mon Aug 27 13:27:01 MST 2012

Quote: dragilla
No, I'm not kidding... I'm really confused. I get this behavior on both of my lpcxpresso1769, so I think it's not hardware.



:confused:

P2[9]  is used to switch USB D+ via R73 and Q3 :mad:

That's pulling up this pin :eek:

So either use a different (unconnected) pin or solder out R73 or Q3 ;)
0 Kudos

453 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dragilla on Mon Aug 27 13:12:48 MST 2012
No, I'm not kidding... I'm really confused. I get this behavior on both of my lpcxpresso1769, so I think it's not hardware.
0 Kudos

453 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ex-kayoda on Mon Aug 27 13:10:01 MST 2012
Are you kidding us or did you solder out Q3 or R73  :confused::eek::confused:
0 Kudos