1

I'm working on creating a virtual canopen slave with python to communicate with an existing master. when running my script I keep getting this error "no sdo response recieved". As far as I know, I need an sdo server to send response to the master, is it possible to create a virtual sdo server that does the job? otherwise, does anyone have an idea on how to fix that problem?

Hayfa
  • 11
  • 1
  • 1
    This could literally mean anything. Just some node trying to access another node's OD through SDO but getting no response. – Lundin May 12 '21 at 11:10
  • @Lundin thank you for your quick answer! I'm really new to canopen and I'm still learning.. I have to create a virtual canopen device but as I mentioned before, I keep getting this problem and I didn't know how to fix it.. Is it even possible to create a virtual canopen device which communicates with an existing master? do I need to use another library to send response to master requests? I think it may be a problem with the sdo server as mentioned here : [link](https://github.com/christiansandberg/canopen/issues/20) – Hayfa May 12 '21 at 11:58
  • I don't know anything about virtual devices or the Python libs, sorry. But basically every node on a conforming CANopen bus needs to have at least one SDO which other objects can access it through. Also, there's no "servers" or "masters" as such, save for the network management (NMT) master node which has the responsibility to wake up other nodes, check that they are still alive etc. – Lundin May 12 '21 at 12:02

1 Answers1

0

Yes, it's possible to create a virtual CAN device that will have a SDO server. You can use it together with virtual CAN bus (vcan on Linux) to test your CAN communication before you have your hardware available.

  1. Enable vcan:
 $ modprobe vcan
 $ sudo ip link add dev vcan0 type vcan
 $ sudo ip link set up vcan0
  1. Start a virtual CAN device with SDO server:

From the tags in question I assume you use python-canopen. So you can use this one https://canopen.readthedocs.io/en/latest/sdo.html#canopen.sdo.SdoServer, that will read your node.eds or node.xdd file. Run this Python script in one terminal. Remember to use vcan0 interface. network.connect(channel='can0', bustype='socketcan')

  1. Run your "master" SDO client script in second terminal. It will read the SDO from your virtual device. Remember to use vcan0 interface.
Filip Kubicz
  • 459
  • 1
  • 5
  • 17