lpcware

I2C0 initialization

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by renan on Thu Jan 06 05:53:04 MST 2011
I've been trying to set up I2C0 on my RDB1768 board. Here is my initialization code: (From what I have read in the UM10360, this should be enough to start the clock generation on the SCL pin, please correct me if I'm wrong)


void i2cInitPins()
{
    LPC_PINCON->PINSEL1 |= ~(2 << 22);
    LPC_PINCON->PINSEL1 &= ~(2 << 24);
    LPC_PINCON->I2CPADCFG = 0;
}

void i2cInit()
{
    LPC_SC->PCONP |= (1 << 7);
    LPC_SC->PCLKSEL0 = 1 << 14;

    LPC_I2C0->I2SCLH = 125;
    LPC_I2C0->I2SCLL = 125;

    LPC_I2C0->I2CONCLR = I2CONCLR_AAC | I2CONCLR_SIC | I2CONCLR_STAC | I2CONCLR_I2ENC;

    NVIC_EnableIRQ(I2C0_IRQn);

    LPC_I2C0->I2CONSET = I2CONSET_I2EN;   
}


When I scope the SCL pin, I only see it high.

Renan

Outcomes