Skip to content

Configure STM32 DoCAN addressing and UDS sessions#421

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

Configure STM32 DoCAN addressing and UDS sessions#421
nhuvaoanh123 wants to merge 10 commits into
eclipse-openbsw:mainfrom
nhuvaoanh123:stm32-pr-9

Conversation

@nhuvaoanh123

Copy link
Copy Markdown
Contributor

Purpose of this PR

  • Bugfix
  • New Feature
  • Documentation Update
  • Other

Description

Ninth PR in the STM32 platform series. Configures the DoCAN transport layer for standard UDS diagnostics over CAN bus.

Changes

  1. DoCanSystem.cpp: Update CAN addressing from S32K defaults (0x02A/0x0F0) to standard OBD-II UDS IDs (0x7E0 request / 0x7E8 response)
  2. appConfig.h: Set LOGICAL_ADDRESS to 0x0600 for STM32 diagnostics
  3. DiagSession.cpp: Add AppProgrammingSession — uses programming-session response byte (0x02) without triggering the bootloader shutdown sequence, keeping the UDS dispatcher alive for service-level programming operations

Cross-platform impact

The DiagSession change modifies shared code but only activates when PLATFORM_SUPPORT_UDS=ON. Existing S32K and POSIX builds are unaffected — they use different session configurations and don't register this session type.

Milestone

With PR 10 (UDS services), TesterPresent (0x3E) works end-to-end over CAN bus.

Depends on #420 (PR 8: F413ZH). PR 9 of 10.

Related Issues

Part of STM32 platform port — see #413 for series overview.

Breaking Changes

  • Yes
  • No — shared code change is additive and behind feature flag

Test Plan

  1. Build all presets (posix, S32K, STM32) — verify no regressions
  2. CAN bus test: send TesterPresent (0x3E 00) to 0x7E0, expect positive response on 0x7E8

Regression Tests

Have tests been added/updated? [ ] Yes [x] No — integration tests via CAN bus in PR 10

nhuvaoanh123 pushed a commit to nhuvaoanh123/openbsw that referenced this pull request Mar 30, 2026
Add full UDS (Unified Diagnostic Services) implementation for STM32:

Services:
- DiagnosticSessionControl (0x10) — default, extended, programming sessions
- SecurityAccess (0x27) — seed/key authentication
- TesterPresent (0x3E) — keep-alive
- ClearDiagnosticInformation (0x14) — DTC clearing
- ReadDtcInformation (0x19) — DTC status and snapshot reads
- ControlDtcSetting (0x85) — DTC recording on/off
- RoutineControl (0x31) — demo routine for HIL testing
- WriteDataByIdentifier (0x2E) — VIN write support
- DTC Manager — centralized fault code lifecycle

Architecture:
- All services compile conditionally (PLATFORM_SUPPORT_UDS=ON)
- UdsSystem task manages service registration and lifecycle
- Stm32-prefixed files are STM32-specific implementations
- Existing posix/S32K UDS services are unmodified

Qualification: 405 HIL tests passing across 5 test suites on NUCLEO-G474RE.
Test dashboard: https://nhuvaoanh123.github.io/openbsw/

Depends on eclipse-openbsw#421 (PR 9: DoCAN transport). PR 10 of 10.
nhuvaoanh123 pushed a commit to nhuvaoanh123/openbsw that referenced this pull request Mar 30, 2026
Add full UDS (Unified Diagnostic Services) implementation for STM32:

Services:
- DiagnosticSessionControl (0x10) — default, extended, programming sessions
- SecurityAccess (0x27) — seed/key authentication
- TesterPresent (0x3E) — keep-alive
- ClearDiagnosticInformation (0x14) — DTC clearing
- ReadDtcInformation (0x19) — DTC status and snapshot reads
- ControlDtcSetting (0x85) — DTC recording on/off
- RoutineControl (0x31) — demo routine for HIL testing
- WriteDataByIdentifier (0x2E) — VIN write support
- DTC Manager — centralized fault code lifecycle

Architecture:
- All services compile conditionally (PLATFORM_SUPPORT_UDS=ON)
- UdsSystem task manages service registration and lifecycle
- Stm32-prefixed files are STM32-specific implementations
- Existing posix/S32K UDS services are unmodified

Qualification: 405 HIL tests passing across 5 test suites on NUCLEO-G474RE.
Test dashboard: https://nhuvaoanh123.github.io/openbsw/

