Can't Deploy Application from VS 2010
#1
Posted 11 September 2012 - 09:13 PM
#2
Posted 12 September 2012 - 12:02 AM
- Giuliano likes this
#3
Posted 12 September 2012 - 04:35 AM
This happens to me all the time with .NET MF 4.2 (wasn't a problem in earlier versions), it seems to happen when the Netduino app has a main application loop with long (1 second) Thread.Sleep()s in it. I have two different ways that I solve it:
1. Unplug the Netduino and plug it back in, then press F5 really fast so that it catches the Netduino before it has finished booting up.
2. (better) Add some code to your netduino application to allow you to terminate your application. An easy way to do this is to add a jumper (or a switch) to one of the pins, and use an InterruptPort to set a boolean flag which terminates the loop.
Thanks for your response Anthony,
I like # 2, do you happen to have an example on how to accomplish that?
#4
Posted 12 September 2012 - 04:55 AM
#5
Posted 12 September 2012 - 07:25 PM
This is very interesting.
I'm wondering if some feature in .NET MF 4.2 QFE2 is locking out the debugger. If we can figure out which feature it is (or reproduce a simple loop which exhibits this issue), we can share it with Microsoft and try to get to the bottom of it.
If you have a simple repro (~10 lines of code) which reproduces this issue, we'd really appreciate it if you shared it with us. We want to make sure that deployment to .NET MF 4.2 devices is as smooth as possible and even better than with .NET MF 4.1.
Also...if it's not too much trouble to ask, can you try forcing your computer to use the MFUSB drivers for your Netduino instead of the new WinUSB drivers? If the problem is specific only to WinUSB, then that may make this a much easier problem to isolate.
Thank you,
Chris
Hi Chris,
Sure, I will be more than glad to help on this, so I guess I should try the MFUSB drivers and see if the problem persist. Can you point me out where to get them?
#6
Posted 13 September 2012 - 02:37 AM
Hi Chris,
Sure, I will be more than glad to help on this, so I guess I should try the MFUSB drivers and see if the problem persist. Can you point me out where to get them?
Never mind, I found it here:
http://forums.netdui...-mfusb-drivers/
Let's see how it goes with it and I will post my results. By the way I didn't find WINUSB drivers under the C:\Program Files (x86)\Secret Labs\Netduino SDK\Drivers folder, so I guess I don't have them or might be located somewhere else in my hard drive, either that or I always have used MFUSB drivers and didn't know about that
#7
Posted 17 September 2012 - 04:08 AM
#8
Posted 17 September 2012 - 05:49 PM
If it still happens let me know and I will post an example like you asked.
Yes, it is still happening. I noticed that any program that has a Thread.Sleep longer than 2 seconds causes the issue. Also if the program has 2 or more threads running with a Thread.Sleep in them or a lot of processing going on with all of them together.
Anthony, if you already have a sample program that recreates this issue, please upload it here, so Chris can take a look at it, otherwise I will try to have something for him tonight.
Thank you
#9
Posted 17 September 2012 - 10:41 PM
While Not mblnStopped System.Threading.Thread.Sleep(500) End While
PS: My code for terminating the program goes something like this. This code assumes that you are using an external pull-up resistor & connecting a jumper or switch to one of the digital pins (replace "Pin" below in the Interrupt port constructror call with the actual pin).
Private mobjInput As InterruptPort Sub main mobjInput = New InterruptPort(Pin, True, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeHigh) mobjInput.EnableInterrupt() AddHandler mobjInput.OnInterrupt, AddressOf OnButtonPressed While Not mblnStopped System.Threading.Thread.Sleep(500) End While End Sub Sub OnButtonPressed(port As UInteger, state As UInteger, time As Date) If state = 1 Then mblnStopped=True End If End Sub
#11
Posted 18 September 2012 - 01:41 AM
Thanks for the sample Anthony.
I put a little C# sample together using Anthony's VB code provided and using Stefan's speaker class. So this is the way it works:
Once the program is launched (after the N+ is reset) it will make a beep sound using a speaker, if you have one connected to Pin D9 & GND.
If you press the on board switch, then the program will make 2 beeps, indicating it is going into the end state, therefore ending the while loop.
You can use the on board LED instead (led = new OutputPort(Pins.ONBOARD_LED, false); ) or whatever your imagination tells you if you don't have a speaker handy.
Attached Files
#12
Posted 21 September 2012 - 04:02 PM
After a while, trying to deploy a second (or third) time, Visual Studio says
Unable to communicate with device - Serial:COM10
Edit: False alert. It's a different situation.
I changed my program from COM1 to COM2. But I use COM2 to deploy the application.
I guess because my program use COM2 now, Visual Studio can't deploy a new application.
Edited by awaiK, 21 September 2012 - 04:41 PM.
#13
Posted 24 September 2012 - 12:22 AM
#14
Posted 09 October 2012 - 09:34 PM
It seems that some programs will happily deploy while others cause a VS/TinyCRL exception.
For example, when I try to deploy this program I consistently get the VS exception, even if I do a full erase/re-flash first.
SecretLabs.NETMF.Hardware.PWM led = new SecretLabs.NETMF.Hardware.PWM(Pins.GPIO_PIN_D10); int dutyCycle = 0; led.SetDutyCycle((uint)dutyCycle); int dir = 1; int cycles = 0; while (true) { if (dutyCycle > 100) { dir = -1; } else if (dutyCycle < 0) { dir = 1; cycles += 1; if (cycles >= 10) { break; } } dutyCycle += dir; led.SetDutyCycle((uint)dutyCycle); }
The exception is...
---------------------------
TinyCLR Error
---------------------------
An exception occurred while attempting to launch the debugger: Object reference not set to an instance of an object.
---------------------------
OK
---------------------------
There's also an error in the VS output...
Device not found or cannot be opened - USB:Netduino
This program always works fine though.
bool state = false; OutputPort led = new OutputPort(Pins.ONBOARD_LED, state); int flashLength = 250; while (true) { state = !state; led.Write(state); flashLength += 10; Thread.Sleep(flashLength); }
I'm very confused and somewhat frustrated.
#15
Posted 09 October 2012 - 10:33 PM
I'm very confused and somewhat frustrated.
These sorts of issues can be incredibly frustrating, especially when you're not sure it's the code or the Visual Studio issues.
Can you provide some details on your development environment, such as the type of Netduino you're using, the Netduino Firmware version, the .Net Micro Framework you have installed, and the Netduino SDK version?
Hopefully we can get you back up and running.
Cheers,
Steve
Twiiter: https://twitter.com/Gutworks
#16
Posted 09 October 2012 - 10:43 PM
#17
Posted 10 October 2012 - 01:25 AM
It is interesting that in your error it said, "Device not found or cannot be opened - USB:Netduino" and you're using the Netduino Plus. When you create the project are you selecting Netduino Plus Application? You should also see at the top of your code:
using SecretLabs.NETMF.Hardware.NetduinoPlus;
I have tested your code, and it works, however it will go by very quickly and end. Your dutyCycle will climb to 101, and down to -1 several times. Then the application ends after 2039 iterations. Why it ends at that point, I cannot answer at the moment, but am curious.
In any case, I hope this help.
Cheers,
Steve
Twiiter: https://twitter.com/Gutworks
#18
Posted 10 October 2012 - 07:45 AM
#19
Posted 26 May 2013 - 09:51 AM
Hi,
I don't know what i did last night, but my Netduino seems to have stopped working.
I used some loop and sleep, as usually, but now I received "Unable to communicate with device - USB:Netduino" message every time I try to deploy a project.
In MF Deployment Tool I cannot connect, ping, read capabilities, ....I always receive "Error: No response from device" or "Failure - Devce NetduinoPlus2_Netduino is invalid or not responding".
I try to use another USB port but it doesn't work.
I try to use first Anthony method (unplug and press F5 quickly) but it doesn't work.
Any suggestion? Is there any method to clear netduino Program memory?
Thanks in advance
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users