Warning
This documentation is actively being updated as the project evolves and may not be complete in all areas.
CAN driver¶
jumpstarter-driver-can
provides functionality for interacting with CAN bus
connections based on the python-can
library.
Installation¶
pip3 install --extra-index-url https://pkg.jumpstarter.dev/simple/ jumpstarter-driver-can
jumpstarter_driver_can.Can
¶
A generic CAN bus driver.
Available on any platform, supports many different CAN interfaces through the python-can
library.
Configuration¶
Example configuration:
export:
can:
type: jumpstarter_driver_can.Can
config:
channel: 1
interface: "virtual"
Parameter |
Description |
Type |
Required |
Default |
---|---|---|---|---|
interface |
Refer to the python-can list of interfaces |
str |
yes |
|
channel |
channel to be used, refer to the interface documentation |
int or str |
yes |
API Reference¶
- class jumpstarter_driver_can.client.CanClient¶
A generic CAN client for sending/recieving traffic to/from an exported CAN bus.
- property channel_info: str¶
Get the CAN channel info.
- flush_tx_buffer() None ¶
Flush the transmission buffer.
- property protocol: CanProtocol¶
Get the CAN protocol supported by the bus.
- send(msg: Message, timeout: float | None = None) None ¶
Send an individual CAN message.
- shutdown() None ¶
Shutdown the bus.
- property state: BusState¶
The current state of the CAN bus.
jumpstarter_driver_can.IsoTpPython
¶
A Pure python ISO-TP socket driver
Available on any platform (does not require Linux ISO-TP kernel module), moderate performance and reliability, wide support for non-standard hardware interfaces
Configuration¶
Example configuration:
export:
can:
type: jumpstarter_driver_can.IsoTpPython
config:
channel: 0
interface: "virtual"
address:
rxid: 1
txid: 2
params:
max_frame_size: 2048
blocking_send: false
can_fd: true
Parameter |
Description |
Type |
Required |
Default |
---|---|---|---|---|
interface |
Refer to the python-can list of interfaces |
|
no |
|
channel |
channel to be used, refer to the interface documentation |
|
no |
|
address |
Refer to the isotp.Address documentation |
|
yes |
|
params |
IsoTp parameters, refer to the IsoTpParams section table |
|
no |
see table |
read_timeout |
Read timeout for the bus in seconds |
|
no |
0.05 |
API Reference¶
- class jumpstarter_driver_can.client.IsoTpClient¶
An ISO-TP CAN client for sending/recieving ISO-TP frames to/from an exported CAN bus.
- available() bool ¶
Returns True if an ISO-TP frame is awaiting in the reception queue, False otherwise.
- recv(block: bool = False, timeout: float | None = None) bytes | None ¶
Dequeue an ISO-TP frame from the reception queue if available.
- send(data: bytes, target_address_type: int | None = None, send_timeout: float | None = None) None ¶
Enqueue an ISO-TP frame to send over the CAN network.
- set_address(address: Address | AsymmetricAddress) None ¶
Sets the layer address. Can be set after initialization if needed. May cause a timeout if called while a transmission is active.
- start() None ¶
Start listening for messages.
- stop() None ¶
Stop listening for messages.
- stop_receiving() None ¶
Stop receiving messages.
- stop_sending() None ¶
Stop sending messages.
- transmitting() bool ¶
Returns True if an ISO-TP frame is being transmitted, False otherwise.
jumpstarter_driver_can.IsoTpSocket
¶
Pure python ISO-TP socket driver
Available on any platform, moderate performance and reliability, wide support for non-standard hardware interfaces
Configuration¶
Example configuration:
export:
can:
type: jumpstarter_driver_can.IsoTpSocket
config:
channel: "vcan0"
address:
rxid: 1
txid: 2
params:
max_frame_size: 2048
blocking_send: false
can_fd: true
Parameter |
Description |
Type |
Required |
Default |
---|---|---|---|---|
channel |
CAN bus to be used i.e. |
|
yes |
|
address |
Refer to the isotp.Address documentation |
isotp.Address |
yes |
|
params |
IsoTp parameters, refer to the IsoTpParams section table |
|
no |
see table |
API Reference¶
- class jumpstarter_driver_can.client.IsoTpClient
An ISO-TP CAN client for sending/recieving ISO-TP frames to/from an exported CAN bus.
- available() bool
Returns True if an ISO-TP frame is awaiting in the reception queue, False otherwise.
- recv(block: bool = False, timeout: float | None = None) bytes | None
Dequeue an ISO-TP frame from the reception queue if available.
- send(data: bytes, target_address_type: int | None = None, send_timeout: float | None = None) None
Enqueue an ISO-TP frame to send over the CAN network.
- set_address(address: Address | AsymmetricAddress) None
Sets the layer address. Can be set after initialization if needed. May cause a timeout if called while a transmission is active.
- start() None
Start listening for messages.
- stop() None
Stop listening for messages.
- stop_receiving() None
Stop receiving messages.
- stop_sending() None
Stop sending messages.
- transmitting() bool
Returns True if an ISO-TP frame is being transmitted, False otherwise.
IsoTpParams¶
Parameter |
Description |
Type |
Required |
Default |
---|---|---|---|---|
|
Minimum Separation Time minimum in milliseconds between consecutive frames. |
|
No |
|
|
Number of consecutive frames that can be sent before waiting for a flow control frame. |
|
No |
|
|
Default length of data in a transmitted CAN frame (CAN 2.0) or initial frame (CAN FD). |
|
No |
|
|
Minimum length of data in a transmitted CAN frame; pads with |
|
No |
|
|
Override the STmin value (in seconds) received from the receiver; |
|
No |
|
|
Timeout in milliseconds for receiving a flow control frame after sending a first frame or a block. |
|
No |
|
|
Timeout in milliseconds for receiving a consecutive frame in a multi-frame message. |
|
No |
|
|
Byte value used for padding if the data length is less than |
|
No |
|
|
Maximum number of Wait Frame Transmissions (WFTMax) allowed before aborting. |
|
No |
|
|
Maximum size of a single ISO-TP frame that can be processed. |
|
No |
|
|
If |
|
No |
|
|
If |
|
No |
|
|
Default target address type: |
|
No |
|
|
If |
|
No |
|
|
Maximum bitrate in bits per second for rate limiting if enabled. |
|
No |
|
|
Time window in seconds over which the rate limit is calculated. |
|
No |
|
|
If |
|
No |
|
|
If |
|
No |
|