pepillo
Advanced Member level 4
Hi,
I am implementing a system to read files on a FAT16 formatted SD card through a PIC18. However I am stuck because I cannot find the Root Directory. I apply the formulae for calculating the start of the Root Directory, as follows:
Root directory first sector = 0x00 + Number of reserved sectors + (Number of FATs * sectors per FAT)
According to the information in the Boot Sector, I get the following values:
- Number of reserved sectors = 0x0008 = 8 <-- this is weird, usually it´s only 1 in FAT16
- Number of FATs = 0x02 = 2
- Sectors per FAT = 0x00EC = 236
So, if that´s correct, the Root directory should start at sector 480 (0x01E0), but when I read that block I get all zeroes so it looks like it must be somewhere else... Does anybody know what can be wrong in there?
I attach an screenshot of the Boot Sector contents.
If you could give me some advice that would be great... Thanks. Best regards,
P
P.S.: I formatted the card on WindowsXP under "FAT" format
I am implementing a system to read files on a FAT16 formatted SD card through a PIC18. However I am stuck because I cannot find the Root Directory. I apply the formulae for calculating the start of the Root Directory, as follows:
Root directory first sector = 0x00 + Number of reserved sectors + (Number of FATs * sectors per FAT)
According to the information in the Boot Sector, I get the following values:
- Number of reserved sectors = 0x0008 = 8 <-- this is weird, usually it´s only 1 in FAT16
- Number of FATs = 0x02 = 2
- Sectors per FAT = 0x00EC = 236
So, if that´s correct, the Root directory should start at sector 480 (0x01E0), but when I read that block I get all zeroes so it looks like it must be somewhere else... Does anybody know what can be wrong in there?
I attach an screenshot of the Boot Sector contents.
If you could give me some advice that would be great... Thanks. Best regards,
P
P.S.: I formatted the card on WindowsXP under "FAT" format