SD card only works upon reset.

I have an arduino mega 2560. I am trying to connect an SD card module to the arduino to have my sensors write data in a csv/txt file.

The connections of the sd card module are as follows:

GND-Ground
3V3-Connected to the 3.3V from Arduino(not sure if right)
5V-Vcc
CS- pin 53
MOSI- 51
SCK-52
MISO-50
GND-Ground

I'm not so sure that it should be connected to the 3.3V or a level shifter should be used. And if so, why is it important?

I am using the ReadWrite Example from the SD Library and the initialization fails.
I remove the SD card, insert it again and reset the Arduino, It says successful.

When I use it on my laptop, sometimes it seems to write and sometimes not.

Assignment due in 3 days. Any advice would be appreciated.
Thanks,
J

jessilen:
I have an arduino mega 2560. I am trying to connect an SD card module to the arduino to have my sensors write data in a csv/txt file.

The connections of the sd card module are as follows:

GND-Ground
3V3-Connected to the 3.3V from Arduino(not sure if right)
5V-Vcc
CS- pin 53
MOSI- 51
SCK-52
MISO-50
GND-Ground

I'm not so sure that it should be connected to the 3.3V or a level shifter should be used. And if so, why is it important?

I am using the ReadWrite Example from the SD Library and the initialization fails.
I remove the SD card, insert it again and reset the Arduino, It says successful.

When I use it on my laptop, sometimes it seems to write and sometimes not.

Assignment due in 3 days. Any advice would be appreciated.
Thanks,
J

Unless your SDCard adapter has level (5V to 3.3V) shifters built in, you will damage your SDCard if you directly connect the card to the Arduino Mega.

I would suspect since your card adapter has level shifters built in. (because of the 5V input).
I expect and assume(ass U Me), the 3.3v is an output from an on board regulator.

Just leave the 3.3V pin unconnected.

Read the message at the top of this forum about FORMATTING your SDCard. Windows formats SDCards in a manner that IS NOT understood by the SD Library.

Chuck.