← Back to Autonomy
Volume I · Embedded Communication Series

The CAN Protocol

An interactive primer for engineers building electric vehicles

Few pieces of technology have proved as quietly enduring as Bosch's Controller Area Network. Conceived in 1983 to replace ever-growing wiring harnesses in passenger cars, it now carries the most consequential conversations inside a modern electric vehicle — torque requests to inverters, contactor commands from battery management, fault codes destined for the technician's scanner — at modest data rates that would embarrass an ethernet engineer, yet with a reliability that has outlasted three generations of automotive computing.

This monograph is written for the practising EV controls engineer who needs to know not merely what CAN does, but why it survives in safety-critical powertrains, where it is being replaced, and how the protocol's mechanical details — bit timing, arbitration, error counters — translate into the calibration screens and oscilloscope traces of daily work. Each section ends with practical notes drawn from production experience on traction inverters and HV batteries.

§ I

Origins & Why It Still Wins a protocol designed for cars, not computers

Before CAN, an automobile was wired point-to-point: every switch, sensor and lamp had its own dedicated copper. By the early 1980s the harness in a fully optioned Mercedes had ballooned past two kilometres of wire weighing more than 50 kg. Bosch engineer Uwe Kiencke and his team set out to design a serial bus that was cheap, robust, prioritised and multi-master — a network where any node could speak when the bus was idle, and where the most urgent message would always go through first.

The 1986 SAE paper announcing CAN listed four design choices that, in retrospect, explain its longevity:

PrincipleConsequence
Message-oriented (not address-oriented)Any node may consume any frame; ECUs can be added without rewiring software.
Non-destructive bitwise arbitrationCollisions cost nothing — the loser silently steps aside and the winner's frame survives intact.
Multi-cast broadcastOne transmission reaches every listener, halving traffic versus point-to-point.
In-bit error detectionFive complementary mechanisms catch corruption with a residual error probability below 10⁻¹³.

For an electric vehicle, these properties matter more, not less, than they did for an internal-combustion car. A traction inverter must decide within a millisecond whether to honour a torque request; a battery management system must veto closing the main contactors if even one of 100+ cell modules reports a fault. CAN's deterministic priority resolution and its tolerance of single-wire failures (an open or short on either bus line still permits degraded operation per ISO 11898-2) make it a natural fit for safety-critical traffic that must arrive.

Practical Note Despite the relentless march of Automotive Ethernet, CAN-FD is not going away on the powertrain. Time-Sensitive Networking (TSN) over 100BASE-T1 is winning the backbone, but at the edge — the inverter, the on-board charger, the cell-monitoring chain — the determinism, cost and EMC robustness of CAN remain unbeaten. Plan your architecture for coexistence, not replacement.
§ II

The Physical Layer two wires, one differential voltage, two states

A high-speed CAN bus consists of exactly two wires — CAN_H and CAN_L — twisted together, terminated at each end of the trunk with a 120 Ω resistor matching the cable's characteristic impedance. Information is encoded not in the absolute voltage of either wire, but in the differential voltage between them, which radically improves immunity to the electromagnetic chaos of an EV powertrain.

The bus has two states, deliberately named to avoid the usual high/low ambiguity:

The asymmetry is intentional. When one node transmits a dominant bit and another transmits a recessive bit simultaneously, the dominant bit overwrites the recessive — this is the AND-of-the-bus property on which all arbitration depends.

Demo 1 — Differential Voltages
Fig. 1
CAN_H CAN_L V_diff = H - L
Why differential Any external interference — say, the 8 kHz switching noise of a SiC inverter — couples almost equally onto both twisted wires. Because the receiver looks only at the difference, the common-mode component cancels. Try sliding the noise control up: CAN_H and CAN_L wobble together, but Vdiff barely flinches. This is the same trick used by RS-485, Ethernet, USB and every other serious bus.
§ III

Anatomy of a Frame SOF · arbitration · control · data · CRC · ACK · EOF

A classical CAN data frame is a packet of between 47 and 135 bits — short, by any modern standard. Every byte exists for a reason: arbitration, addressing, length signalling, payload, integrity, acknowledgement, end-marker. Understanding the layout makes oscilloscope decoding intuitive and explains, for instance, why an 11-bit ID message of zero data length still requires 47 bit-times to transmit.

Standard frame (CAN 2.0A, 11-bit identifier)

FieldBitsPurpose
SOF1Start-of-frame, always dominant; synchronises receivers.
Identifier11Message ID; doubles as arbitration priority (lower = higher priority).
RTR1Remote Transmission Request; dominant for data frames.
IDE1Identifier Extension; dominant = standard, recessive = extended.
r01Reserved.
DLC4Data Length Code, 0–8 bytes.
Data0–64The payload itself.
CRC15 + 1Cyclic-redundancy check + delimiter.
ACK1 + 1Acknowledge slot (recessive by sender, dominant by any healthy receiver) + delimiter.
EOF7End-of-frame, seven recessive bits.
IFS3Inter-frame space.

One subtle but essential mechanism is bit stuffing. After any run of five identical bits in the field from SOF through CRC, the transmitter inserts an opposite-polarity stuff bit, which the receiver removes. This guarantees enough edges for receivers' bit-timing units to stay synchronised — and explains the upper bound of 135 bits per frame.

