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.

View on GitHub

client_demo

Drives a server from the UDS client API.

View on GitHub

bare_metal

Bare-metal super-loop integration skeleton.

View on GitHub

custom_service

Adds a manufacturer-specific service, or overrides a built-in one, through config.user_services without editing the library.

View on GitHub

Platforms

Integration for real targets and RTOSes.

zephyr_uds_server

Zephyr application, built with west. The shipped config builds for native_sim.

View on GitHub

freertos_demo

Two FreeRTOS tasks sharing one UDS context: one feeds CAN frames in, one runs the periodic tick.

View on GitHub

f103_cubemx_uds_ecu

STM32F103C8 (Blue Pill) CubeMX / HAL ECU. ISO-TP over bxCAN, real HAL_FLASH erase and program, hardware CRC.

View on GitHub

h5_uds_ecu_full

ECU firmware for a virtual STM32H5 that serves all 27 services.

View on GitHub

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.

View on GitHub

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.

View on GitHub

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.

View on GitHub

dtc_clear

ClearDiagnosticInformation (0x14) through uds_dtc_bind: all groups versus one group, with conditionsNotCorrect and requestOutOfRange.

View on GitHub

dtc_full_coverage

Every ReadDTCInformation (0x19) sub-function, split between library-framed and application-served.

View on GitHub

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.

View on GitHub

auth_challenge_mbedtls

The same 0x29 flow with real AES-128-CMAC. Builds against mbedTLS or wolfSSL with identical output.

View on GitHub

security_access_mbedtls

SecurityAccess (0x27) deriving the key from the seed with AES-128-CMAC. Two security levels, two secrets. mbedTLS or wolfSSL.

View on GitHub

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.

View on GitHub

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.

View on GitHub

Testing

generated_tests

Python tests for the main services, generated from a service spec.

View on GitHub