Home Learning Paths ECU Lab Assessments Interview Preparation Arena Pricing Log In Sign Up

XCP Slave Stack Configuration (PEAK XCON / Vector XL)

Cxcpbasic_config.h
/* XcpBasic configuration header — typical development ECU settings */

/* Transport: XCP on CAN */
#define XCP_TRANSPORT_CAN
#define XCP_CAN_CHANNEL         0         /* CAN controller 0 */
#define XCP_CAN_MASTER_ID       0x600UL   /* CRO ID (tool → ECU) */
#define XCP_CAN_SLAVE_ID        0x601UL   /* DTO ID (ECU → tool) */
#define XCP_CAN_BAUDRATE        500000UL

/* Protocol configuration */
#define XCP_MAX_CTO             8         /* command object size: 8 bytes (CAN) */
#define XCP_MAX_DTO             8         /* data transfer object size: 8 bytes */
#define XCP_SEED_KEY_ENABLED    0         /* disable seed/key for development */
#define XCP_PAGE_PROCESSOR      1         /* enable page switching support */

/* Calibration memory: working page in RAM, reference in Flash */
#define XCP_WORKING_PAGE_ADDR   0x20001000UL
#define XCP_WORKING_PAGE_SIZE   0x8000UL  /* 32 KB calibration RAM */
#define XCP_REFERENCE_PAGE_ADDR 0x00010000UL
#define XCP_REFERENCE_PAGE_SIZE 0x8000UL  /* 32 KB calibration Flash */

/* DAQ configuration */
#define XCP_MAX_DAQ_LISTS       16
#define XCP_MAX_ODT_PER_DAQ     8
#define XCP_MAX_ODT_ENTRIES     256

CANape Project Setup

CANape Setup StepMenu Path / ActionVerification
New deviceConfiguration → New Device → XCP on CANDevice appears in device tree
Import A2LDevice → right-click → Load A2L DescriptionAll CHARACTERISTICs and MEASUREMENTs visible in symbol browser
Configure CAN channelDevice → XCP settings → Channel → bit-rate 500 kbps, ID 0x600/0x601Channel shows green when hardware connected
ConnectDevice → Connect (or toolbar button)XCP console shows CONNECT response 0xFF
Check GET_STATUSXCP console → GET_STATUSResponse: DAQ_PROCESSOR_RUNNING=0, CAL_PAGE_MODE as configured

DAQ Session Verification

Pythoncanape_daq_verify.py
# CANape COM API: verify DAQ session produces data at correct rate
import canape_com as canape
import time

app = canape.OpenApplication("ECU_Engine.cfg")
device = app.GetDevice("ECU_Engine")
device.Open()

# Create measurement task with 3 signals at 10ms
meas = device.CreateMeasurementList()
meas.AddSignal("engine_rpm",    event="event_10ms")
meas.AddSignal("coolant_temp",  event="event_100ms")
meas.AddSignal("lambda_actual", event="event_10ms")

# Start and record 5 seconds
app.StartMeasurement()
time.sleep(5.0)
app.StopMeasurement()

# Verify sample rates from MF4 file
recording = canape.LoadRecording("last_recording.mf4")
for sig in ["engine_rpm", "lambda_actual"]:
    samples = recording.GetSignal(sig)
    rate_hz = len(samples) / 5.0
    assert 90 <= rate_hz <= 110, f"{sig}: expected ~100 Hz, got {rate_hz:.1f} Hz"
    print(f"{sig}: {rate_hz:.0f} Hz — OK")

Common Pitfalls and Diagnostics

