cancel
Showing results for 
Search instead for 
Did you mean: 

How to store data on non erasable memory of controller during run time.

Bs.1
Associate II

I am using STM32L442KC part number...And i want to store the 16 byte of data on non erasable memory of controller during runtime...Can i get any reference how to store the data in microcontroller memory???

14 REPLIES 14

Which OPT bytes would these be?

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

You can use the EEProm emulation software, or you can roll your own solution:

https://www.st.com/resource/en/application_note/dm00311483-eeprom-emulation-techniques-and-software-for-stm32-microcontrollers-stmicroelectronics.pdf

You need to erase the flash page and program your data each time you want to change it.

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

Hi TDK,

Thanks for your reply...

I have downloaded the EEProm emulation software(X-CUBE-EEPROM_V2.0.0). But in that there are so many files found in project folder of my targeted microcontroller.

I am stuck up with how to use that files in my actual code....

if any reference for how to use this files will be very helpful for me....

Bs.1
Associate II

I am targeted for the STM32L442KC part number... But in "X-CUBE-EEPROM_V2.0.0\Projects\STM32L4\EEPROM_Emul" folder I found the readme in which mentioned that "This example runs on STM32L476xx devices and STM32L4R5xx devices." will it work for STM32L442KC???

Also i didn't found eeprom.c file to use the respective API related to EEPROM....

The exact option byte/address has not been decided yet...the actual requirement is during runtime client system is going to send one string to my system and i have to store that string at non erasable memory to use afterward for further processing....I am stuck with how to store that received data in internal non erasable memory...

I found some API during search EEPROM_WriteData(), EEPROM_ReadData().... but stuck at how to generate the related API or middleware..

TDK
Guru

I don't use the EEPROM emulation software myself. I do have the same thing working on a few projects, but with my own code. I would imagine the code works on a STM32L442KC with few changes, but I'm guessing here.

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

Have you written on internal EEPROM in your code??if yes, how you have did this?? So that i can try the same logic in my code.

I am using STM32L442KC with AES functionality used in it...

HAL_FLASH_Program will write to flash. You need to erase the page before writing. That's the basics.
I don't want to share anything other than very basic code because that ends up as more work for me.
If you feel a post has answered your question, please click "Accept as Solution".
Bs.1
Associate II

Hi...

I have tried with below lines.

HAL_FLASH_Unlock();

HAL_FLASH_Program(FLASH_TYPEPROGRAM_DOUBLEWORD, 0x8000001, 0x01);

HAL_FLASH_Lock();

i.e i am trying to write the 0x01 data on address 0x8000001..

Any API to check???whether I have written the correct data on that particular address or not....

or can I read that data using particular API..? so that i can read and print it on Hyper Terminal to cross verify the successful data written on location or not.