Hydra deployment problem with SD card inserted

I’ve written a simple data logger program, reading from a serial port and writing the data to an SD card and outputting some data on another serial port. On startup I read a text file on the SD card to retrieve some configuration parameters, if the SD card isn’t inserted then I use some default configuration parameters and don’t log to the SD card.

I’ve noticed that roughly every 2nd or 3rd attempt to download/deploy a new version of my software to the Hydra fails from Visual Studio if the SD card is inserted. If the SD card isn’t inserted then I never have a problem deploying a new version.

Typically I’ll be running my code with Visual Studio attached, then hit shift-F5 to detach, make a build change and then hit F5 to build/deploy/run.

The sympton is when a deploy fails with the SD card inserted is that Visual Studio will reboot the Hydra but the Debug output window stays blank. On a normal sucessful deploy the first line printed in the output window is: Found debugger! followed by a list of assemblies etc.

I call the following routine from ProgramStarted()


void InitStorage()
{
   _sdCard = new GTM.GHIElectronics.SDCard(8);

   if (_sdCard.IsCardInserted)
   {
      _sdCard.MountSDCard();
      GT.StorageDevice storage = _sdCard.GetStorageDevice();
      _sdRootDirectory = storage.RootDirectory;
      string fileName = _sdRootDirectory + @ "\Logs\" + _startupTime.Year + "-" + _startupTime.Month + "-" + _startupTime.Day + "--" + _startupTime.Hour + "-" + _startupTime.Minute + "-" + _startupTime.Second + ".ftilog";
      _dataLogFile = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.Read);
      }
}

Are there any known issues with the SD card module and Hydra around these sorts of symptons?

Thanks

I think there might be an issue, because somebody else reported an issue related to a card being inserted:

http://www.tinyclr.com/forum/topic?id=10494

@ Architect - Thanks, I see in that case it seems to prevent the camera insertion event from firing on startup, but it doesn’t prevent the system from booting and running.

Whereas in my case it seems to cause the system to hang or at least not be able to connect to the VS2010 debugger after the reboot.

I understand and I think he is using Spider.
All I am saying is that it looks like there are some issues when card is inserted. Maybe these two cases will be enough for GHI to double-check that part of the SDK.

@ Sean

There are no known issues related to the Hydra SD in this manner. Your’s is the first report of this. I did a quick test of deploying a simple program to the Hydra and changed it a few times and redeployed with an SD card inserted into the SD module and there are not any hang-ups that you are reporting. Can you try the same deploy/redeploy tests with different code to see if you get the same results? Can you provide a simple program as to repo this issue so we can test here?

@ Aron

I took a look at the Visual Studio output window for Micro Framework Device Deployment and Debug and this is what I’m seeing.

First deployment and startup to the Hydra with the SD card inserted works fine, with the following output.


Micro Framework Device Deployment
---------------------------------
Incrementally deploying assemblies to device
Deploying assemblies for a total size of 106940 bytes
Assemblies successfully deployed to device.


Debug
-----
Found debugger!

Create TS.

 Loading start at 20175a40, end 201a2d84

   Assembly: mscorlib (4.2.0.0)     Assembly: Microsoft.SPOT.Native (4.2.0.0)     Assembly: Microsoft.SPOT.Hardware (4.2.0.0)
..............

Then I hit shift-F5 to detach the VS debugger and make a minor code change and hit F5 again to deploy and run the updated program.

I see:


Micro Framework Device Deployment
---------------------------------
Incrementally deploying assemblies to device
Deploying assemblies for a total size of 106940 bytes
Assemblies successfully deployed to device.

And then Visual Studio displays the following in the status bar:


The debugging target is not in an initialized state; rebooting...

Which it does in all cases, i.e. in the sucessful deploy/run cases, and I hear Windows give me the USB insertion/removal beep, however the output for Debug in Visual Studio stays blank:


Debug
-----



No “Found debugger!” string or anything.

I have the following code called from ProgramStarted:


void InitStorage()
{
	_sdCard = new GTM.GHIElectronics.SDCard(8);

	if (_sdCard.IsCardInserted)
	{
		_sdCard.MountSDCard();
		GT.StorageDevice storage = _sdCard.GetStorageDevice();
		_sdRootDirectory = storage.RootDirectory;
		string fileName = _sdRootDirectory + @ "\Logs\" + _startupTime.Year + "-" + _startupTime.Month + "-" + _startupTime.Day + "--" + _startupTime.Hour + "-" + _startupTime.Minute + "-" + _startupTime.Second + ".ftilog";
		_dataLogFile = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.Read);
	}
}

But given no output to the Debug window I’m not sure that my code has even started running yet.

My guess is that the previous run of the program which had some open files on the SD card at the time it was rebooted is somehow leaving the SD card in some weird state that is preventing the reboot after the deploy from working.

Thanks