Battery backed RAM or CF for Data Persistence

Hi all:

I need some suggestions and pointers regarding a design issue I'm having. We are building an electronic bingo system (players use terminals, instead of physical bingo cards).

The core system is being developed around a PC104 linux-based system (debian). The system has a 128MB CF card on it that contains the OS which is mounted read-only upon boot.

My question is; I need to provide some level of data persistence in the event of a power failure. Something along the lines of storing the last ~100 or so 'plays', so that if the power would fail, the user could resume at their last state.

I've thought about using another CF card strictly for data storage, however this seems like overkill. Furthermore, I'm concerned about the 'failure rates' related to consecutive writes to CF media.

Typically, players will be making a mark on their bingo card every 10 -

15 seconds, so I need a medium that can:

(a) Deal with frequent updates; and (b) Be available upon boot up in the event of power failure

I've heard of using battery-backed RAM / CMOS RAM / in these situations... but I have no experience programming under these types of media.

Any help / pointers / discussion would be appreciated.

-Barry

Reply to
Barry S
Loading thread data ...

...

Programming is simple. But building the hardware is the tricky part. You have to make sure that the battery-backed RAM is isolated from the main system when power starts to go down.

EEPROM would be a better choice. They need special programming sequence to write to, unlikely to be corrupted by power failure.

If I were designing it, I would use a microcontroller with Flash & EEPROM and a serial port as a data server. It would cost $5 to $10 to build.

Reply to
Linnix

Add seperate partition on CF card, say 12MB.

12M/512 byte sector size = 24000 sectors. Writing a sector every 10 seconds sequentially wraps every 3 days or so (24 hour a day). It's really hard to find flashes nowadays with endurances as low as 10000 writes. So, 30000 days = around 80 years. If the machine is used 8h/day, then 240 years.
Reply to
Ian Stirling

Remember that CF cards can get internally corrupted and totally inaccessible when power goes down while writing to them. Moreover wear out effects (each sector can only be erased a certain number of times) can hit.

So IMHO this is not a good idea at all. A physically accessible flash chip with a flash file system ("FFS") is a better choice. Here only the sector just written to gets corrupted when power goes down, FFS cares for this, as it deals with wear-out effects by spreading data cyclically on the complete area. (BTW it can't help with flash cards as that said corruption is internally to them.)

Regarding wear out effects an even better choice might be a RAM with a shaddow-flash, that automatically takes the data on power down. I just head of a new generation of such devices. Same can be accessed with a ram file system.

-Michael

Reply to
Michael Schnell

Why not using a (some 1$) serial flash chip) I do not know about MTD drivers (to make FFS work) for those, but as they are very common in the embedded world, I guess such a thing should be available somewhere (Google found a discussion here:

formatting link
)

-Michael

Reply to
Michael Schnell

Michael Schnell schrieb:

even better:

formatting link

-Michael

Reply to
Michael Schnell

Never seen this.

Yes, and after only 240 years.

Reply to
Ian Stirling

But others have.

It has been discussed here many times (see the backlog). The FC producers don't give any information on this so there is so guarantee that it will not happen. You can't sell a device relying on that.

-Michael

Reply to
Michael Schnell

Serial flash would be my second choice. But serial flash is still flash, they are block accessable and subject to wear and tear. It would not be much better than puting data in the CF flash. EEPROM is byte accessable and should be 10x more write cycles than flash using the same fab technology. That's my understanding a few years ago, unless things have changed.

Reply to
Linnix

So you put a slightly larger capacitor on, and don't write if the power won't last at least 100ms.

Actually, if it's a PC-like system, there may be a few bytes of user- accessible "CMOS" memory.

Reply to
Ian Stirling

Whatever cap he put on will be drained by the main system. A large cap is for noise filtering, not for power fail protection.

He would need power fail detection (brown out detector) to notify the processor and isolate the CF power rail from the main system on power failure.

Anyway, he is using PC104. He needs more than a few bytes.

Reply to
Linnix

Potentially then, you'r talking of a 10000uf 6.3V capacitor, and a diode. Not exactly expensive. Alternatively, say the PC104 system draws 5W.

If using a switched mode power supply, probably the easiest way to do this is to upgrade the energy storage capacitor, to take the hold-up from some 6ms to 100ms, and a mains failure detector.

Reply to
Ian Stirling

....

Most PC104 boards have sockets for static ram or battery backed static ram. These can often be set up as solid state disks. Failing that, PC104 is expandable

formatting link
formatting link

Talk to your PC1004 supplier.

Reply to
Robert E A Harvey

failure.

But large, I have not seen any 10Kuf cap. I have seen 1Kuf the size of an AA battery. If you are using 10Kuf, rechargable battery might be smaller and cheaper. However, it would take the space (height) of at least two PC104 boards.

I have seen CF internal activities (from LED) for tens of seconds after the last write, while it is shuffing internal sector tables. 100ms is not enough for engineering safety. For mission critical design (gaming machine would qualify), I would put in at least 30 seconds after the main processor received power fail notification. With all these considerations, I still believe EEPROM to be cheaper and easier.

Reply to
Linnix

failure.

Actually not.

6800uf 6.3V, 23*16mm.

What LED?

I do note that (for example) sandisks industrial CF say that writes will complete in 20ms. "Unless reassignment occurs". Which isn't exactly helpfull.

Reply to
Ian Stirling

There are mainly two failure possibilities during a power down if a write is active:

  1. between CPU and CF
  2. in the CF

  1. This is depending on the file system. In the worst case you have a fat file system and re-write a file which needs new more sectors. In that case the hole fat table is corrupt and the disk no longer accessible. A way to minimize that is to not change the file size, in that case you just have a corrupted file. With an mirror file you can handle that. There are other file systems which protect you from that (ext3, etc.). That is a general problem, you will have it with hard disks as well. But hard disks are faster and it's less likely to hit a write procedure.

  2. Problem of the CF. They have an own processor inside which handle the sector utilisation ratio etc. . If this logic has an uncontrolled shutdown it can loos information's. There are no information's about what's inside... depending on the marked the price is more important than the security. Some CF brands have industrial versions which have this problem solved (more expensive, more secure)

I hope this helps a little bit in making your system more secure. Chris

Reply to
Chris

Can you supply a link ?

-Michael

Reply to
Michael Schnell

Hi Michael

There are some good links:

CompactFlash Association,

formatting link

Application Note: ?Optimisation of CF Host Operation', SanDisk (AppNoteCFHostv1.0.pdf, Document No. 80-36-00233),

formatting link

SanDisk Industrial Grade ATA ?CompactFlash, PC Card and FlashDrive- Manual, Document No. 80-36-00208,

formatting link

Man page for fs,

formatting link
(5)

File Systems (FAT, HTPFS, NTFS),

formatting link

Transaction-Save FAT File System,

formatting link

Reply to
Chris

Thanks, I'll take a look.

-Michael

Reply to
Michael Schnell

I don't find a spec about a max time for a write to be completed _when_reassignment_ occurs_.

Ian quoted in another post:

I do note that (for example) sandisks industrial CF say that writes will complete in 20ms. "Unless reassignment occurs". Which isn't exactly helpful.

-Michael

Reply to
Michael Schnell

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.