Skip to main content
Graduate II
April 6, 2024
Solved

Question about HAL_I2C_Mem_Write for accessing I2C EEPROM

  • April 6, 2024
  • 2 replies
  • 1984 views

Most I2C EEPROM (eg M24M01E) need some time after a write command to transfer the written data into the internal EEPROM. During that time (eg max 3.5 ms) the device does not respond to I2C.

My question is about the timeOut parameter in the HAL_I2C_Mem_Write (and other HAL_I2C_Mem_xxxx) :

Is this timeOut intended or suited to deal with this unavailability of the device after a write operation ? 

If I want to do 2 write operations (and I do not insert a delay between both HAL calls myself), will the second call automatically retry until timeOut, and so if I set timeOut to 4 ms, I could in the application simply ignore the needed delay after a write operation.

 

    This topic has been closed for replies.
    Best answer by Pavel A.

    Yes.

     

    2 replies

    Pavel A.Answer
    Super User
    April 6, 2024

    Yes.

     

    Super User
    April 6, 2024

    If you know, to write 2 or more bytes, you should not use "byte write", but page write, to do it in one access:

    AScha3_0-1712432984588.png

    -> less stress to the eeprom and to you (about timing) .

    StrooomAuthor
    Graduate II
    April 6, 2024

    Thank you.  Of course I combine writes to consecutive addresses into page-writes, but when this address range spans several pages, I have to split it into multiple page writes.