Go Down

Topic: Mega r3 microSD card not initialising - CardInfo (Read 136 times) previous topic - next topic

trullt

Hello

I'm struggling to get a microSD card to work on the hardware pins of a Mega 2560 r3 board. SoftwareSPI appears to test OK, and the card/reader works just fine on an Uno (hw pins) so I don't think the Reader is at fault.

Gear:
New SanDisk 16Gb microSD card formatted using SD Card Formatter 5.0.0 by Tuxera
Geekcreit Mega 2560 hooked up via USB to Win10 IDE 1.6.12
RobotDyn SD reader  http://www.ebay.co.uk/itm/Micro-SD-Card-Reader-Module-for-Arduino-Raspberry-Pi-PIC-RobotDyn-/131844235419 hooked up to Mega thusly:
CS - 53
DI - 50
DO - 51
CLK - 52
GND - GND
5V - 5V

I have also used 80mm leads which I've soldered onto the SD reader and pushed into the header sockets on the Mega just in case length of lead was a problem. And tried using 3.3V.

Using the SD Example CardInfo, after modifying line 36:
const int chipSelect = 53;

I've also tried this on D22, D10, and D4. No joy.

Result on Serial Monitor is:
"Initializing SD card...initialization failed." <snipped for brevity>

I also tried SDFat/SdInfo, result being (after typing "a" and clicking the Send button in Serial Monitor):

"SdFat version: 1.0.3

Assuming the SD is the only SPI device.
Edit DISABLE_CHIP_SELECT to disable another device.

Assuming the SD chip select pin is: 53
Edit SD_CHIP_SELECT to change the SD chip select pin.

type any character to start
error: cardBegin failed
SD errorCode: 0X20,0XFF

type any character to start"

To prove the board works OK with the Mega, I tried Examples>SDFat>SoftwareSpi:

Type any character to start
This line was printed using software SPI.
Done.


I've got the usual array of basic test gear, spare Unos, pro Minis, mega boards etc.

I would welcome any assistance or thoughts people may have on getting this reader to run on the Mega board through its hardware SPI pins after succeeding on the Uno.

If I've missed something really obvious please be kind :-)

trullt

Finally figured it out, simply add this line to set pin D53 properly:

pinMode(53, OUTPUT);

ta dah!

It works.

Go Up