Demo 2 — Frame Builder & Bit Stuffing
Fig. 2
Extended frames (CAN 2.0B) A 29-bit identifier replaces the 11-bit ID. The IDE bit becomes recessive, an SRR (Substitute Remote Request) bit appears, and 18 additional ID bits are appended. SAE J1939 — the protocol layered on top of CAN for heavy-duty vehicles — uses 29-bit IDs throughout, packing source address, destination address and parameter group number into the identifier.
§ IV

Arbitration CSMA/CR — collisions made polite

What happens when two ECUs decide to transmit at the same instant? On Ethernet, both detect the collision, back off, and retry with a randomised delay — wasting time and giving no guarantee of priority. CAN solves the same problem more elegantly. Because dominant bits overwrite recessive bits on the wire, each transmitter compares the bit it intended to send against the bit it actually sees. The moment a node sees a dominant bit when it transmitted a recessive bit, it knows another node has a higher-priority (lower-numbered) ID, and it instantly stops transmitting and switches to receive mode. The winner's frame continues uninterrupted.

This is called Carrier Sense Multiple Access with Collision Resolution (CSMA/CR), and it has a beautiful consequence: the highest-priority message in the system suffers, in the worst case, only one bit-time of latency for any given lower-priority frame already in transit — a deterministic bound that lets engineers prove real-time schedulability.

Demo 3 — Three-Node Arbitration
Fig. 3
Press Start Arbitration to watch three ECUs contend for the bus, bit by bit.
Practical Note — ID Assignment for EVs Reserve the lowest IDs (highest priority) for safety-critical fast messages: e.g. 0x080 for emergency torque-off, 0x0A00x0FF for BMS contactor commands and HV interlock. Mid-range IDs (0x2000x3FF) for 1 ms / 10 ms control loops. Higher IDs for diagnostics and infotainment. Never give two messages the same ID — the bus will lock up the moment they collide in the data field.
§ V

Bit Timing & Synchronisation where embedded firmware meets the wire

Every node on a CAN bus must agree, to within fractions of a bit-time, on where the middle of each bit is. There is no separate clock line: receivers extract timing from recessive-to-dominant edges in the data stream itself. To make this possible, the nominal bit time is divided into four segments:

Tbit = SyncSeg + PropSeg + PhaseSeg1 + PhaseSeg2 (1)

The Synchronisation Segment (always 1 Time Quantum, TQ) is where edges are expected. The Propagation Segment compensates for signal-propagation delay along the cable plus transceiver group delay — round-trip. The two Phase Segments bracket the sample point, the instant at which the receiver actually latches the bit's logic level. Industry convention places the sample point at 75–87.5% of the bit time; CANopen recommends 87.5%, AUTOSAR drivers default similarly.

Resynchronisation occurs when an unexpected edge falls inside PhaseSeg1 or PhaseSeg2: the controller shortens or lengthens these segments by up to the Synchronisation Jump Width (SJW) to slide the sample point back over the new edge.

Demo 4 — Bit Timing Visualiser
Fig. 4
Common Pitfall A 500 kbit/s bus running 200 m of cable cannot use the textbook 87.5% sample point — propagation delay alone consumes 1 µs (two bits at 500 kbit/s). Bench-checked bit timing on a 1 m harness will throw stuff errors the moment it meets the production vehicle's 8 m harness with three inline connectors. Always recompute bit timing for the real harness, and ask CAN transceiver datasheets for their loop-delay specifications.
§ VI

Error Handling & Bus States five mechanisms, two counters, three states

CAN's fault-confinement model is one of its most studied features. Every node maintains two counters — the Transmit Error Counter (TEC) and the Receive Error Counter (REC) — that move in response to detected errors and successful transmissions. The node's behaviour transitions through three states based on the counter values:

Five complementary error-detection mechanisms operate in parallel: bit monitoring (compare transmitted bit with bus value), bit stuffing (more than five identical consecutive bits), frame check (fixed-form fields must match), CRC (15-bit polynomial over the frame), and ACK check (at least one receiver must drive the ACK slot dominant). Together they reduce the residual undetected-error probability below 10⁻¹³ — about one undetected error per million years of continuous traffic at 500 kbit/s.

Demo 5 — Fault-Confinement State Machine
Fig. 5
Node is Error Active. TEC = 0, REC = 0.
Practical Note — Bus-Off Recovery AUTOSAR's CanSM specifies a two-stage Bus-Off recovery: a short delay (~100 ms) for the first few occurrences, then a long delay (~1 s) if bus-off recurs, with a counter that escalates to a permanent fault. Do not let your inverter silently auto-recover and re-engage torque without arbitration with the VCU. A bus-off event during traction is a safety-relevant signal and must be reported up the diagnostic stack (UDS DTC, ASIL-graded).
§ VII

CAN-FD and the Path to CAN-XL faster data, longer frames, same arbitration

Classical CAN tops out at 1 Mbit/s and 8 bytes of payload — comfortably enough for periodic torque and temperature signals, but painfully slow for the multi-kilobyte secure flash blocks now demanded by over-the-air updates and for the parameter dumps of modern motor-control software. CAN-FD (Flexible Data-rate), introduced by Bosch in 2012 and standardised as ISO 11898-1:2015, addresses both shortcomings while preserving the priceless property of bitwise arbitration.

