SD Library with Mega card 2560

Sd2Card::init() return false;

it is failing at the below code

while ((status_ = cardCommand(CMD0, 0)) != R1_IDLE_STATE) { if (((uint16_t)(millis() - t0)) > SD_INIT_TIMEOUT) { error(SD_CARD_ERROR_CMD0); goto fail;

}

SS pin uses as 53 If any know what is this issue with, what could be wrong.

Note: The code works fine with UNO

Thank you in advance if you are responding.

Note: The code works fine with UNO

Really? Using pin 53 as the SS pin?

PaulS: Really? Using pin 53 as the SS pin?

I hope he has actually wired the CS of the SDCard to pin 53 on the Mega.

I think he listed his changes for the Mega, I do not think he meant the Uno has a pin 53.

ksolai: Sd2Card::init() return false;

it is failing at the below code

Note: The code works fine with UNO

Thank you in advance if you are responding.

Ksolai, The UNO and the MEGA use different pins for the SPI interface. The UNO uses 10..13, the MEGA uses 50..53. The ISP (6pin connector in the center of the board) has the same pinouts on both boards.

How have you connected your SDCard shield to the mega. If you are using a plugin shield that fits the UNO you will have problems using that shield on the MEGA unless is uses the 6pin header for SPI bus connection.

Please describe (schematic) how you have the MEGA connected to the SDCard shield.

Chuck.