Skip to content

f103-uds-ecu: full typical-session UDS coverage#343

Merged
w1ne merged 7 commits into
mainfrom
feat/f103-uds-full-coverage
Jun 23, 2026
Merged

f103-uds-ecu: full typical-session UDS coverage#343
w1ne merged 7 commits into
mainfrom
feat/f103-uds-full-coverage

Conversation

@w1ne

@w1ne w1ne commented Jun 23, 2026

Copy link
Copy Markdown
Owner

What

Makes the f103-uds-ecu example answer the full everyday UDS diagnostic session and proves it end-to-end. A coverage audit found that most typical services were compiled into the firmware but had no registered handler and no runnable scenario — only SecurityAccess (0x27), ECUReset (0x11), and a single h563 DID read actually ran on the bus. This closes that gap for f103.

Scope (f103-uds-ecu)

  • 0x22 / 0x2E ReadDataByIdentifier / WriteDataByIdentifier — DID table: VIN 0xF190 (read-only), scratch 0x0123 (read/write, extended-session gated), IO point 0xA001.
  • 0x14 / 0x19 ClearDTC / ReadDTCInformation — seeded uds_dtc_store (DTC 0x123456).
  • 0x31 RoutineControl — routine 0x0203 (extended-session gated).
  • 0x2F InputOutputControl, 0x28 CommunicationControl.
  • 0x10 / 0x3E DiagnosticSessionControl / TesterPresent — built into udslib; proven by the scenario.

How it's proven

  • Combined scenario (uds-session.yaml + uds-session-smoke.yaml): a 12-step scripted tester walks the session — RDBI VIN → write rejected in default session (7F 2E 31) → 10 03 → TesterPresent → write accepted → read-back → DTC count → clear → routine → IO control → comm control → ECUReset. Smoke verified: exit 0, uds_tester done, ECU_READY banner twice (real AIRCR reboot). Negative control (corrupted expect) fails on step 0. Like the existing reset smoke, this drives a locally-built ELF and is not a clean-checkout CI gate.
  • Always-on Rust regression (crates/core/src/bus/mod.rs): six CanUdsTester FSM tests covering SF DID-write, routine-with-output, IO-control, multi-frame DTC reassembly, expect_nrc, and FlowControl delivery on a multi-frame ECU response. These run in core-integrity.

Production fix surfaced during integration

The 17-byte VIN response is multi-frame, which exposed a real bug: service_can_uds_testers had no AwaitMultiResp arm in its to_send match, so the FlowControl computed for a multi-frame ECU response was silently dropped and the exchange deadlocked. Fixed with a one-arm addition, guarded by a regression test that asserts the FC frame actually reaches the bxCAN (confirmed RED without the fix).

Follows up the scriptable-tester + real-reset work in #338.

w1ne added 7 commits June 23, 2026 02:08
Signed-off-by: w1ne <14119286+w1ne@users.noreply.github.com>
Signed-off-by: w1ne <14119286+w1ne@users.noreply.github.com>
…ter shapes

Signed-off-by: w1ne <14119286+w1ne@users.noreply.github.com>
Signed-off-by: w1ne <14119286+w1ne@users.noreply.github.com>
Add uds-session.yaml (system: scripted 12-step tester) and
uds-session-smoke.yaml (scenario: uart_contains + uds_tester done)
for the full everyday UDS session: RDBI VIN, session-gated DID write,
TesterPresent, DTC read/clear, routine, IO control, comm control, and
ECUReset. Smoke passes (exit 0, two ECU_READY banners).

Also fix service_can_uds_testers: the AwaitMultiResp state was missing
from the to_send match, so the FlowControl computed by
observe_ecu_frame_script was silently dropped when the ECU responded with
a multi-frame ISO-TP FirstFrame. Adding the AwaitMultiResp arm forwards
pending_inject (the FC) so the ECU can continue with its CFs.

Signed-off-by: w1ne <14119286+w1ne@users.noreply.github.com>
…response

Guards the AwaitMultiResp arm fix in service_can_uds_testers: verifies
that a FlowControl frame (0x30 nibble) is actually delivered onto the
bxCAN bus after the ECU sends a FirstFrame, so the ECU can proceed with
its ConsecutiveFrames.  Without the fix the FC was silently swallowed by
the _ => None arm and the bxCAN rx trace shows no new frames.

Signed-off-by: w1ne <14119286+w1ne@users.noreply.github.com>
…verage

Signed-off-by: w1ne <14119286+w1ne@users.noreply.github.com>
@w1ne w1ne merged commit 629bbcf into main Jun 23, 2026
13 checks passed
@w1ne w1ne deleted the feat/f103-uds-full-coverage branch June 23, 2026 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant