I have modified the SD2pinmap.h lines 41 to 45 to this
// SPI port
uint8_t const SS_PIN = 49; // SC 53 or 49???
uint8_t const MOSI_PIN = 52; // data out
uint8_t const MISO_PIN = 50; //data in
uint8_t const SCK_PIN = 51; // CLK
I am trying to get the example SDfatinfo.pde to work, and modified the code from line 148 to 150.
pinMode(53, OUTPUT); // set the SS pin as an output (necessary!)
digitalWrite(53, HIGH); // but turn off the W5100 chip! (not applicable)
uint8_t r = card.init(SPI_HALF_SPEED, 53); // Use digital 53 as the SD SS line
Running the gets this reply in the serial monitor (comments were added manually and are the different cards
//32MB Cannon
card.init failed
SD error
errorCode: 2
errorData: FF
type any character to start
//2nd 32MB Cannon
card.init failed
SD error
errorCode: 2
errorData: FF
type any character to start
//128MB Kodak
init time: 344
Card type: SD1
readCID failedSD error
errorCode: F
errorData: FF
type any character to start
//2BG Kingston MicroSD+adapter
init time: 624
Card type: SD2
readCID failedSD error
errorCode: E
errorData: FF
type any character to start
//4GB PNY SHDC microsd+adpater
init time: 359
Card type: SDHC
readCID failedSD error
errorCode: E
errorData: 1F
Can someone help me pinpoint why I can't read the info of any of the cards?
I have spent an hour looking for furthur documentation on this and have found none.
I spent another hour using my minimal experience looking through the code in the libraries trying to find where the error codes come from and have only found a headache.
Could any of you guys who are more experienced take a look at this as I really am just as frustrated and lost as OP. [smiley=undecided.gif]
Thank you much Richard Crowley. Yet another reason to not debug at 4am. Mine is a 32MB Cannon and threw the same errorcode: 2 that dwjp902 got. Dunno how I missed that, but here it is for Dwjp902.
//32MB Cannon
errorCode: 2 /** CMD8 was not accepted - not a valid SD card*/
errorData: FF
//your card is probably too small or not configured correctly.
//2nd 32MB Cannon
errorCode: 2 /** CMD8 was not accepted - not a valid SD card*/
errorData: FF
//your card is probably too small or not configured correctly.
//128MB Kodak
errorCode: F /** timeout while waiting for start of read data */
errorData: FF
//try doing a FULL FORMAT and maybe increase the value of [uint16_t const SD_READ_TIMEOUT = 300;]
//2BG Kingston MicroSD+adapter
errorCode: E /** read CID or CSD failed */
errorData: FF
//no idea what this means. need to research.
//4GB PNY SHDC microsd+ adapter
errorCode: E /** read CID or CSD failed */
errorData: 1F
//no idea what this means. need to research.
ALSO, I noticed the following in SdCard.h
// define software SPI pins so Mega can use unmodified GPS Shield
/** SPI chip select pin */
uint8_t const SD_CHIP_SELECT_PIN = 10;
/** SPI Master Out Slave In pin */
uint8_t const SPI_MOSI_PIN = 11;
/** SPI Master In Slave Out pin */
uint8_t const SPI_MISO_PIN = 12;
/** SPI Clock pin */
uint8_t const SPI_SCK_PIN = 13;
I suggest you change that to this:
// define software SPI pins so Mega can use unmodified GPS Shield
/** SPI chip select pin */
uint8_t const SD_CHIP_SELECT_PIN = 53;//10; 53 or 49?
/** SPI Master Out Slave In pin */
uint8_t const SPI_MOSI_PIN = 52;//11;
/** SPI Master In Slave Out pin */
uint8_t const SPI_MISO_PIN = 50;//12;
/** SPI Clock pin */
uint8_t const SPI_SCK_PIN = 51;//13;
This isn't the first thread I have seen on this topic either. Usually the thread just dies after a while with no clear resolution. As soon as any of us get that thing working, please share a link to the library for download + how you made it work and/or a modified version of the library for simplicity. Solve this issue once and for all!
I got it to work, I changed the speed value to 1/4
pinMode(53, OUTPUT); // set the SS pin as an output (necessary!)
digitalWrite(53, HIGH); // but turn off the W5100 chip! (not applicable)
uint8_t r = card.init(SPI_QUARTER_SPEED, 53); // Use digital 53 as the SD SS line
and the info returned this
type any character to start
init time: 968
Card type: SD2
Manufacturer ID: 2
OEM ID: TM
Product: SA02G
Version: 0.3
Serial number: 1411765916
Manufacturing date: 5/2009
cardSize: 3854336 (512 byte blocks)
flashEraseSize: 128 blocks
eraseSingleBlock: true
part,boot,type,start,length
1,80,6,63,3854273
2,0,0,0,0
3,0,0,0,0
4,0,0,0,0
Volume is FAT16
blocksPerCluster: 64
clusterCount: 60215
fatStartBlock: 71
fatCount: 2
blocksPerFat: 236
rootDirStart: 543
dataStartBlock: 575
Data area is not aligned on flash erase boundaries!
Running the LS example with the modified quarterspeed, 53 line returns this
Type any character to start
Free RAM: 6942
Volume is FAT16
Files found in root:
128661~1.PNG 2010-10-09 04:31:54 306078
128902~1.JPG 2010-11-06 04:41:46 441175
EST.TXT 2010-11-21 04:25:44 0
Files found in all dirs:
128661~1.PNG
128902~1.JPG
EST.TXT
Done