How can I know the network connection status for Anybus IP?

Hi,

I have a design based on Anybus IP (Profinet and Ethernet/IP) implemented in Xilinx Zynq-7030. My custom Linux application is based on source code ABCC Starter Kit 3.04.01 and ABCC Driver 5.04.01.

I think that my request should be easy to answer; I need a way to determine whether or not the network cable is connected. I know that the callback function (ETN_SetAttrSuccessCallback) is being executed whenever I plug or unplug the network cable, but I can’t find an attribute that tells me which state I am in.

I know that ANB_STATUS toggles between “ABP_ANB_STATE_WAIT_PROCESS” and “ABP_ANB_STATE_PROCESS_ACTIVE” when the Profinet PLC gets disconnected/connected, but I don’t see a change of state when I just unplug/plug the cable to a standard network.

Is there a variable or object that can tell me the network status? Thanks.

Yannick.

Hi @yfortin

Just to make sure, is this device the AB6605

https://www.anybus.com/support/file-doc-downloads/compactcom-40-series-specific/?ordercode=AB6605

Hi Tim,

Not quite… I am using the Anybus IP for Xilinx Zynq SoC:
https://www.anybus.com/fr/technologies/wireless-others/anybus-ip-for-xilinx

But the Anybus IP appears to share the same documentation as the CompactCom modules. Therefore if you know the answer for that module please let me know, as it will probably apply to my configuration as well.

Thank you,
Yannick.

It looks like you might be able to do this by making a request to the Ethernet Host Object F9h and then get access to instance 1 attribute 8 and then read bits 3 and 4

image

image

See attached manual:

Hi Tim,

Thank you very much, that looks indeed like the attribute I was looking for!

However I have tried to read that attribute and I’m getting error code 8 (ABCC_EC_RESP_MSG_E_BIT_SET) when verifying the contents of psMsg with ABCC_VerifyMessage(). Do you now what that means?

I am using a command sequence that requests the attribute through the following call:

ABCC_GetAttribute(psMsg, 249, 1, 8, ABCC_GetNewSourceId() );

Where:

249 is the decimal value for Ethernet Host Object (F9h)

1 is the instance number (Instance Attributes)

8 is the attribute number (Network Status)

The UINT16 value retrieved from psMsg is either 0x0003 (when network unplugged) or 0xA803 (when network is connected). That doesn’t quite fit the bit description given for the Network Status attribute, although it seems I could actually use these values to determine whether or not the network is present (but that wouldn’t be very clean).

For test purpose I have tried to get a UINT16 value from another random attribute (Network Configuration Object – Instance #0 – Attribute 3) and I can successfully read the expected value (13) without any error. This seems to indicate that my code is working generally-speaking.

ABCC_GetAttribute(psMsg, 4, 0, 3, ABCC_GetNewSourceId()); à This yields value 13

Can you tell by any chance why the Network Status attribute is reporting an error?

Thanks,

Yannick.

Tim,

Also, I just noticed that the Network Status field is specified for access “SET” but not “GET”.

Can I really get the status I need from that attribute?

Thanks,

Yannick.

Hi Yannick,

Take a look in the etn_obj.c and the abcc_obj_cfg.h for the following:

It looks like if you take a look at ETN_IA_NETWORK_STATUS_ENABLE, ETN_OBJ_ENABLE and enable them, and then take a look at etn_iNetworkStatus then you should be able to get the information.

There is another object config define that should allow you to have more of a callback routine, but you’ll need to define the implementation yourself here: ETN_OBJ_USE_SET_ATTR_SUCCESS_CALLBACK

You’ll need to implement this function if you use that optional callback:
ETN_SetAttrSuccessCallback( iInstance, bAttribute );

Hi Tim,

Thanks for the advice, but no luck…

I already had the following defines in abcc_platform_cfg.h, which if I understand correctly overrides the default configuration.

#define ETN_OBJ_ENABLE TRUE

#define ETN_IA_IP_CONFIGURATION_ENABLE TRUE

#define ETN_IA_NETWORK_STATUS_ENABLE TRUE

#define ETN_OBJ_USE_SET_ATTR_SUCCESS_CALLBACK TRUE

I have printed these parameters on screen during execution to make sure that they were correctly asserted. I have also tried to change the values from FALSE to TRUE directly in
etn_obj.c and abcc_obj_cfg.h, but it doesn’t change the behavior.

I was already using the callback function and that is working well (it gets called each time I plug/unplug the network cable). But I an still getting an error when I try to fetch the Network Status attribute from the Anybus IP.

I’ve tried to access several other objects and most of them return similar error, but not all.

Are there other configurations that I should be enabling?

Thanks,

Yannick.

Hmm let me try and escalate this to a colleague in sweden and see if he has any recommendations.

Hi Tim,

Actually, I just figured a way to do it;

I noticed that there is a static variable “etn_iNetworkStatus” which is defined in etn_obj.c, and which is already being managed by the driver to retrieve the network status.

By reading that variable, I am getting the status that I need and without error. I did not analyze the source code fully so I don’t yet understand why my own command list would not yield the same result, but it doesn’t matter as long as I can get the status…

Thanks,

Yannick.

Hmm ok at least we got it working for now, but I’ll see what else I can find out

Hi Tim,

Actually I find the “etn_iNetworkStatus” variable very convenient and it does the job very well. That solution works out for me.

However, I’d very much like to understand why I’m unable to run a command sequence correctly. I have just posted another question on this forum about updating the IP address from the driver. It seems I cannot successfully write the required command sequence, or at least it doesn’t do what I’d expect. It could be (or not) the same issue that I had when trying to read the network status.

Are there preparatory steps that should be executed prior to sending a command sequence to the Anybus IP? Perhaps I’m unwillingly skipping some steps…

Thanks,
Yannick.

One of my Swedish colleagues just sent me a message on this.

He said that when we were looking in the manual we were reading it in the wrong direction. The application does not read the attribute from the command, it’s already located in the RAM on our side as long as the correct parts of the Host Ethernet Object are Implemented in the right way.

He was saying that only set is required because it’s located on the application side and that it’s the compactcom that writes the new status whenever needed

Good, it all makes sense. The solution works for me.
Thank you very much Tim for your help!
Yannick.

1 Like

Glad we could help!