The trick is to use two bit rates per frame, separated by the BRS (Bit Rate Switch) bit:

  1. The arbitration phase (SOF through BRS) runs at the classical nominal rate — typically 500 kbit/s — because arbitration requires every transmitter to see every other's dominant bit before the sample point.
  2. Once arbitration is won and BRS is set recessive, the bus switches to the data phase rate — commonly 2 Mbit/s or 5 Mbit/s in vehicles, up to 8 Mbit/s on benches — for the DLC, data and CRC fields.
  3. After the CRC, the bus reverts to nominal rate for ACK and EOF.
Demo 6 — Classical CAN vs CAN-FD Throughput
Fig. 6

The payload limit jumps from 8 to 64 bytes, the CRC widens to 17 or 21 bits with a different polynomial (chosen to maintain Hamming distance even under bit-stuffing irregularities), and a stuff-bit count field guards against a class of subtle errors that plagued early FD implementations.

Looking ahead — CAN-XL Ratified in 2022 as ISO 11898-1 Amendment 1, CAN-XL pushes payloads to 2048 bytes and data-phase rates to 10–20 Mbit/s, with an explicit goal of bridging the gap between CAN-FD and 10BASE-T1S Ethernet. In an EV powertrain, CAN-XL is being evaluated for sensor-data aggregation (e.g. resolver and current waveforms from inverter to motor lab), not for ordinary control traffic.
§ VIII

Higher-Layer Protocols UDS, ISO-TP, J1939, OBD-II, CANopen

Raw CAN gives you frames, IDs and bytes. To actually exchange diagnostic requests, segmented file transfers, or standardised emissions data, the industry layers higher protocols on top:

ISO 15765-2 — Transport Protocol (ISO-TP)

CAN's 8-byte (or 64-byte) payload is too small for many diagnostic operations. ISO-TP fragments a logical message of up to 4 GB into a sequence of single, first, consecutive and flow-control frames, with a tiny header in the first byte indicating the frame type and sequence number. Every UDS exchange you observe on a vehicle bus is in fact an ISO-TP conversation.

ISO 14229 — Unified Diagnostic Services (UDS)

UDS defines the request/response protocol used by every modern OEM scan tool: read DTCs (0x19), read data by identifier (0x22), security access (0x27), routine control (0x31), request download (0x34) for ECU flashing, and many more. Each request carries a service identifier (SID); a positive response echoes the SID + 0x40, a negative response is 0x7F <SID> <NRC>.

SAE J1939

Dominant in commercial vehicles and heavy machinery, J1939 uses 29-bit identifiers to encode source address, destination address and a Parameter Group Number (PGN). It defines a fixed catalogue of Suspect Parameter Numbers (SPNs) — engine RPM, coolant temperature, etc. — so any J1939-compliant ECU is plug-and-play. Several electric-truck programmes adopt J1939 conventions even when the powertrain is fully electric.

ISO 15031 / SAE J1979 — OBD-II

The legally mandated subset of diagnostics, accessed via the trapezoidal connector under the dash. PIDs (Parameter IDs) under service 0x01 expose a defined list of signals: vehicle speed, battery state of charge for EVs (PID 0x5B), HV battery pack temperature (0x5C), etc. Useful for compliance and for third-party telematics dongles.

CANopen, CANaerospace, DeviceNet

Outside the automobile, CANopen (CiA 301) is the dominant higher-layer protocol — used in industrial robotics, medical devices, and increasingly in charging infrastructure on the back end of CCS DC fast chargers. It defines an object dictionary, PDOs (Process Data Objects), and SDOs (Service Data Objects).

§ IX

CAN in the EV Architecture domain controllers, gateways, zonal trends

A contemporary battery-electric vehicle does not have a CAN bus — it has several, partitioned by function and safety integrity. The diagram below shows a typical (and deliberately simplified) topology with the principal domains and the kind of traffic each carries.

Demo 7 — EV Network Topology & Message Flow
Fig. 7
Pick a scenario and press Run Scenario to see how messages traverse the gateway between buses.

Why segment the buses?

Three reasons dominate:

Charging interfaces

The DC fast-charging story is split between standards:

The zonal trend

Newer architectures — Mercedes-Benz MMA, VW SSP, GM Ultifi, Stellantis STLA Brain — are moving toward zonal rather than functional partitioning, with a high-bandwidth backbone (Automotive Ethernet 100/1000BASE-T1, TSN) connecting four to six zonal controllers, each of which fans out to local sensors and actuators via short CAN-FD or LIN segments. The number of long CAN runs shrinks; the number of short CAN segments multiplies. The protocol survives, but its role inverts — from vehicle backbone to local actuator bus.

§ X

Practical Notes diagnostics, bus loading, calibration pitfalls

Bus loading — rules of thumb

Calculate worst-case bus load as Σ (frame_length_bits / period_ms) / bitrate. Targets in production EV programmes:

BusBitrateTypical loadHard limit
Powertrain (safety-critical)500 kbit/s CAN-FD or 2 Mbit/s data phase< 40%60%
Chassis & ADAS sensors500 kbit/s< 50%70%
Body & comfort125 or 250 kbit/s< 60%80%
Diagnostic / OBD500 kbit/s< 10% steady state

