EmbeddedRelated.com
Forums

SD CARDS

Started by Onestone February 8, 2012
Onestone :

> Any idea where I can get the full spec data sheet from without
> having to buy it?
>

Search for productmanualsdcardv2.2final.pdf

M.

Beginning Microcontrollers with the MSP430

I need to add, that I send 80 dummy clocks on the SPI before I send the
CMD0.

M.

Matthias Weingart :

> Al,
>
> you maybe have to wait some time until CMD0 is ready. I send the CMD0
> command several times until it is recognized by the card - timeout 1
> second. It is important that at least DAT3 and CMD (Pins 1 and 2) are at
> high level during power up of the card. However I have 330k Pullups on
> DAT0, DAT3 and CMD. DAT1 and DAT2 are not connected at all. I reduced
> clock speed to 100kHz during the initial commands also. Reason is during
> the initial CMD0 the cards responds with open drain outputs only. After
> init is completed, the card is switching to Push-Pull outputs and can
> handle 20MHz or more.
>
> M.
> Onestone :
>
>> Hi Dan, and thanks for replying. I have pull ups on the 2 'RSV' lines,
>> which, according to the reference I have is the requirement for SPI
>> mode, but information seems a little sparse. I have only been able to
>> get the simplified version of the spec and that doesn't actually show
>> the physcial layout. I have interface diagrams for several other brands
>> of cards and they all show no resistors (contrary to the Sd spec) I
>> quote the following:-
>>
>> floating when no card is inserted or when all card drivers are in a
>> high-impedance mode.
>> The host shall pull-up all DAT0-3 lines by RDAT, even if the host uses
>> SD Memory Card as 1 bit mode-only in SD mode. Also, the host shall
>> pull-up all "RSV" lines in SPI mode, even though they are not used.
>>
>> I am using Micro SD, and the above is from the data sheet for a MaxNova
>> card. Since the two RSV lines are DAT1 and DAT2 in SD mode I have taken
>> this to mean that these are the only lines that need to be pulled up
>> since the CMD line becomes MOSI, DAT3 becomes /CS and DAT0 becomes
>> MISO.
>>
>> I am beginning to suspect that you may be onto the issue though. Damn
>> it!! Any idea where I can get the full spec data sheet from without
>> having to buy it?
>>
>> Cheers
>> Al
>>
>> On 9/02/2012 1:28 PM, Dan Bloomquist wrote:
>>> Onestone wrote:
>>>> Hi I wonder if anyone out there has an explanation for the following
>>>> problem...
>>> I might have a reasonable guess. When I worked the sd card, (pretty
>>> sure it was a Kingston), it worked fine without pull ups on the unused
>>> pins. But F. Foust said in his paper that the pins 'must' be pulled up
>>> with 50k resistors. And I think he was using a sandisk card. Do you
>>> have pull ups?
>>>
>>> Best, Dan.
>>>
Hi Matt. many thanks for replying. I send anything from 80 to 160 clocks
to try and see what is happening, no difference. I am using micro SD so
the pins are different, and I run at 400kHz, which is the spec. I've
tried running lower speed, and no differece either. I think it will come
down to variances between cards, and some combination of pull-ups. I've
had david respond that he only needs 1 line puylled up and it wasn't
DAT3 or CMD, and his works with any card. So more fun ahead I guess. At
least my old Mobile phone had some use, the 2Gb card works beautifully!!

Cheers

Al

