Page 2 of 2

Re: SD Card Module (HCARDU0008)

Posted: Fri Oct 25, 2013 8:49 am
by andrew
The simple answer is that most SD cards are designed to interface to 3.3V TTL logic levels and that you should include a level shifter if you need to interface to 5V levels. However saying that we have directly interfaced to many types of SD cards with 5V TTL and never seen any problems. So it is up to you, it's very unlikely that you will damage your SD card but it is a possibility.

We do also sell a microSD module that includes level shifters.

Re: SD Card Module (HCARDU0008)

Posted: Thu Mar 06, 2014 1:11 pm
by uobstudent
Does the sd card module support the sandisk ultra sdhc cards?

Re: SD Card Module (HCARDU0008)

Posted: Thu Mar 06, 2014 5:11 pm
by andrew
We haven't tested this module with this particular version of SD card. We can confirm that it works with a amongst other cards, a 4GB HC SanDisK and a 32GB HC Transcend. This is a passive reader and so long as your SD card supports SPI mode there should be no reason why it would not work with this reader.

Re: SD Card Module (HCARDU0008)

Posted: Tue Mar 11, 2014 11:36 pm
by uobstudent
I'm unable to get the reader to work on my arduino mega 2560. Below is my setup. The card never initializes.

Ive tried using the 3.3 and the 5v supply pin and both grounds.
The SD card is formatted to FAT32 by a windows 7 PC Tool

MISO - 50
MOSI - 51
SCK - 52
CS - 53

And the code (from the arduino website with the pin cs pin changed to 53 to match the board):

#include <SD.h>

File myFile;

void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}


Serial.print("Initializing SD card...");
// On the Ethernet Shield, CS is pin 4. It's set as an output by default.
// Note that even if it's not used as the CS pin, the hardware SS pin
// (10 on most Arduino boards, 53 on the Mega) must be left as an output
// or the SD library functions will not work.
pinMode(53, OUTPUT);

if (!SD.begin(53)) {
Serial.println("initialization failed!");
return;
}
Serial.println("initialization done.");

// open the file. note that only one file can be open at a time,
// so you have to close this one before opening another.
myFile = SD.open("test.txt", FILE_WRITE);

// if the file opened okay, write to it:
if (myFile) {
Serial.print("Writing to test.txt...");
myFile.println("testing 1, 2, 3.");
// close the file:
myFile.close();
Serial.println("done.");
} else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
}

// re-open the file for reading:
myFile = SD.open("test.txt");
if (myFile) {
Serial.println("test.txt:");

// read from the file until there's nothing else in it:
while (myFile.available()) {
Serial.write(myFile.read());
}
// close the file:
myFile.close();
} else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
}
}

void loop()
{
// nothing happens after setup
}

Re: SD Card Module (HCARDU0008)

Posted: Wed Mar 12, 2014 2:04 pm
by andrew
I've been taking a look at this and I'm seeing some odd behaviour. The above code works perfectly on an Uno (with the CS pin change) but on a Mega it it gives the card initialisation error. However resetting the mega and then inserting the card into the reader whilst the "Initializing SD card..." message appears makes the code work. It's almost like something on a Mega, or the code/library when running on a Mega, is causing the card to get into an unknown state.

Could you confirm you see the same thing when inserting the card at this point?

Re: SD Card Module (HCARDU0008)

Posted: Wed Mar 12, 2014 6:42 pm
by uobstudent
I'm not seeing this with mine. I might not be catching it at the right point in the initiation but it continues to fail. Is the microSD reader any more reliable to use?

Re: SD Card Module (HCARDU0008)

Posted: Thu Mar 13, 2014 12:51 pm
by andrew
The problem with the SD card reader is that it is effectively a passive device (a breakout board for an SD socket) and doesn't include level shifters. This if fine for 3.3V development boards but when used with 5V boards like the Mega, a level shifter should really be added. The SDRamps module was actually designed to work with a Mega and includes a level shifter. The above sketch will work perfectly SDRamps module.

Re: SD Card Module (HCARDU0008)

Posted: Thu Mar 13, 2014 1:42 pm
by uobstudent
Ok, I'll give one a try if you can confirm it will work with my set up.

Is this the correct module?
http://www.ebay.co.uk/itm/microSD-SD-Ca ... 20d9a23b58

Re: SD Card Module (HCARDU0008)

Posted: Thu Mar 13, 2014 4:04 pm
by andrew
Yes, I happen to have one set up right now with a mega and your posted sketch works without any modification. That is indeed our current eBay listing.

Re: SD Card Module (HCARDU0008)

Posted: Tue Jul 22, 2014 7:48 pm
by axelz
If it's any help, I too was experiencing issues with the reader, on a mega, but found this was due to me using a MicroSD card and adaptor, though it may have just been a bit picky. Using an oldd 2GB Kingston SD card then worked fine.