Search code examples
diagnosticsobd-iiautosarautomotiveuds

Difference between Reading a DID using RDBI (0x22) and using Routine Control (0x31) in UDS


This was a question I was asked some time ago and forgot its answer, however, I would like to have a "detailed" answer to this question.

Explain the difference between using RDBI (0x22) UDS service and using Routine Control (0x31) UDS service to read a DID and which method is the fastest/most efficient/best

Also if there is a better format to this question, please provide it.


Solution

  • There is usually no faster/efficient/better.

    A DataIdentifier (DID) could have different services assigned to it, depending on the DID:

    • ReadDataByIdentifier - read out the DID
    • WriteDataByIdentifier - e.g. change and store a parameter
    • IoControlByIdentifier - with subfunctions:
      • returnControlToEcu
      • resetToDefault
      • freezeCurrentData
      • shortTermAdjustemt - e.g. override the internal status of an I/O like "Turn LED on/off" to check a broken LED, or set input speed to 50km/h to test a speed activated function while the vehicle is still staying in the repair shop

    After changing a DID e.g. by IoControl, the ReadDataByIdentifier can be used to read the current status.

    For more complicated things, where certain sequence of things have to be executed, a RoutineControl could be used, e.g. EOL/Service Alignment of sensors, clearing the NvM.

    From ISO-14229-1:

    14.2 RoutineControl (3116) service

    14.2.1 Service description

    The RoutineControl service is used by the client to execute a defined sequence of steps and obtain any relevant results. There is a lot of flexibility with this service, but typical usage may include functionality such as erasing memory, resetting or learning adaptive data, running a self-test, overriding the normal server control strategy, and controlling a server value to change over time including predefined sequences (e.g. close convertible roof) to name a few. In general, when used to control outputs this service is used for more complex type control whereas inputOutputControlByIdentifier is used for relatively simple (e.g. static) output control.

    So, for normal usage, the ReadDataByIdentifier is applicable in most cases for just reading out data elements.

    You could even combine multiple DIDs to read with DynamicallyDefinedData service, or even use for some a ReadDataPeriodicallyByIdentifier.

    In the internal implementation of the ReadData, it is usually just Dcm collecting/accessing the data elements directly over the SenderReceiver interfaces of your components. Vector even provides now a so called DiagXf, a data transformer similar to ComXf transformers, to (de-)serialize the data. In such case, you might not even need to write a single line of code.