DHCP problem troubleshooter thread

@ andre.m -

up to now you mentioned dhcp works for you?

Using the raw code posted I get the expected IP. My router DHCP list (last image posted, marked in yellow) shows the IP listed.

I reran the test code many times and if I did not use any other code I received the IP expected and received only one call to the NetworkAddressChanged method.

I always receive the correct IP if I did NOT modify the sample code.

However, if I modify the code (such as to display some debugging messages to the T35 display) it fails. I then receive three calls to the NetworkAddressChanged method.

Using Debug.Print() does not seem to bother anything.

The three calls are always:
Call 1) a valid IP
Call 2) IP 0.0.0.0
Call 3) a valid IP
I never receive a fourth call. Only and always three.

Sending a debug message using ‘display.SimpleGraphics.DisplayText(debug message)’ causes the sample code to fail
because then I start receiving three calls to the NetworkAddressChanged method.

I can have the T35 connected without having extra calls to the NetworkAddressChanged method.

If I try to ‘use’ the T35 to display debug messages, within the sample code, I then start receiving three calls to the NetworkAddressChanged method.

In other words, the code is unusable in the real world.

I used the sample code (working OK and only receving one call to the NetworkAddressChanged method).

I modified the code by adding a button event to start the WiFi setup upon a button press. The code does not use the T35 display.
Adding the button event and responding to it did not seem to cause a problem.

I then added a method to setup a HttpWebRequest and then I started receiving the multiple calls to the NetworkAddressChanged method.

I am trying to track down what causes the multiple calls to the NetworkAddressChanged. I’m not a professional programmer. I was trying to write some
code that uses the sample as a base and setup some web requests. When I modified the sample code I noticed that I started receiving the multiple calls…

At the moment i’m trying to see if I can find the specific change that caused the failure.

Have a GREAT day!

@ andre.m -

at the end you have a working ip address and no socket problems if you use the code from ghi, or not?

I do not think I know how to answer you question directly.

I do know that when I run the sample code ‘as is’ (That means I have not made changes to the original code posted by Gus)
I application runs without failure showing the Debug.Print messages. My router DHCP List always shows the same IP address 192.168.2.5.

Method wifi_NetworkAddressChanged(object sender, EventArgs e) is called only once.

I am not sure what you mean by ‘no socket problems’ - Not the brightest blub in the light fixture here…
Unless you mean a socket between the application WiFi and my wireless router. To me (I assume) that socket is created
somewhere inside the GHINET.NetworkInterfaceExtension… I know nothing about what sockets the interface uses…

Like I have said before. Using the sample code my router always shows that the WiFi module IP in in it’s DHCP list.
As a side note: I have/use McAfee and if I look at their ‘My Network’ is also shows it connected.

EDIT: Created a snapshot of McAfee showing IP

I can say (from my point of view) that something is still not working. Even though it shows I have a good IP from DHCP.
(I admit it very well could be my code but I have not been able to create a simple web request without errors).

I used the sample code as a base and added some code that worked on my Spider (Using the Redpine WiFi module for Gadgeteer) and that does not work).
I used the sample code as a base because it said it was made for Cobra II (which I am using). I want it to work for GHI AND me!

I’ll keep out of it until I find a specific reason for the errors that boil down to receving multiple events after using HttpWebRequest request.GetResponse().

I receive… error SocketException ErrorCode = 10054 and then I start receiving three NetworkChangeExtension_NetworkAddressChanged events.

!!! are my Debug messages

!!! ERROR: Inner:System.Net.WebException: connection failed
!!! Exit SetupWebEvent()
!!! EXIT wifi_NetworkAddressChanged 1

!!! WirelessConnectivityChanged-------

!!! Enter wifi_NetworkAddressChanged 2
!!! NetworkAddressChanged WiFideviceIP = 0.0.0.0 Count: 2
!!! ERROR IP not correct 0.0.0.0 Count:2

!!! Enter wifi_NetworkAddressChanged 3
!!! NetworkAddressChanged WiFideviceIP = 192.168.2.5 Count: 3
!!! Calling SetupWebEvent()
!!! Enter SetupWebEvent()
!!! HttpWebRequest is using url: http://192.168.2.5:80/cobrawifi