DBC files

The de-facto exchange format for CAN message catalogues is the Vector DBC file: a plain-text description of every message ID, signal start-bit, length, byte order (Intel/Motorola), scale, offset, units and value tables. Most tooling — Vector CANalyzer, CANoe, PEAK PCAN-View, Wireshark with the CAN plugin, Python's cantools library — consumes DBC directly. Treat the DBC as part of the source code: version-control it, code-review it, generate the embedded encoder/decoder from it.

Partial Networking & wake-up

An EV at rest in a parking garage cannot afford to keep every ECU powered. CAN Partial Networking (ISO 11898-6) allows selected ECUs to be put into sleep while a transceiver with selective wake-up filters specific IDs and powers the microcontroller only when a relevant frame arrives. This is essential for keeping 12 V battery drain below the typical 50 mA target during the long-key-off phase.

Common pitfalls — a partial list

A small EV-specific checklist For any new traction inverter or BMS bring-up:
1. Verify bit timing on a scope before the first transmission — capture both edges, measure sample point.
2. Confirm the 60 Ω bus resistance with the harness in its final routing.
3. Run a 24 h soak with the inverter switching at full power and measure REC growth — a healthy node should remain at REC = 0.
4. Stress-test ID priority by injecting bursts of low-ID frames and confirming the 1 ms torque control loop is not delayed beyond its deadline.
5. Verify Bus-Off recovery: short the bus for 200 ms, release, and confirm the ECU returns to Error Active and resumes traffic within the calibrated recovery window.
§ XI

CAN Interface Hardware what sits between your laptop and the bus

So far, the protocol. Now the metal. Every measurement, every flash, every dyno trace begins with a small black box that bridges three worlds: a host computer speaking USB or PCIe; a protocol stack speaking CAN frames with microsecond timestamps; and a transceiver speaking dominant and recessive bits onto a pair of copper wires. This object is the CAN interface, and choosing the right one is more consequential than its modest price suggests.

Vector VN1630A CAN/LIN Interface, a four-channel USB device with D-sub 9 connectors and IXXAT breakout
Plate I A representative high-end interface — the Vector VN1630A, a four-channel CAN-FD / LIN device communicating with the host over USB 2.0. Visible on the right-hand face: the four channel-status LEDs and the D-sub 9 connectors, here mated with an IXXAT-style transceiver-cable adapter. Such interfaces deliver hardware time-stamping at sub-microsecond resolution across all channels from a single shared clock.

The vendor landscape

The professional automotive market is dominated by a small number of suppliers, each with a slightly different philosophy:

VendorFlagship linesNotes
Vector InformatikVN1610, VN1630A, VN1640, VN5640, VN8900Default in OEM development; tight integration with CANoe / CANalyzer / CANape; XL-Driver Library.
PEAK-SystemPCAN-USB FD, PCAN-PCI Express FD, PCAN-EthernetExcellent value; well-supported on Linux and macOS; SDK includes PCAN-Basic for Python, C#, etc.
KvaserLeaf Pro HS v2, U100, Memorator ProStrong on standalone logging; CANlib API; popular in motorsport and aerospace.
Intrepid Control SystemsValueCAN 4, neoVI FIRE, RAD-GalaxyMulti-protocol (CAN, LIN, Automotive Ethernet, FlexRay) in one chassis; Vehicle Spy software.
IXXAT (HMS)USB-to-CAN FD, CAN@net III, CAN-IB familyIndustrial heritage; popular for embedded gateways; supports CANopen out of the box.

The software stack

An interface is only as useful as the layers above it. From the bottom up:

Practical Note — Multi-channel synchronisation When you correlate a 1 ms torque-request message on the powertrain bus against the inverter's response on a different bus or against the analogue current sensor on an oscilloscope, every microsecond of skew shows up as a phantom delay in your control-loop debugging. Insist on an interface that timestamps all channels from a single hardware clock — this is standard on Vector VN-series, Kvaser Pro hardware, and Intrepid neoVI, but not always on cheaper dual-channel adapters. For oscilloscope correlation, use an interface with an external trigger I/O (SMB or BNC) and one of its lines as a hardware-timed sync marker.

Bench setup pitfalls

§ XII

XCP — Measurement & Calibration over CAN how engineers actually look inside a running ECU

UDS, covered in §VIII, is the diagnostic protocol; it answers "what is wrong?" and "what is your software version?" But the daily work of a controls engineer is different: you need to see a state variable evolve in real time while the inverter is spinning the dyno, and you need to tweak a calibration constant — a torque-table cell, a regulator gain, a current-limit threshold — without rebuilding and reflashing the ECU. That is the job of XCP, the Universal Measurement and Calibration Protocol, standardised by ASAM.

XCP descends from CCP (CAN Calibration Protocol, 1996), which was tied to CAN. XCP generalised the abstraction: the application layer is identical regardless of whether the underlying transport is CAN, CAN-FD, Ethernet (UDP or TCP), USB, FlexRay or a custom serial link. In an EV powertrain context you will encounter all four of the first transports, often in the same project: XCP on CAN on the production inverter, XCP on Ethernet for high-bandwidth rapid prototyping with dSPACE or ETAS hardware, and XCP on USB for bench-side data logging from a debug interface.

