Re: compact flash

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Quoted text here. Click to load it

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

Re: compact flash
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 :

http://www.sandisk.com/tech/oem_design/cf/CF%20MemMode.ZIP

 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<512;i++) {
        *(b + i) = cf[DATA_REG];
    }
}


snipped-for-privacy@apl.washington.edu (Timothy Wen) wrote in message
Quoted text here. Click to load it
code?
Quoted text here. Click to load it

Site Timeline