EmbeddedRelated.com
Forums

FatFS, LPC2148 and 1GB Sandisk SD card

Started by boru...@gmail.com March 30, 2008
Hello to all,

I have a problem with FatFS and i read all related post's but haven't got any luck running the FatFS with my board (i'm using SPI0).

1.problem: When I first initialize the card using a JTAG, the DSTATUS = 0x00, which is ok. If I restart the code using a JTAG the initialitation returns 0x02. But if i remove the card and repeat the initialization it returns 0x00. Any ideas.

2.problem: when I want to open a file (create a new one) auto_mount returns that there is no filesystem. I formated the card using FAT and FAT32 but no luck. The card works fine on a PC. I don't know what to try anymore.

Can someone help me? I used the IAR port of the FatFS for LPC2148 version 005.

Thank you.

Regards, Borut

An Engineer's Guide to the LPC2100 Series

Hi Borut,

> my microSD card from Sandisk was also recognized as mmc card (but not
> always).

Yep. You're not tickling it correctly.

> But i still can't get to run FatFS on my 1GB Sandisk card.

Again, not correct initialization I guess.

> Also, i'm still having problems initializing SD card - i can't
> initialize it twice in one run - i have to remove it from holder and
> then it works. Whad kind of initialization are you using (some
> suggestions pls :) )?

I can initialize it twice no problem.

As for initialization, I suggest you get down to reading the specifications.
I wrote everything from access to the SD simplified I/O specs and I don't
expect my code to run on all MMC cards (specs 4.1-4.3 I have, nothing else).
I can't say why your specific card isn't working. Kingston-branded cards
seem to be sourced from multiple manufacturers for the *same* card. I don't
think this will be true for Sandisk, but I do have Sandisk cards that report
different versions for nominally the same card.

How come you're still running CrossWorks? ;-)

Regards,

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks for ARM, MSP430, AVR, MAXQ, and now Cortex-M3 processors
Some additional info: my Transcend 512MB card was recognised ac
MMCCard, when i did f_mkfs i was able to open/create a file but when
i tried to write to it i got FR_DENIED. Also, under Win XP my SDcard
is now only 1,88MB in size. I tried formating it again under win but
i can't change size of the card.

Regards,

Borut

--- In l..., "bkastel1" wrote:
>
> Hello Paul :)
>
> First thank you for your answers and recommendations. As with help
> for CrossStudio your are giving it your best. Second, i LOVE
> CrossStudio (except intellisense-like function would be great to
> have:) ) and i'm in the proccess of buying personal licence but i
> don't know how to buy it and pay it with Mastercard (don't like
> faxing the numbers of my card). So far i'm using lic from my
company.
> Third :), i tried with Kingstone 512MB SD card; initialization
works
> but FatFS still doesn't (i'm just debuging as i'm writing this).
Did
> you wrote new initialization functions? I was thinking of checking
> out EFSL initialization (as i remember init was working with all my
> cards there) but i still don't know why f_open( ... ) returns
> FR_NO_FILESYSTEM. Maybe i need to do f_mkfs before trying to
> open/create a new file?
>
> Thanks Paul
>
> --- In l..., "ghetto_shinobi"
> wrote:
> >
> > Hi
> >
> > I just checked all my cards with EFSL and they all worked
> fine.Tested
> > on:512MB SD from Kingston,512 and 1GB microSD from SanDisk,1GB
> microSD
> > Premier from SanDisk and i also dug up my old 32MB MMC from
SanDisk.
> > Take a look at their implementation of card init function.
> > I will also try to check all my cards with FatFs and report back
> results.
> >
> > Regards!
> >
> > > Hi Borut,
> > >
> > > > my microSD card from Sandisk was also recognized as mmc card
> (but not
> > > > always).
> > >
> > > Yep. You're not tickling it correctly.
> > >
> > > > But i still can't get to run FatFS on my 1GB Sandisk card.
> > >
> > > Again, not correct initialization I guess.
> > >
> > > > Also, i'm still having problems initializing SD card - i can't
> > > > initialize it twice in one run - i have to remove it from
> holder and
> > > > then it works. Whad kind of initialization are you using (some
> > > > suggestions pls :) )?
> > >
> > > I can initialize it twice no problem.
> > >
> > > As for initialization, I suggest you get down to reading the
> > specifications.
> > > I wrote everything from access to the SD simplified I/O specs
and
> I
> > don't
> > > expect my code to run on all MMC cards (specs 4.1-4.3 I have,
> > nothing else).
> > > I can't say why your specific card isn't working. Kingston-
> branded
> > cards
> > > seem to be sourced from multiple manufacturers for the *same*
> card.
> > I don't
> > > think this will be true for Sandisk, but I do have Sandisk cards
> > that report
> > > different versions for nominally the same card.
> > >
> > > How come you're still running CrossWorks? ;-)
> > >
> > > Regards,
> > >
> > > --
> > > Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
> > > CrossWorks for ARM, MSP430, AVR, MAXQ, and now Cortex-M3
> processors
> > >
>
Hi There,

I too am having exactly the same issue with a 1GB micro-sd. LPC2148, FatFS, under
Crossworks. Same scenario, same errors (though am trying to run it as a process under
TNKernel). I'm working on it too but if you have a resolution then please do share! I will
too, of course.

All the best,

Ed

--- In l..., CeDeROM wrote:
>
> Hello!
>
> I have the same problem with Kingston 1GB MMC mobile card.
>
> Also I have problem to run console on USB port - when I connect
> develboard do PC, ttyACM0 is created, but nothing is happens on this
> port. UART0 console works fine.
>
> Regards,
> Tomek
>
> --
> CeDeROM, http://www.tomek.cedro.info
>

Hi Paul,

I talked to some of my friends and they all said that it is great that
you offer personal licences. and also i thing the price is totaly
affordable. For that money you REALLY get a lot. Just one question:
V2? Are you preparing something? :)

Thanks

--- In l..., "Paul Curtis" wrote:
>
> Hi Borut,
>
> > First thank you for your answers and recommendations. As with help
> > for CrossStudio your are giving it your best. Second, i LOVE
> > CrossStudio (except intellisense-like function would be great to
> > have:) )
>
> Yeah, V2 is better in this regard.
>
> > and i'm in the proccess of buying personal licence but i
> > don't know how to buy it and pay it with Mastercard (don't like
> > faxing the numbers of my card).
>
> Well, we have a whole web page dvoted to how to get hold of a personal
> license. I wonder whether anybody appreciates the fact we do this
type of
> licensing...
>
> > So far i'm using lic from my company.
> > Third :), i tried with Kingstone 512MB SD card; initialization works
> > but FatFS still doesn't (i'm just debuging as i'm writing this). Did
> > you wrote new initialization functions?
>
> Like I said, I have my own FAT implementation and it's working with
MMC and
> SD cards in SPI mode on the Olimex 2148 board.
>
> > I was thinking of checking
> > out EFSL initialization (as i remember init was working with all my
> > cards there) but i still don't know why f_open( ... ) returns
> > FR_NO_FILESYSTEM. Maybe i need to do f_mkfs before trying to
> > open/create a new file?
>
> Well, I haven't used FatFS, but I did want to write a FAT file store
from
> scratch. For such a simple thing it takes a long time to get it right.
>
> --
> Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
> CrossWorks for ARM, MSP430, AVR, MAXQ, and now Cortex-M3 processors
>