Architecture in one sentence

A master (CANape, INCA, MATLAB Vehicle Network Toolbox, a custom Python script using pyxcp) issues commands to a slave (the XCP driver embedded in the ECU firmware), which responds with answers and asynchronously streams measurement data back at configured event triggers.

Two packet types, three core services

XCP defines exactly two packet families:

On top of these, three services do almost all the work:

  1. Measurement (DAQ). The master configures one or more DAQ lists: each list is a set of memory addresses (ECU variables) tied to an event channel — typically a periodic task in the ECU scheduler (1 ms, 10 ms, 100 ms) or an event raised by a specific function (e.g. each PWM cycle). When the event fires, the XCP slave packs the current values of those variables into a DTO and transmits. No polling.
  2. Calibration. The master may DOWNLOAD new values to any writable memory address, with optional resource-access protection. Cleared with SET_CAL_PAGE, the change takes effect on the next time the application code reads the parameter.
  3. Page switching. Many ECUs implement two memory pages — a reference page (the flashed baseline, read-only) and a working page (RAM, writable). A SET_CAL_PAGE command swaps which one the application sees. This gives an engineer the ability to roll back a calibration change instantly, and to compare new-vs-old behaviour by toggling pages mid-test.
Demo 8 — XCP DAQ Event Sampling
Fig. 8

The A2L file — the missing piece

The XCP protocol does not know names. It moves bytes between memory addresses, full stop. The bridge between "address 0x80001234, four bytes, little-endian" and "motor mechanical speed in revolutions per minute" lives in the A2L file (ASAM MCD-2 MC), a plain-text description that every measurement / calibration tool ingests. A minimal entry looks like:

/* MEASUREMENT block — one per observable variable */
/begin MEASUREMENT motor_speed_rpm "Motor mechanical speed"
   FLOAT32_IEEE NoCompuMethod 0 0 -10000 10000
   ECU_ADDRESS 0x80001234
   DISPLAY_IDENTIFIER nSpeed
   FORMAT "%.1f"
   PHYS_UNIT "rpm"
/end MEASUREMENT

/* CHARACTERISTIC block — one per calibration parameter */
/begin CHARACTERISTIC Iq_Limit_A "q-axis current limit"
   VALUE 0x80008000 Linear_q15 500.0 -500.0 500.0
   PHYS_UNIT "A"
/end CHARACTERISTIC

For a model-based development flow — Simulink Embedded Coder, TargetLink, or ETAS ASCET — the A2L file is generated automatically from the model: every Simulink signal marked for measurement and every workspace tunable parameter appears in the A2L with the correct address (resolved post-link by parsing the linker map) and the correct conversion rule (inferred from the data-type and scale/offset attributes on the signal).

Practical Note — Bus Load Discipline Drag Demo 8's 1 ms slider toward 32 signals on classical CAN and watch the bus load explode past 100%. XCP-on-CAN is a finite resource: every DAQ packet competes for bus arbitration against your real powertrain traffic. A common production discipline at OEMs is to budget XCP at < 10% of the powertrain bus and route the bulk of high-rate measurements over a dedicated XCP-on-Ethernet debug link via a separate physical connector on the ECU. CAN-FD's data-phase rate buys you roughly a 4× headroom but does not change the rule.

Calibration page switching, in practice

When commissioning a new motor map on the dyno, you load the existing flash calibration onto the reference page, copy it to the working page, then make incremental changes to the working page — torque table cells, MTPA breakpoints, field-weakening transition speeds — while the dyno is running. At any moment you can SET_CAL_PAGE → reference to A/B-compare the original and the new calibration on the same operating point. When you're happy, the working page becomes the new flash content and is written back to the ECU's non-volatile memory via the standard UDS flash sequence. The protocol is unchanged; the workflow is what makes XCP indispensable.

§ XIII

The Tooling Ecosystem CANoe, CANape, INCA, HIL, restbus, file formats

The protocols described in this monograph are not, on their own, productive. Around them an entire ecosystem of measurement, simulation, calibration, logging and testing tools has grown up — much of it from the same companies that supply the interface hardware. A working engineer needs to know which tool to reach for, and which file format to feed it.

Measurement & Calibration

ToolVendorPrimary use
CANapeVectorXCP master, measurement recording (MDF/MF4), calibration, ECU flashing, map editing.
INCAETASDirect competitor to CANape; deeper integration with ETAS HIL and Bosch ECUs.
ATI VisionAccurate TechnologiesCommon in North American OEMs; supports CCP, XCP, KWP, UDS.
MATLAB Vehicle Network ToolboxMathWorksScripted measurement, DBC/A2L parsing, dataflow into Simulink for offline analysis.

Bus Simulation & Test

ToolUse case
CANoe (Vector)Full residual-bus simulation: model the entire vehicle network so a single ECU-under-test believes it sees its neighbours. CAPL scripting language for test sequences and signal manipulation.
CANalyzer (Vector)Passive monitoring and post-trace analysis; the read-only cousin of CANoe.
vTESTstudio (Vector)Authoring environment for automated test cases that execute on CANoe.
Vehicle Spy (Intrepid)Tight integration with neoVI / RAD hardware; scripting in Python.
BUSMASTER (open-source)Free alternative for CAN logging and simple replay; works with Vector and Kvaser hardware.

