Skip to content

Add STM32 UDS diagnostic services#422

Draft
nhuvaoanh123 wants to merge 11 commits into
eclipse-openbsw:mainfrom
nhuvaoanh123:stm32-pr-10
Draft

Add STM32 UDS diagnostic services#422
nhuvaoanh123 wants to merge 11 commits into
eclipse-openbsw:mainfrom
nhuvaoanh123:stm32-pr-10

Conversation

@nhuvaoanh123

Copy link
Copy Markdown
Contributor

Purpose of this PR

  • Bugfix
  • New Feature
  • Documentation Update
  • Other

Description

Final PR in the 10-part STM32 platform series. Adds 9 UDS diagnostic services with full HIL test qualification.

UDS Services implemented

SID Service Description
0x10 DiagnosticSessionControl Default, extended, programming sessions
0x27 SecurityAccess Seed/key authentication
0x3E TesterPresent Keep-alive heartbeat
0x14 ClearDiagnosticInformation Clear stored DTCs
0x19 ReadDtcInformation DTC status, snapshots, stored DTCs
0x85 ControlDtcSetting Enable/disable DTC recording
0x31 RoutineControl Demo routine for validation
0x2E WriteDataByIdentifier VIN write support
DtcManager Centralized fault code lifecycle

Qualification

405 HIL tests passing across 5 test suites on NUCLEO-G474RE:

  • UDS service compliance tests
  • Reliability/stress tests
  • Regression suite
  • FMEA-based stress scenarios

📊 Test dashboard: https://nhuvaoanh123.github.io/openbsw/

Architecture

  • All services behind PLATFORM_SUPPORT_UDS=ON compile flag
  • UdsSystem task manages service registration and lifecycle
  • Stm32-prefixed files are STM32-specific — existing posix/S32K UDS untouched

Complete series

PR Title Status
#413 MCU foundation Open
#414 UART + BSP drivers Open
#415 bxCAN/FDCAN drivers Open
#416 FDCAN transceiver Open
#417 HardFault + safety Open
#418 FreeRTOS board config Open
#419 ThreadX support Open
#420 Second board (F413ZH) Open
#421 DoCAN transport Open
This UDS services Open

Depends on #421 (PR 9: DoCAN transport). PR 10 of 10.

Related Issues

Completes the STM32 platform port started in #408.

Breaking Changes

  • Yes
  • No — new source files, compile-flag gated

Test Plan

  1. Build: CC=arm-none-eabi-gcc CXX=arm-none-eabi-g++ cmake --preset nucleo-g474re-freertos-gcc && cmake --build --preset nucleo-g474re-freertos-gcc
  2. Flash to NUCLEO-G474RE
  3. Send UDS requests over CAN bus (0x7E0):
    • TesterPresent: 3E 00 → expect 7E 00
    • DiagnosticSessionControl: 10 01 → expect 50 01 ...
    • SecurityAccess seed: 27 01 → expect 67 01 <seed>
  4. Run full HIL suite (405 tests)

Regression Tests

Have tests been added/updated? [x] Yes — 405 HIL tests [ ] No

@nhuvaoanh123 nhuvaoanh123 force-pushed the stm32-pr-10 branch 4 times, most recently from 9aa85e7 to 8f823e2 Compare March 31, 2026 14:50
@nhuvaoanh123 nhuvaoanh123 marked this pull request as draft May 1, 2026 19:17
@nhuvaoanh123 nhuvaoanh123 changed the title feat(stm32): UDS diagnostic services — 9 services, 405 HIL tests Add STM32 UDS diagnostic services Jun 2, 2026
@nhuvaoanh123 nhuvaoanh123 deleted the stm32-pr-10 branch June 2, 2026 07:48
@nhuvaoanh123 nhuvaoanh123 reopened this Jun 2, 2026
@nhuvaoanh123 nhuvaoanh123 force-pushed the stm32-pr-10 branch 4 times, most recently from ad85e80 to cc0db82 Compare June 2, 2026 09:21
Import the STM32F4 and STM32G4 CMSIS device headers from
STMicroelectronics' dedicated RIM-tracked repositories. Keep only the
F413 and G474 headers needed by the STM32 MCU foundation and record
the unused upstream headers as RIM ignores.
Add the STM32 platform entry point, chip CMake files, bspMcu startup
code, a software reset wrapper, and the STM32 unit-test presets. The
platform reuses the shared CMSIS core from libs/3rdparty/cmsis
instead of carrying a local copy.
Add STM32 BSP modules for clock, UART, GPIO, timer, ADC, and EEPROM,
plus interrupt handling primitives and the ETL platform glue.
@nhuvaoanh123 nhuvaoanh123 force-pushed the stm32-pr-10 branch 2 times, most recently from daee3aa to b84cd89 Compare June 11, 2026 00:09
Add bxCAN and FDCAN device drivers with STM32 CAN tests.

Add the bxCAN transceiver adapter and unit-test registration.
Add the FDCAN transceiver implementation and STM32 test coverage.

Wire the FDCAN transceiver into the chip-family CMake selection.
Add the STM32 hard fault handler with RAM dump region and the IWDG
watchdog driver. Add the G474RE safety manager sources and watchdog
unit tests.
Add the NUCLEO-F413ZH reference application board: BSP configuration,
board main with FreeRTOS and ThreadX variants, bxCAN CAN system, and
the board presets.
Introduce two feature flags set by the STM32 board options:
PLATFORM_SUPPORT_OBD_UDS_ADDRESSING selects 0x7E0/0x7E8 tester CAN IDs
and logical address 0x0600, and PLATFORM_SUPPORT_PROGRAMMING_SESSION
adds an application-level programming session. The BSW
ProgrammingSession disables the UDS dispatcher on entry (bootloader
handover), so the application session keeps the dispatcher alive and
uses session index 0x02 to avoid matching PROGRAMMING_SESSION() in
switchSession().
Add demo UDS services for the STM32 boards behind the
PLATFORM_SUPPORT_UDS_DEMO_SERVICES board option: ECU reset, an
in-memory DTC store with read/clear/control services, security
access, VIN write, and demo routine control. The UDS dispatcher
accepts functional requests when the demo services are enabled.
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