# Data retention on a microcontroller

Just reading the datasheet of the attiny13 it says that it can hold its data for 20 years at 85 degrees Celsius and 100 years at 25 degrees Celsius.

• Is this irrespective of the read and writes on the micro for example I turn it off and keep it at a constant temperature of 85 degrees Celsius for 20 years and it will loose its data?
• How can it "loose" its data? I fail to see this concept.
• Also what is with the unit ppm(parts per million?) its mentioned on page 6 in the data retention section but don't understand what its talking about. I've seen it regularly when talking about crystal oscillators but can't understand why its used.
• What's your use case? For most applications, the thing to take away from that page is "The data will last longer than your device, don't worry about it." Are you working on a high durability, safety critical, or otherwise unique product? – Kevin Vermeer Jun 29 '11 at 21:51
• @Kevin There is no case for this question just read it in the datasheet and wondered what it meant by this statement as I got a little confused. – Dean Jun 29 '11 at 21:53
• @answerers: that 1 ppm, how should I read that? 1 defective controller per million, or 1 defective bit cell per million. The first possibility is comforting, the second less so. – Federico Russo Jun 30 '11 at 9:09
• @Federico - good question. I updated my answer. – stevenvh Jun 30 '11 at 10:23
• It holds a charge.. when you rewrite the cell it will hold it for another 20 years @85d. Like recharging it. So after time the charge start to fail and the data start to corrupt. – Piotr Kula Aug 24 '11 at 8:07

Flash memory, like EEPROM, stores its information in so-called floating gates. Normal gates on (MOS)FETs have an external connection through which the FET is switched on and off (for integrated MOSFETs this would be a metal layer connection). Floating gates don't have this pin or metal layer connection. They sit completely insulated in SiO$_2$ above the MOSFET's channel, and at > $10^{14} \Omega$cm SiO$_2$ is one of the best insulators you can get.

Like traditional MOSFETs they switch the channel on when they carry a charge. But how are they programmed then? Through a quantum effect called tunneling which is induced by applying an electric field between the channel and a control gate. The technology is therefore called FLOTOX, short for "FLOating-gate Tunnel OXide", comparable to FAMOS ("Floating-gate Avalanche injection Metal Oxide Semiconductor") used in the older UV-erasable EPROMs.
(I can't explain tunneling in detail here; quantum effects defy any logic. Anyway it relies heavily on statistics).

Your first question is actually a double one: 1) can I perform unlimited reads and writes, and 2) does it retain the data when the device isn't used (shelf life)?
To start with the first: no you can't. You can read it an unlimited number of times, but write cycles are limited. The datasheet says 10 000 times. The limited number of cycles is caused by charge carriers left in the floating gate after erasure, whose number in the end becomes so large that the cell can't be erased anymore.
Will it retain its data for 20 years even without power? Yes, that's what the datasheet says. MTTF (Mean Time To Failure) calculations (again a statistical method) predict less than 1 part per million errors. That's what the ppm means.

a note on MTTF
MTTF means Mean Time To Failure, which is different from MTBF (Mean Time Between Failures). MTBF = MTTF + MTTR (Mean Time To Repair). Makes sense.
People often use the term MTBF when they actually mean MTTF. In many situations there's not much difference, like when the MTTF is 10 years, and the MTTR is 2 hours. But failed microcontrollers aren't repaired, they are replaced, so neither MTTR nor MTBF means anything here.

Atmel quotes 1ppm errors after 100 years. It's obvious that the AVR hasn't been in production for that long, so how would they come to that figure? There's a persistent misunderstanding that this would be simply a linear thing: 1 defective device after 1000 000 hours would be the same as 1 defective device per 1000 hours in a population of 1000 devices. 1000 x 1000 = 1000 000, right? That's not how it works! It isn't linear. You can perfectly have errors after 1 million hours, and none after a thousand, even with a population of a million! MTTF calculations take all kinds of effects into account that may influence the product's reliability, and attaches a time for each of them. Statistical methods are then used to come to a prediction when the product will eventually fail. See also "bathtub curve".

