USING P0.29 as GPIO

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

USING P0.29 as GPIO

1,364 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by handthepig on Sat Jun 01 22:06:59 MST 2013
Hi guys,I'm using LPC1769, i tried configuring p0.29 as GPIO but it does not seem to work. I checked my coding by configuring GPIO functions to other pins e.g. 2.13 and it works. Can anyone help me with this as i'm new to LPC1769 and there are still alot of things I don't quite understand. :(:(

Gladly appreciate it thanks :)
0 Kudos
Reply
3 Replies

1,316 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by handthepig on Mon Jun 03 01:30:04 MST 2013
omg i get it now thanks!
0 Kudos
Reply

1,316 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Sun Jun 02 03:48:01 MST 2013

Quote: handthepig
... there are still alot of things I don't quite understand.



If pins behave strange it's a good idea to read user manual UM10360

Quote:

9.5.1 GPIO port Direction register FIOxDIR (FIO0DIR to FIO4DIR- 0x2009 C000 to 0x2009 C080)
This word accessible register is used to control the direction of the pins when they are configured as GPIO port pins. Direction bit for any pin must be set according to the pin functionality.
Note that GPIO pins P0.29 and P0.30 are shared with the USB_D+ and USB_D- pins and [COLOR=Red]must have the same direction. If either FIO0DIR bit 29 or 30 are configured as zero, both P0.29 and P0.30 will be inputs. If both FIO0DIR bits 29 and 30 are ones, both P0.29 and P0.30 will be outputs.[/COLOR]


Quote:

Table 88:
The pin mode cannot be selected for pins P0[27] to P0[30]. Pins P0[27] and P0[28] are dedicated I2C open-drain pins without pull-up/down. Pins P0[29] and P0[30] are USB specific[COLOR=Magenta] [COLOR=Red]pins without configurable pull-up or pull-down resistors. Pins P0[29] and P0[30] also must have the same direction since they operate as a unit for the USB function,[/COLOR][/COLOR]...

Stepping through this simple sample shows this effect:
 LPC_GPIO0->FIOSET = (1<<29);    //high
 LPC_GPIO0->FIOSET = (1<<30);    //high
 LPC_GPIO0->FIODIR |= (1<<29);    //output
 LPC_GPIO0->FIODIR |= (1<<30);    //output
[COLOR=Red] //P0.29 and P0.30 are both pulled high here at the same time, after they are both outputs... [/COLOR]
0 Kudos
Reply

1,316 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by handthepig on Sat Jun 01 22:26:35 MST 2013
PinCfg1.Funcnum=0;//Config as GPIO
PinCfg1.OpenDrain=0;
PinCfg1.Pinmode=0;
PinCfg1.Portnum=0;
PinCfg1.Pinnum=29;
GPIO_SetValue(0,1<<29);
0 Kudos
Reply