Skip to main content
WNguy.1
Associate II
Jan 30, 2020 12:27 AM UTC
Solved

Help on storing live/changed data into STM32F4 board and retrieving it in it in its own code

Hi fellow programmers! I need assistance on where I would start in trying to flash/store live new data into an STM32 micro controller and then retrieving it to use again in the case that it resets or turns Off/On.

Any key words or directions would be greatly appreciated!

This topic has been closed for replies.
Andrew Neil
Andrew NeilBest answer
Super User
Jan 30, 2020 11:44 AM UTC

"I need assistance on where I would start"

For a start, you will need to be a competent 'C' programmer, with at least a working understanding of microcontroller architecture.

Assuming you have that, the first place to start with any new device is always to go to the manufacturer's Product Page - there you will find specifications, application notes, examples, tools, etc, etc, ...

https://www.avrfreaks.net/comment/2839426#comment-2839426

You haven't said which particular STM32F4 you're considering, so here's one at random:

https://www.st.com/en/microcontrollers-microprocessors/stm32f401.html

On the 'Resources' Tab, choose 'Technical Literature' and then 'Application Notes'

Spend some time browsing those - there's loads of useful stuff!

Juts to be awkward, it seems that the App Note you require is not listed!

:persevering_face:

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.

4 replies

Tesla DeLorean
Guru
Jan 30, 2020 1:10 AM UTC

Start with the Reference Manual, and the description of the FLASH subsystem and registers

Example, try this

STM32Cube_FW_F4_V1.24.1\Projects\STM32F413ZH-Nucleo\Examples\FLASH\FLASH_EraseProgram

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
TDK
Jan 30, 2020 3:08 AM UTC

To expand a little further, it is common to use the last page of flash to store program settings that you can read out and re-write during program execution. Note that flash isn't like RAM--you need to erase the entire page before you can write to any of it.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Andrew Neil
Andrew NeilBest answer
Super User
Jan 30, 2020 11:44 AM UTC

"I need assistance on where I would start"

For a start, you will need to be a competent 'C' programmer, with at least a working understanding of microcontroller architecture.

Assuming you have that, the first place to start with any new device is always to go to the manufacturer's Product Page - there you will find specifications, application notes, examples, tools, etc, etc, ...

https://www.avrfreaks.net/comment/2839426#comment-2839426

You haven't said which particular STM32F4 you're considering, so here's one at random:

https://www.st.com/en/microcontrollers-microprocessors/stm32f401.html

On the 'Resources' Tab, choose 'Technical Literature' and then 'Application Notes'

Spend some time browsing those - there's loads of useful stuff!

Juts to be awkward, it seems that the App Note you require is not listed!

:persevering_face:

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.
WNguy.1
WNguy.1Author
Associate II
Jan 30, 2020 5:13 PM UTC

Wow, amazing, thanks so much for the great advice and help! I'm using the Nucleo-F413ZH and programmed a CAN bus interface with a motor, in case of a power failure or general functionality, I'd want it to store its most recent position. I should be able to find the most optimal scenario if it'd be flashing the memory or using EEPROM for example.