Classic CAN carries 8 bytes per frame at up to 1 Mbit/s. That was plenty for a status word and a few sensor readings, and it isn't for a firmware update over the bus, a calibration table or a diagnostic dump. CAN FD fixes that: up to 64 bytes per frame, and a data phase that switches to a faster bit rate once arbitration is over.
The BenchPod has had a CAN port since the beginning. With firmware 3.10.2 it speaks CAN FD too, on the same connector, with the same API. If your node runs CAN FD, the pod can now be the rest of the bus.
What changed
The pod's CAN controller always supported FD; the firmware didn't use it. Now one extra argument turns it on:
from embeddedci.benchpod import BenchPod
with BenchPod("192.168.1.150", la_voltage=3.3) as bp:
with bp.open_can(bitrate=500_000, data_bitrate=2_000_000, mode="normal", term=True) as can:
can.write(0x123, bytes(range(64))) # one FD frame, 64 bytes, data phase at 2 Mbit/s
reply = can.expect(can_id=0x124, timeout=1.0)
assert reply.fd and reply.brs and len(reply.data) == 64bitrate is the arbitration rate, the slow part every node on the bus has to agree on. data_bitrate is the rate the frame switches to for its payload. Leave data_bitrate out and the bus is classic CAN, exactly as before, so existing tests don't change.
| Setting | Classic CAN | CAN FD on the BenchPod |
|---|---|---|
| Payload per frame | 0-8 bytes | 0-8, 12, 16, 20, 24, 32, 48 or 64 bytes |
| Arbitration rate | up to 1 Mbit/s | up to 1 Mbit/s |
| Data phase | same as arbitration | up to 8 Mbit/s (1, 2, 4, 5 and 8 Mbit/s work) |
| Remote frames | yes | no (CAN FD has none) |
| Frames queued on the pod | about 50 | about 13 of 64 bytes |
The data rate has to have exact bit timing at the controller's clock, so 3 and 6 Mbit/s are refused with an error that names the rates that work. The pod picks the sample points itself: 80 % in the arbitration phase, and 80 % (up to 2 Mbit/s) or 75 % (above) in the data phase, with transmitter delay compensation on, as CiA 601-3 recommends. Give your node the same sample points and the two agree from the first frame.
An FD payload that isn't one of the legal lengths is padded with zeros to the next one. Write 40 bytes and the bus carries 48; the reply's dlc tells you what was sent.
Classic and FD on one bus
Real buses are often mixed: an FD gateway next to a classic sensor node that will never be updated. On an FD bus the pod sends FD frames with bit-rate switching by default, and you can step down per frame:
with bp.open_can(bitrate=500_000, data_bitrate=5_000_000, term=True) as can:
can.write(0x200, bytes(48)) # FD, data phase at 5 Mbit/s
can.write(0x201, bytes(48), brs=False) # FD, but the payload stays at 500 kbit/s
can.write(0x202, [1, 2, 3], fd=False) # a classic frame, for the classic nodeEvery received frame says what it was: frame.fd for an FD frame, frame.brs when its data phase switched. Print one and you get CAN std FD+BRS id=0x124 [64] 0001..., which is handy in a failing test's output.
Our own test node, the process-control node, has a classic CAN controller. That turned out to be a good test in itself: the pod on a 2 or 5 Mbit/s FD bus exchanges classic frames with it, and both sides finish with zero error counts.
The pod as the other ECU
Most CAN tests need someone on the other end: a node that answers a request, the way a battery controller answers "what's your state of charge?". The pod's responder does that in its firmware. When a frame with a given ID arrives, the pod replies straight from the receive interrupt, in microseconds, with no round trip to your computer or the cloud:
with bp.open_can(bitrate=500_000, data_bitrate=2_000_000, term=True) as can:
# Diagnostic request 0x7DF gets a 64-byte answer on 0x7E8, the way an ECU would.
can.add_responder(0x7DF, 0x7E8, bytes([0x62, 0xF1, 0x90]) + b"VIN-TEST-0001".ljust(61, b"\0"))
# Your firmware sends 0x7DF and should parse the answer: check what it did with it.On an FD bus the reply is an FD frame with bit-rate switching, unless you pass reply_fd=False or reply_brs=False. The pod holds up to 8 rules, and simulate_ecu installs a whole table at once. Closing the bus clears them, so a rule from one test never answers in the next.
Errors are measured, not hidden
A frame that arrives proves the happy path. The interesting CAN bugs show up in the error counters: a node that transmits without anyone acknowledging, a wrong sample point that works on a short cable and fails on a long one, a missing terminator. can.status() reports what the pod's controller saw:
st = can.status()
assert st["tec"] == 0 and st["rec"] == 0, f"errors on the bus: {st}"
assert not st["bus_off"] and st["rx_overflow"] == 0| Field | What it tells you |
|---|---|
tec, rec | transmit and receive error counters |
error_passive | the pod's controller is error passive (a counter above 127) |
bus_off | the pod went bus-off |
bus_off_recoveries | how many times it came back |
rx_overflow | frames dropped because the receive queue was full |
responder_hits | how many requests the responder answered |
The 120 Ω termination is a relay you switch from the test: term=True when opening the bus, or can.set_term(False) in the middle. That makes "the bus has no terminator" a test case instead of an afternoon with a multimeter. In the thermostat node's suite, termination on means traffic in both directions with zero errors; termination off means the pod's frame never gets through and its error counter climbs.
One thing to be clear about: the pod reports bus-off, it doesn't cause it. It can't send a malformed frame or force an error frame onto the bus to push your node into bus-off. What you can do is create the conditions a real bus has: take away the only terminator, put the pod in listen mode so nobody acknowledges your node, or set a different bit rate, and then check your firmware's counters and recovery through its console or its own CAN messages.
Self-test without a second node
The internal and external loopback modes let a pod test its own CAN FD path with nothing wired to it. external goes out through the transceiver and back, so it also checks the physical side:
with bp.open_can(bitrate=1_000_000, data_bitrate=4_000_000, mode="external") as can:
can.write(0x55, bytes(range(64)))
assert can.expect(can_id=0x55, timeout=0.5).data == bytes(range(64))We run that as the first test of a CAN suite. If it fails, the problem is the pod or its cable, not your firmware, and the rest of the suite doesn't waste anybody's time.
From the agent and the cloud
Every CAN command is a single request and reply, so all of it works over the EmbeddedCI cloud as well as the LAN and USB. The MCP server has the same calls as tools: can_open with a data_bitrate, can_write, can_read, can_respond and can_status, so an AI agent can bring up an FD bus, play the other ECU and read the error counters while it narrows down a failure. In the web app and BenchPod Desktop, the bus console's CAN tab does the same by hand.
CAN FD needs firmware 3.10.2 or later (capability can_fd); benchpod.supports("can_fd") lets a test skip on an older pod instead of failing. The full reference is in the pytest framework docs and the API reference. If you're starting from classic CAN, the thermostat node article shows a complete CAN test suite on a real board, and the 48 MS/s logic analyzer captures a 2-5 Mbit/s data phase without missing an edge.