The reason I am posting is that I am facing issues with micro SD cards(using a Kingston SDC/2GB atm), as other people have already posted.
The following code works just fine with firmware 4.1.0.6 on NetduinoPlus:
using System; using System.IO; using System.Net; using System.Net.Sockets; using System.Threading; using Microsoft.SPOT; using Microsoft.SPOT.IO; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware; using SecretLabs.NETMF.Hardware.NetduinoPlus; namespace MicroSdTest { public class Program { public static void Main() { Thread.Sleep(1000); VolumeInfo vol = new VolumeInfo("\\SD"); string dir = Directory.GetCurrentDirectory(); string[] dirs = Directory.GetDirectories("\\"); dirs = Directory.GetDirectories("\\SD\\"); foreach (string d in dirs) Debug.Print(d); Debug.Print("ok"); } } }
I usually set a breakpoint before
dirs = Directory.GetDirectories("\\SD\\");so I can check the contents of vol or I can just let it pass crashing or printing. It turns out that on 4.1.0.6, it detects the FAT filesystem just fine and I can format/print the directories. On 4.2 RC3 none of that occurs and the code crashes whenever I try to access any of the card's features.
I have tried this simple code running back and forth from 4.1.0.6 to 4.2RC3 a few times and the behavior was consistent. Am I missing something like mounting it on 4.2RC3 or is it a bug? This particular issue is delaying a project of mine...
edit:forgot to post the actual exception I get
A first chance exception of type 'System.NotSupportedException' 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
Thanks,
Geancarlo Rocha