This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

I2C with LPC2387

Hi,

I am working on MCB2300(LPC2387).
I have used its sample code for Temperature sensing using I2C and its working fine.
Now I have connected EEPROM (AT24C02) with microcontroller to store some data.
For that I have used same code and did some changes to write and read data from EEPROM.
But its not working properly.
Below is changes which I have done.

int main (void)
{
  DWORD i;

  if ( I2CInit( (DWORD)I2CMASTER ) == FALSE )   /* initialize I2c */
  {
        while ( 1 );                            /* Fatal error */
  }

  /* Configure temp register before reading */
  for ( i = 0; i < BUFSIZE; i++ )    /* clear buffer */
  {
        I2CMasterBuffer[i] = 0;
  }
  I2CWriteLength = 3;
  I2CReadLength = 0;
  I2CMasterBuffer[0] = 0xA0;
  I2CMasterBuffer[1] = 0x00;
  I2CMasterBuffer[2] = 0x10;    /* configuration value, no change from
                                                                default */
  I2CCmd = LM75_CONFIG;
  I2CEngine();

   for ( i = 0; i < BUFSIZE; i++ )   /* clear buffer */
  {
        I2CMasterBuffer[i] = 0;
  }

  I2CWriteLength = 2;
  I2CReadLength = 1;
  I2CMasterBuffer[0] = 0xA1;
  I2CMasterBuffer[1] = 0x00;
  I2CCmd = 0xA0;
  I2CEngine();
  }

Suggest me where I have done mistake.
any link of tutorial for R/W data using LPC2387 will be appreciated.
Hope for best solution.

Thanks
Dhaval

Parents
  • ics.nxp.com/.../lpc17xx.cmsis.driver.library.zip

    Download the above driver library, it is for LPC17xx, but the I2C controller supposed to be similar.

    Now, NXP provides more I2C examples, including:

    /***********************************************************************//**
     * @file                pca8581_test.c
     * @purpose             An example of I2C using polling mode to test the I2C driver.
     *                              Using EEPROM PCA8581 to transfer a number of data byte.
     * @version             2.0
     * @date                21. May. 2010
     * @author              NXP MCU SW Application Team
     *---------------------------------------------------------------------
    

    The path:
    lpc17xx.cmsis.driver.library\LPC1700CMSIS\Examples\I2C\pca8581_polling

Reply
  • ics.nxp.com/.../lpc17xx.cmsis.driver.library.zip

    Download the above driver library, it is for LPC17xx, but the I2C controller supposed to be similar.

    Now, NXP provides more I2C examples, including:

    /***********************************************************************//**
     * @file                pca8581_test.c
     * @purpose             An example of I2C using polling mode to test the I2C driver.
     *                              Using EEPROM PCA8581 to transfer a number of data byte.
     * @version             2.0
     * @date                21. May. 2010
     * @author              NXP MCU SW Application Team
     *---------------------------------------------------------------------
    

    The path:
    lpc17xx.cmsis.driver.library\LPC1700CMSIS\Examples\I2C\pca8581_polling

Children
No data