SD card problems, possible solution

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
boinx
 
Posts: 19
Joined: Mon Jun 04, 2007 11:42 pm

Post by boinx »

after having another card go bad, i realized that it too had suddenly aquired a 'MBR partition'.

i think a recent XP update is now making SD cards bootable by adding a MBR partition. this is great, but im guessing our FAT16 code expects to start reading paritition info at block 0 and now the MBR is there, so... FAIL.

ive been messing around with dd trying to copy a working SD card onto a mbr one...i've had some positive results so far but dont have a 100% solution yet.

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Post by adafruit »

ah thats useful information. thats probably what was causing a lot of issues
im sure i can find a good fat16 full-formatter, ill look around

User avatar
boinx
 
Posts: 19
Joined: Mon Jun 04, 2007 11:42 pm

Post by boinx »

this seemed to work for me:

http://panasonic.jp/support/global/cs/s ... atter.html

at least it brought one card 'back from the dead'.

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Post by adafruit »

im going to sticky this since its a common question

jbrandt01
 
Posts: 17
Joined: Sat Nov 22, 2008 4:39 am

Re: SD card problems, possible solution

Post by jbrandt01 »

One thing I've found that helps recover corrupted cards is to copy the cards image to itself using DD or a similar tool. For a tool that is ment for copying bit for bit, this oddly enough works quite well at fixing issues like this. I can only assume that it exploits hardware error correction.

ie:
dd if=/dev/sdb of=/dev/sdb

User avatar
dataman
 
Posts: 98
Joined: Wed May 20, 2009 7:03 pm

Re: SD card problems, possible solution

Post by dataman »

Got it working, thanks to the panansonic reformat.
Was pulling my hair out, resoldering every point.
Couldn't be something as simple as the card format,
Windows wouldn't do that to me....
Sure would....
The panasonic tool cleaned the card,
Worked straight away.
Highly reccommended.

Note, would not work with the internal reader (Ricoh) on my Dell laptop,
But work just find through a generic external reader.

User avatar
fat16lib
 
Posts: 595
Joined: Wed Dec 24, 2008 1:54 pm

Re: SD card problems, possible solution

Post by fat16lib »

SDFormatter, the panansonic formatter, is the only way I know to correctly format a SD card. I have been on a BANNED for over a year to get users of Arduino shields to use it, to little avail.

You are another victim of Microsoft, Apple, and Linux format utilities.

The SD standard is clear how file structures must be aligned with SD flash blocks, erase groups, and bad spots but these operating systems ignore the standard.

Windows, OS X, and Linux recover from the errors they create but the Arduino has too little memory and does not support CRCs so it can't.

User avatar
dataman
 
Posts: 98
Joined: Wed May 20, 2009 7:03 pm

Re: SD card problems, possible solution

Post by dataman »

Oh so that's the problem.
CRC error handling.
I was wondering...

User avatar
techiebot
 
Posts: 24
Joined: Tue Sep 01, 2009 10:00 pm

Re: SD card problems, possible solution

Post by techiebot »

I have read all of the posts about SD cards and still am finding them inscrutable.

I am using an Atmel 328 with a WAVE shield. It was working fine for a long time. Then I hooked it up to a 12 volt sealed acid 12 amp hour battery. The power is going through an adjustable voltage regulator and a 10,000 uF capacator, which reduces the voltage to 9 vdc.

The shield works fine with usb power. But when I power it up with the battery it works fine at first. But if I turn it off and then on later, it can no longer read the SD card. I have fiddled with the cards re-formatting them in several different ways. Sooner or later I have gotten the card to work again (this has happened 3 times with 2 different cards). I am using Mac OS and following the instructions and using the terminal program to set them to FAT 16.

Today I got a Windows machine and formatted them both with the Panasonic program. The shield could read one, but not the other. The one it could read had no files, and when I copied sound files to the card, the shield could no longer read the card.

