MAC Address getting reset to all 00's - Anyone else seen this?
#1
Posted 01 November 2011 - 02:04 PM
#2
Posted 01 November 2011 - 05:25 PM
I have now had several instances where my networking on the NetduinoPlus seems to start behaving strangely and when I open up MF Deploy, the MAC address is reset to all 00's and the DNS servers I had setup are changed. I am currently using a 4.2 RTM based firmware... but I have been seeing this from time to time for a while now.
I am aware that these values are reset when flashing the ER_CONFIG, but I am fairly sure it is happening spontaneously (or at least triggered by something else).
Could you please verify that this is indeed happening spontaneously (i.e. without intentionally editing the config sector) by reading it from code (and not from MFDeploy) when it misbehaves?
The config sector should only be read--never written to--unless you specifically do so with your code. [Changing from DHCP to static IP or vice-versa or setting your IP address may trigger a write.]
Chris
#3
Posted 02 November 2011 - 01:16 AM
Could you please verify that this is indeed happening spontaneously (i.e. without intentionally editing the config sector) by reading it from code (and not from MFDeploy) when it misbehaves?
The config sector should only be read--never written to--unless you specifically do so with your code. [Changing from DHCP to static IP or vice-versa or setting your IP address may trigger a write.]
Great advice Chris. I was just about to integrate a MAC address checker in the code so I would know immediately when it had happened and try to determine what I was doing to trigger it.
I am using DHCP and (perhaps redundantly) call the EnableDHCP() method in my initialization code, but I am never changing from or to static. I always use DHCP.
I'll keep an eye on it.
-Valkyrie-MT
#4
Posted 02 November 2011 - 02:06 AM
I'd recommend checking to see whether your Netduino Plus is using DHCP or static IP during startup...and only enabling DHCP if it's not using IP. The config sector doesn't have a backup so if it's being rewritten when the device is unplugged you could lose the data in that sector. Also, flash does have an upper limit to rewrite cycle (10,000's or 100,000 cycles)...so you could in theory wear out the erase/rewrite cycles by looping through that code enough times.I am using DHCP and (perhaps redundantly) call the EnableDHCP() method in my initialization code, but I am never changing from or to static. I always use DHCP.
Chris
#5
Posted 03 November 2011 - 01:22 AM
All I did was press the reset button while my app had been running. I did not pull the USB cable or anything else.
So, I entered MFDeploy and saw that DHCP had been disabled and the MAC address was reset to 000000000001.
I think that the MAC address and DHCP were actually hosed before I pressed the reset button and that's why the NTP was failing. So, I don't think it was caused by pushing the reset button on Netduino.
After setting the MAC and DHCP again everything worked again. I pressed the reset button again, but this time it restarted perfectly.
-Valkyrie-MT
#6
Posted 03 November 2011 - 05:03 AM
#7
Posted 03 November 2011 - 05:19 PM
The story gets even more interesting. When you get the bad MAC address, does turning off and then re-powering the unit do anything for you? If it's working and you cycle power on the Netduino Plus does that fix/break anything?
Also...do you have another Netduino Plus? I wonder if the config sector is worn out (rare but possible). Although the inconsistency of the issue here leads me to lean towards the possibility an lwIP network stack bug.
Ha, I have many Netduino Pluses actually. I haven't seen this follow any particular one, but I'll switch to another to see what happens.
If I power cycle, nothing changes. Once the MAC is set to 000000000001, it stays that way on all subsequent boots... until I set it back with MFDeploy. It's too bad the field is read-only on the N+ because I could store the correct MAC in the SD card and restore it and reboot automatically when N+ boots with a MAC starting with "000000". I would love to see a future version of the firmware enable the setter on the MAC. It's likely to be a simple change and could have other interesting uses to others... Until then, I might create a timer to check the MAC every minute to try and catch when it changes...
-Valkyrie-MT
#8
Posted 04 November 2011 - 12:52 AM
I would love to see a future version of the firmware enable the setter on the MAC.
Wow, I just looked at the firmware source and realized there IS a setter for MAC address. So I just tried it and it totally works. I don't know why I though that you couldn't set the MAC address. I suppose, I will add some code to detect when it is set to 000000000001 and restore the MAC address automatically. Hopefully, in the next few days, I'll see it happen again...
I'll use something like this to start:
var ni = NetworkInterface.GetAllNetworkInterfaces()[0]; if (ni.PhysicalAddress[0] == 0x00) { Debug.Print("Restoring Physical Address..."); ni.PhysicalAddress = new byte[] { 0x5C, 0x86, 0x4A, 0x99, 0x99, 0x99 }; Debug.Print("MAC Address: " + ni.PhysicalAddress.ToHexString()); }
-Valkyrie-MT
#9
Posted 04 November 2011 - 03:33 AM
MAC Address: 000000000001 ********** Restoring Physical Address... +=+=+=+= MAC Address: 5C864A009999 DNS server 1 is: 192.168.5.1 Network initialized! IP address is 192.168.5.100 Gateway Address is: 192.168.5.1 DNS server 1 is: 192.168.5.1 Subnet: 255.255.255.0 DHCP is enabled? False DynamicDNS is enabled? False MAC Address: 5C864A009999 Setting Date and Time from Network Time Server: nist1-chi.ustiming.org A first chance exception of type 'System.Net.Sockets.SocketException' occurred in Microsoft.SPOT.Net.dll Exception was thrown: System.Net.Sockets.SocketExceptionMicrosoft.SPOT.Net.SocketNative::getaddrinfo System.Net.Dns::GetHostEntry Extension::SetFromNetwork Extension::SetFromNetwork NetduinoPlusWebServer.Program::SyncTime NetduinoPlusWebServer.Program::Main
Notice how it failed on "Dns::GetHostEntry" which is probably only because the DNS server is set wrong! I also pulled up Wireshark when this happened, and sure enough it was using the restored MAC address (Notice "SecretLa_00:99:99" below) and was ARPing with the bogus static IP address. So, now, I'm adding back the EnableDHCP command before the MAC Address restore and perhaps next time this happens it will automatically fix itself!
WireShark:
542 87.474419 SecretLa_00:99:99 Broadcast ARP 60 Who has 192.168.5.1? Tell 192.168.5.100
Note: MAC addresses altered to protect the innocent.
-Valkyrie-MT
#10
Posted 04 November 2011 - 03:37 AM
Well, protecting everyone except the person with that MAC addressNote: MAC addresses altered to protect the innocent.
It seems like your config sector is getting wiped out or the entwork stack is not reading in the config sector properly. I have an idea to determine which one it is.
Can you try setting the "USB Name" of your device? So instead of NetduinoPlus, name it something else. Then when the configuration changes...see if the name has reverted to "NetduinoPlus".
My guess is that it's a software glitch in the .NET MF lwIP integration which is acting up in your particular situation...although the fact that depower/repower doesn't fix it pushes me towards thinking it's a config sector issue. [Also, if having written to the config sector 10,000's of times...it might have gotten worn out.]
Chris
#11
Posted 08 November 2011 - 02:43 AM
#12
Posted 23 January 2012 - 03:21 PM
Was there any conclusion to this? My new (and only) N+ is doing the same, MAC-Addy suddenly is 0, also, even after correcting it I can't connect via Ethernat (This post: cant-connect-via-ethernet).
Also, if I untick the use DHCP box in MFDeploy and click "update", it is always back on again when I go back into the Network config window.
#13
Posted 23 January 2012 - 04:46 PM
Are you enabling DHCP via an app which is on your Netduino Plus? If so, then that box would get auto-checked again...Was there any conclusion to this? My new (and only) N+ is doing the same, MAC-Addy suddenly is 0, also, even after correcting it I can't connect via Ethernat (This post: cant-connect-via-ethernet).
Also, if I untick the use DHCP box in MFDeploy and click "update", it is always back on again when I go back into the Network config window.
Could you please try the following?
1. ERASE your current app using the Erase button in MFDeploy
2. Check the firmware version on your device using MFDeploy's "device capabilities option". Is it "Netduino" or "Netduino Plus" firmware? What version?
3. Set your device's MAC Address and give it a Static IP address (not DHCP). Save it.
4. Wait 5 seconds.
5. Now query the MAC address and IP address. Are they what you set it to?
There might be a glitch between the DHCP server and the Netduino Plus. If we can establish the static IP works, then we can debug from there...
Chris
#14
Posted 23 January 2012 - 08:48 PM
#15
Posted 25 January 2012 - 05:15 AM
Was there any conclusion to this?
Here is my conclusion... I am still seeing this about once in 15 reboots but have worked around it. It may be that because I always use DHCP (and most others don't), I see it more. Fortunately, restoring the MAC address as I stated earlier in this thread did the trick. It works EVERY time. My Netduino boots on DHCP perfectly and automatically corrects and restores MAC addresses when needed. It also sets the static/dhcp setting to DHCP because that seems to get set back to static and 192.168.5.1. Thankfully, the 4.2 RC3 firmware fixed just enough of the Netowrking stuff to make this workaround possible...
I saw some bug fixes checked into codeplex after the .NET MF 4.2 RTM that may address this issue so I was holding back on reporting the issue until I had time to test a new version...
-Valkyrie-MT
#16
Posted 09 March 2012 - 03:05 AM
#17
Posted 26 April 2012 - 06:15 AM
Fortunately, restoring the MAC address as I stated earlier in this thread did the trick. It works EVERY time.
I've tried setting the MAC address in code - and I can confirm in code that the address is changed (ie the byte array reflects the new bytes) But when checking the ARP table, I still see the previous mac listed.
Does your other network hardware see the updated MAC?
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users