GPIO out for 0_4 and 0_5

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

GPIO out for 0_4 and 0_5

529 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by avass on Sat Feb 16 00:39:50 MST 2013
I am trying to use pin 0_4 and 0_5 as a GPIO on an LPCXpresso LPC1115. I also added 0_3 as a control pin.

I use the following code, nothing else runs ( except SystemCoreClockUpdate(); )

LPC_IOCON->PIO0_3 &= ~0x43F;// 0100 0011 1111 Zero FUNC, MODE, HYS and OD
LPC_IOCON->PIO0_4 &= ~0x307;// 0011 0000 0111 = 0x307 : Zero FUNC, I2CMODE
LPC_IOCON->PIO0_5 &= ~0x307;// 0011 0000 0111 = 0x307 : Zero FUNC, I2CMODE
LPC_GPIO[0]->DIR|=(1<<4)|(1<<5)|(1<<3);// Set these pins as output
LPC_SYSCON->SYSAHBCLKCTRL |= (1<<6);// Enable Clock for the GPIO
LPC_GPIO[0]->DATA&=~((1<<4)|(1<<5)|(1<<3));// Set them to 0
LPC_GPIO[0]->MASKED_ACCESS[(1<<4)|(1<<5)|(1<<3)] = (1<<4)|(1<<5)|(1<<3);

When I run the above code, pin0_3 goes up to 3.3V, but 0_4 and 0_5 aren't.

Anybody has any idea?

Thanks,

-A
Labels (1)
0 Kudos
Reply
1 Reply

515 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Wouter on Mon Feb 18 02:01:06 MST 2013
Hi Avass,

Pin PIO0_4 and PIO0_5 are open-drain outputs, and thus require pull-up resistors in order to reach a high level.

Regards,
Wouter
0 Kudos
Reply