Supported Hardwares
This section describes basic usage for each supported hardwares.
Kvaser
KVASER supports Win64 platform.
This interface requires canlib32.dll (supposed to be installed along with the device driver).
To setup interface, do something like below,
cfg = InterfaceConfigCAN(KVASER, 0, 500_000) # channel 0, 500kbps
iface = Interface(cfg)For CAN FD,
cfg = InterfaceConfigFD(KVASER, 0, 500_000, 2_000_000) # channel 0, 500kbps, 2Mbps
iface = Interface(cfg) KVASER interface has separate acceptance filters for standard IDs and extended IDs. Each type can have only one filter. Therefore, when setting filters, make sure to strictly match the ID type. If Vector of AcceptanceFilter is provided, only first one will be applied.
slcan
SLCAN supports Win64/Linux platform. Tested on CANable 2.0 firmware.
To setup interface,
cfg = InterfaceConfigCAN(SLCAN, "COM3", 500_000) # channel COM3, 500kbps
iface = Interface(cfg)channel name is supposed to be like COM3 on Windows, like /dev/ttyACM0 on Linux.
For CAN FD,
cfg = InterfaceConfigFD(SLCAN, "COM3", 500_000, 2_000_000) # channel COM3, 500kbps, 2Mbps
iface = Interface(cfg) CAN FD on SLCAN, datarate can be chosen from 2000000, 5000000.
SLCAN with FD firmware (b158aa7) is seemd to be always on FD mode, thus there is no pure CAN mode. Therefore, even if this interface is set up for CAN_20, exceptionally receives FDFrame when someone sends that.
status function for SLCAN always returns NO_STATUS status. Since slcan firmware has no capability to check bus status.
SocketCAN
SOCKETCAN supports Linux platform.
To setup interface,
cfg = InterfaceConfigCAN(SOCKETCAN, "can0", 0) # bitrate is ignored.
iface = Interface(cfg)For CAN FD,
cfg = InterfaceConfigFD(SOCKETCAN, "can0", 0, 0) # bitrate, datarate is ignored.
iface = Interface(cfg)Bitrate and Datarate can not be modified from CANBus library, so use ip link command from terminal.
The acceptance filter of the SOCKETCAN interface does not internally distinguish between standard and extended IDs. Therefore, for example, if you set options for stdfilter, the extfilter will not receive any messages unless you explicitly configured to do so.
status function for SocketCAN initially set as NO_STATUS. The status which status function returns is not updated unless you call recv function.
Vector
VECTOR supports Win64 platform.
To use this interface, please install Vector XL-Driver-Library separately. Check vxlapi64.dll is in your path.
cfg = InterfaceConfigCAN(VECTOR, 0, 500_000; vector_appname="NewApp") # channel 0, 500kbps
iface = Interface(cfg)vector_appname kwarg is always required. It means corresponding name in Vector Hardware Manager.
For CAN FD,
cfg = InterfaceConfigFD(VECTOR, 0, 500_000, 2_000_000; vector_appname="NewApp") # channel 0, 500kbps, 2Mbps
iface = Interface(cfg) AcceptanceFilterhas same behavior asKVASERinterface.
Vector XL Driver originally supports channel sharing from multiple processes. The process who accesses specific port first will gain init_access rights, which is needed to set bitrate and so on.
At this time, CANBus.jl can not communicate without init_access. If you attempt to open port with already-occupied channel, you will see "failing to set bitrate" message.
Communication without init_access will be implemented until version 0.1.0.