Skip to content

Repository files navigation

🚗 CAN + UDS Automotive Diagnostics Stack

CI License Language Build Release

Deterministic CAN → ISO-TP → UDS diagnostic stack implemented in portable C11

A modular, host-testable automotive diagnostics stack modelling:

CAN transport → ISO-TP segmentation/reassembly → UDS diagnostics → ECU simulation

This release is simulation-first and test-driven. It demonstrates protocol-layer architecture, defensive validation, deterministic behaviour, ECU/tester interaction, integration testing, reproducible CMake builds, and host-side tooling.

Scope: This is a host-side engineering model. It does not claim physical CAN transceiver validation, OEM interoperability, formal ISO conformance certification, production automotive cybersecurity certification, or vehicle-level validation.


✨ Project at a Glance

Area Implementation
Language C11
Build CMake
Test CTest + deterministic C test executable
Transport CAN frame model + virtual CAN bus
Segmentation ISO-TP single/multi-frame + flow control
Diagnostics UDS session, services, DTC, security
Simulation Virtual CAN bus + ECU + tester
Tooling C and Python host utilities
CI GitHub Actions
Release v1.0.0
Verified direct tests 13/13 passed
License MIT

🧭 Architecture

                         Diagnostic Tester
                              / Client
                                 |
                                 v
                    +-------------------------+
                    |       UDS Layer         |
                    | Sessions | Services     |
                    | DTC      | Security     |
                    +-----------+-------------+
                                |
                                v
                    +-------------------------+
                    |      ISO-TP Layer       |
                    | SF | MF | Flow Control   |
                    +-----------+-------------+
                                |
                                v
                    +-------------------------+
                    |        CAN Layer        |
                    | Frame | Bus | Filtering  |
                    +-----------+-------------+
                                |
                                v
              +---------------------------------------+
              | Virtual CAN Bus / ECU Simulation      |
              | ECU Simulator + Tester Environment    |
              +---------------------------------------+

🎯 Engineering Goals

  • Clear CAN / ISO-TP / UDS layer boundaries.
  • Portable C11 implementation.
  • Deterministic host-side behaviour.
  • Defensive input validation.
  • Explicit error/result handling.
  • Reproducible CMake builds.
  • Automated CTest verification.
  • Unit and integration coverage.
  • Separate ECU simulation from protocol logic.
  • Small executable demonstrations.
  • Host tooling separated from the core library.
  • Documentation that states both capabilities and limitations.
  • CI validation on pushes and pull requests.

🚦 Implemented Scope

CAN

  • CAN frame representation and validation.
  • Standard identifier handling.
  • Payload length validation.
  • Virtual FIFO-style bus.
  • Identifier filtering.
  • Deterministic host-side transport simulation.

ISO-TP

  • Single-frame transmission.
  • Multi-frame transmission.
  • Flow-control handling.
  • Segmentation and reassembly.
  • Transport validation and error-path tests.

The ISO-TP implementation is an educational/host-testable model, not a certified ISO 15765-2 implementation.

UDS

  • Diagnostic session handling.
  • Diagnostic service processing.
  • DTC handling.
  • Deterministic security-access state handling.
  • Request/response processing.
  • Error/negative-path behaviour.

ECU / Simulation

  • Virtual CAN transport.
  • ECU simulation.
  • Tester interaction.
  • Deterministic request/response behaviour.
  • CAN/ISO-TP/UDS integration testing.

🧩 Repository Structure

Can-UDS-Automotive-Stack/
├── .github/
│   ├── workflows/
│   ├── ISSUE_TEMPLATE/
│   └── pull_request_template.md
├── cmake/
├── docs/
│   ├── architecture/
│   ├── design/
│   ├── protocol/
│   └── testing/
├── examples/
│   ├── can_demo/
│   ├── isotp_demo/
│   └── uds_demo/
├── include/
│   ├── can/
│   ├── common/
│   ├── ecu/
│   ├── isotp/
│   └── uds/
├── simulator/
│   ├── ecu/
│   ├── tester/
│   └── virtual_bus/
├── src/
│   ├── can/
│   ├── common/
│   ├── ecu/
│   ├── isotp/
│   └── uds/
├── tests/
│   ├── can/
│   ├── ecu/
│   ├── integration/
│   ├── isotp/
│   ├── test_vectors/
│   └── uds/
├── tools/
│   ├── log_analyzer/
│   ├── python/
│   └── uds_client/
├── screenshots/
├── CMakeLists.txt
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── PROJECT_INFO.md
├── SECURITY.md
└── VERSION

🔬 Core Components

Component Responsibility
CAN frame Representation and validation
CAN bus Virtual transport
CAN filter Identifier filtering
Common result/error Deterministic error model
ISO-TP Segmentation, reassembly, flow control
UDS Diagnostic request/response processing
UDS session Diagnostic session state
UDS DTC Diagnostic trouble-code handling
UDS security Deterministic test security behaviour
ECU ECU configuration/simulation state
Virtual bus Simulation transport environment
UDS tester Tester-side interaction
Log analyzer Host-side log utility
UDS client Small host client API

🧪 Verification

Clean Release build:

rm -rf build
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release

CTest:

ctest --test-dir build --output-on-failure

Verified:

100% tests passed, 0 tests failed out of 1

Direct deterministic test executable:

./build/can_uds_tests.exe

Verified:

