CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Best utility for formatting SD Memory Card ?
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Ttelmah



Joined: 11 Mar 2010
Posts: 20058

View user's profile Send private message

PostPosted: Mon Sep 04, 2017 9:06 am     Reply with quote

Form the SD spec:

"All hosts shall provide pull-up resistors on all data lines DAT[3:0] as described in section 6 of the SD Physical Specification Version 1.10."

This actually ensures the lines do not float.

The pull up is also required to protect the lines from floating (another thing that can lead to excessive consumption), when the card is removed.

Table 53, specifies a maximum resistance of 100K, and a minimum of 10K on the CMD line and all four data lines.

"RDAT and RCMD are pull-up resistors protecting the CMD and the DAT lines against bus floating when no card is inserted or when all card drivers are in an 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."

Note the 'shall'.

I wonder what 'dollar' he is actually using?. The prices mention seem very high. Genuine Kingston 2GB SD cards sell in one off from the manufacturer in the UK, for less than 5$ US, falling if you buy ten off.
It'd seem he could save more money by getting somebody to shop around.
soonc



Joined: 03 Dec 2013
Posts: 215

View user's profile Send private message

PostPosted: Mon Sep 04, 2017 10:25 am     Reply with quote

Ttelmah wrote:
Form the SD spec:

"All hosts shall provide pull-up resistors on all data lines DAT[3:0] as described in section 6 of the SD Physical Specification Version 1.10."

This actually ensures the lines do not float.

The pull up is also required to protect the lines from floating (another thing that can lead to excessive consumption), when the card is removed.

Table 53, specifies a maximum resistance of 100K, and a minimum of 10K on the CMD line and all four data lines.

"RDAT and RCMD are pull-up resistors protecting the CMD and the DAT lines against bus floating when no card is inserted or when all card drivers are in an 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."

Note the 'shall'.

I wonder what 'dollar' he is actually using?. The prices mention seem very high. Genuine Kingston 2GB SD cards sell in one off from the manufacturer in the UK, for less than 5$ US, falling if you buy ten off.
It'd seem he could save more money by getting somebody to shop around.


Prices: I did specify..... US Dollar "the ATP costs me US$24.95" 10pcs price is actually US$24.7817 Each. DigiKey are hard nosed... The Suffix on most of their parts is -ND meaning NO DISCOUNT...

The link is too long but here is the DigiKey part number:
Digi-Key Part Number for 2GB ATP MicroSD SLC Industrial Temp. Range AF2GUDI-OEM-ND

The Regular size SD card part number AF2GSDI-OEM-ND 60pcs price is
US$29.5236 .... Notice how they price down to 1/10000th of a dollar !

They know there are fake cards out there and OEM like me dare not touch them, so discount is hard to come by ! If I want to buy 5K or more they will actually talk to me on the phone...!

I'm reading the SD 2.01 specs

6.4.1.4 ... Power up Ramp (5) after VDD stable time, host provides at least 74 clocks before issuing the first command.

(my comment) as I said After I did the 80 clocks thing started to work ! They are missing from the CCS code and should be in there.

6.4.1.5 .... During power done, DAT, CMD, and CLK should be disconnected or driven to logical 0 by the host. !
I need to check if that's being done.

My scope is capable of of capturing 14 pico seconds edges.... My SPI lines are clean, and ripple on the Vdd is low. BTW they are clean with or without pull up R's.

I also searched the Version 6.0 Physical Layer Spec. and did not find the "SHALL" and very little mention of pull up resistors.

Can you please point me to the document where it discusses pull up resistors.
soonc



Joined: 03 Dec 2013
Posts: 215

View user's profile Send private message

PostPosted: Mon Sep 04, 2017 10:31 am     Reply with quote

