Re: compact flash

In article , Timothy Wen writes

Dear list, >I am trying to use a compact flash in true IDE mode in an embedded environment. >Has anyone done something similar before and is willing to share an >example code? >thanks.

I'm using it in memory mode, but while searching the web I found an audio player project which did use CF in IDE mode. If you google for "Compact Flash" IDE you should find it.

--
Tim Mitchell
Reply to
Tim Mitchell
Loading thread data ...

Hi,

here's what I wrote. It's been able to read a sector from the CF card.

Note it's :

1/ directly ported from a very useful SanDisk AN that can be downloaded here :

formatting link

2/ ugly code

romuald

void wait_ready(void) { while((cf[STATUS_REG] & 0xF0) != 0x50); }

void wait_drq(void) { while((cf[STATUS_REG] & 0xF8) != 0x58); }

void read_sect(const unsigned long num) { wait_ready(); cf[SEC_COUNT_REG] = 0x01; cf[LBA_LOW] = num; // No need for a cast... cf[LBA_MID] = (num >> 8) & 0x000000FF; cf[LBA_HI] = num >> 16; cf[DRV_HD_REG] = 0xE0; cf[COMMAND_REG] = 0x20; wait_drq(); get_data(); }

void get_data(void) { uint i; xdata char * data b;

b = IDE_BUF; for(i=0;i Dear list,

code?

Reply to
romu

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.