cancel
Showing results for 
Search instead for 
Did you mean: 

EEPROM Emul advantages in STM32WL

RPaja.1
Associate II

Hi All,

I have implemented EEPROM Emul Middleware in STM32WL project (https://www.st.com/resource/en/application_note/an4894-eeprom-emulation-techniques-and-software-for-stm32-microcontrollers-stmicroelectronics.pdf) in lieu of writing directly in FLASH the NVM Lorawan Context Structure.

LorawanEndNode example store the NVM Lorawan Context Structure in FLASH, directly as follow( function OnStoreContextRequest in lora_app.c):

if (FLASH_IF_Erase(LORAWAN_NVM_BASE_ADDRESS, FLASH_PAGE_SIZE) == FLASH_IF_OK)
 {
    FLASH_IF_Write(LORAWAN_NVM_BASE_ADDRESS, (const void *)nvm, nvm_size);
  }

I changed this function to my own function using EEPROM Emul

  //store nvm in eeprom
  writeNVMContext_EEPROMemul ((const void *)nvm, nvm_size);

And something similar to restore the context.

It is working properly as desired:

  • I store the NVM lorawan context every Uplink/Downlink message. This works for my OTAA session is always ok after poweron/off or hard resets.
  • Save lifetime of FLASH in this case of use:
    • EEPROM Emul: Every Uplink/Downlink only changes 24 bytes.
    • FLASH directly: Every Uplink/Downlink erase and write 1484 bytes in 1 page.

My calculations are that EEPROM Emul write cycles are 10.000, and i have configured EEPROM emul for 2 & 2 EEPROM Pages:

1484 bytes first write.

24 bytes every Uplink/Downlink

...

...

4096 bytes(2 pages) 1484 + 108x24 bytes.

Every 108 Downlink/Uplink 2 pages are erased.

Next 108 Downlink/Uplink Next 2 pages are erased.

We have 4 pages of EEPROM Emul.

If every page have 10000 write cycle life.

EEPROM Emul lifetime in this case is: 216 x10000= 2.160.000 downlink/uplink messages

Do you think that it is correct?

Thanks very much

1 ACCEPTED SOLUTION

Accepted Solutions
IIRHO.1
ST Employee

hello @RPaja.1​   and welcome to ST Community

Based on your description, your calculations seem to be correct. If you are only writing 24 bytes for every uplink/downlink message, and you have 4 pages of EEPROM Emul each with a write cycle life of 10,000, then your EEPROM Emul lifetime in this case would be 216 x 10,000 = 2,160,000 uplink/downlink messages.

However, it's worth noting that the actual lifespan of the EEPROM Emul may vary depending on various factors . That's why it's always a good idea to perform some testing to validate the longevity of the EEPROM Emul under your specific use case.

hope this is helpful. If this is what you are looking for, please mention my answer as the best answer so that the information will be defused.

Issam

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

2 REPLIES 2
IIRHO.1
ST Employee

hello @RPaja.1​   and welcome to ST Community

Based on your description, your calculations seem to be correct. If you are only writing 24 bytes for every uplink/downlink message, and you have 4 pages of EEPROM Emul each with a write cycle life of 10,000, then your EEPROM Emul lifetime in this case would be 216 x 10,000 = 2,160,000 uplink/downlink messages.

However, it's worth noting that the actual lifespan of the EEPROM Emul may vary depending on various factors . That's why it's always a good idea to perform some testing to validate the longevity of the EEPROM Emul under your specific use case.

hope this is helpful. If this is what you are looking for, please mention my answer as the best answer so that the information will be defused.

Issam

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

RPaja.1
Associate II

Thanks for your response @IIRHO.1​ , I will test it.

Regards