tags:

views:

162

answers:

7

I have an embedded app that needs to do a lot of writing to a flash disk (or other). We cannot use a hard disk due to the environment. This is an industrial system subject to vibration and explosive fuel vapour.

The trouble is, flash has a lifecycle of around 100000 write cycles. Ample for your digital camera. Wears out after a year in our scenario.

Any alternatives that people have found work for them?

I was thinking of using FRAM but it's been done before here and it's slow and small.

+1  A: 

Use SD cards that have a built-in wear leveling controller. That way the write cycles get distributed over all the flash blocks and you get a very long life out of your flash.

Nils Pipenbrinck
+4  A: 

As Nils says, commercial compact flash cards, and drive replacements (NAND) have wear levelling. If you are using cheap onboard (NOR) flash you might have to do this yourself.

The best way is some sort of ring buffer where you are only appending data and then overwriting a full drive. Remember flash can only erase a full block (page) but can then append individual bytes to existing data in that page.

Also can you buffer a page in RAM and then write once or do you have to have individual bytes committed at all times?

Most app sheets for embedded processors will have examples of this.

Martin Beckett
A: 

I have used a Compact Flash card in a embedded system with great success. It has a onboard controller that does all the thinking for you. Not all Compact Flash controllers are equal so get one that is a recent design and was intended to be used as a hard drive replacement as they have better wear levelling algorithms.

Gerhard
+3  A: 

You really need to provide much more information:

  • how much capacity do you need?
  • what costs are acceptable?
  • what physical form factor do you need?
  • what lifetime do you want?

If your storage needs aren't particularly huge and you can deal with the cost, There are battery-backed SRAM parts (up to at least 2 Megabytes per part) that are as fast as RAM (that's what they are) and have no limit on number of writes. But they cost a lot more than flash.

You could also get a drive with a SATA interface that's populated with DRAM.

Michael Burr
+2  A: 

This post referes to using embedded linux. Not sure if this is what you want.

I have a not to differnt system, but for medical use. We use a NOR flash for all parts that have low update frequency and NAND flash for the rest. I would recoment using UBI/UBIFS for the top layer om the MTD disk. UBI/UBIFS takes care of all the underlying problems for you. If you then design your system to have a lot larger physical flash than you need. Example: You need 100MB and then design your HW with 1GB flash. Then the data can be shuffeld around by UBI without any interaction from systems above.
UBIFS documentation
UBI documentation

eaanon01
+2  A: 

As Michael Burr pointed out, we need more info. (Please answer his questions.)

I have an additional question: What kind of interface is this? PATA? SATA? USB?

As others have pointed out, any decent Flash Drive will provide some kind of wear leveling. Look for this in the datasheet for the device. Many vendors will boast about their wear-leveling technique.

You mention 100000 cycles. This seems pretty low to me. Most "industrial grade" flash drives can do a lot more than that (millions). Make sure you aren't using a bargain-basement device. A good flash drive will usually include an equation or calculator tool you can use to figure out the expected lifespan of the device.

(I can say from personal experience that some brands of flash drives hold up a lot better than others, particularly the "industrial" ones. Our drives go through some pretty brutal usage scenarios.)

The other thing that can help a lot is capacity. The higher capacity of flash drive, the more room the wear-leveling algorithm has to work with, which means a longer lifespan.

The other thing you can look at doing is software techniques to minimize the wearing of the flash components. Do you have a pagefile/swapfile? Maybe you don't need it. If you are creating/deleting lots of temporary files, move this to a RAM disk. Remember, it is erasure/reprogramming cycles that usually wears out a flash cell, so reducing those operations will usually help.

msemack
A: 

I was thinking of using FRAM but it's been done before here and it's slow and small.

Compare with nvSRAM; that may provide the performance you need.

Clifford