Re: Pretec CF-cards and FAT!

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Other than the serial number and the number of large sectors these disks are formatted exactly the same.

The serial number being different is normal.

The large sectors being different is usually due to how the CIS for the card reports the geometry of the card.

In your case, the values are very close. The cards differ in size by only 128 sectors, or 64k bytes, nothing to get excited about.

Pretec: 0001e860
Sandisk: 0001e8e0


Nick.



Rautiainen wrote:
OK, I'll try.

Looks messy, but I hope you can figure it out.

Pretec:

00000000 EB3C 904D 5344 4F53 352E 3000 0202 0800 .<.MSDOS5.0.....
00000010 0200 0200 00F8 F400 3F00 FF00 2000 0000 ........?... ...
00000020 60E8 0100 0000 2981 6094 6A4E 4F20 4E41 `.....).`.jNO NA
00000030 4D45 2020 2020 4641 5431 3620 2020 33C9 ME    FAT16   3.
00000040 8ED1 BCF0 7B8E D9B8 0020 8EC0 FCBD 007C ....{.... .....|
00000050 384E 247D 248B C199 E83C 0172 1C83 EB3A 8N$}$....<.r...:
00000060 66A1 1C7C 2666 3B07 268A 57FC 7506 80CA f..|&f;.&.W.u...
00000070 0288 5602 80C3 1073 EB33 C98A 4610 98F7 ..V....s.3..F...
00000080 6616 0346 1C13 561E 0346 0E13 D18B 7611 f..F..V..F....v.
00000090 6089 46FC 8956 FEB8 2000 F7E6 8B5E 0B03 `.F..V.. ....^..
000000A0 C348 F7F3 0146 FC11 4EFE 61BF 0000 E8E6 .H...F..N.a.....
000000B0 0072 3926 382D 7417 60B1 0BBE A17D F3A6 .r9&8-t.`....}..
000000C0 6174 324E 7409 83C7 203B FB72 E6EB DCA0 at2Nt... ;.r....
000000D0 FB7D B47D 8BF0 AC98 4074 0C48 7413 B40E .}.}....@xxxxxxx
000000E0 BB07 00CD 10EB EFA0 FD7D EBE6 A0FC 7DEB .........}....}.
000000F0 E1CD 16CD 1926 8B55 1A52 B001 BB00 00E8 .....&.U.R......
00000100 3B00 72E8 5B8A 5624 BE0B 7C8B FCC7 46F0 ;.r.[.V$..|...F.
00000110 3D7D C746 F429 7D8C D989 4EF2 894E F6C6 =}.F.)}...N..N..
00000120 0696 7DCB EA03 0000 200F B6C8 668B 46F8 ..}..... ...f.F.
00000130 6603 461C 668B D066 C1EA 10EB 5E0F B6C8 f.F.f..f....^...
00000140 4A4A 8A46 0D32 E4F7 E203 46FC 1356 FEEB JJ.F.2....F..V..
00000150 4A52 5006 536A 016A 1091 8B46 1896 9233 JRP.Sj.j...F...3
00000160 D2F7 F691 F7F6 4287 CAF7 761A 8AF2 8AE8 ......B...v.....
00000170 C0CC 020A CCB8 0102 807E 020E 7504 B442 .........~..u..B
00000180 8BF4 8A56 24CD 1361 6172 0B40 7501 4203 ...V$..aar.@xxxx
00000190 5E0B 4975 06F8 C341 BB00 0060 666A 00EB ^.Iu...A...`fj..
000001A0 B04E 544C 4452 2020 2020 2020 0D0A 5265 .NTLDR      ..Re
000001B0 6D6F 7665 2064 6973 6B73 206F 7220 6F74 move disks or ot
000001C0 6865 7220 6D65 6469 612E FF0D 0A44 6973 her media....Dis
000001D0 6B20 6572 726F 72FF 0D0A 5072 6573 7320 k error...Press
000001E0 616E 7920 6B65 7920 746F 2072 6573 7461 any key to resta
000001F0 7274 0D0A 0000 0000 0000 00AC CBD8 55AA rt............U.


Sandisk:

00000000 EB3C 904D 5344 4F53 352E 3000 0202 0800 .<.MSDOS5.0.....
00000010 0200 0200 00F8 F400 3F00 FF00 2000 0000 ........?... ...
00000020 E0E8 0100 0000 294E 2839 BA4E 4F20 4E41 ......)N(9.NO NA
00000030 4D45 2020 2020 4641 5431 3620 2020 33C9 ME    FAT16   3.
00000040 8ED1 BCF0 7B8E D9B8 0020 8EC0 FCBD 007C ....{.... .....|
00000050 384E 247D 248B C199 E83C 0172 1C83 EB3A 8N$}$....<.r...:
00000060 66A1 1C7C 2666 3B07 268A 57FC 7506 80CA f..|&f;.&.W.u...
00000070 0288 5602 80C3 1073 EB33 C98A 4610 98F7 ..V....s.3..F...
00000080 6616 0346 1C13 561E 0346 0E13 D18B 7611 f..F..V..F....v.
00000090 6089 46FC 8956 FEB8 2000 F7E6 8B5E 0B03 `.F..V.. ....^..
000000A0 C348 F7F3 0146 FC11 4EFE 61BF 0000 E8E6 .H...F..N.a.....
000000B0 0072 3926 382D 7417 60B1 0BBE A17D F3A6 .r9&8-t.`....}..
000000C0 6174 324E 7409 83C7 203B FB72 E6EB DCA0 at2Nt... ;.r....
000000D0 FB7D B47D 8BF0 AC98 4074 0C48 7413 B40E .}.}....@xxxxxxx
000000E0 BB07 00CD 10EB EFA0 FD7D EBE6 A0FC 7DEB .........}....}.
000000F0 E1CD 16CD 1926 8B55 1A52 B001 BB00 00E8 .....&.U.R......
00000100 3B00 72E8 5B8A 5624 BE0B 7C8B FCC7 46F0 ;.r.[.V$..|...F.
00000110 3D7D C746 F429 7D8C D989 4EF2 894E F6C6 =}.F.)}...N..N..
00000120 0696 7DCB EA03 0000 200F B6C8 668B 46F8 ..}..... ...f.F.
00000130 6603 461C 668B D066 C1EA 10EB 5E0F B6C8 f.F.f..f....^...
00000140 4A4A 8A46 0D32 E4F7 E203 46FC 1356 FEEB JJ.F.2....F..V..
00000150 4A52 5006 536A 016A 1091 8B46 1896 9233 JRP.Sj.j...F...3
00000160 D2F7 F691 F7F6 4287 CAF7 761A 8AF2 8AE8 ......B...v.....
00000170 C0CC 020A CCB8 0102 807E 020E 7504 B442 .........~..u..B
00000180 8BF4 8A56 24CD 1361 6172 0B40 7501 4203 ...V$..aar.@xxxx
00000190 5E0B 4975 06F8 C341 BB00 0060 666A 00EB ^.Iu...A...`fj..
000001A0 B04E 544C 4452 2020 2020 2020 0D0A 5265 .NTLDR      ..Re
000001B0 6D6F 7665 2064 6973 6B73 206F 7220 6F74 move disks or ot
000001C0 6865 7220 6D65 6469 612E FF0D 0A44 6973 her media....Dis
000001D0 6B20 6572 726F 72FF 0D0A 5072 6573 7320 k error...Press
000001E0 616E 7920 6B65 7920 746F 2072 6573 7461 any key to resta
000001F0 7274 0D0A 0000 0000 0000 00AC CBD8 55AA rt............U.