HIL & Rapid Prototyping

Hardware-in-the-loop (HIL) systems close the loop between a real ECU and a real-time simulated plant. They consume your CAN signals as inputs to a vehicle dynamics or e-machine model and inject the model's responses back on the bus — a dyno-in-a-box. The four big platforms in the EV space:

Bypassing deserves a special note in an EV context. The technique replaces a piece of running ECU code — say, the q-axis current controller — with a function executing on external rapid-prototyping hardware, communicating via XCP-on-Ethernet at sub-millisecond cycle times. You iterate on the model in Simulink, hit "build and deploy", and the new controller is live on the dyno seconds later, with the rest of the production ECU code untouched. The technique is invaluable for tuning regulator gains, evaluating new MTPA strategies, or testing harmonic-current injection schemes before they are mature enough to embed in the production binary.

Restbus simulation

An ECU on the bench, unplugged from the rest of the vehicle, is hostile territory: every periodic message it expects from a neighbour is missing, every timeout fires, and the application either refuses to start or enters a limp-home mode. The cure is restbus simulation — typically authored in CANoe, where you load the vehicle DBC, mark which nodes are real and which are simulated, and the tool generates the expected periodic traffic for all simulated nodes. The device-under-test sees a believable network and behaves as it would in the vehicle.

The file-format menagerie

ExtensionStandardWhat it describes
.dbcVector proprietary, ubiquitousCAN messages and signals — IDs, byte order, scale, offset, value tables.
.arxmlAUTOSAR XMLThe full architectural description: ECUs, software components, signals, port mappings, network topology. Source-of-truth in AUTOSAR projects, with DBC generated as a by-product.
.a2lASAM MCD-2 MCECU memory description for XCP — measurements, characteristics, conversion rules, events.
.mf4 / .mdfASAM MDF 4.x / 3.xMeasurement data — multi-channel time-series, the standard recording format from CANape, INCA and MDF4-aware loggers.
.blfVector binary loggingCompact CAN trace format produced by CANalyzer / CANoe.
.ascVector ASCII tracePlain-text bus log, human-readable, easily parsed by Python.
.ldfLIN Description FileThe LIN equivalent of DBC — slave configuration, schedule tables, signal definitions.
.cddCANdela (Vector)UDS service catalogue and DTC list for a specific ECU — consumed by diagnostic testers.
.odxISO 22901-1Open Diagnostic data eXchange — the standardised successor to vendor-specific diagnostic catalogues.

Where to start, if you are starting today

For a controls engineer arriving on a new EV programme, the minimum-viable toolkit is: a four-channel CAN-FD interface (Vector VN1630A or PEAK PCAN-USB FD), Vector CANoe or PEAK PCAN-View for live bus monitoring, the project's DBC and A2L files under version control, Python with python-can and cantools for scripted measurement and replay, MATLAB / Simulink with Vehicle Network Toolbox if your team is model-based, and CANape or INCA the moment XCP-based calibration becomes part of the daily work. Add a HIL system when your control loops are mature enough that you can no longer tolerate dyno turnaround times.

A closing thought Forty years on from Kiencke's 1986 paper, CAN remains the protocol you reach for when an embedded controller must say something true to another embedded controller and be believed. The architecture has not stood still — CAN-FD has stretched the payload, CAN-XL is gathering momentum, Automotive Ethernet has occupied the backbone — but the elemental properties that made it right for cars in 1986 still make it right for electric vehicles in 2026: priority by design, errors detected in flight, a bus that an ECU can leave gracefully when it is no longer trustworthy. Few engineering choices age this well.
§ XIV

CANape & CANoe the two programs you live in

Of the dozen vendor tools listed in the previous section, two account for the overwhelming majority of an EV-controls engineer's wall-clock time. CANape is where you measure and calibrate a real ECU; CANoe is where you simulate the rest of the vehicle so that ECU has someone to talk to. They share a vendor (Vector Informatik), an ancestor in CANalyzer, and a common visual idiom, but the workflows are genuinely different. This section walks through both with enough detail to recognise — and reproduce — what an experienced user is doing on the screen across the desk from you.

XIV.A — CANape, the engineer's measurement bench

CANape is, at heart, an XCP master with very polished display, recording, and calibration windows on top. Open a project and you will find four artefacts that define what it can do:

The day-to-day rhythm is straightforward. You connect the interface, CANape sends the XCP CONNECT command, queries the slave's resources, and downloads the configured DAQ lists to the ECU. You hit the red Measurement button and signals begin streaming from the ECU to your display in real time. You drag a calibration parameter from the parameter tree onto a slider widget, change it on the fly, and watch the response in the same window. When you have something worth keeping, the Recorder writes the lot to an MDF4 file with full timing metadata, ready for offline analysis in MATLAB, Python, or Vector's own vSignalyzer.

Demo 9 — CANape-Style Measurement & Calibration Window
Fig. 9

Drag the Torque demand slider while measurement is running — the working page applies your calibrated Kp immediately and the actual-torque trace responds with the corresponding rise time. Flip the Page selector to Reference to see how the same demand would have been tracked with the flashed-baseline Kp. This is the workflow that distinguishes a calibration tool from a passive logger: the act of measurement and the act of tuning are unified in the same window.

