cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to write a complete page in 256 K-Bit I2C EEPROM

msjk25
Associate

I am using M24256-BW M24256-BR M24256-BF
M24256-DR M24256-DF 256 K-Bit I2C EEPROM for booting purpose.
While writing the data into EEPROM, I am not able to write the last byte(64th) of the page.
If I will write it separately, then it will work fine but with the page write it is not.

Is there any workaround for this issue.
I am following the correct sequence of steps given in the datsheet.

Thank you.

 

4 REPLIES 4
TDK
Guru

Perhaps the indices are 0-based and you're using 1-based. Show you code.

If you feel a post has answered your question, please click "Accept as Solution".

I am using 0 based indices only.
If I am writing 65 bytes, then also what is happening is the last byte is rolling over to 0th index but the last byte remains same as FF. (the 64th byte is not getting written anywhere).

My write function is as below:

void drv_writeEeprom(UINT32 count, UINT16 w_addr, UINT8* i2cDataSendArray){

 

    /*Give the start condition*/
    i2c_start(M_APPI2C_REGS_PTR);

    /*Send slave address with R/W_ bit as 0*/
    drv_i2cSendData(M_APPI2C_REGS_PTR,0xA0U);

    /*Send the two bytes of address*/
    drv_i2cSendData(M_APPI2C_REGS_PTR,w_addr>>8);
    drv_i2cSendData(M_APPI2C_REGS_PTR,w_addr & 0xFFU);

    /*Send the data bytes to write in EEPROM*/
    for(UINT32 i=0;i<count;i++){
        drv_i2cSendData(M_APPI2C_REGS_PTR,i);
    }

    /*Give the stop condition*/
    i2c_stop(M_APPI2C_REGS_PTR);

    /*Give a delay of 5ms for internal write cycle to be completed*/
    sys_delayInUs(5000);

}

 

And what platform is this?

Perhaps inspect signals with a scope or logic analyzer, looking specifically how it manages the stop. How the stop and start functions wrap the drv_i2c function. Perhaps there are other more compound functions.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
TDK
Guru

> If I am writing 65 bytes,

You can only write one page (64 bytes) at a time, per the datasheet. If your first written index is 0, then the last written index will be 63, not 64.

TDK_0-1688862632630.png

 

If you feel a post has answered your question, please click "Accept as Solution".