| Stage | Activity | Tooling |
|---|---|---|
| Author | Write ODX for 3 services + 2 DTCs | XML editor or ODXStudio |
| Validate | Schema check + consistency check + ID-REF check | xmllint + Python scripts |
| Package | Create PDX with index.xml | Python create_pdx.py |
| Import | Load PDX into odxtools | odxtools Python library |
| Test | Encode requests; decode responses vs live/mock ECU | pytest + odxtools + MockEcu |
| Investigate | Use ODX to diagnose unexpected response bytes | odxtools decode + compu method trace |
Lab: End-to-End Diagnostic Workflow
Exercise 1: Author-to-Delivery Pipeline
#!/bin/bash
# Complete ODX author-to-delivery pipeline
set -e
ECU_NAME="ABS_ECU"
VERSION="v4.2.0"
ODX_DIR="odx_files"
OUTPUT_DIR="delivery"
echo "=== Step 1: XML well-formedness check ==="
for f in $ODX_DIR/*.odx; do
xmllint --noout "$f" && echo " OK: $f"
done
echo "=== Step 2: Schema validation ==="
for f in $ODX_DIR/*.odx; do
xmllint --noout --schema schemas/ISO22901_2.2.xsd "$f" \
&& echo " Schema OK: $f"
done
echo "=== Step 3: ID reference check ==="
python3 odx_manager.py validate-refs $ODX_DIR/
echo "=== Step 4: Consistency check ==="
python3 odx_consistency.py $ODX_DIR/*.odx
echo "=== Step 5: Package as PDX ==="
mkdir -p $OUTPUT_DIR
python3 create_pdx.py \
--output "$OUTPUT_DIR/${ECU_NAME}_${VERSION}.pdx" \
--odx-dir "$ODX_DIR" \
--version "$VERSION"
echo "=== Delivery ready: $OUTPUT_DIR/${ECU_NAME}_${VERSION}.pdx ==="Exercise 2: Test ODX Against Mock ECU
"""Test ODX descriptions against mock ECU responses."""
import pytest
import odxtools
@pytest.fixture(scope="session")
def odx_db():
return odxtools.Database("delivery/ABS_ECU_v4.2.0.pdx")
@pytest.fixture(scope="session")
def abs_ecu(odx_db):
return odx_db.ecus["ABS_ECU_EU_v4_2"]
def test_rdbi_vehiclespeed_encoding(abs_ecu):
"""Verify RDBI request encodes to correct bytes."""
service = abs_ecu.services["ReadDataByIdentifier_VehicleSpeed"]
req_bytes = service.encode_request()
assert req_bytes == bytes([0x22, 0xF4, 0x01]), \
f"Expected 22 F4 01, got {req_bytes.hex()}"
def test_rdbi_vehiclespeed_decoding(abs_ecu):
"""Verify response decodes to correct physical value."""
service = abs_ecu.services["ReadDataByIdentifier_VehicleSpeed"]
# Mock response: 0x62 0xF4 0x01 0x13 0x88 = 5000 raw = 50.0 km/h
response = bytes([0x62, 0xF4, 0x01, 0x13, 0x88])
decoded = service.decode_response(response)
assert abs(decoded["VehicleSpeed"] - 50.0) < 0.01, \
f"Expected 50.0 km/h, got {decoded['VehicleSpeed']}"
def test_dtc_p0500_has_freeze_frame(abs_ecu):
"""Verify DTC P0500 has freeze frame DOPs defined."""
dtc = abs_ecu.dtcs["DTC_P0500_SpeedSensorCircuit"]
assert len(dtc.freeze_frame_dops) >= 3, \
"DTC P0500 must have at least 3 freeze frame DOPs"Summary
The end-to-end lab demonstrates that ODX is not just documentation -- it is executable specification. The test that verifies RDBI request encoding (test_rdbi_vehiclespeed_encoding) is simultaneously a quality check on the ODX data and a regression test: if someone changes the DID from 0xF401 to 0xF402, this test fails immediately. The test that verifies response decoding (test_rdbi_vehiclespeed_decoding) tests the COMPU-METHOD: if the factor changes from 0.01 to 0.1, the decoded value will be 500.0 km/h instead of 50.0 km/h, and the test fails. Running these ODX integration tests in the CI/CD pipeline transforms the ODX from a static delivery artefact into a living, continuously validated specification that cannot diverge from the actual ECU behaviour without a test failure -- this is the highest level of diagnostic data quality achievable in an automated toolchain.
🔬 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
- 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'.
- 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.
- 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.
- 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.