DoCAN OBD-II Client Demo
This example demonstrates how to implement a simple OBD-II client using a command line interface (CLI) to interact with an OBD-II ECU. The client allows users to send requests for various OBD-II services and retrieve data from the vehicle’s ECU.
While all the implementation are meant to be tested without any underlying hardware, enabling a compile time macro PLATFORM_TEST_SUPPORT, will call some function that can be used to certain real functionalities.
Request Current Diagnostic Data (0x01) service
The CLI menu request the user to select one of the PID’s. Based on the user input, relevant request code is sent. Based on the server response, prints are shown to indicate the PID’s type established or the error that occurred.
Freeze Frame Data (0x02) service
Yet to be implemented for example
Request Diagnostic Trouble Codes (DTCs) (0x03) service
Specific DTC record IDs can be read. In PLATFORM_TEST_SUPPORT mode, CAN transmit/receive counters and Air bag information from a GPIO are used.
Clear Diagnostic Information (0x04) service
The CLI menu inputs the DTC group code to be cleared and send it to the server. The response error code is printed.
Request Oxygen Sensor Monitoring Test Results (0x05) service
Yet to be implemented for example
Request On-Board Monitoring Test Results for Specific Monitored Systems (0x06) service
Yet to be implemented for example
Request Control of On-Board System, Test or Component (0x08) service
Yet to be implemented for example
Request Vehicle Information (0x09) service
Requests vehicle-specific information such as VIN and ECU name.
Refer to the OBD protocol page for more details ISO15031 - OBD Protocol.