Problem in the example i2c LPC1114

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

Problem in the example i2c LPC1114

844 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bruno on Mon Mar 19 06:47:25 MST 2012
I am using the example of the lpc1114 i2c. The looked and saw nothing different with the records of lpc11u14.
But even so it does not work in lpc11u14.

Sincerely.
0 Kudos
Reply
8 Replies

808 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by researchinnovation on Thu May 10 22:47:50 MST 2012
@Bruno ..Hi..!!!

Please try this driver.


Thanks & Regards......:)
0 Kudos
Reply

808 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by researchinnovation on Thu May 10 22:43:10 MST 2012

Quote: bruno
I am using the example of the lpc1114 i2c. The looked and saw nothing different with the records of lpc11u14.
But even so it does not work in lpc11u14.

Sincerely.



@Bruno ..Hi..!!!

Please try this code.


Thanks & Regards......:)
0 Kudos
Reply

808 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by atomicdog on Thu May 10 21:07:11 MST 2012

Quote: DaveB
Thank you John.

I had a look at your code and it was basically the same as mine i.e I had not missed anything out. However, I did change updating the I2C registers from ORing 8bit values to writing an entire 32bit hex value and suddenly things worked.:eek:

CONCLR is a write only register so I'm guessing that's where things were getting screwed up. Since a read would be required to do an OR.
0 Kudos
Reply

808 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by DaveB on Thu May 10 20:39:57 MST 2012
Thank you John.

I had a look at your code and it was basically the same as mine i.e I had not missed anything out. However, I did change updating the I2C registers from ORing 8bit values to writing an entire 32bit hex value and suddenly things worked.:eek:
0 Kudos
Reply

808 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by atomicdog on Wed May 09 20:41:50 MST 2012

Quote: DaveB
I have similar code but the same problem. Does anybody have code that works on the LPC11U14 for I2C. I have made the USB work for this device so the I2C should be easy right????


I have some code for the LPC1114 here. I'm guessing the register names are the same so it shouldn't need much modification other then the MCU.
0 Kudos
Reply

808 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by DaveB on Wed May 09 16:36:25 MST 2012
I have similar code but the same problem. Does anybody have code that works on the LPC11U14 for I2C. I have made the USB work for this device so the I2C should be easy right????
0 Kudos
Reply

808 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Loop on Sat Apr 07 01:33:14 MST 2012
I got the same problem...I also analyzed the pins...no signals or flags.
0 Kudos
Reply

808 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bruno on Mon Mar 19 10:44:54 MST 2012
[SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#005032][SIZE=2][COLOR=#005032][LEFT]uint32_t[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] [B]I2CInit[/B]( [/COLOR][/SIZE][SIZE=2][COLOR=#005032][SIZE=2][COLOR=#005032]uint32_t[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] I2cMode ) [/COLOR]
{
LPC_SYSCON->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]PRESETCTRL[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] |= (0x1<<1);

LPC_SYSCON->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]SYSAHBCLKCTRL[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] |= (1<<5);
LPC_IOCON->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]PIO0_4[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] &= ~0x3F; [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]/* I2C I/O [U]config[/U] */[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]LPC_IOCON->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]PIO0_4[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] |= 0x01; [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]/* I2C SCL */[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]LPC_IOCON->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]PIO0_5[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] &= ~0x3F;
LPC_IOCON->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]PIO0_5[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] |= 0x01; [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]/* I2C SDA */[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT][/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]/* IOCON may change in the next release, save change for future references. */[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]LPC_IOCON->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]PIO0_4[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] |= (0x1<<10); [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]/* open drain pins */[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]LPC_IOCON->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]PIO0_5[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] |= (0x1<<10); [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]/* open drain pins */[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]
[/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]/*--- Clear flags ---*/[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]LPC_I2C->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]CONCLR[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = I2CONCLR_AAC | I2CONCLR_SIC | I2CONCLR_STAC | I2CONCLR_I2ENC;

[/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]/*--- Reset registers ---*/[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]#if[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] FAST_MODE_PLUS[/COLOR]
LPC_IOCON->PIO0_4 |= (0x2<<8);
LPC_IOCON->PIO0_5 |= (0x2<<8);
LPC_I2C->SCLL = I2SCLL_HS_SCLL;
LPC_I2C->SCLH = I2SCLH_HS_SCLH;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]#else[/LEFT]
[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]LPC_I2C->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]SCLL[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = I2SCLL_SCLL;
LPC_I2C->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]SCLH[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = I2SCLH_SCLH;[/LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][LEFT]#endif[/LEFT]
[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ( I2cMode == I2CSLAVE )
{
LPC_I2C->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]ADR0[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = PCF8594_ADDR;
}

[/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]/* Enable the I2C Interrupt */[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][LEFT]NVIC_EnableIRQ([/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]I2C_IRQn[/I][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);

LPC_I2C->[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]CONSET[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = I2CONSET_I2EN;
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]return[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]( TRUE );[/LEFT]
}
[/SIZE][/COLOR][/SIZE]
0 Kudos
Reply