Skip to main content

Universal Calibration Protocol for Python

Project description

pyxcp_social.svg

Reliable Python tooling for the ASAM MCD-1 XCP protocol (measurement, calibration, flashing) with multiple transports (CAN, Ethernet, USB, Serial) and handy CLI utilities.

PyPI Python Versions License: LGPL v3+ Code style: black

pyXCP is a production-ready Python library for communicating with XCP-enabled devices, most commonly automotive ECUs. Use it to take measurements, adjust parameters (calibration), stream DAQ/STIM, and program devices during development.

Highlights:

  • Transports: Ethernet (TCP/IP), CAN, USB, Serial (SxI)

  • Cross-platform: Windows, Linux, macOS

  • Rich CLI tools for common XCP tasks

  • Extensible architecture and layered design


Installation

The easiest way is from PyPI:

pip install pyxcp

To install from the main branch:

pip install git+https://github.com/christoph2/pyxcp.git

Requirements

  • Python >= 3.10

  • Building from source requires a working C/C++ toolchain (native extensions are used for performance). Wheels are provided for common platforms and Python versions; if a wheel is not available, pip will build from source.

  • An XCP slave device (or simulator)

Quick start

The tutorial walks you through typical tasks end-to-end: see tutorial.

Minimal example using the built-in argument parser and context manager:

from pyxcp.cmdline import ArgumentParser

ap = ArgumentParser(description="pyXCP hello world")

with ap.run() as x:
    x.connect()
    identifier = x.identifier(0x01)
    print(f"ID: {identifier!r}")
    print(x.slaveProperties)
    x.disconnect()

Configuration

pyXCP supports a traitlets-based configuration system.

  • Recommended Python config example and generator: tutorial and configuration

  • Legacy TOML examples remain available for compatibility.

Command‑line tools

Installed entry points (see pyproject.toml):

  • xcp-info — print capabilities and properties

  • xcp-id-scanner — scan for slave identifiers

  • xcp-fetch-a2l — retrieve A2L from target (if supported)

  • xcp-profile — generate/convert config files

  • xcp-examples — launch assorted demos/examples

  • xmraw-converter — convert recorder .xmraw data

  • pyxcp-probe-can-drivers — list available CAN interfaces

Run any tool with -h for options.

Features

  • Multiple transport layers: Ethernet (TCP), CAN, USB, SxI (serial/UART)

  • High-precision IEEE 1588/PTP hardware timestamping (Ethernet/UDP on Windows and Linux)

  • Data Acquisition (DAQ) and Stimulation (STIM)

  • Calibration (read/write parameters)

  • Flashing/programming workflows

  • A2L (ASAM MCD‑2 MC) support

  • Recorder utilities and converters (see recorder)

  • Extensible architecture for custom transports

Documentation

To build the Sphinx documentation locally:

  1. Install doc requirements:

    pip install -r docs/requirements.txt

  2. Build:

    sphinx-build -b html docs docs/_build/html

  3. Open

    docs/_build/html/index.html

Compatibility

  • Operating systems: Windows, Linux, macOS

  • Python: 3.10 - 3.14, CPython wheels where available

  • CAN backends: python-can compatible drivers (see howto_can_driver)

Contributing

Contributions are welcome! Please: - Read CODE_OF_CONDUCT - Open an issue or discussion before large changes - Use pre-commit to run linters and tests locally

License

GNU Lesser General Public License v3 or later (LGPLv3+). See LICENSE for details.

References

About ASAM MCD‑1 XCP

XCP (Universal Measurement and Calibration Protocol) is an ASAM standard defining a vendor‑neutral protocol to access internal data of electronic control units (ECUs) for measurement, calibration (parameter tuning), and programming. XCP decouples the protocol from the physical transport, so the same command set can be carried over different buses such as CAN, FlexRay, Ethernet, USB, or Serial.

  • Roles: An XCP Master (this library) communicates with an XCP Slave (your device/ECU or simulator).

  • Layered concept: XCP defines an application layer and transport layers. pyXCP implements the application layer and multiple transport bindings.

  • Use cases:

    • Measurement: Read variables from the ECU in real‑time, including high‑rate DAQ streaming.

    • Calibration: Read/write parameters (calibration data) in RAM/flash.

    • Programming: Download new program/data to flash (where the slave supports it).

For the authoritative description, see the ASAM page: https://www.asam.net/standards/detail/mcd-1-xcp/

