Main Site Documentation

SD Card Emulator


Is there a way to emulate the SD card in the emulator before running on the Fez?

I have a data file that will be on the SD card and I want to first put it on emulated storage and debug the code.

Is that possible?


Yes you can use file system on emulator. There is no “PresitantStorage” class but everything else is the same. See examples that ship with NETMF in “my documents” on your PC


HI Gus,

I Looked at this example you suggested (a good one btw), but under emulation it starts by creating a formatted blank SD card image.

I think what’s being asked is how can the image be “pre-loaded” with files (eg. config.xml, …). In case you’re trying to emulate particular support issue, and replicate their problem with live data.

Is there a way to pre-load data from existing Host System [MS-Windows or similar] files?

Can you force the emulator to pre-load a specific *.dat file from a range of files.?

I am at the same point. And have’t got past this.


I personally never bothered much with emulator as hardware is cheap and makes more sense for embedded devices.


Hi Gus,

My XML Loader takes around 60 seconds to load each time I debug, so emulation would be something to aid in speeding up development.

So if there are any suggestions on how to do it would be appreciated.

In mean time I am trying to load the structure to extended weak reference flash, so I don’t need to load every time. But not there yet.



8 months - long time for a thread to come back to life :slight_smile:

Anyway, here’s how I solved this.

Enable WINFS in Emulator.config: (only the bits related to WINFS is shown)

<?xml version="1.0" encoding="utf-8"?> Microsoft.SPOT.Emulator.Gpio.GpioPort Microsoft.SPOT.Emulator.Lcd.LcdDisplay Microsoft.SPOT.Emulator.FS.WindowsFileSystem Microsoft.SPOT.Emulator.FS.AsyncWindowsFileSystem Microsoft.SPOT.Emulator.BlockStorage.Region Microsoft.SPOT.Emulator.BlockStorage.BlockRange Microsoft.SPOT.Emulator.BlockStorage.EmulatorBlockStorageDevice Microsoft.SPOT.Emulator.BlockStorage.EmulatorRemovableBlockStorageDevice Microsoft.SPOT.Emulator.FS.NativeFileSystem Microsoft.SPOT.Emulator.Memory.RamManager 8388608
<BSDevice id="OnBoardFlash">

<NativeFS id="FATFS">

<RemovableBSD id="SD1">

<RemovableBSD id="SD2">

<WinFS id="WinFS">

When you run the app in the emulator, you’ll see a folder created in the same place as your project file:

Copy your files here and they will appear on the “SD card” when it is mounted.

It is a real time saver if you have a lot of file I/O development to do. Debugging straight on the hardware is painful - especially over the Serial port - so the emulator does make a difference here.


I see. In this case, I would write part of my program that is “hardware independent” on the standard Microsoft emulator to debug it before I move it to the device.


Thanks Realiser - will give this a go tomorow


Works a treat: Thanks a lot I owe you a beer.

FYI: for others:

a) This WINFS volume automatically loads on start of emulator.

b) Need to re-jig your code to use different name:

        public static string SD_VOLUME = @ "\WINFS\";
        public static string SD_VOLUME = @ "\SD\";

PS: MICROSOFT_EMULATION is my own custom #define


Would love to know how you found out about this as both reference books don’t mention SD card emulation or WINFS! as far as I can see (which is disappointing).


As far as I remember I looked at the code in the Custom Emulator example that comes with the SDK.

If there is someone out there interested in the emulator, I have some serious problems to solve and I’d like some help… For example how to emulate a 16x2 character LCD.