EmbeddedRelated.com
Forums

SD cards with LPC2148

Started by Sutton Mehaffey May 30, 2008
Hello.

There is a lot of information about memory cards in the book "Mass Storage" (Jan Axelson).

Regards,
Fernando




Sutton Mehaffey escribi
I will post code and a flow chart when finished. If anyone else comes
up with anything for me to try out, I will do my best to accommodate.

I also noticed that the second initialize case for Version 1 cards
seems to be the older MMC/SD method (where init was done before
CMD58). However, I don't see any mention of that method in the Spec
anymore. I did confirm that the older init method works for either
version of the Version 1 card. But, I'm assuming they (SD) wanted you
to issue CMD58 to check the operation voltage before initializing for
some reason. This, however, is impossible because of the rejected
CMD58 on some Version 1 cards.

Sutton

--- In l..., Herbert Demmel wrote:
>
> Sutton,
>
> you definitely seem to make a good job when finding out all those
> weird issues. As mentioned in my former email, I'm just now designing
> the hardware (the SD-specific firmware will follow in some months or
> so), so I currently have absolutely no knowledge about SD cards yet,
> but I would be interested in getting some source code from you, if
> this is possible (once you have finished your work).
>
> Please let me know if this is possible.
>
> Best regards
> Herbert
>
> At 18:28 02.06.2008 +0000, you wrote:
> >OK. I think I figured something out. Apparently, the flow chart on
> >page 95 of the SD Spec. is not correct for all SD cards.
> >
> >It appears there can be two VERSION 1 setup possibilities when a CMD8
> >is rejected (reject means ILLEGAL COMMAND).
> >
> >Some SD cards (and most in my case) can execute CMD58 and initialize
> >on ACMD41 successfully as per the spec.
> >
> >Other cards cannot. After rejecting CMD8, some cards also reject
> >CMD58 and CMD55 (so you can't use ACMD41 as the init command). In
> >this case, you must first issue CMD1 as the init command until status
> >is 00. THEN, you can READ_OCR. This seems to solve the problem.
> >
> >In my case, I have 4 1GB, 1 2GB, and 1 512MB cards that reject CMD8,
> >but can immediately READ_OCR and then be initialized by CMD55-ACMD41.
> > I have 3 other 1GB cards that require the 2nd method of
> >initialization described above.
> >
> >I hope to write up a better flow chart once I feel 100% confident that
> >all cards are working properly.
> >
> >Any other input to this is appreciated.
> >
> >Sutton
> >
> >
> >
> >
> >--- In l..., Herbert Demmel wrote:
> > >
> > > At 15:36 02.06.2008 +0000, you wrote:
> > > >One of my cards (Edge 512MB) causes a hugh momentary voltage drop
> > > >(3.3V down to about 2.5V) and causes a brownout on my LPC2148,
which
> > > >causes a reset. No other card does this. Does anyone think
this is a
> > > >bad card or should I expect this occasionally and put a 1uF cap
on the
> > > >power bus instead of my .1uf?
> > >
> > > Ooops, you should have at least 4u7 *and* a 22uH in series, this is
> > > what I've seen recommended to exactly avoid what you mentioned
above.
> > > I'm just designing a board with a (micro-)SD card and originally did
> > > not understand what sense the choke has (and found the
explanation on
> > > the web later then), but thanks to your post now I *know* that it
> > > does make sense ;-) - see at http://elm-chan.org/docs/mmc/mmc_e.html
> > > "Consideration to Bus Floating and Hot Insertion"
> > >
> > > Herbert
> > >
> > >
> > > >I have a Lexar 128MB card that gives me an ILLEGAL COMMAND for
> > > >READ_CSD (Status 04), but reads other registers OK (CID). I don't
> > > >have another 128MB card to test. Are there conditions whereby
a 128MB
> > > >card doesn't have a CSD?
> > > >
> > > >Sutton
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >--- In l..., "Sutton Mehaffey" wrote:
> > > > >
> > > > > This is not really an LPC issue, even though I am using a
LPC2148 to
> > > > > interface with SD cards.
> > > > >
> > > > > I'm finally back on tackling the SD card issue with different
> > > > > manufacturers and making sure all work as advertised as far as
> > > > > initialization and determining size and type of card for
formatting
> > > > > purposes. I have about 20 SD cards just about all from
different
> > > > > vendors. However, some are OEM I expect, because the some
MIDs are
> > > > > the same.
> > > > >
> > > > > The only good code initialization code that I have found is Joel
> >W.'s
> > > > > code which handles all types of cards, and I have based my
code on
> > > > > that. The other code on the site and the Application Note by
> >Philips
> > > > > only seems to handle Version 1 cards and MMC.
> > > > >
> > > > > I used the SD Card Spec's (9/2006) flow chart, the 'How to Use
> > > > > MMC/SDC' description on elm-chan.org, Joel's code, and a SPI
Beagle
> > > > > Analyzer from Total Phase to look at all scenarios of
> >initialization.
> > > > > I'm trying to put together a better flow chart with exactly
what
> > > > > status to expect and how to handle each status. Hopefully, that
> >will
> > > > > be of some service to someone - all in one place.
> > > > >
> > > > > However, I'm getting some unexplained status on some cards upon
> >init,
> > > > > but not on some other cards of the same size. So, I was hoping
> > > > > someone might have an answer.
> > > > >
> > > > > I am getting 3 basic scenarios, as expected, when initializing a
> > > > > random SD card.
> > > > >
> > > > > - CMD8 legal, READ_OCR gives valid determination of HCSD card or
> > > > > SD-Version
> > > > >
> > > > > - CMD8 illegal, READ_OCR gives valid determination of
SD-Version 1.
> > > > >
> > > > > - CMD8 illegal, READ_OCR give invalid readings (but are
Version 1
> > > >cards).
> > > > >
> > > > > On, this last scenario, if you get an illegal CMD8, the READ_OCR
> >gives
> > > > > all FFs on read. If you read it again, it gives proper voltage
> > > > > information. If you read it a 3rd time, it gives you all
FFs again.
> > > > > So, every odd read, you get all FFs and every even read you get
> >proper
> > > > > info. I have 4 Version 1 cards (PNY-1GB, PQ1-1GB,
SanDisk-256MB,
> > > > > Sandisk-MicroSD) that have this anomoly. I have 7 other
Version 1
> > > > > cards (4-1GB, 1-2GB, 1-512MB, 1-128MB) that exhibit the correct
> > > > > READ_OCR every time. I thought that maybe if you got an illegal
> >CMD8,
> > > > > that you had to return to idle mode to get the card back to
a known
> > > > > state, but since 7 other cards work fine, I don't believe so.
> >Anybody
> > > > > had any issues like this?
> > > > >
> > > > > Also, does anyone know - Can a particular size card be a Version
> >1 or
> > > > > Version 2 depending on how the vendor wants to format the
card? I
> > > > > have 2-1GB cards that are Version 2 and 9-1GB that are
Version 1. I
> > > > > have a 2GB that is a Version 1. I was wondering if a 512MB
or lower
> > > > > can be a Version 2?
> > > > >
> > > > > Sutton
> > > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >

An Engineer's Guide to the LPC2100 Series