Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No connection / SDO respons with a Seeedstudio USB to CAN adapter #399

Open
thommols opened this issue Oct 16, 2023 · 0 comments
Open

No connection / SDO respons with a Seeedstudio USB to CAN adapter #399

thommols opened this issue Oct 16, 2023 · 0 comments
Labels

Comments

@thommols
Copy link

thommols commented Oct 16, 2023

Hi,

I cant seem to get a working connection between my Seeedstudio adapter and my CANopen supported Servo-drive.
I installed my adapter via: https://python-can.readthedocs.io/en/stable/interfaces/seeedstudio.html#interface.
My code and debug messages are listed below.
It goes wrong in the network coding, NMT messages are also not working.
I checked incoming messages on the CANopen network with a 2nd USBCAN adapter, messages from my python code are not visable.
this is my code:

`import canopen
from canopen.profiles.p402 import BaseNode402
import time
import logging
logging.basicConfig(level=logging.DEBUG)

node = BaseNode402(1, 'C:\Users\thomk\Documents\CANOPEN-EDS-MBDV-Servo-DulAxes-V1.0.eds')
node2 = BaseNode402(2, 'C:\Users\thomk\Documents\CANOPEN-EDS-MBDV-Servo-DulAxes-V1.0.eds')

network = canopen.Network()

network.connect(bustype='seeedstudio', channel='COM3', bitrate=1000000)
network.add_node(node)
network.add_node(node2)
network.check()

network.sync.start(0.005)

node.nmt.send_command(0x81) # node reset and init
node.nmt.send_command(0x1) # node operational

node.sdo[0x6040]
node.sdo[0x6040].raw = 0x03 # write enable profile velocity mode (control word)
node.sdo[0x6041]
node.sdo[0x6041].raw # read status word`

this is de debugging message I get:

`DEBUG:canopen.pdo:TPDO Map as 4
DEBUG:canopen.pdo:RPDO Map as 4
DEBUG:canopen.pdo:TPDO Map as 4
DEBUG:canopen.pdo:RPDO Map as 4
DEBUG:can:can config: {'bitrate': 1000000, 'interface': 'seeedstudio', 'channel': 'COM3'}
DEBUG:seeedbus:init_frm: aa55120101000000000000000000010000000015
INFO:canopen.network:Connected to 'Serial interface: COM3'
WARNING:seeedbus:fileno is not implemented using current CAN bus: fileno
DEBUG:seeedbus:sending: aac0800055
INFO:canopen.nmt:Changing NMT state on node 1 from INITIALISING to INITIALISING
INFO:canopen.nmt:Sending NMT command 0x81 to node 1
DEBUG:seeedbus:sending: aac20000810155
INFO:canopen.nmt:Changing NMT state on node 1 from INITIALISING to OPERATIONAL
INFO:canopen.nmt:Sending NMT command 0x1 to node 1
DEBUG:seeedbus:sending: aac20000010155
DEBUG:canopen.variable:Writing Control word (0x6040:0) = 3
DEBUG:seeedbus:sending: aac801062b4060000300000055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac0800055
DEBUG:seeedbus:sending: aac80106800000000000040555
ERROR:canopen.sdo.client:Transfer aborted by client with code 0x05040000
Traceback (most recent call last):
File "C:\Users\thomk\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\canopen\sdo\client.py", line 66, in read_response
block=True, timeout=self.RESPONSE_TIMEOUT)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\queue.py", line 178, in get
raise Empty
_queue.Empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:/Users/thomk/OneDrive - Saxion/Documenten/python code test 3.py", line 24, in
node.sdo[0x6040].raw = 0x03 # write enable profile velocity mode (control word)
File "C:\Users\thomk\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\canopen\variable.py", line 89, in raw
DEBUG:seeedbus:sending: aac0800055
self.data = self.od.encode_raw(value)
File "C:\Users\thomk\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\canopen\variable.py", line 41, in data
self.set_data(data)
File "C:\Users\thomk\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\canopen\sdo\base.py", line 133, in set_data
self.sdo_node.download(self.od.index, self.od.subindex, data, force_segment)
File "C:\Users\thomk\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\canopen\sdo\client.py", line 160, in download
fp.write(data)
File "C:\Users\thomk\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\canopen\sdo\client.py", line 388, in write
response = self.sdo_client.request_response(request)
File "C:\Users\thomk\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\canopen\sdo\client.py", line 84, in request_response
return self.read_response()
File "C:\Users\thomk\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\canopen\sdo\client.py", line 68, in read_response
raise SdoCommunicationError("No SDO response received")
canopen.sdo.exceptions.SdoCommunicationError: No SDO response received
PS C:\Users\thomk> `

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants