0

I'm attempting to read data from my SD card, but I have strange behavior and can't figure out why this is happening.

I'm using CardInfo from the Arduino example and am trying to read the data from my SD card.

I'm faced with two different problems, but maybe they can be related:

1: If I format my SD card from my Mac (FAT32), if my card is still empty, the program can read my card and output the right information. But if I add data from my Mac to the SD Card, card.init never initialise, and my data are never read (because of the hidden files). If I remove those hidden files, but let only the expected files be, the program never find them, like if my card was still empty. I don't know how to handle this.

2: From my Arduino, if I feed the card from the 3.3 V output, I get the

Card type: SD2 Could not find FAT16/FAT32 partition. Make sure you've formatted the card

It only works on 5 V (but the card type becomes SDHC). So I've tried to feed my card with another 3.3 V/5 V supply (my Arduino is grounded to this supply as well), but this is only working on 5 V. On 3.3 V my card isn't detected. My wires to the SD card are about 15 inch. I don't know if it can affect it drastically, but this is the only 'weird' thing about this circuit. By the way I naively think my 3.3 V supply should handle that.

Here are my materials: - Arduino Duemilanove

  • For the SPI wiring I'm using pin 10 for SS.
  • Using the Cardinfo from the Arduino library.

migrated from electronics.stackexchange.com Jan 11 '15 at 12:12

This question came from our site for electronics and electrical engineering professionals, students, and enthusiasts.

  • 1
    And SD cars is powered by 3.3v, but also the I/O is 3.3v. You'd need a logic level converter to talk to it. Giving it 5v signals might screw up the SD card and result in wrong behavior. Not sure if that's the case here though. I haven't worked with SD cards. – Gerben Jan 11 '15 at 12:28
1

I recommend you get a MicroSD card breakout board from that link, or something similar. That's around $US 15.

Micro SD breakout board

That includes the logic level converters. That particular board is for the **micro* SD card, but similar converters could no doubt be found for an SD card. Or use that one with a micro-SD card and just get an SD converter for when you plug it into the Mac.

I personally have used the SDfat library without any problems. However since he started rewriting it, I did have some issues. I have a backup of an earlier version which might be useful if the live library doesn't work for you.

You might be best off not formatting the card, but leave it as factory formatted. That will probably be compatible with the Mac, and also the SDfat library.

0

First of all, use 3.3 V. You need a logic-level converter.

Then you have to understand SPI is not the main protocol used by SD cards, and that Arduino should use SDSC to be sure, as some libraries are SDSC only.

Then you may have a hardware problem (from FAT32/SDHC library for Wave and other shields):

SDHC cards have a 3.3 V bus so most Adruino shields, like the Wave Shield, use a resistor voltage divider to shift bus levels from 5 V to 3.3 V. These voltage dividers can not meet the 10 ns rise time for most SDHC cards."

Also using an external power source may solve your trouble.

0

Mac OS X will default to using the GPT partition table to format the card, even in FAT32. This does not work with the standard Arduino library for SD cards I've found. You must use MBR.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy