Specification Of A Transport Layer For SAE J1939 - AUTOSAR

Transcription

Specification of a Transport Layer for SAE J1939AUTOSAR Release 4.2.2Document TitleSpecification of a TransportLayer for SAE J1939Document OwnerDocument ResponsibilityDocument Identification NoDocument ClassificationAUTOSARAUTOSAR425StandardDocument StatusPart of AUTOSAR ReleaseFinal4.2.2Document Change HistoryRelease Changed by4.2.2 AUTOSARReleaseManagement4.2.1 AUTOSARReleaseManagement4.1.3 AUTOSARReleaseManagement4.1.2 AUTOSARReleaseManagementChange Description Fixed retry behavior Clarified effect of MetaData on SA/DA/Protocol Introduction of further error classes Removed obsolete configuration elements Harmonized with SWS BSW General on4.0.2AUTOSARAdministration 4.0.1AUTOSARAdministration 1 of 81Allow for parallel reception via TP (BAM/CMDT)and directlyClarified ambiguities regarding CTS parametersNotifResultType replaced by StdReturnTypeAdditional development errors for protocolproblemsConnection parameters moved to channelconfigurationEditorial changesRemoved chapter(s) on change documentationSupport for dynamic CAN IDs via MetaDataSupport for variable block size and retryTP API improvements and fixesAdapted to new BSW GeneralAPI changes: CancelTransmit, CancelReceive,and ChangeParameter were changed tosynchronous behaviorFixed service API IDsRemoved duplicate requirement J1939TP0099Clarified requirements SWS J1939Tp 00125and SWS J1939Tp 00189Initial releaseDocument ID 425: AUTOSAR SWS SAEJ1939TransportLayer- AUTOSAR confidential -

Specification of a Transport Layer for SAE J1939AUTOSAR Release 4.2.2DisclaimerThis specification and the material contained in it, as released by AUTOSAR, is forthe purpose of information only. AUTOSAR and the companies that have contributedto it shall not be liable for any use of the specification.The material contained in this specification is protected by copyright and other typesof Intellectual Property Rights. The commercial exploitation of the material containedin this specification requires a license to such Intellectual Property Rights.This specification may be utilized or reproduced without any modification, in any formor by any means, for informational purposes only. For any other purpose, no part ofthe specification may be utilized or reproduced, in any form or by any means, withoutpermission in writing from the publisher.The AUTOSAR specifications have been developed for automotive applications only.They have neither been developed, nor tested for non-automotive applications.The word AUTOSAR and the AUTOSAR logo are registered trademarks.Advice for usersAUTOSAR specifications may contain exemplary items (exemplary referencemodels, "use cases", and/or references to exemplary technical solutions, devices,processes or software).Any such exemplary items are contained in the specifications for illustration purposesonly, and they themselves are not part of the AUTOSAR Standard. Neither theirpresence in such specifications, nor any later documentation of AUTOSARconformance of products actually implementing such exemplary items, imply thatintellectual property rights covering such exemplary items are licensed under thesame rules as applicable to the AUTOSAR Standard.2 of 81Document ID 425: AUTOSAR SWS SAEJ1939TransportLayer- AUTOSAR confidential -

Specification of a Transport Layer for SAE J1939AUTOSAR Release 4.2.2Table of Contents1Introduction and Functional Overview . 62Glossary, Acronyms, and Abbreviations . 83Related Documentation . 103.13.23.34Input Documents . 10Related Standard Documents . 11Related specification . 11Constraints and Assumptions . 124.14.25Limitations . 12Applicability to Automotive Domains. 12Module Architecture. 135.1 Dependencies on Other Modules . 135.2 File Structure . 135.2.1 Code File Structure . 145.2.2 Header File Structure . 146Requirements Traceability . 167Functional Specification. 227.1 Basic Principles of SAE J1939 . 227.2 Basic Functionality of J1939Tp . 237.3 Initialization and Shutdown . 247.4 Communication with the Lower Layer. 257.4.1 Transmission Confirmation . 257.4.2 Reception Indication . 267.5 Internal Behavior . 267.5.1 Session Handling . 267.5.1.1 Close Transmission . 267.5.1.2 Abort Transmission . 267.5.1.3 Close Reception . 267.5.1.4 Abort Reception . 267.5.1.5 Abort CMDT Connection . 267.5.2 N-SDU Reception . 277.5.3 N-SDU Transmission . 287.5.4 Data Flow on the CAN Bus . 307.5.4.1 Data Flow using Direct Transmission . 307.5.4.2 Data Flow using CMDT . 307.5.4.3 Data Flow using BAM . 347.5.5 N-SDU Buffer Management . 357.5.6 Relationship between N-SDU and N-PDU in J1939Tp . 367.5.7 Concurrent Connections . 377.5.8 N-PDU Padding . 387.5.9 Handling of Unexpected N-PDU Arrivals . 387.6 Error Classification . 387.6.1 Development Errors . 387.6.2 Runtime Errors . 393 of 81Document ID 425: AUTOSAR SWS SAEJ1939TransportLayer- AUTOSAR confidential -

