Hello,
I got my FEZ Cerberus Tinker Kit few weeks ago and I am starting to test the modules… I am having a problem with the SD Card.
I checked the forums and documentation, but they make reference to Net 4.2 (I have 4.3) and libraries that no longer exists… but the basic idea was there… so I added the module to the designer and tried the following code… but I am getting errors and I have no idea why.
public partial class Program
{
void ProgramStarted()
{
Debug.Print("Program Started");
characterDisplay.Clear();
characterDisplay.Print("Program Started");
sdCard.DebugPrintEnabled = true;
sdCard.Mounted += sdCard_Mounted;
sdCard.Unmounted += sdCard_Unmounted;
if (!sdCard.IsCardMounted)
sdCard.Mount();
}
void sdCard_Unmounted(SDCard sender, EventArgs e)
{
Debug.Print("sdCard_Unmounted");
characterDisplay.Clear();
characterDisplay.Print("sdCard_Unmounted");
}
void sdCard_Mounted(SDCard sender, GT.StorageDevice device)
{
Debug.Print("sdCard_Mounted");
characterDisplay.Clear();
characterDisplay.Print("sdCard_Mounted");
}
}
And I am getting this exception when I debug the program and the SD Card has already been inserted:
[quote]Using mainboard GHI Electronics FEZ Cerberus version 1.2
A first chance exception of type ‘System.Exception’ occurred in GHI.Hardware.dll
Program Started
A first chance exception of type ‘System.Exception’ occurred in GHI.Hardware.dll
The thread ‘’ (0x3) has exited with code 0 (0x0).[/quote]
If I cancel the Debug session and manually press the RESET button in the board I get this exception (I got it from MS Deploy)
[quote]ERROR : The SD card does not have a valid filesystem.
SDCard ERROR : The SD card does not have a valid filesystem.
sdCard_Unmounted
SDCard ERROR : The SD card does not have a valid filesystem.
sdCard_Unmounted
SDCard ERROR : The SD card does not have a valid filesystem.[/quote]
Then I disconnect the USB Cable, wait 2 seconds, connect the power back on and it works!
The Mount event gets called, if I take the SD card out, the Unmount event gets called, etc…
[quote]sdCard_Mounted
sdCard_Unmounted
sdCard_Mounted
sdCard_Unmounted
sdCard_Mounted[/quote]
At this point, if I try to debug it with Visual Studio or press RESET (without removing the power) I get the first error again.
[quote]Using mainboard GHI Electronics FEZ Cerberus version 1.2
A first chance exception of type ‘System.Exception’ occurred in GHI.Hardware.dll
Program Started
A first chance exception of type ‘System.Exception’ occurred in GHI.Hardware.dll
The thread ‘’ (0x3) has exited with code 0 (0x0).[/quote]
Any ideas why?..
I tried creating the SD Card module manually instead of the designer, I tried Mainboard.MountStorageDevice, I even tried using the class GHI.IO.Storage.SDCard instead of the Gadgeteer Module and I get the same results.
I formatted the SD Card (128mb supplied in the tinker kit) with FAT16 and I made sure it works fine in Windows.
Any help would be appreciate it.
Thanks.