IXXAT Virtual Communication Interface#
Interface to IXXAT Virtual Communication Interface V3 SDK. Works on Windows.
The Linux ECI SDK is currently unsupported, however on Linux some devices are supported with SocketCAN.
The send_periodic()
method is supported
natively through the on-board cyclic transmit list.
Modifying cyclic messages is not possible. You will need to stop it, and then
start a new periodic message.
Configuration#
The simplest configuration file would be:
[default]
interface = ixxat
channel = 0
Python-can will search for the first IXXAT device available and open the first channel.
interface
and channel
parameters are interpreted by frontend can.interfaces.interface
module, while the following parameters are optional and are interpreted by IXXAT implementation.
receive_own_messages
(default False) Enable self-reception of sent messages.unique_hardware_id
(default first device) Unique hardware ID of the IXXAT device.extended
(default True) Allow usage of extended IDs.fd
(default False) Enable CAN-FD capabilities.rx_fifo_size
(default 16 for CAN, 1024 for CAN-FD) Number of RX mailboxes.tx_fifo_size
(default 16 for CAN, 128 for CAN-FD) Number of TX mailboxes.bitrate
(default 500000) Channel bitrate.data_bitrate
(defaults to 2Mbps) Channel data bitrate (only canfd, to use when message bitrate_switch is used).sjw_abr
(optional, only canfd) Bus timing value sample jump width (arbitration).tseg1_abr
(optional, only canfd) Bus timing value tseg1 (arbitration).tseg2_abr
(optional, only canfd) Bus timing value tseg2 (arbitration).sjw_dbr
(optional, only used if baudrate switch enabled) Bus timing value sample jump width (data).tseg1_dbr
(optional, only used if baudrate switch enabled) Bus timing value tseg1 (data).tseg2_dbr
(optional, only used if baudrate switch enabled) Bus timing value tseg2 (data).ssp_dbr
(optional, only used if baudrate switch enabled) Secondary sample point (data).
Filtering#
The CAN filters act as an allow list in IXXAT implementation, that is if you supply a non-empty filter list you must explicitly state EVERY frame you want to receive (including RTR field). The can_id/mask must be specified according to IXXAT behaviour, that is bit 0 of can_id/mask parameters represents the RTR field in CAN frame. See IXXAT VCI documentation, section “Message filters” for more info.
List available devices#
In case you have connected multiple IXXAT devices, you have to select them by using their unique hardware id.
To get a list of all connected IXXAT you can use the function get_ixxat_hwids()
as demonstrated below:
>>> from can.interfaces.ixxat import get_ixxat_hwids
>>> for hwid in get_ixxat_hwids():
... print("Found IXXAT with hardware id '%s'." % hwid)
Found IXXAT with hardware id 'HW441489'.
Found IXXAT with hardware id 'HW107422'.
Bus#
- class can.interfaces.ixxat.IXXATBus(channel, can_filters=None, receive_own_messages=False, unique_hardware_id=None, extended=True, fd=False, rx_fifo_size=None, tx_fifo_size=None, bitrate=500000, data_bitrate=2000000, sjw_abr=None, tseg1_abr=None, tseg2_abr=None, sjw_dbr=None, tseg1_dbr=None, tseg2_dbr=None, ssp_dbr=None, **kwargs)[source]#
The CAN Bus implemented for the IXXAT interface.
Based on the C implementation of IXXAT, two different dlls are provided by IXXAT, one to work with CAN, the other with CAN-FD.
This class only delegates to related implementation (in calib_vcinpl or canlib_vcinpl2) class depending on fd user option.
- Parameters
channel (int) – The Channel id to create this bus with.
can_filters – See
can.BusABC.set_filters()
.receive_own_messages (bool) – Enable self-reception of sent messages.
unique_hardware_id (Optional[int]) – UniqueHardwareId to connect (optional, will use the first found if not supplied)
extended (bool) – Default True, enables the capability to use extended IDs.
fd (bool) – Default False, enables CAN-FD usage.
rx_fifo_size (int) – Receive fifo size (default 1024 for fd, else 16)
tx_fifo_size (int) – Transmit fifo size (default 128 for fd, else 16)
bitrate (int) – Channel bitrate in bit/s
data_bitrate (int) – Channel bitrate in bit/s (only in CAN-Fd if baudrate switch enabled).
sjw_abr (int) – Bus timing value sample jump width (arbitration). Only takes effect with fd enabled.
tseg1_abr (int) – Bus timing value tseg1 (arbitration). Only takes effect with fd enabled.
tseg2_abr (int) – Bus timing value tseg2 (arbitration). Only takes effect with fd enabled.
sjw_dbr (int) – Bus timing value sample jump width (data). Only takes effect with fd and baudrate switch enabled.
tseg1_dbr (int) – Bus timing value tseg1 (data). Only takes effect with fd and bitrate switch enabled.
tseg2_dbr (int) – Bus timing value tseg2 (data). Only takes effect with fd and bitrate switch enabled.
ssp_dbr (int) – Secondary sample point (data). Only takes effect with fd and bitrate switch enabled.
- send(msg, timeout=None)[source]#
Transmit a message to the CAN bus.
Override this method to enable the transmit path.
- Parameters
msg (Message) – A message object.
timeout (Optional[float]) – If > 0, wait up to this many seconds for message to be ACK’ed or for transmit queue to be ready depending on driver implementation. If timeout is exceeded, an exception will be raised. Might not be supported by all interfaces. None blocks indefinitely.
- Raises
CanOperationError – If an error occurred while sending
- Return type
None
- shutdown()[source]#
Called to carry out any interface specific cleanup required in shutting down a bus.
- property state: can.bus.BusState#
Return the current state of the hardware
Implementation based on vcinpl.dll#
- class can.interfaces.ixxat.canlib_vcinpl.IXXATBus(channel, can_filters=None, receive_own_messages=False, unique_hardware_id=None, extended=True, rx_fifo_size=16, tx_fifo_size=16, bitrate=500000, **kwargs)[source]#
The CAN Bus implemented for the IXXAT interface.
Warning
This interface does implement efficient filtering of messages, but the filters have to be set in
__init__
using thecan_filters
parameter. Usingset_filters()
does not work.- Parameters
channel (int) – The Channel id to create this bus with.
can_filters – See
can.BusABC.set_filters()
.receive_own_messages (bool) – Enable self-reception of sent messages.
unique_hardware_id (Optional[int]) – unique_hardware_id to connect (optional, will use the first found if not supplied)
extended (bool) – Default True, enables the capability to use extended IDs.
rx_fifo_size (int) – Receive fifo size (default 16)
tx_fifo_size (int) – Transmit fifo size (default 16)
bitrate (int) – Channel bitrate in bit/s
- send(msg, timeout=None)[source]#
Sends a message on the bus. The interface may buffer the message.
- Parameters
msg (can.message.Message) – The message to send.
- Raise
:class:CanTimeoutError :class:CanOperationError
- Return type
None
- shutdown()[source]#
Called to carry out any interface specific cleanup required in shutting down a bus.
- property state: can.bus.BusState#
Return the current state of the hardware
- class can.interfaces.ixxat.canlib_vcinpl.CyclicSendTask(scheduler, msgs, period, duration, resolution)[source]#
A message in the cyclic transmit list.
Message send task with a defined duration and period.
- Parameters
messages – The messages to be sent periodically.
period – The rate in seconds at which to send the messages.
duration – Approximate duration in seconds to continue sending messages. If no duration is provided, the task will continue indefinitely.
- Raises
ValueError – If the given messages are invalid
Implementation based on vcinpl2.dll#
- class can.interfaces.ixxat.canlib_vcinpl2.IXXATBus(channel, can_filters=None, receive_own_messages=False, unique_hardware_id=None, extended=True, rx_fifo_size=1024, tx_fifo_size=128, bitrate=500000, data_bitrate=2000000, sjw_abr=None, tseg1_abr=None, tseg2_abr=None, sjw_dbr=None, tseg1_dbr=None, tseg2_dbr=None, ssp_dbr=None, **kwargs)[source]#
The CAN Bus implemented for the IXXAT interface.
Warning
This interface does implement efficient filtering of messages, but the filters have to be set in
__init__
using thecan_filters
parameter. Usingset_filters()
does not work.- Parameters
channel (int) – The Channel id to create this bus with.
can_filters – See
can.BusABC.set_filters()
.receive_own_messages (int) – Enable self-reception of sent messages.
unique_hardware_id (Optional[int]) – unique_hardware_id to connect (optional, will use the first found if not supplied)
extended (bool) – Default True, enables the capability to use extended IDs.
rx_fifo_size (int) – Receive fifo size (default 1024)
tx_fifo_size (int) – Transmit fifo size (default 128)
bitrate (int) – Channel bitrate in bit/s
data_bitrate (int) – Channel bitrate in bit/s (only in CAN-Fd if baudrate switch enabled).
sjw_abr (int) – Bus timing value sample jump width (arbitration).
tseg1_abr (int) – Bus timing value tseg1 (arbitration)
tseg2_abr (int) – Bus timing value tseg2 (arbitration)
sjw_dbr (int) – Bus timing value sample jump width (data)
tseg1_dbr (int) – Bus timing value tseg1 (data). Only takes effect with fd and bitrate switch enabled.
tseg2_dbr (int) – Bus timing value tseg2 (data). Only takes effect with fd and bitrate switch enabled.
ssp_dbr (int) – Secondary sample point (data). Only takes effect with fd and bitrate switch enabled.
- send(msg, timeout=None)[source]#
Sends a message on the bus. The interface may buffer the message.
- Parameters
msg (can.message.Message) – The message to send.
- Raise
:class:CanTimeoutError :class:CanOperationError
- Return type
None
- class can.interfaces.ixxat.canlib_vcinpl2.CyclicSendTask(scheduler, msgs, period, duration, resolution)[source]#
A message in the cyclic transmit list.
Message send task with a defined duration and period.
- Parameters
messages – The messages to be sent periodically.
period – The rate in seconds at which to send the messages.
duration – Approximate duration in seconds to continue sending messages. If no duration is provided, the task will continue indefinitely.
- Raises
ValueError – If the given messages are invalid
Internals#
The IXXAT BusABC
object is a fairly straightforward interface
to the IXXAT VCI library. It can open a specific device ID or use the
first one found.
The frame exchange does not involve threads in the background but is explicitly instantiated by the caller.
recv()
is a blocking call with optional timeout.send()
is not blocking but may raise a VCIError if the TX FIFO is full
RX and TX FIFO sizes are configurable with rx_fifo_size
and tx_fifo_size
options, defaulting to 16 for both.