A really bumpy road

I’m trying to be most grateful for the two Netduino boards I got for free, one for my contest idea and one for answering the questionary. But my repeating failures make me feel like an alpha tester. Right now I’m struggling with this error:

Looking for a device on transport 'USB'
Found device port 'USB' with ID '5c9fd312-9c22-4b3f-a1e7-a53963577179' for transport 'Usb'
Starting device deployment...
Attempting to connect to device 'USB:Netduino' Iteration 0
Opening port \\?\USB#VID_22B1&PID_1000#000000000000#{09343630-a794-10ef-334f-82ea332c49f3}\Operations
Attaching debugger engine...
... cannot attach debugger engine!

This is what happens to my Netduino 3 Ethernet. On the Netduino 3 Wifi I’m back in the problem with the board refusing to show up! I had that problem already and got it fixed, only I can’t remember what it was all about. I wish I could concentrate on my real project and not having solve issues like these.

I get this every now and then, There are a couple of ways to try and get around this.

Reboot the board and deploy
Try rebooting the Netduino using the reset switch. Then try to deploy about 3-5 seconds after you release the reset switch.

Disconnect and Reconnect the Netduino
Sort of obvious what to do here.

Restart Visual Studio
For some reason I was seeing this earlier in the week and VS was having problems and this solved it.

Delete the Application from the board
I normally do this by overwriting the firmware. This can be a bind as you will also have to double check the network settings as well.

This problem can also happen if you have a tight loop in your application. I tend to avoid while (true) constructs unless I put a small Thread.Sleep(...) in there. I always make sure any event driven applications end with a Thread.Sleep(Timeout.Infinite) statement.

This problem crops up every now and then, something we want to address.

Regards,
Mark

What’s the thing with the Sleep function? When Netduino is powered with the USB cable, it starts to perform the previous loaded program, right? And that program should have a Sleep function performed frequently? Is that the only way for Visual Studio (or whichever underlying process) to interrupt everything to deploy a new program?

But the main problem is that this situation keeps repeating all the time! If I manage to reload the firmware, I might succeed in deploying a new program, but I don’t know that, because in the next moment I’m in the same situation. I get running into this situation repeatedly and I don’t know why! The problem is not getting out of it (well, yes, that is also a problem, because its darn hard!), the problem is getting into the same problem repeatedly!

You can erase the app. using MFdeploy. In the future add Thread.Sleep(10000) on the first line of code. This will give you 10 seconds to load your new code if needed.

I get no response from the Netduino when I use MFDeploy. The device shows up on USB (Netduino3_Netduino), but after clicking on Erase, I first get a popup window with an empty table (headers Block Usage, Address and Size), I click Erase (though I feel the table should be filled with something) and after a while the error alert “No response from device”. Meanwhile the MFDeploy text monitor shows the following:

