Way back in July - I was using a Panda with wiznet to prototype a new product.
I finalised the design with an EMX module, and now have my boards back.
The board is up and running - but once again I find that DHCP is not working on this board either ??.
I just get an exception if I try to either ‘EnableDhcp’ OR ‘RenewDhcpLease’ (having enabled DHCP using MfDeploy).
When looking at a packet sniff on the network - there appear to be requests coming from my PC for an IP address - but not from the board (senders MAC is my PC port!!). The PC requests have a MAC address of all zero’s.
None of the MAC addresses seem to correspond with what is on the EMX board label. Even MfDeploy reports a different MAC address :-O.
So - what am I doing wrong here ??? Should I override the MfDeploy MAC with that on the EMX label or what ???.
Help please…
NB I did update the firmware to 4.1.8.0 using your updater tool.
I’ve been using the MAC address configured by MFDeploy for my Cobra, and it works fine. I don’t remember there being a “sticker” on the packaging for the Cobra. Was there one, and is the MAC address hardcoded into the Cobra?
Sorry for the delay - I was not in the office for most of yesterday.
Been trying unsuccessfully to get Ethernet working on ANY EMX product :-((. I have a couple of my own boards with EMX modules.
I also have a Cobra and just put the same code into it, it also will not work :-((.
Using 4.1.8 codebase…
If I set for dhcp - it just barfs with a System Exception after a long timeout.
I have tried setting a static IP using MfDeploy.
I then run some very simple code, and sit in a loop. Ethernet tells me that the cable is connected, and I get a Networkavailabilitychanged event when unplugging and plugging in my cable.
If I try a simple Ping to the board(s) ARP does not even respond (using Netmon on a local non-switching Hub). Tried 2 different cables (as per some posts). Proven the cables in my PC and they are OK there.
MAC set to be that on the EMX sticker. Gateway set to my router. IP set to 192.168.1.200 (Cobra board).
What else do I need to do just to bring up the Ethernet IF :-O.
Code is taken from your or Microsofts ?? simple example with the webclient stuff removed…
public static void Init()
{
if (!Ethernet.IsEnabled)
{
Ethernet.Enable();
}
NetworkInterface[] netif = NetworkInterface.GetAllNetworkInterfaces();
// Ethernet is always the first interface netif[0]
NetworkAvailablityBlocking = new ManualResetEvent(false);
if (!Ethernet.IsCableConnected)
{
Debug.Print("Cable is not connected!");
NetworkAvailablityBlocking.Reset();
while (!NetworkAvailablityBlocking.WaitOne(5000, false))
{
if (!Ethernet.IsCableConnected)
{
Debug.Print("Cable is not connected!");
Debug.Print("Still waiting.");
}
else
break;
}
}
Debug.Print("Ethernet cable is connected!");
while (true)
{
Debug.Print("Waiting...");
Thread.Sleep(30000);
}
}
try enabling the Ethernet interface as dhcp or static addressing. then after the cable is inserted, print out the ip address and gateway of the interface
If Dhcp fails it assign the last static ip assigned.i .e. 192.168.1.200.
Please try another Dhcp server and different cable (even if the cable works with your PC) to isolate the problem. Some community members have encounter some incompatibility issues.
If neither static IP nor Dhcp method worked. Then I beleive there is something wrong in the phsical connection or network settings. Double check the subnet mask, the netwrok ID.
Connect the system directly to your PC using a crossover cable and set static IPs on both sides and ping Cobra’s IP address from the PC.
After connecting the new switch - I forgot that I had set the Static IP Address in code to 200 instead of 101, so I was pinging the wrong address :-((.
SO - the upshot is that the EMX modules don’t appear to like my VERY OLD 10M Hub :-((.
NB I ONLY ever use this when I need to sniff packets on a non-PC hardware :-O, as a switch filters and thus won’t permit this.
So - the Hub is still ‘in circuit’ (so that I can sniff packets) but interfaced through a 10/100/1000 DLink switch, between it and the EMX board.
The board which is working is my own hardware - so an even better result
With the 10M hub directly connected, the ‘link pulse’ LED was lit (Green) but the yellow one was not (ie it sensed 10M), but now its running at 100M I guess - as this LED is also lit (yellow).
Maybe the driver code just doesn’t like working at 10M ?? - 10M IS pretty ‘old hat’ these days I guess :-O.
Anyway - that seems to be this problem resolved.
Many Thanks to those who suggested things to try ;-)).
remove line forcing StaticIp - and it still works, picking up Static IP from MfDeploy (I know - I made it 102 instead of 101
Set MfDeploy Enable DHCP flag, and add back in the DHCP code (see below for those who want it). This also worked, gave me a new IP (correctly DHCP allocated ;-), as well as new DNS server IP’s - even better ;-).
So - problem resolved - down to the hardware I was plugging in to :-(( - which has never failed me before with many ‘other’ hardware interfaces!!
Hope this saga might just help someone else ;-)).
Best regards
Graham
Debug.Print("Enable DHCP");
try
{
if (!netif[0].IsDhcpEnabled)
netif[0].EnableDhcp();// This function is blocking
else
{
netif[0].RenewDhcpLease();// This function is blocking
}
network_is_read = true;
Debug.Print("Network settings:");
Debug.Print("IP Address: " + netif[0].IPAddress);
Debug.Print("Subnet Mask: " + netif[0].SubnetMask);
Debug.Print("Default Getway: " + netif[0].GatewayAddress);
Debug.Print("DNS Server: " + netif[0].DnsAddresses[0]);
}
catch (Exception ex)
{
Debug.Print("DHCP Failed");
}