UDS Server Stack
Overview
RAPIDSEA supports ISO14229 protocol as explained in the ISO14229 - UDS 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 UDS server and how it interfaces with other modules.
The below diagram captures the block level diagram of the DoIP UDS server and how it interfaces with other modules.
DoCAN Interface
The UDS 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.
Mode |
Description |
|---|---|
rs_iso15765_* |
Set of functions called by UDS server to perform operation such as initialize, transmit messages etc |
rs_uds_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.
DoIP Interface
The UDS server 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.
Mode |
Description |
|---|---|
rs_iso13400_* |
Set of functions called by UDS server to perform operation such as initialize, transmit messages etc |
rs_uds_server_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 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 UDS 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.
Function |
Description |
|---|---|
rs_uds_server_open |
To initialize the UDS server stack |
rs_uds_server_set_p2_timing |
To setup the P2 timing associated with the server |
rcb_uds_server_session_timeout |
To setup the session timeout value |
rs_uds_server_process |
To be called periodically to process the incoming/outgoing messages |
rs_uds_server_close |
To free the UDS server handle |
There are many functions through which the UDS server stack retrieves information from the application logic or indicate actions to be performed. These functions are captured in the below table.
Function |
Description |
|---|---|
rcb_uds_server_is_request_allowed |
Called to check if security permission and session is available for the given service code |
rcb_uds_server_10h_session_default |
Called to indicate request for default session setup |
rcb_uds_server_10h_session_programming |
Called to indicate request for programming session setup |
rcb_uds_server_10h_session_extended |
Called to indicate request for extended diagnostic session setup |
rcb_uds_server_10h_session_safety_system |
Called to indicate request for safety system session setup |
rcb_uds_server_10h_session_custom |
Called to indicate request for custom session setup |
rcb_uds_server_session_timeout |
Called to indicate when the active session times out |
rcb_uds_server_11h_ecu_reset_req |
Called to indicate Reset request received from Tester |
rcb_uds_server_14h_clear_dtc |
Called to clear DTC information by group ID |
rcb_uds_server_19h_read_dtc_info |
Called to read DTC information by various report types |
rcb_uds_server_22h_read_did |
Called to read Data by ID |
rcb_uds_server_23h_read_mem_by_addr |
Called to read Memory by address |
rcb_uds_server_24h_read_scaling_data_by_did |
Called to read scaling data by ID |
rcb_uds_server_27h_secure_access |
Called to perform secure access on the device |
rcb_uds_server_28h_comm_control |
Called to indicate change in communication control |
rcb_uds_server_2ah_read_data_periodic_by_id |
Called to register/un-register for periodic read of data |
rcb_uds_server_2eh_write_did |
Called to write Data By ID |
rcb_uds_server_2fh_io_control |
Called to perform temporary control of given Data ID |
rcb_uds_server_31h_routine_start |
Called to Start a Routine |
rcb_uds_server_31h_routine_stop |
called to Stop a Routine |
rcb_uds_server_31h_routine_status |
Called to query status for a routine operation |
rcb_uds_server_30h_get_block_size |
Called to get the block size to be used for transfer |
rcb_uds_server_30h_get_min_seperation_time |
Called to get the separation for the transfer |
rcb_uds_server_34h_get_max_block_len |
Called to get maximum block size for transfer operation |
rcb_uds_server_34h_req_download |
Called to indicate download request from client |
rcb_uds_server_36h_transfer_data |
Called to transfer to/from client |
rcb_uds_server_37h_req_transfer_exit |
Called to terminate/stop transfer operation |
rcb_uds_server_3dh_write_mem_by_addr |
Called to write to given memory address |
rcb_uds_server_3eh_tester_present |
Called to indicate that the tester is still connected |
rcb_uds_server_83h_access_timing_parameter |
Called to get/set access timing parameters |
rcb_uds_server_84h_secured_data_transmission |
Called to transfer data in a secure way |
rcb_uds_server_85h_control_dtc |
Called to control DTC setting |
rcb_uds_server_87h_link_control |
Called to set link control parameters |
rcb_uds_server_35h_req_upload |
Called to initiate an upload session |
rcb_uds_server_set_roe_start_processing |
Called to set the given value to the roe start processing parameter |
rcb_uds_server_get_roe_start_event |
Called to get the value of roe start event. |
rcb_uds_server_86h_get_num_of_activated_events |
Called to get the how many events are activated. |
rcb_uds_server_86h_resp_on_event |
Called to perform response on event operation |
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 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 as per the underlying hardware design as described in the CAN Interface page and rs_iso13400_* functions for DoIP
Initialize the buffers necessary for the operation
Initialize the CAN, ISO15765 and ISO14229 stack function for DoCAN and Ethernet socket , ISO13400 and ISO14229 for DoIP.
Periodically call the process functions so that internal timeouts are handled.
High level flow chart is depicted below for DoCAN:
High level flow chart is depicted below for DoIP:
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 Server Demo.
UDS Header Details
Documentation from the relevant header as follows:
Warning
doxygenfile: Cannot find file “rs_uds_server.h