Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

About sd card access in case of file broken

SD

  • Please log in to reply
1 reply to this topic

#1 jiwonoh

jiwonoh

    Advanced Member

  • Members
  • PipPipPip
  • 42 posts

Posted 24 April 2013 - 07:54 AM

This question from my team member, he cannot verify id yet, so I upload this topic instead of him.

 

---

 

Hi forum.

 

I'm studying .NET MF and my board is netduino plus 2.

I tested safety in sdcard data access when external interruption is occured.

 

My program follows like below:

Create new file -> Write random data not a byte, about 30 bytes

 

Every my own write operation include open and close.

 

I made netduino program halting when it perform writting operation.

 

I use this method while these 3 kinds of exceptional cases.

1) turn off the power supply

2) press the button 'reset'

3) eject sdcard unexpectedly.

 

Sometimes, my files are stored naturally. but, almost files doesn't.

 

There is no damage in files.

 

 

In the process of test, I found one thing strange.

 

Files with enough writing time(recorded about 19kb and more than) were stored almost without damage.

 

But, files with tiny writting time were not stored. WHY?

 

 

So, I browse many site for information related with block device, read/write buffer etc.

 

Still I don't know it yet. Help me.

 

 

This is my write source in infinite loop.

 

 

 

using (TextWriter tw = new StreamWriter(MyManager.FileName, true)){  tw.WriteLine(Content);  tw.Close();}Debug.Print(Content); 

 

 

PS. What kind of filesystem for sdcard is general ? in netduino plus 2. FAT16 or FAT32.



#2 ziggurat29

ziggurat29

    Advanced Member

  • Members
  • PipPipPip
  • 244 posts

Posted 24 April 2013 - 07:56 PM

lucky you (that you get that little corruption)!.  I almost always get corruption when I power off, eject, whatnot, and then I have to chkdsk to return the sd card to functionality. This is a big deal for me.   You might be a little lucky since you are opening and closing the file, but how can you know that the power fail event will not happen when it happens to be open?  Similarly, while there is a 'card inserted' switch on the SD card, it notifies the netmf while the SD is in the process of being removed, so this doesn't really give much time to ensure disk structures are flushed!

 

Regarding the filesystem type, that is a function of what you formatted the card to be.  Some manufacturers ship a 2GB SD preformatted as FAT16, others as FAT32.  I'm pretty sure the netmf will support both, and I think my card is FAT32 though I don't have it in reach right now to verify.







Also tagged with one or more of these keywords: SD

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.