We put our sd card reader with sd card on arduino due. Used the list files example and it works fine. Now when we put the same reader on the mega 2560 and change the listfiles example to pinMode, 53, OUTPUT) and sd.begin(53) it doesn't work anymore.
Post a link to the SD board. Some SD boards don't have a logic level converter. The Due is a 3.3v processor. The Mega is a 5v processor. Putting 5 volts from the Mega digital pins into 3.3v inputs on the SD card can cause the SD card to fail.
The sd card module has a level convertor and 3.3 and 5v power pins. Its a Lc studio. Www.lcsoft.net.
This board? It doesn't have a logic level converter. http://www.lctech-inc.com/Hardware/Detail.aspx?id=0c3b6f7a-d101-4a60-8b56-3abfb7fd818d
It appears this board doesn't either. http://www.lctech-inc.com/Hardware/Detail.aspx?id=27e765c5-7052-46d7-846b-338e6b74495b
Is there another SD board on that site?
It's the first one. We did have it working on the arduino mega 2560 before. On another board
That board does not have a logic level converter. If you look at a schematic, the resistors are pullup resistors connected to the 3.3v bus. You are putting 5 volts into a 3.3 volt input.
It may run on some Arduinos, and fail on others, but eventually it will cause the SD card inputs or Arduino outputs to fail permanently.
Do u know one that does work on arduino mega 2560?
This has a logic level converter. http://www.adafruit.com/products/254
Doesn't the arduino mega 2560 run on 5v? We need it to work on arduino mega 2560.
dennizr: Doesn't the arduino mega 2560 run on 5v? We need it to work on arduino mega 2560.
Yes, the Mega2560 (like I use) runs on 5 volts, and has 5 volt outputs. I use the ethernet shield (has logic level converters for the SD card) and the SD cards work fine on it.
That breakout board from Adafruit will work with 3.3v and 5v processors.
I use this low cost shield on Mega. It stacks with other shields, has level shifters and connects to the ISP for SPI.
The same company makes this microSD module but early versions have a problem sharing the SPI since the MISO line is not released by a level shifter on MISO. If you only use the SPI for an SD card, this works fine.
Both have a IC buffer on MISO, the first shield disables the buffer when SD select is high, the microSd module in early versions always has the buffer enabled. Too bad ebay sellers don’t provide the version for the microSD module, later versions are nice.
I ran into a similar problem with my SD shield: it worked great on my Arduino Uno, but wouldn't work on my Arduino Mega 2560 Rev 3.
The problem for me was that the SPI pins in the Mega are different pin numbers than in the Uno. See the SPI library documentation for details.
I found two solutions: a software one and a hardware one.
The hardware solution: rewire the SPI pins between the Arduino and the shield so that the Mega's SPI pins appear at the Uno pin numbers for the shield. There are products that do this: I bought a Sparkfun TransmogriShield to fit between the Mega and the SD shield, and it works fine.
The software solution (if you don't want the hardware solution): In the SD library, in file Sd2Card.h, change MEGA_SOFT_SPI to 1 (rather than 0). Then restart your Arduino IDE.
In either case, as described in the documentation, set the appropriate Chip Select pin for the SD card. For mine it's pinMode(8, OUTPUT) and SD.begin( 8 )
Note: The software solution turns on software SPI in the SD library. I didn't find similar Mega soft SPI support for Wifi, which is why I went with the hardware solution for my SD + Wifi shield.
I hope this helps.