Clock settings for LPC11U14 target board in I2C Fast mode

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

Clock settings for LPC11U14 target board in I2C Fast mode

238 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Sathiyakala on Tue Sep 11 04:32:38 MST 2012
:confused:Is the below program will set the clock correctly for a master transmitter operation for a 400Khz I2C interface?

void I2CInit()
{
  LPC_SYSCON->PRESETCTRL |= (1<<2);

  LPC_SYSCON -> SYSAHBCLKDIV |=(1<<1);

  LPC_SYSCON->SYSAHBCLKCTRL |= (1<<5);


  LPC_IOCON->PIO0_4 |= 0x81;/* I2C SCL */

  LPC_IOCON->PIO0_5 |= 0x81;/* I2C SDA */

 
  LPC_I2C->SCLL   = 0x0000000F;
  LPC_I2C->SCLH   = 0x0000000F; //For 12MHZ frequency

  /*--- Clear flags ---*/
  LPC_I2C->CONCLR = I2CONCLR_AAC | I2CONCLR_SIC | I2CONCLR_STAC | I2CONCLR_I2ENC;

  LPC_I2C->CONSET = I2CONSET_I2EN|I2CONSET_STA;

}
0 Kudos
2 Replies

212 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Sathiyakala on Tue Oct 09 21:41:52 MST 2012
Thanks for ur valuable reply. It woks now.
0 Kudos

212 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by daniel.widyanto on Fri Sep 28 01:00:12 MST 2012
Nope.

The I2C reset is in bit 1 PRESETCTRL
LPC_SYSCON->PRESETCTRL |= /* should be */ (1<<1); 
.
0 Kudos