CAN-FD
CAN-FD is an opt-in transport on the freertos-posix SocketCAN path. It does
not replace the classic demo contract in CAN output: the three 8-byte
frames (0x100 / 0x101 / 0x102) stay the default, and Zephyr, the
FVP UDP tunnel, and S32Z hardware remain classic only.
Enabling it
Safety Island: build
freertos-posixas usual, then setSAFETY_ISLAND_CAN_FORMAT=fdnext toSAFETY_ISLAND_CAN_IFACE. The default isclassic.Host bridge:
python3 demo/can_carla_bridge/bridge.py --can-format fd. The default isclassic.vcancarries CAN-FD frames; current kernels givevcan0the FD MTU of 72 bytes. Thevcanroundtrip script sets the FD MTU while the link is down before running.
Fail closed: an unknown SAFETY_ISLAND_CAN_FORMAT value, an interface whose
MTU is below 72 (CAN-FD disabled), or a platform without FD support all make
can_init() fail instead of silently sending classic frames.
Frame format
FD mode replaces the classic three-frame batch with one 24-byte frame:
CAN ID |
Payload |
Scaling |
|---|---|---|
|
lateral (8 bytes), longitudinal (8 bytes), status (8 bytes) |
the three classic payloads in order; see CAN output |
length is the payload byte count (24). The wire DLC is the CAN-FD encoding
of that length: 12 for 24 bytes. FD DLC values 9–15 cover 12/16/20/24/32/
48/64 bytes and are not byte counts. SocketCAN maps length to the wire DLC;
BRS stays off.
The status slice is the classic status frame byte for byte, including the
decision, the fault id and the CRC over all 23 preceding bytes
(CAN output), so the host decoder applies the same integrity, commit,
replay, and watchdog rules to both formats. A bridge
instance decodes one format at a time (--can-format), ignores frames in
the other format, and ignores extended-ID frames in both.
Non-goals
No OEM FD DBC.
No FD on Zephyr, the FVP UDP tunnel, or S32Z hardware.
No BRS / second bitrate selection yet.
No change to the classic
0x100/0x101/0x102contract.
Validation
actuation_module/test/can_output_test.cppchecks the FD encoder frame id, byte length 24, BRS off, and every payload offset against the classic scaling.actuation_module/test/can_vcan_sender.cppsends one classic batch and one FD frame onvcan0;demo/can_carla_bridge/test_vcan_roundtrip.pydecodes both and checks the sequence and watchdog rules. The script then lowers the vcan MTU to 16 and checks CAN-FD init fails closed.demo/can_carla_bridge/test_decoder.pyandtest_bridge.pycover the FD golden vectors, extended-ID, replay and length rejection, and format exclusivity.The
FreeRTOS POSIX vcanCI job runs both formats. No CARLA.
vcan validates framing and the software path only. Bitrate, bus load, bus-off, and real transceivers need hardware.