(Forget the Wikipedia errorticle on MTBF. It's wrong.)

How does it lose its data? The gate charge will not leak away in the same sense current leaks in normal circuit through high resistances. It will do so the same way it's programmed and erased, through tunneling. The higher the temperature, the higher the energy of the charge carriers and the bigger the chance that they tunnel through the SiO$_2$ layer.

Federico's question if the 1 ppm refers to devices or cells is justified. The datasheet doesn't say, but I presume it's 1 defective data cell per million. Why? If it was devices you would get worse figures for devices with bigger Flash sizes, and they're the same for 1k as for 16k. Also, 100 years is extremely long. I would be surprised to see 999 999 devices out of 1 million still working.

images shamelessly stolen here

• Huh, and I thought quantum effects rely on magic. Who'd have thought statistics had anything to do with it!? – Olin Lathrop Jun 30 '11 at 10:18
• @Olin - Since my statistical classes, many moons ago, I see statistics as some kind of evil magic. Could that be the magic you mean? – stevenvh Jun 30 '11 at 10:49

This type of memory stores data as small charges on insulated FET gates. This essentially holds the FET gate at either a high or low voltage. Another way of looking at the same thing is that the 1 or 0 is stored as a voltage on a capacitor connected to a FET gate.

The charge storage isn't permanent. Eventually enough charge will leak so that the original state of the bit can't be reliably determined anymore. Higher temperature makes it a little easier for the charge to leak, which is why the data retention spec is shorter at elevated temperature.

As for ppm, yes that's "parts per million". It's the same concept as percent, which is just another way of saying parts per hundred. 100ppm = .01% = .0001

In attiny (as well as many other uC) 'permanent' data is stored in flash memory - which is basically a special transistor which can 'trap' charge (like a capacitor). The trick is that there is no 'wire' connecting to this capacitor - so they only way to charge or discharge it - is via quantum tunneling. This means that it's discharges really really slow, and it's quite hard to charge/discharge it (each this charge/discharge damages the transistor, that's why it is limited to 10k erases).

Speed of this discharge is determined empirically, and you see it in datasheet.

But this is 'typical' value - you may get both much higher & lower data retention times - this might get a little random. There is no exact way to find out in advance when data should be gone. So that's why you see this approximation in datasheet + estimation how much devices will be worse than this estimate.

• @BarsMonster - Speed of discharge can't be determined purely empirically, since the device isn't in existance for 20 years yet. The empirical data is just the basis for a statistical method, which puts more weight in it. – stevenvh Jun 30 '11 at 8:40
• @stevenvh It's possible if you do so at elevated temperatures. Also, transistor threshold change is changed continuously, so you may not just wait until it will switch from 1 to 0, but rather monitor the process with some 0.01% precision. – BarsMonster Jun 30 '11 at 9:10
• @BarsMonster - it's just that you can't just do a linear extrapolation on this. That's a common misconception about MTTF: if it says 1 million hours a lot of people think that on a 1000 devices test there's 1 failure after 1000 hours, and that that would be where the million hours comes from. It's not that simple. – stevenvh Jun 30 '11 at 9:56
• @stevenvh I am not saying it's linear :-) – BarsMonster Jun 30 '11 at 10:20
• @stevenvh: I'm not familiar with MTTF. I'm familiar with MTBF, which from what I understand is essentially the inverse of the probability that a device operating for a certain length of time will experience a failure. So if a device operating for one hour has a one-in-a-million chance of failure, that's an MTBF of 1,000,000 hours. If every device will work for 1,000 hours precisely, then the MTBF for new devices would be infinite, but it would drop to nothing as the devices hit the 1,000-hour mark. From a quick glance, MTTF seems similar... – supercat Jul 1 '11 at 15:24