This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Can't change IOCON register in NXP LPC1114

Hello, I'm trying to configure I2C functinoality on PIO04 and PIO05 on a LPC1114.
The same code works on CooCox but it won't work with Keil.
I found that in Keil the register LPC_IOCON->PIO0_4 and LPC_IOCON->PIO0_5 aren't changing.
The code I used is the following:

// variables
volatile uint32_t IOCONP04 = 0, IOCONP05 = 0;

// manage to change the register
LPC_SYSCON->PRESETCTRL |= (0x1<<1);
LPC_SYSCON->SYSAHBCLKCTRL |= (1<<5);
LPC_IOCON->PIO0_4 &= ~0x3F; /* I2C I/O config */
LPC_IOCON->PIO0_4 |= 0x01; /* I2C SCL */
LPC_IOCON->PIO0_5 &= ~0x3F;
LPC_IOCON->PIO0_5 |= 0x01; /* I2C SDA */

// checking if changes were done
IOCONP04 = LPC_IOCON->PIO0_4;
IOCONP05 = LPC_IOCON->PIO0_5;

After this, in the watch window, I see 0x0000 for both registers.
In CooCox this value is 0d193 for both.

Please help! I depend on this to change IDE from CooCox to Keil!