hi,
i would like to know the write and erase times for a sector for a 89V51RD2 microcontroller. if you have this info please share it.
Also i see from the datasheet that the write/erase cycles are 10000. is this for one sector or for the entire block? the origin of this question is can the lifetime of the device be calculated as
lifetime of flash = 10000 * number of sectors ?
i will use one sector at a time and then when this sector is full erase and begin writing again to this sector. when the number of write/erase cycles are over then i move over to the next sector. will this work?
any inputs will be helpful. thanks in advance.
well i will initiate the write after i detect the powerfail so i think there is no question of a powerfail during the writing to flash.
Remember that flash writes requires a constant voltage - so you need to catch power failures by looking at some voltage on the outside of your regulator. And have large enough capacitors that the regulator can supply a valid voltage until you are done.
Not only that - the capacitors must hold for long enough that they support a write failure in which case you might have to try a second time by maybe failing your current sector and move to the next sector. Or you might step back in time with on average 5k saves but potentially a full 10k saves.
you are overcomplicating it use a struct
x x x cksm used
to write after start/power fail: start from the beginning, the first struct where used is ff is where you write then keep a RAM pointer till next fail
to read after powerfail finf the first where used is ff go one back, if cksm is OK, use it, if not, go one more back
i have done this many times, the abive just works
thanks for your reply...this seems to be a good method. i will use it.
ofcourse i will detect the powerfail as early as possible.
regarding the capacitance values i need to know the write time for calculating the capacitance values. and the current consumed by the microcontroller during the write. this value i can get by monitoring the microcontroller for some time during operation but i am still stuck on the write time.
regarding the write time i thought i could calculate it roughly by flashing a hex file of a know size using the FlashMagic SW. i know that this uses isp routines while my application will use iap routines but the time for writing a byte to the flash would be the same?
thanks for your inputs. your inputs have helped me a lot!
Normally, writes are fast. It's normally the erase to make the flash sector ready to accept data that takes lots of time. Which means that having one sector pre-erased can reduce your power needs - but if that write fails you lost your margin for a second attempt.