XCP in a nutshell

  • Connect/Session: The master establishes a connection, negotiates capabilities/features, and optionally unlocks protected functions via seed & key.

  • Addressing: Memory is accessed via absolute or segment‑relative addresses. Addressing modes are described in the associated A2L file (ASAM MCD‑2 MC), which maps symbolic names to addresses, data types, and conversion rules.

  • Events: The slave exposes events (e.g., “1 ms task”, “Combustion cycle”), which trigger DAQ sampling. The master assigns signals (ODTs) to these events for time‑aligned acquisition.

  • DAQ/STIM: DAQ = Data Acquisition (slave → master), STIM = Stimulation (master → slave). Both use event‑driven lists for deterministic timing.

  • Timestamps: DAQ may carry timestamps from the slave for precise time correlation.

  • Security: Access to sensitive commands (e.g., programming, calibration) can be protected by a seed & key algorithm negotiated at runtime.

  • Checksums: XCP defines checksum services useful for verifying memory regions (e.g., after flashing).

Relation to A2L (ASAM MCD‑2 MC)

While XCP defines the protocol, the A2L file describes the measurement and calibration objects (characteristics, measurements), data types, conversion rules, and memory layout. In practice, you use pyXCP together with an A2L to: - Resolve symbolic names to addresses and data types. - Configure DAQ lists from human‑readable signal names. - Interpret raw values using the appropriate conversion methods.

pyXCP provides utilities to fetch A2L data when supported by the slave and to work with A2L‑described objects. See also pya2ldb!

Transports and addressing

XCP is transport‑agnostic. pyXCP supports multiple transports and addressing schemes: - CAN (XCP on CAN): Robust and ubiquitous in vehicles; limited payload and bandwidth; suited for many calibration tasks and moderate DAQ rates. - Ethernet (XCP on TCP/UDP): High bandwidth with low latency; well suited for rich DAQ and programming workflows. - USB: High throughput for lab setups; requires device support. - Serial/SxI: Simple point‑to‑point links for embedded targets and simulators.

The exact capabilities (e.g., max CTO/DTO, checksum types, timestamping) are negotiated at connect time and depend on the slave and transport.

Supported features (overview)

The scope of features depends on the connected slave. At the library level, pyXCP provides: - Session management: CONNECT/DISCONNECT, GET_STATUS/SLAVE_PROPERTIES, communication mode setup, error handling. - Memory access: Upload/short upload, Download/Download Next, verifications, optional paged memory where supported. - DAQ/STIM: Configuration of DAQ lists/ODTs, event assignment, data streaming, timestamp handling when available. - Programming helpers: Building blocks for program/erase/write flows (exact sequence per slave’s flash algorithm and A2L description). - Security/Seed & Key: Pluggable seed‑to‑key resolution including 32↔64‑bit bridge on Windows. - Utilities: Identifier scanning, A2L helpers, recorder and converters.

Refer to tutorial and configuration for feature usage, and xcp-info for a capability dump of your target.

Compliance and versions

pyXCP aims to be compatible with commonly used parts of ASAM MCD‑1 XCP. Specific optional features are enabled when a slave advertises them during CONNECT. Because implementations vary across vendors and ECU projects, always consult your A2L and use xcp-info to confirm negotiated options (e.g., checksum type, timestamp unit, max DTO size, address granularity).

If you rely on a particular XCP feature/profile not mentioned here, please open an issue with details about your slave and A2L so we can clarify support and—if feasible—add coverage.

Safety, performance, and limitations

  • Safety‑critical systems: XCP is a development and testing protocol. Do not enable measurement/calibration on safety‑critical systems in the field unless your system‑level safety case covers it.

  • Performance: Achievable DAQ rates depend on transport bandwidth, ECU event rates, DTO sizes, and host processing. Ethernet typically yields the highest throughput.

  • Latency/jitter: Event scheduling in the slave and OS scheduling on the host can affect determinism. Use timestamps to correlate data precisely.

  • Access control: Seed & key protects sensitive functions; your organization’s policy should govern algorithm distribution and access.

