cancel
Showing results for 
Search instead for 
Did you mean: 

Error in writing data to ST25DV user memory EEPROM

Nikhil D&K
Senior

Hello,

I am currently interfacing ST25DV with STM32L073 MCU using lower level drivers for I2C instead of HAL drivers. I have successfully configured and tested the ST25DV FTM mode.

Now i want to use the user memory region in ST25DV to store product information. So what should be the steps to write and read from the user memory (EEPROM) ?

As per the docs, i have to disable the mailbox to have access to EEPROM. So i disabled the mailbox using dynamic register. Than opened I2C session by passing password. Using i2c write function tried writing a single byte to 0x0000 address but write function failed. When i try using HAL driver it gives me error code of 1.

So can anyone please tell me the step for writing / reading from the user memory EEPROM in ST25DV04K.

1 ACCEPTED SOLUTION

Accepted Solutions
JL. Lebon
ST Employee

Hello Nikhil,

As you already understood, EEPROM is not accessible if the mailbox is enabled.

So, you first need to ensure that mailbox is disabled. This can be done by writing in the MB_CTRL_Dyn register with value 0 (I guess you already figured this out well).

An other condition is that the EEPROM address you want to write should not be write protected. You can check the write protection by reading ENDAx configuration bytes (this determines the areas sizes) and I2CSS (this gives you the protection setting of each area).

If the area is write protected, you need to first sent the I2C password. You can then check if the security session is correctly opened by reading the I2C_SSO_Dyn register: a value of 1 indicates that the security session is opened. A write is then possible.

Finally, you need to have the I2C write command framed correctly. For example, to write a single byte at address 0x0000, your I2c frame needs to be like this: Start/0xA6/Ack/0x00/Ack/0x00/Ack/DataByte/Ack/Stop

Best reagrds.

View solution in original post

2 REPLIES 2
JL. Lebon
ST Employee

Hello Nikhil,

As you already understood, EEPROM is not accessible if the mailbox is enabled.

So, you first need to ensure that mailbox is disabled. This can be done by writing in the MB_CTRL_Dyn register with value 0 (I guess you already figured this out well).

An other condition is that the EEPROM address you want to write should not be write protected. You can check the write protection by reading ENDAx configuration bytes (this determines the areas sizes) and I2CSS (this gives you the protection setting of each area).

If the area is write protected, you need to first sent the I2C password. You can then check if the security session is correctly opened by reading the I2C_SSO_Dyn register: a value of 1 indicates that the security session is opened. A write is then possible.

Finally, you need to have the I2C write command framed correctly. For example, to write a single byte at address 0x0000, your I2c frame needs to be like this: Start/0xA6/Ack/0x00/Ack/0x00/Ack/DataByte/Ack/Stop

Best reagrds.

Okay thanks.