Specification of a Transport Layer for SAE J1939AUTOSAR Release 4.2.27.6.3 Transient Faults . 397.6.4 Production Errors . 397.6.5 Extended Production Errors . 407.7 API Parameter Checking . 408API Specification . 418.1 Imported Types . 418.2 Type Definitions . 418.3 Function Definitions . 418.3.1 J1939Tp Init . 418.3.2 J1939Tp Shutdown . 438.3.3 J1939Tp GetVersionInfo . 438.3.4 J1939Tp Transmit . 448.3.5 J1939Tp CancelTransmit . 458.3.6 J1939Tp CancelReceive . 458.3.7 J1939Tp ChangeParameter . 468.4 Callback Notifications . 478.4.1 J1939Tp RxIndication . 478.4.2 J1939Tp TxConfirmation . 478.5 Scheduled Functions . 488.5.1 J1939Tp MainFunction . 488.6 Expected Interfaces . 488.6.1 Mandatory Interfaces . 488.6.2 Optional Interfaces . 499Sequence Diagrams . 509.19.29.39.49.59.69.710Reception of Direct PG . 50Reception via BAM . 50Reception via CMDT . 51Transmission of Direct PG . 52Transmission via BAM . 53Transmission via CMDT . 54Handling of Retry during CMDT Transmission . 55Configuration Specification . 5710.1How to Read this Chapter . 5710.2Containers and Configuration Parameters . 5710.2.1J1939Tp. 6210.2.2J1939TpGeneral . 6210.2.3J1939TpConfiguration . 6410.2.4J1939TpRxChannel . 6410.2.5J1939TpRxCmNPdu . 6810.2.6J1939TpRxDtNPdu . 6810.2.7J1939TpRxPg . 6910.2.8J1939TpRxDirectNPdu . 7010.2.9J1939TpRxNSdu . 7110.2.10 J1939TpTxFcNPdu . 7110.2.11 J1939TpTxChannel . 7210.2.12 J1939TpRxFcNPdu . 7510.2.13 J1939TpTxCmNPdu . 7610.2.14 J1939TpTxDtNPdu . 774 of 81Document ID 425: AUTOSAR SWS SAEJ1939TransportLayer- AUTOSAR confidential -

Specification of a Transport Layer for SAE J1939AUTOSAR Release 4.2.210.2.15 J1939TpTxPg . 7810.2.16 J1939TpTxDirectNPdu . 7810.2.17 J1939TpTxNSdu . 7910.3Published Information. 80115 of 81Not applicable requirements . 81Document ID 425: AUTOSAR SWS SAEJ1939TransportLayer- AUTOSAR confidential -

Specification of a Transport Layer for SAE J1939AUTOSAR Release 4.2.21Introduction and Functional OverviewThis specification describes the functionality, the API, and the configuration of theAUTOSAR Basic Software module J1939Tp, which implements an SAE J1939compatible transport layer for AUTOSAR. The terms J1939Tp and J1939 TransportLayer module are used synonymously in this document.SAE J1939 has a broad acceptance in the truck domain, and consists of severaldocuments describing the layers of the communication protocol from the physicallayer to diagnostics and the application layer. SAE J1939-21 describes the data linkand transport layer, which includes two transport protocol variants:BAM (Broadcast Announce Message) for broadcast messages, andCMDT (Connection Mode Data Transfer) for point-to-point connections.This specification defines how the transport protocol of SAE J1939-21 can beimplemented in the AUTOSAR architecture. It only describes those parts of theimplementation that are relevant to the AUTOSAR architecture. Protocol specificdetails like exact timings are not part of this specification. Therefore, to be able toimplement the J1939 Transport Layer module, the reader of this specification musthave access to the original SAE J1939-21specification document.The module J1939Tp interfaces to the PDU Router and the CAN Interface, as shownin the following figure:Figure 1-1 : AUTOSAR Communication StackThe purpose of J1939Tp is to segment and reassemble J1939 PGNs (N-SDUs) thatare longer than 8 bytes. The segmented messages are sent and received via theCAN Interface.6 of 81Document ID 425: AUTOSAR SWS SAEJ1939TransportLayer- AUTOSAR confidential -

