Crate ecu_diagnostics
source · [−]Expand description
A crate which provides the most common ECU diagnostic protocols used by modern ECUs in vehicles, as well as common hardware APIs for accessing and using diagnostic adapters
ECU Diagnostic protocol support
This crate provides the 3 most widely used diagnostic protocols used by modern ECUs from 2000 onwards
On-board diagnostics (OBD2)
ISO9141 - OBD2 is a legal requirement on all vehicles produced from 2002, allowing for reading of sensor data, reading and clearing standard DTCs, and reading basic vehicle information. OBD2 is designed to be safe and simple, and does not write data to the ECU.
Keyword protocol 2000 (KWP2000)
ISO14230 - KWP2000 is a advanced diagnostic protocol utilized by many vehicle manufacturers from 2000-2006 (Superseded by UDS).
Unlike OBD2, KWP2000 allows for much more complex operations, which could potentially cause damage to a vehicle if used incorrectly.
A few examples of features allowed by KWP2000 are
- ECU flashing
- Clearing and reading of permanent DTCs
- Manipulation of ECU communication parameters
- Low level manipulation of ECU’s EEPROM or RAM
- Gateway access in vehicles which have them
The specification implemented in this crate is v2.2, dated 05-08-2002.
Unified diagnostic services (UDS)
ISO14429 - UDS is an advanced diagnostic protocol utilized by almost all vehicle manufacturers from 2006 onwards. Like KWP2000, this protocol allows for reading/writing directly to the ECU, and should therefore be used with caution.
The specification implemented in this crate is the second edition, dated 01-12-2006.
Hardware support (VCIs)
This crate provides support for the following VCI adapters and hardware protocols, as well as a convenient interface for making your own adapter API for customized hardware
SocketCAN (Linux only)
This crate provides support for socketCAN compatible adapters, for utilizing both ISO-TP and regular CAN communication
SAE J2534-2
SAE J2534 (AKA Passthru) is a VCI adapter protocol which allows a VCI to communicate with a vehicle using multiple various different network types, including CAN, ISO-TP, J1850, ISO9141 and SCI.
NOTE: Although the J2534 API is officially only for Windows, it will also compile for UNIX and OSX operating systems, due to the unofficial porting of the API in the Macchina-J2534 project
Modules
Module for logical communication channels with an ECU
Module for common Diagnostic trouble code data
Dynamic diagnostic session helper
The hardware module contains simplified API’s and abstraction layers for interacting with common hardware that can be used for either Bench setups or OBD2 adapters in order to communicate with vehicle ECUs
Module for KWP2000 (Keyword protocol 2000 - ISO142330)
Module for OBD (ISO-9141)
Module for UDS (Unified diagnostic services - ISO14229)
Enums
Diagnostic server error
Diagnostic server event
Traits
Basic diagnostic server payload
Basic diagnostic server settings
Base trait for diagnostic servers
Handler for when ServerEvent get broadcast by the diagnostic servers background thread
Functions
Converts a single byte into a BCD string
Converts a slice to a BCD string
Type Definitions
Diagnostic server result