On 9/02/2012 7:16 PM, Matthias Weingart wrote:
> I need to add, that I send 80 dummy clocks on the SPI before I send the
> CMD0.
>
> M.
>
> Matthias Weingart:
>
>> Al,
>>
>> you maybe have to wait some time until CMD0 is ready. I send the CMD0
>> command several times until it is recognized by the card - timeout 1
>> second. It is important that at least DAT3 and CMD (Pins 1 and 2) are at
>> high level during power up of the card. However I have 330k Pullups on
>> DAT0, DAT3 and CMD. DAT1 and DAT2 are not connected at all. I reduced
>> clock speed to 100kHz during the initial commands also. Reason is during
>> the initial CMD0 the cards responds with open drain outputs only. After
>> init is completed, the card is switching to Push-Pull outputs and can
>> handle 20MHz or more.
>>
>> M.
>> Onestone:
>>
>>> Hi Dan, and thanks for replying. I have pull ups on the 2 'RSV' lines,
>>> which, according to the reference I have is the requirement for SPI
>>> mode, but information seems a little sparse. I have only been able to
>>> get the simplified version of the spec and that doesn't actually show
>>> the physcial layout. I have interface diagrams for several other brands
>>> of cards and they all show no resistors (contrary to the Sd spec) I
>>> quote the following:-
>>>
>>> floating when no card is inserted or when all card drivers are in a
>>> high-impedance mode.
>>> The host shall pull-up all DAT0-3 lines by RDAT, even if the host uses
>>> SD Memory Card as 1 bit mode-only in SD mode. Also, the host shall
>>> pull-up all "RSV" lines in SPI mode, even though they are not used.
>>>
>>> I am using Micro SD, and the above is from the data sheet for a MaxNova
>>> card. Since the two RSV lines are DAT1 and DAT2 in SD mode I have taken
>>> this to mean that these are the only lines that need to be pulled up
>>> since the CMD line becomes MOSI, DAT3 becomes /CS and DAT0 becomes
>>> MISO.
>>>
>>> I am beginning to suspect that you may be onto the issue though. Damn
>>> it!! Any idea where I can get the full spec data sheet from without
>>> having to buy it?
>>>
>>> Cheers
>>> Al
>>>
>>> On 9/02/2012 1:28 PM, Dan Bloomquist wrote:
>>>> Onestone wrote:
>>>>> Hi I wonder if anyone out there has an explanation for the following
>>>>> problem...
>>>> I might have a reasonable guess. When I worked the sd card, (pretty
>>>> sure it was a Kingston), it worked fine without pull ups on the unused
>>>> pins. But F. Foust said in his paper that the pins 'must' be pulled up
>>>> with 50k resistors. And I think he was using a sandisk card. Do you
>>>> have pull ups?
>>>>
>>>> Best, Dan.
>>>>
>>
Hi Al, do you send CMD0 several times? Take a look in ChaN's code:
http://elm-chan.org/fsw/ff/00index_e.html
However, good luck!

Matthias

Onestone :

> Hi Matt. many thanks for replying. I send anything from 80 to 160 clocks
> to try and see what is happening, no difference. I am using micro SD so
> the pins are different, and I run at 400kHz, which is the spec. I've
> tried running lower speed, and no differece either. I think it will come
> down to variances between cards, and some combination of pull-ups. I've
> had david respond that he only needs 1 line puylled up and it wasn't
> DAT3 or CMD, and his works with any card. So more fun ahead I guess. At
> least my old Mobile phone had some use, the 2Gb card works beautifully!!
>
> Cheers
>
> Al
>
> On 9/02/2012 7:16 PM, Matthias Weingart wrote:
>> I need to add, that I send 80 dummy clocks on the SPI before I send the
>> CMD0.
>>
>> M.
>>
>> Matthias Weingart:
>>
>>> Al,
>>>
>>> you maybe have to wait some time until CMD0 is ready. I send the CMD0
>>> command several times until it is recognized by the card - timeout 1
>>> second. It is important that at least DAT3 and CMD (Pins 1 and 2) are
at
>>> high level during power up of the card. However I have 330k Pullups on
>>> DAT0, DAT3 and CMD. DAT1 and DAT2 are not connected at all. I reduced
>>> clock speed to 100kHz during the initial commands also. Reason is
during
>>> the initial CMD0 the cards responds with open drain outputs only. After
>>> init is completed, the card is switching to Push-Pull outputs and can
>>> handle 20MHz or more.
>>>
>>> M.
>>>
>>>
>>> Onestone:
>>>
>>>> Hi Dan, and thanks for replying. I have pull ups on the 2 'RSV' lines,
>>>> which, according to the reference I have is the requirement for SPI
>>>> mode, but information seems a little sparse. I have only been able to
>>>> get the simplified version of the spec and that doesn't actually show
>>>> the physcial layout. I have interface diagrams for several other
brands
>>>> of cards and they all show no resistors (contrary to the Sd spec) I
>>>> quote the following:-
>>>>
>>>> floating when no card is inserted or when all card drivers are in a
>>>> high-impedance mode.
>>>> The host shall pull-up all DAT0-3 lines by RDAT, even if the host uses
>>>> SD Memory Card as 1 bit mode-only in SD mode. Also, the host shall
>>>> pull-up all "RSV" lines in SPI mode, even though they are not used.
>>>>
>>>> I am using Micro SD, and the above is from the data sheet for a
MaxNova
>>>> card. Since the two RSV lines are DAT1 and DAT2 in SD mode I have
taken
>>>> this to mean that these are the only lines that need to be pulled up
>>>> since the CMD line becomes MOSI, DAT3 becomes /CS and DAT0 becomes
>>>> MISO.
>>>>
>>>> I am beginning to suspect that you may be onto the issue though. Damn
>>>> it!! Any idea where I can get the full spec data sheet from without
>>>> having to buy it?
>>>>
>>>> Cheers
>>>> Al
>>>>
>>>> On 9/02/2012 1:28 PM, Dan Bloomquist wrote:
>>>>> Onestone wrote:
>>>>>> Hi I wonder if anyone out there has an explanation for the following
>>>>>> problem...
>>>>> I might have a reasonable guess. When I worked the sd card, (pretty
>>>>> sure it was a Kingston), it worked fine without pull ups on the
unused
>>>>> pins. But F. Foust said in his paper that the pins 'must' be pulled
up
>>>>> with 50k resistors. And I think he was using a sandisk card. Do you
>>>>> have pull ups?
>>>>>
>>>>> Best, Dan.
>>>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
Hi matthias, I don't see where he sends mu;ltiple CMD0, nor from all the
official documents I have seen do I see any suggestion that this should
be done. perhaps I'll try it and see what happens, but my gut feel is
still the pullups.

