UDS Client Stack

UDS Client Overview

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

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

DoCAN UDS Stack Block Diagram

The below diagram captures the block level diagram of the DoIP UDS client and how it interfaces with other modules.

DoIP UDS Stack Block Diagram

DoCAN Interface

The UDS client 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 UDS client to perform operation such as initialize, transmit messages etc

rs_uds_client_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.

DoIP Interface

The UDS client communicates over the Ethernet through the underlying DoIP stack (ISO13400). This DoIP stack is also available as part of the RAPIDSEA components. All the functions that are needed are available as part of the DoIP stack and has to be compiled together.

DoIP Interface

Mode

Description

rs_iso13400_*

Set of functions called by UDS client to perform operation such as initialize, transmit messages etc

rs_uds_client_docan_callback

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

These details with respect to the DoIP interface are covered in detail in the ISO13400 - DoIP Protocol page.

Application Interface

While the RAPIDSEA UDS client 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 UDS client 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_uds_client_open

To initialize the UDS client stack.

rs_uds_client_process

To be called periodically to process the incoming/outgoing messages.

rs_uds_client_req_diag_session_control

To initiate a diagnostic session with the server.

rs_uds_client_req_ecu_reset

To request ECU reset.

rs_uds_client_req_clear_diag_info

To clear DTC information.

rs_uds_client_req_read_data_by_id

To read Data by ID.

rs_uds_client_req_read_mem_by_addr

To read memory by address.

rs_uds_client_req_read_scaling_data_by_id

To read scaling data of the data by ID.

rs_uds_client_req_security_access

To perform secure access.

rs_uds_client_req_comm_control

To set up communication control on the UDS channel.

rs_uds_client_req_write_data_by_id

To write data by ID.

rs_uds_client_req_control_io_by_id

To control IO by ID.

rs_uds_client_req_routine_control

To perform routine control operation.

rs_uds_client_req_download

To request download of data.

rs_uds_client_req_transfer_data

To transfer data.

rs_uds_client_req_transfer_exit

To terminate data transfer.

rs_uds_client_req_write_mem_by_addr

To write memory by address.

rs_uds_client_req_tester_present

To send tester present.

rs_uds_client_req_access_timing_param

To set up access timing parameters.

rs_uds_client_req_control_dtc_setting

To set up DTC settings.

rs_uds_client_req_link_control

To set up link control.

rs_uds_client_req_read_data_by_periodic_id

To read data using periodic IDs.

rs_uds_client_req_read_dtc_info

To read DTC information.

rs_uds_client_enable_pos_resp_suppression

To enable/disable positive response suppression.

rs_uds_client_req_upload

To requests upload the data.

rs_uds_client_req_response_on_event

To requests a server to start or stop transmission of responses on a specified event.

rs_uds_client_close

To free the UDS Client handle.

There are many functions through which the UDS client 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_uds_client_10h_diag_session_resp

Called when response for a default session setup request is received

rcb_uds_client_11h_ecu_reset_resp

Called when response for ECU reset request is received

rcb_uds_client_14h_clear_diag_info_resp

Called when response for clear DTC request is received

rcb_uds_client_22h_read_data_by_id_resp

Called when response for read Data by ID is received

rcb_uds_client_23h_read_mem_by_addr_resp

Called when response for Memory by address is received

rcb_uds_client_24h_read_scaling_data_by_id_resp

Called when response for read scaling data by ID is received

rcb_uds_client_27h_security_access_resp

Called when response for secure access is received

rcb_uds_client_28h_comm_ctrl_resp

Called when response for communication control request is received

rcb_uds_client_2eh_write_data_by_id_resp

Called when response for write Data By ID is received

rcb_uds_client_2fh_io_control_by_id_resp

Called when response for control of given Data ID is received

rcb_uds_client_31h_routine_control_resp

Called when response for routine control is received

rcb_uds_client_34h_download_data_resp

Called when response for download request is received

rcb_uds_client_36h_transfer_data_resp

Called when response for transfer data is received

rcb_uds_client_37h_transfer_exit_resp

Called when response for exit transfer operation is received

rcb_uds_client_3dh_write_mem_by_addr_resp

Called when response for write by memory address is received

rcb_uds_client_3eh_tester_present_resp

Called when response for tester present is received

rcb_uds_client_83h_access_timing_param_resp

Called when response for access timing parameters is received

rcb_uds_client_85h_control_dtc_setting_resp

Called when response for control DTC setting is received

rcb_uds_client_87h_link_control_resp

Called when response for link control parameters is received

rcb_uds_client_2ah_read_data_by_periodic_id_resp

Called when a response to read data by periodic id is received

rcb_uds_client_19h_read_dtc_info_resp

Called when a response to read DTC information is received

rcb_uds_client_transmit_confirm

Called it indicate status of the last transmit operation

rcb_uds_client_error_resp

Called to indicate reception of error response for any request

rcb_uds_client_35h_req_upload_resp

Called when a response to upload data is received

rcb_uds_client_86h_resp_on_event_resp

Called when a response to response on event is received

rcb_uds_client_2ch_ddid_resp

Called when a response to dynamic define data ID is received

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

Implementation Guide

This section explains how the UDS 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 and rs_iso13400_* functions for DoIP 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 ISO14229 stack function for DoCAN and Ethernet socket , ISO13400 and ISO14229 fucction for DoIP .

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

  • If there is a need to send a request to ECU/server, send via rs_uds_client_req_* calls such as rs_uds_client_req_comm_control, rs_uds_client_req_clear_diag_info etc.

  • When the response from server is received, rcb_uds_client_* functions such as rcb_uds_client_14h_clear_diag_info_resp, rcb_uds_client_27h_security_access_resp are called.

  • On reception of negative response from server, rcb_uds_client_error_resp function is called.

  • Up on successful completion of transmission of request or failure to do so, rcb_uds_client_transmit_confirm is called with relevant reason code.

High level flow chart is depicted below for DoCAN:

UDS Client Flow Diagram

High level flow chart is depicted below for DoIP:

UDS Client Flow Diagram

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

Example demo

An example implementation is available along with the release and is described in DoCAN UDS Client Demo.

UDS Client Header

Documentation from the relevant header as follows:

Warning

doxygenfile: Cannot find file “rs_uds_client.h