56F8013: Flash

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

56F8013: Flash

Jump to solution
2,628 Views
jag
Contributor IV
Hi,
I need to store a parameter in the flash. The problem is that I need to store it something like 300'000 during all the life time of the board, and the flash has a number erase-write cycles = 10'000 (minimum).
I'm thinking of using an array to stoer sequentially the parameter (that is something that continues to grow, so it's not very difficult to get the last value), but my question is:
How is the flash erased? Words, Banks, ...?
Because, if it's erased in words it's ok, I can do what I've written before, if the erase procedure erase more than a word using an array is useless because every time I erase and write all the array is erased and rewritten...

Thanks

Bye Jack
Tags (2)
0 Kudos
1 Solution
1,079 Views
jag
Contributor IV
Hi, thanks for the answer.
Unfortunately I don't have so much pages to spend for parameters saving.
I found out another method:
I use only one page.
luckily I need only 15 bit for the parameter, so I have 1 bit in the word that I can use like "bookmark".
If the bookmark is 1 the cell is free and I can write on it, if the bookmark is 0 the cell is used.
I can use a number of cells < 256 (I use 64). I write on the first cell that has the bookmark == 1. (when I read I use the last cell with bookmark ==0). When I used all the cells I make an erase page and I reastart from the beginning.

I use the HFM driver for read write (unbuffered) and page erase.

Bye Jack

View solution in original post

0 Kudos
3 Replies
1,079 Views
william_jiang
NXP Apps Support
NXP Apps Support
Hi Jack,
 
The flash can be erased by pages or can be mass erased ( the flash whole block is erased). Programing a bit makes the bit to 0, while erasing a page makes all bits in the page to 1s.
 
You can use multiple pages to get high endurance by emulating EEPROM. This is because it reduces the number of erase cycles. For example, you want 256 words with 100K cycles endurance.  What you can do is to reserve 10x256 words (please note that typical flash endurance of erase cycles is 10K)  for this purpose. 
1) 1st program is to program information into 1st 256 words.
2) 2nd program is to program zeros into 1st 256 words and information into 2nd 256 words.
......
10) 10th program is to program zeros into 9th 256 words and information into 10th 256 words.
11) Erase all 10 x 256 words, then go to step 1.
 
So useful information always starts from non-zero data.  
 
Hope it helps.
 
Best Regards,
 
Dragon
 
0 Kudos
1,080 Views
jag
Contributor IV
Hi, thanks for the answer.
Unfortunately I don't have so much pages to spend for parameters saving.
I found out another method:
I use only one page.
luckily I need only 15 bit for the parameter, so I have 1 bit in the word that I can use like "bookmark".
If the bookmark is 1 the cell is free and I can write on it, if the bookmark is 0 the cell is used.
I can use a number of cells < 256 (I use 64). I write on the first cell that has the bookmark == 1. (when I read I use the last cell with bookmark ==0). When I used all the cells I make an erase page and I reastart from the beginning.

I use the HFM driver for read write (unbuffered) and page erase.

Bye Jack
0 Kudos
1,079 Views
william_jiang
NXP Apps Support
NXP Apps Support
You're welcome. I agree. it is also a good way using single bit as a mark for each word. Good Luck!
0 Kudos