Atmel 8051: use program flash for data storage?

I've got a Atmel 8051 (T89C51RD2) with 64K flash. Can I use part of the program flash for data storage? From the datasheet it seems like I should be able to use the on-chip low-level routines to program up to 128 bytes with the PROGRAM DATA PAGE call and read bytes with the MOVC opcode.

I'm envisioning reading some data from flash into RAM, doing some processing and then writing it back to flash.

Are there fundamental problems with this approach? The datasheet is a bit vague but it doesn't mention any restrictions on a user application reprogramming the flash, other than the process being a bit slow and good for only about 100K times.

By the way, is the 100K per byte, per page or for the whole flash area?

Thanks, Andrew Queisser

Reply to
andrew queisser
Loading thread data ...

It's the "about" 100K that's the only real problem. Flash (and EEPROM) memories wear out, but it's difficult to predict when.

Per page, usually. You can only erase a page at a time.

But endurance is very dependent on other considerations, particulalry the frequency of writing. If you are re-writing the Flash several times a second, then don't expect to get more than 10K or so cycles from it.

Microchip provide documentation, and a free software tool, for estimating the endurance of their EEPROMs according to your design parameters. Do Atmel have anything similar?

--
  Max
Reply to
Max

The FLASH loaders are mainly for ISP/IAP, but you can use them for data storage,with these caveats

- During WRITE, normally the core idles (ie your app needs to tolerate disable of INTS, and pause for the PGM time. This is because a single FLASH plane cannot write and read at the same time.

- Some allow Partial page writes, some do not.

You should also look at the newer Atmel AT89C51ED2/RD2/ID2 devices.

-jg

Reply to
Jim Granville

Yes. My product does this with this exact part (T89C51RD2). An upcoming one does it with the AT89C51RD2.

Correct.

You'll find it'll take around 20-30ms for a write whether you're writing 1 byte or 128 bytes. Fortunately you don't need to erase any pages - you just write the data where you want it. Also, to help alleviate wear patterns, you can consider doing a compare before a write so you don't rewrite the same data and degrade the cell.

It's *PER CELL* (per bye that is) per my conversation with an Atmel engineer (not a rep).

-->Neil

Reply to
Neil Bradley

In article , Neil Bradley writes

It's 100K for each bit. i.e. you can change the state of a bit 100K times. Actually I have been told by an Atmel engineer that the Flash uses the same technology as the EEprom, so the number of rated cycles is actually 1 million, but they are not able to test it the same way because it's slow, so they are only claiming 100K.

If you aren't aware, the T89C51RD2 is being discontinued. If this is a product for manufacture you should switch to the AT89C51RD2 (no EEPROM) or AT89C51ED2 (with EEPROM). The on-chip bootloader arrangements are different in the AT.. chips from the T.. chip.

--
Tim Mitchell
Reply to
Tim Mitchell

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.