pic a compactflash card
I have built a Compact Flash Data acquisition system with ATMega128 and FAT16 support.
I can't give you any sources...sorry...
The problem is that you have to meet the timing of the CF Specification.
With my 16MHz system i had to do this by adding 2 wait states.
It will probably work on most cards without the wait states, but don't come complaining when it doesn't.
The Read/Write sector protocol is relatively simple.
Try to allways use the LBA mode, this is so much simpler and doesn't require Translation.
First set the LBA sector you want to access by writing the Cylinder High, Cylinder Low, Sector and Head Register. Write the number of Sectors you wish to read to the Sector Count register. Write the "Read Sector" or the "Write Sector" Command to the Command Register.
Then wait at least 400us and start checking the Status Register.
The CF Card will be busy for some time (Only test for the Busy bit!, the others are not valid if the busy bit is set!!!)
When the busy bit is 0, then check if there was an error.
If there was no error check if the Card is ready and there is a Data Request (RDY and DRQ bits in the Status register (Check for 0x58))
Then start reading the Data register.
In 8 bit mode, just keep reading from the data register for 512 times.
I think the MSB comes first and the LSB is second.
When you are done, you can start another transfer.
Be carefull with your print layout.
I had some trouble with some cards with my wire wrap board.
Fixed the problems by adding Capacitors over the databus and RD and WR on the CF Card side.
I can't give you any details on the FAT16 implementation because that is a kind of confidential ;-)
I'm a little dissappointed with the access times and the transferspeed of the Cards.
When i read a sector it takes up to 2ms to access a sector and then i have to read the buffer...
Does anyone have some experiance with the access timing of the CF Cards???
Greetz, Venz..