Cheers

Al

On 9/02/2012 10:06 PM, Matthias Weingart wrote:
> Hi Al, do you send CMD0 several times? Take a look in ChaN's code:
> http://elm-chan.org/fsw/ff/00index_e.html
> However, good luck!
>
> Matthias
>
> Onestone:
>
>> Hi Matt. many thanks for replying. I send anything from 80 to 160 clocks
>> to try and see what is happening, no difference. I am using micro SD so
>> the pins are different, and I run at 400kHz, which is the spec. I've
>> tried running lower speed, and no differece either. I think it will come
>> down to variances between cards, and some combination of pull-ups. I've
>> had david respond that he only needs 1 line puylled up and it wasn't
>> DAT3 or CMD, and his works with any card. So more fun ahead I guess. At
>> least my old Mobile phone had some use, the 2Gb card works beautifully!!
>>
>> Cheers
>>
>> Al
>>
>> On 9/02/2012 7:16 PM, Matthias Weingart wrote:
>>> I need to add, that I send 80 dummy clocks on the SPI before I send the
>>> CMD0.
>>>
>>> M.
>>>
>>> Matthias Weingart:
>>>
>>>> Al,
>>>>
>>>> you maybe have to wait some time until CMD0 is ready. I send the CMD0
>>>> command several times until it is recognized by the card - timeout 1
>>>> second. It is important that at least DAT3 and CMD (Pins 1 and 2) are
> at
>>>> high level during power up of the card. However I have 330k Pullups on
>>>> DAT0, DAT3 and CMD. DAT1 and DAT2 are not connected at all. I reduced
>>>> clock speed to 100kHz during the initial commands also. Reason is
> during
>>>> the initial CMD0 the cards responds with open drain outputs only. After
>>>> init is completed, the card is switching to Push-Pull outputs and can
>>>> handle 20MHz or more.
>>>>
>>>> M.
>>>>
>>>>
>>>> Onestone:
>>>>
>>>>> Hi Dan, and thanks for replying. I have pull ups on the 2 'RSV' lines,
>>>>> which, according to the reference I have is the requirement for SPI
>>>>> mode, but information seems a little sparse. I have only been able to
>>>>> get the simplified version of the spec and that doesn't actually show
>>>>> the physcial layout. I have interface diagrams for several other
> brands
>>>>> of cards and they all show no resistors (contrary to the Sd spec) I
>>>>> quote the following:-
>>>>>
>>>>> floating when no card is inserted or when all card drivers are in a
>>>>> high-impedance mode.
>>>>> The host shall pull-up all DAT0-3 lines by RDAT, even if the host uses
>>>>> SD Memory Card as 1 bit mode-only in SD mode. Also, the host shall
>>>>> pull-up all "RSV" lines in SPI mode, even though they are not used.
>>>>>
>>>>> I am using Micro SD, and the above is from the data sheet for a
> MaxNova
>>>>> card. Since the two RSV lines are DAT1 and DAT2 in SD mode I have
> taken
>>>>> this to mean that these are the only lines that need to be pulled up
>>>>> since the CMD line becomes MOSI, DAT3 becomes /CS and DAT0 becomes
>>>>> MISO.
>>>>>
>>>>> I am beginning to suspect that you may be onto the issue though. Damn
>>>>> it!! Any idea where I can get the full spec data sheet from without
>>>>> having to buy it?
>>>>>
>>>>> Cheers
>>>>> Al
>>>>>
>>>>> On 9/02/2012 1:28 PM, Dan Bloomquist wrote:
>>>>>> Onestone wrote:
>>>>>>> Hi I wonder if anyone out there has an explanation for the following
>>>>>>> problem...
>>>>>> I might have a reasonable guess. When I worked the sd card, (pretty
>>>>>> sure it was a Kingston), it worked fine without pull ups on the
> unused
>>>>>> pins. But F. Foust said in his paper that the pins 'must' be pulled
> up
>>>>>> with 50k resistors. And I think he was using a sandisk card. Do you
>>>>>> have pull ups?
>>>>>>
>>>>>> Best, Dan.
>>>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
jUST TRIED:-