"Ten" <nospam@xxxxxxxxxxxxxxxxxxx> wrote in message news:hADQe.48336$Hx4.38969@xxxxxxxxxxxxxxxxxxxxxxx


If you use Hex Workshop, you can export the sector as a text file and post it here.

Rautiainen wrote:

There are nothing but text at offset 0x1BE. Text range is about 0x1A1-0x1F3.

If I compare working card to not working card, there are differences only at offset 0x20 and offsets 0x27-0x2a.

At offset 0x0E can be found the sector number where is FAT-table (these cases sector number 8).

I took screen captures from sector 0 at both cards. But I don't know can I send binaries here. So they can be found few days from the address (PNG files, about 75kB each):

Pretec:
http://s49.yousendit.com/d.aspx?id=13YGBHW0BSU2G11MCOFUQ9WCRY

Sandisk:
http://s49.yousendit.com/d.aspx?id=22TYPZLKYZ15P0GZBDHKREMJED

If you can't get them, send to my email your valid email address and I will send them straight to you.

Thanks, Janne


"Ten" <nospam@xxxxxxxxxxxxxxxxxxx> wrote in message news:WiEPe.13746$PM3.1074@xxxxxxxxxxxxxxxxxxxxxxx



For the 0xEB case, the first entry in the partition table (offset 0x1BE) will point to the sector that contains the MBR. The MBR contains the BPB which defines where the FATs are located and other important file system parameters. For the 0xFA case the BPB starts at offset (in sector 0) 0x0B. From the look of your output, it appears the driver is expecting to find a BPB in sector 0 instead of following the partition chain.

