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 ?
LBA mode switching on my compactflash
Started by ●June 9, 2005
Reply by ●June 9, 20052005-06-09
nono240-no-spam@altern.org wrote:> 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.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!"
Reply by ●June 10, 20052005-06-10
"Mark McDougall" <msmcdoug@no.spam.iinet> wrote in message news:42a844c2$0$13551$5a62ac22@per-qv1-newsreader-01.iinet.net.au...> nono240-no-spam@altern.org wrote: > > > 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. > > Does the data returned from IDENTIFY_DEVICE specify that it supports LBA?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
Reply by ●June 10, 20052005-06-10
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).