XCP Server Demo
Overview
RAPIDSEA provides XCP (Universal Measurement and Calibration Protocol) support, as detailed in the XCP protocol documentation page. This demo illustrates a real-world simulation of a vehicle fuel tank, exposing calibration parameters and live measurement values through the XCP interface. It helps users understand how the stack can be customized for calibration and measurement applications.
for functional command code refer to the XCP Server Protocol
XCP Running Example
Refer to the Supported Platforms to set up the environment.
The fuel tank demo showcases how internal system variables can be exposed through the XCP protocol for real-time measurement and calibration. In this scenario, two key aspects are demonstrated:
Measurement – Monitoring runtime data such as the actual fuel level and its percentage representation.
Calibration – Tuning sensor thresholds that determine how fuel levels are interpreted or processed by the system.
The following steps explain how to start/initialize the XCP server. Note: The screenshots shown below were taken on a Linux machine.
XCP Server Initialization
Launch the executable for the XCP server demo application and select the communication/transport type

Enter the IP address and port number for the XCP server. These values define the endpoint where the XCP client will connect

Once the configuration is complete, the XCP server enters a waiting state, listening for incoming client connection. After a successful connection is established, the demo use case begins execution.
XCP running Example
Use Case: Fuel Tank Simulation
In the XCP server application, a demo use case is defined to simulate a vehicle fuel tank system equipped with sensors and supports two operating modes:
Refill Mode
In this mode, the fuel level gradually increases over time, emulating a real-world refueling process. The demo continuously updates two key XCP measurement variables:
fuel_volume: The current fuel volume in liters.
fuel_level_percent: The fuel level as a percentage of total tank capacity.
These values are accessible via the XCP interface and can be monitored in real time by client.
Drive Mode
In Drive Mode, the fuel level gradually decreases over time to simulate vehicle fuel consumption during operation. The same two XCP measurement variables are dynamically updated:
fuel_volume: Decreases to reflect fuel usage.
fuel_level_percent: Decreases proportionally to indicate the remaining fuel capacity.
This mode helps verify how calibration thresholds and sensor behaviors react to falling fuel levels which impact the fuel percentage, and provides a controlled way to test XCP-based measurement and logging functionality.
After selecting the Refill Mode, the fuel value gradually increases. At the same time, sensor calibration parameters can be adjusted in real-time, immediately affecting the calculated fuel percentage displayed.
The following table details the memory-mapped variables extracted from the A2L/ELF files utilized by the XCP fuel meter module. Each entry specifies the register address, variable identifier, access rights, data type, valid operational range, and description for monitoring and calibration thresholds.
Note
The addresses listed below were obtained during compilation on a Linux-based build environment. These values are visible on the XCP client and are categorized as either Measurements or Calibrations based on their roles. Please note that the address values may vary depending on custom implementations, memory layout, or target-specific linker scripts.
Variable Address |
Variable Name |
R/W |
Data type |
Value/Range |
Functionality |
---|---|---|---|---|---|
0x40EAA0 |
fuel_volume |
R |
uint32 |
0 to 250 |
Indicates current fuel volume in litres |
0x40EAA4 |
fuel_percent |
R |
uint32 |
0 to 100 |
Indicates current fuel level as a percentage |
0x40E170 |
fuel_level_threshold_empty |
R/W |
uint32 |
0 to 250 |
Threshold below which fuel is considered empty |
0x40E174 |
fuel_level_threshold_low |
R/W |
uint32 |
0 to 250 |
Threshold for low fuel |
0x40E178 |
fuel_level_threshold_mid |
R/W |
uint32 |
0 to 250 |
Mid-level fuel threshold |
0x40E17C |
fuel_level_threshold_high |
R/W |
uint32 |
0 to 250 |
Indicates fuel level near full capacity |
0x40E180 |
fuel_level_threshold_full |
R/W |
uint32 |
0 to 250 |
Threshold approaching full tank |
0x40E184 |
fuel_level_threshold_max |
R/W |
uint32 |
0 to 250 |
Highest fuel level before overflow |
Note
When compiling on Linux, use the -no-pie linker flag to generate binaries with fixed memory addresses, This disables position-independent executable (PIE) generation, allowing variables to reside at absolute addresses as defined