Sign in

username:

password:



Not a member?

Search Comp.Arch.Embedded



Search tips

embedded by Keywords

68HC11 | 68HC12 | 8051 | 8052 | ARM | ARM7 | Asic | AT91 | AT91RM9200 | Atmel | AVR | AVRStudio | Bootloader | CFP | CompactFlash | Cygnal | Cypress | Dataflash | DSP | eCos | EEPROM | Embedded Linux | Emulator | Endian | Ethernet | Firewire | FPGA | Freescale | GCC | GNUARM | GSM | H8 | HDLC | I2C | Infineon | Interrupts | Java | JTAG | LCD | LED | LPC2000 | MCU | Microchip | MMC | MPLAB | MSP430 | PC104 | PCB | PCI | PCMCIA | PowerPC | Rabbit | RS232 | RS485 | RTOS | SBC | SDRAM | Sensor | SPI | STK500 | UART | UML | USART | USB | Verilog | VHDL | VxWorks | Xilinx

Ads

Discussion Groups

See Also

DSPFPGAElectronics

Discussion Groups | Comp.Arch.Embedded | SD card initialisation

There are 17 messages in this thread.

You are currently looking at messages 0 to 10.

SD card initialisation - Murray R. Van Luyn - 2008-12-01 01:57:00

Hi,

I'm trying to initialise a 2GB Transcend SD card with an AT89C51AC2.

I send CMD0 and get a 0x01 response. It's initialising...

Then I send 10 CMD55 messages and get no valid response (0xFF) each time.
I don't know why I don't get a 0x01 response here until the card has 
finished initialising?

Sound familiar to anyone?

Regards,
Murray R. Van Luyn. 





Re: SD card initialisation - Peter Jakacki - 2008-12-01 03:06:00

Murray R. Van Luyn wrote:
> Hi,
> 
> I'm trying to initialise a 2GB Transcend SD card with an AT89C51AC2.
> 
> I send CMD0 and get a 0x01 response. It's initialising...
> 
> Then I send 10 CMD55 messages and get no valid response (0xFF) each time.
> I don't know why I don't get a 0x01 response here until the card has 
> finished initialising?
> 
> Sound familiar to anyone?

You send CMD0 and that's fine but you need to send ACMD41 which is 
CMD55+CMD41 combo. I don't put a limit on the number of times I do this 
but depend upon a timeout instead. It depends upon the card.

*Peter*


Re: SD card initialisation - Murray R. Van Luyn - 2008-12-01 03:45:00

Thanks Peter.

It seems that I'm going to get a 0x01 response no matter how many times I 
issue CMD0.

Also, it seems that I'm going to get an invalid response (0xFF) no matter 
how many times I then issue CMD55.

Vexing!

Regards,
Murray R. Van Luyn.

"Peter Jakacki" <p...@gmail.com> wrote in message 
news:dWMYk.2320$E...@news-server.bigpond.net.au...
> Murray R. Van Luyn wrote:
>> Hi,
>>
>> I'm trying to initialise a 2GB Transcend SD card with an AT89C51AC2.
>>
>> I send CMD0 and get a 0x01 response. It's initialising...
>>
>> Then I send 10 CMD55 messages and get no valid response (0xFF) each time.
>> I don't know why I don't get a 0x01 response here until the card has 
>> finished initialising?
>>
>> Sound familiar to anyone?
>
> You send CMD0 and that's fine but you need to send ACMD41 which is 
> CMD55+CMD41 combo. I don't put a limit on the number of times I do this 
> but depend upon a timeout instead. It depends upon the card.
>
> *Peter*
> 



Re: SD card initialisation - Peter Jakacki - 2008-12-01 03:55:00

Murray R. Van Luyn wrote:
> It seems that I'm going to get a 0x01 response no matter how many times I 
> issue CMD0.
> 
> Also, it seems that I'm going to get an invalid response (0xFF) no matter 
> how many times I then issue CMD55.

