| Type | How Injected | Detects | Tools |
|---|---|---|---|
| Pin-level (electrical) | Switch signal to GND/Vbat/open via relay matrix | Short-to-ground, open-circuit, short-to-supply on sensor/actuator lines | Pickering FIU; Inova FIU-810; custom relay board |
| Bus-level (communication) | Corrupt, delay, drop, or inject CAN/LIN/Ethernet frames | Communication faults: message loss, bit errors, timing violations | Vector CANoe fault injection; ETAS bus error injection |
| Model-level (software) | Override HIL plant model signal to inject fault value | Sensor drift, stuck-at, out-of-range, intermittent | HIL platform variable override (ControlDesk, VeriStand) |
| Software-level (ECU) | Compile-time fault injection in ECU code (test builds only) | Software-level fault (covered in unit testing, not HIL) | Polyspace, mutation testing tools |
Fault Injection Types for HIL
Pin-Level Fault Injection with Relay Matrix
#!/usr/bin/env python3
# Pin-level fault injection: switch sensor line to fault state
# Uses Pickering 40-297 relay matrix card (HIL fault injection)
class PinFaultInjector:
"""Controls relay matrix for pin-level fault injection"""
FAULT_NORMAL = 0 # normal connection: sensor to HIL DAC
FAULT_SHORT_GND= 1 # short to ground (0V)
FAULT_SHORT_BAT= 2 # short to battery (12V)
FAULT_OPEN = 3 # open circuit (disconnect)
def __init__(self, relay_card_addr):
self.addr = relay_card_addr
self.state = {} # channel -> fault state
def inject(self, channel, fault_type, duration_ms=None):
"""Inject fault on given channel (e.g., throttle sensor)"""
print(f" FI: channel={channel} fault={fault_type}")
# In real impl: send command to relay card via GPIB/USB
# self.relay_card.set_crosspoint(channel, fault_type)
self.state[channel] = fault_type
if duration_ms is not None:
import threading
t = threading.Timer(duration_ms / 1000.0,
self.clear, args=[channel])
t.start()
def clear(self, channel):
self.state[channel] = self.FAULT_NORMAL
# self.relay_card.set_crosspoint(channel, self.FAULT_NORMAL)
# Test: inject throttle sensor short-to-ground; verify ECU DTC
def test_throttle_short_to_gnd(fi, ecu_monitor):
import time
fi.inject("TPS_CHANNEL_1", PinFaultInjector.FAULT_SHORT_GND)
time.sleep(0.1) # wait for FHTI (100 ms)
dtcs = ecu_monitor.read_dtcs()
assert "P0122" in dtcs, f"Expected DTC P0122 (TPS low), got {dtcs}"
fi.clear("TPS_CHANNEL_1")
print(" PASS: DTC P0122 set within FHTI")Bus-Level Fault Injection with CANoe
// CANoe CAPL script: inject CAN bus faults during HIL test
// Run from CANoe environment; modifies bus traffic
variables {
message VehicleSpeed vspd; // message to corrupt
int fi_enabled = 0;
int fi_drop_count = 0;
}
// Message drop fault: suppress VehicleSpeed for 200ms
on message VehicleSpeed {
if (fi_enabled) {
// Do not call output() -- message is dropped
fi_drop_count++;
} else {
output(this); // pass through normally
}
}
// Bit-error injection: corrupt specific signal value
on message BrakeStatus {
if (fi_enabled == 2) {
this.BrakePresssure_kPa = 0xFFFF; // inject max value (out-of-range)
}
output(this);
}
// Test control: called from ECU-TEST or Python
on sysvar FaultInjection::VSpeedDropEnable {
fi_enabled = @this;
write("Fault injection: VehicleSpeed drop = %d", fi_enabled);
}Summary
Fault injection testing is the most important HIL test activity for safety-critical systems: it validates that every safety mechanism (sensor range check, CAN timeout, watchdog) actually detects its target fault within the specified FHTI and correctly triggers the safe state transition. ISO 26262 Part 5 requires DC (Diagnostic Coverage) claims to be validated by test evidence - fault injection on HIL provides this evidence at system level. The three fault injection types are complementary: pin-level for electrical faults (stuck-at, open), bus-level for communication faults (timeout, corruption), and model-level for sensor drift and gradual failure modes that cannot be achieved with a relay switch.
🔬 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.