What is XCP

Micael Coutinho,autosarbswxcp

XCP is a standard protocol that enables calibration on modern ECU's. Learn how it works here

If you stayed on the automotive industry long enough, you probably have already heard calibration is an important step of ECU development. It allows to fine tune parameters on the ECU so that our sensors, control algorithms, work according to our system requirements. We have discussed how calibration is performed before, in the article Calibration Overview (opens in a new tab), where we discussed the multiple forms of calibration, and even touched on XCP multiple times, as the concepts are tightly related. We also recommend learning about A2L in our article The Basics of A2L Files (opens in a new tab), as the MC-Tools take part of the A2L description to match the ECU configuration of XCP and communicate with the ECU through it.

So, what is XCP (Universal Measurement and Calibration Protocol), and why do we use it? Defined by the ASAM MCD-1 XCP standard, it enables access to the memory inside our ECU's, which means we can measure and calibrate, in theory, any memory range (if we consider memory overlay, of course), via our preferred communication bus (the X in XCP stands for the flexibility of transport layer we can use), with the exception of LIN, which is too slow for XCP. It provides us a way to measure and stimulate variables periodically or via polling, perform memory paging (more on that in a moment), reprogram our ECU, perform project-specific operations (just like we can do via UDS), and even debugging. We see here that some functionalities overlap with UDS (you can check our article UDS Overview (opens in a new tab)), but they are, in fact, very different. Firstly, XCP is a development module, which is available in production. And due to its memory access capabilities, it makes sense, because there isn't a very secure authentication mechanism. Second, the periodic measuring, calibration and memory paging capabilities are way more powerful than those on UDS. Third, XCP is well-establised as the de-facto protocol, used by the MC-Tools. Now, let's take at dive on the XCP protocol.

XCP Events, DAQ and STIM Lists, ODT's and ODT Entries:

DAQ (Data AcQuisition) and STIM (Data STIMulation) lists are at the heart of the XCP protocol. All other resources are pretty transversal to other modules you may find in Autosar, but these are very XCP-specific, and make it extremely useful. To learn them, we'll dive into the four concepts mentioned above:

Since we have thrown many concepts around, here is a picture to make you understand the relationship between events, DAQ/STIM lists, ODT's and ODT entries:

Relationship between events, DAQ/STIM lists, ODT's and ODT entries { w: 352, h: 403 }

Relationship between events, DAQ/STIM lists, ODT's and ODT entries

Communication Protocol:

There are two types of messages on XCP: CTO (Command Transfer Object) and DTO (Data Transfer Object). Inside them, there are specific command categories. For CTO messages:

Now that we know what DAQ and STIM lists are, the DTO command categories are easy to understand. They transfer DAQ or STIM lists, depending on the direction. In sum, the CTO and DTO messages and their direction can be depicted in the following picture:

CTO and DTO message categories { w: 298, h: 252 }

CTO and DTO message categories

XCP Message Structure:

Depending on the type of message and the category within it, the XCP protocol will send a different kind of message. But the building blocks are always the same, they are just present or absent according to the kind of message. In the picture below, you can see all the possible fields that can take part in an XCP frame. By analysing each of these fields carefully, we'll know what they mean and in what kinds of commands we find them:

XCP CTO (top) and DTO (bottom) message structure { w: 632, h: 152 }

XCP CTO (top) and DTO (bottom) message structure

Communication Modes:

XCP resorts to 3 different communication modes, which defer on the number of commands being sent in each direction:

Standard (left), block (middle) and interleaved (right) XCP communication modes { w: 530, h: 252 }

Standard (left), block (middle) and interleaved (right) XCP communication modes

As some closing thoughts, we hope this article helped you understand some of the basics of the XCP protocol, specifically, what it is, why it's so useful in ECU development and the protocol structure. We intentionally left the commands out of this article, in order to maximize the learning potential. They will have their own article in the future, so stay tuned!

Author: Micael Coutinho (opens in a new tab)

References:

© AutosarToday —@LinkedIn