Secure Digital (SD) card initialization in SPI mode
CASTalk.com Forum Index CASTalk.com
Discussion of DSP, FPGA, storage and embedded system.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web castalk.com
Secure Digital (SD) card initialization in SPI mode

 
Post new topic   Reply to topic    CASTalk.com Forum Index -> Embedded System
Author Message
Guest






Posted: Sun Jan 02, 2005 7:55 am    Post subject: Secure Digital (SD) card initialization in SPI mode Reply with quote

I'm attempting to interface to an SD card using an AT89S8252 MCU. I'm
using an 74LS125 to convert between 5V and 3.3V. The hardware seems to
be ok since I *do* get a response from the card but I'm having problems
initializing the card in SPI mode.

I am sending 96 clock cycles initially and then I send a CMD0.
Everything I've read suggests that CMD0 should initially respond with
0x01 at which point I can issue CMD1 to take the card out of idle mode.
Sometimes this works. But most of the time it doesn't work.

I usually get 0xFC back from the card and it never returns another
value until I eject the card and re-insert it. At that point CMD0
returns 0x03 and never goes to 0x01. Sometimes I find that if I insert
the card into an SD card reader I have and then reinsert it into my
hardware that the card works as expected (CMD0 returns 0x01, I then
issue CMD1 which returns 0x01 for awhile and then returns 0x00).

The 0x03 response to CMD0 suggests to me it is in idle mode and
reporting an "erase/reset" error. I've been unable to determine what
exactly that means.

At this point I'm running out of ideas of what I could be doing wrong.
I've looked at some code that was written for Atmel AVRs and it appears
I'm doing the same thing. And like I said sometimes it works. But
most of the time it seems the card is in some kind of strange state
that I can't get it out of.

If anyone has any ideas I would be very interested in some suggestions.
Thanks,
Craig
Back to top
Guest






Posted: Mon Jan 03, 2005 12:38 am    Post subject: Re: Secure Digital (SD) card initialization in SPI mode Reply with quote

Never mind. I found the problem. A short between the CS line and
another line was causing the SD card to always be selected. Bad thing.
Problem solved.
Back to top
Guest






Posted: Mon Jan 03, 2005 9:00 pm    Post subject: Re: Secure Digital (SD) card initialization in SPI mode Reply with quote

cesgoogle@vaultbbs.com wrote:
Quote:
I'm attempting to interface to an SD card using an AT89S8252 MCU.

Where did you get the spec for the SD card interface?
What kind of sustained transfer rates are you getting?
-howy
Back to top
Rene Tschaggelar
Guest





Posted: Mon Jan 03, 2005 9:35 pm    Post subject: Re: Secure Digital (SD) card initialization in SPI mode Reply with quote

howard@zaxcom.com wrote:

Quote:
cesgoogle@vaultbbs.com wrote:

I'm attempting to interface to an SD card using an AT89S8252 MCU.


Where did you get the spec for the SD card interface?
What kind of sustained transfer rates are you getting?

The specs are downloadable at http://www.sandisk.com

Rene
--
Ing.Buero R.Tschaggelar - http://www.ibrtses.com
& commercial newsgroups - http://www.talkto.net
Back to top
 
Post new topic   Reply to topic    CASTalk.com Forum Index -> Embedded System All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




VoIP Electronics Powered by phpBB