!!! Inside try HttpWebRequest request.GetResponse()
#### Exception System.Net.Sockets.SocketException - CLR_E_FAIL (4) ####
#### Message:
#### Microsoft.SPOT.Net.SocketNative::connect [IP: 0000] ####
#### System.Net.Sockets.Socket::Connect [IP: 001d] ####
#### System.Net.HttpWebRequest::SubmitRequest [IP: 0019] ####
#### System.Net.HttpWebRequest::GetResponse [IP: 000c] ####
#### GadgeteerTestWiFiWeb.Program::SetupWebEvent [IP: 0099] ####
#### GadgeteerTestWiFiWeb.Program::wifi_NetworkAddressChanged [IP: 005d] ####
#### GHI.Premium.Net.NetworkInterfaceExtension::NetworkChangeExtension_NetworkAddressChanged [IP: 0021] ####
#### GHI.Premium.Net.NetworkChangeExtension::OnNetworkChangeCallback [IP: 00ac] ####
#### GHI.Premium.Net.NetworkChangeExtension+NetworkChangeExtensionListener::OnEvent [IP: 000d] ####
#### Microsoft.SPOT.EventSink::EventDispatchCallback [IP: 0014] ####
#### SocketException ErrorCode = 10054
#### SocketException ErrorCode = 10054
A first chance exception of type ‘System.Net.Sockets.SocketException’ occurred in Microsoft.SPOT.Net.dll
#### SocketException ErrorCode = 10054
#### SocketException ErrorCode = 10054
#### Exception System.Net.WebException - 0x00000000 (4) ####
#### Message: connection failed
#### System.Net.HttpWebRequest::EstablishConnection [IP: 0168] ####
#### System.Net.HttpWebRequest::SubmitRequest [IP: 0019] ####
#### System.Net.HttpWebRequest::GetResponse [IP: 000c] ####
#### GadgeteerTestWiFiWeb.Program::SetupWebEvent [IP: 0099] ####
#### GadgeteerTestWiFiWeb.Program::wifi_NetworkAddressChanged [IP: 005d] ####
#### GHI.Premium.Net.NetworkInterfaceExtension::NetworkChangeExtension_NetworkAddressChanged [IP: 0021] ####
#### GHI.Premium.Net.NetworkChangeExtension::OnNetworkChangeCallback [IP: 00ac] ####
#### GHI.Premium.Net.NetworkChangeExtension+NetworkChangeExtensionListener::OnEvent [IP: 000d] ####
#### Microsoft.SPOT.EventSink::EventDispatchCallback [IP: 0014] ####
A first chance exception of type ‘System.Net.WebException’ occurred in System.Http.dll
#### Exception System.Net.WebException - 0x00000000 (4) ####
#### Message:
#### System.Net.HttpWebRequest::GetResponse [IP: 00d3] ####
#### GadgeteerTestWiFiWeb.Program::SetupWebEvent [IP: 0099] ####
#### GadgeteerTestWiFiWeb.Program::wifi_NetworkAddressChanged [IP: 005d] ####
#### GHI.Premium.Net.NetworkInterfaceExtension::NetworkChangeExtension_NetworkAddressChanged [IP: 0021] ####
#### GHI.Premium.Net.NetworkChangeExtension::OnNetworkChangeCallback [IP: 00ac] ####
#### GHI.Premium.Net.NetworkChangeExtension+NetworkChangeExtensionListener::OnEvent [IP: 000d] ####
#### Microsoft.SPOT.EventSink::EventDispatchCallback [IP: 0014] ####
A first chance exception of type ‘System.Net.WebException’ occurred in System.Http.dll
!!! ERROR: Inner:System.Net.WebException: connection failed
!!! Exit SetupWebEvent()
!!! EXIT wifi_NetworkAddressChanged 3

After receiving the errors above my router (after a refresh) still shows a valid DHCP IP

Sort of funny because I got the Cobra II to use it for a Web Application…