Calibration objects beyond simple parameters

CANape's parameter tree is hierarchical and typed. A scalar like Iq_Limit_A opens as a numeric editor; a 1-D table like MTPA_Iq_vs_Tdemand[] opens as a curve editor with draggable breakpoints; a 2-D map like Efficiency_eta(speed, torque) opens as a surface editor with both contour and 3-D views, and the cursor on the surface follows the ECU's live operating point if the corresponding signals are being measured. For an MTPA-curve recalibration session, you can have the map editor on one screen, a 4-channel scope of (Tdemand, Tactual, Iq, Id) on another, and reshape the map by dragging individual cells while watching the response in real time — a workflow that would have been unthinkable in the days when a calibration change meant a flash cycle and a power-down.

Practical Note — Bypassing in CANape A natural extension is function bypassing: instead of merely tuning a parameter, you replace an entire function — say, the q-axis current PI controller — with a Simulink model executing on external rapid-prototyping hardware (dSPACE MicroAutoBox III, ETAS ES910) connected by XCP-on-Ethernet. CANape coordinates the hand-off: at each control-loop cycle, the production ECU sends current measurements out via XCP-STIM, the external box computes the new voltage commands, and sends them back via XCP-DAQ — all at sub-millisecond cycle times. You iterate on the controller in Simulink, click Build & Deploy, and the new algorithm is live without re-flashing the production binary. Indispensable for tuning gain schedules, evaluating new MTPA strategies, or testing HCI schemes before they're mature enough for production code.

XIV.B — CANoe, the virtual vehicle network

If CANape's centre of gravity is the device, CANoe's is the network. The premise is simple: most testing of an embedded ECU has to happen long before the rest of the vehicle exists, or in scenarios that would be expensive or dangerous to provoke on a real car. CANoe lets you build a virtual replica of the vehicle network — every bus, every node, every signal, every periodic message and every event-driven response — and run it in real time alongside the one or two real ECUs you actually have on the bench.

The configuration is organised around four main windows:

WindowPurpose
Simulation SetupNetwork topology view. Each node icon is either real (a passthrough to the physical bus) or simulated (a CAPL program standing in for an absent ECU).
Measurement SetupWhat to record and how. Connects analysis blocks (Trace, Graphic, Statistics) between the bus and the recorder.
TraceThe bus log — every frame with timestamp, ID, DLC, data, and decoded signals from the DBC.
GraphicTime-domain signal plots, similar to CANape's measurement window but driven by bus signals rather than XCP.

CAPL — the language that makes CANoe powerful

The single feature most responsible for CANoe's dominance is CAPL — the Communication Access Programming Language, a C-flavoured event-driven scripting language with direct access to bus messages, signals, system variables, and Vector's environment functions. Every simulated node and every test case is a CAPL program. A minimal CAPL file that simulates a torque-request transmitter and reacts to a status response looks like this:

/* TorqueRequester.can — a simulated VCU node */

variables {
   message 0x100 TorqueReq;                // frame definition
   msTimer SendCycle;                       // 10 ms periodic timer
   float   currentDemand_Nm = 0.0;
}

on start {
   write("VCU node up at t = %f s", timeNow());
   setTimer(SendCycle, 10);             // fire every 10 ms
}

on timer SendCycle {
   // Encode physical Nm to raw (scale 0.0625 Nm/bit, signed 16-bit)
   TorqueReq.word(0) = (int)(currentDemand_Nm / 0.0625);
   TorqueReq.byte(2) = sysGetVariableInt(VCU::DriveMode);
   output(TorqueReq);
   setTimer(SendCycle, 10);
}

/* Event-driven: react to a received MotorStatus message */
on message MotorStatus {
   if (this.byte(0) & 0x01) {
      write("⚠  Motor fault flag at %.3f s", timeNow());
      currentDemand_Nm = 0.0;                  // safe-state
   }
}

/* Panel-driven: react to operator changing a system variable */
on sysvar VCU::TorqueDemand {
   currentDemand_Nm = @VCU::TorqueDemand;
}

Note three patterns: the on timer handler implements periodic transmission; the on message handler is the event-driven reception path; the on sysvar handler links a system variable to a user-interface widget on a CANoe panel. CAPL is fast enough to keep up with the bus in real time (microsecond-scale handler execution) and capable enough to express complex test logic, gateway behaviour, residual-bus simulation, and even bit-level fault injection.

Test automation — vTESTstudio

For repeatable regression testing, hand-written CAPL gives way to vTESTstudio, Vector's test-authoring environment. Tests are authored declaratively as a sequence of stimulus and check statements; vTESTstudio compiles them into CAPL that runs on the same CANoe runtime. The output is a structured HTML report listing passed and failed cases — exactly the artefact you need for ASIL evidence under ISO 26262.

