We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I'm using a C167 chip, I need to save just a single variable to Flash. The value will be used as part of a configuration parameter. Is there a nice simple way of using Flash to save just a single variable? Thanks
The trouble with Flash for data storage is that you can't generally erase individual locations - you have to erase a whole sector. Also, flash tends to have only a relatively limited number of erase cycles. Therefore, you might want to consider alternatives; eg, EEPROM, FRAM,... For details of erasing & programming your particular flash chip, you will have to read the Data Sheet. You will probably find example code on the manufacturer's website.
Ciao, take a look at this appnote, maybe it helps Ciao Bruno http://www.keil.com/appnotes/docs/apnt_138.asp
The method for erasing and programming flash depends on the particular device. You really have to check the data sheet. Typically, you have to present a specific sequence of values on the address and data busses, followed by the address and value you want to write. For AMD-style parts, which is pretty much anyone but Intel, the sequence is usually something like: Addr Data ---- ----- AAAA 55 5555 AA SA A0 ; SA is any address in the sector addr data ; Addr is the actual address to program, ;data is the value you want Flash memory is usually divided into "sectors" of some number of words, with the size depending on the device. Flash sectors must be erased before writing. An entire sector must be erased as a unit. Erasure sets all bits in the sector to '1'. Programming (writing) flash can only set a 1 to a 0. You can program flash multiple times without erasing, and you can even program the same location multiple times if it happens that you never need to change a 0 to a 1. Many micros with built-in flash also have a built-in code library in their boot ROM with routines to do the programming that you can call. See your data sheet. While flash does have a limited number of write cycles, this number is generally pretty high if you're talking about configuration data. Typical lifetimes these days are 1,000,000 erase cycles for generic parts. Sometimes you see 100,000. Flash intended only for program updates -- usually built into a micro -- sometimes guarantee only 10,000 erase cycles. But even that is enough to reprogram the chip twice a day, every day, for ten years. You can't use flash for operating variables as though it were RAM, but for holding code or configuration parameters, and even for a lot of logging applications, the lifetime really isn't much of a concern in practice. Is everyone else eagerly awaiting MRAM?
Is everyone else eagerly awaiting MRAM? Awaiting? I am using it. Erik
Interesting. What's the application? And who's the vendor? How does the cost stack up against flash?
Interesting. What's the application? And who's the vendor? How does the cost stack up against flash? Frequently (every 20min updated data that must be kept during powerdown. Ramtron about flash *3 Erik
"RAMTRON" That's FRAM - not MRAM. Motorola is working on MRAM - I saw mention of samples due in "late 2003"...
sorry, FerroMagnetic there you go. Erik
"sorry, FerroMagnetic there you go." Well, there's yer problem, mate: it's Ferroelectric RAM, innit? http://www.ramtron.com/aboutfram/framfacts.htm