Failed to register IP address error

Started by Tom Miller, January 03, 2014, 10:48:38 AM

Previous topic - Next topic

Tom Miller

Hello,

I am testing the LPC1768 ethernet bootlader with Flash Magic 7.67.
It was running fine the last two days. Today, out of the blue, Flash Magic won't connect anymore with the above error message. Did not change anything compared to yesterday. Flash Magic started of course with administrator rights.
Seems to me Flash Magic does not even try to communicate with the bootloader, it aborts right after I press the Start button.
I am a Windows programmer myself (Rad Studio XE5 and Visual C++) so I could provide debugging support.
Thanks,
Tom

Andy Ayre

Flash Magic has to register the IP address for the MAC address you have enrtered with Windows by manipulating the ARP table. It does this by calling the 'arp' command. You might want to try it manually and see if you can spot anything strange.

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

Tom Miller

ok, could you please give me the exact arp command you do programmatically which leads to this IP address error message? I could then debug this for myself. Do you spawn a cmd.exe process for this arp command or do you use some kind of API for this?

Thanks,
Tom

Andy Ayre

Hi Tom, Sorry, the 'arp' command isn't used; we use the API function SnmpExtensionQuery. Can you please generate and send us a debug file? Instructions are here: http://www.flashmagictool.com/debugfile.html.

regards, Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

Tom Miller

Hi Andy,

please find attached the debug file.

If you could generate a small test program with the portion of the code which leads to this error, I could offer you to debug this and find hopefully the reason. To be able to do this on my machine, the test program would have to be a project in either Visual C++, .Net or Rad Studio XEx C++.

Thanks, Tom

Andy Ayre

Sorry for the delay in getting back to you. The debug file didn't help. We've added some more diagnostics to try and see what is happening. Please download and copy the following DLL into your FM installation:

http://www.flashmagictool.com/temp/FlashMagicARMCortexEthernet-r3453.zip

Start FM, go to Help -> About and make sure the ARM Cortex Ethernet driver version is 2.08.3453. Then generate a new debug file and send it to us. Thanks.

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

Tom Miller

Hello Andy,

the version you attached is "ARM Cortex Ethernet Driver Version 2.08.3296", not 3453, at least Flash Magic says this.
Here is the new debug file.
Thanks, Tom

Andy Ayre

The Windows function SnmpExtensionQuery(SNMP_PDU_SET, ...) returns the error code SNMP_ERRORSTATUS_GENERR. Unfortunately that's a generic error code so it isn't very helpful.

This code is very close to what we are using if you want to give it a try at the low level yourself:

http://www.codeproject.com/Articles/22483/Edit-Add-Remove-Modify-ARP-Tables

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

Tom Miller

Hello Andy,

I tried this project and there the call to pfnSnmpExtensionQuery(SNMP_PDU_SET...) results not in error code 5 but in success.

I believe I found a solution:

The first time I press start in FM it tries to connect without the error message and timing out if bootlaoder not found. Beginning from the second press of start button, the error msg pops up at once. The Arp test project shows in this case that there is an invalid entry (created by FM) with mac 00-00-00-00-00-00 and FM fails to overide it.

So with every start press, if FM could check if this entry is already there and either
a) delete it and recreate it or
b) skip creating it and continue

I am not sure if a) or b) would work better (depending if this entry is really invalid or could be used anyway), probably have to test it.

Could you create a test version with it?

Or, another question, could you give me parts of the FM project, lets say some kind of empty template where just the ethernet connect code is present, don't need and want of course all the flashing stuff. With this I could figure out a stable solution for this problem.

Thanks,
Tom


Andy Ayre

#9
We are unable to reproduce either of the problems you see (connection failed and bogus entry with MAC address of zero). However, please try this DLL:

http://www.flashmagictool.com/temp/FlashMagicARMCortexEthernet-r3296.zip

If it doesn't help please generate a new debug file and send it to us. Thanks.

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

Tom Miller

Hello Andy,

please find attached the new debug file.

It is like before: first time FM tries to connect as it should with its internal timeout (3-4sec?), right after that, next connect immediately pops up the error message box. If I wait for like 30sec, the next connect is ok again.

I am aware that you can't reproduce that on your machine, since I am programming also hardware related software for customers I often have exactly the same case, errors on their machines but not on mine because of different HW/SW. Thats why I offered you to debug a striped down version of FM (just the Eth connect code) on my machine.

Thanks, Tom

Andy Ayre

The problem is as you pointed out - an invalid entry with a MAC address of 00-00-00-00-00-00 mapped to the IP address you are using for the bootloader. Flash Magic attempts to remove this entry and it can't.

Can you manually remove that entry? If so what exact command are you using?

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

Tom Miller

Hello Andy,

sorry for the late reply, I was quite busy in the last days. But I am still very interested in a solution for this (I want to install a Cortex M3 device in the cellar and want to flash from remote).

No, I can't manually remove this entry. The test project from codeproject can't do this and I don't know any other way.

But like I wrote in my last posts, I see at least 2 ways to continue:

a)  debug a striped down version of FM (just the Eth connect code) on my machine and try to find a solution

b) "Flash Magic attempts to remove this entry and it can't." -> in your connect code, don't do this. If the entry is there, do try to continue with the connect code without throwing a error msg box. MAC 00-00-00-00-00-00 is probably not really invalid but just a intermediate step before Windows can see the real MAC once there was a communication.

Thanks, Tom


Andy Ayre

The attached DLL attempts to use the bootloader even if it cannot add an entry to the ARP table.

However if you cannot remove the strange entries even with admin permissions then I think something more fundamental is wrong with Windows.
Embedded Systems Academy, Inc.
support at esacademy dot com

Tom Miller

Ok, I give up on trying to improve Flash Magic with this special bug.
A workaround is to wait for like 1 minute or so, then the zero MAC entry will vanish and FM tries to connect normaly. Or another workaround is to increment the temporary IP address each time before a new connect attempt.

Thanks Tom