SuperCAN plugin for python-can
This plugin is required on Windows to get access to SuperCAN devices from Python. On Linux, simply use can.Bus(interface='socketcan', ...)
.
Open a native command prompt.
-
Open a MinGW shell suitable for your system (MinGW64, typically).
-
Ensure you have the necessary packages installed, i.e
pacman -S mingw-w64-x86_64-toolchain mingw64/mingw-w64-x86_64-python-pip
-
Copy the content of the
SuperCAN
directory to a writable location. -
Navigate to this directory
-
Run
python -m pip install .
-
Ensure your device is upgraded to firmware version 0.6.0 or better.
-
Optionally, register the COM server (
supercan_srv64.exe
) for shared channel access. If you used the installer, this step is already done. Otherwise, from an admin console, runsupercan_srv64.exe /RegServer
-
Access the CAN channel from Python
import can e = can.Bus( channel=0, # channel index (0-based) filters=None, interface="supercan", serial="12345678", # device serial bitrate=500000)
You can force shared mode like so:
import can e = can.Bus( channel=0, # channel index (0-based) filters=None, interface="supercan", serial="12345678", # device serial bitrate=500000, shared=True) # request shared mode, fail if unavailable
Note, exclusive mode is always available. This should always work:
import can e = can.Bus( channel=0, # channel index (0-based) filters=None, interface="supercan", serial="12345678", # device serial bitrate=500000, shared=False) # request exclusive mode