CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

LBA begin value not right on fat 32 partition entry

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
xokolatecake



Joined: 09 Mar 2007
Posts: 14

View user's profile Send private message

LBA begin value not right on fat 32 partition entry
PostPosted: Sat Mar 15, 2008 7:45 am     Reply with quote

Hi!

I'm have some trouble working with fat32 on a SD card.
Using WinHex and looking at the boot sector (sector 0) of the card, i can't find a valid LBA BEGIN address on the partition entry. I know the boot code is 446 bytes and then the 16 byte partition entry starts, and that the LBA BEGIN sits at byte number 8, so its offset 454 from the start of the disk, but the number i find its over the card capacity!!

This is my boot sector, as winhex shows it:

EB 58 90 4D 53 44 4F 53 35 2E 30 00 02 08 24 00
02 00 00 00 00 F8 00 00 3F 00 FF 00 00 00 00 00
00 4C 0F 00 D2 03 00 00 00 00 00 00 02 00 00 00
01 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 29 EE 92 10 DC 4E 4F 20 4E 41 4D 45 20 20
20 20 46 41 54 33 32 20 20 20 33 C9 8E D1 BC F4
7B 8E C1 8E D9 BD 00 7C 88 4E 02 8A 56 40 B4 08
CD 13 73 05 B9 FF FF 8A F1 66 0F B6 C6 40 66 0F
B6 D1 80 E2 3F F7 E2 86 CD C0 ED 06 41 66 0F B7
C9 66 F7 E1 66 89 46 F8 83 7E 16 00 75 38 83 7E
2A 00 77 32 66 8B 46 1C 66 83 C0 0C BB 00 80 B9
01 00 E8 2B 00 E9 48 03 A0 FA 7D B4 7D 8B F0 AC
84 C0 74 17 3C FF 74 09 B4 0E BB 07 00 CD 10 EB
EE A0 FB 7D EB E5 A0 F9 7D EB E0 98 CD 16 CD 19
66 60 66 3B 46 F8 0F 82 4A 00 66 6A 00 66 50 06
53 66 68 10 00 01 00 80 7E 02 00 0F 85 20 00 B4
41 BB AA 55 8A 56 40 CD 13 0F 82 1C 00 81 FB 55
AA 0F 85 14 00 F6 C1 01 0F 84 0D 00 FE 46 02 B4
42 8A 56 40 8B F4 CD 13 B0 F9 66 58 66 58 66 58
66 58 EB 2A 66 33 D2 66 0F B7 4E 18 66 F7 F1 FE
C2 8A CA 66 8B D0 66 C1 EA 10 F7 76 1A 86 D6 8A
56 40 8A E8 C0 E4 06 0A CC B8 01 02 CD 13 66 61
0F 82 54 FF 81 C3 00 02 66 40 49 0F 85 71 FF C3
4E 54 4C 44 52 20 20 20 20 20 20 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 0D 0A 52 65
6D 20 64 69 73 63 20 2F 20 6F 75 74 72 6F 20 73
75 70 6F 72 74 65 FF 0D 0A 45 72 72 6F 20 64 69
73 63 6F FF 0D 0A 50 72 69 6D 61 20 74 65 63 6C
61 20 70 2F 20 72 65 69 6E 69 0D 0A 00 00 00 00
00 00 00 00 00 00 00 00 00 AC C7 D4 00 00 55 AA

In bold is the 32 byte LBA BEGIN starting at offset 454.

What am I doing wrong?! Can someone give me a hint!
Thanks=)


Last edited by xokolatecake on Sat Mar 15, 2008 11:13 am; edited 1 time in total
Ttelmah
Guest







PostPosted: Sat Mar 15, 2008 11:00 am     Reply with quote

Put the disk into a PC, and check the partition is visible.
There is a problem, in that the partition 'type' code, for a FAT32 partition, should be 0B, or 0C. This is the fifth byte after the start of the partition entry. Yours is not 'right'....
If this is the data from the MBR, this is not a standard FAT32 partition entry...

Best Wishes
xokolatecake



Joined: 09 Mar 2007
Posts: 14

View user's profile Send private message

PostPosted: Sat Mar 15, 2008 11:17 am     Reply with quote

thanks for your reply.

I can see the card and have access to it in windows.
This is taken from winhex just after formatting in command line with:
format G: /FS:FAT32 /A:512

I don't know where could the mistake be..i have just format it again and the result is the same...do you recomend anything else?
Ttelmah
Guest







PostPosted: Sat Mar 15, 2008 4:00 pm     Reply with quote

Format, doesn't write the MBR. What does disk manager show?. What happens if you delete the partition, and start again. The high number you have, in the 'type' field, suggests something like disk compression is enabled for the drive (can't remember what type code is used for this, but it is something in this area), which would (of course), make it unreadable, from things like W95. You need to be using Windows95 FAT32, rather than anything extended like this.

Best Wishes
xokolatecake



Joined: 09 Mar 2007
Posts: 14

View user's profile Send private message

PostPosted: Mon Mar 17, 2008 7:03 am     Reply with quote

Quote:
Format, doesn't write the MBR. What does disk manager show?.

Can you tell where to get this?

thanks for your help=)
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Mon Mar 17, 2008 12:55 pm     Reply with quote

The offset 454 you refer to in your boot sector does not contain partition data but texts like 'Rem disc / outro suporte' and 'Erro disc'. These are the Portugese versions of 'Invalid system disk' and 'Disk I/O error'.
This is because you are not looking at a Master Boot Record but at another type of Boot sector known as 'Volume Boot Record' (VBR) (sometimes called the Volume Boot Sector or Partition Boot Sector).

The purpose and layout of a VBR are similar to the MBR but they are just the second step in the boot process. The volume boot sector contains two items:
1. BIOS Parameter Block (BPB)
This information contains detailed information about the logical drive, such as its type, length, and name.
2. Volume Boot Code
This contains the boot program specific to the drive if active; otherwise it is ignored.

The layout of the BIOS Parameter Block varies with the Operating System used, it is not related to the File System (FAT12/16/32, etc) used. More info on layout of the BPB can be found at http://homepages.[spam].net/J.deBoynePollard/FGA/bios-parameter-block.html
xokolatecake



Joined: 09 Mar 2007
Posts: 14

View user's profile Send private message

PostPosted: Tue Mar 18, 2008 7:03 am     Reply with quote

thanks for the tip, i ended up reading again the document about fat from microsoft and everything is ok, i was just looking in the wrong offsets!

for reference: http://www.microsoft.com/whdc/system/platform/firmware/fatgen.mspx
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group