[PASS] CAN frame
[PASS] CAN bus
[PASS] CAN filter
[PASS] ISO-TP SF
[PASS] ISO-TP MF
[PASS] ISO-TP FC
[PASS] ISO-TP errors
[PASS] UDS session
[PASS] UDS services
[PASS] UDS DTC
[PASS] UDS security
[PASS] ECU
[PASS] UDS/CAN integration
ALL TESTS PASSED (13/13)

CTest exposes the complete deterministic suite as one aggregate test target; the executable reports the individual 13 passing test groups.

▶️ Demonstrations

./build/can_demo.exe
./build/isotp_demo.exe
./build/uds_demo.exe

Verified outputs:

CAN demo: virtual bus ready (0 pending)
ISO-TP demo: 2 frames / rc=0
UDS demo: SID 0x62, length 7

🐍 Python Tooling

python -m py_compile     tools/python/can_log_analyzer.py     tools/python/trace_parser.py     tools/python/uds_test_runner.py

The verified Python utilities use the standard library only.

📸 Release Evidence

The release contains seven evidence images:

  • screenshots/01_build.png
  • screenshots/02_tests.png
  • screenshots/03_can_demo.png
  • screenshots/04_isotp_demo.png
  • screenshots/05_uds_demo.png
  • screenshots/06_uds_client.png
  • screenshots/07_log_analyzer.png

They document software execution only and are not physical-hardware validation.

📚 Documentation

  • docs/architecture/module_boundaries.md — module responsibilities.
  • docs/architecture/system_architecture.md — system architecture.
  • docs/design/error_handling.md — error/result behaviour.
  • docs/design/state_machines.md — state-machine behaviour.
  • docs/protocol/can.md — CAN model.
  • docs/protocol/isotp.md — ISO-TP model.
  • docs/protocol/uds.md — UDS model.
  • docs/testing/test_matrix.md — test matrix.
  • docs/testing/test_strategy.md — verification strategy.

⚙️ Build Requirements

  • CMake 3.16+
  • C11-capable compiler
  • Ninja or another CMake generator
  • Python 3
  • Git
  • CTest

Verified Windows environment: MinGW GCC 16.1.0 with Ninja.

🚀 Getting Started

git clone https://github.com/prasanth-vedula/Can-UDS-Automotive-Stack.git
cd Can-UDS-Automotive-Stack

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release
ctest --test-dir build --output-on-failure

🔐 Security and Scope Limitations

The security-access implementation is deliberately deterministic for testing. It is not a production authentication algorithm.

This repository is not:

  • an OEM security implementation;
  • a secure key-management system;
  • a vehicle cybersecurity solution;
  • evidence of ISO/SAE 21434 or UNECE R155/R156 compliance;
  • a production ECU authentication mechanism.

See SECURITY.md.

🚧 Known Scope Boundaries

The release does not claim:

  • physical CAN-controller/transceiver testing;
  • real vehicle-bus interoperability;
  • OEM-specific diagnostic interoperability;
  • production ECU timing validation;
  • formal ISO 15765-2 conformance;
  • formal ISO 14229 conformance;
  • automotive functional-safety certification;
  • production cybersecurity certification;
  • hardware-in-the-loop validation.

🗺️ Roadmap

v1.0.0 — Completed

  • CAN frame/bus/filtering model.
  • ISO-TP single/multi-frame and flow control.
  • UDS sessions, services, DTC and deterministic security model.
  • ECU and tester simulation.
  • CAN/ISO-TP/UDS integration testing.
  • CMake + CTest.
  • GitHub Actions CI.
  • C and Python tooling.
  • Architecture/protocol/testing documentation.
  • Seven release-evidence screenshots.
  • Repository governance and MIT licensing.

Future directions

  • Additional UDS services.
  • More complete ISO-TP timing/state handling.
  • Timeout modelling.
  • Expanded negative-response matrix.
  • Hardware CAN adapter abstraction.
  • Hardware-in-the-loop support.
  • Additional protocol vectors.
  • Coverage reporting.
  • Static analysis.
  • Sanitizer builds.
  • Cross-platform CI.

Future items are not represented as completed features.

📈 Engineering Characteristics

Determinism — repeatable host-side behaviour.

Modularity — independently understandable protocol layers.

Defensive design — malformed inputs and error paths are explicitly tested.

Traceability — documentation maps architecture to implementation areas.

Verification — CTest and direct executable results provide repeatable evidence.

Reproducibility — CMake provides a clean build path.

Transparency — simulation and compliance limitations are explicitly documented.

🤝 Contributing

Before submitting changes:

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release
ctest --test-dir build --output-on-failure

Update tests and documentation when behaviour changes. See CONTRIBUTING.md.

📜 License

MIT License. See LICENSE.

👤 Author

Vedula China Venkata Prasanth

B.Tech — Electronics and Communication Engineering
Lendi Institute of Engineering and Technology
Vizianagaram, Andhra Pradesh, India

Email: vprasanth302@gmail.com
GitHub: https://github.com/prasanth-vedula

⭐ Repository

https://github.com/prasanth-vedula/Can-UDS-Automotive-Stack

Release: v1.0.0
Status: Stable for the documented host-simulation scope.

About

Deterministic C11 CAN → ISO-TP → UDS automotive diagnostics stack with virtual ECU simulation, testing, and host tooling.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages