Hi.
I’m pretty new in this NETMF world, but I have a lot of years of experience with electronics and programming: http://blog.tkjelectronics.dk
I tried hooking up an SD Card connector to my FEZ Panda as stated on this link: microframeworkprojects.com - This website is for sale! - microframeworkprojects Resources and Information.
Then I used the code from the “Beginners guide to NETMF”, and after adding a lot of references, it could be deployed successfully.
The references I added was:
[ulist]
- FEZPanda_GHIElectronics.NETMF.FEZ
- GHIElectronics.NETMF.Hardware
- GHIElectronics.NETMF.IO
- GHIElectronics.NETMF.System
- Microsoft.SPOT.Hardware
- Microsoft.SPOT.IO
- Microsoft.SPOT.Native
- mscorlib
- System.IO[/ulist]
After a couple of seconds after the Panda has been reset, the debugger throws me this exception:
I’ve tried searching the internet and on this forum for the error, and it looks like it has something to do with the initialization, and that the SD card can’t be initialized.
This is the C# code:
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.System;
using GHIElectronics.NETMF.IO;
namespace FEZ_Panda_Application1
{
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();
}
}
}
I’ve also measured the SCLK with my Oscilloscope, and it is 300kHz.
Do you have any idea what is going on, as I’ve tried now with two different cards, and I have doubled checked the connections.
Best Regards
Thomas Jespersen