cancel
Showing results for 
Search instead for 
Did you mean: 

Store values in internal flash

GauravK
Senior

Can variable values be stored in some fixed addresses of internal flash and retrieved from them after reset? 

is there any example for same.

1 ACCEPTED SOLUTION

Accepted Solutions

@Uwe Bonnes wrote:

You can write to erased memory cells. 


@GauravK for more on this, see:

https://community.st.com/t5/stm32-mcus-products/flash-write-versus-erase-cycles/m-p/665631/highlight/true#M241948

and follow the link.

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

View solution in original post

6 REPLIES 6
Uwe Bonnes
Principal III

You can write to erased memory cells. This must happen in chunks, e.g. 256 bits on H7 and down to single bytes on some older families. If the retrieved value needs to be reporgrammed later, look for EPROM emulation.

As @Uwe Bonnes suggested, what you're looking for is:


Application note AN4894How to use EEPROM emulation on STM32 MCUs:

https://www.st.com/resource/en/application_note/an4894-how-to-use-eeprom-emulation-on-stm32-mcus-stmicroelectronics.pdf

 

and the X-CUBE-EEPROM EEPROM emulation expansion software for STM32Cube:

https://www.st.com/en/embedded-software/x-cube-eeprom.html 

 

EDIT:

Older stuff for F4:

AN3969: EEPROM emulation in STM32F40x/STM32F41x microcontrollers

https://www.st.com/content/ccc/resource/technical/document/application_note/ec/dd/8e/a8/39/49/4f/e5/DM00036065.pdf/files/DM00036065.pdf/jcr:content/translations/en.DM00036065.pdf

See also:

https://www.st.com/en/embedded-software/stsw-stm32066.html

https://community.st.com/s/question/0D50X00009XkhQn/stm32f4-eeprom-emulation-hal-library

 

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

@Uwe Bonnes wrote:

You can write to erased memory cells. 


@GauravK for more on this, see:

https://community.st.com/t5/stm32-mcus-products/flash-write-versus-erase-cycles/m-p/665631/highlight/true#M241948

and follow the link.

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

I will be checking and get back if needed

Akuma.6
Associate III

Hi,

I am working on STM32G0 series and trying to save the records (120bytes each record) into internal mcu flash memory location and when it required will read the read the stored records and do our operations.

Please let us know the logic.

Regards,

Kumar

 

See the links posted earlier!

Some more info here - including links to some other implementations:

https://community.st.com/t5/stm32-mcus-embedded-software/eeprom-emulation-virtual-addresses/m-p/675788

 

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.