Search code examples
c#netduino

Netduino plus, SD Card cannot get basic example working


Hi I want to try my SD card on de the netduino plus. I downloaded the SDK from this website yesterday.

I could not find documentation so I figured out the following code. However it gives "CLR_E_VOLUME_NOT_FOUND".. What do I do wrong ? I read something online about mounting and a certain dll (SecretLabs.NETMF.IO.dll ) but I cannot find that dll.

Can anybody help me getting started ?

public class Program
{
    public static void Main()
    {
        var dir = Directory.GetCurrentDirectory();
        var fileName = Path.Combine(dir, "test.txt");
        Debug.Print(fileName);
        byte[] testBytes = new byte[] { 1,2,3,4 };
        File.WriteAllBytes(fileName, testBytes);
    }

}

Output :

\test.txt

Exception System.IO.IOException - CLR_E_VOLUME_NOT_FOUND (1) Message: System.IO.Path::NormalizePath [IP: 0070] System.IO.Path::GetFullPath [IP: 001a] System.IO.FileStream::.ctor [IP: 0009] System.IO.File::WriteAllBytes [IP: 0012] NetduinoPlusApplication1.Program::Main [IP: 0025]

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


Solution

  • I've been helped at the Netduino Forum, see this forum post.

    I needed to write to the \SD\ folder. Mounting/dll was only necessary for the plain Netduino with an additional SD card shield.

    Three quick things:

    1. The MicroSD card will be mounted at \SD\ rather than \
    2. MicroSD cards up to 2GB are generally supported.
    3. SecretLabs.NETMF.IO is only needed for manually mounting and dismounting--on the regular Netduino. The Netduino Plus automatically mounts and dismounts MicroSD Cards.