Skip to main content
Visitor II
July 5, 2006
Question

I2C with M24C02

  • July 5, 2006
  • 6 replies
  • 1170 views
Posted on July 05, 2006 at 10:28

I2C with M24C02

    This topic has been closed for replies.

    6 replies

    ahmadAuthor
    Visitor II
    July 4, 2006
    Posted on July 04, 2006 at 10:34

    hi,

    I'm trying to make the communication between the I2C bus with a M24C02 EEPROM . what is the difference between it and other m24cxx. can anyone send an example of working I2C with it.

    thanks in advance

    Visitor II
    July 4, 2006
    Posted on July 04, 2006 at 10:41

    Hi,

    There is an ST application note 'STR71x I2C Communication with M24Cxx EEPROM' available on the following link:

    http://mcu.st.com/mcu/modules.php?name=mcu&file=familiesdocs&fam=86

    I hope that this can help you,

    Regards,

    Hich ;)

    ahmadAuthor
    Visitor II
    July 5, 2006
    Posted on July 05, 2006 at 06:32

    hi,

    thanks hich. it works now. But i had a new problem. i'm trying to get I2C0 and I2c1 to work. well I2C1 seems to be working fine, but not I2C0 which not giving out any signal. I probed it using oscilloscope. Does the 2 ports has a different bus address?? anyone can help me with this?

    thanks

    ahmadAuthor
    Visitor II
    July 5, 2006
    Posted on July 05, 2006 at 07:30

    hi,

    thanks RISC

    yes i've configured both as AF open drain but it seems only I2C1 is working.i included the code for I2C0 configuring which is basically about the same for I2C1.

    GPIO_Config(GPIO1, I2C_SCL0|I2C_SDA0, GPIO_AF_OD); //Open-drain output for SCL (P1.13), SDA (P1.14)

    I2C_Init(I2C0); //Initialize I2C1 Peripheral

    //APB_ClockConfig( APB1, ENABLE, 0x0004 ); //Enabling I2C clock via APB

    I2C_FCLKConfig(I2C0); //Config I2C freq. according for FCLK freq.

    I2C_OnOffConfig(I2C0, ENABLE); //Enable I2C Peripheral

    //I2C_AddressConfig ( I2C0, 0xC0, I2C_Mode7);//configure the BUS address

    I2C_SpeedConfig(I2C0,100000); //Select I2C Clock speed = 100khz

    I2C_AcknowledgeConfig(I2C0, ENABLE); //Enable Acknowledge feature

    I2C_ITConfig (I2C0, ENABLE); // // Enable the interrupt generation

    thanks,

    ahmadAuthor
    Visitor II
    July 5, 2006
    Posted on July 05, 2006 at 08:42

    hi,

    yes all gpios and i2cs has been uncommented. ive tested the 2 programs which uses i2c1 and i2c0 respectively with the exact same code. i2c1 works but i2c0 doesnt. i'm using raisonance reva starter kit btw.

    thanks

    ahmadAuthor
    Visitor II
    July 5, 2006
    Posted on July 05, 2006 at 10:28

    hi,

    thats what i figured out this morning that I2C0 not connected to the HW but i;m not entirely sure. but since you mention it then its should be true. to answer your question, nope i havent made any HW modification. thanks a lot btw.

    thanks again.