Specification of a Transport Layer for SAE J1939AUTOSAR Release 4.2.2The PDU-Router (PduR) deploys AUTOSAR COM and DCM I-PDUs onto differentcommunication protocols (e.g. CAN or J1939, segmented via transport layer ordirectly). At runtime, the PduR decides where to route I-PDUs based on the I-PDU(L-SDU or N-SDU) identifier. In the same way, the CanIf uses the L-SDU (I-PDU orN-PDU) identifier to decide whether a received message must be processed by oneof the available transport layer modules or may be forwarded directly to the PduR.J1939Tp supports fixed and variable size N-SDUs (I-PDUs) with more than 8 bytes.I-PDUs that do not exceed 8 bytes are exchanged directly between PduR and CanIf.Fixed size N-SDUs are always segmented by the J1939Tp, while variable size NSDUs are only segmented when they exceed 8 bytes. J1939Tp forwards variablesize N-SDUs with an actual size of 8bytes or less and a configured maximum size ofmore than 8 bytes directly to the CanIf. The transport protocol variant (BAM orCMDT) is chosen based on received N-PDUs when a large N-SDU is received, andon the configuration and the actual DA when a large N-SDU is transmitted.J1939Tp supports handling of N-PDUs and N-SDUs with variable SA, DA, andPriority. In this case, the N-PDUs and N-SDUs will contain parts of the CAN ID in theMetaData (attached to the payload).In summary, J1939Tp provides the following functionality:- Segmentation and direct transmission of data in transmit direction- Reassembling and direct reception of data in receive direction- Control of data flow- Timeout supervision- Detection of errors during segmentation or reassembly7 of 81Document ID 425: AUTOSAR SWS SAEJ1939TransportLayer- AUTOSAR confidential -

Specification of a Transport Layer for SAE J1939AUTOSAR Release 4.2.22Glossary, Acronyms, and AbbreviationsThe following table presents a glossary of J1939 specific terms. For all other terms,please check the AUTOSAR Glossary.Glossary TermAddress ClaimingJ1939 DiagnosticsParameterParameter GroupTransport Protocol8 of 81ExplanationAddress Claiming forms the network management of SAE J1939defined in the standard document SAE J1939/81. Address claimingassigns a temporary 8-bit identifier to each ECU connected to oneJ1939 network. Within this network, the 8-bit identifier is unique. The 8bit identifier is used as source and target address of parameter groups(messages) transferred via the J1939 network. The address claimingprocedure is based on the exchange of AddressClaimed messages(PGN 00EE00).The SAE J1939 diagnostic layer is defined in the standard documentSAE J1939/73. The J1939 diagnostics is functionally similar to the UDSdiagnostics, and has recently been extended to support OBD foremission relevant values.A parameter is a signal of the SAE J1939 application layer. Parametersare uniquely identified by the SPN.A parameter group is a message of the SAE J1939 application layer.Each parameter group contains several parameters (signals), and isuniquely identified by the PGN.The SAE J1939 transport protocol is used for the segmentedtransmission of messages with more than 8 bytes of data. The transportprotocol is defined in the network layer standard document (SAEJ1939/21).Document ID 425: AUTOSAR SWS SAEJ1939TransportLayer- AUTOSAR confidential -