a) multiple repeated CMD0
b) slowed clock from 400kHz to 100kHz
c) extended numer of 'wake up' clocks
d) all combos of above

No difference. Nokia works, Sandisk no works

Cheers

Al

On 9/02/2012 10:06 PM, Matthias Weingart wrote:
> Hi Al, do you send CMD0 several times? Take a look in ChaN's code:
> http://elm-chan.org/fsw/ff/00index_e.html
> However, good luck!
>
> Matthias
>
> Onestone:
>
>> Hi Matt. many thanks for replying. I send anything from 80 to 160 clocks
>> to try and see what is happening, no difference. I am using micro SD so
>> the pins are different, and I run at 400kHz, which is the spec. I've
>> tried running lower speed, and no differece either. I think it will come
>> down to variances between cards, and some combination of pull-ups. I've
>> had david respond that he only needs 1 line puylled up and it wasn't
>> DAT3 or CMD, and his works with any card. So more fun ahead I guess. At
>> least my old Mobile phone had some use, the 2Gb card works beautifully!!
>>
>> Cheers
>>
>> Al
>>
>> On 9/02/2012 7:16 PM, Matthias Weingart wrote:
>>> I need to add, that I send 80 dummy clocks on the SPI before I send the
>>> CMD0.
>>>
>>> M.
>>>
>>> Matthias Weingart:
>>>
>>>> Al,
>>>>
>>>> you maybe have to wait some time until CMD0 is ready. I send the CMD0
>>>> command several times until it is recognized by the card - timeout 1
>>>> second. It is important that at least DAT3 and CMD (Pins 1 and 2) are
> at
>>>> high level during power up of the card. However I have 330k Pullups on
>>>> DAT0, DAT3 and CMD. DAT1 and DAT2 are not connected at all. I reduced
>>>> clock speed to 100kHz during the initial commands also. Reason is
> during
>>>> the initial CMD0 the cards responds with open drain outputs only. After
>>>> init is completed, the card is switching to Push-Pull outputs and can
>>>> handle 20MHz or more.
>>>>
>>>> M.
>>>>
>>>>
>>>> Onestone:
>>>>
>>>>> Hi Dan, and thanks for replying. I have pull ups on the 2 'RSV' lines,
>>>>> which, according to the reference I have is the requirement for SPI
>>>>> mode, but information seems a little sparse. I have only been able to
>>>>> get the simplified version of the spec and that doesn't actually show
>>>>> the physcial layout. I have interface diagrams for several other
> brands
>>>>> of cards and they all show no resistors (contrary to the Sd spec) I
>>>>> quote the following:-
>>>>>
>>>>> floating when no card is inserted or when all card drivers are in a
>>>>> high-impedance mode.
>>>>> The host shall pull-up all DAT0-3 lines by RDAT, even if the host uses
>>>>> SD Memory Card as 1 bit mode-only in SD mode. Also, the host shall
>>>>> pull-up all "RSV" lines in SPI mode, even though they are not used.
>>>>>
>>>>> I am using Micro SD, and the above is from the data sheet for a
> MaxNova
>>>>> card. Since the two RSV lines are DAT1 and DAT2 in SD mode I have
> taken
>>>>> this to mean that these are the only lines that need to be pulled up
>>>>> since the CMD line becomes MOSI, DAT3 becomes /CS and DAT0 becomes
>>>>> MISO.
>>>>>
>>>>> I am beginning to suspect that you may be onto the issue though. Damn
>>>>> it!! Any idea where I can get the full spec data sheet from without
>>>>> having to buy it?
>>>>>
>>>>> Cheers
>>>>> Al
>>>>>
>>>>> On 9/02/2012 1:28 PM, Dan Bloomquist wrote:
>>>>>> Onestone wrote:
>>>>>>> Hi I wonder if anyone out there has an explanation for the following
>>>>>>> problem...
>>>>>> I might have a reasonable guess. When I worked the sd card, (pretty
>>>>>> sure it was a Kingston), it worked fine without pull ups on the
> unused
>>>>>> pins. But F. Foust said in his paper that the pins 'must' be pulled
> up
>>>>>> with 50k resistors. And I think he was using a sandisk card. Do you
>>>>>> have pull ups?
>>>>>>
>>>>>> Best, Dan.
>>>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
On 02/08/2012 11:43 PM, Onestone wrote:
> Hi David. I have the clock cranking up to 8MHz after initialisation, but
> don't have a pull up on D0, only the 2 pins labelled as RSV. maybe that
> is an issue. Damned tiny to solder a pull up there in retrospect though
> when I'm using a microSD and push-pull style holder. Add to that bad
> coordination and shakes due to a buggered spine and it may be time to
> build a new board! Thanks for the insights so far.
>
> cheers
>
> Al

