LBA mode switching on my compactflash

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

Translate This Thread From English to

Threaded View
Hi all,

I'm successfully using a CF on my design with CHS mode addressing for
weeks, but when i'm trying to access it in LBA mode (by setting the LBA
bit (6) in the HEAD register before sending 0x20 command), for
retrieving the boot sector (LBA=0) for example, i'm not getting the
boot sector while CHS addressing is ok.

Any help ?


Re: LBA mode switching on my compactflash

Quoted text here. Click to load it

Does the data returned from IDENTIFY_DEVICE specify that it supports LBA?

Also note that the reserved bits in that register are usually specified as
requiring a '1' written to them - though I'm not sure what happens if you
don't write '1's...

Regards,

--
|              Mark McDougall                | "Electrical Engineers do it
|  <http://members.iinet.net.au/~msmcdoug |   with less resistance!"

Re: LBA mode switching on my compactflash
Quoted text here. Click to load it

Isn't LBA part of the CompactFlash specification?

Anyway, here is a psuedo code snippit to read 512 bytes:

wait for CF_status = 0b0101XXXX
CF_cdh = 0xE0;
CF_sector_number = (u8) address;
CF_cylinder_low = (u8) (address >> 8);
CF_cylinder_high = (u8) (address >> 16);
CF_sector_count = 1;
CF_command = 0x20;
wait for CF_status = 0b01011XXX
for(i = 0; i < 512; i++) *buffer++ = CF_data;
check CF_error

Ross




Re: LBA mode switching on my compactflash
Thank you for your help,

I've identified my problem : LBA is working ! Reading LBA=0x00000
return the MBR and not the partition boot record (0/1/1).
I've confused MBR and boot record.
So reading CHS 0/1/1 (1st partition boot record) is not the same as
reading LBA 0x000000.
Sorry ;)

PS: the CF spec says that ALL CF must implement LBA mode (confirmed by
reading the capabilities field from the 0xEC command).


Site Timeline