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

SD Card Initialization problem

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
andreluizeng



Joined: 04 Apr 2006
Posts: 117
Location: Brasil

View user's profile Send private message Send e-mail MSN Messenger

SD Card Initialization problem
PostPosted: Mon Mar 02, 2009 10:51 am     Reply with quote

Hi,

I have two boards to work with sd/mmc card with different pics, board 1 has 18f2620 and board 2 18f4620, both running at 10Mhz (or even 40Mhz pll) with 3.3V. Also I have 3 sd cards: nokia micro sd 256mb, sandisk micro sd 2GB and Kingston SD 2GB.

In board 1 (with 18f2620) I've tested these sd cards and I had success in all three.

but in Board 2 (18f4620) only the micro sds worked. Kingston 2GB doesn't work at all. And in a deeper analysis I found out that Kingston sd card never leaves idle state, and the worst thing is... after sending cmd0 and then cmd1 (cmd55+acmd41) the sd cards respond with 0x01 (idle state) two or three times then the sd card just respond with 0xff. Somebody just experienced this problem too ? What could be causing that? bad pcb layout or sd connector ?

Hope someone can help.

thanks in advance.

Andre
_________________
Andre
asmallri



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

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

Re: SD Card Initialization problem
PostPosted: Mon Mar 02, 2009 2:30 pm     Reply with quote

andreluizeng wrote:
Hi,

I have two boards to work with sd/mmc card with different pics, board 1 has 18f2620 and board 2 18f4620, both running at 10Mhz (or even 40Mhz pll) with 3.3V.


How are you getting 40MHz at 3.3 volts with these PICs?

Post a link to your SD interface schematics.
_________________
Regards, Andrew

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



Joined: 04 Apr 2006
Posts: 117
Location: Brasil

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Mon Mar 02, 2009 4:31 pm     Reply with quote

asmallri

dont worry about 40MHz, Im using only 10MHz... a part of my schematic can be viewed in this link:

http://img211.imageshack.us/img211/8601/board1.jpg


this is for board 1 with pic18f2620 the difference from another board is that I have some dipswitches between PIC´s pin and the peripherel connected on it.

I just got more 4 cards to test following by:

Vendor Type Size Result

1 - Lexar professional SD Card 1GB Success
2 - Cannon SD Card 32MB Success
3 - Sandisk MMC Card 32MB Success
4 - Kingston Micro SD 2GB Failure


I dont understand.. Im just having problems with Kingston cards =(

and the result was the same.. after a few answers (0x01) after CMD1 (or CMD55 + ACMD4) the card stop responding (0xff).

thanks in advance.

regards.
_________________
Andre
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Mon Mar 02, 2009 5:43 pm     Reply with quote

You are switching the power to the SD card by a transistor. The minimum allowed voltage for these cards is 2.7V.
3.3V - Vce voltage of 0.6V = 2.7V

In theory this should be OK, but you have no error margin. It is a simple test to replace the transistor by a jumper.

Are you using the code as posted in http://www.ccsinfo.com/forum/viewtopic.php?t=37463 ?
Read my comments in that thread.
andreluizeng



Joined: 04 Apr 2006
Posts: 117
Location: Brasil

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Mon Mar 02, 2009 6:01 pm     Reply with quote

ckielstra

I measured 3.28V on SD card... after that Im sure that the supply voltage is not the problem.


thanks

regards.
_________________
Andre
andreluizeng



Joined: 04 Apr 2006
Posts: 117
Location: Brasil

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Mon Mar 02, 2009 6:04 pm     Reply with quote

ckielstra

I made a little modification in this code.. the way that Im sending commands and treating the responses... but In both cases I´ve got the same problem with Kingston Cards.


regards.
_________________
Andre
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Mon Mar 02, 2009 6:28 pm     Reply with quote

andreluizeng wrote:
I measured 3.28V on SD card... after that Im sure that the supply voltage is not the problem.
Did you use a scope for measuring the voltage? Average current consumption for the card will be low, but peak currents could cause voltage drops.
Thinking about it, it would be good design to add a 100nF capacitor to the low side of the transistor.
asmallri



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

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

PostPosted: Mon Mar 02, 2009 7:55 pm     Reply with quote

I suspect your power supply switching logic is the culprit. The circuit is too close to the tolerances - its operation is dependant on HFE of the transistor. To test this theory, short out the emitter-collector.

Logically you would expect the current consumption to be higher on the higher capacity cards however the age of the respective implementation means we cannot assume that is the case.

I have tested Kingston cards without problem and if you are 100% sure your 2620 implementation works, then I would be examining the hardware implementation in greater detail.
_________________
Regards, Andrew

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



Joined: 04 Apr 2006
Posts: 117
Location: Brasil

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Mon Mar 02, 2009 10:24 pm     Reply with quote

Ok, I will make these modifications and see what will happen.

thanks again, you are helping me a lot, I will post results as soon as I can


regards.
_________________
Andre
andreluizeng



Joined: 04 Apr 2006
Posts: 117
Location: Brasil

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Mon Mar 02, 2009 10:47 pm     Reply with quote

You were right guys... the problem was in my switching logic... kingston was not hanging out on the edge, when I made the jumper on transistor and it worked. Now Ill try to fix it in a better way is possible, since this circuit is already mounted in a pcb.

thanks again for helping.

regards.
_________________
Andre
asmallri



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

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

PostPosted: Mon Mar 02, 2009 11:24 pm     Reply with quote

Try a 1K base resistor instead of 2.2K
_________________
Regards, Andrew

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








PostPosted: Mon Mar 02, 2009 11:36 pm     Reply with quote

asmallri

it worked with 1k5, thanks a lot.

now im going to bed and try to sleep a little, 2:22 am here, and I need to wake up early to go to work... what im doing here is just for fun =)

best regards.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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