Specification of a Transport Layer for SAE J1939AUTOSAR Release 4.2.2The following table lists acronyms and abbreviations that are specific to the J1939transport layer. For all other abbreviations, please check the AUTOSAR Glossaryand the AUTOSAR BSW Module List.Acronym /AbbreviationBAMDescriptionBroadcast Announce Message, broadcast variant of SAE J1939transport protocolCMDTConnection Mode Data Transfer, peer-to-peer variant of SAE J1939transport protocolDADestination Address, part of the 29 bit identifier of SAE J1939messagesDETDefault Error Tracer, supports development and runtime error reportingDMxDiagnostic messages of the SAE J1939 diagnostics layerNAMEUnique 64 bit identifier of each ECU connected to an SAE J1939networkPDUFPDU Format, part of the 29 bit identifier of SAE J1939 messages whichidentifies the message and determines the layout of the 29 bit identifierPDUSPDU Specific, part of the 29 bit identifier of SAE J1939 messages whichidentifies broadcast messages which do not have a destination addressPGParameter Group, SAE J1939 term for a specific message layout,corresponds to an N-SDU of J1939TpPGNParameter Group Number, unique identifier of an SAE J1939 parametergroupSASource Address, part of the 29 bit identifier of SAE J1939 messagesSPNSuspect Parameter Number, unique identifier of an SAE J1939parameterTP.CMConnection Management message (PGN 00EC00) used by SAE J1939transport protocol, corresponds to an N-PDU of J1939TpTP.CM BAMBroadcast Announce Message, variant of TP.CM that initiates a BAMtransmissionTP.CM CTSConnection Mode Clear To Send, variant of TP.CM that is used forhandshake during CMDT transmissionTP.CM EndOfMsg End Of Message Acknowledge, variant of TP.CM that acknowledgesAckcorrect reception of a CMDT transmissionTP.CM RTSConnection Mode Request To Send, variant of TP.CM that initiates aCMDT transmissionTP.Conn AbortConnection Abort, variant of TP.CM that terminates a CMDTtransmissionTP.DTData Transfer message (PGN 00EB00) used by SAE J1939 transportprotocol, corresponds to an N-PDU of J1939Tp9 of 81Document ID 425: AUTOSAR SWS SAEJ1939TransportLayer- AUTOSAR confidential -

Specification of a Transport Layer for SAE J1939AUTOSAR Release 4.2.23Related Documentation3.1 Input Documents[1] List of Basic Software ModulesAUTOSAR TR BSWModuleList.pdf[2] Layered Software ArchitectureAUTOSAR EXP LayeredSoftwareArchitecture.pdf[3] General Requirements on Basic Software ModulesAUTOSAR SRS BSWGeneral.pdf[4] Specification of COMAUTOSAR SWS COM.pdf[5] Requirements on CANAUTOSAR SRS CAN.pdf[6] Specification of CAN InterfaceAUTOSAR SWS CANInterface.pdf[7] Requirements on a Transport Layer for SAE J1939AUTOSAR SRS SAEJ1939TransportLayer.pdf[8] Specification of PDU RouterAUTOSAR SWS PDURouter.pdf[9] Specification of BSW SchedulerAUTOSAR SWS Scheduler.pdf[10] Specification of Default Error TracerAUTOSAR SWS DefaultErrorTracer.pdf[11] Basic Software Module Description TemplateAUTOSAR SRS BSWGeneral.pdf[12] Specification of ECU ConfigurationAUTOSAR TPS ECUConfiguration.pdf[13] Specification of System TemplateAUTOSAR TPS SystemTemplate.pdf[14] Specification of Memory MappingAUTOSAR SWS MemoryMapping.pdf[15] General Specification of Basic Software ModulesAUTOSAR SWS BSWGeneral.pdf10 of 81Document ID 425: AUTOSAR SWS SAEJ1939TransportLayer- AUTOSAR confidential -

Specification of a Transport Layer for SAE J1939AUTOSAR Release 4.2.23.2 Related Standard Documents[16]SAE J1939-21(2006-12), Data Link Layer[17]SAE J1939-7x(2006-xx), Application Layer3.3 Related specificationAUTOSAR provides a General Specification of Basic Software modules [15] (SWSBSW General), which is also valid for SAE J1939 Transport Layer.Thus, the specification SWS BSW General shall be considered as additional andrequired specification for SAE J1939 Transport Layer.11 of 81Document ID 425: AUTOSAR SWS SAEJ1939TransportLayer- AUTOSAR confidential -