I have a CF that has a similar sector 0 to yours. It has 0xFA in byte 0, no BPB, and a partition table at 0x1BE. So this is a hybrid confiruation.

Apparently CE 4.2 is OK with this. One way to fix the driver is to have it check for the existence of these tokens in what it thinks is the BPB:

At offset 0x15 the value should be 0xF8.
At offset 0x36 - 0x3D there should be a left justified string that conatins the type of file system. Usually this is FAT12, FAT16, or FAT32. This string should be padded with spaces on the right.


If these don't exist, jump to offset 0x1BE and read the first partition table entry. This will provide a sector offset to another sector. Jumpt to that sector and check for the MBR again.

Nick.


Ken Christensen wrote:


0xEB is a valid PBR entry for a non-bootable disk. 0xFA is the first byte of an MBR. Note that these are x86 instruction codes. The rest of the records define the disk geometry. Your driver may be looking for an MBR to use in identifying where the FAT is located and the configuration of the file system. If this is the case, you would need a flash disk with an MBR, or fix the CF driver to recognize the non-bootable, but properly formatted CF cards.


"Rautiainen" wrote:




Thank you for the answer guys.

I read the raw data from the card and the byte 0 in sector 0 is 0xEB. That's correct, am I right?

I've got two pretec cards so I don't think that the problem is corrupted card.

Could it be possible that 0xFA is some kind of error number?


"Ten" <nospam@xxxxxxxxxxxxxxxxxxx> wrote in message news:DLjPe.11982$PM3.1984@xxxxxxxxxxxxxxxxxxxxxxx




I'd use Hex Workshop because it has templates you can overlay on raw disk sector data to decode the information. This works nicely on MBR and PBRs (Master Boot Records and Partition Boot Records).

If you use hexworkshop you need these mods to see the boot record correctly.

In the file C:\Program Files\BreakPoint Software\Hex Workshop 4.0\Structures\standard-types.hsl, change #pragma maxarray(128) to #pragma maxarray(512).

In the file filesystem.hsl, change the MBR structure to look like this:
// MBR
struct MASTER_BOOT_RECORD
{
UBYTE BootCode[128] ;
UBYTE BootData[130] ;
UBYTE Junk[188] ;
PART_ENTRY partitions[4] ;
WORD EndOfSectorMarker ;
} ;


When you are in Hex Workshop, put the cursor at the beginning of the sector.

In the right pane, open a the filesystem library then add (the plus sign) the structure overlay that you want.

By the way 0xFA as the byte 0 in sector 0 is valid. CE 4.2 does not complain about this.




Ken Christensen wrote:



Hello,
I suggest gettting a raw card reader for your desktop something like Winhex. Take a look at the first sector and see if it has a valid MBR or PBR. WinCE and for that matter XP do not write an MBR onto CF. If yours is corrupt, then you will have to find a way of getting that section re-built. There were some freeware utilities on the net, google for them. Really though you should only need the BPB from the boot record to point to the partition table so you could just create one with winhex.



