Compact Flash Card Pinout

Shown looking into card

Function       Function
Mem I/O True IDE
Mode 4
  Pin   Mem I/O True IDE
Mode 4
GND --- 1 26 --> !CD1
D03 <-> 2 27 <-> D11
D04 <-> 3 28 <-> D12
D05 <-> 4 29 <-> D13
D06 <-> 5 30 <-> D14
D07 <-> 6 31 <-> D15
!CE1 !CS0 --> 7 32 <-- !CE2 !CS1
A10 L --> 8 33 --> !VS1
!OE !ATA_SEL --> 9 34 <-- NU !IORD
A09 L --> 10 35 <-- NU !IOWR
A08 L --> 11 36 <-- !WE
A07 L --> 12 37 --> RDY/BSY IREQ INTRQ
VCC --- 13 38 --- VCC
A06 L --> 14 39 <-- !CSEL
A05 L --> 15 40 --> !VS2
A04 L --> 16 41 <-- RESET !RESET
A03 L --> 17 42 --> !WAIT IORDY
A02 --> 18 43 --> NU !INPACK NC
A01 --> 19 44 <-- !REG H
A00 --> 20 45 <-> BVD2(H) !SPKR !DASP
D00 <-> 21 46 <-> BVD1(H) !STSCHG !PDIAG
D01 <-> 22 47 <-> D08
D02 <-> 23 48 <-> D09
WP !IOIS16 !IOCS16 --> 24 49 <-> D10
!CD2 <-- 25 50 --- GND
Essential for
minimal
8-bit interface.
Essential for
16-bit interface.

Connector

Pin pitch is 0.05". So it is best suited to surface mount. It is more convenient to lay out PCB tracks so that they approach from both edges instead of interleaving them as is usually done for ATA/IDE connectors.

In the UK, CPC sell CF headers, part ref CN5037.

See http://www.compactflash.org/ for the definitive specification.


Notes

CF combines features from ISA bus, 16-bit PCMCIA, and ATA/IDE buses. It can appear as I/O mapped, memory mapped, or as an IDE device. The IDE mode is always 16-bit, but I/O and memory modes can present data as 8 or 16-bits. These features make it the most flexible choice, allowing it to be used by devices other than the PC - such as 8-bit processors in consumer electronics.

The memory-mapped mode occupies 1K of address space, the top half containing the selected page of data.

1. Devices should allow for 3-state signals not to consume current.
2. Should be grounded by the host.
3. Should be tied to VCC by the host.
4. Optional for CF+ Cards, required for CompactFlash Storage Cards.

* indicates active low signal

   
GND Ground reference voltage.
VCC Power rail, usually 3V3, but can be 5V. The Compact Flash FAQ says:

"CompactFlash cards support both 3.3V and 5V operation and can be interchanged between 3.3V and 5V systems. This means that any CF card can operate at either voltage. Other small form factor flash cards may be available to operate at 3.3V or 5V, but any single card can operate at only one of the voltages"

This seems to give permission to wire CF cards into 5V systems. This would also be a wise design choice in the CF spec, because consumers avoid the hassle of making sure they have the "right voltage" card.

D0...15 Data bus.
A0...10 Address bus.
RESET System Reset.

Source Code

It seems low-level control commands are relatively simple compared to the job of managing a File Allocation Table (FAT)

Sandisk have a circuit diagram for an IDE to CF adapter. This has no buffers, so it might be wise to avoid loading it with long drive cables.


Hot swapping

Some makers of IDE to CF adapters state that they do not support hot swapping. Further enquires find that this is true for most if not all adapters, because the card decides between Native or IDE modes at reset time, by looking at the !ATA_SEL line. BurchEd said:

Compact flash cards have two interface modes: "native mode" and ATA/IDE mode.
On power up, the CF card looks at the !ATA_SEL pin.  If it is low, then the card goes into IDE mode.

Hot swapping is done simply by making the power pins in the CF card sockets longer than the other pins, so that when the card is inserted, the power pins connect first, before any other signals.

As a result of this, when hot swapped, the card is powered up before the host board can pull down the !ATA_SEL pin.
Therefore, when hot swapping, the card can never be put into ATA/IDE mode.  When hot swapped, the card always goes into "native" mode.

So, to put a card into ATA/IDE mode, it must be inserted into the socket before the host board is powered up.
This means that no board, including the BurchED one, can hot swap, and use ATA/IDE mode.

Due to the fact that the pin functions are different in native and ATA modes, there may be a chance of some signal contention, and maybe damage, if hot swapping into a socket that is intended to be ATA mode only.