Author Topic: Failed to register IP address error  (Read 7115 times)

Tom Miller

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Failed to register IP address error
« on: January 03, 2014, 07:48:38 pm »
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

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2105
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Failed to register IP address error
« Reply #1 on: January 04, 2014, 11:09:30 am »
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

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: Failed to register IP address error
« Reply #2 on: January 04, 2014, 12:58:05 pm »
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

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2105
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Failed to register IP address error
« Reply #3 on: January 06, 2014, 10:09:14 am »
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

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: Failed to register IP address error
« Reply #4 on: January 06, 2014, 04:50:36 pm »
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

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2105
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Failed to register IP address error
« Reply #5 on: January 09, 2014, 05:58:54 pm »
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

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: Failed to register IP address error
« Reply #6 on: January 11, 2014, 02:17:55 pm »
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

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2105
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Failed to register IP address error
« Reply #7 on: January 13, 2014, 10:16:13 am »
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

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: Failed to register IP address error
« Reply #8 on: January 20, 2014, 04:58:43 pm »
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

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2105
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Failed to register IP address error
« Reply #9 on: January 22, 2014, 04:15:23 pm »
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
« Last Edit: January 22, 2014, 04:24:01 pm by Andy Ayre »
Embedded Systems Academy, Inc.
support at esacademy dot com

Tom Miller

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: Failed to register IP address error
« Reply #10 on: January 27, 2014, 04:29:35 pm »
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

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2105
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Failed to register IP address error
« Reply #11 on: January 28, 2014, 04:02:22 am »
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

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: Failed to register IP address error
« Reply #12 on: February 10, 2014, 10:33:56 am »
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

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2105
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Failed to register IP address error
« Reply #13 on: February 10, 2014, 06:08:42 pm »
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

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: Failed to register IP address error
« Reply #14 on: May 12, 2014, 10:23:42 am »
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