I am trying to see if the first mount failed then will making a second or third attempt make it work?
Gus sorry to insist but what are you expecting while trying to mount whereas the “SdPS = new PersistentStorage(“SD”);” have failed and therefore SdPs points on nothing.
I’m having a seemingly related issue with closing and reopening file streams. I’m doing a logger as well and in an attempt to make sure that the log file isn’t corrupted during a power loss, I open and close the FileStream each time I write to the file. I’m only writing small strings every 15 minutes, the write takes about 0.06seconds to complete. The issue I’ve got is that after about 3 to 150 writes to the same file I get an exception,
Writing out entry to SD card
#### Exception System.ArgumentException - 0xfd000000 (10) ####
#### Message:
#### Microsoft.SPOT.IO.NativeFileStream::Write [IP: 0000] ####
#### System.IO.FileStream::Write [IP: 002a] ####
#### GadgeteerApp1.Program::Write_EnvironmentalParameters [IP: 0196] ####
A first chance exception of type ‘System.ArgumentException’ occurred in Microsoft.SPOT.IO.dll
An unhandled exception of type ‘System.ArgumentException’ occurred in Microsoft.SPOT.IO.dll
I’m not catching it at the moment, I can add that. My concern is that I’ve tried 4 different cards including a brand new Sandisk 16GB Class 6 SDHC that I bought hoping to resolve this and I get the error on all of them. I had no end of trouble with Kingston cards in my FEZ Domino and everything was fine when I switched to SanDisk. It seems to be throwing on the Close(). The code is almost an exact copy of the code at the following link with modifications for EMX and Gadgeteer where appropriate,
I’ve spent a few days trying to get around this, but my code is fine, that’s not the issue. I believe there is something else going on here. Do I have to leave the File open the entire time this is running? Shouldn’t I be able to reliably open->close and reopen the file when needed?
What device?
I’ve tried it with a 2GB Kingston micro SD in an SD adapter and
a 16GB Sandisk Class 6 Mobile Ultra Micro SDHC in an adapter for SD.
Which Fez device though…
Spider running 4.1
Please check out this tutorial:
Cheers,
Jay jay, I’ve got that bit working fine. Since the tutorial you mentioned only includes card mount and unmount procedures I’m not sure I understand how it’s relevant to the issue. Rest assured however that the code listed on the tutorial page is in my program and it is working properly. The problem I am having is with a properly detected, inserted SD on successive writes. The card mounts fine, writes fine, but after a period of time it stops working and throws that exception.
in that case, this could be POWER related issue…
Please try using Powered USB or a Different USB Port.
GREAT suggestion! I’ll try that when I get home. Thanks.