Specification of a Transport Layer for SAE J1939AUTOSAR Release 4.2.24Constraints and Assumptions4.1 LimitationsThe AUTOSAR architecture contains several communication system specifictransport layers (J1939Tp, CanTp, FrTp, etc.). All of these modules need to haveidentical APIs, with the exception of API functions for which the PduR has separateconfiguration abilities.The J1939Tp module does not implement the TriggerTransmit API, because it is onlyneeded for time triggered bus architectures.4.2 Applicability to Automotive DomainsThe J1939 transport layer supports the implementation of ECUs that are designed tooperate in a J1939 network.12 of 81Document ID 425: AUTOSAR SWS SAEJ1939TransportLayer- AUTOSAR confidential -

Specification of a Transport Layer for SAE J1939AUTOSAR Release 4.2.25Module Architecture5.1 Dependencies on Other ModulesThis section describes the relations between the J1939Tp and other AUTOSAR basicsoftware modules. Besides the standard modules DET, EcuM, and SchM, whichhave interfaces to all BSW modules, J1939Tp only interacts with the PduR and theCanIf. The interfaces of J1939Tp are similar to the interfaces of CanTp.The figure below shows the interactions between J1939Tp, PduR, and CanIf.Figure 5-1: J1939 Transport Layer interactionsThe J1939Tp’s upper interface offers the PduR module access to transmitted andreceived N-SDUs corresponding to J1939 PGs with a maximum length of more than8 bytes of data.J1939 PGs with a maximum length of 8 bytes or less are exchanged directly betweenPduR and CanIf.5.2 File StructureAUTOSAR specifies that an ECU can be created from modules provided as objectcode, source code (generated or static), or both.13 of 81Document ID 425: AUTOSAR SWS SAEJ1939TransportLayer- AUTOSAR confidential -

Specification of a Transport Layer for SAE J1939AUTOSAR Release 4.2.2The decision to provide a module as object code or source code is based on acompromise between IP protection, test coverage, code efficiency and configurabilityat system generation time. Depending on the configurability requirements of theOEM, suppliers may deliver the J1939Tp module as object code or source code.The file hierarchy defined in this section allows the separation of platform, compiler,and implementation specific definitions and declarations from general definitions, aswell as the separation of source code and configuration.5.2.1 Code File StructureFor details, refer to the chapter 5.1.6 “Code file structure” in SWS BSW General [15].[SWS J1939Tp 00007] ⌈Internally used data types and functions shall be defined locally in the implementationsource files. ⌋ ( )This prevents visibility of these symbols outside of the J1939Tp module.5.2.2 Header File StructureThe following picture shows the include file hierarchy used by the J1939 TransportLayer module.Figure 5-2: File Structure[SWS J1939Tp 00016] ⌈14 of 81Document ID 425: AUTOSAR SWS SAEJ1939TransportLayer- AUTOSAR confidential -

Specification of a Transport Layer for SAE J1939AUTOSAR Release 4.2.2The implementation header files shall include ComStack Types.h. ⌋ ( )[SWS J1939Tp 00193] ⌈The implementation source files shall include Det.h to import the default errornotification API. This API is optional; the header is included depending onECUC J1939Tp 00042 : . See also section 8.6.2. ⌋ ( )[SWS J1939Tp 00015] ⌈The implementation source files shall include PduR J1939Tp.h, which contains thecallbacks functions of the PduR module that are used by the J1939Tp module. Seealso section 8.6.1. ⌋ ( )[SWS J1939Tp 00172] ⌈The implementation source files shall include CanIf.h, which contains the servicefunctions of the CanIf module that are used by the J1939Tp module. See also section8.6.1. ⌋ ( )15 of 81Document ID 425: AUTOSAR SWS SAEJ1939TransportLayer- AUTOSAR confidential -

