| Sub-func | Name | Returns |
|---|---|---|
| 0x01 | reportNumberOfDTCByStatusMask | Count of DTCs matching status mask (not DTC list) |
| 0x02 | reportDTCByStatusMask | DTC number + status byte for each matching DTC |
| 0x03 | reportDTCSnapshotIdentification | All stored snapshot record identifiers |
| 0x04 | reportDTCSnapshotRecordByDTCNumber | Snapshot (freeze frame) for specific DTC |
| 0x06 | reportDTCExtDataRecordByDTCNumber | Extended data record (occurrence counters, etc.) |
| 0x0A | reportSupportedDTC | All DTCs supported by this ECU (regardless of status) |
| 0x0B | reportFirstTestFailedDTC | First DTC that failed this monitoring cycle |
| 0x0D | reportMostRecentTestFailedDTC | Most recently failed DTC |
| 0x14 | reportDTCFaultDetectionCounter | Pending detection counters (before confirmation) |
| 0x17 | reportDTCWithPermanentStatus | DTCs that survived ClearDTC (permanent MIL DTCs) |
0x19 Sub-Function Reference
Sub-function 0x02: reportDTCByStatusMask
#!/usr/bin/env python3
# 0x19 0x02: Read all active DTCs with status mask
# Status mask meanings:
# 0x08 = confirmed DTC only (bit 3)
# 0x01 = currently failing (bit 0)
# 0xFF = any status bit set
# 0x09 = confirmed OR currently failing
import udsoncan
from udsoncan.client import Client
def read_active_dtcs(client):
# Read all confirmed DTCs (most common workshop scan)
resp = client.get_dtc_by_status_mask(0x08)
if resp.positive:
confirmed = [(dtc.id, dtc.status.byte) for dtc in resp.service_data.dtcs]
print(f"Confirmed DTCs ({len(confirmed)}):")
for dtc_id, status in confirmed:
print(f" P{dtc_id:04X} Status: 0b{status:08b}")
print(f" Confirmed: {bool(status & 0x08)} "
f"CurrentlyFailing: {bool(status & 0x01)} "
f"Pending: {bool(status & 0x04)}")
# Read pending DTCs (failing but not yet confirmed — development use)
resp = client.get_dtc_by_status_mask(0x04) # bit 2 = pending
if resp.positive:
print(f"Pending DTCs (not yet confirmed): {len(resp.service_data.dtcs)}")
# Count DTCs first (efficient: no DTC list transfer)
resp = client.get_number_of_dtc_by_status_mask(0x08)
if resp.positive:
print(f"Total confirmed DTCs (count only): {resp.service_data.dtc_count}")Sub-function 0x06: Extended Data Records
#!/usr/bin/env python3
# 0x19 0x06: Read extended data (occurrence counter, aging counter) for a DTC
import struct, udsoncan
from udsoncan.client import Client
def read_dtc_extended(client, dtc_id: int):
resp = client.get_dtc_extended_data_record_by_dtc_number(
dtc_id, extended_data_record_number=0xFF) # 0xFF = all records
if not resp.positive:
print(f"No extended data for P{dtc_id:04X}")
return
for record in resp.service_data.extended_data:
rnum = record.record_number
data = record.raw_data
if rnum == 0x01:
print(f" Occurrence counter: {data[0]} times")
elif rnum == 0x02:
print(f" Aging counter: {data[0]}/40 drive cycles")
elif rnum == 0x03:
odometer = struct.unpack(">I", data[:4])[0]
print(f" First occurrence: {odometer} km")
else:
print(f" Record 0x{rnum:02X}: {data.hex()}")Summary
Sub-function 0x02 with mask 0x08 (confirmed DTCs) is the standard workshop scan. Sub-function 0x04 with mask 0x04 (pending DTCs) is the most useful development diagnostic — it catches faults that are detected on every drive but haven't confirmed yet, revealing sensor faults that would otherwise be invisible until the 2nd failed cycle. Sub-function 0x0A (supported DTCs) is the ECU self-description: use it to verify DEM configuration completeness — every DTC in the specification should appear in this list.
🔬 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.