No debugger!
Create TS.
Loading start at 8065cac, end 808cd2c
Assembly: mscorlib (4.3.1.0)
Assembly: Microsoft.SPOT.Native (4.3.1.0)
Assembly: Microsoft.SPOT.Hardware (4.3.1.0)
Assembly: Microsoft.SPOT.Net (4.3.1.0)
Assembly: Microsoft.SPOT.Net.Security (4.3.1.0)
Assembly: System (4.3.1.0)
Assembly: System.Net.Security (4.3.1.0)
Assembly: Microsoft.SPOT.Hardware.SerialPort (4.3.1.0)
Assembly: Microsoft.SPOT.IO (4.3.1.0)
Assembly: System.IO (4.3.1.0)
Assembly: Microsoft.SPOT.Hardware.PWM (4.3.1.0)
Assembly: Microsoft.SPOT.Hardware.Usb (4.3.1.0)
Assembly: Netduino.IP (1.0.0.0)
Assembly: Netduino.IP.Interop (1.0.0.0)
Assembly: Netduino.IP.LinkLayers.CC3100 (1.0.0.0)
Assembly: SecretLabs.NETMF.Diagnostics (4.3.1.0)
Assembly: GoBus (1.5.0.0)
Assembly: SecretLabs.NETMF.Hardware.Netduino (4.3.1.0)
Assembly: Microsoft.SPOT.Hardware.OneWire (4.3.1.0)
Loading Deployment Assemblies.
Attaching deployed file.
Assembly: Blinky (1.0.680

So Netduino really needs a 10 s pause in the beginning of each program ever deployed to the board? Each and every sample program found in the Samples section on the Wilderness site should include the pause line, together with a comment explaining what it is for.
And deploying a program to a Netduino can only happen during 10 seconds after connecting the Netduino to the computer. Each time a new edited version of a program has to be deployed, one has to disconnect and reconnect the USB chord. Am I on right track?

Press F5 before erasing. The 10 second delay is only to allow you to debug. You do not have to use a delay.

What I really want to do is test and develop a program, following this simple routine:

  1. I write code
  2. I click on Run, Debug or Whatever to make my code compile and deploy to the Netduino
  3. I notice how Netduino works according to my code
  4. I decide to make changes in the program, so I jump to step 1.

And on step 2, the magic moment of deployment, I expect the previous program on Netduino to halt abruptly, while the new program is deployed. And when it’s completed, the program starts. And I advance to step 3.

But I seem to be missing something crucial here, please, tell me what it is! Between step 2 and 3 I get into trouble. The text monitor in Visual Studio tells me that “cannot attach the debugger engine”. I have to try to erase the previous program by reflashing the firmware and whatnot. Surely it’s not meant that I should do that every time I want to test changes in the code.

Right now I managed to deploy the sample program, where the button lights the led on the board. I added the 10 s sleep in the beginning. The program seemed to work. And now I try to run the SDCardIO sample project. Back to square zero! “Cannot attach the debugger engine”.

Hi Johan,

When I hit the Debug project, and it seems that it runs the previous build of the project, I normally do a clean, then build, and then explicitly click the “Deploy” button to make sure I download the project to the netduino, and then I finally hit the Debug button.

That way, my projects have worked almost always. No need to reflash the device or anything.

Thanks,
Jorge

My Netduino doesn’t seem to run the previous build. It does simply nothing! It just shows the “Cannot attach the debugger engine” message when I try to deploy.
edit
Oh, now I got it. By running the previous build you mean Netduino keeps running the previous program when it is supposed to receive the new build. Yes, it appears to do that all the time. Or it appears to perform some corrupted memory when something has gone bad. I mean, if I deploy a faulty program, I can’t say what the program does, when I try to deploy a new build. It might be stuck in a tight loop or just randomly perform nonsens commands due to corrupted memory and simply doesn’t have time for communicating with my computer and Visual Studio.

After reflashing the firmware, I’m able to deploy partially the Blinky program. It doesn’t work, but at least it doesn’t hang up immediately with failing the debugger thing. It fails after these lines:
Found debugger!

Create TS.

 Loading start at 8065cac, end 808cd2c

Assembly: mscorlib (4.3.1.0)

Assembly: Microsoft.SPOT.Native (4.3.1.0)

Assembly: Microsoft.SPOT.Hardware (4.3.1.0)

Assembly: Microsoft.SPOT.Net (4.3.1.0)

Assembly: Microsoft.SPOT.Net.Security (4.3.1.0)

Assembly: System (4.3.1.0)

Assembly: System.Net.Security (4.3.1.0)

Assembly: Microsoft.SPOT.Hardware.SerialPort (4.3.1.0)

Assembly: Microsoft.SPOT.IO (4.3.1.0)

Assembly: System.IO (4.3.1.0)

Assembly: Microsoft.SPOT.Hardware.PWM (4.3.1.0)

Assembly: Microsoft.SPOT.Hardware.Usb (4.3.1.0)

Assembly: Netduino.IP (1.0.0.0)

Assembly: Netduino.IP.Interop (1.0.0.0)

Assembly: Netduino.IP.LinkLayers.CC3100 (1.0.0.0)

Assembly: SecretLabs.NETMF.Diagnostics (4.3.1.0)

Assembly: GoBus (1.5.0.0)

Assembly: SecretLabs.NETMF.Hardware.Netduino (4.3.1.0)

Assembly: Microsoft.SPOT.Hardware.OneWire (4.3.1.0)

Loading Deployment Assemblies.

Attaching deployed file.

Assembly: Blinky (1.0.6808.14)

Resolving.

The debugging target runtime is loading the application assemblies and starting execution.
Ready.

'Microsoft.SPOT.Debugger.CorDebug.14.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.Native.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.14.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.Hardware.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.14.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.Net.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.14.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.Net.Security.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.14.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\System.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.14.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\System.Net.Security.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.14.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.Hardware.SerialPort.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.14.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.IO.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.14.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\System.IO.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.14.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.Hardware.PWM.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.14.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.Hardware.Usb.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.14.dll' (Managed): Loaded 'Netduino.IP'
'Microsoft.SPOT.Debugger.CorDebug.14.dll' (Managed): Loaded 'Netduino.IP.Interop'
'Microsoft.SPOT.Debugger.CorDebug.14.dll' (Managed): Loaded 'Netduino.IP.LinkLayers.CC3100'
'Microsoft.SPOT.Debugger.CorDebug.14.dll' (Managed): Loaded 'C:\Program Files (x86)\Secret Labs\Netduino SDK\Assemblies\v4.3\le\SecretLabs.NETMF.Diagnostics.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.14.dll' (Managed): Loaded 'C:\Program Files (x86)\Secret Labs\Netduino SDK\Assemblies\v4.3\le\GoBus.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.14.dll' (Managed): Loaded 'C:\Program Files (x86)\Secret Labs\Netduino SDK\Assemblies\v4.3\le\SecretLabs.NETMF.Hardware.Netduino.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.14.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.Hardware.OneWire.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.14.dll' (Managed): Loaded 'C:\Users\johan\Documents\Visual Studio 2015\Projects\Blinky\SourceCode\bin\Debug\le\Blinky.exe', Symbols loaded.

There it stopps. It won’t blink. In VS I can click the stop button among the debug controls. It takes sometime, then I get this:

Looking for a device on transport 'USB'
Found device port 'USB' with ID '73421b37-15c5-4b70-bd2c-d5c3e23f53ca' for transport 'Usb'
Starting device deployment...
Attempting to connect to device 'USB:Netduino' Iteration 0
Opening port \\?\USB#VID_22B1&PID_1000#000000000000#{09343630-a794-10ef-334f-82ea332c49f3}\Operations
Attaching debugger engine...
... debugger engine attached!
Querying device assemblies...
Found Assembly mscorlib 4.3.1.0
Found Assembly Microsoft.SPOT.Native 4.3.1.0
Found Assembly Microsoft.SPOT.Hardware 4.3.1.0
Found Assembly Microsoft.SPOT.Net 4.3.1.0
Found Assembly Microsoft.SPOT.Net.Security 4.3.1.0
Found Assembly System 4.3.1.0
Found Assembly System.Net.Security 4.3.1.0
Found Assembly Microsoft.SPOT.Hardware.SerialPort 4.3.1.0
Found Assembly Microsoft.SPOT.IO 4.3.1.0
Found Assembly System.IO 4.3.1.0
Found Assembly Microsoft.SPOT.Hardware.PWM 4.3.1.0
Found Assembly Microsoft.SPOT.Hardware.Usb 4.3.1.0
Found Assembly Netduino.IP 1.0.0.0
Found Assembly Netduino.IP.Interop 1.0.0.0
Found Assembly Netduino.IP.LinkLayers.CC3100 1.0.0.0
Found Assembly SecretLabs.NETMF.Diagnostics 4.3.1.0
Found Assembly GoBus 1.5.0.0
Found Assembly SecretLabs.NETMF.Hardware.Netduino 4.3.1.0
Found Assembly Microsoft.SPOT.Hardware.OneWire 4.3.1.0
Adding pe file C:\Users\johan\Documents\Visual Studio 2015\Projects\Blinky\SourceCode\bin\Debug\le\Blinky.pe to deployment bundle
Attempting deployment...
Incrementally deploying assemblies to device
Deploying assemblies for a total size of 864 bytes
Assemblies successfully deployed to device.
Restarting interpreter...
Attaching to device...
Waiting for device to initialize...
The debugger engine failed to receive any debug events from the debugging target

And after that it can’t find the debugger anymore, before I reflash the Netduino again.