Further resources

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyxcp-0.26.1.tar.gz (266.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyxcp-0.26.1-cp314-cp314-win_arm64.whl (3.3 MB view details)

Uploaded CPython 3.14Windows ARM64

pyxcp-0.26.1-cp314-cp314-win_amd64.whl (3.4 MB view details)

Uploaded CPython 3.14Windows x86-64

pyxcp-0.26.1-cp313-cp313-win_arm64.whl (2.6 MB view details)

Uploaded CPython 3.13Windows ARM64

pyxcp-0.26.1-cp313-cp313-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.13Windows x86-64

pyxcp-0.26.1-cp312-cp312-win_arm64.whl (2.1 MB view details)

Uploaded CPython 3.12Windows ARM64

pyxcp-0.26.1-cp312-cp312-win_amd64.whl (2.1 MB view details)

Uploaded CPython 3.12Windows x86-64

pyxcp-0.26.1-cp311-cp311-win_arm64.whl (1.5 MB view details)

Uploaded CPython 3.11Windows ARM64

pyxcp-0.26.1-cp311-cp311-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.11Windows x86-64

pyxcp-0.26.1-cp310-cp310-win_arm64.whl (896.3 kB view details)

Uploaded CPython 3.10Windows ARM64

pyxcp-0.26.1-cp310-cp310-win_amd64.whl (896.7 kB view details)

Uploaded CPython 3.10Windows x86-64

pyxcp-0.26.1-cp310-cp310-macosx_11_0_arm64.whl (1.0 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file pyxcp-0.26.1.tar.gz.

File metadata

  • Download URL: pyxcp-0.26.1.tar.gz
  • Upload date:
  • Size: 266.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyxcp-0.26.1.tar.gz
Algorithm Hash digest
SHA256 b97b766a7e519d2b1ebbf66010df64e2076078e3711d456350974643cc90c2a3
MD5 edf44c617fd8b7049981f238e41e09a5
BLAKE2b-256 6b91c55d13e550120c660e58846dfd6de444cb15467507f8df974d8399959b85

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyxcp-0.26.1.tar.gz:

Publisher: pythonapp.yml on christoph2/pyxcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyxcp-0.26.1-cp314-cp314-win_arm64.whl.

File metadata

  • Download URL: pyxcp-0.26.1-cp314-cp314-win_arm64.whl
  • Upload date:
  • Size: 3.3 MB
  • Tags: CPython 3.14, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyxcp-0.26.1-cp314-cp314-win_arm64.whl
Algorithm Hash digest
SHA256 a89bdaefa354fef8114aaf74ea55fa79757e38428e53aa95bbf98a7022e4909e
MD5 f29a186b8ba7bc989b032d623112a401
BLAKE2b-256 2e4a09a47d0399dba90c72be479335ee1246be4c71ec17c9355ffc316f0f92ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyxcp-0.26.1-cp314-cp314-win_arm64.whl:

Publisher: pythonapp.yml on christoph2/pyxcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyxcp-0.26.1-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: pyxcp-0.26.1-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 3.4 MB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyxcp-0.26.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 3551a5c0a412885117063b42265bc0aee1f4853719acaf7f81af882c8e687dac
MD5 7135a07138d88a7b46370565a578c556
BLAKE2b-256 abd330a8fa2a0dc373c9d7a6d2723e3b14a38b8b297119f0c91f0da95ca6f373

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyxcp-0.26.1-cp314-cp314-win_amd64.whl:

Publisher: pythonapp.yml on christoph2/pyxcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyxcp-0.26.1-cp313-cp313-win_arm64.whl.

File metadata

  • Download URL: pyxcp-0.26.1-cp313-cp313-win_arm64.whl
  • Upload date:
  • Size: 2.6 MB
  • Tags: CPython 3.13, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyxcp-0.26.1-cp313-cp313-win_arm64.whl
Algorithm Hash digest
SHA256 636f9f71fe4ec26adfbb208b73b3bd3d87ab02b2a69c513f1f13960b55233812
MD5 0c8afd62f5e69e9877f99c3447d419f6
BLAKE2b-256 dc0d3a6acbad121dae15dc949c74a5eeb0acca81ffdd1be72d6469f647607942

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyxcp-0.26.1-cp313-cp313-win_arm64.whl:

Publisher: pythonapp.yml on christoph2/pyxcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyxcp-0.26.1-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pyxcp-0.26.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyxcp-0.26.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 d1e2655a9ed8411f56649cf75b02bf3de7acbe3997de2872211702c8389eb6ab
MD5 ef09b1d2f377fd0ff621a721212e9abe
BLAKE2b-256 e2d15ed7a3f781872b1b81abc837cb62e4a451cad090a566f015b8b925d6f8e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyxcp-0.26.1-cp313-cp313-win_amd64.whl:

Publisher: pythonapp.yml on christoph2/pyxcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyxcp-0.26.1-cp312-cp312-win_arm64.whl.

File metadata

  • Download URL: pyxcp-0.26.1-cp312-cp312-win_arm64.whl
  • Upload date:
  • Size: 2.1 MB
  • Tags: CPython 3.12, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyxcp-0.26.1-cp312-cp312-win_arm64.whl
Algorithm Hash digest
SHA256 befb3db632575cf2e17e362995af15dc3f8f064b55bfb39b8fa9fc7cf2f99d07
MD5 4532223c36bb11063f38e045b3942a78
BLAKE2b-256 84055761b0cce8e4db59934fff85165e60f2d2496bcd6d699f49bc23a4eba549

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyxcp-0.26.1-cp312-cp312-win_arm64.whl:

Publisher: pythonapp.yml on christoph2/pyxcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyxcp-0.26.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pyxcp-0.26.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 2.1 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyxcp-0.26.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 91c3f23821510457f6e7dec4c1fc45b876b7bb04d559311f6f6972130d0e38d2
MD5 9d0292eddd06ac610c9c76bd8fac349d
BLAKE2b-256 a33126d9ebbd14a0ac0b0d12748974f342e2883c580e2b2bfd6ec25b45ca1d54

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyxcp-0.26.1-cp312-cp312-win_amd64.whl:

Publisher: pythonapp.yml on christoph2/pyxcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyxcp-0.26.1-cp311-cp311-win_arm64.whl.

File metadata

  • Download URL: pyxcp-0.26.1-cp311-cp311-win_arm64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.11, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyxcp-0.26.1-cp311-cp311-win_arm64.whl
Algorithm Hash digest
SHA256 c70e6d53ec18d839445cb8ca8853bbebb5de532a4977a38af5ec313dfd2ec798
MD5 42026ca668fe7f002e5337ee8f83bebd
BLAKE2b-256 373f719f65026eec62b2845bba60beea179d7cddffee2e2a50c8b93d3d3d3612

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyxcp-0.26.1-cp311-cp311-win_arm64.whl:

Publisher: pythonapp.yml on christoph2/pyxcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyxcp-0.26.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pyxcp-0.26.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyxcp-0.26.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d6e9343d8ad43a6dc2105d8e098914b3c8c548eeb587bbf0df95a81c787e9af4
MD5 857152fd27f7a9c0aef0e80619c29af0
BLAKE2b-256 d7ed995755f8edd82991faee10906e2723debb145dd92b30165bc3bb3c61bc2b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyxcp-0.26.1-cp311-cp311-win_amd64.whl:

Publisher: pythonapp.yml on christoph2/pyxcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyxcp-0.26.1-cp310-cp310-win_arm64.whl.

File metadata

  • Download URL: pyxcp-0.26.1-cp310-cp310-win_arm64.whl
  • Upload date:
  • Size: 896.3 kB
  • Tags: CPython 3.10, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyxcp-0.26.1-cp310-cp310-win_arm64.whl
Algorithm Hash digest
SHA256 715da5582acca259abf98f5b8bb39bc54c01e21ebecf8ec0d5af7a9d71539c33
MD5 fefa009b955650d33c933540139cf145
BLAKE2b-256 3d0b6e8558afc56a6ac5cedac329921e1fdc8942036dc98fec8fe70df7ee7f0e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyxcp-0.26.1-cp310-cp310-win_arm64.whl:

Publisher: pythonapp.yml on christoph2/pyxcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyxcp-0.26.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pyxcp-0.26.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 896.7 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyxcp-0.26.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f0dd261b94c2f5f07f701df1ecef0caabcb7e227199a1a7e4d99c83613bf2c0c
MD5 aa3468e4fba351b8a0f0440023f0116e
BLAKE2b-256 cc96bb3723c691b947e5876cb85df0497c9ff7a819f3464cab2ede13f4dc5faa

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyxcp-0.26.1-cp310-cp310-win_amd64.whl:

Publisher: pythonapp.yml on christoph2/pyxcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyxcp-0.26.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyxcp-0.26.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f037b567b7e5f76015b7f0de1e5ee47d77583862ac1332cd6b82f95ac2a455d1
MD5 52e7c161bf038204e14895b19a00ec17
BLAKE2b-256 5f7555b1e3da4cf0649ee63abe81f192fc9ee200b4f0eb1a89cd7265627c37b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyxcp-0.26.1-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: pythonapp.yml on christoph2/pyxcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page