Crashing system leaves SD cards unable to be formatted
ElectricAye
Posts: 4,561
I'm suffering from an onslaught of system crashes. In the past, I've always had to reformat my SD cards every time. Now my Windows XP tells me that "Windows can't reformat this disk." even though it can see the disk is there. My lovely Propeller-based system has now left two SD cards in this zombie-like state. I've shut everything down, restarted, tried various methods to safely shut down the disk, etc. Windows just refuses to deal with them anymore. Does this mean they are probably fried? Any suggestions on what to do next?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It might be the Information Age but the Eon of Ignorance has yet to end.
Post Edited (ElectricAye) : 9/18/2008 3:41:02 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It might be the Information Age but the Eon of Ignorance has yet to end.
Post Edited (ElectricAye) : 9/18/2008 3:41:02 PM GMT
Comments
Tim
I (or someone) should write a formatter in Spin. There's probably a way to do it using the Disk Management tools in Administration Tools
rather than the command-line formatter.
When you say system crashes, do you mean Windows crashes, or Spin/Prop crashes? You shouldn't need to reformat your cards every time
Windows crashes, nor every time the Prop crashes . . .
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Still some PropSTICK Kit bare PCBs left!
I have some problem on format 2GB SD on my XP.
After some research it was no problem in XP ..
It wsa problem in Card reder/writer ...
I buy new and it function perfectly
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nothing is impossible, there are only different degrees of difficulty.
For every stuipid question there is atleast one inteligent answer
If you dont ask you wont know
If your gonna construct something, make it the simplest possible yet as versalite as posible
Sapieha
I should have been better at describing what Windows XP says, it says it can not COMPLETE the formatting of the disk. I went and tried the disk anyway and so far it now seems to be working.... well, uh, until the system just crashed again.
Rokicki, I should have said it is my Prop-based system that is crashing, not the Windows program. Heaven forbid a Windows product would ever crash! What would give you such silly ideas? ...As for having to reformat after every Prop crash, it seems my Spin program will get stuck if I don't. Is there something I should be doing to avoid that nuisance?
Mike, I have a MacOS. So maybe I'll try that to see if I can clean up the SD cards.
Thanks again,
Mark
cause of problems, and in normal use you'd never write that sector.
Needing to reformat your card after a spin crash should not happen, frankly.
You might post the whole source code (if you are willing) just so we can have a few eyeballs glance over it for common errors.
Two or three times Windows was not able to reformat it, it does not found the SD card anymore.
My solution was to overwrite sector 0 of the card with all Zeros. And I have done this with the WriteBlock method of the sdspi object!
Then Windows found the SD card again.
Andy
I've noticed that you can break Windows pretty easy with a Prop when it comes to SD.
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Getting started with a Propeller Protoboard?
Check out: Introduction to the Proboard & Propeller Cookbook 1.4
Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
Got an SD card connected? - PropDOS
An overwrite of sector 0 is almost always a universal cure. Windows just can't cope with a malformed partition table or MBR.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Pull my finger!
if you look at popen(), the first thing it does is call pclose(), so opening for write when there's an open file should
not break anything. I have tested this stuff pretty intensively, and also it's in pretty wide-spread use without
complaints, so if there's a failure mode we should find it and fix it.
I'm both thrilled and amazed by your enthusiasm for pursuing this problem. I'll be happy to post my horrible code that has messed up my two SD cards. I'm sure the fault lies with me and not with your venerable code. It will be a great embarrassment for me, exposing myself as a newbie fool, but I'll post everything just as soon as I get to my other computer. I'm on my Mac right now, and its disk utility failed to repair whatever happened to both SD cards. I just hope my code isn't so bad that it will cloud your efforts to find what might be wrong and how these SD cards got fouled up.
The results of my attempt to repair one of the SD cards looks like this:
Verify and Repair volume “BANR1”
** /dev/disk1s1
** Phase 1 - Preparing FAT
** Phase 2 - Checking Directories
/80912135.CSV starts with cluster out of range (65535)
Truncate? yes
** Phase 3 - Checking for Orphan Clusters
Found orphan cluster(s)
Fix? yes
Marked 1 clusters as free
1 files, 1973856 KiB free (61683 clusters)
***** FILE SYSTEM WAS MODIFIED *****
My effort to verify the card gave me this:
Verifying volume “BANR1”
** /dev/disk1s1
** Phase 1 - Preparing FAT
** Phase 2 - Checking Directories
/80912135.CSV starts with cluster out of range (65535)
Truncate? no
** Phase 3 - Checking for Orphan Clusters
Found orphan cluster(s)
Fix? no
Found 1 orphaned clusters
1 files, 1973824 KiB free (61682 clusters)
Error: Filesystem verify or repair failed.
The original code in sdspiqasm:
In other words, if the command is not valid, then write some rubbish to a sector!
The fixed code:
I have not trashed an·SD card·since adding these two lines!
·
here's the spin file of my monstrous code that has mess up my SD cards.· I apologize for the mess that it is.· I hope it helps in some way.
thanks,
Mark
crash for you.
I have to get a new fsrw out the door . . .
========================================================================================================================================================
SD Memory Card Formatting Software
Software Description
This software formats SD Memory Card and SDHC Memory Card(SD/SDHC Memory Card) using a formatting program that complies with the SD Memory Card specification SD formatting provides quick and easy access to the SD Memory Card.
Generally, SD/SDHC Memory Card file systems formatted with generic operating system formatting software do not comply with the SD Memory Card specification.
===========================================================================================================================================================
You can download it here:
panasonic.jp/support/global/cs/sd/download/sd_formatter.html
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Aka: CosmicBob
How can we format the SD Card with the Propeller???
Post Edited (VIRAND) : 9/18/2008 12:13:30 AM GMT
Oh thank you! I have a card sitting on my desk that has suffered this fate. I never knew the fix was so easy!
This is a little gem of info!!!!
Tom, yes, this would be a great addition to your SD routines. Simple and effective. Maybe call it the "recover" routine?
-Parsko
Post Edited (parsko) : 9/18/2008 2:54:55 PM GMT
Ariba, that's great. Would you mind posting the exact code you used for doing this? So far I've tried Norton Disk Doctor running on Windows XP, the MacOS disk utility program, and the plain ole Windows XP format task thing to try to fix these SD cards, but none of them has worked. I've tried to erase the SD cards but that doesn't work because it gives me "input/output error" or "CRC failure" when I try to do that.
It's times like these I wish I really knew what I was doing.
Mark
This is one fine program to edit pchsical sectors od al media
WinHex 15.1
And much more
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nothing is impossible, there are only different degrees of difficulty.
For every stupid question there is at least one intelligent answer
If you don't ask you wont know
If your gonna construct something, make it·as simple as·possible yet as versatile as posible
Sapieha
I'll take a look at WinHex and give it a try. At this point, I'll try anything. If I find I can't recover SD cards after a system crash with the Prop, I'm screwed. There would be no way to move on with the debugging process, unless I don't mind spending 10 bucks a pop.
thanks,
Mark
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It might be the Information Age but the Eon of Ignorance has yet to end.
You call "initSDcard" with the pin numbers for the various signals from the SD card, then call "writeSDcard"
with the sector address, address of a 512 block to write, and byte count. If you use a byte count of 1, the
rest of the block is padded with zeroes. That way, you only need to furnish the address of a single zero byte
for the data to be written. Both routines return TRUE if successful, FALSE otherwise. Call "stopSDcard"
before removing the SD card.
Something like:
I'll have a look at this FemtoBasic program. I've got two brand new SD cards ready to meet their maker if need be. Hopefully your Femto will save them from the burnt sacrificial altar of my horrible programming skills.
cheers,
Mark
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It might be the Information Age but the Eon of Ignorance has yet to end.
This was very useful for raw data write to SD.
It is same for Read raw sectors ?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nothing is impossible, there are only different degrees of difficulty.
For every stupid question there is at least one intelligent answer
If you don't ask you wont know
If your gonna construct something, make it·as simple as·possible yet as versatile as posible
Sapieha
Not shure if this always helps, perhaps it was only the solution for my specific SD card malfunction.
Good luck
Andy
thank you! thank you!
And thanks to all who've given suggestions on fixing this problem. I'm away from my gadgetry at the moment, so I'll need some time before I can provide some feedback.
cheers,
Mark
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It might be the Information Age but the Eon of Ignorance has yet to end.
Yes, there is a readSDcard routine as well that has the same parameters.
Mike, I entered the above code based on your suggestion but I'm getting "Card failed."· Is there something I've left out?
I tried Ariba's suggestion, too, but that didn't work either.·
·