EmbeddedRelated.com
Forums

CompactFlash for storage

Started by Spoon September 4, 2007
[ Message cross-posted to comp.arch.embedded and comp.arch.storage ]

Hello everyone,

I have an x86-based system running Linux, and I'm considering using a 
CompactFlash card for non-volatile storage, instead of a typical hard 
disk drive.

I was wondering if I could just use the same IDE driver I've been using 
for hard disk drives.

As far as I understand, if I use a CF-to-IDE adapter, and plug that 
adapter into the IDE connector, then there is no problem.

However the motherboard provides a "CF socket", so I was thought I might 
not need the CF-to-IDE adapter. If I stick a CF card in the CF socket, 
will the regular IDE driver work, or do I need one of the MTD drivers?

Note: the datasheet states "CompactFlash Socket on IDE 0 
(Primary/Master)" which seems to indicate the CF socket is just an 
embedded CF-to-IDE adapter, and everything should work, right?

Another question: I've been using so-called DOMs (Disk On Module) which 
often include some form of wear-leveling to even the wear of different 
memory cells. Do typical CF cards include this feature?

How much electronics (other than plain storage) is there in a CF card?

Are features such as DMA support implemented in the card or are they 
supported at a different level? (In the IDE controller? Elsewhere?)

Regards.
Un bel giorno Spoon digit�:

> I was wondering if I could just use the same IDE driver I've been using > for hard disk drives.
Yes, but you will need to take some additional steps in order to reduce the disk writes to the minimum necessary (disabling the swapfile, using ramdisks whenever possible, etc). You should find plenty of documentation on this topic, for example you can see how the DSL guys are doing it: http://damnsmalllinux.org/ Windows XP embedded has also a particular disk filter driver that keeps in RAM all of the changes made to the filesystem, unless you want to commit them explicitly (look for EWF and FBWF). Maybe there is something similar also for Linux. -- emboliaschizoide.splinder.com
On Sep 4, 5:51 am, Spoon <root@localhost> wrote:

> However the motherboard provides a "CF socket",
Without exception that I have seen, on-board CF sockets on x86 systems are already wired in True-IDE mode.
> embedded CF-to-IDE adapter, and everything should work, right?
The "adapter" is a single strapped pin that puts the device in True- IDE mode. Otherwise it's just a connector.
> Another question: I've been using so-called DOMs (Disk On Module) which > often include some form of wear-leveling to even the wear of different
All CF cards include wear leveling. However the strategies you use when running off flash are very different from what you'd use running off rotating magnetic media. Run some quick back-of-an-envelope calculations and you'll see that even a seemingly-infrequent regular write operation can VERY quickly eat the erase lifetime of typical NAND flash chips. Also: There are bonus gotchas when using CF media. * Writes are slower than reads, and much more power-hungry. * It used to be true - and I believe from recent experiment is still true - that a power failure during write operations can leave the card unusable. Not merely corrupt filesystem, but actually a useless card. * In True-IDE mode, you cannot hot-swap cards. * {etc...}
> How much electronics (other than plain storage) is there in a CF card?
A typical CF card is more or less three chips: voltage regulator, NAND flash [might be more than one physical chip], and microcontroller. The performance of the CF card is heavily dependent on the capabilities of the micro. Some companies even used to advertise "USES FAST H8 MICROCONTROLLER!".
> supported at a different level? (In the IDE controller? Elsewhere?)
There is no "IDE controller" per se in a CF card, there's only the micro.
In article <46DD2AA2.4040205@localhost>, Spoon  <root@localhost> wrote:
> >Another question: I've been using so-called DOMs (Disk On Module) which >often include some form of wear-leveling to even the wear of different >memory cells. Do typical CF cards include this feature?
Typical IDE DOMs and CF cards are the exact same item in a slightly different shape, particularly if you go with the so-called "industrial" ones from the same manufacturer. But one gotcha with motherboard CF sockets (this is what I warned about before) is that some board makers, for reasons that are unclear to me, do not actually run the signal lines needed for DMA to the CF socket, so, on the same board, a DOM with the exact same flash, microcontroller, and firmware _may_ be faster: you should test for yourself. -- Thor Lancelot Simon tls@rek.tjls.com "The inconsistency is startling, though admittedly, if consistency is to be abandoned or transcended, there is no problem." - Noam Chomsky