Yes, of course, but read my previous post. BTW, 01 is the correct 
response for CMD0 then you move on to Acmd41 not CMD55 .

*Peter*

Re: SD card initialisation - Murray R. Van Luyn - 2008-12-01 04:18:00

Hi Peter,

Yes, I've issued CMD0, then CMD55 as a precursor to ACMD47. I never got past 
the CMD55 which results in the repeated invalid response. If I issue CMD0 
followed by ACMD47 I get the same invalid responses.

I've managed to get the SD card to respond to an MMC card CMD0 then CMD1 
initialisation sequence. That won't do as I'm writing code specifically for 
an SD card. Crumbs!

Regards,
Murray R. Van Luyn.

"Peter Jakacki" <p...@gmail.com> wrote in message 
news:2ENYk.2333$E...@news-server.bigpond.net.au...
> Murray R. Van Luyn wrote:
>> It seems that I'm going to get a 0x01 response no matter how many times I 
>> issue CMD0.
>>
>> Also, it seems that I'm going to get an invalid response (0xFF) no matter 
>> how many times I then issue CMD55.
>
> Yes, of course, but read my previous post. BTW, 01 is the correct response 
> for CMD0 then you move on to Acmd41 not CMD55 .
>
> *Peter* 



Re: SD card initialisation - Murray R. Van Luyn - 2008-12-01 04:29:00

Hi Peter,

If I misunderstand you correctly this sequence is wrong:

-------------------------------------------------------------------------------

    /* Send CMD55 to indicate that next command is application specific */
    /* MMC cards do not respond to this command */
    cmd[0] = SD_CARD_CMD55;
    cmd[5] = SD_CARD_CMD55_CRC;
    retries = 0;
    while(sd_card_write_command(cmd) != SD_CARD_NO_ERROR)
    {
        if(retries++ > 500)
        {
            SD_CARD_CS = 1;                  // Disable SD card
            return(SD_CARD_NOT_SD);          // No response - not an SD card
        }
    }

    /* Send ACMD41 SEND_OP_COND command */
    cmd[0] = SD_CARD_ACMD41;
    cmd[5] = SD_CARD_ACMD41_CRC;
    retries = 0;
    while(sd_card_write_command(cmd) != SD_CARD_NO_ERROR)
    {
        if(retries++ > 500)
        {
            SD_CARD_CS = 1;                 // Disable SD card
            return(SD_CARD_ERROR);          // No response
        }
    }
-------------------------------------------------------------------------------

What is the CMD55+CMD41 combo if it's not CMD55 (6 bytes beginning 0x37) 
followed by ACMD41 (6 bytes beginning 0x29)?

Regards,
Murray R. Van Luyn.

"Peter Jakacki" <p...@gmail.com> wrote in message 
news:2ENYk.2333$E...@news-server.bigpond.net.au...
> Murray R. Van Luyn wrote:
>> It seems that I'm going to get a 0x01 response no matter how many times I 
>> issue CMD0.
>>
>> Also, it seems that I'm going to get an invalid response (0xFF) no matter 
>> how many times I then issue CMD55.
>
> Yes, of course, but read my previous post. BTW, 01 is the correct response 
> for CMD0 then you move on to Acmd41 not CMD55 .
>
> *Peter* 



Re: SD card initialisation - Peter Jakacki - 2008-12-01 07:15:00

Uncluttering it and taking it from the top:

Quote from SANDISK Product Manual SD Card V2.2 final
- Section 3.4.1 Power Up

"ACMD41 is a special synchronization command used to negotiate the 
operation voltage range and to poll the cards until they are out of 
their power-up sequence. Besides the operation voltage profile of the 
cards, the response to ACMD41 contains a busy flag, indicating that the 
card is still working on its power-up procedure and is not ready for
identification. This bit informs the host that the card is not ready. 
The host has to wait (and continue to poll the cards, each one on his 
turn) until this bit is cleared. The maximum period of power up 
procedure of single card shall not exceed one second."

