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
Secure Digital (SD) card initialization in SPI mode
Started by ●January 2, 2005
Reply by ●January 2, 20052005-01-02
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.
Reply by ●January 3, 20052005-01-03
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? -howy
Reply by ●January 3, 20052005-01-03
howard@zaxcom.com wrote:> 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