NVRAM - Page 1
Forum section: electronics / projects

author: pyromaniac4382
author_rank: Contributor
timestamp: March 18, 2015, 02:43:21 pm
content: I have been playing around with Z80 stuff for a little while now with just a ROM and some I/O stuff (UART LEDs etc.) I have gotten to the point now where RAM is somewhat necessary for interesting stuff like stack operation and what-have-you. I am just about to clutter up my breadboard with a parallel RAM chip when I thought to myself, I wish there was just a chip that could act like RAM and ROM at the same time. This question had me googling for a bit to where I came across the term 'NVRAM'.This sounds exactly like what I am looking for. (of course my eeprom programmer cannot program the things (g540 POS) )Anyway I guess my question is, are these the chips I am looking for, or are there other solutions out there? Will this solve my 'chicken vs the egg' ram/rom problem, or should I just suck it up and use two separate chips? I would guess that I could hack together a device to program these things with switches if my G540 can't get the job done, right?

author: Alex Eisenhut
author_rank: Super Contributor
timestamp: March 18, 2015, 03:28:40 pm
content: Totally obsolete. I'd just power up a standard x8 SRAM with a coin cell through a diode OR.SRAMs usually specify a minimum voltage where they hold the data but you can't access it. Then you power it up again and you can access it again.And this is even with decades-old SRAMs.

author: acbern
author_rank: Frequent Contributor
timestamp: March 18, 2015, 04:09:17 pm
content: a simple diode OR with a battery will not work. you need a power supervisory circuit that will disable write cycles while powering up/down. this is why people used these nvrams. they do it internally. for readbording, these are the simplest solution for your problem. also, there are programmers out there for <50 bucks on ebay that can programm them.

author: Howardlong
author_rank: Super Contributor
timestamp: March 18, 2015, 04:18:39 pm
content: The last time I did any Z80 stuff was over 20 years ago, but I did use some Simtek NVSRAM which has static RAM shadowed with flash, so when you power up the flash is written to SRAM.It was a neat solution as it reduced chip count, but you had to be sure your code didn't blow the stack or otherwise run away with itself!Simtek was taken over by Cypress. Chips were STK12C68. Back in those days they were still available in DIP. I programmed them in circuit by asserting BUSRQ to make the bus 3-state hi-z, clipping on an IC clip onto the NVSRAM connected to a homebrew programmer.You can still get them, and there are larger devices available eg STK15C88, and they are 5V so compatible with your Z80: not sure if they do 3.3V ones nowadays.Zilog's Z80 as I am sure you know pretty much owned the MPU market with MOS Technology's 6502 for many years around the late 70s through to the early 80s until the 8088 came out, and IBM PCs took over. For a chip to have such longevity in that space is unheard of these days!

author: Dr. Frank
author_rank: Super Contributor
timestamp: March 18, 2015, 04:22:07 pm
content: NVRAMs are a bit outdated, but not obsolete, yet.They were still offered, for heavens sake, as HP3458A DMMs require them.It's MAXIM/DALLAS DS1220, 2kx8 and DS1230 32kx8. Price for common types maybe below 10$.There's also a 2nd source available, and types with replaceable 'snaphat' battery.The advantage - over a simple schottky diode / Lithium cell / SRAM solution is a certain data integrity protection circuit for brown out / blackout conditions.Some folks also want to replace these components by modern RAMTRON F-RAMsFrank

author: Alex Eisenhut
author_rank: Super Contributor
timestamp: March 18, 2015, 06:26:39 pm
content: Quote from: acbern on March 18, 2015, 04:09:17 pmBah, this isn't some space-certified system, I used to diode-OR SRAM all the time in my VIC-20, it's not a big deal. It worked very well.

author: FrankBuss
author_rank: Unknown
timestamp: March 18, 2015, 06:44:11 pm
content: You could try a FRAM, like the FM28V020. But would need some voltage level translators, too for your 5V Z80 system (74LVC8T245 or similar).

