Anybus CC40/EIP Set MAC Address

Dear Support,

I’m working with an Anybus CC40 for EtherNet/IP.

Starting from your reference application I built an application that communicates with ABCC40 through SPI.

Everything work correctly and now I wondering how to specify the Ethernet Ports Mac Addresses.
My idea is to read the MAC Addresses from Host MCU flash memory and set it into the ABCC. In future I will buy a pool of MACs.

Thank you in advance for your support.

Best regards,
Federico

Dear Federico,

You can use the Ethernet Host Object (F9h), Instance #1, Attributes 9 and 10 to configure the MAC address of the Port 1 and 2.

Best regards
Tareq

Dear TareQ,

thank you for your reply.

To set that MAC I tried to add a command to a user sequence (something like to the procedure to set-up the IP Address):

#define ANYBUS_CC_HANDLER_ABP_OBJECT_MAC_ADDRESS_PORT1      (ABP_ETN_IA_PORT1_MAC_ADDRESS)
#define ANYBUS_CC_HANDLER_ABP_OBJECT_MAC_ADDRESS_PORT2      (ABP_ETN_IA_PORT2_MAC_ADDRESS)


typedef struct ANYBUS_CC_HANDLER_MacElement
{
   UINT16   instance;
   union
   {
      UINT8 value[ANYBUS_CC_HANDLER_MAC_ELEMENT_SIZE_BYTE];
      BOOL  boolValue;
   } value;

} ANYBUS_CC_HANDLER_MacElement_t;


typedef struct ANYBUS_CC_HANDLER_MacSettings
{
    ANYBUS_CC_HANDLER_MacElement_t  macAddressPort;

} ANYBUS_CC_HANDLER_MacSettings_t;


static ANYBUS_CC_HANDLER_MacSettings_t ANYBUS_CC_HANDLER_MacSettingsPort1 =
{
    { ANYBUS_CC_HANDLER_ABP_OBJECT_MAC_ADDRESS_PORT1, { ANYBUS_CC_HANDLER_NETWORK_DEFAULT_MAC_ADDRESS_PORT1 } }
};

static ANYBUS_CC_HANDLER_MacSettings_t ANYBUS_CC_HANDLER_MacSettingsPort2 =
{
    { ANYBUS_CC_HANDLER_ABP_OBJECT_MAC_ADDRESS_PORT2, { ANYBUS_CC_HANDLER_NETWORK_DEFAULT_MAC_ADDRESS_PORT2 } }
};


static ABCC_CmdSeqCmdStatusType UpdateMacAddressPort1( ABP_MsgType* psMsg )
{
    ABCC_SetMsgHeader(  psMsg,
                        ABP_OBJ_NUM_ETN,
                        ANYBUS_CC_HANDLER_MacSettingsPort1.macAddressPort.instance,
                        ABP_NC_VAR_IA_VALUE,
                        ABP_CMD_SET_ATTR,
                        ANYBUS_CC_HANDLER_MAC_ELEMENT_SIZE_BYTE,
                        ABCC_GetNewSourceId() );

    ABCC_SetMsgString( psMsg, (char*)ANYBUS_CC_HANDLER_MacSettingsPort1.macAddressPort.value.value, 4, 0 );

    return ABCC_SEND_COMMAND;
}

but I get an “Unexpected Error”.

Is this procedure correct?

Thank you in advance fro your time.

Best regards,
Federico

Dear Federico,

This is not the correct procedure. The Ethernet Host Object (F9h) belongs to the application and not to the module. So the module will send request to the application to get the information about the MAC addresses and the application must answer with the wanted values.
We have prepared a definitions for this configuration in the example code in the file “abcc_obj_cfg.h”, Which you can use:

** Attribute 9: Port 1 MAC Address (Array[6] of UINT8)
*/
#ifndef ETN_IA_PORT1_MAC_ADDRESS_ENABLE
#define ETN_IA_PORT1_MAC_ADDRESS_ENABLE TRUE
#define ETN_IA_PORT1_MAC_ADDRESS_VALUE “\x00\x30\x11\x00\x00\x01”
#endif

/*
** Attribute 10: Port 2 MAC Address (Array[6] of UINT8)
*/
#ifndef ETN_IA_PORT2_MAC_ADDRESS_ENABLE
#define ETN_IA_PORT2_MAC_ADDRESS_ENABLE TRUE
#define ETN_IA_PORT2_MAC_ADDRESS_VALUE “\x00\x30\x11\x00\x00\x02”
#endif

Best regards
Tareq

Dear TareQ,

thanks for the explanation.

My goal is to configure the module MAC addresses reading this MACs from the MCU Flash Memory.
I thought that it is possible to set the MAC during the module initialization writing some objects.

Thank you.

Best regards,
Federico

Hi there,

Just an Update,

I enabled the processing of ETN_ProcessCmdMsg and I can check that thise case in executed:

#if ETN_IA_MAC_ADDRESS_ENABLE
      case ABP_ETN_IA_MAC_ADDRESS:
      {
         UINT16 i;
         UINT8  abMac[ 6 ];

         ANYBUS_CC_INTERFACE_GetMacAddress( abMac );

         for( i = 0; i < ABP_ETN_IA_MAC_ADDRESS_DS; i++ )
         {
            ABCC_SetMsgData8( psNewMessage, abMac[ i ], i );
         }
         ABP_SetMsgResponse( psNewMessage, ABP_ETN_IA_MAC_ADDRESS_DS );
         break;
      }
#endif

and I added a function to respond with the MAC address.

I also noticed that the attributes 9 and 10 are never accessed.
This could be related to the fact that I use the ABCC as a network HUB and not as a device with two different ethernet ports?

Thank you!

Hi Federico,

Sorry for the misunderstanding. The change of the MAC address for the Port1 and 2 is only possible in the profint modules. It is unfortunately not possible for the Ethernet/IP module.

In the description of the Ethernet Host Object you can find the following statment:

Do not implement attributes #9 and #10, only used for PROFINET devices, if the module shall use the
preprogrammed MAC addresses.

Best regards
Tareq

Hi TareQ,

finally I was able to change the MAC Address writing this Object ABP_ETN_IA_MAC_ADDRESS into the etn_obj.h.

Is this procedure correct for the EtherNet/IP slave?

Is there other way to confgiure a custom MAC address into the ABCC (something hardware or during the module firmware programming)?

Thank you.

Hi Federico,
Yes, this is the only way and the correct way to change the MAC address for Ethernet IP modules.
I’m not sure if there is a possibility by our side to produce the modules with specific MAC address for you.
If you are interested, please contact our sales team in your country and they will check the possibility.

Best regards
Tareq