Formatting SD Card through Windows XP

Discussion in 'Windows 64 Bit' started by Parag, Mar 26, 2009.

  1. Parag

    Parag Guest

    Hi,

    I am in the process of writing FAT16 compliant file system. What my
    intention is formatting & loading files onto SDCard through windows then
    plugging same SDCard on some microcontroller and reading back files through
    my File System (off course in this case my file system code will be running
    from microcontroller).

    I am using 2GB SDCard(Sandisk) and basic formatting and writing data to the
    SDCard I am doing through windows(XP) only.

    I am facing following issues-
    1: Master Boot Record is missing and Partition Boot Record starts from zero
    sector.
    2: Data file should start at the first sector of data area but doesn't
    starts there. Let me explain this-

    I have read following values form Partiton Boot Record-
    Bytes_per_sector = 512
    Sectors_per_cluster = 64
    Reserved_sectors = 2
    Number_of_FAT_copies = 2
    Maximum_Root_DIR_entries = 512
    Sectors_per_FAT = 243

    With the above information we can say that-
    partition_start_sector = 0;
    fat1_start_sector = 2; //partition_start_sector + Reserved_sectors
    fat2_start_sector = 245; //fat1_start_sector + Sectors_per_FAT
    rdir_start_sector = 488; //fat2_start_sector + Sectors_per_FAT
    userdata_start_sec = 520; //rdir_start_sector + 32

    As user data starts at 520th sector thus first file's data should at this
    sector, but instead of this first file's data is starting from 525th sector.

    I have verified the contents till rdir_start_sector through hex editor and
    all the things (FAT1/FAT2, RDIR) are starting at correct offset only user
    data is starting after 5 sectors (i.e. 525) instead of the actual one (i.e.
    500).

    I am unable to figure out why this is starting after 5 sectors.

    Thanks
    Parag
     
    Parag, Mar 26, 2009
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.