Diagnostic service implementation – An introduction

Abbreviations

DCM – Diagnostic Communication Manager
CDD -Candela Diagnostic Description
NRC -Negative Response Code
RCRRP – Request Correctly received Response Pending

Introduction

In a AUTOSAR project, the Diagnostics CDD integration process shall generate most of the configuration information necessary for Diagnostics Communication Manager (DCM) and its dependencies. In addition, service specific user call-out functions are generated. The implementation for these call-outs must be filled by the application programmer for correct functionality.

Basic operation

When a diagnostics service is requested by diagnostics tester, DCM will interpret the request and invoke a user call-out function associated with the service and its sub-function.

The signature of call-out function looks something like this. The naming of the function may differ , however the logic remain same.

Std_ReturnType <Module>_<DataMember>_<service>( const uint8 * Data,
Dcm_OpStatusType OpStatus, Dcm_NegativeResponseCodeType * ErrorCode );

Example call-out for write data by identifier service will look something like this. SpeedLimter is the module name. MaxSpeed is data member to be written.

Std_ReturnType DataServices_SpeedLimter_MaxSpeed_WriteData(const uint8 * Data,
Dcm_OpStatusType OpStatus,
Dcm_NegativeResponseCodeType * ErrorCode);

opStatus

As each service requires a processing time, Dcm shall call these call-out with different opStatus values, so that kind of state machine can be realized. Please note call-outs originate from Dcm_MainFunction context.

When service requested by diagnostic tester, then …

  1. DCM invokes respective call-out handler, first with opStatus equal to DCM_INITIAL.
  2. When processing is not completed in the first call & return status is DCM_E_PENDING, then DCM invokes the call-out handler with opStatus equal to DCM_PENDING on every Dcm_MainFunction context as long as the rerun status from call-out us DCM_E_PENDING.
  3. When processing is not completed in the first call & return status is DCM_E_FORCE_RCRRP, then DCM defer invoking the call-out handler until RCRRP timeout. At RCRRP timeout, it call-out invoked with opStatus equal to DCM_FORCE_RCRRP_OK from Dcm_MainFunction context.
  4. In case DCM detected internal timeout on operation, DCM invokes the call-out handler with opStatus equal to DCM_CANCEL.

Here is one possible illustration of opStatus.

Possible return values from the call-out and reaction of DCM.

The standard return (Std_ReturnType) value of these callout functions are

  1. E_OK – Request was successful
  2. E_NOT_OK – Request was not successful
  3. DCM_E_PENDING – Request is not yet finished
  4. DCM_E_FORCE_RCRRP – Application requests the transmission of a response Response Pending (NRC 0x78)

Std_ReturnType::E_OK
Informs the DCM to send positive response to tester.

Std_ReturnType::E_NOT_OK
Informs the DCM to send negative response to tester. The negative response code given to tester is equal to parameter value ErrorCode.

Std_ReturnType::DCM_E_PENDING
Informs the DCM that processing is not completed. DCM must invoke the call-out again but with opStatus DCM_PENDING. DCM takes care of maintaining protocol timings towards tester.

Std_ReturnType::DCM_E_FORCE_RCRRP
Explicitly requests DCM to send response pending negative response to tester. The next invocation of call-out is deferred until the RCRRP timeout.
On RCRRP timeout, DCM invokes the call-out function with opStatus equal to DCM_FORCE_RCRRP_OK.

Negative Response Codes

Here is the list of few frequently used NRC.

  • DCM_POS_RESP 0x00
  • DCM_E_GENERALREJECT 0x10
  • DCM_E_REQUESTOUTOFRANGE 0x31
  • DCM_RESPONSE_PENDING 0x78

Please refer to SWS document [1] for comprehensive list of values of Dcm_NegativeResponseCodeType.

Tag references

SWS_Dcm_00527: DCM_INITIAL
SWS_Dcm_00530: DCM_PENDING
SWS_Dcm_00529: DCM_FORCE_RCRRP_OK
SWS_Dcm_00980: Dcm_NegativeResponseCodeType

References:

  1. Specification of Diagnostic Communication Manager

Follow up article : Diagnostics service – immediate response

Leave a Reply

Your email address will not be published. Required fields are marked *

Jayakumar Sengottuvel
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.