D
D
Denis2016-08-03 14:34:35
C++ / C#
Denis, 2016-08-03 14:34:35

Ways to protect against data loss when writing to flash?

Good day.
Development for stm32f4 microcontroller.
In the project, you have to work a lot with flash memory, writing small portions of data there. To protect the system from data loss when the process of writing to memory is interrupted, say, when the microcontroller is turned off, the first thing that comes to mind is to duplicate flash memory pages and set the flags of the current working version to them, but copying the entire page with each write operation does not look attractive, because it takes quite a lot of time.
Whether prompt there are any algorithms of protection against data loss for such cases.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
iv_k, 2016-08-03
@lacredin

if you don't want FS - duplicate sectors, put write counters and CRC on them. if the CRC does not match, we take another sector, if both are valid, we take the one with a larger counter.
If you need to write some settings often, I advise you to think about external FRAM

D
Dmitry Murzinov, 2016-08-03
@iDoka

Since you are more interested in the problem of write atomicity than integrity,
I would look towards JFFS2 if I were you.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question