Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

SD card boot sector location

SD card boot sector location

2005-12-22 by theothervmax

Hi all,
I have an SD card formatted by means of a PC card reader. When I try to access the card via SPI, it seems that the boot sector's number is 249. All sectors below this location read as zeroes. The card's volume is 1 GB. The file system is FAT16.
The question is: why 249 ? It must be described somewhere, but I failed to find anything in "ProdManualSDCardv1.9" and some other documents.
Regards,
Max

RE: [lpc2000] SD card boot sector location

2005-12-22 by Mark Crow

My memory fails on the details but you need to research the various FAT16
'disk' formats.  You're probably reading a partition block which will have
to be parsed in order to locate the actual boot sector.  Sorry I can't take
the time to help more.  I had to deal with this once when reading SD cards
via USB.
Show quoted textHide quoted text
  -----Original Message-----
  From: lpc2000@yahoogroups.com [mailto:lpc2000@yahoogroups.com]On Behalf Of
theothervmax
  Sent: Thursday, December 22, 2005 7:36 AM
  To: lpc2000@yahoogroups.com
  Subject: [lpc2000] SD card boot sector location


  Hi all,
  I have an SD card formatted by means of a PC card reader. When I try to
access the card via SPI, it seems that the boot sector's number is 249. All
sectors below this location read as zeroes. The card's volume is 1 GB. The
file system is FAT16.
  The question is: why 249 ? It must be described somewhere, but I failed to
find anything in "ProdManualSDCardv1.9" and some other documents.
  Regards,
  Max





----------------------------------------------------------------------------
--
  YAHOO! GROUPS LINKS

    a..  Visit your group "lpc2000" on the web.

    b..  To unsubscribe from this group, send an email to:
     lpc2000-unsubscribe@yahoogroups.com

    c..  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.


----------------------------------------------------------------------------
--



[Non-text portions of this message have been removed]

Re: SD card boot sector location

2005-12-22 by derbaier

--- In lpc2000@yahoogroups.com, "theothervmax" <vmax@g...> wrote:
>
> Hi all,
> I have an SD card formatted by means of a PC card reader. When I try
to access the card via SPI, it seems that the boot sector's number is
249. All sectors below this location read as zeroes. The card's volume
is 1 GB. The file system is FAT16.
> The question is: why 249 ? It must be described somewhere, but I
failed to find anything in "ProdManualSDCardv1.9" and some other
documents.
> Regards,
> Max
>

You probably will not find any information on the subject of the FAT
Boot Sector location in MMC/SD card documentation. The FAT structures
are specific to the FAT file system and unrelated to the physical
device supporting the file system. There is a short and simple article
on using the FAT file system on MMC/SD cards at

 http://www.circuitcellar.com

The article title is "Portable FAT Library for MCU Applications" from
issue 176 in March 2005.


-- Dave

Re: [lpc2000] SD card boot sector location

2005-12-22 by Tom Walsh

theothervmax wrote:

>Hi all,
>I have an SD card formatted by means of a PC card reader. When I try to access the card via SPI, it seems that the boot sector's number is 249. All sectors below this location read as zeroes. The card's volume is 1 GB. The file system is FAT16.
>The question is: why 249 ? It must be described somewhere, but I failed to find anything in "ProdManualSDCardv1.9" and some other documents.
>  
>

You have to go out on the net and visit the many fine sites which have 
taken the time to fully explain the FAT filesystem.  This subject, is 
literally, older than the Internet..

Regards,

TomW


-- 
Tom Walsh - WN3L - Embedded Systems Consultant
http://openhardware.net, http://cyberiansoftware.com
"Windows? No thanks, I have work to do..."
----------------------------------------------------

Re: SD card boot sector location

2005-12-22 by theothervmax

First of all, thanks for everyone replied.

One article called "The master boot record (MBR) and what it does" states: 
"The master boot record is always located at cylinder 0, head 0, and sector 1, the first sector on the disk".
My current problem is that I can't see ANYTHING in the first sector on my disk (SD card), as well as in the following 248 sectors, nothing but all zeroes. Yes, I can see the volume boot sector (at rather a weird location 249), both file allocation tables, root directory and so on...
I tried both FAT16 and FAT32 on this card, and the result is just the same: boot sector number 249. 



