Formatting a CompactFlash card and using it.

Hi, I am trying to write a program in C language to format a Compact Flash card. I have the CompactFlash Association specification. I am unable to figure out how to read and write to the flash card and configure the various registers to support memory mode. If anybody could give me some tips or sources of information, it will be very helpful. With Regards, Anupama.

Reply to
Anupama
Loading thread data ...

Don't be misslead by the term "memory mapped mode". This does NOT mean that one or more sectors would be mapped into your host cpu's memory for random access. The mode is fairly similar to the normal interfacing in that you must read and write sectors into the RAM of the host cpu modify it there and write it back sector by sector.

I found the app notes from Sandisk quite helpfull along with the docs you aparently already have.

With regard to formatting - well, there you need to wirte the information to it acording to the filesystem that should reside there. If it's FAT then it's fairly easy, but it still requires that you make yourself comfortable with the FAT filesystem layout. There are several sources about this topic like i.e.

formatting link
or
formatting link

I'm sure there is a ton more information around.

Markus

Reply to
Markus Zingg

This is a bookmark I have which may be helpful :

Zel electronics on flash disks :

formatting link

Reply to
zalzon

You should use ATA mode. All Compact Flash storage cards implement ATA/IDE mode. Some IO cards (ex. ethernet cards) uses memory mode for buffered access.

The spec allows paged memory implementations; however, not too many devices are implemented this way.

Reply to
Linnix

Err - no, they don't. All they say is that in memory mapped mode, if A10 is high, the device will ignore all other address lines. This allows that the host CPU can use block move operations because the data register is located at address '0'. This IS an advantage over true IDE mode but its definately not compareable to what's otherwise usually understood with memory mapping in general. A CompactFlash card that IS a CompactFlash card MUST implement this behaviour or else it would not be a CompactFlash card.

Markus

Reply to
Markus Zingg

This can't be true in general. Some I/O cards (CF ethernet and/or wifi) use all 11 addresses (including A10). It might be a specific implementation.

Sound like you are descripting I/O mode, rather than memory mode.

Reply to
Linnix

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.