The three workflows you will use most

  1. Restbus simulation. Load the project DBC, mark the device-under-test as Real and every other node as Simulated, and CANoe will auto-generate (or you'll fill in) the CAPL stubs that produce the expected periodic traffic. The DUT sees a network that looks complete.
  2. Trace replay. Drop a logged .blf or .asc file into a Replay block in the Measurement Setup. The bus replays the captured traffic exactly as it occurred, with original timing — invaluable for reproducing a field-failure scenario on the bench.
  3. Gateway emulation. Two CAN channels, one CAPL program forwarding selected IDs from channel 1 to channel 2 with optional ID remapping, signal scaling, or rate gating. Useful when standing in for a not-yet-available production gateway, or when testing how a new ECU behaves behind a real one.
CANalyzer vs CANoe The two share most of the same UI and file formats; the difference is what they're licensed to do. CANalyzer is read-only — it watches, decodes, and records, but it cannot transmit. CANoe can transmit, simulate nodes, run CAPL test programs, and host vTESTstudio. If your seat licence is CANalyzer, your tools menu will be missing exactly those items. Plan licensing before the integration phase begins.

How they fit together

On a typical day at the inverter bench you may well have both tools running at once: CANoe on one monitor simulating the VCU, BMS, and OBD-tester so the inverter under test sees a complete vehicle, and CANape on another monitor connected to the same bus, measuring inverter-internal signals via XCP and tuning the q-axis current PI gains live. The two programs share the bus through the same CAN interface — typically a Vector VN1610 or VN1630A — and Vector's drivers arbitrate access cleanly. Combined, they cover virtually the entire span of bench-side work between "a fresh binary just compiled" and "a calibrated, regression-tested release candidate."

❦ ❦ ❦
References

References & Further Reading

  1. Robert Bosch GmbH. CAN Specification 2.0, Parts A and B. Stuttgart, 1991. The foundational document; still freely available from Bosch.
  2. ISO 11898-1:2015. Road vehicles — Controller area network (CAN) — Part 1: Data link layer and physical signalling. The current international standard, including CAN-FD.
  3. ISO 11898-2:2016. Road vehicles — Controller area network (CAN) — Part 2: High-speed medium access unit. Defines the physical layer, transceiver behaviour, and common-mode voltage range.
  4. ISO 11898-6:2013. Road vehicles — CAN — Part 6: High-speed medium access unit with selective wake-up functionality. The CAN Partial Networking standard.
  5. ISO 15765-2:2024. Road vehicles — Diagnostic communication over CAN (DoCAN) — Part 2: Transport protocol and network layer services. ISO-TP, the basis for UDS over CAN.
  6. ISO 14229-1:2020. Road vehicles — Unified diagnostic services (UDS) — Part 1: Application layer. The vocabulary of every modern scan tool.
  7. SAE J1939 family of standards. Recommended Practice for Serial Control and Communications Heavy Duty Vehicle Network. The 29-bit-ID protocol used in trucks and increasingly in electric commercial vehicles.
  8. ISO 15118-1/-2/-20. Road vehicles — Vehicle to grid communication interface. Plug-and-Charge, used over PLC for CCS DC fast charging.
  9. CHAdeMO Association. CHAdeMO Protocol Specification. CAN-based DC fast-charging protocol.
  10. K. Etschberger. Controller Area Network: Basics, Protocols, Chips and Applications. IXXAT Press, 2001. Still one of the clearest tutorial books.
  11. M. Di Natale, H. Zeng, P. Giusto, A. Ghosal. Understanding and Using the Controller Area Network Communication Protocol: Theory and Practice. Springer, 2012. Excellent on schedulability analysis and timing.
  12. Vector Informatik GmbH. CANoe / CANalyzer Users' Manual. Reference for DBC files, real-time bus simulation, and CAPL scripting.
  13. AUTOSAR Classic Platform. Specification of CAN Driver, CAN Interface, CAN State Manager, PduR, Com (current revision). Defines the layered automotive software stack on top of CAN.
  14. F. Hartwich. CAN with Flexible Data-Rate. Bosch white paper, 2012. The introductory paper for CAN-FD.
  15. CiA 601-3. CAN XL specifications. The forthcoming successor to CAN-FD, with up to 2048-byte payloads.
  16. ASAM e.V. ASAM MCD-1 XCP — Universal Measurement and Calibration Protocol, Part 1 (Overview), Part 2 (Protocol Layer), Part 3 (Transport Layers — XCP on CAN, FlexRay, Ethernet, USB, SxI). The defining XCP standard.
  17. ASAM e.V. ASAM MCD-2 MC (ASAP2 / A2L). The ECU description file format consumed by every measurement and calibration tool.
  18. ASAM e.V. ASAM MDF 4.x. The standardised measurement data format used by CANape, INCA, and most automotive loggers.
  19. A. Patzer, R. Zaiser. XCP — The Standard Protocol for ECU Development. Vector Informatik whitepaper, freely available. The clearest introductory text on XCP.
  20. Vector Informatik. VN1630A Product Information & XL-Driver Library Manual. Hardware reference for the four-channel CAN-FD / LIN interface and the host driver API.
  21. PEAK-System Technik. PCAN-Basic API Documentation. Reference for the cross-platform driver used with PEAK hardware.
  22. R. Hartkopp et al. SocketCAN — Controller Area Network Protocols on Linux. Linux kernel documentation; the basis for python-can and most open-source automotive tooling on Linux.
  23. K. Lennartsson. CAN, CAN-FD and CAN-XL in Automotive. Kvaser AB technical article. Useful comparison of the three protocol variants in production use.
Typeset in Cormorant Garamond & Crimson Pro · Monospace JetBrains Mono
Seven canvas demonstrations · Compiled as a single static HTML document