--- In lpc2000@yahoogroups.com, Tom Walsh <tom@o...> wrote:
Show quoted textHide quoted text
>
> theothervmax wrote:
> 
> >Hi all,
> >I have an SD card formatted by means of a PC card reader. When I try to access the card via SPI, it seems that the boot sector's number is 249. All sectors below this location read as zeroes. The card's volume is 1 GB. The file system is FAT16.
> >The question is: why 249 ? It must be described somewhere, but I failed to find anything in "ProdManualSDCardv1.9" and some other documents.
> >  
> >
> 
> You have to go out on the net and visit the many fine sites which have 
> taken the time to fully explain the FAT filesystem.  This subject, is 
> literally, older than the Internet..
> 
> Regards,
> 
> TomW
> 
> 
> -- 
> Tom Walsh - WN3L - Embedded Systems Consultant
> http://openhardware.net, http://cyberiansoftware.com
> "Windows? No thanks, I have work to do..."
> ----------------------------------------------------
>

Re: SD card boot sector location

2005-12-22 by derbaier

--- In lpc2000@yahoogroups.com, "theothervmax" <vmax@g...> wrote:
>
> First of all, thanks for everyone replied.
> 
> One article called "The master boot record (MBR) and what it does"
states: 
> "The master boot record is always located at cylinder 0, head 0, and
sector 1, the first sector on the disk".
> My current problem is that I can't see ANYTHING in the first sector
on my disk (SD card), as well as in the following 248 sectors, nothing
but all zeroes. Yes, I can see the volume boot sector (at rather a
weird location 249), both file allocation tables, root directory and
so on...
> I tried both FAT16 and FAT32 on this card, and the result is just
the same: boot sector number 249. 
> 

As Tom said, FAT is pretty well explained in a lot of places on the
net. The article that I pointed to certainly explained your situation
quite well to my satisfaction when I first found it. 

It does seem strange that you can't see anything on the first physical
block of the card, since the pointer to the block containing the FAT
boot record is located near the end of the first physical block on the
card right around byte 454.

--Dave

RE: [lpc2000] Re: SD card boot sector location

2005-12-22 by Joel Winarske

> One article called "The master boot record (MBR) and what it does" states:
> "The master boot record is always located at cylinder 0, head 0, and
> sector 1, the first sector on the disk".
> My current problem is that I can't see ANYTHING in the first sector on my
> disk (SD card), as well as in the following 248 sectors, nothing but all
> zeroes. Yes, I can see the volume boot sector (at rather a weird location
> 249), both file allocation tables, root directory and so on...
> I tried both FAT16 and FAT32 on this card, and the result is just the
same:
> boot sector number 249.

And this SD card can be read and written via Windows?

Re: SD card boot sector location

2005-12-23 by theothervmax

Thank you Dave for your hint cause it helped me so much. When I tried to read the value at this address (454) directly in some different sectors, I found that my card content dumping mechanism doesn't display correctly one fourth of a sector (128 bytes), the last portion. When I got it working right, everything had become visible.
Regards,
   Max

--- In lpc2000@yahoogroups.com, "derbaier" <dershu@s...> wrote:
Show quoted textHide quoted text
>
> --- In lpc2000@yahoogroups.com, "theothervmax" <vmax@g...> wrote:
> >
> > First of all, thanks for everyone replied.
> > 
> > One article called "The master boot record (MBR) and what it does"
> states: 
> > "The master boot record is always located at cylinder 0, head 0, and
> sector 1, the first sector on the disk".
> > My current problem is that I can't see ANYTHING in the first sector
> on my disk (SD card), as well as in the following 248 sectors, nothing
> but all zeroes. Yes, I can see the volume boot sector (at rather a
> weird location 249), both file allocation tables, root directory and
> so on...
> > I tried both FAT16 and FAT32 on this card, and the result is just
> the same: boot sector number 249. 
> > 
> 
> As Tom said, FAT is pretty well explained in a lot of places on the
> net. The article that I pointed to certainly explained your situation
> quite well to my satisfaction when I first found it. 
> 
> It does seem strange that you can't see anything on the first physical
> block of the card, since the pointer to the block containing the FAT
> boot record is located near the end of the first physical block on the
> card right around byte 454.
> 
> --Dave
>