"Rautiainen" wrote:





Hello all,

I've having problems with Pretec's industrial grade CF-cards and CE 3.0. Processor is PPC823. Cards are found but and initialized but CE cannot understang the filesystem. CE always says asks to format the card. I click 'format', no error comes to screen. Explorer founds 'Storage Card', but it cannot be write. I've tried to format the cards with XP (FAT16, I even tried FAT32), it won't work either in CE.

Other question: Is there any other industrial grade flash card amnufacturers than Pretec? Sandisk doesn't make industrial grade cards anymore.

Thanks, Janne

Some debug information:

<...>

0x80f17cbc: PCMCIA:CallClientISR - returned from Client ISR
0x80f17cbc: PDCardReadAttrByte Address: 410200 Offset: 1 Data: 80
0x80f17cbc: PDCardWriteAttrByte Address: 410200 Offset: 1 Data: 80
0x80f17cbc: PCMCIA:IREQInt - Calling InterruptDone
0x80ea24dc: ATADISK:ATAWaitForDisk - ata_status = 0x58
0x80ea24dc: ATDISK:DoDiskIO done - status=0
0x80ea24dc: FATFS!MountDisk: BPB_HiddenSectors(-973207947) != 0
0x80ea24dc: FATFS!InitVolume: sector 0 byte 0 suspicious (0xfa)
0x80ea24dc: FATFS!InitVolume: invalid BPB, volume deemed invalid
0x80ea24dc: No cache has been setup !!!
0x80ea24dc: ATADISK:GetFolderName - RegQueryValueEx(Folder) returned 87
0x80ea24dc: FATFS!GetDeviceValue(DSK2:): DriverKey='Drivers\PCMCIA\ATADisk', ActiveKey='Drivers\Active\20'
0x80ea24dc: FATFS!GetDeviceValue(DSK2:): RegQueryValueEx(HKLM\Drivers\PCMCIA\ATADisk\Folder) failed (87)
0x80ea24dc: FATFS!RegisterVolume: successfully mounted volume 0x000c3848 as Storage Card
0x80ea24dc: FATFS!FATUIEvent(0x50134): Would you like the system to format the Storage Card folder so that the system can use it?
WARNING: If you select Yes, any files in the Storage Card folder will be erased!
0x80eb6e28: NOTIFICATION::XCeEventHasOccurred
0x80eb6e28: NOTIFICATION::HandleSystemEvent 7 /ADD DSK2:


<...>



.



Relevant Pages

  • Re: Pretec CF-cards and FAT!
    ... The MBR contains the BPB which defines where the FATs are located and other important file system parameters. ... For the 0xFA case the BPB starts at offset (in sector 0) 0x0B. ... I've got two pretec cards so I don't think that the problem is corrupted card. ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Memory Stick Life Span
    ... >> But unlike HDs memory sticks and CF do not need to be defraged. ... the card may become pretty fragmented. ... Each Sector header contains ... In addition the first sector header contains the length of the file as ...
    (rec.photo.digital)
  • Re: MMC Replay NTSC FAQ under construction
    ... when you format a 4GB SDHC card to fat 16: ... application compatibility problems, particularly with setup ... Proceed with Format using a 64K cluster?" ... sector index to 32 bits, which made the 8-bit signed sector sectors/ ...
    (comp.sys.cbm)
  • CompactFlash + microcontroller weirdness
    ... MB card from IOData and a 128 MB card from SanDisk, ... failing sector is filled with garbage which doesn't look random; ... as follows (1 cycle = 40 ns): ... the firmware will wait for BSY# assert and ...
    (comp.arch.embedded)
  • Re: Pretec CF-cards and FAT!
    ... If I compare working card to not working card, ... At offset 0x0E can be found the sector number where is FAT-table. ... The MBR contains the BPB which defines where the FATs are located and other important file system parameters. ...
    (microsoft.public.windowsce.platbuilder)