SymptomRoot CauseDiagnosticFix
CONNECT returns 0xFE 0x29 (ACCESS_LOCKED)Seed/key security enabled on ECUCheck XCP monitor: response code 0x29Load seed/key DLL matching ECU's key algorithm (File → Access → Seed/Key Plugin)
No CONNECT response at allSwapped CAN IDs (CRO/DTO reversed)Physical CAN bus analyser shows tool frame on wrong IDSwap CAN_ID_MASTER and CAN_ID_SLAVE in CANape device config
Values read as garbage / wrong scaleBYTE_ORDER mismatch in A2L (INTEL vs MOTOROLA)UPLOAD one known scalar, compare raw bytes to expected valueChange MOD_COMMON BYTE_ORDER or per-CHARACTERISTIC BYTE_ORDER
Write has no effect (ECU ignores DOWNLOAD)ECU_ADDRESS in A2L pointing to wrong section (Flash instead of RAM)Check A2L address against linker MAP fileUpdate ECU_ADDRESS to correct RAM address; check address_extension = 0x01 for RAM
DAQ values all zeroWorking page not active (ECU reading reference which has zeros)Check SET_CAL_PAGE: is working page active?SET_CAL_PAGE to working page for ECU side

Summary

XCP communication setup requires four verified steps: slave stack compiled with correct CAN IDs and page config, CANape device configured with matching IDs and A2L, CONNECT response 0xFF confirmed in the XCP monitor, and DAQ session producing samples at the expected rate. The five common pitfalls — seed/key lock, swapped IDs, byte-order mismatch, wrong ECU_ADDRESS, and inactive working page — account for 95% of first-connection failures.

🔬 Deep Dive — Core Concepts Expanded

This section builds on the foundational concepts covered above with additional technical depth, edge cases, and configuration nuances that separate competent engineers from experts. When working on production ECU projects, the details covered here are the ones most commonly responsible for integration delays and late-phase defects.

Key principles to reinforce:

  • Configuration over coding: In AUTOSAR and automotive middleware environments, correctness is largely determined by ARXML configuration, not application code. A correctly implemented algorithm can produce wrong results due to a single misconfigured parameter.
  • Traceability as a first-class concern: Every configuration decision should be traceable to a requirement, safety goal, or architecture decision. Undocumented configuration choices are a common source of regression defects when ECUs are updated.
  • Cross-module dependencies: In tightly integrated automotive software stacks, changing one module's configuration often requires corresponding updates in dependent modules. Always perform a dependency impact analysis before submitting configuration changes.

🏭 How This Topic Appears in Production Projects

  • Project integration phase: The concepts covered in this lesson are most commonly encountered during ECU integration testing — when multiple software components from different teams are combined for the first time. Issues that were invisible in unit tests frequently surface at this stage.
  • Supplier/OEM interface: This is a topic that frequently appears in technical discussions between Tier-1 ECU suppliers and OEM system integrators. Engineers who can speak fluently about these details earn credibility and are often brought into critical design review meetings.
  • Automotive tool ecosystem: Vector CANoe/CANalyzer, dSPACE tools, and ETAS INCA are the standard tools used to validate and measure the correct behaviour of the systems described in this lesson. Familiarity with these tools alongside the conceptual knowledge dramatically accelerates debugging in real projects.

⚠️ Common Mistakes and How to Avoid Them

  1. Assuming default configuration is correct: Automotive software tools ship with default configurations that are designed to compile and link, not to meet project-specific requirements. Every configuration parameter needs to be consciously set. 'It compiled' is not the same as 'it is correctly configured'.
  2. Skipping documentation of configuration rationale: In a 3-year ECU project with team turnover, undocumented configuration choices become tribal knowledge that disappears when engineers leave. Document why a parameter is set to a specific value, not just what it is set to.
  3. Testing only the happy path: Automotive ECUs must behave correctly under fault conditions, voltage variations, and communication errors. Always test the error handling paths as rigorously as the nominal operation. Many production escapes originate in untested error branches.
  4. Version mismatches between teams: In a multi-team project, the BSW team, SWC team, and system integration team may use different versions of the same ARXML file. Version management of all ARXML files in a shared repository is mandatory, not optional.

📊 Industry Note

Engineers who master both the theoretical concepts and the practical toolchain skills covered in this course are among the most sought-after professionals in the automotive software industry. The combination of AUTOSAR standards knowledge, safety engineering understanding, and hands-on configuration experience commands premium salaries at OEMs and Tier-1 suppliers globally.

← PreviousPage Switching & Calibration ConceptsNext →A2L File Structure & Syntax