EmbeddedRelated.com
Forums

SD card problem!

Started by Atanas Tulbenski March 25, 2005

I'm using SD card with LPC2124. At first I used software SPI and
everything was fine. When I start using hardware SPI got problem. The
SD card initializes, I can read serial numbers, but I cant read data
using CMD17. The card returns error code 0x04 "ilegal command". Any
sugestions?



An Engineer's Guide to the LPC2100 Series



Can you please explain in a bit detail what you mean by Software SPI
and hardware SPI.
--- In , "Atanas Tulbenski" <top4e@y...>
wrote:
>
> I'm using SD card with LPC2124. At first I used software SPI and
> everything was fine. When I start using hardware SPI got problem.
The
> SD card initializes, I can read serial numbers, but I cant read
data
> using CMD17. The card returns error code 0x04 "ilegal command".
Any
> sugestions?




Re: SD card problem!

Software SPI I mean SPI interface realized by software "bitbanging"
and the hardware SPI means using hardware SPI module.

--- In , "garg_priti" <garg_priti@y...> wrote:
>
>
> Can you please explain in a bit detail what you mean by Software
SPI
> and hardware SPI.
> --- In , "Atanas Tulbenski" <top4e@y...>
> wrote:
> >
> > I'm using SD card with LPC2124. At first I used software SPI and
> > everything was fine. When I start using hardware SPI got problem.
> The
> > SD card initializes, I can read serial numbers, but I cant read
> data
> > using CMD17. The card returns error code 0x04 "ilegal command".
> Any
> > sugestions?




check your polarity and idle state of SCLK. Why don't you scope it
and compare sotware sPI to hardware SPI?

We have it working, no problems.
http://www.ghielectronics.com/ALFAT-SD.htm

Gus

--- In , "Atanas Tulbenski" <top4e@y...>
wrote:
>
> I'm using SD card with LPC2124. At first I used software SPI and
> everything was fine. When I start using hardware SPI got problem.
The
> SD card initializes, I can read serial numbers, but I cant read
data
> using CMD17. The card returns error code 0x04 "ilegal command".
Any
> sugestions?




The SPI now is fine. I can read registers of the SD card. But I cant
read the flash memmory. On CMD17 command the card returns ilegal
command, and CSR (Card Status Register) is 0x01FF, which means "CARD
IS LOCKED". How can I unlock the card? Any ideas!

--- In lpc2000@lpc2..., "Gus" <gus_is_working@y...> wrote:
>
> check your polarity and idle state of SCLK. Why don't you scope it
> and compare sotware sPI to hardware SPI?
>
> We have it working, no problems.
> http://www.ghielectronics.com/ALFAT-SD.htm
>
> Gus
>
> --- In lpc2000@lpc2..., "Atanas Tulbenski" <top4e@y...>
> wrote:
> >
> > I'm using SD card with LPC2124. At first I used software SPI and
> > everything was fine. When I start using hardware SPI got problem.
> The
> > SD card initializes, I can read serial numbers, but I cant read
> data
> > using CMD17. The card returns error code 0x04 "ilegal command".
> Any
> > sugestions?



Where can I buy SDIO connectors in retail quantity (1
or 2) In-store California or online?

Thanks,
-Mike.

--- Gus <gus_is_working@gus_...> wrote:
>
> check your polarity and idle state of SCLK. Why
> don't you scope it
> and compare sotware sPI to hardware SPI?
>
> We have it working, no problems.
> http://www.ghielectronics.com/ALFAT-SD.htm
>
> Gus
>
> --- In lpc2000@lpc2..., "Atanas Tulbenski"
> <top4e@y...>
> wrote:
> >
> > I'm using SD card with LPC2124. At first I used
> software SPI and
> > everything was fine. When I start using hardware
> SPI got problem.
> The
> > SD card initializes, I can read serial numbers,
> but I cant read
> data
> > using CMD17. The card returns error code 0x04
> "ilegal command".
> Any
> > sugestions? >
>
__________________________________
Yahoo! Messenger
Show us what our next emoticon should look like. Join the fun.
http://www.advision.webevents.yahoo.com/emoticontest




http://www.sparkfun.com/shop/index.php?shop=1&cart 4636&cat=1&itemid30&
http://www.sparkfun.com/shop/index.php?shop=1&cart 4636&cat=1&itemid31&


Mouser (www.mouser.com) has 17 items listed if you seach on mmc then drill
down to connectors.

A typical part is 688-SCDA1A0701. Cost is $2.16 for one.

-----Original Message-----
From: Michael Anburaj [mailto:embeddedeng@embe...]
Sent: Saturday, April 02, 2005 11:02 AM
To: lpc2000@lpc2...
Subject: Re: [lpc2000] Re: SD card problem! Where can I buy SDIO connectors in retail quantity (1
or 2) In-store California or online?

Thanks,
-Mike.

