hardbyte / hardbyte/python-can

How to connect to sysworxx usb-CANmodul2?

Open
#1,308 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
1.6k
Forks
697
PR merge metrics
No merged PRs in 30d

Description

I should connect to two channels of sysworxx USB-CANmodul2 device using canopen python lib at the same time. However, I get the following mistake: "Function UcanInitHardwareEx returned 5: the module with the specified device number is not connected (or used by an other application)". Here is the part of code for the first device:

```
network = canopen.Network()
network.connect(bustype='systec', channel=0, bitrate=500000)
print(f"Connected to CanModule_2: {self.network=}")
network.scanner.search()
sleep(1)
for node_id in network.scanner.nodes:
print(f"Found node abs encoder {node_id}")
node = network.add_node(node_id, os.path.join(Cfg.data_path, 'AHM.eds'))
```
Here is for the second one:
```
network = canopen.Network()
network.connect(bustype='systec', channel=1, bitrate=500000)
print(f"Connected to CanModule_1: {self.network=}")
network.scanner.search()
for node_id in network.scanner.nodes:
print(f"Found node {node_id}")
node = network.add_node(node_id, os.path.join(Cfg.data_path, 'Faulhaber.eds'))
```
These two connection are separated into two threads. Unfortunately, I can connect only to one channel. How to connect to two channels at the same time?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.