Sign in

username:

password:



Not a member?

Search AT91SAM



Search tips

Subscribe to AT91SAM



Ads

Discussion Groups

Discussion Groups | AT91SAM ARM | SD/MMC card on an sam7-ex256

For users of the Atmel AT91SAM7 and AT91SAM9 ARM CPU chips. Atmel has taken a new direction by combining on chip flash and ram with the ARM CPU on a single die. This provides low cost devices for small systems using the ARM CPU. This group is to exchange information to help users get started and learn how to use the devices.

SD/MMC card on an sam7-ex256 - axl_dudu - Mar 2 19:59:06 2008

Hello,
does anyone has a working example for controlling the SD/MMC card on an
at91sam7 (preferably with the olimex's board sam7-ex256)? I have been
struggling to get working an example that someone gave me but it gets
stuck somewhere in the init part.

Thanks,
Tudor



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )


Re: SD/MMC card on an sam7-ex256 - Eric Haver - Mar 3 7:42:04 2008

Hi Tudor,

NutOS does this right out of the box.
Includes FTP.

I am now working to get it to format the card.

*E

On Sun, Mar 2, 2008 at 12:39 PM, axl_dudu wrote:

> Hello,
> does anyone has a working example for controlling the SD/MMC card on an
> at91sam7 (preferably with the olimex's board sam7-ex256)? I have been
> struggling to get working an example that someone gave me but it gets
> stuck somewhere in the init part.
>
> Thanks,
> Tudor
>
>
>



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

Re: SD/MMC card on an sam7-ex256 - axl_dudu - Mar 4 3:16:18 2008

Thanks Eric.
I haven't tried yet the NutOS. I have been using FreeRTOS and I'd
like to continue with it(at least for the moment). But I will
consider migrating to the NutOS, if it includes FTP.

Tudor

--- In A...@yahoogroups.com, "Eric Haver" wrote:
>
> Hi Tudor,
>
> NutOS does this right out of the box.
> Includes FTP.
>
> I am now working to get it to format the card.
>
> *E
>
> On Sun, Mar 2, 2008 at 12:39 PM, axl_dudu wrote:
>
> > Hello,
> > does anyone has a working example for controlling the SD/MMC card
on an
> > at91sam7 (preferably with the olimex's board sam7-ex256)? I have
been
> > struggling to get working an example that someone gave me but it
gets
> > stuck somewhere in the init part.
> >
> > Thanks,
> > Tudor
> >
> >
>



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

Re: Re: SD/MMC card on an sam7-ex256 - Bernd Walter - Mar 4 9:40:29 2008

On Tue, Mar 04, 2008 at 08:09:42AM -0000, axl_dudu wrote:
> Thanks Eric.
> I haven't tried yet the NutOS. I have been using FreeRTOS and I'd
> like to continue with it(at least for the moment). But I will
> consider migrating to the NutOS, if it includes FTP.

You might want to consider efsl.
http://www.efsl.be/
It has some limitations on FAT with long filenames though.
But maybe you are just searching for the block functions and not for
filesystem support.

> --- In A...@yahoogroups.com, "Eric Haver" wrote:
> >
> > Hi Tudor,
> >
> > NutOS does this right out of the box.
> > Includes FTP.
> >
> > I am now working to get it to format the card.
> >
> > *E
> >
> >
> >
> > On Sun, Mar 2, 2008 at 12:39 PM, axl_dudu wrote:
> >
> > > Hello,
> > > does anyone has a working example for controlling the SD/MMC card
> on an
> > > at91sam7 (preferably with the olimex's board sam7-ex256)? I have
> been
> > > struggling to get working an example that someone gave me but it
> gets
> > > stuck somewhere in the init part.
> > >
> > > Thanks,
> > > Tudor
> > >
> > >

--
B.Walter http://www.bwct.de http://www.fizon.de
b...@bwct.de i...@bwct.de s...@fizon.de



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

Re: SD/MMC card on an sam7-ex256 - axl_dudu - Mar 4 12:13:57 2008

Yes. It is what I was looking for. I got an example made for this
board but it doesn't work properly. I have a microSD with an adapter
for the SD slot. The problem, as far as I went until now, is that
even thought the interface can read from the card, it detects invalid
FAT during the startup sequence of the EFSL. The card is just fine, I
checked it on the pc. I even installed a program that reads the Disk
Parameter Block and everything seems ok.

The person that gave me the example said he tried it with a 512MB
SANDISK SD card. I am using a 1GB A-DATA microSD with the available
adapter. Could this be a problem?

Tudor
--- In A...@yahoogroups.com, Bernd Walter wrote:
>
> On Tue, Mar 04, 2008 at 08:09:42AM -0000, axl_dudu wrote:
> > Thanks Eric.
> > I haven't tried yet the NutOS. I have been using FreeRTOS and I'd
> > like to continue with it(at least for the moment). But I will
> > consider migrating to the NutOS, if it includes FTP.
>
> You might want to consider efsl.
> http://www.efsl.be/
> It has some limitations on FAT with long filenames though.
> But maybe you are just searching for the block functions and not for
> filesystem support.
>
> > --- In A...@yahoogroups.com, "Eric Haver" wrote:
> > >
> > > Hi Tudor,
> > >
> > > NutOS does this right out of the box.
> > > Includes FTP.
> > >
> > > I am now working to get it to format the card.
> > >
> > > *E
> > >
> > >
> > >
> > > On Sun, Mar 2, 2008 at 12:39 PM, axl_dudu wrote:
> > >
> > > > Hello,
> > > > does anyone has a working example for controlling the SD/MMC
card
> > on an
> > > > at91sam7 (preferably with the olimex's board sam7-ex256)? I
have
> > been
> > > > struggling to get working an example that someone gave me but
it
> > gets
> > > > stuck somewhere in the init part.
> > > >
> > > > Thanks,
> > > > Tudor
> > > >
> > > >
>
> --
> B.Walter http://www.bwct.de http://www.fizon.de
> bernd@... info@... support@...
>



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

RE: Re: SD/MMC card on an sam7-ex256 - microbit - Mar 4 13:20:37 2008

I'm not familiar with EFSL, but it sounds like it might be looking for the MBR (Master Boot
Record) in the wrong place.
There are primarily 2 ways of format & set up partition, it can't just look in sector (LBA) #0.
I would check the procedure and see if it supports :
1. FDISK method
2. Allows enough offset to go fetching the MBR in 2nd case.

Best Regards,
Kris

-----Original Message-----
From: A...@yahoogroups.com [mailto:A...@yahoogroups.com] On Behalf Of axl_dudu
Sent: Wednesday, 5 March 2008 4:11 AM
To: A...@yahoogroups.com
Subject: [AT91SAM] Re: SD/MMC card on an sam7-ex256

Yes. It is what I was looking for. I got an example made for this
board but it doesn't work properly. I have a microSD with an adapter
for the SD slot. The problem, as far as I went until now, is that
even thought the interface can read from the card, it detects invalid
FAT during the startup sequence of the EFSL. The card is just fine, I
checked it on the pc. I even installed a program that reads the Disk
Parameter Block and everything seems ok.

The person that gave me the example said he tried it with a 512MB
SANDISK SD card. I am using a 1GB A-DATA microSD with the available
adapter. Could this be a problem?

Tudor
--- In A...@yahoogroups.com, Bernd Walter wrote:
>
> On Tue, Mar 04, 2008 at 08:09:42AM -0000, axl_dudu wrote:
> > Thanks Eric.
> > I haven't tried yet the NutOS. I have been using FreeRTOS and I'd
> > like to continue with it(at least for the moment). But I will
> > consider migrating to the NutOS, if it includes FTP.
>
> You might want to consider efsl.
> http://www.efsl.be/
> It has some limitations on FAT with long filenames though.
> But maybe you are just searching for the block functions and not for
> filesystem support.
>
> > --- In A...@yahoogroups.com, "Eric Haver" wrote:
> > >
> > > Hi Tudor,
> > >
> > > NutOS does this right out of the box.
> > > Includes FTP.
> > >
> > > I am now working to get it to format the card.
> > >
> > > *E
> > >
> > >
> > >
> > > On Sun, Mar 2, 2008 at 12:39 PM, axl_dudu wrote:
> > >
> > > > Hello,
> > > > does anyone has a working example for controlling the SD/MMC
card
> > on an
> > > > at91sam7 (preferably with the olimex's board sam7-ex256)? I
have
> > been
> > > > struggling to get working an example that someone gave me but
it
> > gets
> > > > stuck somewhere in the init part.
> > > >
> > > > Thanks,
> > > > Tudor
> > > >
> > > >
>
> --
> B.Walter http://www.bwct.de http://www.fizon.de
> bernd@... info@... support@...
>



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

Re: SD/MMC card on an sam7-ex256 - axl_dudu - Mar 4 13:46:59 2008

Hello Eric!
How did you limit the speed? If you remember what changes you made to
do that, please post them (at least from what you remember).

Thanks,
Tudor

--- In A...@yahoogroups.com, "Eric Pasquier" wrote:
>
> Hi,
>
> I am using a 2GB card with SPI protocol.
> I remember that I had to limit transfert rate during initialisation
phase.
>
> I hope this help.
>
> Eric Pasquier
> ----- Original Message -----
> From: axl_dudu
> To: A...@yahoogroups.com
> Sent: Tuesday, March 04, 2008 6:10 PM
> Subject: [AT91SAM] Re: SD/MMC card on an sam7-ex256
> Yes. It is what I was looking for. I got an example made for this
> board but it doesn't work properly. I have a microSD with an
adapter
> for the SD slot. The problem, as far as I went until now, is that
> even thought the interface can read from the card, it detects
invalid
> FAT during the startup sequence of the EFSL. The card is just
fine, I
> checked it on the pc. I even installed a program that reads the
Disk
> Parameter Block and everything seems ok.
>
> The person that gave me the example said he tried it with a 512MB
> SANDISK SD card. I am using a 1GB A-DATA microSD with the
available
> adapter. Could this be a problem?
>
> Tudor
>
> --- In A...@yahoogroups.com, Bernd Walter wrote:
> >
> > On Tue, Mar 04, 2008 at 08:09:42AM -0000, axl_dudu wrote:
> > > Thanks Eric.
> > > I haven't tried yet the NutOS. I have been using FreeRTOS and
I'd
> > > like to continue with it(at least for the moment). But I will
> > > consider migrating to the NutOS, if it includes FTP.
> >
> > You might want to consider efsl.
> > http://www.efsl.be/
> > It has some limitations on FAT with long filenames though.
> > But maybe you are just searching for the block functions and
not for
> > filesystem support.
> >
> > > --- In A...@yahoogroups.com, "Eric Haver"
wrote:
> > > >
> > > > Hi Tudor,
> > > >
> > > > NutOS does this right out of the box.
> > > > Includes FTP.
> > > >
> > > > I am now working to get it to format the card.
> > > >
> > > > *E
> > > >
> > > >
> > > >
> > > > On Sun, Mar 2, 2008 at 12:39 PM, axl_dudu wrote:
> > > >
> > > > > Hello,
> > > > > does anyone has a working example for controlling the
SD/MMC
> card
> > > on an
> > > > > at91sam7 (preferably with the olimex's board sam7-ex256)?
I
> have
> > > been
> > > > > struggling to get working an example that someone gave me
but
> it
> > > gets
> > > > > stuck somewhere in the init part.
> > > > >
> > > > > Thanks,
> > > > > Tudor
> > > > >
> > > > >
> >
> > --
> > B.Walter http://www.bwct.de http://www.fizon.de
> > bernd@ info@ support@
>



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

RE: Re: SD/MMC card on an sam7-ex256 - microbit - Mar 4 16:16:23 2008

The first thing to do is to check if your low level disk interface is properly working.
Now, of course if you just simply write somewhere and read it back (as a test) it might still
'appear' to be OK, but actually be writing wrong (and read back wrong, so it looks OK).

Having a 'sanity check' PC formatted card is your ticket out....

It actually does sound like your low level isn't running right. I'll have to dig up what your card
could be reading at offset 510 & 511 (where the signature is). AFAIK it *should* read 0x55AA
there, SFD or FDISK.

The best probably is to first check if your low level reads card size properly.
You need to read the CSD (Card Specific Data). If your Card Size makes sense, then you're on your
way, else this is where you should concentrate first.

In answer to your earlier question, you should first do the SPI operations (like putting into bit
mode etc.) at low clock (I used SPI at 2 MHz first on SAM7 and that worked fine on many SD cards).
Once init properly then you can go to full speed (I switched to 24 MHz SPI).

Perhaps this might get you started.

It might help if you tell which :
- Card you're using
- What FAT you have on it, 16/32
(bear in mind that XP now can format as FAT32 from 64 MB onwards)
- SPI settings you use

Best Regards,
Kris

-----Original Message-----
From: A...@yahoogroups.com [mailto:A...@yahoogroups.com] On Behalf Of axl_dudu
Sent: Wednesday, 5 March 2008 5:39 AM
To: A...@yahoogroups.com
Subject: [AT91SAM] Re: SD/MMC card on an sam7-ex256

I've just checked to see if it reads the MBR and WHAT it reads from
there. First, the EFSL checks the Boot sector signature (that must be
0x55AA) but mine reads 0xABB0. Then it checks other stuff that I
haven't got the time to dig up.
I have checked the signature on the pc and it is just fine. So there
might be a problem when reading this address. Maybe it is a problem
with the device speed, as Eric suggested. If you have any other
suggestions, please post them.
Regards,
Tudor

--- In A...@yahoogroups.com, "microbit" wrote:
>
> I'm not familiar with EFSL, but it sounds like it might be looking
for the MBR (Master Boot
> Record) in the wrong place.
> There are primarily 2 ways of format & set up partition, it can't
just look in sector (LBA) #0.
> I would check the procedure and see if it supports :
> 1. FDISK method
> 2. Allows enough offset to go fetching the MBR in 2nd case.
>
> Best Regards,
> Kris
>
> -----Original Message-----
> From: A...@yahoogroups.com [mailto:A...@yahoogroups.com] On
Behalf Of axl_dudu
> Sent: Wednesday, 5 March 2008 4:11 AM
> To: A...@yahoogroups.com
> Subject: [AT91SAM] Re: SD/MMC card on an sam7-ex256
>
> Yes. It is what I was looking for. I got an example made for this
> board but it doesn't work properly. I have a microSD with an
adapter
> for the SD slot. The problem, as far as I went until now, is that
> even thought the interface can read from the card, it detects
invalid
> FAT during the startup sequence of the EFSL. The card is just fine,
I
> checked it on the pc. I even installed a program that reads the
Disk
> Parameter Block and everything seems ok.
>
> The person that gave me the example said he tried it with a 512MB
> SANDISK SD card. I am using a 1GB A-DATA microSD with the available
> adapter. Could this be a problem?
>
> Tudor
> --- In A...@yahoogroups.com, Bernd Walter wrote:
> >
> > On Tue, Mar 04, 2008 at 08:09:42AM -0000, axl_dudu wrote:
> > > Thanks Eric.
> > > I haven't tried yet the NutOS. I have been using FreeRTOS and
I'd
> > > like to continue with it(at least for the moment). But I will
> > > consider migrating to the NutOS, if it includes FTP.
> >
> > You might want to consider efsl.
> > http://www.efsl.be/
> > It has some limitations on FAT with long filenames though.
> > But maybe you are just searching for the block functions and not
for
> > filesystem support.
> >
> > > --- In A...@yahoogroups.com, "Eric Haver"
wrote:
> > > >
> > > > Hi Tudor,
> > > >
> > > > NutOS does this right out of the box.
> > > > Includes FTP.
> > > >
> > > > I am now working to get it to format the card.
> > > >
> > > > *E
> > > >
> > > >
> > > >
> > > > On Sun, Mar 2, 2008 at 12:39 PM, axl_dudu wrote:
> > > >
> > > > > Hello,
> > > > > does anyone has a working example for controlling the
SD/MMC
> card
> > > on an
> > > > > at91sam7 (preferably with the olimex's board sam7-ex256)? I
> have
> > > been
> > > > > struggling to get working an example that someone gave me
but
> it
> > > gets
> > > > > stuck somewhere in the init part.
> > > > >
> > > > > Thanks,
> > > > > Tudor
> > > > >
> > > > >
> >
> > --
> > B.Walter http://www.bwct.de
http://www.fizon.de
> > bernd@ info@ support@
> >
>
>



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

Re: Re: SD/MMC card on an sam7-ex256 - Eric Pasquier - Mar 4 19:29:55 2008

Hi,

I am using a 2GB card with SPI protocol.
I remember that I had to limit transfert rate during initialisation phase.

I hope this help.

Eric Pasquier
----- Original Message -----
From: axl_dudu
To: A...@yahoogroups.com
Sent: Tuesday, March 04, 2008 6:10 PM
Subject: [AT91SAM] Re: SD/MMC card on an sam7-ex256
Yes. It is what I was looking for. I got an example made for this
board but it doesn't work properly. I have a microSD with an adapter
for the SD slot. The problem, as far as I went until now, is that
even thought the interface can read from the card, it detects invalid
FAT during the startup sequence of the EFSL. The card is just fine, I
checked it on the pc. I even installed a program that reads the Disk
Parameter Block and everything seems ok.

The person that gave me the example said he tried it with a 512MB
SANDISK SD card. I am using a 1GB A-DATA microSD with the available
adapter. Could this be a problem?

Tudor

--- In A...@yahoogroups.com, Bernd Walter wrote:
>
> On Tue, Mar 04, 2008 at 08:09:42AM -0000, axl_dudu wrote:
> > Thanks Eric.
> > I haven't tried yet the NutOS. I have been using FreeRTOS and I'd
> > like to continue with it(at least for the moment). But I will
> > consider migrating to the NutOS, if it includes FTP.
>
> You might want to consider efsl.
> http://www.efsl.be/
> It has some limitations on FAT with long filenames though.
> But maybe you are just searching for the block functions and not for
> filesystem support.
>
> > --- In A...@yahoogroups.com, "Eric Haver" wrote:
> > >
> > > Hi Tudor,
> > >
> > > NutOS does this right out of the box.
> > > Includes FTP.
> > >
> > > I am now working to get it to format the card.
> > >
> > > *E
> > >
> > >
> > >
> > > On Sun, Mar 2, 2008 at 12:39 PM, axl_dudu wrote:
> > >
> > > > Hello,
> > > > does anyone has a working example for controlling the SD/MMC
card
> > on an
> > > > at91sam7 (preferably with the olimex's board sam7-ex256)? I
have
> > been
> > > > struggling to get working an example that someone gave me but
it
> > gets
> > > > stuck somewhere in the init part.
> > > >
> > > > Thanks,
> > > > Tudor
> > > >
> > > >
>
> --
> B.Walter http://www.bwct.de http://www.fizon.de
> bernd@... info@... support@...
>



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

RE: Re: SD/MMC card on an sam7-ex256 - microbit - Mar 5 6:59:43 2008

I was curious and ended up having a look at EFSL.
It seems to be in an 'in between' state 0.2.8 -> 0.3/4 , but overall I quite like it - the ioman
has some nice caching features. There's a few silly things too, but it seems that's WIP.

So, I got interested in fiddling and decided to set it up for my SAM7S256-EK which I added an
SD/MMC socket to quite some time ago.

To be able to work faster I've first set up a project under CrossWorks MSP430 with Simulator.
I simulate a 30 KB FAT12 drive there (which I first "force" format of course, as it's in simulated
RAM..)
This way I can familiarise myself way faster with the guts of it, as the code is little
documented.

I've written a formatting function so you can fmt from EFSL in FAT12/16/32, to be tested better.

I've actually had fun doing that, next I'll port my existing interface code from SAM7-EK that I
have under CrossWorks for ARM.

So, after I do this I can help you much better with EFSL if you want to.

Best Regards,
Kris

-----Original Message-----
From: A...@yahoogroups.com [mailto:A...@yahoogroups.com] On Behalf Of axl_dudu
Sent: Wednesday, 5 March 2008 5:39 AM
To: A...@yahoogroups.com
Subject: [AT91SAM] Re: SD/MMC card on an sam7-ex256

I've just checked to see if it reads the MBR and WHAT it reads from
there. First, the EFSL checks the Boot sector signature (that must be
0x55AA) but mine reads 0xABB0. Then it checks other stuff that I
haven't got the time to dig up.
I have checked the signature on the pc and it is just fine. So there
might be a problem when reading this address. Maybe it is a problem
with the device speed, as Eric suggested. If you have any other
suggestions, please post them.
Regards,
Tudor



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

Re: SD/MMC card on an sam7-ex256 - axl_dudu - Mar 5 8:55:13 2008

The initial clock setting was for 48khz. I moved all SD card init
code from inside the task(I am using the FreeRTOS) in the init part
and I got it going(after a lot of playing with the clock speed - got
it at 8Mhz)! I will now have to see if I can read the file from a
task.
Still, I am very happy to see that is working. Thanks a lot for your
help! The only explanation that I have is that it is not working from
inside a task, even though it is obvious that the code I use was
adapted for FreeRTOS - it has some specific functions like
vPortEnterCritical() .
I will see what I can do to make it work and post what I will find in
case anyone encounters the same problems.

I am using a 1GB A-DATA microSD card with SD adapter, FAT32, 8bit
transfer, CPOL=0, ClockPhase=1, SCLK = 48Mhz/32*31 = 48kHz (initial
clock).

Once again thanks for pointing the directions where I had to look and
if you got any ideea why the file_fopen() function is not working
from inside a task, please let me know.

Tudor
--- In A...@yahoogroups.com, "microbit" wrote:
>
> The first thing to do is to check if your low level disk interface
is properly working.
> Now, of course if you just simply write somewhere and read it back
(as a test) it might still
> 'appear' to be OK, but actually be writing wrong (and read back
wrong, so it looks OK).
>
> Having a 'sanity check' PC formatted card is your ticket out....
>
> It actually does sound like your low level isn't running right.
I'll have to dig up what your card
> could be reading at offset 510 & 511 (where the signature is).
AFAIK it *should* read 0x55AA
> there, SFD or FDISK.
>
> The best probably is to first check if your low level reads card
size properly.
> You need to read the CSD (Card Specific Data). If your Card Size
makes sense, then you're on your
> way, else this is where you should concentrate first.
>
> In answer to your earlier question, you should first do the SPI
operations (like putting into bit
> mode etc.) at low clock (I used SPI at 2 MHz first on SAM7 and that
worked fine on many SD cards).
> Once init properly then you can go to full speed (I switched to 24
MHz SPI).
>
> Perhaps this might get you started.
>
> It might help if you tell which :
> - Card you're using
> - What FAT you have on it, 16/32
> (bear in mind that XP now can format as FAT32 from 64 MB onwards)
> - SPI settings you use
>
> Best Regards,
> Kris
>
> -----Original Message-----
> From: A...@yahoogroups.com [mailto:A...@yahoogroups.com] On
Behalf Of axl_dudu
> Sent: Wednesday, 5 March 2008 5:39 AM
> To: A...@yahoogroups.com
> Subject: [AT91SAM] Re: SD/MMC card on an sam7-ex256
>
> I've just checked to see if it reads the MBR and WHAT it reads from
> there. First, the EFSL checks the Boot sector signature (that must
be
> 0x55AA) but mine reads 0xABB0. Then it checks other stuff that I
> haven't got the time to dig up.
> I have checked the signature on the pc and it is just fine. So
there
> might be a problem when reading this address. Maybe it is a problem
> with the device speed, as Eric suggested. If you have any other
> suggestions, please post them.
> Regards,
> Tudor
>
> --- In A...@yahoogroups.com, "microbit" wrote:
> >
> > I'm not familiar with EFSL, but it sounds like it might be
looking
> for the MBR (Master Boot
> > Record) in the wrong place.
> > There are primarily 2 ways of format & set up partition, it can't
> just look in sector (LBA) #0.
> > I would check the procedure and see if it supports :
> > 1. FDISK method
> > 2. Allows enough offset to go fetching the MBR in 2nd case.
> >
> > Best Regards,
> > Kris
> >
> > -----Original Message-----
> > From: A...@yahoogroups.com [mailto:A...@yahoogroups.com] On
> Behalf Of axl_dudu
> > Sent: Wednesday, 5 March 2008 4:11 AM
> > To: A...@yahoogroups.com
> > Subject: [AT91SAM] Re: SD/MMC card on an sam7-ex256
> >
> > Yes. It is what I was looking for. I got an example made for this
> > board but it doesn't work properly. I have a microSD with an
> adapter
> > for the SD slot. The problem, as far as I went until now, is that
> > even thought the interface can read from the card, it detects
> invalid
> > FAT during the startup sequence of the EFSL. The card is just
fine,
> I
> > checked it on the pc. I even installed a program that reads the
> Disk
> > Parameter Block and everything seems ok.
> >
> > The person that gave me the example said he tried it with a 512MB
> > SANDISK SD card. I am using a 1GB A-DATA microSD with the
available
> > adapter. Could this be a problem?
> >
> > Tudor
> >
> >
> > --- In A...@yahoogroups.com, Bernd Walter wrote:
> > >
> > > On Tue, Mar 04, 2008 at 08:09:42AM -0000, axl_dudu wrote:
> > > > Thanks Eric.
> > > > I haven't tried yet the NutOS. I have been using FreeRTOS and
> I'd
> > > > like to continue with it(at least for the moment). But I will
> > > > consider migrating to the NutOS, if it includes FTP.
> > >
> > > You might want to consider efsl.
> > > http://www.efsl.be/
> > > It has some limitations on FAT with long filenames though.
> > > But maybe you are just searching for the block functions and
not
> for
> > > filesystem support.
> > >
> > > > --- In A...@yahoogroups.com, "Eric Haver"
> wrote:
> > > > >
> > > > > Hi Tudor,
> > > > >
> > > > > NutOS does this right out of the box.
> > > > > Includes FTP.
> > > > >
> > > > > I am now working to get it to format the card.
> > > > >
> > > > > *E
> > > > >
> > > > >
> > > > >
> > > > > On Sun, Mar 2, 2008 at 12:39 PM, axl_dudu wrote:
> > > > >
> > > > > > Hello,
> > > > > > does anyone has a working example for controlling the
> SD/MMC
> > card
> > > > on an
> > > > > > at91sam7 (preferably with the olimex's board sam7-ex256)?
I
> > have
> > > > been
> > > > > > struggling to get working an example that someone gave me
> but
> > it
> > > > gets
> > > > > > stuck somewhere in the init part.
> > > > > >
> > > > > > Thanks,
> > > > > > Tudor
> > > > > >
> > > > > >
> > >
> > > --
> > > B.Walter http://www.bwct.de
> http://www.fizon.de
> > > bernd@ info@ support@
> > >
> >
> >
> >
> >
> >
> >



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

Re: SD/MMC card on an sam7-ex256 - axl_dudu - Mar 5 12:16:41 2008

It would be great to see the format function you have made. If you
can, try the system together with FreeRTOS and tell me if it works
for you.

Tudor

--- In A...@yahoogroups.com, "microbit" wrote:
>
> I was curious and ended up having a look at EFSL.
> It seems to be in an 'in between' state 0.2.8 -> 0.3/4 , but
overall I quite like it - the ioman
> has some nice caching features. There's a few silly things too, but
it seems that's WIP.
>
> So, I got interested in fiddling and decided to set it up for my
SAM7S256-EK which I added an
> SD/MMC socket to quite some time ago.
>
> To be able to work faster I've first set up a project under
CrossWorks MSP430 with Simulator.
> I simulate a 30 KB FAT12 drive there (which I first "force" format
of course, as it's in simulated
> RAM..)
> This way I can familiarise myself way faster with the guts of it,
as the code is little
> documented.
>
> I've written a formatting function so you can fmt from EFSL in
FAT12/16/32, to be tested better.
>
> I've actually had fun doing that, next I'll port my existing
interface code from SAM7-EK that I
> have under CrossWorks for ARM.
>
> So, after I do this I can help you much better with EFSL if you
want to.
>
> Best Regards,
> Kris
>
> -----Original Message-----
> From: A...@yahoogroups.com [mailto:A...@yahoogroups.com] On
Behalf Of axl_dudu
> Sent: Wednesday, 5 March 2008 5:39 AM
> To: A...@yahoogroups.com
> Subject: [AT91SAM] Re: SD/MMC card on an sam7-ex256
>
> I've just checked to see if it reads the MBR and WHAT it reads from
> there. First, the EFSL checks the Boot sector signature (that must
be
> 0x55AA) but mine reads 0xABB0. Then it checks other stuff that I
> haven't got the time to dig up.
> I have checked the signature on the pc and it is just fine. So
there
> might be a problem when reading this address. Maybe it is a problem
> with the device speed, as Eric suggested. If you have any other
> suggestions, please post them.
> Regards,
> Tudor
>



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

Re: Re: SD/MMC card on an sam7-ex256 - Eric Pasquier - Mar 6 5:17:38 2008

Hi Tudor,

You limit the speed by setting your SPI clock to about 100KHz during init phase :

Command 0 : GO_IDLE_STATE
Command 1 : SEND_OP_COND

After receiving the last response, you can then change the SPI clock up to 25MHz max (check manufacturer specifications and CSD register).

I am sucessfully using an ScanDisk 2Gb card at 8MHz.

Eric.

----- Original Message -----
From: axl_dudu
To: A...@yahoogroups.com
Sent: Tuesday, March 04, 2008 7:40 PM
Subject: [AT91SAM] Re: SD/MMC card on an sam7-ex256
Hello Eric!
How did you limit the speed? If you remember what changes you made to
do that, please post them (at least from what you remember).

Thanks,
Tudor

--- In A...@yahoogroups.com, "Eric Pasquier" wrote:
>
> Hi,
>
> I am using a 2GB card with SPI protocol.
> I remember that I had to limit transfert rate during initialisation
phase.
>
> I hope this help.
>
> Eric Pasquier
>
>
> ----- Original Message -----
> From: axl_dudu
> To: A...@yahoogroups.com
> Sent: Tuesday, March 04, 2008 6:10 PM
> Subject: [AT91SAM] Re: SD/MMC card on an sam7-ex256
>
>
> Yes. It is what I was looking for. I got an example made for this
> board but it doesn't work properly. I have a microSD with an
adapter
> for the SD slot. The problem, as far as I went until now, is that
> even thought the interface can read from the card, it detects
invalid
> FAT during the startup sequence of the EFSL. The card is just
fine, I
> checked it on the pc. I even installed a program that reads the
Disk
> Parameter Block and everything seems ok.
>
> The person that gave me the example said he tried it with a 512MB
> SANDISK SD card. I am using a 1GB A-DATA microSD with the
available
> adapter. Could this be a problem?
>
> Tudor
>
> --- In A...@yahoogroups.com, Bernd Walter wrote:
> >
> > On Tue, Mar 04, 2008 at 08:09:42AM -0000, axl_dudu wrote:
> > > Thanks Eric.
> > > I haven't tried yet the NutOS. I have been using FreeRTOS and
I'd
> > > like to continue with it(at least for the moment). But I will
> > > consider migrating to the NutOS, if it includes FTP.
> >
> > You might want to consider efsl.
> > http://www.efsl.be/
> > It has some limitations on FAT with long filenames though.
> > But maybe you are just searching for the block functions and
not for
> > filesystem support.
> >
> > > --- In A...@yahoogroups.com, "Eric Haver"
wrote:
> > > >
> > > > Hi Tudor,
> > > >
> > > > NutOS does this right out of the box.
> > > > Includes FTP.
> > > >
> > > > I am now working to get it to format the card.
> > > >
> > > > *E
> > > >
> > > >
> > > >
> > > > On Sun, Mar 2, 2008 at 12:39 PM, axl_dudu wrote:
> > > >
> > > > > Hello,
> > > > > does anyone has a working example for controlling the
SD/MMC
> card
> > > on an
> > > > > at91sam7 (preferably with the olimex's board sam7-ex256)?
I
> have
> > > been
> > > > > struggling to get working an example that someone gave me
but
> it
> > > gets
> > > > > stuck somewhere in the init part.
> > > > >
> > > > > Thanks,
> > > > > Tudor
> > > > >
> > > > >
> >
> > --
> > B.Walter http://www.bwct.de http://www.fizon.de
> > bernd@ info@ support@
> >
>



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

RE: Re: SD/MMC card on an sam7-ex256 - microbit - Mar 8 17:39:23 2008

Hi Tudor,

I've only had time in bits 'n pieces, but everything is working quite OK now.
The formatting is working fine for FAT12/16 with a choice to create partitioned or not
cards. I need to find a gap to finalise testing FAT32, there's a small snag there somewhere.
One of the problems is that EFSL assumes a FAT32 card by default *and* assumes that it is
partitioned. Format an SD card from XP through a reader and you'll see they're never partitioned,
they're just SFD.
EFSL just loads the 4 partition tables and happily chugs away. (it should check for the 'magic'
number on MBR and then make a decision whether there is a partition table present or not) I
presume the authors are working on that. I looked at it, but there's no simple way to fix that
without changing the actual code under the \src\ directory.
The main contention is with function loadMBR().

In any case, when the format function is all tested and cleaned up I'll send it to you and/or
upload it here in Files.

Oh, I don't use FreeRTOS, If I need RTOS I use CTL (which is CrossWorks included RTOS).

Best Regards,
Kris

-----Original Message-----
From: A...@yahoogroups.com [mailto:A...@yahoogroups.com] On Behalf Of axl_dudu
Sent: Thursday, 6 March 2008 12:33 AM
To: A...@yahoogroups.com
Subject: [AT91SAM] Re: SD/MMC card on an sam7-ex256

It would be great to see the format function you have made. If you
can, try the system together with FreeRTOS and tell me if it works
for you.

Tudor



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

Reading extra partitions on SD Cards as Volumes on XP - microbit - Mar 9 5:16:35 2008

Hi all,

For completeness in the formatting stuff I've written for EFSL, I'm writing ability to partition
large SD cards. Now, I've noticed that XP doesn't/won't access the extra partitions.
I'm assuming it's because they're registering as 'Removable' media.

I always thought that RBC deals in RAW LBAs, so I don't see why XP shouldn't be able to do it.
(but it doesn't it seems)

So, the question is :

Q : Does anyone know of a utility or some such that 'stops' or 'filters' XP from ignoring active
partitions #2-#4 on SD cards (through a Card Reader) ?

FWIW, when I format from AT91SAM7S-EK and test with eg. 2 partitions, then Disk Manager shows the
2 partitions :
It shows the first partition as 'FAT' - healthy
and the 2nd partition as 'Healthy' but doesn't recognise FAT.

PS : Changing the Media Descriptor to 'Fixed' in boot record in my code doesn't help either.

Best Regards,
Kris



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

RE: Reading extra partitions on SD Cards as Volumes on XP - Paul Curtis - Mar 9 7:10:00 2008

Hi,

> For completeness in the formatting stuff I've written for EFSL, I'm
> writing ability to partition
> large SD cards. Now, I've noticed that XP doesn't/won't access the
> extra partitions.
> I'm assuming it's because they're registering as 'Removable' media.

Whatever it's doing, the partitions don't show up. I don't think anybody
has been able to do this on Windows.

> I always thought that RBC deals in RAW LBAs, so I don't see why XP
> shouldn't be able to do it. (but it doesn't it seems)

Again, I do not know of a reason not to, but I suspect that Microsoft have a
good reason.

> So, the question is :
>
> Q : Does anyone know of a utility or some such that 'stops' or
> 'filters' XP from ignoring active
> partitions #2-#4 on SD cards (through a Card Reader) ?

Not that I know of.

> FWIW, when I format from AT91SAM7S-EK and test with eg. 2 partitions,
> then Disk Manager shows the 2 partitions :
> It shows the first partition as 'FAT' - healthy
> and the 2nd partition as 'Healthy' but doesn't recognise FAT.
>
> PS : Changing the Media Descriptor to 'Fixed' in boot record in my code
> doesn't help either.

I use Mac OS X with my SD card library; Mac OS seems to do a much better job
of it than Windows.

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks for ARM, MSP430, AVR, MAXQ, and now Cortex-M3 processors



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

Re: Reading extra partitions on SD Cards as Volumes on XP - axl_dudu - Mar 9 11:48:33 2008

Hi Kris,
Good ideea to use more partitions on a single SD card. I don't see
any reason for Windows to not recognize them.
If you find anything, please let me know.

Tudor

--- In A...@yahoogroups.com, "microbit" wrote:
>
> Hi all,
>
> For completeness in the formatting stuff I've written for EFSL, I'm
writing ability to partition
> large SD cards. Now, I've noticed that XP doesn't/won't access the
extra partitions.
> I'm assuming it's because they're registering as 'Removable' media.
>
> I always thought that RBC deals in RAW LBAs, so I don't see why XP
shouldn't be able to do it.
> (but it doesn't it seems)
>
> So, the question is :
>
> Q : Does anyone know of a utility or some such that 'stops'
or 'filters' XP from ignoring active
> partitions #2-#4 on SD cards (through a Card Reader) ?
>
> FWIW, when I format from AT91SAM7S-EK and test with eg. 2
partitions, then Disk Manager shows the
> 2 partitions :
> It shows the first partition as 'FAT' - healthy
> and the 2nd partition as 'Healthy' but doesn't recognise FAT.
>
> PS : Changing the Media Descriptor to 'Fixed' in boot record in my
code doesn't help either.
>
> Best Regards,
> Kris
>



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

Re: Reading extra partitions on SD Cards as Volumes on XP - axl_dudu - Mar 9 12:09:27 2008

Hello Paul,
sorry for asking, but I didn't understood one thing from what you
wrote. Is MAC OS able to recognize different partitions on a sigle SD
card?

Regards,
Tudor

--- In A...@yahoogroups.com, "Paul Curtis" wrote:
>
> Hi,
>
> > For completeness in the formatting stuff I've written for EFSL,
I'm
> > writing ability to partition
> > large SD cards. Now, I've noticed that XP doesn't/won't access the
> > extra partitions.
> > I'm assuming it's because they're registering as 'Removable'
media.
>
> Whatever it's doing, the partitions don't show up. I don't think
anybody
> has been able to do this on Windows.
>
> > I always thought that RBC deals in RAW LBAs, so I don't see why XP
> > shouldn't be able to do it. (but it doesn't it seems)
>
> Again, I do not know of a reason not to, but I suspect that
Microsoft have a
> good reason.
>
> > So, the question is :
> >
> > Q : Does anyone know of a utility or some such that 'stops' or
> > 'filters' XP from ignoring active
> > partitions #2-#4 on SD cards (through a Card Reader) ?
>
> Not that I know of.
>
> > FWIW, when I format from AT91SAM7S-EK and test with eg. 2
partitions,
> > then Disk Manager shows the 2 partitions :
> > It shows the first partition as 'FAT' - healthy
> > and the 2nd partition as 'Healthy' but doesn't recognise FAT.
> >
> > PS : Changing the Media Descriptor to 'Fixed' in boot record in
my code
> > doesn't help either.
>
> I use Mac OS X with my SD card library; Mac OS seems to do a much
better job
> of it than Windows.
>
> --
> Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
> CrossWorks for ARM, MSP430, AVR, MAXQ, and now Cortex-M3 processors
>



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

RE: Re: Reading extra partitions on SD Cards as Volumes on XP - Paul Curtis - Mar 9 12:40:23 2008

Hi Tudor,

> Hello Paul,
> sorry for asking, but I didn't understood one thing from what you
> wrote. Is MAC OS able to recognize different partitions on a sigle SD
> card?

Yes, and it's able to partition them too.

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks for ARM, MSP430, AVR, MAXQ, and now Cortex-M3 processors



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

RE: Reading extra partitions on SD Cards as Volumes on XP - microbit - Mar 9 17:58:36 2008

Hi Paul,

Thanks for clarifying, that confirms my observations :-)

> Whatever it's doing, the partitions don't show up. I don't think anybody
> has been able to do this on Windows.

Can you define 'partitions don't show up' better ?
Disk Management does show my (extra) partitions, but it doesn't see the FAT I put on it.

While on this subject, can you confirm that each boot record for a partition does _indeed_ reside
at LBA start of partition + the CHS sector offset of 63 ?
IOW I mean, let's say an SD card is partitioned exactly in 2 equal parts (SD card size/2).
If I have this correct, the Boot record for partition #2 would be at LBA (SD card size/2) + 63
and its LBA sector size (at [0x1CE].sectorsize in MBR) would be LBA ((SD card size/2) - 63).
Correct ?

In any case, it's still handy to partition. One of my test cards is a Transcend 512 MB and it's
woefully slow. For quicker testing I just allocate like say 1/4 of that etc.

Best Regards,
Kris

-----Original Message-----
From: A...@yahoogroups.com [mailto:A...@yahoogroups.com] On Behalf Of Paul Curtis
Sent: Sunday, 9 March 2008 10:11 PM
To: A...@yahoogroups.com
Subject: RE: [AT91SAM] Reading extra partitions on SD Cards as Volumes on XP

Hi,

> For completeness in the formatting stuff I've written for EFSL, I'm
> writing ability to partition
> large SD cards. Now, I've noticed that XP doesn't/won't access the
> extra partitions.
> I'm assuming it's because they're registering as 'Removable' media.

Whatever it's doing, the partitions don't show up. I don't think anybody
has been able to do this on Windows.

> I always thought that RBC deals in RAW LBAs, so I don't see why XP
> shouldn't be able to do it. (but it doesn't it seems)

Again, I do not know of a reason not to, but I suspect that Microsoft have a
good reason.

> So, the question is :
>
> Q : Does anyone know of a utility or some such that 'stops' or
> 'filters' XP from ignoring active
> partitions #2-#4 on SD cards (through a Card Reader) ?

Not that I know of.

> FWIW, when I format from AT91SAM7S-EK and test with eg. 2 partitions,
> then Disk Manager shows the 2 partitions :
> It shows the first partition as 'FAT' - healthy
> and the 2nd partition as 'Healthy' but doesn't recognise FAT.
>
> PS : Changing the Media Descriptor to 'Fixed' in boot record in my code
> doesn't help either.

I use Mac OS X with my SD card library; Mac OS seems to do a much better job
of it than Windows.

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks for ARM, MSP430, AVR, MAXQ, and now Cortex-M3 processors



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

RE: Re: Reading extra partitions on SD Cards as Volumes on XP - microbit - Mar 9 18:03:29 2008

Hi Paul et al,

This leads me to something else that's been bothering me for some time.

I notice that SD FAT libs make some big assumptions about FAT type.
If I format FAT16A on my 512 MB card, (eg) EFSL starts using FAT32, although it should use FAT16.
Anyone know of any docs somewhere that update on how to make a better decision ?
(apart from fatgen103.doc). I'm pondering this too especially since MS dropped the lower limit for
FAT32 to 64 MB ....
(Perhaps looking at the FsInfo record if there, and then go FAT32 or some such ?)

I always thought that simply looking at the FATXX string in the MBR is not the way to do it,
but seems to me that stupidly looking at disk size isn't the right way either.

XP does figure out with larger cards whether I've formatted them in FAT16 or FAT32 on my own HW.

Secondly, I'd like to come up with a more precise way to look at the MBR of cards to see whether
they're SFD or FDISK. I've resorted to looking for the "FAT" string in LBA #0 (since a partitioned
card won't have that there).
Should I access the first partition (if it's there), fetch the 1st partition's boot record and
examine whether the signature 0xAA55 is at [511] ?
If it's not there - wouldn't that be a more reliable way to then conclude that this is an SFD card
(ie. NO partitions) ?

Best Regards,
Kris

-----Original Message-----
From: A...@yahoogroups.com [mailto:A...@yahoogroups.com] On Behalf Of Paul Curtis
Sent: Monday, 10 March 2008 3:48 AM
To: A...@yahoogroups.com
Subject: RE: [AT91SAM] Re: Reading extra partitions on SD Cards as Volumes on XP

Hi Tudor,

> Hello Paul,
> sorry for asking, but I didn't understood one thing from what you
> wrote. Is MAC OS able to recognize different partitions on a sigle SD
> card?

Yes, and it's able to partition them too.

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks for ARM, MSP430, AVR, MAXQ, and now Cortex-M3 processors



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

RE: Re: Reading extra partitions on SD Cards as Volumes on XP - Paul Curtis - Mar 9 18:37:20 2008

Hi Kris,

> This leads me to something else that's been bothering me for some time.
>=20
> I notice that SD FAT libs make some big assumptions about FAT type.
> If I format FAT16A on my 512 MB card, (eg) EFSL starts using FAT32,
> although it should use FAT16.
> Anyone know of any docs somewhere that update on how to make a better
> decision ?
> (apart from fatgen103.doc).=20

That is *the* specification to use. Microsoft advise that, for best intero=
perability, the number of clusters in a volume should not be near the thres=
holds for FAT12/FAT16/FAT32 because they've seen broken implementations of =
FAT. From my experience, the only thing that matters is the number of clus=
ters in a volume to determine the volume type. NOTE: even Microsoft mis-do=
cument the threshold conditions in their tools!

> I'm pondering this too especially since MS dropped the lower limit for
> FAT32 to 64 MB ....

I'm not sure what you're getting at here.

> (Perhaps looking at the FsInfo record if there, and then go FAT32 or
> some such ?)

Number of clusters. Always.

> I always thought that simply looking at the FATXX string in the MBR is
> not the way to do it,

Absolutely not!

> but seems to me that stupidly looking at disk size isn't the right way
> either.

Correct, disk size has nothing to do with it. You can have FAT16 all the w=
ay to 2G. There is a method for determining FAT12/16/32 given the number o=
f sectors, but that's for selecting the best configuration, not the configu=
ration that will actually be used.

> XP does figure out with larger cards whether I've formatted them in
> FAT16 or FAT32 on my own HW.
> Secondly, I'd like to come up with a more precise way to look at the
> MBR of cards to see whether
> they're SFD or FDISK. I've resorted to looking for the "FAT" string in
> LBA #0 (since a partitioned card won't have that there).

Nope, don't do that. Again, superfloppy and those with a partition map are=
slightly different but might "look the same". There are some good links a=
bout for decoding extended partitions and the like, but not real firm docum=
entation on how partition maps and the MBR all jive together. When Vista w=
rite the new GUID-based partition tables it also fakes up an MBR. Mac OS c=
an do this stuff too.

> Should I access the first partition (if it's there), fetch the 1st
> partition's boot record and
> examine whether the signature 0xAA55 is at [511] ?
> If it's not there - wouldn't that be a more reliable way to then
> conclude that this is an SFD card
> (ie. NO partitions) ?

Here is an extract from my simple volume mount, which is *not* the full mou=
nt code for disks. It just tries to mount a volume as a superfloppy or the=
first active partition (note: not all the code is shown here):

=EF=BB=BF // If there is a jump then this is a drive without partitions su=
ch as a floppy
// or a superfloppy (SD/MMC card, USB flash drive, and so on).
if ((vol->sector_data.bytes[0x000] =3D=3D 0xEB && vol->sector_data.bytes[=
0x002] =3D=3D 0x90) ||
vol->sector_data.bytes[0x000] =3D=3D 0xE9)
{
partition_start_sector =3D 0;
}
else
{
// Select first partition.
if (vol->sector_data.bytes[0x1BF])
{
// Partition 1 is a valid partition.
partition_start_sector =3D xtl_fat_read_uint32(vol->sector_data.b=
ytes + 0x1C6);
}

Rgds,

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk=20
CrossWorks for ARM, MSP430, AVR, MAXQ, and now Cortex-M3 processors

=20

=20


(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

RE: Reading extra partitions on SD Cards as Volumes on XP - Paul Curtis - Mar 9 18:43:22 2008

Hi Kris,

> Hi Paul,
>
> Thanks for clarifying, that confirms my observations :-)
>
> > Whatever it's doing, the partitions don't show up. I don't think
> anybody
> > has been able to do this on Windows.
>
> Can you define 'partitions don't show up' better ?
> Disk Management does show my (extra) partitions, but it doesn't see the
> FAT I put on it.

Only the first active partition of a SD card is mounted and available under
Windows evcen if there are multiple partitions on a disk. Mac OS X shows
you all the partitions and you can use them all.

> While on this subject, can you confirm that each boot record for a
> partition does _indeed_ reside
> at LBA start of partition + the CHS sector offset of 63 ?

No idea what you're getting at here Kris. I don't recognize the 63. I just
use the tables...

> IOW I mean, let's say an SD card is partitioned exactly in 2 equal
> parts (SD card size/2).
> If I have this correct, the Boot record for partition #2 would be at
> LBA (SD card size/2) + 63
> and its LBA sector size (at [0x1CE].sectorsize in MBR) would be LBA
> ((SD card size/2) - 63).
> Correct ?

Why? Again, the 63 isn't all that illuminating for me.

> In any case, it's still handy to partition. One of my test cards is a
> Transcend 512 MB and it's woefully slow. For quicker testing I just
allocate like say 1/4 of that
> etc.

If you read the information returned by the card you find a fair amount of
information about the internals of the card. The newer SDHC cards are rated
and will attain a sustained transfer rate of up to 6MB/second for class 6
cards. That's not slow. If your file system isn't very intelligent, I/O
will be slow.

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks for ARM, MSP430, AVR, MAXQ, and now Cortex-M3 processors



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

RE: Re: Reading extra partitions on SD Cards as Volumes on XP - microbit - Mar 10 0:27:48 2008

Hi Paul,

> number of clusters in a volume to determine the volume type.
> NOTE: even Microsoft mis-document he threshold conditions in their tools!

Yep, I've noticed that ! If you apply their 'magic formula' (fatgen103.doc) at times you can get
inconsistencies of 1-2 sectors for the threshold... MS themselves can't even get it right.
It's funny actually, quoting fatgen : "Just don't wonder how the formula works, it just does.."
Well, it doesn't ALWAYS.

>> I'm pondering this too especially since MS dropped the lower limit for
>> FAT32 to 64 MB ....
> I'm not sure what you're getting at here.

Well, I meant that a 64 MB volume does NOT necessarily mean that it'll be FAT16 (anymore).
I can format 64 MB cards as FAT32 or FAT

> Here is an extract from my simple volume mount, which is *not* the full mount code for disks.
> It just tries to mount a volume as a superfloppy or the first active partition (note: not all
> the code is shown here):

Right, I see - so you're looking at the actual bootcode (jmp) at [0] (0x0090FEEB)
I haven't come across the 2nd possibility yet where MBR[0] = 0xE9 ? What does that cover ?
(I'm happy to go figure it out though).

This is already a great help, thanks !
(I'm doing this to learn more about it)
Best Regards,
Kris

-----Original Message-----
From: A...@yahoogroups.com [mailto:A...@yahoogroups.com] On Behalf Of Paul Curtis
Sent: Monday, 10 March 2008 9:44 AM
To: A...@yahoogroups.com
Subject: RE: [AT91SAM] Re: Reading extra partitions on SD Cards as Volumes on XP

Hi Kris,

> This leads me to something else that's been bothering me for some time.
>
> I notice that SD FAT libs make some big assumptions about FAT type.
> If I format FAT16A on my 512 MB card, (eg) EFSL starts using FAT32,
> although it should use FAT16.
> Anyone know of any docs somewhere that update on how to make a better
> decision ?
> (apart from fatgen103.doc).

That is *the* specification to use. Microsoft advise that, for best interoperability, the number
of clusters in a volume should not be near the thresholds for FAT12/FAT16/FAT32 because they've
seen broken implementations of FAT. From my experience, the only thing that matters is the number
of clusters in a volume to determine the volume type. NOTE: even Microsoft mis-document the
threshold conditions in their tools!



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

RE: Reading extra partitions on SD Cards as Volumes on XP - microbit - Mar 10 1:06:33 2008

Hi Paul,

> No idea what you're getting at here Kris. I don't recognize the 63. I just
> use the tables...

I'm referring to the standard offset for a partition table (Max # of sectors in CHS I believe).
This is for my own formatting, so I'm creating those tables.

I'll try reword this :

Let's say I have a disk with 20,000 (decimal) sectors on it. I format into 2 Volumes, each 10,000
sectors.

So,
Partition table #1 would have :
[8] : # of sectors (LBA) preceding its partition (absolute) = 63
[C] : # of sectors in the partition = (10,000 - 63)

Partition table #2 would have :
[8] : # of sectors (LBA) preceding its partition (absolute) = 10,000
[C] : # of sectors in the partition = (10,000 - 63)

In this case, where do I store the Boot record for Partition #2 ?
At absolute sector # 10,000 - Right ??? I initially would have thought that the boot record for
partition # 2 would have been at absolute sector # 10,063 !!

Perhaps it's confusing because I'm simplifying it with the partition table offset.
(if that makes sense :-)
I haven't covered CHS for clarity.

> If you read the information returned by the card you find a fair amount of
> information about the internals of the card.

That I don't get.
What if I decide to only allocate say 1/4 of the card (by using one partition and not SFD),
leaving 3/4 unallocated ? What good is the CIS then ????
If I based my decision what FAT to use that way, all hell will break loose.

> Only the first active partition of a SD card is mounted and available under
> Windows evcen if there are multiple partitions on a disk. Mac OS X shows
> you all the partitions and you can use them all.

I don't use Mac (besides I hate those dumb Mac & PC ads with the guy from Die Hard 4.0, they're
full of crap). I love Die Hard 4.0 however.. :-)

Shame Windows doesn't readily read multiple partitions.
Kinda makes me wonder whether I should still bother then with partitioning in my format code ?
Oh well, I'm still having fun and learning anyhow.
Best Regards,
Kris

-----Original Message-----
From: A...@yahoogroups.com [mailto:A...@yahoogroups.com] On Behalf Of Paul Curtis
Sent: Monday, 10 March 2008 9:50 AM
To: A...@yahoogroups.com
Subject: RE: [AT91SAM] Reading extra partitions on SD Cards as Volumes on XP



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

RE: Re: Reading extra partitions on SD Cards as Volumes on XP - Jonathan Dumaresq - Mar 10 9:37:39 2008

Hi,

I have played with some FAT libs form sam7x and 7s part and I finaly used
the chanfat. I use it principally in fat16 but it is suppose to support the
fat12/16/32 also.

It is only for your information. I have played with the esfl but without
many success.=20

http://elm-chan.org/fsw/ff/00index_e.html

regards

Jonathan

-----Message d'origine-----
De=A0: A...@yahoogroups.com [mailto:A...@yahoogroups.com] De la part =
de
microbit
Envoy=E9=A0: 9 mars 2008 18:01
=C0=A0: A...@yahoogroups.com
Objet=A0: RE: [AT91SAM] Re: Reading extra partitions on SD Cards as Volumes=
on
XP

Hi Paul et al,

This leads me to something else that's been bothering me for some time.

I notice that SD FAT libs make some big assumptions about FAT type.
If I format FAT16A on my 512 MB card, (eg) EFSL starts using FAT32, althoug=
h
it should use FAT16.
Anyone know of any docs somewhere that update on how to make a better
decision ?
(apart from fatgen103.doc). I'm pondering this too especially since MS
dropped the lower limit for
FAT32 to 64 MB ....
(Perhaps looking at the FsInfo record if there, and then go FAT32 or some
such ?)

I always thought that simply looking at the FATXX string in the MBR is not
the way to do it,
but seems to me that stupidly looking at disk size isn't the right way
either.

XP does figure out with larger cards whether I've formatted them in FAT16 o=
r
FAT32 on my own HW.

Secondly, I'd like to come up with a more precise way to look at the MBR of
cards to see whether
they're SFD or FDISK. I've resorted to looking for the "FAT" string in LBA
#0 (since a partitioned
card won't have that there).
Should I access the first partition (if it's there), fetch the 1st
partition's boot record and
examine whether the signature 0xAA55 is at [511] ?
If it's not there - wouldn't that be a more reliable way to then conclude
that this is an SFD card
(ie. NO partitions) ?

Best Regards,
Kris
=20

-----Original Message-----
From: A...@yahoogroups.com [mailto:A...@yahoogroups.com] On Behalf Of
Paul Curtis
Sent: Monday, 10 March 2008 3:48 AM
To: A...@yahoogroups.com
Subject: RE: [AT91SAM] Re: Reading extra partitions on SD Cards as Volumes
on XP

Hi Tudor,

> Hello Paul,
> sorry for asking, but I didn't understood one thing from what you
> wrote. Is MAC OS able to recognize different partitions on a sigle SD
> card?

Yes, and it's able to partition them too.

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk=20
CrossWorks for ARM, MSP430, AVR, MAXQ, and now Cortex-M3 processors

=20

=20


(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

RE: Reading extra partitions on SD Cards as Volumes on XP - Paul Curtis - Mar 12 20:08:04 2008

Kris,

> > If you read the information returned by the card you find a fair
> amount of information about the internals of the card.
>
> That I don't get.

Shame. ;-)

> What if I decide to only allocate say 1/4 of the card (by using one
> partition and not SFD),
> leaving 3/4 unallocated ? What good is the CIS then ????
> If I based my decision what FAT to use that way, all hell will break
> loose.

This is not what I mean. The card can tell you about things that will make
it go faster at the interface using multi-block writes. I believe this is
required, in effect, for all these digital cameras to take snappy
photos--there's no way to make things go fast on a highly fragmented SD card
(consider every other sector in use). For streaming large amounts of data
to a file you really need a good filing system that knows a little about the
capability of the media it's driving.

> > Only the first active partition of a SD card is mounted and available
> under
> > Windows evcen if there are multiple partitions on a disk. Mac OS X
> shows
> > you all the partitions and you can use them all.
>
> I don't use Mac (besides I hate those dumb Mac & PC ads with the guy
> from Die Hard 4.0, they're
> full of crap). I love Die Hard 4.0 however.. :-)
>
> Shame Windows doesn't readily read multiple partitions.
> Kinda makes me wonder whether I should still bother then with
> partitioning in my format code ?
> Oh well, I'm still having fun and learning anyhow.

I can't see the need to partition anything on an embedded device--format a
partition, possibly, but not do that actual partitioning.

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks for ARM, MSP430, AVR, MAXQ, and now Cortex-M3 processors



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

RE: Re: Reading extra partitions on SD Cards as Volumes on XP - Paul Curtis - Mar 13 3:15:58 2008

Kris,

> > number of clusters in a volume to determine the volume type.
> > NOTE: even Microsoft mis-document he threshold conditions in their
> tools!
>
> Yep, I've noticed that ! If you apply their 'magic formula'
> (fatgen103.doc) at times you can get
> inconsistencies of 1-2 sectors for the threshold... MS themselves can't
> even get it right.
> It's funny actually, quoting fatgen : "Just don't wonder how the
> formula works, it just does.."
> Well, it doesn't ALWAYS.

Well, it seems to work for me, at least I cannot see where it would fail.

> >> I'm pondering this too especially since MS dropped the lower limit
> for
> >> FAT32 to 64 MB ....
> > I'm not sure what you're getting at here.
>
> Well, I meant that a 64 MB volume does NOT necessarily mean that it'll
> be FAT16 (anymore). I can format 64 MB cards as FAT32 or FAT

You can use FAT32 on anything (within reason).

> > Here is an extract from my simple volume mount, which is *not* the
> full mount code for disks.
> > It just tries to mount a volume as a superfloppy or the first active
> partition (note: not all
> > the code is shown here):
>
> Right, I see - so you're looking at the actual bootcode (jmp) at [0]
> (0x0090FEEB)
> I haven't come across the 2nd possibility yet where MBR[0] = 0xE9 ?
> What does that cover ? (I'm happy to go figure it out though).

See fatgen103 p. 9.

-- Paul.



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

RE: Re: Reading extra partitions on SD Cards as Volumes on XP - microbit - Mar 17 9:07:39 2008

Well, XP _can_ treat USB card readers as 'Local'...

Just recently Bill Knight gave me a great URL for doing just exactly what I was after.
I tried it and it works like a charm on my cardreader :
http://portableapps.com/node/7181

As Bill pointed out, you don't need to access the registry though :
The info the web page says to get from the registry is also on the 'Details' tab of the disk
device properties dialog. It's actually really simple.
(of course you can always roll back the driver)

You can create/delete Partitions from XP to your heart's content.
So I picked up a bit more on my formatting function.
I'm still testing more, and cleaning up a bit but the func can now :
- Create a single SD as SFD (ie. no partition tables, just MBR).
- Create a single SD as a single Partition using the reported Card Size to adjust the partition.
- Create a single SD as a single Partition. Or with 2,3 or 4 partitions.
- Have arbitrary sizes specified for each Partition.
- Give each SFD or Partition an arbitrary Serial Number 32 bit.
- Give each SFD or Partition an arbitrary Volume label.
- Format in FAT12, FAT16(16 bit sectors), FAT16(32 bit sectors), FAT32(LBA or CHS)
- Set the decision threshold for FAT16->FAT32 (default 65525, but I set it at 64MB so I can create
FAT16 partitions where 32 bit sector values are used.

I've tested a fair bit and it seems stable now.
FAT types can be in any order, as long as they pass the plausibility check.
(You can partition from XP but you're limited with choice of Volume sizes)
Once I have it completely abstracted, so you can 1-2-3 link it with the rest of EFSL (and tested
for that), I'll upload it.

There's still snags too in the IO manager that haven't been fixed in the latest versions ie. the
error handling for sector writes in IOMan is really buggered up.
It can affect proper flushing of the cache.

When I have a gap again will tinker more there too.

Best Regards,
Kris

-----Original Message-----
From: A...@yahoogroups.com [mailto:A...@yahoogroups.com] On Behalf Of axl_dudu
Sent: Monday, 10 March 2008 2:45 AM
To: A...@yahoogroups.com
Subject: [AT91SAM] Re: Reading extra partitions on SD Cards as Volumes on XP

Hi Kris,
Good ideea to use more partitions on a single SD card. I don't see
any reason for Windows to not recognize them.
If you find anything, please let me know.

Tudor

--- In A...@yahoogroups.com, "microbit" wrote:
========================================================================
Groups related to AT91SAM
========================================================================

msp430 (131 common members)
http://groups.yahoo.com/group/msp430?v=1&t=ipt&ch=email&pub=groups&slk=aftr0&sec=recg
Computers & Internet/Hardware: Welcome to the MSP430 User's Group! The purpose of...

avrclub (118 common members)
http://groups.yahoo.com/group/avrclub?v=1&t=ipt&ch=email&pub=groups&slk=aftr1&sec=recg
Microprocessors/Microcontrollers: Atmel AVR Microcontroller discussion group!

AVR-Chat (109 common members)
http://groups.yahoo.com/group/AVR-Chat?v=1&t=ipt&ch=email&pub=groups&slk=aftr2&sec=recg
Microprocessors/Microcontrollers: A place for Atmel AVR Microcontroller users to sha...

e-embedded (82 common members)
http://groups.yahoo.com/group/e-embedded?v=1&t=ipt&ch=email&pub=groups&slk=aftr3&sec=recg
Internet/Internet Appliances: Open-membership mailing list for embedded system d...

rabbit-semi (71 common members)
http://groups.yahoo.com/group/rabbit-semi?v=1&t=ipt&ch=email&pub=groups&slk=aftr4&sec=recg
Microprocessors/Microcontrollers: This is a user group for folks designing and progr...
------------------------------------



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

Re: Reading extra partitions on SD Cards as Volumes on XP - axl_dudu - Mar 17 13:13:53 2008

GREAT! Thanks a lot Kris!

Tudor
--- In A...@yahoogroups.com, "microbit" wrote:
>
> Well, XP _can_ treat USB card readers as 'Local'...
>
> Just recently Bill Knight gave me a great URL for doing just
exactly what I was after.
> I tried it and it works like a charm on my cardreader :
> http://portableapps.com/node/7181
>
> As Bill pointed out, you don't need to access the registry though :
> The info the web page says to get from the registry is also on
the 'Details' tab of the disk
> device properties dialog. It's actually really simple.
> (of course you can always roll back the driver)
>
> You can create/delete Partitions from XP to your heart's content.
> So I picked up a bit more on my formatting function.
> I'm still testing more, and cleaning up a bit but the func can now :
> - Create a single SD as SFD (ie. no partition tables, just MBR).
> - Create a single SD as a single Partition using the reported Card
Size to adjust the partition.
> - Create a single SD as a single Partition. Or with 2,3 or 4
partitions.
> - Have arbitrary sizes specified for each Partition.
> - Give each SFD or Partition an arbitrary Serial Number 32 bit.
> - Give each SFD or Partition an arbitrary Volume label.
> - Format in FAT12, FAT16(16 bit sectors), FAT16(32 bit sectors),
FAT32(LBA or CHS)
> - Set the decision threshold for FAT16->FAT32 (default 65525, but I
set it at 64MB so I can create
> FAT16 partitions where 32 bit sector values are used.
>
> I've tested a fair bit and it seems stable now.
> FAT types can be in any order, as long as they pass the
plausibility check.
> (You can partition from XP but you're limited with choice of Volume
sizes)
> Once I have it completely abstracted, so you can 1-2-3 link it with
the rest of EFSL (and tested
> for that), I'll upload it.
>
> There's still snags too in the IO manager that haven't been fixed
in the latest versions ie. the
> error handling for sector writes in IOMan is really buggered up.
> It can affect proper flushing of the cache.
>
> When I have a gap again will tinker more there too.
>
> Best Regards,
> Kris
>
>
> -----Original Message-----
> From: A...@yahoogroups.com [mailto:A...@yahoogroups.com] On
Behalf Of axl_dudu
> Sent: Monday, 10 March 2008 2:45 AM
> To: A...@yahoogroups.com
> Subject: [AT91SAM] Re: Reading extra partitions on SD Cards as
Volumes on XP
>
> Hi Kris,
> Good ideea to use more partitions on a single SD card. I don't see
> any reason for Windows to not recognize them.
> If you find anything, please let me know.
>
> Tudor
>
> --- In A...@yahoogroups.com, "microbit" wrote:
>

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



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )