How to manually change the IP address for the M40

I am using an M40 for Ethernet/IP connected to a custom board.
After implementing a simple Application, creating and adding an ADI, I got to the point of reading and changing the ADI’s Parameters over the Web.

The problem is that users need to be able to manually enter network information, including the IP address of the product to which the M40 is connected.
To do this, I want to store network information in the EEPROM, and when the product is turned on, I want the M40 to change the network settings based on the network information stored in the EEPROM.
I checked the default settings via the webpage and DHCP is enabled, but I want to change it to Static and change the IP address etc.

So what I need is a way to programmatically modify the network information on the M40.
Thank you.

Hi @eloiz,
I am not sure if this would be necessary. The compactcom’s IP address can be set via the HMS IPconfig software by your end customer. This does not require the device to have an IP address already. Once this IP is set it is stored in nonvolatile memory on the compactcom. You would not need to store this IP address yourself.

If you were to start managing the IP address from the host application this could cause issues with Conformance for different network types. Profinet for examples would expect the IP address to be set by the network.

Thank you for your reply.

I want to manage the TCP/IP on the Custom board and the IP on the AnyBus Ethernet/IP m40 module the same.

I wanted to determine whether to use TCP/IP or Anybus Ethernet/IP based on what the user selects on the LCD connected to the product. I wanted to store the IP address in the CustomBoard’s EEPROM, check the mode selected by the user when it is powered on, and set the IP address of the TCP/IP or AnyBus M40.

If that’s not possible, that’s fine. I can recommend that users use the IPConfig software.
But if there is a way, I’d love to hear about it.

Thank you.

Hello @eloiz,

I’m not sure if I fully understand your setup. What do you mean by the TCP/IP vs ABCC? Are you using the RMII version of the ABCC or does your device have its own ethernet port?

To set the IP from you host application you will need to setup a command sequence for setting the IP address. I would recommend reviewing appl_abcc_handler.c for some examples. APPL_SetAddres() may be close to what you need but is for setting the node Id for some networks or the last octet if the IP based on dipswitches.

You will need to consider the state of the device when setting the address. If you are in runtime you will need to restart the compactcom for the address to apply.

There are other things you may need to consider depending on the network type. Some networks have a second NC instance so NC 1 + 2. CClink for example has addr + baud. ECT has a 16-bit ‘addr’ NC instance, in addition to the IP settings.