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