I am very frustrated with this, and now I don't have a card that the shield will read. All cards work fine on the computer via a card reader. A disk utility shows that the cards have no damage.

type any character to start

card.init failed
SD error
errorCode: 1
errorData: 0


This is the output from the card analysis program.

I am thinking that there is something electrically wrong with the shield. The Arduino is brand new and seems to be working just fine.

Any ideas?

D9W
 
Posts: 38
Joined: Tue Oct 26, 2010 4:25 pm

Re: SD card problems, possible solution

Post by D9W »

I just want to point out something i stumbled on over at a parallax forum <hope those are not fighting words>. you might want to read what Bunnies Studios has to say about problem MicroSDs >> http://www.bunniestudios.com/blog/?p=918. I am new to SC cards so hope this is helpful.

candicenec
 
Posts: 3
Joined: Thu Sep 09, 2010 1:32 pm

Re: SD card problems, possible solution

Post by candicenec »

Hi there,

Thanks for this thread to help find solutions to SD card problems.

I recently bought a Wave Shield from Adafruit that comes with a Transcend 2GB Micro SD card. I am operating from a Mac OS to interface Arduino with the shield. The code works fine but I have a similar problem to Techiebot - ie: only 1 card works on the shield while the other (same brand from Adafruit too) does not.

I have followed the procedures to format my card using the Disk Utility system in Mac for both cards but only 1 works.

This is the serial monitor code I get for the other dysfunctional one.
"Wave test!"
Couldn't open filesys

Any advice?

I was also wondering, the Panasonic reformatting link above, I realized it's only for PC. Is there one for Mac?



Thanks a lot for your time,
Cnec

AkulahPathub
 
Posts: 1
Joined: Mon Feb 28, 2011 9:29 am

Re: SD card problems, possible solution

Post by AkulahPathub »

Greetings, new to this great forum.

Recently buy adafruit logshield, i got it working nicely with Fat16.h
But when i test it with 5V ready Micro-SD Breakout board+, i cant get the card detected :?

And try using SDFat library, and loading SdFatInfo. And got in the serial:

Code: Select all

type any character to start

init time: 8

Card type: SD2

Manufacturer ID: 3
OEM ID: SD
Product: SU128
Version: 8.0
Serial number: 397207312
Manufacturing date: 5/2007

cardSize: 246016 (512 byte blocks)
flashEraseSize: 32 blocks
eraseSingleBlock: true

part,boot,type,start,length
1,0,6,97,245919
2,0,0,0,0
3,0,0,0,0
4,0,0,0,0

Volume is FAT16
blocksPerCluster: 32
clusterCount: 7682
fatStartBlock: 98
fatCount: 2
blocksPerFat: 31
rootDirStart: 160
dataStartBlock: 192

type any character to start
My question is, how can i change from Fat16 library without change everything ?
I mean, i wish using the same sketch with my logshield and my sd-card breakout board (plus DS1307 RTC breakout).

Thanks in advance, i will digging with google again :)

rwarren1
 
Posts: 33
Joined: Mon Dec 26, 2011 5:50 pm

Re: SD card problems, possible solution

Post by rwarren1 »

:? okay, one minute the CardInfo sketch when ran says, wiring correct, card present, and the type etc. But cannot find the FAT16/FAT32 file system. I am using chipSelect 4 and #define SD_CS 4. but when I run the same sketch twice, I get an error the second time saying card not found, is wiring correct, etc. What is going on here? Also, how do you partition the SD CArd? My goal is to upload onto the 2.8 TFT TouchScreen the Tiger.bmp. Any help would be appreciated.

User avatar
fat16lib
 
Posts: 595
Joined: Wed Dec 24, 2008 1:54 pm

Re: SD card problems, possible solution

Post by fat16lib »

Sometimes CardInfo thinks the wiring/card connection is OK when it is marginal. This is because the SD library does lots of retries to initialize the card.

If you get any failures with card not found, you have a hardware problem, not a format problem.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”