cancel
Showing results for 
Search instead for 
Did you mean: 

Question about FLASH programming

matic
Associate III
Posted on March 26, 2016 at 21:21

If I understand right, to program FLASH, I have first to erase all page. Even if I want to store only one word of data. Is that true?

But page erasing is very slow - about 20 ms regarding to datasheet. This is not acceptable for our application where a whole program loop take about 10 us and this FLASH programming (storing of one word) should occur quite often.

Is there any other way to store data in a non-volatile memory, which would be faster? Is it possible to store data without erasing a page each time?

Thanks
4 REPLIES 4
Radosław
Senior II
Posted on March 26, 2016 at 21:44

I must say that, becose it isn't your first question about this.  You are doing it wrong.

very ofter writing to flash? vary bad idea.  You can pre erase flash. And store data to all cells.  Page then will be erase ones per several writes. 

But propably you you project assumption are wrong.  Use cpu with sleep mode, use baterry backap (supercap).  

Posted on March 27, 2016 at 00:37

The flash cells must be erased before reuse, but you need to move beyond writing a single word, this is just wrong headed. Even if you have to write a byte or small structure, the way this is done is to journal it over a whole sector/page/block. The memory has finite cycles, 100K for the STM32's as I recall.

Use the BKPRAM to store things you want saved, and that runs at bus speeds.

If you need EEPROM or FRAM you will need to add it externally. The size/structure of these memories is not conducive to the same processes as high speed logic, which is why you typically don't see them mixed these days.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
AvaTar
Lead
Posted on March 27, 2016 at 15:13

>The flash cells must be erased before reuse, but you need to move beyond writing a single word, this is just wrong headed. Even if you have to write a byte or small structure, the way this is done is to journal it over a whole sector/page/block. The memory has finite cycles, 100K for the STM32's as I recall.

 

Flash, using the mentioned block sizes, already consumes most of the die space. Having smaller block sizes would increase area requirements even more. Other vendors (e.g. Microchip) has implemented some Flash with single-byte access (erase/program), calling it ''EEPROM''. Usual size is 0.5 ... 8kByte, for data usage.

Basically, it is the same technology, trimmed for higher data retention and erase/program cycle count, and higher complexity, and higher costs.

> If you need EEPROM or FRAM you will need to add it externally. The size/structure of these memories is not conducive to the same processes as high speed logic, which is why you typically don't see them mixed these days.

 

E.g. TI does have MCUs with integrated FRAM (some MSP430 variants). Not sure if it'a a homogenous silicon.

If not prohibited by costs, I would suggest serial FRAM (SPI, IIC). Data retention and number of erase/write cycles is practically unlimited, and without additional delay (Flash/EEPROM has erase times in the milliseconds range).

matic
Associate III
Posted on March 27, 2016 at 19:57

Thank you all for the replies. Yes, I am aware of limited program/erase cycles. We will probably try to use a whole page (probably few of them), and do an erase only when all of them are full.