I'm using Codesys Runtime on RPi for lab equipment and it's gorgeous for it's money with EtherCAT support etc. But now I would like to start experimenting with CAN and CANopen. I see, that CANopen for RPI shall be available according to the runtime datasheet, but don't see any examples on how to make it working. I also interested in simple CAN first, before starting with CANopen.
Can Codesys developers help and provide some material or tutorial on:
- What additional HW is needed? I have couple of USB-CAN adapters from Ixxat and Peak. Will they work with Codesys? Datasheet suggests only EL6751 terminal - is it the only HW supported?
- How to setup Codesys to work with CAN and CANopen using this HW on Rpi? Any simple project which reads or writes CAN messages would be appreciated.
- Any common errors, debug solutions?
My plan is to build a simple CAN logger for lab purposes first and then move to more complex things.
Hello, if you are using e.g. the debian buster based Os the PeakCANUSB-adapter is already supported with SocketCan. If you want to use this in CODESYS you have only to enable the component in the CODESYSControl_User.cfg. Then you could direct use the CanBus adapter and all protocoldevices like CanOpen.
Dear Codesys fans and developers,
I'm using Codesys Runtime on RPi for lab equipment and it's gorgeous for it's money with EtherCAT support etc. But now I would like to start experimenting with CAN and CANopen. I see, that CANopen for RPI shall be available according to the runtime datasheet, but don't see any examples on how to make it working. I also interested in simple CAN first, before starting with CANopen.
Can Codesys developers help and provide some material or tutorial on:
- What additional HW is needed? I have couple of USB-CAN adapters from Ixxat and Peak. Will they work with Codesys? Datasheet suggests only EL6751 terminal - is it the only HW supported?
- How to setup Codesys to work with CAN and CANopen using this HW on Rpi? Any simple project which reads or writes CAN messages would be appreciated.
- Any common errors, debug solutions?
My plan is to build a simple CAN logger for lab purposes first and then move to more complex things.
Thank you.
UPD just found this http://www.industrialberry.com/can-bus-with-codesys/ m
Have you solved your problem?
Hi Syoma,
adapter support on Linux is related to SocketCAN support in kernel, so Peak will definitely work. I read online that the Ixxat proprietary SocketCAN driver has some problems, so I'd stay away from that.
Codesys support of CAN layer 2 is a bit hairy, you can refer to the library documentation here: https://help.codesys.com/webapp/hGcF55fadXXw7LxTlfIUoErJcVQ%2Ffld-CAN-Low-Level;product=CAA%20Can%20Low%20Level%20Extern;version=3.5.17.0
whereas for CANopen you can just drop a CANbus device as a subdevice of your PLC and then a CANopen manager and/or a CANopen slave under it: https://help.codesys.com/webapp/_can_f_canbased_field_busses;product=core_canbus_configuration_editor;version=3.5.17.0
Hello, if you are using e.g. the debian buster based Os the PeakCANUSB-adapter is already supported with SocketCan. If you want to use this in CODESYS you have only to enable the component in the CODESYSControl_User.cfg. Then you could direct use the CanBus adapter and all protocoldevices like CanOpen.
Last edit: bruno-roth 2021-12-09
Also this USB to CAN adapter is working:
https://www.amazon.de/gp/product/B07Q812QK8/ref=ppx_yo_dt_b_asin_title_o01_s00?ie=UTF8&th=1
with the same configuration I used with the PeakCAN Adapter. It is really plug and play.