author: Kjelt
author_rank: Super Contributor
timestamp: March 18, 2015, 07:30:03 pm
content: I heard that fram has to rewrite the location after each read since it is a destructive read. What if power fails during a read?

author: Skimask
author_rank: Super Contributor
timestamp: March 18, 2015, 07:39:15 pm
content: Quote from: Kjelt on March 18, 2015, 07:30:03 pmNope, not true. Been using fram for awhile now. Non-vol just like eeprom, but read/writes fast like sram. But you pay $$$ for it.

author: pyromaniac4382
author_rank: Contributor
timestamp: March 18, 2015, 07:43:02 pm
content: A while back I was sampling some parts and just happen to add a M48Z35Y-70PC1 NVRAM into the mix from ST which I found lying around. Again this won't outright program on my crappy G540 programmer even though it is the same pin-out and voltage range as the CAT28C256, but I digress.SRAM (CY62256N I have a few of) with a diode-OR sounds like a plan, but again no rig to program other than a hand (switches) or microcontroller solution which tend to get messy, and require more work than I would like.What I was thinking I could swing is using my crappy G540 programmer to iteratively program my CAT28C256 ROM to the point where it will contain a solid serial interface monitor with the PC. (UART) I would then have to program up a way to copy this monitor code "up" to NV-RAM. Shut the power off and replace the ROM space with the NVRAM physically, and boot again to my serial interface. From there I could use my remaining memory space for another RAM, or what have you.

