I am using NXP Micro for interfacing microSD card with FAT32 file system.

for implementation I am using drivers located at below link.


the original driver is not configured for HCS12X compiler. I have done those changes and I am able to read data from SD Card using SPI.

my issue is when I format the SD card using PC in FAT 32 mode I am unable to read THE BOOT RECORD from SD card.

I have successfully read MBR section of card, but after MBR check in SD card initialization- it checks THE BOOT RECORD and i am getting all zeros at that section.

thus the card init is failing as it is not receiving data from THE BOOT RECORD read..

  1. Do i need to follow some specific pattern while formatting card??
  2. Does all SD cards have THE BOOT RECORD section right next to MBR (as a 1st partition)

SD card is no more than a block device -- a collection of numerated sectors (blocks) from the sector numbered zero up to its capacity.

There are two types of SD cards -- simple SD and SDHC. They differ in the way the sectors are addressed. If you are able to read MBR, you're using the correct block driver for your card.

Everything else, including search for partitions and reading files within the partition, is purely a software task.

In your MCU, I can recommend using FatFS driver that is versatile in the meaning that it supports both MBRed cards and the ones without MBR, it supports several partitions at once and it auto-detects and supports any of FAT12, FAT16 or FAT32.

Regarding the way to format SDcard, I can recommend using gparted in linux to make MBR and create formatted partitions exactly with the cluster size you need. In linux, you can even easily create MBRless partition (whole device is a single partition).

  • \$\begingroup\$ Hello, I was able to use sd card and read and write files from card, \$\endgroup\$ – Mandar Sansare Jul 29 '19 at 14:45
  • \$\begingroup\$ Now i want to use SDHC cards in my project. is there any other method to use them. coz i am unable to read them using the same driver. can someone please guide what all are the differences are there between SD and SDHC \$\endgroup\$ – Mandar Sansare Jul 29 '19 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.