Domino hanging after start debugging

I´m using a Fez domino and very often I need to unplug the debug cable because the system hungs and comms goes down.
Do anybody knows the reason for thsi or is just a problem with my board ?

Thanks

Is it a particular application? Hard to say without looking at your code.

General:

Based upon the data you have provided I have determined you have a problem. The best solution is to fix the problem.

If you could take a few minutes and explain the problem then we might be able to help you.

Mike,
I press F5 and I check the application behavior; after that if I press the ‘stop debugging’ and change some lines of code.
Very often happens if press F5 again, the system hungs and I need to unplug the usb cable, and plug it again ; even if I reset the board nothing happens in the pc side (i need to unplug).
Thanks

Most likely you have the system in a loop without a wait state. When this happens, there is not time available for the debugger to capture the system and do the upload.

Use the MFDeploy tool to erase your application, then check your code for a loop.

If don’t have a lot of code, then post it here. If you have a lot of code then try reducing it to just the portion than exhibits the problem.

Here is the code , but just the main; of have a few call to other classes for tcp and web functionality that implements threads to accept client requests, but I´m not showing them here because it is a lot of code


using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using GHIElectronics.NETMF.FEZ;
using FezFTC232;

namespace SimplyWay
{
  public class Program
  {
    public static void Main()
    {
      Vars.numBlinks = 1;
      Thread LedThreadHandler;
      LedThreadHandler = new Thread(ledThread);
      LedThreadHandler.Start();

      microSD mySD = new microSD();
      if (mySD.startSD() != 0)
      {
        Vars.numBlinks = 2;
        return;
      }
      if (mySD.readSystemConfiguration("config_sys.xml")!=0)
      {
        Vars.numBlinks = 3;
        return;
      }

      mySD.readDomoticConfiguration("config_dom.xml");

      for (byte n = 0; n <= Vars.divStruct.Length - 1; n++)
      {
        mySD.writeHtmlDivisionFile("division.tpl", Vars.divStruct[n].divisionId, "division.css", "domo.js");
      }
      mySD.writeHtmlMainFile("main.tpl", Vars.projectStruct.ProjectName, "main.css", "domo.js");

      //mySD.stopSD();

      if (Vars.clientType == "FIAS")  // tcp
      {
        //TcpComms myTcp = new TcpComms();
        ////myTcp.startComms("43-185-44-2-206-127", "10.16.1.200", 4411, "255.255.255.0", "10.16.0.1", "10.16.0.1", 1, "fias");
        //if (myTcp.startComms(Vars.mac, Vars.ip, int.Parse(Vars.port), Vars.subnet, Vars.dns, Vars.gateway, byte.Parse(Vars.dhcp)) != 0)
        //{
        //  Vars.numBlinks = 4;
        //  return;
        //}
      }
      else // web
      {
        webServer myWebServer = new webServer();
        if (myWebServer.startComms(Vars.mac, Vars.ip, int.Parse(Vars.port), Vars.subnet, Vars.dns, Vars.gateway) != 0)
        {
          Vars.numBlinks = 4;
          return;
        }
      }


      microFTC232 myFtc = new microFTC232();
      if (!myFtc.InitMsgQueue(5))    
      {
        Vars.numBlinks = 5;
        return;
      }
      if (!myFtc.InitSerialComms("COM1"))
      {
        Vars.numBlinks = 6;
        return;
      }
    }

    public static void ledThread()
    {
      OutputPort LED;

      LED = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, true);

      while (true)
      {
        for (byte N=0;N<Vars.numBlinks;N++)
        {
          LED.Write(true);
          Thread.Sleep(Vars.msStatusLedBlinkTime);
          LED.Write(false);
          Thread.Sleep(Vars.msStatusLedBlinkTime);
        }
        if (Vars.numBlinks > 1)
          Thread.Sleep(Vars.msStatusLedOffTime);
      }
    }
  }
}

Thanks

Please edit your last replay and put the code brackets around you code. It is the 101010 button above the Message box.

Hello,
It´s done.

Thanks

too much code not shown to determine anything helpful.

I noticed that you are returning from main, which is not recommended. I doubt that is the problem.

start with a minimal code base and then add functionality until you see the problem again. then focus in on the code you just added. you need to isolate the problem area.

when I have a similar problem I often add a button at the start of the program and wait for it to be depressed before starting execution. this will allow you to get around the startup problem.

The code doesn’t make sense. How does it return from main?

Yes,
You are right; but the true is the code never reaches the return line codes (just in case of an error, but I agree is not correct).

I beleive the problem has nothing to do with the code; I tried a small example from the ‘Beguiners guide ebook’ and the problem sometimes happens
I noticed, most of the times when that happens, in the output window, it start to reboot and stays with the message ‘rebooting’ for ever; after a few tries an hardware error is returned and in the VS project properties, tab .net micro framework, the device field is empty, so I think VS looses the connection with the domino.

I tried different usb ports without luck, as well another target,

Thanks

Generate a new project and load it. The board LED should blink.

Does the problem still exist?

No, the led does’nt blink but the softw runs ok

Thanks