CAN Bus Output
Applies to: IOcan · Standalone controller. What this means
Overview
A CAN Bus Output packs a single CANbus signal into a raw outgoing CAN frame, using a byte/bit layout you define by hand. Use it when you know the frame layout (e.g. from a DBC) for an arbitrary or custom device and there is no CAN Preset for it. This is the raw frame signal approach: you give the message ID, say how the bits are encoded and where they sit, then scale your source value into the raw signal. To write a named object on a supported device instead, use a CAN Object Output.
If the target is an engine ECU rather than an arbitrary device, check the ECU integrations first — a preset may already send what you are about to pack by hand.
Prerequisites & hardware
- A defined CAN bus for the channel the frame is sent on — see Working with the CAN Bus.
- The frame's message ID and bit layout for the signal you want to write (length, offset, encoding).
- A source value (a map, driver or input) to drive the signal.
Add it in the app
- Add a new output and choose CAN Bus Output as the type.
- Give it a clear alias (e.g.
Requested Torque). - Enter the Message ID and its ID type, then the encoding type, length and offset that place the signal in the frame.
- Set the in → raw scaling and a default value, then drive it from a map/driver.
Settings reference
| Setting | Meaning | Unit | Range / values | Notes |
|---|---|---|---|---|
| Message ID | CAN frame identifier to send | hex | fixed32 | The arbitration ID of the outgoing frame. |
| Message ID type | Identifier width | — | Extended (29-bit), Standard (11-bit) |
Must match what the receiving device expects. |
| Encoding type | How the value is packed into the bits | — | UnsignedBigEndian, UnsignedLittleEndian, SignedBigEndian, SignedLittleEndian, BitField, CounterField, BitCounterField |
Selects signedness/endianness/bitfield. CounterField / BitCounterField auto-generate a rolling message counter. |
| Length | Signal length | bytes / bits | uint32 | In bytes for the integer types and CounterField; in bits for the bitfield types (BitField, BitCounterField). |
| Offset | Position of the signal in the frame | bytes / bits | uint32 | Same units as Length: bytes for integer/CounterField types, bits for bitfield types. |
| In min / In max | Input (engineering) range to scale from | source unit | sint32 | The source low/high points. |
| Raw min / Raw max | Raw signal range to scale to | — | sint32 | The packed value at In min / In max. |
| Default value | Value packed before a source value is available | source unit | sint32 | Sent until the source provides a value. |
Scaling: the source value is mapped from In min…In max to Raw min…Raw max using two-point interpolation.
Rolling counter: choose CounterField or BitCounterField for keep-alive
and rolling-counter bytes — the device increments the value on each frame, so
the output needs no source driving it.
When the frame is actually sent
You do not set a transmit rate on this output, and it is worth knowing what the device does instead:
- Every 10 ms as a floor, whether or not anything changed. A receiver watching for a timeout will not see a gap longer than that.
- Immediately when any value in the frame changes. A frame whose signal is moving is sent as fast as the CAN task runs, which is every 1 ms.
Frames are staggered rather than sent together. Each outgoing frame is offset within the 10 ms window by its position in the configuration, so a configuration with several outputs spreads them across the window instead of bursting them onto the bus at the same instant.
The practical consequence: a changing signal reaches the bus quickly, and a static one still refreshes. If a receiver needs a slower fixed rate, rate-limit the source feeding the output rather than looking for a period setting here.
There is no clamping. A source outside In min…In max extrapolates, and a
raw value wider than the field wraps rather than saturating. Clamp upstream —
a Map Output clamps at its end points.
Common settings
CAN Bus Output uses the shared Name setting, and the Pin field selects which CAN channel the frame is transmitted on rather than a physical pin. Getting that wrong is the usual reason a correctly built frame never appears. See Common IO settings.
Example — requested torque to an inverter
- Type CAN Bus Output, alias
Requested Torque. - Message ID
0x100, ID typeStandard (11-bit). - Encoding type
UnsignedLittleEndian, Length2(bytes), Offset1(starts at byte 1) — a 16-bit value. (A bitfield type would use bits here.) - In min/max
0/500(Nm) → Raw min/max0/5000(0.1 Nm/bit). - Default value
0so no torque is requested until the strategy drives it. - Add a second output on the same ID with Encoding type
CounterFieldfor the inverter's rolling-counter byte.
Troubleshooting
- Receiver ignores the frame: check the Message ID and ID type, and the CAN bus baud rate.
- Value lands wrong / sign flipped: check the encoding type, Length and Offset — they are in bytes for integer/
CounterFieldtypes and bits for bitfield types. - Receiver reports a counter/checksum fault: add a
CounterField/BitCounterFieldoutput for the rolling-counter byte. - Sends an unexpected value at start-up: set a sensible Default value.
Related
- CAN Object Output — write a named object to a CAN Preset instead of packing bytes by hand.
- CAN Bus Input — decode a signal from an incoming frame.
- Working with the CAN Bus