OBD-II Server Stack

Overview

RAPIDSEA supports ISO15031 protocol as explained in the ISO15031 - OBD Protocol page. This page explains the server architecture and details how the user should interface the stack with their custom logic and realize the ECU implementation quickly. It also provides guidelines on adopting the stack for different systems.

The below diagram captures the block level diagram of the DoCAN OBD server and how it interfaces with other modules.

DoCAN OBD Stack Block Diagram

DoCAN Interface

The OBD server communicates over the CAN network through the underlying DoCAN stack (ISO15765). This DoCAN stack is also available as part of the RAPIDSEA components. All the functions that are needed are available as part of the DoCAN stack and has to be compiled together.

DoCAN Interface

Mode

Description

rs_iso15765_*

Set of functions called by OBD server to perform operation such as initialize, transmit messages etc

rs_obd_server_docan_callback

Callback function called by the DoCAN layer to inform of Data Indication, error etc

These details with respect to the DoCAN interface are covered in detail in the ISO15765 - DoCAN Protocol page.

Application Interface

While the RAPIDSEA OBD server stack can handle most of the functionality such as message validation, session management, timing control etc, the business logic has to implement the application functionality. the RAPIDSEA OBD server clearly defines API and callback functions that are essential for the user to use/implement.

The below table captures the function that are to be called from the application logic.

API Functions

Function

Description

rs_obd_server_open

To initialize the OBD server stack

rs_obd_server_set_p2_timing

To setup the P2 timing associated with the server

rs_obd_server_process

To be called periodically to process the incoming/outgoing messages

There are many functions through which the OBD server stack retrieves information from the application logic or indicate actions to be performed. These functions are captured in the below table.

Callback Functions

Function

Description

rcb_obd_server_01h_req_current_diag_data

Called to indicate request Current Diagnostic Data

rcb_obd_server_02h_request_freeze_frame_data

Called to indicate request Freeze Frame Data

rcb_obd_server_03h_req_diag_trouble_code

Called to indicate request Diagnostic Trouble Codes

rcb_obd_server_04h_clear_dtc

Called to Clear/Reset Diagnostic Trouble Codes and information

rcb_obd_server_05h_req_oxygen_sensor_monitoring

Called to indicate request Oxygen Sensor Monitoring Test Results

rcb_obd_server_06h_req_on_board_monitoring

Called to indicate request On-Board Monitoring Test Results for Specific Monitored Systems

rcb_obd_server_07h_req_emission_diag_trouble_code

Called to indicate request Emission-Related Diagnostic Trouble Codes Detected During Current or Last Completed Driving Cycle

rcb_obd_server_08h_req_ctrl_of_on_board_system

Called to indicate request Control of On-Board System, Test or Component

rcb_obd_server_09h_req_vehicle_information

Called to indicate request vehicle information

These functions are documented in detail in the below sections. It is important for the server to implement these functions correct for proper operation of the system.

Implementation Guide

This section explains how the OBD server can be implemented using the RAPIDSEA stack. Whether the stack is available in source form or in binary form, the steps to be followed are

  • Implement the Callback functions mentioned above

  • Implement the underlying rs_can_* functions for DoCAN as per the underlying hardware design as described in the CAN Interface page.

  • Initialize the buffers necessary for the operation

  • Initialize the CAN, ISO15765 and ISO15031 stack function for DoCAN.

  • Periodically call the process functions so that internal timeouts are handled.

High level flow chart is depicted below for DoCAN:

DoCAN OBD Server Flow Diagram

This can be implemented in a bare-metal system or over RTOS or over full fledged OS such as Linux etc.

Dependency

This stack depends on the below RAPIDSEA interfaces that can be obtained or custom implemented.

Example demo

An example implementation is available along with the release and is described in DoCAN OBD-II Server Demo.

OBD Header Details

Documentation from the relevant header as follows:

Warning

doxygenfile: Cannot find file “rs_obd_server.h