Specification of a Transport Layer for SAE J1939AUTOSAR Release 4.2.26Requirements TraceabilityRequirementDescriptionSatisfied by--SWS J1939Tp 00007--SWS J1939Tp 00015--SWS J1939Tp 00016--SWS J1939Tp 00020--SWS J1939Tp 00022--SWS J1939Tp 00026--SWS J1939Tp 00030--SWS J1939Tp 00031--SWS J1939Tp 00032--SWS J1939Tp 00035--SWS J1939Tp 00038--SWS J1939Tp 00039--SWS J1939Tp 00040--SWS J1939Tp 00041--SWS J1939Tp 00043--SWS J1939Tp 00045--SWS J1939Tp 00046--SWS J1939Tp 00047--SWS J1939Tp 00048--SWS J1939Tp 00057--SWS J1939Tp 00060--SWS J1939Tp 00071--SWS J1939Tp 00076--SWS J1939Tp 00094--SWS J1939Tp 00095--SWS J1939Tp 00097--SWS J1939Tp 00098--SWS J1939Tp 00100--SWS J1939Tp 00101--SWS J1939Tp 00106--SWS J1939Tp 00116--SWS J1939Tp 00118--SWS J1939Tp 00119--SWS J1939Tp 00120--SWS J1939Tp 00159--SWS J1939Tp 0016016 of 81Document ID 425: AUTOSAR SWS SAEJ1939TransportLayer- AUTOSAR confidential -

Specification of a Transport Layer for SAE J1939AUTOSAR Release 4.2.2--SWS J1939Tp 00162--SWS J1939Tp 00163--SWS J1939Tp 00165--SWS J1939Tp 00172--SWS J1939Tp 00173--SWS J1939Tp 00175--SWS J1939Tp 00176--SWS J1939Tp 00177--SWS J1939Tp 00180--SWS J1939Tp 00192--SWS J1939Tp 00193--SWS J1939Tp 00194--SWS J1939Tp 00195--SWS J1939Tp 00198--SWS J1939Tp 00199--SWS J1939Tp 00200--SWS J1939Tp 00203--SWS J1939Tp 00204--SWS J1939Tp 00206--SWS J1939Tp 00207--SWS J1939Tp 00208--SWS J1939Tp 00209--SWS J1939Tp 00210--SWS J1939Tp 00211--SWS J1939Tp 00212--SWS J1939Tp 00213--SWS J1939Tp 00214--SWS J1939Tp 00215--SWS J1939Tp 00216--SWS J1939Tp 00217--SWS J1939Tp 00218--SWS J1939Tp 00219--SWS J1939Tp 00220--SWS J1939Tp 00221--SWS J1939Tp 00222--SWS J1939Tp 00223--SWS J1939Tp 00224--SWS J1939Tp 00225--SWS J1939Tp 0022617 of 81Document ID 425: AUTOSAR SWS SAEJ1939TransportLayer- AUTOSAR confidential -

Specification of a Transport Layer for SAE J1939AUTOSAR Release 4.2.2--SWS J1939Tp 00227--SWS J1939Tp 00228--SWS J1939Tp 00229--SWS J1939Tp 00230--SWS J1939Tp 00231--SWS J1939Tp 00232SRS BSW 00005Modules of the µC Abstraction Layer(MCAL) may not have hard coded horizontalinterfacesSWS J1939Tp 99999SRS BSW 00101The Basic Software Module shall be able toinitialize variables and hardware in aseparate initialization functionSWS J1939Tp 00087SRS BSW 00161The AUTOSAR Basic Software shall providea microcontroller abstraction layer whichprovides a standardized interface to highersoftware layersSWS J1939Tp 99999SRS BSW 00162The AUTOSAR Basic Software shall providea hardware abstraction layerSWS J1939Tp 99999SRS BSW 00164The Implementation of interrupt serviceroutines shall be done by the OperatingSystem, complex drivers or modulesSWS J1939Tp 99999SRS BSW 00167All AUTOSAR Basic Software Modules shallprovide configuration rules and constraints toenable plausibility checksSWS J1939Tp 00084SRS BSW 00168SW components shall be tested by a function SWS J1939Tp 99999defined in a common API in the Basis-SWSRS BSW 00170The AUTOSAR SW Components shallprovide information about their dependencyfrom faults, signal qualities, driver demandsSWS J1939Tp 99999SRS BSW 00171Optional functionality of a Basic-SWcomponent that is not required in the ECUshall be configurable at pre-compile-timeSWS J1939Tp 00125SRS BSW 00314All internal driver modules shall separate theinterrupt frame definition from the serviceroutineSWS J1939Tp 99999SRS BSW 00323All AUTOSAR Basic Software Modules shal

The terms J1939Tp and J1939 Transport Layer module are used synonymously in this document. SAE J1939 has a broad acceptance in the truck domain, and consists of several documents describing the layers of the communication protocol from the physical layer to diagnostics and the application layer. SAE J1939-21 describes the data link