Im using a PIC to read a compact flash card (8bit mode), however, it doesnt seem to be able to read the number of sectors, the model number, etc consistently.
Does anyone have any experience with the IDE interface??
Here is what Im doing:
- Hard Reset
- Read Byte from Address 0x17 until Bit 7 goes low
- Write a 1 at Address 0x11
- Read Byte from Address 0x17 until Bit 7 goes low
- Write a 0xEF at Address 0x17
- Read Byte from Address 0x17 until Bit 7 goes low
- Write a 0xE0 at Address 0x16
- Read Byte from Address 0x17 until Bit 7 goes low
- Write a 1 at Address 0x12
- Read Byte from Address 0x17 until Bit 7 goes low
- Write a 0xEC at Address 0x12
- Read Byte from Address 0x17 until Bit 7 toggles
- Clock in 512 bytes on the data bus for model info, etc.
The strange part is that if I randomly reset the compact flash (touching pin 1 to ground) it works, but I cant seem to find why most of the time theres no data.
Ben