Re: SD card boot sector location

2005-12-23 by derbaier

--- In lpc2000@yahoogroups.com, "theothervmax" <vmax@g...> wrote:
>
> 
> Thank you Dave for your hint cause it helped me so much. When I
tried to read the value at this address (454) directly in some
different sectors, I found that my card content dumping mechanism
doesn't display correctly one fourth of a sector (128 bytes), the last
portion. When I got it working right, everything had become visible.
> Regards,
>    Max
> 

I'm glad I was able to help!  The article that I suggested mentioned
that you will always find an offset like you found with MMC/SD card
FAT file systems, but the offset would not exist in a disk FAT
filesystem. For the 32MB cards that I am using the offset is 0x20.

-- Dave

RE: [lpc2000] Re: SD card boot sector location

2006-02-21 by Bruce Paterson

> There is a short and simple article on using the FAT file 
> system on MMC/SD cards at
> 
>  http://www.circuitcellar.com
> 
> The article title is "Portable FAT Library for MCU 
> Applications" from issue 176 in March 2005.

I know this an old thread but I've just had need to look into SD cards. 
Anyway, above article I cannot find on the website. I suspect it's only
in the printed version :(

Cheers,
Bruce

Re: SD card boot sector location

2006-02-21 by donhamilton2002

--- In lpc2000@yahoogroups.com, "Bruce Paterson" <bruce.paterson@...>
wrote:
>
> 
> > There is a short and simple article on using the FAT file 
> > system on MMC/SD cards at
> > 
> >  http://www.circuitcellar.com
> > 
> > The article title is "Portable FAT Library for MCU 
> > Applications" from issue 176 in March 2005.
> 
> I know this an old thread but I've just had need to look into SD cards. 
> Anyway, above article I cannot find on the website. I suspect it's only
> in the printed version :(
> 

sheesh,

ftp://ftp.circuitcellar.com/pub/Circuit_Cellar/2005/176/Sham176.zip

RE: [lpc2000] Re: SD card boot sector location

2006-02-21 by Bruce Paterson

> --- In lpc2000@yahoogroups.com, "Bruce Paterson" <bruce.paterson@...>
> wrote:
> >
> > 
> > > There is a short and simple article on using the FAT file 
> system on 
> > > MMC/SD cards at
> > > 
> > >  http://www.circuitcellar.com
> > > 
> > > The article title is "Portable FAT Library for MCU Applications" 
> > > from issue 176 in March 2005.
> > 
> > I know this an old thread but I've just had need to look 
> into SD cards. 
> > Anyway, above article I cannot find on the website. I suspect it's 
> > only in the printed version :(
> > 
> 
> sheesh,
> 
> ftp://ftp.circuitcellar.com/pub/Circuit_Cellar/2005/176/Sham176.zip

Err Thanks, but I'd much rather lean towards Tom's code as it's already
newlib integrated and debugged. It was the article itself I wanted to
read as background. No matter.

Thanks Anyway,
Bruce

Re: SD card boot sector location

2006-02-21 by Jan Szymanski

--- In lpc2000@yahoogroups.com, "theothervmax" <vmax@...> wrote:
>
> Hi all,
> I have an SD card formatted by means of a PC card reader. When I 
try to access the card via SPI, it seems that the boot sector's 
number is 249. All sectors below this location read as zeroes. The 
card's volume is 1 GB. The file system is FAT16.
> The question is: why 249 ? It must be described somewhere, but I 
failed to find anything in "ProdManualSDCardv1.9" and some other 
documents.
> Regards,
> Max
>

Hi Max,

Check your software and hardware. 
Maybe what you really send via SPI is not what you want to send.
Are you getting a good responses to all the init commands?

try Winhex on PC
http://www.x-ways.net/winhex/ 

Jan

RE: [lpc2000] Re: SD card boot sector location

2006-02-21 by Joel Winarske

Hi Max,

> > I have an SD card formatted by means of a PC card reader. When I
> try to access the card via SPI, it seems that the boot sector's
> number is 249. All sectors below this location read as zeroes. The
> card's volume is 1 GB. The file system is FAT16.
> > The question is: why 249 ? It must be described somewhere, but I
> failed to find anything in "ProdManualSDCardv1.9" and some other
> documents.

Have you checked if you're packing your structures?

This is very important if you're porting from 8-bit code.


Joel

Re: SD card boot sector location

2006-02-21 by theothervmax

Hi guys,
there is something strange with this thread started by me several 
months ago. It's been active for a few days and then happy ended ;-)
Now I see that this thread appears again but not with the context of 
my (already solved) problem. Now it's just about an article 
published by Circuit Cellar and nothing more...
Thank you anyway.
Regards,
  Max



--- In lpc2000@yahoogroups.com, "Joel Winarske" <joelw@...> wrote:

> Hi Max,
> 
> > > I have an SD card formatted by means of a PC card reader. When 
I
> > try to access the card via SPI, it seems that the boot sector's
> > number is 249. All sectors below this location read as zeroes. 
The
> > card's volume is 1 GB. The file system is FAT16.
> > > The question is: why 249 ? It must be described somewhere, but 
I
Show quoted textHide quoted text
> > failed to find anything in "ProdManualSDCardv1.9" and some other
> > documents.
> 
> Have you checked if you're packing your structures?
> 
> This is very important if you're porting from 8-bit code.
> 
> 
> Joel
>

RE: [lpc2000] Re: SD card boot sector location

2006-02-21 by Joel Winarske

> Hi guys,
> there is something strange with this thread started by me several
> months ago. It's been active for a few days and then happy ended ;-)
> Now I see that this thread appears again but not with the context of
> my (already solved) problem. Now it's just about an article

No kidding from December...

Re: SD card boot sector location

2006-02-21 by derbaier

--- In lpc2000@yahoogroups.com, "Bruce Paterson" <bruce.paterson@...>
wrote:
>
> > --- In lpc2000@yahoogroups.com, "Bruce Paterson" <bruce.paterson@>
> > wrote:
> > >
> > > 
> > > > There is a short and simple article on using the FAT file 
> > system on 
> > > > MMC/SD cards at
> > > > 
> > > >  http://www.circuitcellar.com
> > > > 
> > > > The article title is "Portable FAT Library for MCU Applications" 
> > > > from issue 176 in March 2005.
> > > 
> > > I know this an old thread but I've just had need to look 
> > into SD cards. 
> > > Anyway, above article I cannot find on the website. I suspect it's 
> > > only in the printed version :(
> > > 
> > 
> > sheesh,
> > 
> > ftp://ftp.circuitcellar.com/pub/Circuit_Cellar/2005/176/Sham176.zip
> 
> Err Thanks, but I'd much rather lean towards Tom's code as it's already
> newlib integrated and debugged. It was the article itself I wanted to
> read as background. No matter.
> 
> Thanks Anyway,
> Bruce
>


Easy search!
http://www.circuitcellar.com/magazine/176toc.htm
********************************QUOTE*********************************
Portable FAT Library for MCU Applications
Ivan Sham, William Hue & Pete Rizun
The DOS FAT file system is the industry standard format for flash
memory cards. You can use a microcontroller to read and write files on
an SD/MMC flash memory card with the FAT system. Read on to learn how
to build a portable FAT library for MCU applications. p.18

Keywords: DOS FAT, SD/MMC, memory card, flash, file system, MSP430 
***************************END QUOTE**********************************
The article costs $1.50 to download, or you can read Tom's
documentation for free in his download package.

-- Dave

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.