View previous topic :: View next topic |
Author |
Message |
ktallevi
Joined: 17 Dec 2005 Posts: 58
|
SD Card Init problem |
Posted: Fri May 30, 2008 9:20 am |
|
|
I am attempting to use the ex_fat.c sample from CCS with a microSD card. All the connections are wired up correctly to the SPI port. I have 100k pull up resistors on DI, DO, and CS lines.
During the sd card init routine, the cards all return '80' (using kingston 2gb, and a 512mb card).
I do not believe this is a correct response for the sd card init routine. Any attempt to do a 'dir' command returns nothing.
Any clues as to what the problem might be?
--
Compiler version: 4.068
PIC18F87J50
Xtal: 12MHz |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Fri May 30, 2008 10:30 am |
|
|
0x80 == RESP_TIMEOUT
There was a timeout in communication with the card. The init failed so performing a DIR command is pointless.
Note that for microSD cards the SPI interface is optional (compulsory for SD cards). Most cards available now do (still) support it but you should be aware of this risk if you are creating a commercial product.
Considering you have the same error with two different cards on untested hardware I suspect you have a hardware problem.
Some of the most common mistakes:
- No pull-up on the CMD line (4.7k to 100k) and DAT lines (50k to 100k). No pull-up on the CLK line!
- Data lines straight instead of crossed. Data-out of the PIC should go to Data-In of CSD (Pin2). Data-Out of CSD (pin 7) should go to PIC Data-In.
- Memory card running at too high voltage (never higher than 3.3V, some cards need lower).
- PIC running at 5V and card at 3.3V without voltage translation glue-logic present. (a very common error on this forum). |
|
|
ktallevi
Joined: 17 Dec 2005 Posts: 58
|
|
Posted: Fri May 30, 2008 10:40 am |
|
|
I double checked all the hardware, I am not making any of the common mistakes you had mentioned.
Perhaps these cards, which per purchased recently do not support SPI mode. I could try to use 1 bit SD mode, or 4 bit SD mode, although I don't recall seeing any sample code for that anywhere on the forums.
Anyways everything is running at 3.3v in the circuit, and all the pull-up resistors are present. |
|
|
ktallevi
Joined: 17 Dec 2005 Posts: 58
|
|
Posted: Fri May 30, 2008 12:51 pm |
|
|
After further examination it turns out there is only 1.7v coming out of the Data-out pin from the SD card. I have as 100k pull-up resistor to 3.3v. All the other connections on the SD card that have pull-up resistors have the correct 3.3v.
I don't have any series resistors on the Data-out line so I'm not sure why the voltage is so low.
This could be why there is a timeout on the response as the PIC needs at least 2v to read a logic high. |
|
|
|