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!
Hello Flavio,
Can you verify if the code is working or not? Can you set a breakpoint on this code snippet and run to it?
If so you can read more about the system viewer here:
www.keil.com/.../uv4_db_dbg_systemviewer.htm
The register values in these windows get sent via the "Serial Wire Output" SWO channel when you are using a Coresight debugger:
www2.keil.com/.../ http://www.keil.com/appnotes/files/apnt_297_v102.pdf
Assuming you are using a ULINK2, here are some useful links:
* On this dialog, make sure you are using the SW port (not jtag) www.keil.com/.../ulink2_ctx_debugdrivercfg.htm
* Make sure trace is turned on: http://www.keil.com/support/man/docs/ulink2/ulink2_ctx_trace.htm