Main Site Documentation

Networking problem v4.3


#1

Hi!
I just updated some of my µCs to 4.3 especially to test if the builtin network interface of the FEZ Cerbuino Net is now easier to handle (without Premium etc.).
The first problems came up right after updating when I tried to load the network config in the FEZConfig tool. The software just lost connection to the Cerbuino.
I did not stop here because I thought this to be an issue of v4.3 not yet implemented in the FEZConfig.
The first test in VS2012 trying to get the network interface running was not successful.
It is possible to set the IP manually but using DHCP it always hangs at 0.0.0.0
Any ideas?


#2

I just tried exactly our code:

private bool InitNetwork()
        {
            bool result = false;
            try
            {
                eth = new EthernetBuiltIn();
                eth.Open();
                eth.EnableDhcp();
                //eth.EnableDynamicDns();

                while (eth.IPAddress == "0.0.0.0")
                {
                    Debug.Print("Waiting for DHCP");
                    Thread.Sleep(250);
                }

                result = true;
            }
            catch (Exception ex)
            {
                result = false;
                Debug.Print(ex.Message);
            }
            return result;
        }

Now it ends up inside the catch blcok with the following exception:
Microsoft.SPOT.Net.NetworkInformation.NetworkInterface::UpdateConfiguration
Microsoft.SPOT.Net.NetworkInformation.NetworkInterface::EnableDhcp
GHI.Networking.BaseInterface::EnableDhcp
test1.Program::InitNetwork
test1.Program::ProgramStarted
test1.Program::Main


#3

Yes I am familiar with it, what do you want me to try?
I use a Fritz.Box from AVM which perfectly workey until the update to v4.3 :wink: so I do not expect a problem on that side!


#4

Thank you so far.
Except the communication via Wireshark… what else could I try to check if I did everything right? Especially on the update side!


#5

Hi,

I have almost the same problem (cerberus) : it does not crash (or I didn’t wait long enough), but never gets the IP.
The DHCP server is a D-LInk DIR-825.


#6

It could be I am wrong but as I know, these code won’t work on Cerberus or Cerbuino because there is no support for EthernetBuiltIn(). There is only ENC28 supported.


#7

good hint, will check tomorrow…
i have this cerbuino net, so i thought it was “builtin”


#8

It’s surely ENC28. BuiltIn is only supported by EMX and G400D, and, with some additions, G400S…


#9

Hi there,
thanks first of all for your input :clap:! But until now it didn’t work out.
I tried to change from BuiltinEthernet to ENC28 like this


still no IP via DHCP. Then I was frustrated and tried the old way over

```cs]NetworkInterface iface = NetworkInterface.GetAllNetworkInterfaces()[0
;
iface.EnableDhcp();
iface.EnableDynamicDns();

which also got stuck in

while (iface.IPAddress == "0.0.0.0")
{
Debug.Print("Waiting for DHCP");
Thread.Sleep(250);
}

So from my side there is no idea left. Got pretty lost now and do not wanna think about spending so much time on a product not working the way it should. Or is it just me??? :wall:


#10

Failure to get an address from DHCP can have many causes, it may not be the Cerbuino.
I would suggest trying:
-get a valid MAC address and set it. DHCP needs a MAC.
-have something like static byte[] myMAC = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
and then use iface.PhysicalAddress = myMAC; before enabling DHCP.

-if that doesn’t work, try using a fixed IP just to make sure your router is even allowing you access it at all. There may be some security setup preventing access for DHCP.


#11

Already did both suggestions. Fixed IP access works and with a valid mac address DHCP is definitely not working…
Thanks anyway


#12

so the good news is this is not wireless, so you can dig more into what is going on by grabbing a PC and a network hub and network monitor/wireshark and capturing some data to see what the DHCP server sees. It is more than likely that the problem is related to the DHCP server’s response (or lack ofI know you haven’t been posting much here, so have you just started playing with these devices ? There was at least one report of lwIP DHCP not working http://netmf.codeplex.com/workitem/1655


#13

@ NilesDavis -

;
iface.EnableDhcp();
iface.EnableDynamicDns();

I am not sure in cerberus, NetworkInterface.GetAllNetworkInterfaces()[0] will return ENC28 or not. For sure, you should use directly ENC28 object



looks like you are not using gadgeteer, should add 2 lines of code below before open the interface:



```cs
  NetworkChange.NetworkAvailabilityChanged += new NetworkAvailabilityChangedEventHandler(NetworkChange_NetworkAvailabilityChanged);
            NetworkChange.NetworkAddressChanged += new NetworkAddressChangedEventHandler(NetworkChange_NetworkAddressChanged);

#14

I can confirm that DHCP is working on Cerberus with the MAC “00-21-03-00-00-02” … I have a WinServer 2008R2 Dhcp server.
BUT cerberus has problems on HttpListener. The http.dll gives exception when closing NetworkOutputStream, soon after 3 reply.
The HttpListener doesn’t work at all if Cerberus is NOT in VS debug session.


#15

Hi guys. Now I found some time to test all your suggestions, but I had no success.
BUT Just taking the “standard” Ethernet ENC28 v1.1 module worked after 20 seconds in the same setup. I have really no idea but I think I have the right to be somewhat unsatisfied because the Cerbuino Net concept does not have any advantages for me because the about 10$ more investment just does not work.
This is the essence of my test. Sorry GHI
But thanks to you all for contributing to my problems! THX for your support