C++ ODVA to Anybus AB7306

Hi all,

We are trying to connect to Anybus X-Gateway AB3706 via cpp code. We succeed to get the gateway status, all good when reading. However we are not able to write anything. We checked the CIP transit using Wireshark and communication is okay, we get a succed communication from Anybus when writing (that’s what Wireshark catch…but anything seems to be written).

This is the CIP library we use.

Thank you in advance,

Carles Vela

Attached you can find some more info about our tests. It seems to be something insided Anybus gateway because Input buffer get the data we send thru our cpp code (as seen in the image attached)

qmod_ab7306_inputbuffer test.hcg (56.2 KB) test_canpen_manager_sn_20210715.hcg (48.8 KB)

What X-gateway are you using? I can’t find a AB7306.

I am also a little confused what network protocol you are using. In your original post you are asking about CIP/Ethernet/IP. In your second post you are giving an example using modbus TCP.

You should be able to use the a unconnected/explicit read for assemblies input 100 and output 150.
Here are two quick example for one of our EIP interfaces with the molex tool.


Hi,
Thank you for your response. We’re using this model of gateway, Ethernet/IP slave, CANopen master.
In our C++ we are using CIP to recive and send the data of the buffers, and now we are reading correctly the buffer values that comes from CANopen, but when we are sending the values to the input buffer via CIP, these are not sent through the CANopen network.
In the above screenshots we are using ‘QModMaster’ only to check if the values sent via CIP are correctly mapped inside the buffer.
We will look further with ‘molex’ tool to to write to set the values to the buffer.

I see, the canopen configuration appears correct and your wireshark shows a successful set attribute. Nothing stand out as wrong here, is the CANopen bus in run mode?

Deryck

Good morning,
Thank you for you response. I’m adressing you in order to provide more info about our problem. Next are the captures of the ‘molex’ program, getting all the instance class and then ‘set single attribute’ to the buffer and getting the value of the buffer with ‘get single attribute’:



The status of LED5, corresponding to CANopen network is ‘On, green’ and seems like the values are read correct, because the CANopen values of 0xB and 0x16 are always the same, and then we can confirm in the ‘Anybus Configuration Manager - CANopen’ in the following captures (first captures are the configuration and mapping):



Recieve Long whose value we know:

But when we are cheking the Transmit Longs are always equal to 0:

This is the CANopen traffic capture:

Any idea about wha’ts happening? Thank you in advance

Can you read Transmit long 1 with the online object access too? What value do you see?

What is the state of the CANopen network? Is it in run mode?

Hello Deryck,

Thank you for your fast responses.
.

Can you read Transmit long 1?

Yes, we can read all the Transmit Long

with the online object access too?

Yes, with the online object acces too.

What value do you see?

We see the same Values that we are reading through canAnalyzer, in case of Transmit Long 1, we see 00.

What is the state of the CANopen network? Is it in run mode?

The CANopen network is in Operational state(LED 5 in Green), is the same thing?
.

.
Carles Vela

Can you use the line listener in ACM CANopen to get a capture of the CAN traffic? Start logging then read several of the transmit objects. I would like to use this to verify that the bus is running and see what values are read from the module.

Hey, here’s the log of ACM - CANopen Line Listener.
Line Listener Data - 210720 084001.txt (735.0 KB)

Do you have an ethernet/IP master that can establish a class 1 connection to the EIP side of the device? A colleague has suggested that the connection might be timing out for you and clearing the data.

Deryck

Hey, yes we have an Ethernet/IP master with class 1 connection. To make sure it’s not a code problem we tested the gateway with the RSNetWorx uploading the EDS file of the device and sending the command from there. You can view that in the following images.
EthernetConecctionConfig

It seems that the message is sent succesfully but we are getting the same response from the gateway. Do you know any other way to test the gateway or see something strange in this test?

I am not 100% sure that is making a class 1 connection the instance editor is showing a set attribute single.

Can you try this tool this is similar to the molex tool but has an option for process data. Ethernet/IP Tool - EtherNet/IP Adapter - Knowledgebase
You will need to set the assemblies by clicking the button near number 1.
At number 5 you will also need to set the io size to match the assemblies on the gateway. you can read this from obj 3000 and 3001 in the CANopen object explorer.

Tested, I’m getting connection timeout. Maybe I’m configuring something wrong… Here the photos of the test:


config

Hi again, after redoing the test now I’m getting the following result with the same configuration:


The IP of the gateway is 192.168.4.1 and the IP of the computer 192.168.4.182.
I’m not sure if the photo is uploading, the error is: CIP Status = 0x1 (Connection failure) | Ext. Status = 0x106(OWNERSHIP CONFLICT)

Thanks in advance

Was RSnetworx still connected that may be conflicting.

You we’re right, with that program is working properly. Any idea of why our c++ code isn’t working? Do you have a minimal example of that working with c++? We are not used to Ethernet IP, setAttributeSingle means it’s not a class1 connection? Which would be the class 1 command if it’s not that?

Thanks a lot for all your support.

The difference is your c++ program is a single explicit request for data vs a class 1 connection.
Try disabling the run/idle header for the EIP side to see if this prevents the EIP connection from timing out and clearing the data. set 0x3071 to 0.

We made it work sending the commands via UDP and not TCP.
Thanks a lot.

Thanks for the update glad to hear it is working.

Deryck

1 Like