On my Arduino UNO it works fine but the same code doesnt work on my Mega.
So it can`t be a damaged Reader or SD Card.
For my Mega I changed the SPI Pins from 10-13 -> 50-53 but it doesnt help. If I let the pins to 10-13, ist also doesnt work.
I also tried a level shifter 5V->3.3V.
I tried different things four hours but I can`t get the SD work on a Mega.
Here are the code that works on my UNO but not on MEGA:
#include <SD.h>
#include <SPI.h>
void setup()
{
Serial.begin(115200);
//Init SD_Card
pinMode(10, OUTPUT); //<--- changed to 53 at Mega
digitalWrite(10, HIGH); //<--- changed to 53 at Mega
if (!SD.begin(10))
{
Serial.println("SD Card Init failed");
}
else
{
Serial.println("SD Card works");
}
}
This might not be the most elegant solution but for SD cards (like the Adafruit Wave Shield), I keep the SD card shield on an Uno and communicate back and forth with a Mega using all the handy extra hardware Serial ports. Not sure if this is desirable option to you or possible, but it gets the job done.
Specifically, on the Mega, the Adafruit Wave Shield that uses the SD library, doesn't work. The SD card attaches to the SPI bus on pins 11, 12, 13 and 4 on the Uno, and 50-53 on the Mega. It can be changed by editing the necessary library and rewiring the shield to work on the Mega from what I understand. For my purposes though, I have found it easier to use the extra hardware serial ports on the Mega to send chars (I used every one available in the ASCII table for something, including a service mode) to the UNO with the Wave Shield attached as it was designed for.
In short, I guess it was more to do with the physical footprint of the SD card being used in a shield, as opposed to maybe a breakout board where I suppose it's easy to wire up as needed.
Yes, looks like the Wave Shield does indeed have that, thanks! I might consider that option in the future and just run female to male jumper wires to the SPI pins on the Mega.