DoIP UDS Client Demo
There is an example implementation of DoIP client demo available in apps folder.Initially DoIP client started the UDS socket connection.Once client connected to the server DoIP client broadcast the vehicle identification request. Once client connected, send the request to the server.Server send the response to the client.
There is an example implementation of UDS client available in apps folder. In this implementation, a simple command line interface (CLI) is used to trigger various services on to the ECU/server.
The below diagram captures the high level flow of client and server of DoIP.

Diagnostic Session Control (0x10) request
The CLI menu request the user to select one of Default, Programming, Extended or Safety System Diagnostic types. Based on the user input, relevant request code is sent. Based on the server response, prints are shown to indicate the session type established or the error that occurred.
ECU Reset (0x11) request
The type of request is obtained and sent accordingly. After receiving the response, the power down time is printed.
Clear Diagnostic Information (0x14) request
The CLI menu inputs the DTC group code to be cleared and send it to the server. The response error code is printed.
Read DTC Information (0x19) request
Specific DTC record IDs can be read using RS_IS14229_READ_DTC_REPORT_DTC_STORED_DATA_BY_RECORD_NUMBER sub-function code. Others are not supported. With 0xFF, all the 3 DTC records can be read in a single shot. In PLATFORM_TEST_SUPPORT mode, CAN transmit/receive counters and Air bag information from a GPIO are used.
Read Data By ID (0x22) request
Prompts the user to enter the number of data IDs to be read. Then each of the IDs are obtained and requested.
Read Memory By Address (0x23) request
Data can be read from the given memory address for the given number of bytes and the result is printed.
Read Scaling Data By Identifier (0x24) request
Scaling data can be read for the given data ID
Security Access (0x27) request
Obtains the type and optional data bytes to be sent to the server. Response data is printed as received.
Communication Control (0x28) request
Simply prints the control type information received from the tester. Few global variables updated but not used.
Read Data By Periodic Identifier (0x2A) request
Yet to be implemented in the example.
Write Data By Identifier (0x2E) request
Data ID specified as Read/Write are allowed to be written
Input Output Control By Identifier (0x2F) request
Only prints are supported with fixed response value.
Routine Control (0x31) request
A single routine to blink a LED is supported. When starting the routine, number of blinks to be done can be passed. The same can be stopped and or status queried.
RequestDownload (0x34) request
The example allows the client to download a data and optionally store it in local file system as a file.
TransferData (0x36) request
The example allows the client to transfer data.
RequestTransferExit (0x37) request
The example allows the client to complete data transfer.
Write Memory By Address (0x3D) request
Data can be written from address 0x20001000 using this service for up to 1500 bytes.
Tester Present (0x3E) request
A simple print can be seen on receiving this service request.
Access Timing Parameter (0x83) request
Simple prints can be seen on receiving this service request.
SecuredDataTransmission (0x84) request
The example simply returns one’s complement of the given input.
Control DTC Setting (0x85) request
The example simply prints the given input.
Link Control (0x87) request
The example simply prints the given input and returns a fixed parameter value of 0x123456.
DoIP Client Running Example
Refer to the Supported Platforms page to setup your environmental setup and follow further.
User Configuration for Client
Socket configuration |
Value |
---|---|
Server port number |
13400 |
Server IP address |
IP address of server running PC or machine |
Once run the execution command the (./doip_client_demo for linux and ./RSDoipClientApp.exe for windows) doip client connecting to DoIP server via UDP and TCP.
Note : Before run the client we need to run the doip server on another terminal or eclipse
Note : The below execution steps are same for both windows and linux.
After initial communication has been done, Its shows the UDS services menu look like below
For Linux

For windows

Note : After execution,the follwing procedure will be same for both client and server.
Diagnostic Session Control
In UDS, first we need to switch the diagnostic session from default to other session like programming or any other sessions then only we can access the UDS services
To change the session from default to programming
Type ‘1’ and press enter to choose Diagnostic session control from UDS menu
Then it will list sessions list to switch

Choose the programming session by type ’2’ and press enter. Then the session switch to programming session.

Security Access
UDS services is protected by security access with some credentials.
To open the security access in UDS, Type 11 to reach security access menu from UDS menu.
Now security access menu list as

Security Access request seed
Type 1 and press enter to produce seed key
- Then its will ask,
”Do you want to send any data with this request (y/n)?”
Type ‘n’ and press Enter.

Security Access send key
Now again open the security access menu (Type 11 and press enter) for send key to open the access.
Type ‘2’ and press enter , it will ask as below
”Do you want to send any data with this request (y/n)?”
Enter yes as ‘y’ and press enter then it will like
”Enter number of bytes”
Enter 1 and press enter
Enter data, byte by byte in hex format without 0x
Type “EF” and press enter.
Now the UDS enbled the security access

Read Data by ID service
To get the value of particular data ID in server side we need to choose the read data by ID.
Type 6 and press enter
Then it will ask,
“Please provide the num of data ID to read”
So we need to enter the count of data id we want to read (eg. 1)
After enter the count then it will ask
“whether requesting data for same DID (y/n)”
If we read data for same data ID give ‘y’ and press enter.
If we read data for different data ID give ‘n’ and press enter.
“Please provide the Data ID’s to read in HEX format without 0x”
Now enter the data ID given in the above list of read data ID to read. (eg. 0105)
Then the server will response with reading value for given data id.

Write Data by ID Service
To write the value in the server side on data id we need to choose the write data by id service in UDS menu.
Type 3 and press enter
“Please provide the Data Identification number in hex format without 0x”
Enter the data id need to update the values on server side (eg. f205)
“Please provide the number of bytes in Data Record”
Then enter the no of byte of value we need to write eg. 1 or 2 (eg. 1)
“Please provide the Data Record, byte by byte in hex format without 0x”
Now enter the value to write on respective data id on server side. (eg. 3 or 5 or 7)
Then the server will sent positive response after written the given value on give data id.

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.
Refer to the UDS protocol page for more details ISO14229 - UDS Protocol.
Refer to the DoIP protocol page for more details ISO13400 - DoIP Protocol.