I2C Eeprom free clocking

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

I2C Eeprom free clocking

1,664 Views
MdeJong
Contributor I
Hello all,
 
After getting the second I2C bus working on the MCF5251 (the port configuration was wrong).
I have a new problem:
 
For error handling with EEPROMs the appliction note says, to generate 9 start sequences followed by one stop sequence.
 
To generate this sequence I have tried following code:
 
Code:
        MBAR2_MBCR = MBCR_MTX | MBCR_IEN;            MBAR2_MBCR |=  MBCR_MSTA;                /* generate start */        for (loop = 0; loop < 8; loop++)        {            MBAR2_MBCR |=  MBCR_RSTA;            /* generate restart */        }                MBAR2_MBCR &= ~MBCR_MSTA;                /* generate stop */        MBAR2_MBCR = 0;        MBAR2_MBCR = MBAR2_MBCR | MBCR_IEN;

 
It works when I single step through it, but not when running real-time, what am I doing wrong.
 
 
Regands Mark,
Labels (1)
0 Kudos
1 Reply

887 Views
admin
Specialist II
Generating a START condition takes time. You cannot reasonably expect to set the RSTA bit 9 times in a row in a quick succession and have 9 START conditions on the bus with proper timing. You must have some sort of delay between the consecutive START conditions.
0 Kudos