hardbyte / hardbyte/python-can

Unable to use two separate interface devices at the same time (ixxat)

Open
#1,338 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

### Describe the bug
I am unable to utilize two separate ixxat devices at the same time via python-can.

I am trying to utilize two ixxat devices via python-can to verify throughput on a gateway module but I can't seem to get two interface devices to connect at the same time. One at a time I can get them to connect and send or receive but I get an error trying to use both. I can get both devices to work at the same time via Busmaster, but I need to eventually work this into something more complex than what I present below, but I'm already running into problems. I am using Ixxat USB-to-CAN v2 Compact interfaces. They're on different USB ports on the same windows PC. I would love to have a device with multiple channels but I've only got single channel devices for now.

My physical set up is one device would send messages on the first CAN bus. These get picked up and forwarded by the vehicle gateway to the second CAN bus. On the second CAN bus the receiver interface would read that the message got through and when.

> Ixxat1_sender =CAN1=> GatewayDevice =CAN2=> Ixxat2_receiver

In python I have this:
```
import can
import can.interfaces.ixxat

sendBus = can.interfaces.ixxat.IXXATBus( channel=0, bitrate=500000, unique_hardware_id="HWXXXXXX" )
recvBus = can.interfaces.ixxat.IXXATBus( channel=0, bitrate=500000, unique_hardware_id="HWYYYYYY" )

testMsg = can.Message(arbitration_id = 0x123, data=b"\xFF")
sendBus.send(testMsg)
print(recvBus.recv())
```

However when I try this I get an OS error on setting up the second device. This is an example from VS Code but CLI returns the same thing.

> Exception has occurred: OSError (note: full exception trace is shown but execution is paused at: )
> exception: access violation reading 0x000001E100000000
> File "C:\...\multiCan.py", line 8, in (Current frame)
> recvBus = can.interfaces.ixxat.IXXATBus( channel=0, bitrate=500000, UniqueHardwareId="HWYYYYYY" )

It seems like it's just not capable of registering two devices but that seems like a pretty typical thing to have. Is there any way to get two hardware devices to work? I'd be up for using a different some other method, but I'm not sure what might support this easily enough. I don't know if this is a limitation of python-can or what the problem might be. Given that Busmaster seems to work fine with the two devices it seems odd that python-can would have a problem and it's not necessarily an OS level restriction.

### Expected behavior
Should be able to connect two devices and use them on separate buses or even to communicate with each other at the same time.

### Additional context
OS and version: Windows 10 20H2
Python version: 3.10.0
python-can version: 4.0.0
python-can interface/s (if applicable): Ixxat USB-to-CAN v2 Compact 3.5.2.4268

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.