temtronic wrote:
This post is a classic 'should have left well enough alone' nightmare. While my 'business' hat sees the save $5 per unit is good, the 'tech' hat sees a LOT of $$ wasted on precious R&D time. That $5,000 'saved' by the new device is 50 hrs to me,so 4 days, more or less, for ONE person.
You should consider buying the more expensive part. It would allow you time to R&D while those 1,000 units get shipped out. I don't know if 1,000 is a weeks sales, month or year BUT using a known good device does get the product out the door, into the client's hands and his cash in yours.
The FIRST thing I do when a client asks for 'cost reduction' is to spend a day doing the 'numbers'. Reading a lot(like part availability((2nd source?)), deciding if a new PCB needs to be made($$), parts pricing($/1,000 vs $/5,000) and then the R&D required( double that time!).
I find it scary that there ARE fake chips out there, buy those and ALL profits can be wiped out.
What I'm saying is , it's better to go with what you KNOW works. When(if !) you have time, then play with new devices to see IF you can save.

Have you kept a log of all the time you have spent on this? Research of the chips, buying,bench testing, posting here ? It ALL should be accounted for and the time spent may suprise you.

Jay


I agree and I had already reached that decision yesterday: quote my old post:
"I need to use what works so ATP card it is."
Thanks... I do a lot of price searching. We are not a fortune 500 company ! $5K is worth trying to save.... I will never use fake card that's why I have to base my pricing on good vendors like DigiKey etc.
Thanks for your input.
Ttelmah



Joined: 11 Mar 2010
Posts: 20058

View user's profile Send private message

PostPosted: Mon Sep 04, 2017 11:36 am     Reply with quote

On the card pricing, I found it cheaper to buy Kingston cards from their own retail shop than from their 'suppliers'...

In V6 specification, you will find it says 'the host shall not leave these unused lines floating". Note the 'not'....
The requirement to keep the PIC DI line from floating is a general one that any undriven line should be biased high or low when it is undriven (when the card is removed).
soonc



Joined: 03 Dec 2013
Posts: 215

View user's profile Send private message

What really was the problem.... !
PostPosted: Sat Sep 09, 2017 10:17 pm     Reply with quote

In the final analysis the reason for success and failure with several different cards is really due to the mmcsd.c does not comply with the recommend initialization requirements for modern SD cards.

It is MANDATORY to issue at least 74 clocks to switch ANY SD card into SPI Mode.

The mmcsd.c does not do the "at least 73 clocks". During my initial trials I noted that after
I added code to send 80 clocks things started to work.

This begs the question how can other people get mmcsd.c to work at all?

Frankly I don't know: I do know once I sent 80 clocks the card started to respond.

The next big thing wrong with mmcsd.c is the lack of sending CMD8 after successful CMD0.

Version 2.00 or later compliant Cards will most likely fail using the standard mmcsd.c code
because CMD8 is not in the code.
I think the mmcsd.c is really oriented towards the MMC cards.

Some of the cards I have require the CMD8.

Cards that may not be 2.00 or later compliant will succeed without CMD8, and fail with CMD8 which is the signal to proceed with the code as if the card if less than V2 compliant or is a MMC card.

That was the case with the one card I have that always worked, and the others were V2 compliant and failed.

So basically all the suggestions about poor hardware were simply WRONG but may help in
situations where circuit board layout and power supply are lacking proper design.

As I said at the time that was not the issue in my particular case.

If using HARDWARE SPI mode Pull up Resistors are NOT required if the supply and board layout are done properly.

Referring to Elm-Chan's excellent page on how to use the SD card he recommends a single pull-up on
the DO line or some SD card may not initialize. All of my cards initialized but failed
because of the other reasons stated above.

My comment: I suspect (but cannot prove) when SOFTWARE SPI mode is used on a non-spi compliant port pin the resistor compensates for the improper output driver that most SPI compliant ports have.

Link to Elm-Chan: http://elm-chan.org/docs/mmc/mmc_e.html

Link to SPI Flow Chart: http://elm-chan.org/docs/mmc/pic/sdinit.png

My lesson learned is: READ THE SPEC..... !

I was in a hurry and as is the case "the hurrier I go the slower I gets there."

Thanks for all the help and suggestions.
asmallri



Joined: 12 Aug 2004
Posts: 1663
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

Re: What really was the problem.... !
PostPosted: Sun Sep 10, 2017 12:01 am     Reply with quote

soonc wrote:


If using HARDWARE SPI mode Pull up Resistors are NOT required if the supply and board layout are done properly.


The above is NOT correct. A properly laid out board without pull-up resistors is just as likely to fail in this scenario. The receive input SDI on a PIC aka MISO does not have a pull-up resistor. The input is floating. The SO pin from the card is open drain until the card is put into SPI mode. It may work with some cards and not with others.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Ttelmah



Joined: 11 Mar 2010
Posts: 20058

View user's profile Send private message

PostPosted: Sun Sep 10, 2017 12:43 am     Reply with quote

and on the74 clock, yes it is mandatory to issue this many clocks, but there is a section in the SD paperwork that says it is acceptable to do this by issuing repeated status fetches from the chip. I must admit I prefer to see the code issue 74 simple fetches, and only then ask for he status, but is is acceptable to do it the way CCS does it....
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group