FAT32 File System on an SD Card Examples of the FAT Table and Root Directory Read show more.

Опубликовано: 19 Май 2026
на канале: John B
2,691
64

Hi,
A look at the FAT32 file system and how it relates to data and files on an SD card.
A few errors on my part.

Jan 2026-
I have been doing a proper tonne of work on FAT32 and my 16 Gig SD card. Finished just days ago. Ask me anything. I was thinking of doing a new video with correct terminology for one thing.
First. If you have seen my FAT16 videos, you will see the boot sector, wrong name, is at sector zero.
If sector zero and the first 3 bytes are something like EB 3C 90, that tells us that sector is the original Bios Parameter Block, BPB. Period. EB is a jump instruction, 3C is how high, 90 is A nop, NO OPERATION.
Second point. If you insert an SD card and the MCU or PC sees the first three bytes are empty, it IS saying, human words, This sector does NOT contain the BPB, Bios Parameter Block, a name from the old days, my days lol. That nearly empty sector is now know as the MBR, Master Boot Record.
If it is a MBR, the program must then go to one of four, 16 byte arrays.
The first array of 16 bytes is at 446.
Little endian. 446 + 8 (they call it offset 8) the next four bytes give the program the correct address for the Volume Boot Record, VBR. In the VBR will be the much needed BPB, Bios Parameter Block.
A quick note, why the multiply by 512 and not multiply by 512?
In FAT16, the read-sector CMD17 reads an address in bytes. So on my old 2 gig, the root directory was at sector 472.
But, the address passed to CMD17 was not 472, it was 472 x 512 = 241,664. Or - 241,664 bytes from the start of the SD card. FAT16 = SD-SC, standard capacity but It still went up to 2 gigs.
Since FAT32 can count in 32 bit, but the top four bits are reserved, a standard one partition can have up to 268 million clusters. So multiplying a sector number by 512, the numbers get stupid.
So on FAT32, the CMD17 no longer uses byte addressing, it uses the modern term of sector addressing and the proper / correct term is Logical Block Addressing. LBA.
So on my 16 gig, my sector zero was a MBR, master boot record, the BPB Bios Parameter block is at the actual sector of 8192, and there we find the BPB.
From the BPB, we find bytes per sector, sectors per cluster, size of SD card ... and the all important Partition Start / LBA Start address. Jumping over the reserved etc.
From that BPB and computed numbers in the BPB, we can find the RESERVED, say 2664, FAT SIZE, say 15052. Now I just want my data start / root directory.
FAT SIZE 15052 x 2 = 30,104. Partition Start = 8192. Reserved = 2664. My Root Directory or data start sector = 30,104 + 8192 + 2664 = an actual LBA address of 40,960.
Yes, at sector 40960 is my root directory.
Root cluster is always 2, cluster 0 and 1 do not exist. That's why you might see code like something = cluster -2.