Skip to main content
Sbhus.1
Visitor II
August 18, 2020
Solved

flash memory-STM32F103C8

  • August 18, 2020
  • 1 reply
  • 718 views

 STM32F103C8 , with MXCUBE, MDK-ARM V5.

I would like to know how to program to store the counter value in flash memory even in power failure. when power goes up automatically recall the counter value. Please support me to solve this. I am not fully aware of microcontrollers. I am RF engineer.

This topic has been closed for replies.
Best answer by waclawek.jan

Read PM0075.

Note that you will need to erase the FLASH page where you store the data before you write new value to it. The whole page gets erased at once, but it takes quite a significant time (see datasheet). During that time, FLASH is inaccessible for read, so the program can't run out of it. If this is an issue, you'd need to move relevant portions of the program into RAM and run from there; this is not entirely trivial.

You may want to consider attaching an external serial EEPROM instead.

JW

1 reply

waclawek.jan
waclawek.janBest answer
Super User
August 18, 2020

Read PM0075.

Note that you will need to erase the FLASH page where you store the data before you write new value to it. The whole page gets erased at once, but it takes quite a significant time (see datasheet). During that time, FLASH is inaccessible for read, so the program can't run out of it. If this is an issue, you'd need to move relevant portions of the program into RAM and run from there; this is not entirely trivial.

You may want to consider attaching an external serial EEPROM instead.

JW