Society of Robots - Robot Forum

Software => Software => Topic started by: jackp on April 27, 2010, 04:55:46 PM

Title: How many times can you program the flash memory?
Post by: jackp on April 27, 2010, 04:55:46 PM
Hi,

Is there a limit to the number of times you can write the flash memory with the programmer? 

I've been debugging by iteratively changing a couple of lines of code, uploading the new program and assessing results and not sure if this is best practice.

Thanks
Jack
Title: Re: How many times can you program the flash memory?
Post by: Razor Concepts on April 27, 2010, 05:14:36 PM
10 year 10,000 program warranty  ;D
Look in the datasheets and its on the first page  ;)
Title: Re: How many times can you program the flash memory?
Post by: chelmi on April 27, 2010, 05:16:33 PM
the datasheet says:

Quote
Write/Erase cyles: 10,000 Flash/100,000 EEPROM
Title: Re: How many times can you program the flash memory?
Post by: Admin on April 28, 2010, 06:32:15 AM
Its a bell curve failure rate - whats in the datasheet is just the average. It also doesn't state how it fails (ie bad sectors, or entire failure), or what that bell curve looks like.

Just don't use EEPROM like RAM, and you won't have a problem. EEPROM is meant for data that slowly/rarely changes.
Title: Re: How many times can you program the flash memory?
Post by: Soeren on April 28, 2010, 03:00:19 PM
Hi,

Although it isn't applicable here; when you need flash memory in general to live as long as possible, just make sure to spread the use over the entire map.
Bad sectors should be mapped out of course, but there isn't really any rigid data on how much of the chip must be good to call it go or no-go.

But... it's a common concern among newbies that use crash-and-burn programming, but even with that sort of programming, 10,000 cycles is a whole lot of button pushing, so stop worrying.
Title: Re: How many times can you program the flash memory?
Post by: corrado33 on April 28, 2010, 04:22:50 PM
Hi,

Although it isn't applicable here; when you need flash memory in general to live as long as possible, just make sure to spread the use over the entire map.

So if my program only takes up 10% of the space available in flash memory... how do I program it to the 2nd 10% available, then the third, then the forth etc, so I spread it out over the entire space?  Is that what you were saying?
Title: Re: How many times can you program the flash memory?
Post by: chelmi on April 28, 2010, 04:42:49 PM
Hi,

Although it isn't applicable here; when you need flash memory in general to live as long as possible, just make sure to spread the use over the entire map.

So if my program only takes up 10% of the space available in flash memory... how do I program it to the 2nd 10% available, then the third, then the forth etc, so I spread it out over the entire space?  Is that what you were saying?

;)
Title: Re: How many times can you program the flash memory?
Post by: Soeren on April 28, 2010, 05:22:36 PM
Hi,

Although it isn't applicable here; when you need flash memory in general to live as long as possible, just make sure to spread the use over the entire map.

So if my program only takes up 10% of the space available in flash memory... how do I program it to the 2nd 10% available, then the third, then the forth etc, so I spread it out over the entire space?  Is that what you were saying?
That's more or less how some Flash RAM controllers work automatically (don't know if it's outside the proto-labs yet though). A similar method was devised for EEPROMS in the eighties. The key is to have a scratchpad with an index/pointer to start and length.
It could be that you allways get a pointer from an outside switch selectable PROM, like in an interrupt vector controller. That way you never changes the first jump and the second get vectored to whereever the new code is.

But, I repeat "isn't applicable here" where we're talking about program memory.

That said, I bet I could do it, if the controller had enough space to make it worthwhile, but then again, how long would it take/how high do you value your time, compared to the the fact that a new controller is cheaper than dirt, so just pop a new one in.


A hobbyist isn't likely to go through 10,000 cycles to get a program right (or they would probably give up and find another hobby) and when the program work, I assume the chip is normally not reprogrammed, as it then sits in a PCB doing a job.

Yet another perspective: a midrange controller is around 1/4 to 1/2 the price of a plain hamburger - drop one hamburger (might be healthy and won't hurt nothing) and you have the equivalent of 20,000 to 40,000 more burns in reserve.


Don't worry, be happy and brush your teeth  ;D
Title: Re: How many times can you program the flash memory?
Post by: corrado33 on April 28, 2010, 05:47:11 PM
Hi,
But, I repeat "isn't applicable here" where we're talking about program memory.


I uh... missed that part.   ;)  Honestly I was never worried, since as you said, MCUs are very cheap.  A few bucks isn't worth the time it would take to preserve the flash memory of an MCU.