hardbyte / hardbyte/python-can

sysWORXX, Systec CANmodul8, open both channels on one physical device

Offen
#1,057 5 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
backend:systec enhancement
Vorherrschende Sprache
Python
Sterne
1.6k
Forks
697
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

On Windows it is not possible to create 2 bus objects and open the interface for both channels on one physical device, like it is in the code example below.

```python
bus1 = can.interface.Bus(bustype="systec", device_number="0", channel="0", bitrate=500000)
bus2 = can.interface.Bus(bustype="systec", device_number="0", channel="1", bitrate=500000)
msg1 = bus1.recv(timeout=2)
msg2 = bus2.recv(timeout=2)
print(msg1, "\n", msg2)
bus1.shutdown()
bus2.shutdown()
```

I think the problem is, that whenever a new bus is initialized, the UcanInitCanEx() function from the USBCAN32.dll is called. This function does not have a channel parameter. To open a second channel on the same device the UcanInitCanEx2() has to be called.

```
CANRET PUBLIC UcanInitCanEx (tUcanHandle UcanHandle_p, tUcanInitCanParam* pInitCanParam_p);

UCANRET PUBLIC UcanInitCanEx2 (tUcanHandle UcanHandle_p, BYTE bChannel_p, tUcanInitCanParam* pInitCanParam_p);
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.