I am not trying to ‘fight’ anyone or say right/wrong about anything.
I am only posting what I find so that maybe the ‘smart’ folks can sense what is wrong from the error list.

I’ll shut-up now

Have a GREAT day!

@ Willgeorge, I don’t think you need to worry about the trial and error stuff, but I would suggest that you start a different thread explicitly on your web event issue, because right now it’s pretty clear to me at least that the DHCP code works for you, which is the main purpose of this thread, and you need some help working past your other code issues.

I have updated my Spider to firmware 4.2.9.0

  1. Latest firmware 4.2.9.0

  2. I did NOT use the sample code.
    I updated previously working code that was using firmware 4.2.7.0
    The application runs as before the firmware upgrade (with minor changes).

  3. Spider version is 1.0 - Using module WiFi_RS21 (RS9110-N-11-21-01)

I have a home network.
My Router is a Belkin N750DB N+ (I do not use the 5GHz option)

My router DHCP list always shows the following for the (WiFi_RS21)
192.168.2.11 - 00:23:a7:1d:86:61

The router DHCP List always shows the WiFi device IP

Tested by:
Debugging from visual Studio.
Spider power on
Spider ‘reset’ button pressed
With and without USB cable connected to the Spider

@ andre.m - Can i ask you a favor? Can you run your application without USB connected and have your system setup (LMODE) to output debug messages to COM1.

I see a strong correlation in WiFi Join / DHCP problems when the device is connected to USB and hardware setup with LMODE to use USB

All my WiFi/DHCP problems are gone when i’m not using USB. I can proof that managed interrupt handlers related to network events, are not always called when running the device in USB mode… Maybe native interrupt logic are also affected (not sure). Although there’s another issue with WiFi i guess that relates to poor WiFi signal… I ordered a WiFi spectrum analyzer and need to do more investigation… As far as i know now… RS9110 is able to to connect and obtain an IP using DHCP… even when the signal is low… But wont start communicating over sockets. To be continued…

I think you experienced the problems with wired Ethernet though? Do you use EMX or also G120?

@ andre.m - Thanks for trying !!

EDIT… Did you disconnect the USB cable during test?

That’s indeed not so much… and i am wondering if the problems experienced by different users are related to the same source.

@ GHI is there any more diagnostics I can help with ? Wifi on Cobra II hasn’t worked for me at all.

likely

My wifi module still not work for my spider.
I almost give up.

I sent a router and Cobra II with a problem to GHI, and the problem has been reproduced.

It seems like it worked fine on power up but not after you reset the board (deploying = reset)

Problem maybe fixed…maybe! We are still testing it.

Happy to beta test this on my Cobra II :wink: :wink: that is still without purpose :expressionless: :frowning:

We shall keep on this, no sleep no eat no bathroom till we have it fixed :wink:

Nicotine shewing gum, coffee, red-bull, coffee, red-bull :wink:

Hope its can be fixed, I do not send my wifi module to sleep forever.
Thanks GHI

the no bathroom is taking things a bit far, especially if you’re plying the beavers with coffee and red bulls ! :slight_smile:

1 Like

Please see this forum topic for a fix for the issue. Please test it and let us know if it corrects your issue in that forum.

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

1 Like

still not working for me - post made in the other thread.

Hello,

I just got my FEZ Cobra II a couple of days ago. As it is my first MF device, I am not really an expert on the framework. So the problem might be me.

But I am having problems with my DHCP. Here is the list:

  1. Latest firmware 4.2.9.0
  2. No changes made to the code.
  3. CobraII WiFi RevB
  4. Interface: WiFi RS21. Onboard WiFi (no rev)

Modem - DHCP Server
| |- Cobra II

  1. AVM FritzBox 7320
  2. wifi_WirelessConnectivityChanged is called as expected. All data seems to be right. But then wifi_NetworkAddressChanged never gets invoked.
    The FritzBox tells me, that the device is connected (Mac address of the Cobra II is shown) with WPA 2, but data transfer rate is 0Mbit.

I am not sure how I can check what happens when I hit the Reset button since I dont know how to reconnect the debugger.

I will be happy to provide more information, if I can help you to solve the issue.

Greetings from Germany
Peter