Remote Activation of Routine Control in UDS Protocol – UDS Protocol Tutorial Part 5

This article is the continuation of the UDS protocol tutorial and carries the discussion on the Unified Diagnostic Services Protocol. The aim of this series is to provide easy and practical examples that anyone can understand. In the last article, we have seen the Input Output Control in UDS Protocol. In this tutorial, we are going to see the Remote Activation of Routine Control in UDS Protocol.

Remote Activation of Routine Control

This functional unit specifies the services of remote activation of routines, as they shall be implemented in servers and clients. It has the below service,

  • Routine control service(0x31)

Routine control service

The routine control service ID is 0x31 and the response SID is 0x71.

The Routine Control (0x31) Service is one of the important diagnostic services defined by the ISO 14229-1 standard. Routines can be used to allow the testing tool to do some specific functions in the ECU. With the help of the Routine Control service, the client(tester) can start, stop and check the result of the routine produced after the successful execution of the routine.

The Routine Control service is used by the client during vehicle testing some system testing may run over a certain period of time. 

To perform the testing a routine may be triggered by the client externally or a routine needs to be started by the client in the server’s memory. Before starting the routine some of the pre-conditions like the engine should be turned off, the vehicle should not move, immobilized should be unlocked, etc., needs to be checked and the ECU needs to switch to the appropriate diagnostic session and the security needs to be unlocked. Once after the start of the routine, the ECU will send a positive response to the client.

Suppose if the tester wants to stop the routine there are two methods to stop the routine,

  1. The client interrupts the routine to stop.
  2. The server or ECU finishes the routine after a specified time frame.

Using the Routine Control service, the client (tester) can start, stop and check the result of the routine produced after the successful execution of the routine. If the tester wants to know the result of the routine with the help of the request routine result sub-function we will get the appropriate result.

A routine is a series of actions that the ECU uses to carry out a certain task, such as validating the programming parameters, wiping the flash memory, or ensuring the accuracy of the data. Every routine has a special identifier (RID) that describes its purpose and inputs. Testers should always refer to OEM documentation for details on how to safely and effectively use the Routine Control (0x31) service.

There are a few examples of tasks that are using Routine Control Services,

  1. Programming or re-Programming of the ECU.
  2. Erasing the fault Memory.
  3. Reading or writing of calibration or configuration data from/to the ECU.
  4. Performing Self-test and functional tests.
  5. Activating or De-Activating the particular feature in the ECU.

Routine control service has the below-supported sub-function,

Sub-function (Routine control type)Description
Start Routine(0x01)

The start Routine initiates the execution of a routine corresponding to the given routine identifier. Before using the Start routine it may be necessary to switch the server to a specific diagnostic session using the Diagnostic Session Control service or to unlock the server with secure access. Once the server receives a request to start the routine from the client, the routine shall be started in the server’s memory. If the routine is started successfully it will send a positive response otherwise it will send a negative response to the client.
Stop Routine(0x02)The server routine shall be stopped in the server’s memory after the completion of the Stop routine request message. Based on the application software the server routine shall be stopped at any time or with initialized time in the server’s memory.
Request Routine Result(0x03)This Sub-function gives the exit status information of the completed routine.
For example, if the routine is exited normally, it will send a positive response with a normal exit with the result. If the routine is exited abnormally it will return a negative response with an abnormal exit with result.

Routine Functional Unit – Frame Format

Request frame format

Routine control request SID
Routine control type
Routine identifierRoutine control option record(optional)

Routine control type – Start routine/Stop routine/Request routine result

Routine Identifier is a 2-byte value and it depends on OEMs.

Routine Control Option Record is an optional data record that contains additional information for the routine, such as output values or status.

Response frame format

Positive frame format

PCI LengthRoutine control response SID(0x71)Routine control type(sub-function)Routine identifierRoutine status Record

Negative Frame format

PCI Length    7FRoutine control  SID (0x31)Negative Response Code

Remote Activation of Routine Control – Example

Please check the below example for Routine control transition.

For Positive responses,

Remote Activation of Routine Control - Positive response

For Negative responses,

Remote Activation of Routine Control - Negative response

Supported Negative Response code

NRCNRC NameDescriptionMnemonics
0x12sub-function not supportedThis NRC is used when the requested sub-function isn’t supported.SFNS
0x13Incorrect Message LengthThis NRC shall be sent if the length of the message is wrong.IML
0x22conditions Not CorrectThis NRC is used when the conditions for the Routine Control request aren’t satisfied.CNC
0x24Request Sequence ErrorThe routine is currently active and can not be restarted when the ‘start routine’ sub-function is received. Routine results are not available when the ‘requestRoutineResults’ sub-function is received.
0x31Request Out of RangeThe server does not support the requested routine identifier.ROOR
0x33Security access deniedThis NRC shall be sent if a client sends a request with a valid secure routineIdentifier and the server’s security feature is currently active.SAD
0x72General Programming FailureThis NRC shall be returned if the server detects an error when performing a routine, which accesses the server’s internal memory.GPF

In our next tutorial, we will see Upload Download Functional Unit in UDS Protocol.

You can also read the below tutorials.

Linux Device Driver TutorialsC Programming Tutorials
FreeRTOS TutorialsNuttX RTOS Tutorials
RTX RTOS TutorialsInterrupts Basics
I2C Protocol – Part 1 (Basics)I2C Protocol – Part 2 (Advanced Topics)
STM32 TutorialsLPC2148 (ARM7) Tutorials
PIC16F877A Tutorials8051 Tutorials
Unit Testing in C TutorialsESP32-IDF Tutorials
Raspberry Pi TutorialsEmbedded Interview Topics
Reset Sequence in ARM Cortex-M4BLE Basics
VIC and NVIC in ARMSPI – Serial Peripheral Interface Protocol
STM32F7 Bootloader TutorialsRaspberry PI Pico Tutorials
STM32F103 Bootloader TutorialsRT-Thread RTOS Tutorials
Zephyr RTOS Tutorials – STM32Zephyr RTOS Tutorials – ESP32
AUTOSAR TutorialsUDS Protocol Tutorials
Product ReviewsSTM32 MikroC Bootloader Tutorial
VHDL Tutorials
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments
Table of Contents