This interface adds support for CAN controllers by National Instruments.
NI-CAN only seems to support 32-bit architectures so if the driver can’t be loaded on a 64-bit Python, try using a 32-bit version instead.
CAN filtering has not been tested throughly and may not work as expected.
NicanBus(channel, can_filters=None, bitrate=None, log_errors=True, **kwargs)¶
The CAN Bus implemented for the NI-CAN interface.
This interface does implement efficient filtering of messages, but the filters have to be set in
set_filters()does not work.
- channel (str) – Name of the object to open (e.g. ‘CAN0’)
- bitrate (int) – Bitrate in bits/s
- can_filters (list) – See
- log_errors (bool) – If True, communication errors will appear as CAN messages with
is_error_frameset to True and
arbitration_idwill identify the error (default True)
can.interfaces.nican.NicanError – If starting communication fails
Resets network interface. Stops network interface, then resets the CAN chip to clear the CAN error counters (clear error passive state). Resetting includes clearing all entries from read and write queues.
Send a message to NI-CAN.
Parameters: msg (can.Message) – Message to send Raises: can.interfaces.nican.NicanError – If writing to transmit buffer fails. It does not wait for message to be ACKed currently.