Pierre2,
The only time I got the error that you mention in your first post is if I try to run this code using the emulator.
#### Exception System.NotSupportedException - CLR_E_NOT_SUPPORTED (1) ####
#### Message:
#### Test.Program::Main [IP: 0007] ####
A first chance exception of type ‘System.NotSupportedException’ occurred in MFConsoleApplication1.exe
An unhandled exception of type ‘System.NotSupportedException’ occurred in MFConsoleApplication1.exe
I ran your code in reply 4 exactly as you have it there and I did not get any errors. It read the filesystem and listed the files in the main directory.
For this example you posted, make sure you have the following assemblies:
GHIElectronics.NETMF.IO
GHIElectronics.NETMF.System
Microsoft.SPOT.IO
Microsoft.SPOT.Native
mscorlib
System.IO
I ran the code that you linked to in your first post using a Panda II template and modified the code as follows:
using System;
using System.IO;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.IO;
using Microsoft.SPOT.Hardware;
using GHIElectronics.NETMF.FEZ;
using GHIElectronics.NETMF.IO;
namespace FEZ_Panda_II_SD_Test
{
public class Program
{
public static void Main()
{
// ...
// SD Card is inserted
// Create a new storage device
PersistentStorage sdPS = new PersistentStorage("SD");
// Mount the file system
sdPS.MountFileSystem();
// Assume one storage device is available, access it through
// Micro Framework and display available files and folders:
Debug.Print("Getting files and folders:");
if (VolumeInfo.GetVolumes()[0].IsFormatted)
{
string rootDirectory =
VolumeInfo.GetVolumes()[0].RootDirectory;
string[] files = Directory.GetFiles(rootDirectory);
string[] folders = Directory.GetDirectories(rootDirectory);
Debug.Print("Files available on " + rootDirectory + ":");
for (int i = 0; i < files.Length; i++)
Debug.Print(files[i]);
Debug.Print("Folders available on " + rootDirectory + ":");
for (int i = 0; i < folders.Length; i++)
Debug.Print(folders[i]);
}
else
{
Debug.Print("Storage is not formatted. Format on PC with FAT32/FAT16 first.");
}
// Unmount
sdPS.UnmountFileSystem();
Thread.Sleep(Timeout.Infinite);
}
//public static void Main()
//{
// // Blink board LED
// bool ledState = false;
// OutputPort led = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, ledState);
// while (true)
// {
// // Sleep for 500 milliseconds
// Thread.Sleep(500);
// // toggle LED state
// ledState = !ledState;
// led.Write(ledState);
// }
//}
}
}
Make sure these assemblies are pressent:
FEZPanda_II_GHIElectronics.NETMF.FEZ
GHIElectronics.NETMF.IO
GHIElectronics.NETMF.System
Microsoft.SPOT.Hardware
Microsoft.SPOT.IO
Microsoft.SPOT.Native
mscorlib
System.IO
Again I did not get any errors and the filesystem was read as it was read in the reply 4 test program.
I tested these programs on two different cards:
Kingston 2GB MicroSD
Dane-Elec 4GB MicroSD HC
This is the capabilities of my current version of Panda II:
ClrInfo.clrVersion: 4.1.2821.0
ClrInfo.clrVendorInfo: Microsoft Copyright (C) Microsoft Corporation. All rig
ClrInfo.targetFrameworkVersion: 4.1.2821.0
SolutionReleaseInfo.solutionVersion: 4.1.6.0
SolutionReleaseInfo.solutionVendorInfo: GHI Electronics, LLC
SoftwareVersion.BuildDate: Jun 24 2011
SoftwareVersion.CompilerVersion: 410561
I ran the code as posted in Reply 13 and added the appropriate assemblies and the SD Card did indeed format. I placed the card on my laptop and it was blank. I then put some files on the card and reran one of the other SD Card reading test programs from post 1 and reply 4 and was able to read the file system.
Try some of these solutions and see if they work as I have described them.
@ Thomas8
[quote]#### Exception System.NotSupportedException - CLR_E_NOT_SUPPORTED (5) ####
I have the same problem on the Panda II.
Firmware: 4.1.8.0
I tried to format the SD with the Panda II and with Windows 7 - i also used two different 2GB SD Cards.[/quote]
Make sure that you are not running in emulation mode by going to the Solution Manager and double click on properties. On the properties page select the .Net Micro Framework tab and select Transport: USB… USBizi_USBizi should automatically be there.