cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F446: Flash memory

tst
Associate II

I want write only some bytes but before that I have to erase a full sector.

If I don´t want to loss data from that sector I will need save them.

If sector size is 128Kb, how can I save all data? 

Thank you !

This discussion is locked. Please start a new topic to ask your question.
1 ACCEPTED SOLUTION

Accepted Solutions

The first sector at 0x08000000 must be used by code (or bootloader) because the execution starts there.

All other sectors are up to you. A common approach is to allocate two sectors for data: one current and another backup.

Copy the data from one sector to another before erasing. Copying does not take much RAM, it can be done by 2 or 4 bytes.

-- pa

View solution in original post

11 REPLIES 11
John Craven
Senior

Have you looked at the EEPROM emulation packages that STM provides for most series?

Pavel A.
Super User

It's a problem. 446 has sectors of different size, and there's too little RAM to back up 128K. Try to find a smaller sector: 16 or 32K.

-- pa

The sector sizes of F446 are: 16K, 64K and 128K... I have also tried to save 16K data but I couldn't, just until 10K...

Couldn't I back up data from this flash memory?

You'll need to use smaller sectors for configuration data, by leaving holes in the code space. Or use a sector, or two, that you can commit to the data storage task, and ping-pong between them.

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

I am trying to run the example but sometimes it works and others not...

But that MCU has these size sectors...so I will need manage data of these sizes...(16K,64K,128K...)...

How can I do it?

How can I do it?

The first sector at 0x08000000 must be used by code (or bootloader) because the execution starts there.

All other sectors are up to you. A common approach is to allocate two sectors for data: one current and another backup.

Copy the data from one sector to another before erasing. Copying does not take much RAM, it can be done by 2 or 4 bytes.

-- pa