UDS Stack for Carloop

Unless I’m missing it, I haven’t seen anyone implement a proper UDS stack. The examples each manually construct a UDS packet, which works well for doing specific commands - but does not scale if you’re trying to use a diagnostic library.

I found the openxc UDS stack here (GitHub - openxc/uds-c: Unified Diagnostics Service (UDS) and OBD-II (On Board Diagnostics for Vehicles) C Library) and have integrated it into a local project. However, when I attempt to read a PID such as reading VIN, I’m not getting the proper message on the bus. The UDS stack is returning UDS Tx(0x7DF): 0x0201090000000000, whereas the proper command should be UDS Tx(0x7DF): 0x0209020000000000. Has anyone else tried this and had any success?

Thanks!

Hi @carl1116,

(0x7DF): 0x0209020000000000 is standard command from SAE J1979 to read VIN number. SAE J1979’s standard PIDs are implemented in Engine management System (ECU) of every vehicle.
refer following link for information on open parameter identifiers (PIDs) OBD-II PIDs - Wikipedia

Unified diagnostics Services (UDS) is protocol which is implemented over CAN in car by OEM to diagnose ECU.
In UDS there are services with fix ID and sub-function ID is maintained and implemented by OEMs.

To read VIN one have to use 0x22 Service of UDS which is Read by Identifier but one must know address of ECU and the sub-function identifier which gives VIN number.

So Tx(0x7DF): 0x0209020000000000 command from SAE J1979 is simplest to get VIN Number.