All ACMDs are just like a normal command except they are preceded by a 
CMD55. This is a sequence that only SD cards recognize and is not a 
feature of MMC just in case you are following MMC specs or some sample code.

ACMD41 for instance is equivalent to issuing CMD55, discard the result, 
issue CMD41 and return with that result.

BTW, you can ignore CRC as it is not needed in SPI mode, you only need 
it before you first switch to SPI mode so just use the value 0x95 as the 
CRC in each command (read the specs).

*Peter*




Murray R. Van Luyn wrote:
> Hi Peter,
> 
> If I misunderstand you correctly this sequence is wrong:
> 
> -------------------------------------------------------------------------------
> 
>     /* Send CMD55 to indicate that next command is application specific */
>     /* MMC cards do not respond to this command */
>     cmd[0] = SD_CARD_CMD55;
>     cmd[5] = SD_CARD_CMD55_CRC;
>     retries = 0;
>     while(sd_card_write_command(cmd) != SD_CARD_NO_ERROR)
>     {
>         if(retries++ > 500)
>         {
>             SD_CARD_CS = 1;                  // Disable SD card
>             return(SD_CARD_NOT_SD);          // No response - not an SD card
>         }
>     }
> 
>     /* Send ACMD41 SEND_OP_COND command */
>     cmd[0] = SD_CARD_ACMD41;
>     cmd[5] = SD_CARD_ACMD41_CRC;
>     retries = 0;
>     while(sd_card_write_command(cmd) != SD_CARD_NO_ERROR)
>     {
>         if(retries++ > 500)
>         {
>             SD_CARD_CS = 1;                 // Disable SD card
>             return(SD_CARD_ERROR);          // No response
>         }
>     }
> -------------------------------------------------------------------------------
> 
> What is the CMD55+CMD41 combo if it's not CMD55 (6 bytes beginning 0x37) 
> followed by ACMD41 (6 bytes beginning 0x29)?
> 
> Regards,
> Murray R. Van Luyn.
> 
> "Peter Jakacki" <p...@gmail.com> wrote in message 
> news:2ENYk.2333$E...@news-server.bigpond.net.au...
>> Murray R. Van Luyn wrote:
>>> It seems that I'm going to get a 0x01 response no matter how many times I 
>>> issue CMD0.
>>>
>>> Also, it seems that I'm going to get an invalid response (0xFF) no matter 
>>> how many times I then issue CMD55.
>> Yes, of course, but read my previous post. BTW, 01 is the correct response 
>> for CMD0 then you move on to Acmd41 not CMD55 .
>>
>> *Peter* 
> 
> 

Re: SD card initialisation - tporter - 2008-12-03 08:55:00

On Mon, 1 Dec 2008 17:45:59 +0900, "Murray R. Van Luyn"
<NOSPAM@NOSPAM> wrote:

>Thanks Peter.
>
>It seems that I'm going to get a 0x01 response no matter how many times I 
>issue CMD0.
>
>Also, it seems that I'm going to get an invalid response (0xFF) no matter 
>how many times I then issue CMD55.
>
>Vexing!
>
>Regards,
>Murray R. Van Luyn.
>
>"Peter Jakacki" <p...@gmail.com> wrote in message 
>news:dWMYk.2320$E...@news-server.bigpond.net.au...
>> Murray R. Van Luyn wrote:
>>> Hi,
>>>
>>> I'm trying to initialise a 2GB Transcend SD card with an AT89C51AC2.
>>>
>>> I send CMD0 and get a 0x01 response. It's initialising...
>>>
>>> Then I send 10 CMD55 messages and get no valid response (0xFF) each time.
>>> I don't know why I don't get a 0x01 response here until the card has 
>>> finished initialising?
>>>
>>> Sound familiar to anyone?
>>
>> You send CMD0 and that's fine but you need to send ACMD41 which is 
>> CMD55+CMD41 combo. I don't put a limit on the number of times I do this 
>> but depend upon a timeout instead. It depends upon the card.
>>
>> *Peter*
>> 
>
Typically, you issue a CMD0 20 or 30 times to reset the card (I'm not
worrying about MMC cards here). Then you can follow w/ either a CMD8,
which distinguishes between SD  +/- V2 cards, followed by the
CMD55/ACMD41 pair. 

