Here is the code
Problem :
using Ethernet.UseDHCP seems to make the debugger to blow up with the following output message :
Code :
public partial class Program
{
void ProgramStarted()
{
ethernet.UseDHCP();
usbHost.USBDriveConnected += usbHost_USBDriveConnected;
}
void usbHost_USBDriveConnected(UsbHost sender, Gadgeteer.StorageDevice storageDevice)
{
}
}
Reproduce :
Run the program.
Set a breakpoint in usbHost_USBDriveConnected.
Result :
it will never break, and debug mode will blow up.
Remove ethernet.UseDHCP, then everything works fine.
Observations :
NetworkInterface.GetAllNetworkInterfaces()[0].EnableDhcp();
Trigger the same problem
moving ethernet.UseDHCP in usbHost_USBDriveConnected does not solve the problem.
Mike
November 14, 2011, 6:58am
2
UseDhcp is a blocking call and can take many seconds. try putting a Thread.Sleep(1000) before the call to allow the debugger to get attached.
you might have to use mfdeploy to erase the current program.
void ProgramStarted()
{
ethernet.UseDHCP();
Thread.Sleep(15000);
usbHost.USBDriveConnected += usbHost_USBDriveConnected;
}
Does not work, I keep StaticIp for now, I think it’s a bug.
Mike
November 14, 2011, 9:38am
4
I suggested putting the sleep before the UseDHCP. You put it after…
Did you do an erase with MFDeploy?
ddurant
November 14, 2011, 9:53am
5
I [quote]suggested putting the sleep before the UseDHCP. You put it after…
[/quote]
I’ll see that and raise by putting the UseDHCP call in a separate thread…
Mike
November 14, 2011, 9:56am
6
I believe DHCP locks the entire system. I don’t think putting it into a thread will help except for delaying the execution.
Mike, UseDHCP does not block, I successfully break after it. The debugger crash just after ProgramStarted ends.
I don’t erase firmware now, I must continue my project and can use StaticIp for my tests.
When I will erase I’ll post result here.