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

SD Card strange behavior


  • Please log in to reply
5 replies to this topic

#1 engvidal

engvidal

    Member

  • Members
  • PipPip
  • 10 posts
  • LocationGuarulhos - SP - Brazil

Posted 14 August 2013 - 03:14 PM

My N+2 SD Card is strange. Follow code with remarks

 

public class Program
{
  public static void Main()
  {
  Thread.Sleep(1000);
 
  DirectoryInfo rootDirectory = new DirectoryInfo(@"SD");   
  RecurseFolders(rootDirectory);

  while (true) ;
  }

  private static void RecurseFolders(DirectoryInfo directory)
  {
  bool DE = directory.Exists;    [color=#ff0000;]// >>> A first chance exception of type 'System.IO.IOException' occurred in Microsoft.SPOT.IO.dll[/color]


  if (true)            [color=#ff0000;]// >>> to force this block, because DE returns false, but...[/color]
  {
  Debug.Print(directory.FullName);    [color=#ff0000;]// >>> ... this line returns  SD[/color]
  Thread.Sleep(10);

  foreach (FileInfo file in directory.GetFiles()) [color=#ff0000;]// >>> A first chance exception of type 'System.IO.IOException' occurred in Microsoft.SPOT.IO.dll
               // >>> A first chance exception of type 'System.IO.IOException' occurred in System.IO.dll
               // >>> An unhandled exception of type 'System.IO.IOException' occurred in System.IO.dll[/color]

  {
  Debug.Print(file.FullName);      // >>> the debugger stops before this line
  }

  foreach (DirectoryInfo subDirectory in directory.GetDirectories())
  {
  RecurseFolders(subDirectory);
  }
  }
  else
  {
  Debug.Print("No such Directory !");
  }
  }
  }

 



#2 dtoth

dtoth

    New Member

  • Members
  • Pip
  • 6 posts

Posted 17 August 2013 - 07:10 PM

It works fine here  :)



#3 liqdfire

liqdfire

    Advanced Member

  • Members
  • PipPipPip
  • 78 posts

Posted 21 August 2013 - 12:47 AM

What size is it?

Is it form matted FAT32?



#4 dtoth

dtoth

    New Member

  • Members
  • Pip
  • 6 posts

Posted 21 August 2013 - 12:39 PM

yes, it is formatted to FAT32. Size: 2GB.



#5 upswing

upswing

    New Member

  • Members
  • Pip
  • 8 posts

Posted 23 August 2013 - 12:03 AM

I have the same problem with two different boards and different sd cards.  Anyone got a solution?



#6 upswing

upswing

    New Member

  • Members
  • Pip
  • 8 posts

Posted 23 August 2013 - 12:40 AM

I get an exception when trying to write read the sd card

 

Exception was thrown: System.NotSupportedException

 

Stack Trace

Microsoft.SPOT.IO.NativeIO::GetAttributes System.IO.FileStream::.ctor System.IO.FileStream::.ctor System.IO.StreamWriter::.ctor System.IO.StreamWriter::.ctor NetduinoApplication1.Program::Main

 

Code is

try

{

using (StreamWriter SW = new StreamWriter("SDtest.txt"))

SW.WriteLine("test");

using (StreamReader SR = new StreamReader("SDtest.txt"))

Debug.Print(SR.ReadLine());

 

}

catch (Exception exc)

{

message = exc.Message;

}

 

SD card 4GB Fat32

 

Can anyone help please  






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.