Project

General

Profile

Working with the CAN Bus » History » Version 2

Adam Klama, 06/21/2026 03:03 PM

1 1 Adam Klama
# Working with the CAN Bus
2
3
Several IO types exchange data over CAN. This page covers the shared concepts they
4
depend on; the per-IO pages cover the specifics.
5
6
## CAN bus definition
7
Before adding any CAN IO you must have a CAN bus defined, with:
8
9
| Setting | Meaning |
10
|---|---|
11
| **CAN ID / bus** | Which physical CAN channel. |
12
| **Baud rate** | Bus speed (e.g. 500 kbit/s). |
13
| **CAN FD** | Enable FD and set the FD data baud rate, if used. |
14
| **Termination** | Enable the on-board 120 Ω terminator when the controller is an end node. |
15
16
## Two ways to use CAN
17
18
### 1. Raw frame signals
19
Decode/encode individual **CANbus signals** directly from raw CAN frames by hand.
20
Use these when you have a DBC or know the byte layout:
21
- **[CAN Bus Input](CAN_Bus_Input)** — extract a signal from an incoming
22
  frame (message ID, endianness/bitfield, length, offset, scaling, timeout
23
  behaviour).
24
- **[CAN Bus Output](CAN_Bus_Output)** — pack a signal into an outgoing
25
  frame.
26
27
### 2. CAN Presets
28
**CAN Presets** are predefined device profiles (dashes, ECUs, shifters, keypads,
29
paddles…) that live in `canbusEntities/`. A preset publishes/consumes a set of
30
named **CAN objects** and handles all the byte decoding/encoding for you. When you
31
add a preset it **automatically creates the matching object IO** — you reference
32
or drive those rather than hand-decoding bytes:
33
- **[CAN Object Input](CAN_Object_Input)** — a preset-created input
34
  carrying a named object's value (not configured by hand).
35
- **[CAN Object Output](CAN_Object_Output)** — a named object the preset
36
  sends, driven by a source value.
37
38
## Choosing between them
39
- Use **raw frame signals** for arbitrary/custom devices where you know the layout.
40
- Use **CAN Presets** for supported devices — less error-prone, no manual byte math.
41
42
## Timeouts (inputs)
43
CAN inputs define what to report if a frame stops arriving (`TimeoutMode`):
44
`UsePrevious`, `UseDefault`, or `UseFault`. Set a timeout for any safety-relevant
45
signal so a dropped frame is detected rather than silently held.