| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| andreluizeng 
 
 
 Joined: 04 Apr 2006
 Posts: 117
 Location: Brasil
 
 
			        
 
 | 
			
				| SD Card Initialization problem |  
				|  Posted: Mon Mar 02, 2009 10:51 am |   |  
				| 
 |  
				| 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: 1660
 Location: Perth, Australia
 
 
			        
 
 | 
			
				| Re: SD Card Initialization problem |  
				|  Posted: Mon Mar 02, 2009 2:30 pm |   |  
				| 
 |  
				|  	  | 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
 
 
			        
 
 | 
			
				|  |  
				|  Posted: Mon Mar 02, 2009 4:31 pm |   |  
				| 
 |  
				| 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
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Mon Mar 02, 2009 5:43 pm |   |  
				| 
 |  
				| 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
 
 
			        
 
 | 
			
				|  |  
				|  Posted: Mon Mar 02, 2009 6:01 pm |   |  
				| 
 |  
				| 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
 
 
			        
 
 | 
			
				|  |  
				|  Posted: Mon Mar 02, 2009 6:04 pm |   |  
				| 
 |  
				| 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
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Mon Mar 02, 2009 6:28 pm |   |  
				| 
 |  
				| 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. 	  | andreluizeng wrote: |  	  | I measured 3.28V on SD card... after that Im sure that the supply voltage is not the problem. | 
 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: 1660
 Location: Perth, Australia
 
 
			        
 
 | 
			
				|  |  
				|  Posted: Mon Mar 02, 2009 7:55 pm |   |  
				| 
 |  
				| 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
 
 
			        
 
 | 
			
				|  |  
				|  Posted: Mon Mar 02, 2009 10:24 pm |   |  
				| 
 |  
				| 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
 
 
			        
 
 | 
			
				|  |  
				|  Posted: Mon Mar 02, 2009 10:47 pm |   |  
				| 
 |  
				| 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: 1660
 Location: Perth, Australia
 
 
			        
 
 | 
			
				|  |  
				|  Posted: Mon Mar 02, 2009 11:24 pm |   |  
				| 
 |  
				| 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 
 
 
 
 
 
 
 
			
			
			
			
			
			
			
			
			
 
 | 
			
				|  |  
				|  Posted: Mon Mar 02, 2009 11:36 pm |   |  
				| 
 |  
				| 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.
 |  | 
	
		|  | 
	
		|  |