Examples
19 worked examples from the examples folder. Each opens on GitHub. The one-line descriptions come from the example READMEs and source.
Start here
Run these on your PC with a plain compiler. No hardware.
host_sim
A full UDS server simulator that exercises many services. The Python integration tests use it.
custom_service
Adds a manufacturer-specific service, or overrides a built-in one, through config.user_services without editing the library.
Platforms
Integration for real targets and RTOSes.
zephyr_uds_server
Zephyr application, built with west. The shipped config builds for native_sim.
freertos_demo
Two FreeRTOS tasks sharing one UDS context: one feeds CAN frames in, one runs the periodic tick.
f103_cubemx_uds_ecu
STM32F103C8 (Blue Pill) CubeMX / HAL ECU. ISO-TP over bxCAN, real HAL_FLASH erase and program, hardware CRC.
h5_uds_tester
Tester firmware on a second virtual H5 that requests all 27 services over a virtual FDCAN bus and checks each response. Runs headless with no CAN hardware.
DTC handling
Storing, reading, clearing and persisting diagnostic trouble codes.
dtc_store
The opt-in reference DTC store. It answers 0x19 (including snapshot and extended data) and 0x14, using an array you provide.
dtc_persist
Monitor, operation cycle, reset. Status, freeze frame and counters come back from a buffer that your own NVM driver stores. The library does not write flash.
dtc_clear
ClearDiagnosticInformation (0x14) through uds_dtc_bind: all groups versus one group, with conditionsNotCorrect and requestOutOfRange.
dtc_full_coverage
Every ReadDTCInformation (0x19) sub-function, split between library-framed and application-served.
Security
SecurityAccess and Authentication hooks. The library bundles no cipher.
auth_challenge
Authentication (0x29) challenge and response through fn_auth, with a placeholder tag and no crypto dependency.
auth_challenge_mbedtls
The same 0x29 flow with real AES-128-CMAC. Builds against mbedTLS or wolfSSL with identical output.
security_access_mbedtls
SecurityAccess (0x27) deriving the key from the seed with AES-128-CMAC. Two security levels, two secrets. mbedTLS or wolfSSL.
Reprogramming
Flash and OTA flows.
pro_flash_tool
A flash tool drives an ECU through the 17-step reprogramming sequence, in one process, and prints every request and response. Exits non-zero on failure, so it works as a CI smoke test.
h563_uds_bootloader
Dual-bank OTA bootloader for the STM32H563 with AES-128-CMAC on the 0x27 exchange, a host download tool over SocketCAN CAN-FD, and rollback of an image that never confirms.