Hi all,
I recently ran into a strange problem. When I use my Mega 2560 and the DumpFile.ino sketch (from the SD library examples) to read from an SD card, all goes well, and the Serial Monitor shows the files contents.
However, this only seems to work when connected to the USB ports on the front of my pc, otherwise I get the "Initializing SD card...Card failed, or not present" error message. This puzzles me, as:
The Mega is connecting fine to the pc serial port: as the error messages are comming through.
The USB port shouldn't affect the way the program/Mega interacts with the SD card module?
Can anyone shed any light on why using different serial ports changes the way the Mega reads SD cards?
Maybe not, of the SD card is on the ethernet shield. Some of the USB ports may be borderline on power.
That was the point of requesting the link to the SD card reader. If it is an ethernet shield, power is not the only problem. If the OP is using a Mega, the w5100 slave select (D10) is left floating by the code. That will cause the same problem.
edit: Actually, that code is worse. It sets D10 as OUTPUT, but doesn't set it HIGH, which leaves the w5100 SPI active.
I was powering it off the 3.3vpin , so I'm assuming that as others speculated, I was pulling too much current. I was amazed at how much power an SD card can suck! I was horrified to see that the max draw on the Mega's 3.3v pin is only 50mA, so the lesson I've learned is RTFM...!
Still a mystery why is worked on some usb ports and not others though...?