A quick glance at the data sheet for the MSP430F2274 you mentioned
indicates that the pins have built in pull up/down resistors that you
can enable. No external parts required.
--
David W. Schultz
http://home.earthlink.net/~david.schultz
"Put down that pickle!"
The internals pull ups don't seem to work when the pins are in 'special
modes, ie when set to the SPI function. i discovered this some time ago
on another 2xxx part, and wasn't impressed.

Al

On 10/02/2012 12:09 AM, David W. Schultz wrote:
> On 02/08/2012 11:43 PM, Onestone wrote:
>> Hi David. I have the clock cranking up to 8MHz after initialisation, but
>> don't have a pull up on D0, only the 2 pins labelled as RSV. maybe that
>> is an issue. Damned tiny to solder a pull up there in retrospect though
>> when I'm using a microSD and push-pull style holder. Add to that bad
>> coordination and shakes due to a buggered spine and it may be time to
>> build a new board! Thanks for the insights so far.
>>
>> cheers
>>
>> Al
> A quick glance at the data sheet for the MSP430F2274 you mentioned
> indicates that the pins have built in pull up/down resistors that you
> can enable. No external parts required.
I'm running into the exact same circumstances; a product using a 2GB microSD card in SPI mode fails to recognize the card. I specified SanDisk cards because they were the most reliable in my testing, but now a large percentage of SanDisk cards are failing.

In my case, the cards usually initialize correctly, but reading the boot sector fails CRC checks. My code then rejects the card.

In the debugger, I performed hundreds of reads of the boot sector, and would get a few corrupt bytes in varying locations, regardless of the SPI clock speed. If I ignore the CRC error, I just get invalid reads of the FAT.

I have another product that uses 1-bit SD mode (on-chip SD peripheral); all the cards that fail in SPI mode work correctly in the SD-mode product.

I don't think it has ever been officially established as to whether microSD cards MUST support SPI; I am beginning to suspect that the SPI functionality is still present in most microSD cards, but is no longer tested or otherwise validated.

It's also getting very difficult to find 2GB cards at brick & mortar retailers.

--Gene

--- In m..., Onestone wrote:
>
> The internals pull ups don't seem to work when the pins are in 'special
> modes, ie when set to the SPI function. i discovered this some time ago
> on another 2xxx part, and wasn't impressed.
>
> Al

--- In m..., Onestone wrote:
>
> jUST TRIED:-
>
> a) multiple repeated CMD0
> b) slowed clock from 400kHz to 100kHz
> c) extended numer of 'wake up' clocks
> d) all combos of above
>
> No difference. Nokia works, Sandisk no works
>
> Cheers
>
> Al

WOW, I thought when did this I had problems.

At this point I would check the card in a PC.
Check another Sandisk card, first in a PC, then in the project.

Good Luck