TechnicalReference J1939Dcm
TechnicalReference J1939Dcm
Communication Manager
Technical Reference
Version 17.0.1
Technical Reference MICROSAR Classic J1939 Diagnostic Communication Manager
Document Information
History
visuvo 2022-08-16 16.0.0 > Added diagnostic messages 7, 8, 19, 26, 33 and 58
> Adapt diagnostic message 24 for Autosar
compliance (use of Dem API call instead of
preconfigured ROM table for SPNs supported in
Expanded Freeze Frame)
> Added chapter 2.4.3.1 DM13 and Broadcast-
Command prioritization
visuvo 2022-10-24 16.1.0 > Added diagnostic messages 30 and 34
visuvo 2022-11-23 16.2.0 > Added diagnostic messages 10, 56 and 57
visuvo 2023-02-15 16.2.1 > Adaption of Caution Box in chapter 5.1 Configuration
Variants
visepp 2023-04-21 16.3.0 > Added chapter 6.2 How to handle Meta Data for
reception of Diagnostic Messages
visuvo 2024-03-22 17.0.0 > Added diagnostic message 22
> Adaption of functional deviation for DM01 in table
Table 2-7 Supported features with deviations
visuvo 2024-06-06 17.0.1 > Added chapter 6.4 How to mark a Node as OBD
specific Node
Reference Documents
Caution
We have configured the programs in accordance with your specifications in the
questionnaire. Whereas the programs do support other configurations than the one
specified in your questionnaire, Vector´s release of the programs delivered to your
company is expressly restricted to the configuration you have specified in the
questionnaire.
Contents
1 Introduction................................................................................................................. 10
1.1 Architecture Overview ...................................................................................... 10
3 Integration ................................................................................................................... 20
3.1 Scope of Delivery ............................................................................................. 20
3.1.1 Static Files ....................................................................................... 20
3.1.2 Dynamic Files .................................................................................. 20
3.1.3 Include Structure .............................................................................. 21
3.2 Critical Sections ............................................................................................... 21
3.3 Memory Access ............................................................................................... 22
3.3.1 Memory Access Request (DM14) ..................................................... 23
3.3.2 Memory Access Response (DM15) .................................................. 23
3.3.3 Binary Data Transfer (DM16) ........................................................... 23
3.3.4 Boot Load Data (DM17) ................................................................... 25
3.3.5 Data Security (DM18)....................................................................... 25
3.4 Access to Application ....................................................................................... 25
3.4.1 Command Non-Continuously Monitored Test (DM7) ........................ 26
5 Configuration .............................................................................................................. 61
5.1 Configuration Variants ...................................................................................... 61
5.2 Configuration in Data Base .............................................................................. 61
5.3 Configurable Attributes ..................................................................................... 62
8 Contact ........................................................................................................................ 68
Illustrations
Figure 1-1 AUTOSAR 4.1 Architecture Overview ....................................................... 10
Figure 1-2 Interfaces to adjacent modules of the J1939DCM ..................................... 11
Figure 2-1 J1939DCM Module States ........................................................................ 14
Figure 3-1 J1939DCM Include Structure .................................................................... 21
Figure 3-2 Memory Access: DM14 Reception Sequence ........................................... 23
Figure 3-3 Memory Access: DM15 Transmission Sequence ...................................... 23
Figure 3-4 Memory Access: DM16 Reception Sequence ........................................... 24
Figure 3-5 Memory Access: DM16 Transmission Sequence ...................................... 24
Figure 3-6 Memory Access: DM17 Reception Sequence ........................................... 25
Figure 3-7 Command Non-Continuously Monitored Test: DM7 Sequence.................. 27
Figure 3-8 Provide test result for Non-Continuously Monitored Systems: DM8
Sequence ................................................................................................. 27
Figure 3-9 Supported Non-Continuously Monitored Systems Test Identifiers: DM10
Sequence ................................................................................................. 28
Figure 3-10 Calibration Information: DM19 Sequence ................................................. 28
Figure 3-11 Provide Scaled Test Results: DM30 Sequence ......................................... 29
Figure 3-12 EI-AECD Activation Time: DM33 Sequence .............................................. 29
Figure 3-13 NTE Status: DM34 Sequence ................................................................... 30
Figure 3-14 Model Year and Certification Engine Family: DM56 Sequence ................. 30
Figure 3-15 OBD Information: DM57 Sequence........................................................... 31
Figure 3-16 Provide test result for Rationality Fault SPN Data: DM58 Sequence ......... 31
Figure 3-17 Configuration of J1939DcmMemAccessFunctions for post-build loadable 32
Figure 3-18 Configuration of DemGeneralJ1939 for post-build loadable ...................... 33
Figure 5-1 Definition of J1939 CAN identifiers in the DBC editor................................ 62
Tables
Table 2-1 Implemented Diagnostic Messages .......................................................... 13
Table 2-2 Additional Features ................................................................................... 13
Table 2-3 Broadcast-Command prioritization ............................................................ 15
Table 2-4 Service IDs ............................................................................................... 16
Table 2-5 Errors reported to DET ............................................................................. 17
Table 2-6 Not supported features ............................................................................. 18
Table 2-7 Supported features with deviations ........................................................... 19
Table 3-1 Static files ................................................................................................. 20
Table 3-2 Generated files ......................................................................................... 20
Table 3-3 Memory Access Interfaces provided by J1939DCM .................................. 22
Table 3-4 Application Interface provided by J1939DCM ........................................... 26
Table 4-1 Enumeration type definitions..................................................................... 34
Table 4-2 Structure type definitions .......................................................................... 35
Table 4-3 J1939Dcm_CalibrationIDArrayType .......................................................... 35
Table 4-4 J1939Dcm_CertificationEngineFamilyNameType ..................................... 35
Table 4-5 J1939Dcm_ModelYearType ...................................................................... 35
Table 4-6 J1939Dcm_SupportedTestIdentifiersType................................................. 36
Table 4-7 J1939Dcm_RequestIndication() ................................................................ 36
Table 4-8 J1939Dcm_DeInit() ................................................................................... 37
Table 4-9 J1939Dcm_GetVersionInfo()..................................................................... 37
Table 4-10 J1939Dcm_Init() ....................................................................................... 38
Table 4-11 J1939Dcm_InitMemory() .......................................................................... 38
Table 4-12 J1939Dcm_MainFunction() ....................................................................... 39
Table 4-13 J1939Dcm_SetState() .............................................................................. 39
1 Introduction
This document describes the functionality, API and configuration of the AUTOSAR BSW
module J1939DCM as specified in [1].
The J1939DCM handles the diagnostic communication in a J1939 network. SAE J1939-73
(see [6]) defines several so-called Diagnostic Messages (DMs) which are received and/or
transmitted over the network by the J1939DCM.
The next figure shows the interfaces to adjacent modules of the J1939DCM.
2 Functional Description
2.1 Features
The following table gives an overview over the diagnostic messages which are defined by
AUTOSAR in [1] and which are supported by the J1939DCM.
Especially OBD related DMs are not yet supported, while the memory access messages
are implemented according to the SAE specification ([6]) but not yet defined by AUTOSAR.
Implemented by
Specified by
J1939DCM
AUTOSAR
Diagnostic Messages
2.1.1 Limitations
2.1.1.1 DM1 Transmission on DTC status change
Only the first status change of any DTC within a 1s period will lead to a DM1 transmission.
This is a limitation to the AUTOSAR and SAE specifications ([1] and [6]), where a DM1
shall be transmitted for the first status change of each DTC.
2.1.1.2 OBD Support
Only a limited number of OBD related diagnostic messages are supported (see Table 2-1).
2.1.1.3 Parallel Message Processing and Multiple Nodes
Generally, the J1939DCM is only able to process one message request at a time for each
node. Different nodes are handled independently, so it is possible to request a DM
simultaneously for two nodes.
However, parallel message processing on different nodes is limited. If an access to the
DEM takes longer than one task cycle, all further requests which require DEM access are
rejected.
In case of a directed request, the NACK “Cannot Respond” will be sent. According to the
specification of the Acknowledgment PGN 59392 in [7], the data must then be re-
requested later.
For broadcast requests, where all configured nodes need to respond simultaneously, this
may have the effect that only the first node is able to respond.
2.1.1.4 DM13 and Multiple Nodes
DM13 only affects the configured channels, its implementation is completely independent
of the nodes.
2.2 Initialization
If not already done by the startup code, the statically initialized RAM variables must be
initialized by calling J1939Dcm_InitMemory.
The J1939DCM itself is initialized by calling J1939Dcm_Init. The module can be reset
with the J1939Dcm_DeInit. In uninitialized state, only the
J1939Dcm_GetVersionInfo API is available.
2.3 States
After it is initialized, the J1939DCM is by default in the state J1939DCM_OFFLINE. In this
state, requests can neither be received nor are messages transmitted. The state is
changed to J1939DCM_ONLINE by the API J1939Dcm_SetState.
Initial
startup code,
J1939Dcm_InitMemory
Initialized
[pow er dow n]
[pow er dow n]
Final
Service ID Service
0x01 J1939Dcm_Init
0x02 J1939Dcm_DeInit
0x03 J1939Dcm_GetVersionInfo
0x04 J1939Dcm_MainFunction
0x0A J1939Dcm_DemTriggerOnDTCStatus
0x0B J1939Dcm_SetState
0x40 J1939Dcm_TxConfirmation
0x42 J1939Dcm_RxIndication
0x43 J1939Dcm_CopyTxData
0x44 J1939Dcm_CopyRxData
0x45 J1939Dcm_TpRxIndication
0x46 J1939Dcm_StartOfReception
0x47 J1939Dcm_RequestIndication
0x48 J1939Dcm_TpTxConfirmation
0x50 J1939Dcm_MemResponseTransmit
0x51 J1939Dcm_MemDataTransmit
0x52 J1939Dcm_ProvideTestResultOfDm8
0x80 J1939Dcm_InitMemory
Table 2-4 Service IDs
If another module is used for development error reporting, the function prototype for
reporting the error can be configured by the integrator but must have the same signature
as the service Det_ReportError().
The reported J1939DCM ID is 58.
The errors reported to DET are described in the following table:
Error Code Description
0x01 J1939DCM_E_INVALID_PDU_SDU_ID API called with invalid PDU-ID
0x06 J1939DCM_E_INVALID_STATE API called although not allowed in
current state (e.g. in OFFLINE state)
0x07 J1939DCM_E_PARAM_ID API called with invalid parameter
2.6 Deviations
The following features specified in [1] are not supported:
Category Description
Functional J1939DcmGenericDMxSupport is not supported. Therefore, the following API
API functions and configuration parameters are not available:
Config API functions:
- J1939Dcm_GenericDMxTransmit
- GenericDMx…
Configuration parameters:
- J1939DcmGenericDMx…
Functional Mode Rules and Mode Conditions are not supported. Therefore, the following
Config configuration containers / parameters are not available:
- J1939DcmDiagnosticMessageModeRuleRef
- J1939DcmProcessingConditions and all sub containers
- J1939DcmModeCondition and all sub containers
Functional A negative acknowledgement is sent in case PduR_J1939DcmTransmit returns
anything but E_OK instead of retrying the failed transmission from the next main
function.
Caution
Some of the diagnostic messages needs interaction with DEM (see 4.3 Services used
by J1939DCM). If both, J1939 and OBDII, are licensed for DEM, only the interaction for
diagnostic messages DM01, DM02, DM05, DM11, DM22, DM25 and DM27 are
handled correctly by MICROSAR Classic DEM. The following diagnostic messages
which also require an interaction with DEM may be rejected or the response message
may be incorrect:
- DM03, DM04, DM31, DM35, DM53, DM54 and DM55
Other diagnostic messages which require no interaction with DEM are not affected by
this restriction.
3 Integration
This chapter gives necessary information for the integration of the MICROSAR Classic
J1939DCM into an application environment of an ECU.
«include»
Bsw M.h
«include»
«include»
J1939Dcm.h PduR_J1939Dcm.h
«include» «include»
> J1939Dcm_MemResponseTransmit
> J1939Dcm_MemDataTransmit
> J1939Dcm_ProvideTestResultOfDm8
> J1939Dcm_ProvideTestResultOfDm30
> J1939Dcm_ProvideTestResultOfDm58
The exclusive area can be omitted if it is guaranteed that all of these APIs are only called
in the same context and cannot interrupt each other (e.g. when polling is used).
The call-outs must be specified in the configuration tool and implemented in the application
according to chapter 4.5.1
Also a header file with the prototypes of the implemented functions has to be provided. It is
specified via the configuration parameter
> J1939DcmMemAccessHeaderFile
3.3.1 Memory Access Request (DM14)
DM14 is used by a diagnostic tool to request memory access, so the message only needs
to be received.
The J1939DCM directly forwards a reception of DM14 to the application. The function
which shall be used for notification is set by the configuration parameter:
J1939DcmMemRequestIndicationFunc
DM14 received()
start transmission()
transmission complete()
> J1939DcmMemDataStartOfReceptionFunc
> J1939DcmMemDataCopyRxFunc
> J1939DcmMemDataRxIndicationFunc
CAN Bus Routine Routine Routine Memory Access
J1939DcmMemDataStartOfReceptionFunc
J1939DcmMemDataCopyRxFunc J1939DcmMemDataRxIndicationFunc CDD
J1939Dcm_StartOfReception J1939Dcm_CopyRxData J1939Dcm_TpRxIndication
reception started()
copy Rx data()
reception finished()
start transmission()
transmission complete()
Because all functions (for reception and transmission) are shared by DM16, DM17 and
DM18, each API has a DataKind parameter which depends on the according message
contents.
For DM16, this parameter is set to J1939DCM_MEM_DATA_BINARY.
[J1939DCM_MEM_DATA_BOOTLOAD]:
DM17 received()
Because the function is shared by DM16, DM17 and DM18, it has a DataKind parameter
which depends on the according message contents.
For DM17, this parameter is set to J1939DCM_MEM_DATA_BOOTLOAD.
3.3.5 Data Security (DM18)
DM18 is used to transfer security keys and seeds between the ECU and the diagnostic
tool, so it may be received or transmitted.
Reception and transmission works the same way as for DM16 (see 3.3.3, Figure 3-4 and
Figure 3-5).
For DM18, the DataKind parameter provided by each function, is set to
J1939DCM_MEM_DATA_SECURITY.
For these diagnostic messages the J1939DCM provides interfaces (APIs and call-outs to
the application). The following table gives an overview over these interfaces
Figure 3-8 Provide test result for Non-Continuously Monitored Systems: DM8 Sequence
Figure 3-9 Supported Non-Continuously Monitored Systems Test Identifiers: DM10 Sequence
is received from the application the J1939DCM will trigger the transmission to the
diagnostic tool via J1939Tp.
Figure 3-14 Model Year and Certification Engine Family: DM56 Sequence
3.4.10 Provide test result for Rationality Fault SPN Data (DM58)
DM58 is used to report Rationality Fault SPN Data invoked using DM7. The J1939DCM
directly forwards the test results provided by the call to the API
J1939Dcm_ProvideTestResultOfDm58() to the diagnostic tool via J1939Tp. The
application is informed about the result of the transmission of the DM58 by the call-out
J1939Dcm_TestResultTxConfirmation().
Figure 3-16 Provide test result for Rationality Fault SPN Data: DM58 Sequence
4 API Description
For an overview of all interfaces please see Figure 1-2: Interfaces to adjacent modules of
the J1939DCM.
4.1.1 J1939Dcm_CalibrationIDArrayType
Type Name C-Type Description Value Range
J1939Dcm_Calibrati uint8* Calibration ASCII and limited to printable
onIDArrayType identification characters only, except that 0016 used
as padding at the end for a CAL ID less
than 16 bytes.
Table 4-3 J1939Dcm_CalibrationIDArrayType
4.1.2 J1939Dcm_CertificationEngineFamilyNameType
Type Name C-Type Description Value Range
J1939Dcm_Certifica uint8* Certification Engine ASCII and limited to printable
tionEngineFamilyNa Family characters only, except that 0016 used
meType as terminating “null” character. Up to
200 characters may be used.
Table 4-4 J1939Dcm_CertificationEngineFamilyNameType
4.1.3 J1939Dcm_ModelYearType
Type Name C-Type Description Value Range
J1939Dcm_ModelY uint8* Model Year ASCII and limited to printable
earType characters only. Exactly 8 characters
must be provided by the application.
Table 4-5 J1939Dcm_ModelYearType
4.1.4 J1939Dcm_SupportedTestIdentifiersType
Type Name C-Type Description Value Range
J1939Dcm_Support uint8* Supported Test Indicates the test identifiers that the
edTestIdentifiersTyp Identifiers controller supports. Each bit is assigned
e to one test. The application must
provide exactly 8 Bytes.
Table 4-6 J1939Dcm_SupportedTestIdentifiersType
4.2.2 J1939Dcm_DeInit()
Prototype
void J1939Dcm_DeInit ( void )
Parameter
N/A N/A
Return code
void N/A
Functional Description
This function resets the J1939 Diagnostic Communication Manager to the uninitialized state.
Particularities and Limitations
> Service ID = 0x02
> This function is not reentrant
> This function is synchronous
Call context
> This function can be called from any context
Table 4-8 J1939Dcm_DeInit()
4.2.3 J1939Dcm_GetVersionInfo()
Prototype
void J1939Dcm_GetVersionInfo ( Std_VersionInfoType * versioninfo )
Parameter
versioninfo Pointer to address where the version information of the module will be stored.
Return code
void N/A
Functional Description
This function returns the version information of the J1939Dcm module.
The version information includes Module Id, Vendor Id and Vendor specific version numbers.
The version numbers are BCD-coded.
Particularities and Limitations
> Service ID = 0x03
> This function is not reentrant
> This function is synchronous
Call context
> This function can be called from any context
Table 4-9 J1939Dcm_GetVersionInfo()
4.2.4 J1939Dcm_Init()
Prototype
void J1939Dcm_Init ( const J1939Dcm_ConfigType* configPtr )
Parameter
configPtr Pointer to selected configuration structure.
Return code
void N/A
Functional Description
This function initializes the J1939 Diagnostic Communication Manager.
Particularities and Limitations
> Service ID = 0x01
> This function is not reentrant
> This function is synchronous
Call context
> This function can be called from any context
Table 4-10 J1939Dcm_Init()
4.2.5 J1939Dcm_InitMemory()
Prototype
void J1939Dcm_InitMemory ( void )
Parameter
N/A N/A
Return code
void N/A
Functional Description
This function can be used to initialize RAM variables which are part of a VAR_INIT memory section, if this
is not done by the startup code.
Particularities and Limitations
> Service ID = 0x80
> This function is reentrant
> This function is synchronous
Call context
> If this function is needed, it shall be called at startup before J1939Dcm_Init
Table 4-11 J1939Dcm_InitMemory()
4.2.6 J1939Dcm_MainFunction()
Prototype
void J1939Dcm_MainFunction ( void )
Parameter
N/A N/A
Return code
void N/A
Functional Description
Main function of the J1939 Diagnostic Communication Manager. Used for scheduling purposes and timeout
supervision.
Particularities and Limitations
> Service ID = 0x04
> This function is not reentrant
> This function is synchronous
Call context
> This function can be called from any context
Table 4-12 J1939Dcm_MainFunction()
4.2.7 J1939Dcm_SetState()
Prototype
Std_ReturnType J1939Dcm_SetState ( NetworkHandleType channel,
uint8 node,
J1939Dcm_StateType newState )
Parameter
channel Channel for which the state shall be changed.
note Node for which the state shall be changed.
newState New state the J1939DCM shall enter; see definition of
J1939Dcm_StateType for available states.
Return code
Std_ReturnType > E_OK: New communication state was set.
> E_NOT_OK: Communication state was not changed due to wrong value in
NewState or wrong initialization state of the module.
Functional Description
Changes the communication state of J1939DCM to offline or online.
Particularities and Limitations
> Service ID = 0x0B
> This function is reentrant
> This function is synchronous
Call context
> This function can be called from any context
Table 4-13 J1939Dcm_SetState()
4.2.8 J1939Dcm_MemResponseTransmit()
Prototype
Std_ReturnType J1939Dcm_MemResponseTransmit (
J1939Dcm_AddressInfoType* AddressInfo,
J1939Dcm_MemRespParamType* MemResponseParameter )
Parameter
AddressInfo Source / Destination Address and Channel of message to be transmitted.
MemRequestInfo Parameters of the DM15 message to be transmitted.
Return code
Std_ReturnType > E_OK: transmission of DM15 has been started.
> E_NOT_OK: transmission of DM15 failed.
Functional Description
Triggers transmission of a Memory Access Response message (DM15).
When transmission is finished, the function configured as J1939DcmMemResponseTxConfFunc is called.
Particularities and Limitations
> Service ID = 0x50
> This function is not reentrant
> This function is asynchronous
> This function is only available if at least one DM15 message is configured
Call context
> This function can be called from any context
Table 4-14 J1939Dcm_MemResponseTransmit()
4.2.9 J1939Dcm_MemDataTransmit()
Prototype
Std_ReturnType J1939Dcm_MemDataTransmit (
J1939Dcm_MemDataType DataKind,
J1939Dcm_AddressInfoType* AddressInfo,
PduInfoType* PduInfo )
Parameter
DataKind Kind of data to be transmitted; allowed values are:
> J1939DCM_MEM_DATA_BINARY
> J1939DCM_MEM_DATA_SECURITY
AddressInfo Source / Destination Address and Channel of message to be transmitted.
PduInfo Data to be transmitted, specified by pointer and length.
Return code
Std_ReturnType > E_OK: transmission has been started.
> E_NOT_OK: transmission failed.
Functional Description
Triggers transmission of a memory access data message (DM16 or DM18).
When transmission is finished, the function configured as J1939DcmMemDataTxConfFunc is called.
4.2.10 J1939Dcm_ProvideTestResultOfDm8()
Prototype
Std_ReturnType J1939Dcm_ProvideTestResultOfDm8 (
J1939Dcm_AddressInfoType* addressInfo,
PduInfoType* pduInfo )
Parameter
addressInfo1 Source / Destination Address and Channel of the message to be sent.
pduInfo Pointer to the buffer (SduDataPtr) and its length (SduLength) containing
the data to be transmitted by the lower layer module.
Return code
Std_ReturnType > E_OK: Message transmission started.
> J1939DCM_E_BUSY: Transmission currently not possible. Try again in the
next task cycle.
> E_NOT_OK: Node / Channel combination for DM8 is not in state online, or
transmission buffer cannot hold the requested number of bytes, or the
number of bytes to be transmitted is 0.
Functional Description
Starts the transmission of the DM8 message.
Particularities and Limitations
> This function is synchronous
Call context
> This function can be called from any context
Table 4-16 J1939Dcm_ProvideTestResultOfDm8()
4.2.11 J1939Dcm_ProvideTestResultOfDm30()
Prototype
Std_ReturnType J1939Dcm_ProvideTestResultOfDm30 (
J1939Dcm_AddressInfoType* addressInfo,
PduInfoType* pduInfo )
1 SourceAddress contains the address of the node, the DestinationAddress contains the address of the
tester. For details how to setup Source- and DestinationAddress see 4.5.2.1 J1939Dcm_ExecuteTest().
Parameter
addressInfo2 Source / Destination Address and Channel of the message to be sent.
pduInfo Pointer to the buffer (SduDataPtr) and its length (SduLength) containing
the data to be transmitted by the lower layer module.
Return code
Std_ReturnType > E_OK: Message transmission started.
> J1939DCM_E_BUSY: Transmission currently not possible. Try again in the
next task cycle.
> E_NOT_OK: Node / Channel combination for DM30 is not in state online, or
transmission buffer cannot hold the requested number of bytes, or the
number of bytes to be transmitted is 0.
Functional Description
Starts the transmission of the DM30 message.
Particularities and Limitations
> This function is synchronous
Call context
> This function can be called from any context
Table 4-17 J1939Dcm_ProvideTestResultOfDm30()
4.2.12 J1939Dcm_ProvideTestResultOfDm58()
Prototype
Std_ReturnType J1939Dcm_ProvideTestResultOfDm58 (
J1939Dcm_AddressInfoType* addressInfo,
PduInfoType* pduInfo )
Parameter
addressInfo3 Source / Destination Address and Channel of the message to be sent.
pduInfo Pointer to the buffer (SduDataPtr) and its length (SduLength) containing
the data to be transmitted by the lower layer module.
Return code
Std_ReturnType > E_OK: Message transmission started.
> J1939DCM_E_BUSY: Transmission currently not possible. Try again in the
next task cycle.
> E_NOT_OK: Node / Channel combination for DM58 is not in state online, or
transmission buffer cannot hold the requested number of bytes, or the
number of bytes to be transmitted is 0.
Functional Description
Starts the transmission of the DM58 message.
2 SourceAddress contains the address of the node, the DestinationAddress contains the address of the
tester. For details how to setup Source- and DestinationAddress see 4.5.2.1 J1939Dcm_ExecuteTest().
3 SourceAddress contains the address of the node, the DestinationAddress contains the address of the
tester. For details how to setup Source- and DestinationAddress see 4.5.2.1 J1939Dcm_ExecuteTest().
4.4.2 J1939Dcm_CopyTxData()
Prototype
BufReq_ReturnType J1939Dcm_CopyTxData ( PduIdType id,
PduInfoType* info,
RetryInfoType* retry,
PduLengthType* availableDataPtr )
Parameter
id Identification of the transmitted I-PDU.
info Provides the destination buffer and the number of bytes to be copied.
If not enough transmit data is available, no data is copied. The transport
protocol module may retry.
A copy size of 0 can be used to indicate state changes in the retry parameter.
4.4.3 J1939Dcm_StartOfReception()
Prototype
BufReq_ReturnType J1939Dcm_StartOfReception ( PduIdType id,
PduInfoType* info,
PduLengthType TpSduLength,
PduLengthType* bufferSizePtr )
Parameter
id Identification of the I-PDU.
info Pointer to a PduInfoType structure containing the payload data (without
protocol information) and payload length of the first frame or single frame of a
transport protocol I-PDU reception. Depending on the global parameter
MetaDataLength, additional bytes containing MetaData (e.g. CAN ID) are
appended after the payload data.
TpSduLength Total length of the N-SDU to be received.
bufferSizePtr Available receive buffer in the receiving module. This parameter will be used to
compute the Block Size (BS) in the transport protocol module.
Return code
BufReq_ReturnType > BUFREQ_OK: Connection has been accepted, bufferSizePtr indicates the
available receive buffer; reception is continued.
> BUFREQ_E_NOT_OK: Connection has been rejected; reception is aborted,
bufferSizePtr remains unchanged.
> BUFREQ_E_OVFL: No buffer of the required length can be provided,
reception is aborted. bufferSizePtr remains unchanged.
Functional Description
This function is called at the start of receiving an N-SDU.
The N-SDU might be fragmented into multiple N-PDUs (FF with one or more following CFs) or might
consist of a single N-PDU (SF).
Particularities and Limitations
> Service ID = 0x46
> This function is reentrant
> This function is synchronous
Call context
> This function can be called from any context
Table 4-22 J1939Dcm_StartOfReception()
4.4.4 J1939Dcm_RxIndication()
Prototype
void J1939Dcm_RxIndication ( PduIdType id,
const PduInfoType* PduInfoPtr )
Parameter
id Identification of the received I-PDU.
PduInfoPtr Contains the length (SduLength) of the received I-PDU and a pointer to
a buffer (SduDataPtr) containing the I-PDU.
Return code
void N/A
Functional Description
Called after an I-PDU has been received via the IF API, the result indicates whether the reception was
successful or not.
4.4.5 J1939Dcm_TpRxIndication()
Prototype
void J1939Dcm_TpRxIndication ( PduIdType id, Std_ReturnType result )
Parameter
id Identification of the received I-PDU.
result Result of the reception.
Return code
void N/A
Functional Description
Called after an I-PDU has been received via the TP API, the result indicates whether the reception was
successful or not.
Particularities and Limitations
> Service ID = 0x45
> This function is reentrant
> This function is synchronous
Call context
> This function can be called from any context
Table 4-24 J1939Dcm_TpRxIndication()
4.4.6 J1939Dcm_TpTxConfirmation()
Prototype
void J1939Dcm_TpTxConfirmation ( PduIdType id, Std_ReturnType result )
Parameter
id Identification of the transmitted I-PDU.
result Result of the transmission.
Return code
void N/A
Functional Description
This function is called after the I-PDU has been transmitted via the TP API, the result indicates whether the
transmission was successful or not.
4.4.7 J1939Dcm_TxConfirmation()
Prototype
void J1939Dcm_TxConfirmation ( PduIdType id )
Parameter
id Identification of the transmitted I-PDU.
Return code
void N/A
Functional Description
This function is called after the I-PDU has been transmitted via the IF API to indicate that the transmission
has been completed.
Particularities and Limitations
> Service ID = 0x40
> This function is reentrant
> This function is synchronous
Call context
> This function can be called from any context
Table 4-26 J1939Dcm_TxConfirmation()
4.4.8 J1939Dcm_DemTriggerOnDTCStatus ()
Prototype
void J1939Dcm_DemTriggerOnDTCStatus ( uint32 DTC, uint8 ClientId )
Parameter
DTC Diagnostic Trouble Code in UDS format.
ClientId Dem client Id of a specific node.
Return code
void N/A.
Functional Description
Indicates changes of an UDS DTC status byte. This function is called by the DEM and triggers transmission
of a non periodic DM1 message.
4.5.1.2 J1939DcmMemResponseTxConfFunc
Prototype
void [J1939DcmMemResponseTxConfFunc] ( Std_ReturnType Result )
Parameter
Result > E_OK: DM15 has been transmitted.
> E_NOT_OK: DM15 transmission failed.
Return code
void N/A
Functional Description
Informs the application that a transmission started with J1939Dcm_MemResponseTransmit() is
complete.
Particularities and Limitations
> This function must be reentrant
> At least one DM15 message must be configured
Call context
> This function can be called from any context
Table 4-29 J1939DcmMemResponseTxConfFunc
4.5.1.3 J1939DcmMemDataStartOfReceptionFunc
Prototype
BufReq_ReturnType [J1939DcmMemDataStartOfReceptionFunc] (
J1939Dcm_MemDataType DataKind,
J1939Dcm_AddressInfoType* AddressInfo,
PduLengthType TpSduLength,
PduLengthType* BufferSizePtr )
Parameter
DataKind Kind of data which is received; it can be:
> J1939DCM_MEM_DATA_BINARY
> J1939DCM_MEM_DATA_SECURITY
AddressInfo Source / Destination Address and Channel of the received message.
TpSduLength Overall length of message which is received.
BufferSizePtr Size of available receive buffer in the receiving module.
Return code
BufReq_ReturnType > BUFREQ_OK: Connection has been accepted, bufferSizePtr indicates the
available receive buffer; reception is continued.
> BUFREQ_E_NOT_OK: Connection has been rejected, reception is aborted.
> BUFREQ_E_OVFL: No buffer of the required length can be provided,
reception is aborted.
Functional Description
Informs the application that reception of a memory access data message has started.
4.5.1.4 J1939DcmMemDataCopyRxFunc
Prototype
BufReq_ReturnType [J1939DcmMemDataCopyRxFunc] (
J1939Dcm_MemDataType DataKind,
J1939Dcm_AddressInfoType* AddressInfo,
const PduInfoType* PduInfo,
PduLengthType* BufferSizePtr )
Parameter
DataKind Kind of data which is received; it can be:
> J1939DCM_MEM_DATA_BINARY
> J1939DCM_MEM_DATA_SECURITY
AddressInfo Source / Destination Address and Channel of the received message.
PduInfo Pointer to the buffer (SduDataPtr) and its length (SduLength) containing the
data to be copied by the upper layer module.
BufferSizePtr Available receive buffer after data has been copied.
Return code
BufReq_ReturnType > BUFREQ_OK: Data copied successfully.
> BUFREQ_E_NOT_OK: Data was not copied because an error occurred.
Functional Description
Request the application to copy data of a received memory access data message.
Particularities and Limitations
> This function must be reentrant
> At least one DM16 or DM18 message must be configured
Call context
> This function can be called from any context
Table 4-31 J1939DcmMemDataCopyRxFunc
4.5.1.5 J1939DcmMemDataRxIndicationFunc
Prototype
void [J1939DcmMemDataRxIndicationFunc] (
J1939Dcm_MemDataType DataKind,
J1939Dcm_AddressInfoType* AddressInfo,
const PduInfoType* PduInfo,
Std_ReturnType Result )
Parameter
DataKind Kind of data which is received; it can be:
> J1939DCM_MEM_DATA_BINARY
> J1939DCM_MEM_DATA_BOOTLOAD
> J1939DCM_MEM_DATA_SECURITY
AddressInfo Source / Destination Address and Channel of the received message.
PduInfo Pointer to the buffer (SduDataPtr) and its length (SduLength) containing the
data received data.
Note: this parameter is only valid when DataKind is
J1939DCM_MEM_DATA_BOOTLOAD
Result > E_OK: data message has been received successfully.
> E_NOT_OK: receive error after StartOfReception has been indicated.
Return code
void N/A
Functional Description
Notify the application that the reception of a memory access data message is complete.
Particularities and Limitations
> This function must be reentrant
> At least one DM16, DM17 or DM18 message must be configured
Call context
> This function can be called from any context
Table 4-32 J1939DcmMemDataRxIndicationFunc
4.5.1.6 J1939DcmMemDataTxConfFunc
Prototype
void [J1939DcmMemDataTxConfFunc] ( J1939Dcm_MemDataType DataKind,
Std_ReturnType Result )
Parameter
DataKind Kind of data which has been transmitted; it can be:
> J1939DCM_MEM_DATA_BINARY
> J1939DCM_MEM_DATA_SECURITY
Result > E_OK: data message has been transmitted.
> E_NOT_OK: data message transmission failed.
Return code
void N/A
Functional Description
Informs the application that a transmission started with J1939Dcm_MemDataTransmit() is complete.
Note
SourceAddress contains the address of the tester.
DestinationAddress contains the address of the node.
Therefore, it is required to use the SourceAddress from the parameter addressInfo and
use it as DestinationAddress when one of API functions
J1939Dcm_ProvideTestResultOfDm8() or J1939Dcm_ProvideTestResultOfDm58() is
used to send the response to tester. The same is applicable for the DestinationAddress
(see example below).
Example:
Std_ReturnType J1939Dcm_ExecuteTest(
uint8 tid,
uint32 spn,
uint8 fmi,
P2CONST(J1939Dcm_AddressInfoType, AUTOMATIC, J1939DCM_APPL_DATA) addressInfo)
{
J1939Dcm_AddressInfoType lResponseAddressInfo;
PduInfoType lResponseData;
return E_OK;
}
4.5.2.2 J1939Dcm_GetCalibrationVerificationNumber()
Prototype
Std_ReturnType J1939Dcm_GetCalibrationVerificationNumber (
uint8 nodeAddress,
uint32* calibrationVerificationNumber,
J1939Dcm_CalibrationIDArrayType calibrationID )
Parameter
nodeAddress5 Address of the node from which the calibration information has to be read.
calibrationVerifi- Pointer to which the application can write the calibration verification number.
cationNumber
calibrationID6 Pointer to which the application can write the calibration ID. The size of the
calibration ID is limited to 16 bytes. The application must not write more than
16 bytes to this pointer.
Return code
- > E_OK: Calibration Verification Number available. No more Calibration
Verification Numbers available.
> J1939DCM_E_NOT_READY: Calibration Verification Number not calculated.
Retry again later.
> J1939DCM_E_NEXT: Calibration Verification Number available. More
Calibration Verification Numbers available.
Functional Description
Reads a pair of Calibration Verification Number (CVN) and Calibration Identification (CAL ID) for the
specified node.
Particularities and Limitations
> This function is asynchronous
Call context
> This function is called from task context
> DM19 must be configured
Table 4-35 J1939Dcm_GetCalibrationVerificationNumber()
4.5.2.3 J1939Dcm_GetDeviceActiveTime()
Prototype
Std_ReturnType J1939Dcm_GetDeviceActiveTime ( uint8 nodeAddress,
uint8* eiaecdNumber,
uint32* eiaecdTimer1,
uint32* eiaecdTimer2 )
Parameter
nodeAddress Address of the node from which the device active time has to be read.
eiaecdNumber Pointer to address where the EI-AECD Number will be stored.
eiaecdTimer1 Pointer to address where the engine runtime 1 will be stored.
eiaecdTimer2 Pointer to address where the engine runtime 2 will be stored.
Return code
Std_ReturnType > E_OK: EI-AECD Number available. No more EI-AECD Numbers available.
> J1939DCM_E_NEXT: EI-AECD Number available. More EI-AECD Numbers
available.
Functional Description
Reads the engine runtimes for the DM33.
Particularities and Limitations
> This function is asynchronous
> If the application does not utilize EI-AECDs, the application has to return E_OK for the first call of this
function and has to set the values:
- eiaecdNumber to FB16
- eiaecdTimer1 to 0
- eiaecdTimer2 to 0
> DM33 must be configured
Call context
> This function is called from task context
Table 4-36 J1939Dcm_GetDeviceActiveTime()
4.5.2.4 J1939Dcm_GetModelYear()
Prototype
Std_ReturnType J1939Dcm_GetModelYear (
uint8 nodeAddress,
J1939Dcm_ModelYearType modelYear,
J1939Dcm_CertificationEngineFamilyNameType certificationEngineFamilyName,
uint16* bufferLength )
Parameter
nodeAddress Address of the node from which the Model Year and Certification
Engine Family has to be read.
modelYear Pointer to address where the Model Year will be stored.
certificationEngineFamilyName Pointer to address where the Vehicle and Regulated Family Name
will be stored.
bufferLength In: Size of the buffer available for Vehicle and Regulated Family
Name. The application must not write more bytes to the
provided pointer certificationEngineFamilyName.
Out: Number of bytes written by application for Vehicle and
Regulated Family Name.
Return code
Std_ReturnType > E_OK: Call successful. Model Year and Certification Engine
Family provided.
> E_NOT_OK: Function call not successful.
Functional Description
Gets the Model Year and Certification Engine Family for the DM56.
Particularities and Limitations
> This function is synchronous
> DM56 must be configured
Call context
> This function is called from task context
Table 4-37 J1939Dcm_GetModelYear()
4.5.2.5 J1939Dcm_GetNteStatus()
Prototype
Std_ReturnType J1939Dcm_GetNteStatus ( uint8 nodeAddress,
J1939Dcm_NteStatusType* nteStatus )
Parameter
nodeAddress Address of the node from which the NTE status has to be read.
4.5.2.6 J1939Dcm_GetObdInformation()
Prototype
Std_ReturnType J1939Dcm_GetObdInformation (
uint8 nodeAddress,
J1939Dcm_EngineWarmupSequenceType* engineWarmupSequence )
Parameter
nodeAddress Address of the node from which the OBD Information has to be
read.
engineWarmupSequence Pointer to address where the OBD Information will be stored.
Return code
Std_ReturnType > E_OK: Call successful. OBD Information provided.
> E_NOT_OK: Function call not successful.
Functional Description
Gets the OBD Information for the DM57.
Particularities and Limitations
> This function is synchronous
> DM57 must be configured
Call context
> This function is called from task context
Table 4-39 J1939Dcm_GetObdInformation()
4.5.2.7 J1939Dcm_GetSupportedTestIdentifiers()
Prototype
Std_ReturnType J1939Dcm_GetSupportedTestIdentifiers(
uint8 nodeAddress,
J1939Dcm_SupportedTestIdentifiersType* supportedTestIdentifiers )
Parameter
nodeAddress Address of the node from which the Supported Non-Continuously
Monitored Systems Test Identifiers has to be read.
supportedTestIdentifiers Pointer to address where the bit mask for the Supported Non-
Continuously Monitored Systems Test Identifiers will be stored.
The size of the bit mask for the Supported Non-Continuously
Monitored Systems Test Identifiers is limited to 8 bytes. The
application must not write more than 8 bytes to this pointer.
Return code
Std_ReturnType > E_OK: Call successful. Bit mask fort the Supported Non-
Continuously Monitored Systems Test Identifiers provided.
> E_NOT_OK: Function call not successful.
Functional Description
Gets the Supported Non-Continuously Monitored Systems Test Identifiers for the DM10.
Particularities and Limitations
> This function is synchronous
> DM10 must be configured
Call context
> This function is called from task context
Table 4-40 J1939Dcm_GetSupportedTestIdentifiers()
4.5.2.8 J1939Dcm_TestResultTxConfirmation()
Prototype
void J1939Dcm_TestResultTxConfirmation ( Std_ReturnType result )
Parameter
result > E_OK: Message has been transmitted.
> E_NOT_OK: Message transmission failed.
Return code
void N/A
Functional Description
Informs the application about the result of the transmission of DM8 / DM58 message.
Particularities and Limitations
> This function is synchronous
> At least one DM8 or DM58 message must be configured
Call context
> This function is called from task context
Table 4-41 J1939Dcm_TestResultTxConfirmation()
5 Configuration
In the J1939DCM the attributes can be configured according to/with the following
methods/tools:
> DaVinci Configurator
Caution
For configurations supporting VARIANT-POST-BUILD-LOADABLE or VARIANT-
POST-BUILD-LOADABLE-SELECTABLE, all supported DMs will be automatically
enabled, even if the DMs are not configured, allowing to add DMs later using the
POST-BUILD-LOADABLE feature. Not configured OBD II relevant DMs and the DM24
are excluded from this behavior by default.
If all supported OBD II relevant DMs shall be available for the POST-BUILD-
LOADABLE feature, this can be achieved by enabling the parameter:
/J1939Dcm/J1939DcmGeneral/J1939DcmEnableObdIIForPBL
If DM24 shall be available for the POST-BUILD-LOADABLE feature, this can be
achieved by enabling the parameter:
/J1939Dcm/J1939DcmGeneral/J1939DcmEnableDm24ForPBL
This chapter shall give some examples and hints, how to handle common use cases of the
J1939Dcm.
The length of the Meta Data can be configured with the configuration parameter:
/EcuC/EcucPduCollection/Pdu/MetaDataLength
The Meta Data is relevant for the reception of the diagnostic messages DM7, DM13,
DM14, DM16, DM17 and DM18. Two configuration parameters are available to derive the
source address and the destination address in case that the Meta Data does not provide
this information.
If a Diagnostic message is received in standard CAN frame (11 bit), it is automatically
treated as broadcast message. To override this behavior the following parameter can be
used. This parameter can be automatically derived by a solving action from CanIf
component.
/J1939Dcm/J1939DcmConfigSet/J1939DcmNode/J1939DcmDiagnosticMessageSupport/J
1939DcmRxPdu/J1939DcmRxPduBroadcast
The following parameter contains the source address which is used by the J1939Dcm in
case the Meta Data does not provide the source address (Meta Data length = 0). It can be
derived by a solving action from CanIf component.
/J1939Dcm/J1939DcmConfigSet/J1939DcmNode/J1939DcmDiagnosticMessageSupport/J
1939DcmRxPdu/J1939DcmRxPduSourceAddress
The following table shows how the J1939Dcm determines the Source Address (SA) and
the Destination Address (DA) for the different Meta Data Length cases:
Meta Data J1939Dcm Source Address Destination Address
Length RxPduBroadcast
0 False J1939DcmRxPduSourceAddress Own node Address
0 True J1939DcmRxPduSourceAddress Broadcast Address 0xFF
1 False SA from Meta Data Own node Address
1 True SA from Meta Data Broadcast Address 0xFF
>1 Don’t care SA from Meta Data DA from Meta Data
Table 6-3 Derivation of source and destination address
Note
The Meta Data Length 0 is only allowed for the Diagnostic Messages DM7, DM13,
DM14 and DM17.
▪ If the request is received on Channel 0, the DTC will be cleared only on Node B.
▪ If the request is received on Channel 1, the DTC will be cleared on all Nodes.
▪ If the request is received on Channel 2, the DTC will be cleared on Node A and Node C.
▪ If the request is received on Channel 3, the DTC will be cleared only on Node A.
7.1 Glossary
Term Description
DaVinci Configurator Configuration tool for MICROSAR Classic 4 components.
J1939 SAE Standard for vehicle communication, especially used in commercial
vehicles like trucks and tractors.
Table 7-1 Glossary
7.2 Abbreviations
Abbreviation Description
API Application Programming Interface
AUTOSAR Automotive Open System Architecture
BSW Basis Software
BSWMD Basis Software Module Description
CAN Controller Area Network
CDD Complex Device Driver
CF Consecutive Frame
DBC Data Base CAN
DCM Diagnostic Communication Manager
DEM Diagnostic Event Manager
DET Development Error Tracer
DM Diagnostic Message
DTC Diagnostic Trouble Code
ECU Electronic Control Unit
EDCP Error Detection and/or Correction Parameter
EI-AECD Emission Increasing Auxiliary Emission Control Device
FF First Frame (in the context of transport protocol communication)
Freeze Frame (in the context of failure storage)
ID Identifier
IF Interface
MICROSAR Microcontroller Open System Architecture (the Vector AUTOSAR solution)
NTE Not-To-Exceed
OBD On-board diagnostics
PDU Protocol Data Unit
PduR PDU-Router
PG Parameter Group
PGN Parameter Group Number
PM Particulate Matter
RTE Runtime Environment
SAE Society of Automotive Engineers
SDU Service Data Unit
SF Single Frame
SPN Suspect Parameter Number
SRS Software Requirement Specification
SWC Software Component
SWS Software Specification
TP Transport Protocol
UDS Unified Diagnostic Services
Table 7-2 Abbreviations
8 Contact
> News
> Products
> Demo software
> Support
> Training data
> Addresses
www.vector.com