author: FrankBuss
author_rank: Unknown
timestamp: March 18, 2015, 07:51:49 pm
content: FRAM is not the same like the old core memory. Maybe internally it needs to rewrite after reading, but I would expect that it has sufficient internal capacitors etc. to hide it and make it safe to use, even when power fails after a read. But if you write or read the same memory address with 1 MHz all the time, the byte at this address lasts only 3 years with the Cypress part, and less for some other manufacturers. But should be no problem, even a stack for a Z80 would be possible for normal programs and would last many more years.Programming with switches sounds like a lot of work, I would use an Arduino or Raspberry Pi. Once I builta programmer for a flash EPROMwith a Raspberry Pi (that was before I saw Dave's review of the TL866CS programmer). Hardware and software was done in less than a day.

author: Howardlong
author_rank: Super Contributor
timestamp: March 19, 2015, 08:46:00 am
content: Depends which Cypress part, the FRAMs do have a (very large) limited number of cycles, whereas the NVSRAM flash shadowed SRAM has infinite write cycles to the SRAM. The flash is only written to on power down (if not inhibited), by pulling a pin low, or by a specific read sequence on the device.With the STK12C68, you can disable autostore back to flash on power down, which is probably what you'd want to do in your case. I don't know if this autostore inhibit can be achieved on the other NVSRAMs, although it looks like the STK14C88-5 can. You can do a software controlled autostore, possibly allowing for a bootloader, if you can figure out how to perform the correct read sequence, although if you're running your code from the device that would be no mean feat!You could also inplement a hardware autostore, allowing for a bootloader, by using the HSB pin on the NVSRAM, and putting the Z80 in a wait state until the autostore has finished.Many of these STK devices are 5V, so a perfect match for you Z80. Seems to fit your requirements perfectly from what I can see.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: March 19, 2015, 09:14:11 am
content: FRAM as in Flash-backed RAM, or FeRAM? I wasn't aware that FeRAM (ferroelectric -- DRAM with hard-ish dielectrics -- exactly analogous to core with hard-ish ferromagnetic cores, but miniaturizable to die scale) had write limits. Though I haven't looked at many datasheets.Backed SRAM, you'll want write protection -- some logic to restrict /WE from going active during power-down (when all the bus signals go low, including /WE -- duh, don't want random writes to random addresses!) and from address ranges (to enforce the program read-only area -- since, when your program inevitably gets away from you, you don't want it going nuts and writing over itself!).The address restriction would still be a good idea for F/FeRAM parts, too.Tim

author: Howardlong
author_rank: Super Contributor
timestamp: March 19, 2015, 09:24:49 am
content: Tim,The NVSRAM flash shadowed SRAM parts I cited have all the power up and power down goodness taken care of for you. If you do want to store during a power down, you do need to bolt on a suitable capacitor onto one of the pins to take care of that, but I would imagine the use case here doesn't need or want it, so it can be easily inhibited by tying one of the pins to ground. (Is it just me being old, or does the ubiquitous term "use case" sound awkward? It seems to have somehow crept into common corporate techno parlance over the past five or six years.)The benefit of the NVSRAM is that you don't need both ROM and RAM chips, it's all in one device, and you can arbitrarily choose where ROM and RAM are. The downside is that if your stack (or other operation) goes AWOL, you overwrite your code, which is a perfect reason to inhibit the autostore on power down.Edit: On power up, the flash is automatically copied into SRAM for you. It takes 550us, so a suitable RC on the Z80's RESET pin should take care of that, in fact in most cases it's probably taken care of already.Howard

author: Kjelt
author_rank: Super Contributor
timestamp: March 19, 2015, 09:39:51 am
content: Quote from: T3sl4co1l on March 19, 2015, 09:14:11 amFRAM = FeRAM !QuoteEverything has an end of life parameter. With FRAM this is huge the datasheets I read state between 1010and 1014endurance cycles so that is pretty large number if you compare it to eeprom (4000000 cycles) or even normal flash (100000 cycles).What I read on the net is that they are finding ways for FRAM to have non destructive reads which would be great since this is the only bad thing about this technology, because face it, every read is as destructive as a read.

author: Kjelt
author_rank: Super Contributor
timestamp: March 19, 2015, 10:04:53 am
content: Quote from: FrankBuss on March 18, 2015, 07:51:49 pmDon't think so.The Cypress part has 1014cycles per byte, it has a max. busspeed of 1MHz, to continuously read the same address byte you have to re-addres it each time or you would read consecutive addresses.So this would take according to the datasheet selective random read table, at least 9 bits for the slave address, 18 bits for the MSB/LSB addressing again 9 bits for the slave address and then 9 bits for the databyte to read, totalling 45 bits on the 1MHz bus for 1 byte.So max. speed will be 22222 same bytes per second, resulting in 142,7 years.Even if you could read the same address consecutively so without addressing you still need 9 bits to read per readcycle so that leaves 111111 bytes/second so it will take 28,5 years reading the same address before it passes the manufacturers life.

author: 22swg
author_rank: Frequent Contributor
timestamp: March 19, 2015, 10:10:34 am
content: The NVRAM I worked with in the 80's had weird voltages , was slow only 4k, and needed to know 5 msec before the power failed.. also hated static... suggest SRAM and a coin cell backup battery.. If you want to be 'over the top' , then detect power loss via an interrupt and inhibit ram access.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: March 19, 2015, 10:35:33 am
content: Quote from: 22swg on March 19, 2015, 10:10:34 amHmm, trigger an NMI or reset on brown-out? Actually, a good idea just in general!You know that feeling you get, when you're really really tired, and haven't slept? Or you wake up in the middle of the night, or you're sick? Processors at low voltages are kind of like that... they'll make goofy mistakes. Better to knock them out cold unless/until the voltages are correct.(Ed: alsohttp://xkcd.com/371/though this technically only applies to the more advanced processors with MMUs and such.)Tim

author: Howardlong
author_rank: Super Contributor
timestamp: March 19, 2015, 01:15:37 pm
content: The Cypess NVSRAM flash shadowed RAM should not be confused with their FRAM offerings. The Cypress NVSRAM resolves all of the drawbacks mentioned so far of the other technologies, including read or write endurance, access speed, battery backup, inadvertent writes during power up, power down or brown out, and it is a single 5V supply so directly works with the Z80. What's not to like?