Skip to content

help with timeout error on setup_402_state_machine function #178

@danielluehr

Description

@danielluehr

Hi,

first,I would like to thank everyone for the great work developing this module.

I am using this module to command a Xenus XTL Controller. Some years ago we (my team and I) started using version 0.3 of the canopen module and we tried to implement some parts of the 402 standard so we can control a rotary motor. The development stalled and a few weeks ago we resumed it. We decided to upgrade to the current version (1.0.0) to try the 402 profiles added to the module. In general, it is a great enhancement and we are replacing most of our code with the this project's 402 implementation.

However, we are experiencing and odd behaviour (it might be that we don't yet understand the 402 standard logic completely).

After creating a node and network and adding the node object to the network object, we send an sdo command to the controller to enter full CANopen mode (on reset, it is currently starting on a limited canopen monitoring mode, while the control is taken by internal routines of the controller).
Then we try to use the setup_402_state_machine function, but it fails with a timeout error on the last action (change state to "SWITCH ON DISABLED"). I have found similar situations in other issues here in github.
Nevertheless, if we send a mode of operation command using a direct call to the sdo, and then we repeat the call to setup_402_state_machine it doesn't fail.

We have tried to change the mode of operation before calling setup_402_state_machine for the first time but it fails anyway, and again a change of operation mode after failing seems to reset something and then re-executing the setup_402_state_machine works.

A sample code would be the following:

can_network = canopen.Network()
can_network.connect(channel='can0', bustype='socketcan', bitrate=250000)
can_node = canopen.BaseNode402(1, 'dict.eds')
can_network.add_node(can_node)
can_network.sync.start(0.1)
# enable servomode with CANopen interface
can_node.sdo[0x2300].raw = 30
# next command fails with timeout when changing state to 'SWITCH ON DISABLED'
can_node.setup_402_state_machine()
# change mode of operation
can_node.sdo[0x6060].raw = 3
# now it works
can_node.setup_402_state_machine()

I guess we are doing something wrong, however we cannot find what it is. Any help is appreciated.

Thanks

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions