christiansandberg / canopen

CANopen for Python
http://canopen.readthedocs.io/
MIT License
423 stars 194 forks source link

Full queue when reusing bus #325

Open gardenvariety42 opened 1 year ago

gardenvariety42 commented 1 year ago

I'm building a program to automatically test a safety control unit for industrial machines. Since the actuators and sensors will be imitated by canopen nodes, I'm forced to make j1939 and canopen play nice with each other. I'm required to have both using the same bus so I don't have to use two peak devices. This is what I've tried:

connection = Connection() connection.connect(1) connection.get_messages()

network = Network() network.bus = connection.ecu._bus listeners = network.listeners + connection.ecu._listeners network.notifier = can.Notifier(connection.ecu._bus, listeners, 0.5)

trying to run this I get: Exception: Failed to send: The transmit queue is full

I'm a bloody beginner so likely I'm doing something wrong but I just can't figure it out. Any suggestions would be greatly appreciated.

Just to prevent misunderstandings, the Connection class is a convenience wrapper for the j1939 functionality I wrote and I'm using j1939 and canopen on separate buses without any trouble.

christiansandberg commented 1 year ago

Do you have some other CAN device physically connected to the bus? A CAN message can only be flushed from the buffers when another node has acknowledged it.

gardenvariety42 commented 1 year ago

Yes, there are devices physically connected via a Peak USB contoller. I've been working with both, the j1939 ecu device and the CANopen node device successfully for a while now. If I have both running on separate busses via two controllers, everything is fine. The problem only occurs when I try to use the same bus. The devices are a TTC32S module and a TTC30XH module from TTControl.