CAN Frames not being sent Anybus CAN to modbus tcp

Hi All,

I have an Anybus communicator CAN to modbus TCP server.

I have setup several CAN produce frames to be sent
My problem is, I see no CAN frames being sent by the AnyBus, measured either at the AnyBus, or at my usb-CAN adapter that I am using to monitor the CAN network.

When I write using modbus to the relevant memory locations, the values at those memory locations revert back to 0 a moment later.

An example of one of the CAN frames:


image
image

writing to modbus 1026, using FC 6, 16 or 23 has no effect on the contents at that memory location:
image

When I set the CAN frame “update mode” to cyclically every 10ms, I still get no CAN frame.

I can send CAN frames to the AnyBus, matching to consume functions, and I can poll the relevant memory locations through modbus and see the right values change. This suggests to me the issue isn’t a comms issue.

Can anyone shed any light on why the Anybus server is not sending (producing) an CAN frames?

Hello @M_Lacey ,

What do you have configured for your modbus connection timeouts?

Try disabling the modbus subnetworks timeout or setting the offline and clear buffer to freeze and disabled.


You might be clearing the data before it is sent.

I also recommend double checking the modbus addressing mode and reviewing what modbus registers you need to write to. See chapter 5 of the user guide. https://www.anybus.com/docs/librariesprovider7/default-document-library/manuals-design-guides/hms-hmsi-168-60.pdf?sfvrsn=d2aeadd6_4

You might also want to check if you have the control and status word enabled.

modbus connection details:
image

I set one produce to freeze data on offline:

and another to stop transaction on offline:

This did resolve the issue of the internal memory being cleared. When I send a modbus write command it is now persistent:

With all producers set to cyclical every 10ms, I would be expecting to see can frames every 10ms with what is in the converter internal memory. I only see frames at turn on, but then nothing:

Interestingly when I send a CAN frame to the anybus communicator with a matching consume, it shows up in the CAN line listener and get’s handled correctly. It’s just the produces that don’t seem to work

What is LED 5 on the module doing? Is it flashing red indicating a error?

LED 5 is flashing red

In diagnostic/status the CAN state is error passive when I’m not sending any frames to the converter, and error active when I am sending frames to the converter

This would point to an issue communicating on the CAN bus and could explain why the data was being cleared. It is a bit inconsistent with how you are receiving data. Do you have correct termination on both ends of the bus? Is there only the Gateway and the one other device, I assume some kind of usb to can?

Can you share your configuration file for me to review?

CAN bus connection with 120ohm resistor:

config file:
Anybus CAN to Modbus map file.hcg (9.6 KB)

cheers

I don’t think that wiring is correct. you want a 120 ohm resistor from high to low on both ends. In your case I would expect it on each connector. This site has a diagram. CAN Bus Wiring Diagram, a Basics Tutorial | Tek Eye

I redid the wiring with a termination 120 Ohm resistor at both ends, and longer wire between connectors:

The anybus converter still isn’t sending any CAN frames.
Curiously, the Monitor/Modify function in the software has stopped working

Are there any configuration settings I may have overlooked that would stop the cyclic Produce CAN frames from being sent?
Could it be a firmware corruption issue?

What do you see for the CAN state under Diagnostic/status? What I suspect is happening here is the CAN interface sees a bus error and not sending data. Do you see error passive or any other error state?

Make sure Pin 2’s (CAN low) are connected and pin 7’s (CAN high) are connected together. I can’t quite tell from the image.

pin mapping is 2 to 2 (CAN Low), 7 to 7 (CAN high)
I also have 3 to 3 (GND to GND) and 6 to 6

CAN state is Error passive when I’m not sending any frames to the converter, and Error Active when I am sending frames to the converter

how would I get the converter out of error state? or configure so that it sends frames even in error state?

Hi @M_Lacey,

Error Active is a bit a bit misleading, it is not an error just showing the error register is less then 127. While Error passive is saying there are some errors detected and the error counter has increased, but not enough to fault the bus.

Try setting the Modbus connection Timeout and Modbus offline timeout to 0 to make sure the modbus connection isnt timing out the messages.
You can also try disabling the control status work or make sure you set the device to RUN mode. It is on run on start up.

Disabling the Control Status Word was the solution. The converter now sends CAN frames as expected :smiley:

What had me confused is after writing the configuration to the converter, even without setting the control word, the converter would send CAN frames for a second or so after reset. Even with setting the converter to run mode on startup.

It might have been going into run on start but then something was causing it to go idle. Perhaps you were writing to the control word or possibly errors.