EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Crossworks sample project for sdcard support

Started by Jean-Sebastien Stoezel December 15, 2010
Hello,

I've been battling with this for a while now, I cant seem to get any
communication going between an lpc1756 and an sdcard.
I've used code from cmsis, demo code from NXP and my own code (that works on
an lpc2148). I've used different sdcards, I just can't get it to work.

Does anybody have ready to run project for crossworks, that exercises an
sdcard on ssp/spi0 with a cortex m3? This would help me narrow down the
issue, possibly to a hardware failure.

Jean

An Engineer's Guide to the LPC2100 Series

----Original Message----
From: l...
[mailto:l...] On Behalf Of
Jean-Sebastien Stoezel Sent: 15 December 2010 12:52 To:
l... Subject: [lpc2000] Crossworks
sample project for sdcard support

> Hello,
>
> I've been battling with this for a while now, I cant seem
> to get any communication going between an lpc1756 and an
> sdcard.
> I've used code from cmsis, demo code from NXP and my own
> code (that works on an lpc2148). I've used different
> sdcards, I just can't get it to work.
>
> Does anybody have ready to run project for crossworks,
> that exercises an sdcard on ssp/spi0 with a cortex m3?
> This would help me narrow down the issue, possibly to a
> hardware failure.

I have just got mine working on LPC1758 but unfortunately I cannot share the code.

However it is almost entirely based on the code in the NXP app note AN10406, which is not a great bit of coding but OK to start with. I changed the card initialisation to send ACMD41 instead of CMD1, as high capacity cards (which they all seem to be now) don't work with CMD1, and also to check for block-level addressing instead of byte-level addressing. Init described on Chan's page http://elm-chan.org/docs/mmc/mmc_e.html

One thing I did find is that some cards are really really slow to initialise.

--
Tim Mitchell

Tim:

Thank you for taking the time to share your experience.

It's interesting you went with AN10406, I have been trying to get AN10916 to
work, since it targets Cortex M3 devices.

I am not sure I am using CMD2 or CMD41, I will have to check the code when I
get home. I know that I have been using the same SD card code with the
LPC2148 for over 3 years now, it works great but I can't get it going with
the LPC1756 board I have. I'm even reusing the same SD cards I used with the
LPC2148.

I'm more and more thinking it might be a hardware issue. I don't have
another board to test with, and having code that works for sure on a Cortex
M3 would definitely help.

Jean
On Wed, Dec 15, 2010 at 7:54 AM, Tim Mitchell wrote:

> ----Original Message----
> From: l...
> [mailto:l... ] On Behalf Of
> Jean-Sebastien Stoezel Sent: 15 December 2010 12:52 To:
> l... Subject: [lpc2000]
> Crossworks
> sample project for sdcard support
>
> > Hello,
> >
> > I've been battling with this for a while now, I cant seem
> > to get any communication going between an lpc1756 and an
> > sdcard.
> > I've used code from cmsis, demo code from NXP and my own
> > code (that works on an lpc2148). I've used different
> > sdcards, I just can't get it to work.
> >
> > Does anybody have ready to run project for crossworks,
> > that exercises an sdcard on ssp/spi0 with a cortex m3?
> > This would help me narrow down the issue, possibly to a
> > hardware failure.
>
> I have just got mine working on LPC1758 but unfortunately I cannot share
> the code.
>
> However it is almost entirely based on the code in the NXP app note
> AN10406, which is not a great bit of coding but OK to start with. I changed
> the card initialisation to send ACMD41 instead of CMD1, as high capacity
> cards (which they all seem to be now) don't work with CMD1, and also to
> check for block-level addressing instead of byte-level addressing. Init
> described on Chan's page http://elm-chan.org/docs/mmc/mmc_e.html
>
> One thing I did find is that some cards are really really slow to
> initialise.
>
> --
> Tim Mitchell
>
>
>

Memfault Beyond the Launch