AnsweredAssumed Answered

I2C Master On MCF52233

Question asked by Rajkumar Vinod Kanna on Apr 20, 2009
Latest reply on Jan 7, 2010 by Mark Butcher

I'm using an external I2C based eeprom on my MCF52233 board.

Now the code to initialise is as below. No matter what I do, I'm unable to get past the I2SR_IBB_BITMASK check. Can any one help me please?

 

void i2c_init(void)
{
 

    if (I2SR | I2SR_IBB_BITMASK)
    {
    /* I2SR's IBB flag will be set on power up.
       The sequenc below is done to reset this bit. */
        I2CR = 0;
        I2CR = 0xA0;
        I2DR;
        I2SR = 0;
        I2CR = 0;
        I2CR = 0x80;
    }
   
    /* The above set up is called again */
   
    /* I2CR: IEN=0,IIEN=0,MSTA=0,MTX=1,TXAK=0,RSTA=0,??=0,??=0 */
    I2CR = 0x10;
    /* I2FDR: ??=0,??=0,IC=0x3B */
    I2FDR = 0x3B;
    /* I2ADR: ADR=0,??=0 */
    I2ADR = 0x00;
    /* I2SR: ICF=1,IAAS=0,IBB=0,IAL=0,??=0,SRW=0,IIF=0,RXAK=1 */
    I2SR = 0x81;
    /* I2CR: IEN=1 */
    I2CR |= 0x80;

 

    /* Check Bus Busy. */
    while (I2SR | I2SR_IBB_BITMASK)
        ;

 

}

Outcomes