Repository navigation
UDS over ISO TP
Classic CAN frames carry 8 bytes. A VIN, a DTC list and most UDS responses are longer, so ISO-TP (ISO 15765-2) splits them into a first frame and consecutive frames, with the receiver sending flow-control frames in between. Peykan uses can-isotp for the transport and udsoncan for the UDS (ISO 14229) client. The simulator includes an engine ECU that speaks both (simulator/uds_ecu.py).
11-bit normal addressing, as used for OBD and most UDS on passenger cars:
| ID | |
|---|---|
| Functional request (all ECUs) | 0x7DF |
| Engine request / response |
0x7E0 / 0x7E8
|
| Other ECUs (typical) |
0x7E1/0x7E9, 0x7E2/0x7EA, ... |
Tools and commands default to the engine; pass request_id / response_id (CLI: --request-id / --response-id) for others.
peykan vin{"status": "success", "vin": "1MCAN00S0SM000042", "check_digit_valid": true}Sent as OBD Mode 09 PID 02 to 0x7DF; the reply arrives as a multi-frame ISO-TP message from 0x7E8. check_digit_valid checks position 9 (North American VINs); it's null when the VIN isn't 17 valid characters. The simulated VIN is synthetic.
peykan uds-read 0xF190 0xF195 0xF40C| DID | Meaning | Simulator |
|---|---|---|
F187 |
Spare part number | MCPCAN-ECM-01 |
F18C |
ECU serial number | SIM0000042 |
F190 |
VIN | 1MCAN00S0SM000042 |
F195 |
Software version | the installed Peykan version |
F405 |
Coolant temperature (mirrors OBD PID 05) | live |
F40C |
Engine RPM (PID 0C) | live |
F40D |
Vehicle speed (PID 0D) | live |
F442 |
Control module voltage (PID 42) | live |
Unknown DIDs get negative response 0x31 requestOutOfRange, reported as status negative_response. On a real vehicle, which DIDs exist depends on the ECU; ASCII values are decoded automatically, others come back as raw hex.
peykan uds-dtcs{"status": "success", "dtcs": [
{"code": "P0300", "failure_type": 0, "uds_id": "0x030000", "status": "0x0B",
"status_bits": ["test_failed", "test_failed_this_operation_cycle", "confirmed"]}
]}Status bits follow ISO 14229. The ones that matter most:
-
test_failed: the fault is present now -
confirmed: the code is stored in memory
The simulated ECU keeps history like a real one. While a fault is active its code reads test_failed + confirmed. When the fault clears, the code stays confirmed until peykan uds-clear / uds_clear_dtcs (0x14). A fault that's still present is detected again immediately after clearing. The ECU records faults as they happen, even if nobody reads the codes while the fault is active.
| Service | Behaviour |
|---|---|
0x10 DiagnosticSessionControl |
Default (01) and extended (03) sessions; others → subFunctionNotSupported
|
0x11 ECUReset |
Hard (01) and soft (03) |
0x3E TesterPresent |
Including the suppress-response bit |
| anything else | serviceNotSupported |
Reading (VIN, 0x22, 0x19) needs PEYKAN_ALLOW_TRANSMIT on real hardware; clearing codes and resets also need PEYKAN_ALLOW_WRITE_SERVICES. Every frame goes through the transmit guard, including the flow-control and consecutive frames can-isotp sends on its own. See Real Hardware and Safety.
- 11-bit normal addressing only (no 29-bit or extended addressing yet).
- The VIN request listens for the engine's reply on
0x7E8; vehicles where another module answers need the UDS route with that module's IDs. - No SecurityAccess (0x27): reads that need an unlocked session will be refused by the ECU.
Getting started
Reference
Protocols
Features
Operating it
Contributing