Hi all,
It’s been a while since I’ve really dabbled in the gadgeteer world so please excuse my failing memory.
Firstly I just wanted to double check that my SD Card module v1.4 is compatible with the FEZ Raptor. (It came with the spider kit)
I’ve upgraded everything to 4.3SDK (TinyLoader, TinyCLR)
I’m also running on:
.NET Micro Framework SDK 4.3 (SDK-R2-Beta)
Latest Gadgeteer core
NETMF and Gadgeteer Package 2014 R5
Using the following code it seems like I successfully mount an SD card:
Private Sub InitialiseSDStorage()
If sdCard.IsCardInserted = False Then
Debug.Print("Waiting for SD card to be mounted")
While sdCard.IsCardInserted = False
Thread.Sleep(500)
End While
End If
If sdCard.IsCardMounted = False Then
Debug.Print("Mounting SD Card")
Try
sdCard.Mount()
Catch ex As Exception
FatalError(ex.Message, "InitialiseSDStorage")
End Try
Thread.Sleep(1000)
End If
If sdCard.IsCardMounted = False Then
FatalError("Cannot Mount SD Card", "InitialiseSDStorage")
End If
Debug.Print("SD Card Mounted")
storageDev = sdCard.StorageDevice
' Setup routines to cat the ejecting of sd card
AddHandler sdCard.Unmounted, AddressOf sdCard_SDCardUnmounted
AddHandler sdCard.Mounted, AddressOf sdCard_SDCardMounted
End Sub
I then try to load a bitmap off of the card using the following code (The path is “\project\images\logo_lrg.bmp”):
Private Function LoadBitmap(fname As String) As Bitmap
Dim result As Bitmap
Try
result = storageDev.LoadBitmap(fname, Bitmap.BitmapImageType.Bmp)
Catch ex As Exception
FatalError(ex.Message, "LoadBitmap(" & fname & ")")
End Try
Debug.Print("Image size = " & result.Width.ToString & " x " & result.Height.ToString)
Return result
End Function
I get the following exception:
#### Exception System.IO.IOException - CLR_E_INVALID_DRIVER (1) ####
#### Message:
#### Microsoft.SPOT.IO.NativeIO::GetAttributes [IP: 0000] ####
#### System.IO.FileStream::.ctor [IP: 005c] ####
#### System.IO.File::ReadAllBytes [IP: 0008] ####
#### Gadgeteer.StorageDevice::LoadBitmap [IP: 000b] ####
#### ProjectDemo.HothouseDemo.Program::LoadBitmap [IP: 0009] ####
#### ProjectDemo.HothouseDemo.Program::LoadImage [IP: 000d] ####
#### ProjectDemo.HothouseDemo.Program::ProgramStarted [IP: 0012] ####
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
Any help is appreciated.
Cheers,
Jas