--- Gus <gus_is_working@gus_...> wrote:
>
> check your polarity and idle state of SCLK. Why
> don't you scope it
> and compare sotware sPI to hardware SPI?
>
> We have it working, no problems.
> http://www.ghielectronics.com/ALFAT-SD.htm
>
> Gus
>
> --- In lpc2000@lpc2..., "Atanas Tulbenski"
> <top4e@y...>
> wrote:
> >
> > I'm using SD card with LPC2124. At first I used
> software SPI and
> > everything was fine. When I start using hardware
> SPI got problem.
> The
> > SD card initializes, I can read serial numbers,
> but I cant read
> data
> > using CMD17. The card returns error code 0x04
> "ilegal command".
> Any
> > sugestions? >
>
__________________________________
Yahoo! Messenger
Show us what our next emoticon should look like. Join the fun.
http://www.advision.webevents.yahoo.com/emoticontest
Yahoo! Groups Links



Hi Atanas,
I am trying to initialize my Mini SD memory card in SPI mode
using LPC2129, but after lots of effort not able to do so. The SPI
bus is working with another SPI IC, i have tested it before
connecting to memory. I have incorporated corrections - Pull SSEL to
high and use another GPIO as SSEL.Every time i am getting response
0xFF from memory. Below is my code:
---------------------------------
void init_SPI0 (void)
{
PINSEL0 |= 0x00005500;
//Enable SPI0 pins
IODIR0 |= 0x00000001;
//Enable Chipselect pin as output

S0SPCCR = 0x0000001E;
//Set bit timing PCLK/30
S0SPCR = 0x000000A0;
//Configure as SPI Master interrupts enabled

IOSET0 |= CS; //Pull Chipselect high

}

void init_memory(void)
{
unsigned char txstatus, byteread;

IOCLR0 |= CS; //Pull Chipselect low

S0SPDR = 0x40;
while (!(S0SPSR & 0x80))
putchar('+');
txstatus = S0SPSR;
S0SPDR;
sprintf(str,"Transmit Status 0x40 %x\n",txstatus);
putstr(str);

S0SPDR = 0x00;
while (!(S0SPSR & 0x80))
putchar('+');
txstatus = S0SPSR;
S0SPDR;
sprintf(str,"Transmit Status 0x00 %x\n",txstatus);
putstr(str);

S0SPDR = 0x00;
while (!(S0SPSR & 0x80))
putchar('+');
txstatus = S0SPSR;
S0SPDR;
sprintf(str,"Transmit Status 0x00 %x\n",txstatus);
putstr(str);

S0SPDR = 0x00;
while (!(S0SPSR & 0x80))
putchar('+');
txstatus = S0SPSR;
S0SPDR;
sprintf(str,"Transmit Status 0x00 %x\n",txstatus);
putstr(str);

S0SPDR = 0x00;
while (!(S0SPSR & 0x80))
putchar('+');
txstatus = S0SPSR;
S0SPDR;
sprintf(str,"Transmit Status 0x00 %x\n",txstatus);
putstr(str);

S0SPDR = 0x95;
while (!(S0SPSR & 0x80))
putchar('+');
txstatus = S0SPSR;
S0SPDR;
sprintf(str,"Transmit Status 0x95 %x\n",txstatus);
putstr(str);

S0SPDR = 0xFF;
while (!(S0SPSR & 0x80))
putchar('.');;
txstatus = S0SPSR;
byteread = S0SPDR;
sprintf(str,"Byte Read %x\n",byteread);
putstr(str);
}
-----------------------------

If you have acheived this can you please help me in getting my card
initialized for SPI mode?

regards,
Sunil

--- In lpc2000@lpc2..., "Atanas Tulbenski" <top4e@y...>
wrote:
>
> I'm using SD card with LPC2124. At first I used software SPI and
> everything was fine. When I start using hardware SPI got problem.
The
> SD card initializes, I can read serial numbers, but I cant read
data
> using CMD17. The card returns error code 0x04 "ilegal command".
Any
> sugestions?


Hi Gus,
What should be the polarity and phase for SD memory card?

thanks,
Sunil --- In lpc2000@lpc2..., "Gus" <gus_is_working@y...> wrote:
>
> check your polarity and idle state of SCLK. Why don't you scope it
> and compare sotware sPI to hardware SPI?
>
> We have it working, no problems.
> http://www.ghielectronics.com/ALFAT-SD.htm
>
> Gus
>
> --- In lpc2000@lpc2..., "Atanas Tulbenski" <top4e@y...>
> wrote:
> >
> > I'm using SD card with LPC2124. At first I used software SPI
and
> > everything was fine. When I start using hardware SPI got
problem.
> The
> > SD card initializes, I can read serial numbers, but I cant read
> data
> > using CMD17. The card returns error code 0x04 "ilegal command".
> Any
> > sugestions?