Question I have for you is. do you see the exact same behavior whether
a card is inserted or not? I have seen what looks like go_idle_state
(CMD0) succeed) followed by fails on CMD55, which turned out to be a
physical problem w/ the SD socket - broken switch or a piece of junk
wedged near the bottom. 

Make sure the card is being electrically recognized before you start
worrying over the CMD returns.

Best, Tom

Re: SD card initialisation - Murray R. Van Luyn - 2008-12-05 07:20:00

"tporter" <t...@dtool.com> wrote in message 
news:h...@4ax.com...
> On Mon, 1 Dec 2008 17:45:59 +0900, "Murray R. Van Luyn"
> <NOSPAM@NOSPAM> wrote:
>
>>Thanks Peter.
>>
>>It seems that I'm going to get a 0x01 response no matter how many times I
>>issue CMD0.
>>
>>Also, it seems that I'm going to get an invalid response (0xFF) no matter
>>how many times I then issue CMD55.
>>
>>Vexing!
>>
>>Regards,
>>Murray R. Van Luyn.
>>
>>"Peter Jakacki" <p...@gmail.com> wrote in message
>>news:dWMYk.2320$E...@news-server.bigpond.net.au...
>>> Murray R. Van Luyn wrote:
>>>> Hi,
>>>>
>>>> I'm trying to initialise a 2GB Transcend SD card with an AT89C51AC2.
>>>>
>>>> I send CMD0 and get a 0x01 response. It's initialising...
>>>>
>>>> Then I send 10 CMD55 messages and get no valid response (0xFF) each 
>>>> time.
>>>> I don't know why I don't get a 0x01 response here until the card has
>>>> finished initialising?
>>>>
>>>> Sound familiar to anyone?
>>>
>>> You send CMD0 and that's fine but you need to send ACMD41 which is
>>> CMD55+CMD41 combo. I don't put a limit on the number of times I do this
>>> but depend upon a timeout instead. It depends upon the card.
>>>
>>> *Peter*
>>>
>>
> Typically, you issue a CMD0 20 or 30 times to reset the card (I'm not
> worrying about MMC cards here). Then you can follow w/ either a CMD8,
> which distinguishes between SD  +/- V2 cards, followed by the
> CMD55/ACMD41 pair.
>
> Question I have for you is. do you see the exact same behavior whether
> a card is inserted or not? I have seen what looks like go_idle_state
> (CMD0) succeed) followed by fails on CMD55, which turned out to be a
> physical problem w/ the SD socket - broken switch or a piece of junk
> wedged near the bottom.
>
> Make sure the card is being electrically recognized before you start
> worrying over the CMD returns.
>
> Best, Tom

Hi Tom,

Well the electrical interface is now 100% correct, thanks to your advice. 
I'm still getting no further than CMD8. There's still no reply from the SD 
card no matter how many times it's polled. As far as I'm concerned the 
signals being issued to the SD card are okay. I'm stumped!

Regards,
Murray R. Van Luyn. 



Re: SD card initialisation - Peter Jakacki - 2008-12-06 17:36:00

I have had problems with 2G cards which I suspect might not be SPI 
compatible, only SD compatible. However we could all be playing a never 
ending guessing game unless we have the same details you have such as 
the schematic and code and details of the exact card.

Of course you should be trying other cards which I assume you have done, 
it's one of the very first rules of troubleshooting to eliminate various 
factors and home in on the cause. Try a 1G card or smaller.

*Peter*

Murray R. Van Luyn wrote:
> Hi Tom,
> 
> Well the electrical interface is now 100% correct, thanks to your advice. 
> I'm still getting no further than CMD8. There's still no reply from the SD 
> card no matter how many times it's polled. As far as I'm concerned the 
> signals being issued to the SD card are okay. I'm stumped!

| 1 | 2 | next