Main Site Documentation

Store data in SD without debuging


Hello, i’m doing an application that reads some values and put them into a file in the my SD, when i’m running the aplication from the debug it works fine and stores data, but when i only power the FEZ without debuging, it doesn’t create the file in the SD.
I’m using the Fez Panda tinkerer kid.


Are you sure your power source is supplying enough current for your project to run?


i’m only using the usb port to supply my FEZ panda, but what i don’t understand it’s why the file in the SD is only created when i’m in the debug mode from the visual studio but not when i only use the usb port to supply.
i don’t have more hardware than the included in the tinkerer kit.


I think in this situation you really need to post code.


I’ve changed position of the variables like 100 times, but it’s the same, the SD only stores data when visual sutdio is debuging.
Here is the last code i’m using:


sorry for the last catch statement i cut it using paint XD


Erm… Why are there two nested try…catch’s?


well i use the principal try-catch for all the code in the principal function, and one try-catch for the SD functions, but it’s the same code i was using at first.

The code works fine in every place i put it, but only in debug mode :frowning:

maybe it’s something i’m doing wrong with the UnmountFileSystem for the SD.


Instead of adding your code as a picture you should paste the code inside your text using the code tag.

When it comes to the code it seems that your mounting the SD card, opening a filestream, writing some data, closing the filestream but I cant see where you unmount the SD card. If this is a logger then you might run into problems on the next log entry.

It might be better if you first mounted the SD card and initialized the filestream, then inside a loop do all your write commands. When finished close the stream and unmount the SD card.

You might also take a look at this


If you are using serial port events in your code?

connect a small display to print out debug messages. Or send debug messages over a serial port…then you can trace down your program to know where it is at.


Try pausing a bit after you mount the file system. I normally Thread.Sleep for 500ms. This has fixed some of my SD issues in the past…but I would get exceptions. You are not?



ok i’ll try it :slight_smile: