SD card problems, possible solution
Moderators: adafruit_support_bill, adafruit

by boinx on Sun Sep 21, 2008 1:41 am

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.
boinx
 
Posts: 19
Joined: Mon Jun 04, 2007 10:42 pm

by adafruit on Sun Sep 21, 2008 12:15 pm

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
adafruit
 
Posts: 11689
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

by boinx on Sun Sep 21, 2008 3:33 pm

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'.
boinx
 
Posts: 19
Joined: Mon Jun 04, 2007 10:42 pm

by adafruit on Mon Sep 22, 2008 11:18 pm

im going to sticky this since its a common question
User avatar
adafruit
 
Posts: 11689
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Re: SD card problems, possible solution

by jbrandt01 on Tue Jun 23, 2009 6:08 pm

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
jbrandt01
 
Posts: 18
Joined: Sat Nov 22, 2008 3:39 am

Re: SD card problems, possible solution

by dataman on Fri Jul 24, 2009 4:40 pm

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.
Dataman
Charley Jones, crjones.com
Founder and President:
Sql Server Society of Las Vegas, SSSolv.com
XNA User Group, LVXug.Com
Las Vegas Make, LVMake.Com
Developer of the IntruderChron, MultiChron, & GOL 1.4 Mod, Crjones.Com/AdaMods
User avatar
dataman
 
Posts: 98
Joined: Wed May 20, 2009 6:03 pm

Re: SD card problems, possible solution

by fat16lib on Fri Jul 24, 2009 8:13 pm

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.
fat16lib
 
Posts: 593
Joined: Wed Dec 24, 2008 12:54 pm

Re: SD card problems, possible solution

by dataman on Sat Jul 25, 2009 5:19 pm

Oh so that's the problem.
CRC error handling.
I was wondering...
Dataman
Charley Jones, crjones.com
Founder and President:
Sql Server Society of Las Vegas, SSSolv.com
XNA User Group, LVXug.Com
Las Vegas Make, LVMake.Com
Developer of the IntruderChron, MultiChron, & GOL 1.4 Mod, Crjones.Com/AdaMods
User avatar
dataman
 
Posts: 98
Joined: Wed May 20, 2009 6:03 pm

Re: SD card problems, possible solution

by techiebot on Sat Jul 17, 2010 9:44 pm

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?

techiebot
 
Posts: 24
Joined: Tue Sep 01, 2009 9:00 pm

Re: SD card problems, possible solution

by D9W on Tue Oct 26, 2010 3:34 pm

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.
D9W
 
Posts: 37
Joined: Tue Oct 26, 2010 3:25 pm

Re: SD card problems, possible solution

by candicenec on Wed Nov 24, 2010 11:29 am

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
candicenec
 
Posts: 3
Joined: Thu Sep 09, 2010 12:32 pm

Re: SD card problems, possible solution

by AkulahPathub on Thu Mar 24, 2011 7:32 am

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 | TOGGLE FULL SIZE
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 :)
AkulahPathub
 
Posts: 1
Joined: Mon Feb 28, 2011 8:29 am

Re: SD card problems, possible solution

by rwarren1 on Tue Jan 17, 2012 7:13 am

:? 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.
rwarren1
 
Posts: 33
Joined: Mon Dec 26, 2011 4:50 pm

Re: SD card problems, possible solution

by fat16lib on Tue Jan 17, 2012 8:13 am

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.
fat16lib
 
Posts: 593
Joined: Wed Dec 24, 2008 12:54 pm