Depends on eclipse-openbsw#421 (PR 9: DoCAN transport). PR 10 of 10.
nhuvaoanh123 added a commit to nhuvaoanh123/openbsw that referenced this pull request Mar 30, 2026
Add full UDS (Unified Diagnostic Services) implementation for STM32:

Services:
- DiagnosticSessionControl (0x10) — default, extended, programming sessions
- SecurityAccess (0x27) — seed/key authentication
- TesterPresent (0x3E) — keep-alive
- ClearDiagnosticInformation (0x14) — DTC clearing
- ReadDtcInformation (0x19) — DTC status and snapshot reads
- ControlDtcSetting (0x85) — DTC recording on/off
- RoutineControl (0x31) — demo routine for HIL testing
- WriteDataByIdentifier (0x2E) — VIN write support
- DTC Manager — centralized fault code lifecycle

Architecture:
- All services compile conditionally (PLATFORM_SUPPORT_UDS=ON)
- UdsSystem task manages service registration and lifecycle
- Stm32-prefixed files are STM32-specific implementations
- Existing posix/S32K UDS services are unmodified

Qualification: 405 HIL tests passing across 5 test suites on NUCLEO-G474RE.
Test dashboard: https://nhuvaoanh123.github.io/openbsw/

Depends on eclipse-openbsw#421 (PR 9: DoCAN transport). PR 10 of 10.
nhuvaoanh123 added a commit to nhuvaoanh123/openbsw that referenced this pull request Mar 31, 2026
Add full UDS (Unified Diagnostic Services) implementation for STM32:

Services:
- DiagnosticSessionControl (0x10) — default, extended, programming sessions
- SecurityAccess (0x27) — seed/key authentication
- TesterPresent (0x3E) — keep-alive
- ClearDiagnosticInformation (0x14) — DTC clearing
- ReadDtcInformation (0x19) — DTC status and snapshot reads
- ControlDtcSetting (0x85) — DTC recording on/off
- RoutineControl (0x31) — demo routine for HIL testing
- WriteDataByIdentifier (0x2E) — VIN write support
- DTC Manager — centralized fault code lifecycle

Architecture:
- All services compile conditionally (PLATFORM_SUPPORT_UDS=ON)
- UdsSystem task manages service registration and lifecycle
- Stm32-prefixed files are STM32-specific implementations
- Existing posix/S32K UDS services are unmodified

Qualification: 405 HIL tests passing across 5 test suites on NUCLEO-G474RE.
Test dashboard: https://nhuvaoanh123.github.io/openbsw/

Depends on eclipse-openbsw#421 (PR 9: DoCAN transport). PR 10 of 10.
nhuvaoanh123 added a commit to nhuvaoanh123/openbsw that referenced this pull request Mar 31, 2026
Add full UDS (Unified Diagnostic Services) implementation for STM32:

Services:
- DiagnosticSessionControl (0x10) — default, extended, programming sessions
- SecurityAccess (0x27) — seed/key authentication
- TesterPresent (0x3E) — keep-alive
- ClearDiagnosticInformation (0x14) — DTC clearing
- ReadDtcInformation (0x19) — DTC status and snapshot reads
- ControlDtcSetting (0x85) — DTC recording on/off
- RoutineControl (0x31) — demo routine for HIL testing
- WriteDataByIdentifier (0x2E) — VIN write support
- DTC Manager — centralized fault code lifecycle

Architecture:
- All services compile conditionally (PLATFORM_SUPPORT_UDS=ON)
- UdsSystem task manages service registration and lifecycle
- Stm32-prefixed files are STM32-specific implementations
- Existing posix/S32K UDS services are unmodified

Qualification: 405 HIL tests passing across 5 test suites on NUCLEO-G474RE.
Test dashboard: https://nhuvaoanh123.github.io/openbsw/

Depends on eclipse-openbsw#421 (PR 9: DoCAN transport). PR 10 of 10.
@nhuvaoanh123 nhuvaoanh123 marked this pull request as draft May 1, 2026 19:17
@nhuvaoanh123 nhuvaoanh123 changed the title feat(stm32): DoCAN transport addressing and UDS session config Configure STM32 DoCAN addressing and UDS sessions Jun 2, 2026
@nhuvaoanh123 nhuvaoanh123 deleted the stm32-pr-9 branch June 2, 2026 07:48
@nhuvaoanh123 nhuvaoanh123 reopened this Jun 2, 2026
@nhuvaoanh123 nhuvaoanh123 force-pushed the stm32-pr-9 branch 4 times, most recently from 8ed160d to ef8a02e 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-9 branch 2 times, most recently from 0e1ba11 to 9a5b65f 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().
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