CAN over Serial / SLCAN

A text based interface: compatible to slcan-interfaces (slcan ASCII protocol) should also support LAWICEL direct. These interfaces can also be used with socketcan and slcand with Linux. This driver directly uses either the local or remote serial port, it makes slcan-compatible interfaces usable with Windows also. Remote serial ports will be specified via special URL. Both raw TCP sockets as also RFC2217 ports are supported.

Usage: use port or URL[@baurate] to open the device. For example use /dev/ttyUSB0@115200 or COM4@9600 for local serial ports and socket:// or rfc2217:// for remote ports.

Supported devices


Document this.


class can.interfaces.slcan.slcanBus(channel, ttyBaudrate=115200, bitrate=None, rtscts=False, **kwargs)[source]

Bases: can.bus.BusABC

slcan interface

  • channel (str) – port of underlying serial or usb device (e.g. /dev/ttyUSB0, COM8, …) Must not be empty.
  • ttyBaudrate (int) – baudrate of underlying serial or usb device
  • bitrate (int) – Bitrate in bit/s
  • poll_interval (float) – Poll interval in seconds when reading messages
  • rtscts (bool) – turn hardware handshake (RTS/CTS) on and off
send(msg, timeout=0)[source]

Transmit a message to the CAN bus.

Override this method to enable the transmit path.

  • msg (can.Message) – A message object.
  • timeout (float or None) – 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 indefinitly.

can.CanError – if the message could not be sent


Called to carry out any interface specific cleanup required in shutting down a bus.



Document the internals of slcan interface.