DEENESPTFRRUARHIKOZHNL

CAN Transport Layer (CanTp)

ModulCanTp (CAN Transport Layer)
BSW-Modul-ID35
Standard-Header#include "CanTp.h"
SWS-SpezifikationAUTOSAR_SWS_CANTransportLayer.pdf
ClusterCAN

Module guideAI-GENERATED

Segments long messages into CAN frames and reassembles received segments using flow control.
AI-GENERATED unreviewed Model: claude-opus-5-5 · Effort: high · Temperature: not controllable · Prompt: 69cea53d1819 Provenance Open questions (1)
Causal anchor: R20-11 Valid from R20-11 Synthesized for this specification release.
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

Segments long messages into CAN frames and reassembles received segments using flow control.

The CAN Transport Layer segments messages that do not fit into a CAN frame, controls data flow via flow control, and reassembles received segments according to ISO 15765-2 [SWS_CanTp_00033]. It is situated between PduR and CanIf, has no payload buffer of its own, and copies transmit and receive data segment by segment via the copy services of the upper layer [SWS_CanTp_00298]. It concludes each accepted transmission with a notification to the upper layer—successfully with E_OK, upon timeout or abort with E_NOT_OK. All of this requires CanTp_Init; the timeouts are monitored by the cyclic MainFunction.

CanTp is the CAN Transport Layer. It segments long messages into CAN frames, controls data flow, and reassembles received segments; in doing so, it follows ISO 15765-2 unless the specification governs otherwise [SWS_CanTp_00033]. The module is situated between PduR and CanIf and has no payload buffer of its own. It copies data segment by segment via the copy services of the upper layer [SWS_CanTp_00298] [SWS_CanTp_00216].

kontext Nutzer DCM / Com (TP-Nutzer) PduR PduR Nutzer->PduR TP-Dienste CanTp CanTp PduR->CanTp CanTp_Transmit CanTp_CancelTransmit / CanTp_CancelReceive CanTp_ChangeParameter / CanTp_ReadParameter CanTp->PduR PduR_CanTpStartOfReception PduR_CanTpCopyRxData / PduR_CanTpCopyTxData PduR_CanTpRxIndication / PduR_CanTpTxConfirmation CanIf CanIf CanTp->CanIf CanIf_Transmit (SF, FF, CF, FC) Det DET CanTp->Det Det_ReportError Det_ReportRuntimeError CanIf->CanTp CanTp_RxIndication CanTp_TxConfirmation BswM BswM (Modusmanagement) BswM->CanTp CanTp_Init / CanTp_Shutdown Sched Schedule Manager (zyklischer Task) Sched->CanTp CanTp_MainFunction

Context diagram: The interfaces of CanTp to PduR, CanIf, mode management, scheduler, and DET. Sources: [SWS_CanTp_00216], SWS CanTp p. 17

After power-on, CanTp is in CANTP_OFF [SWS_CanTp_00168]. CanTp_Init with CanTp_ConfigType [SWS_CanTp_00208] transitions all connections into the idle state [SWS_CanTp_00030]; thereafter, CANTP_ON [SWS_CanTp_00170] applies. CanTp_Shutdown closes all connections without notifying anyone [SWS_CanTp_00202] [SWS_CanTp_00200]. The connection channels operate independently of one another with their own timers [SWS_CanTp_00122]. If a transmit channel is occupied, CanTp rejects new requests with E_NOT_OK [SWS_CanTp_00123].

During transmission, CanTp_Transmit evaluates only the length (and MetaData if applicable) [SWS_CanTp_00225]. Depending on the length, an SF or a segmented session follows [SWS_CanTp_00232]. For each segment, CanTp fetches the data with PduR_CanTpCopyTxData [SWS_CanTp_00086] and waits for flow control under N_Bs after FF and after each block [SWS_CanTp_00315]. Interpretation: The call reports only acceptance; the end of the transfer is signaled asynchronously via PduR_CanTpTxConfirmation [SWS_CanTp_00176] [SWS_CanTp_00204]. Question (open)

During reception, CanTp first requests a buffer with PduR_CanTpStartOfReception [SWS_CanTp_00079]. Thereafter, it copies each CF with PduR_CanTpCopyRxData [SWS_CanTp_00269]. If the buffer is scarce, CanTp queries it again in each MainFunction and transmits at most WFTmax FC(WAIT) [SWS_CanTp_00222] [SWS_CanTp_00223]. At the end stands PduR_CanTpRxIndication [SWS_CanTp_00084]. Timeouts are monitored by the cyclic CanTp_MainFunction [SWS_CanTp_00164].

Segmented reception of an N-SDUCanIfCanTpPduRUse Case: First FrameCanTp_RxIndication(FF)N_Br gestartetPduR_CanTpStartOfReception(TpSduLength)BUFREQ_OK, available buffer sizePduR_CanTpCopyRxData(FF-Daten)CanIf_Transmit(FC: CTS, BS, STmin)loopFor each CF of a blockCanTp_RxIndication(CF)PduR_CanTpCopyRxData(6/7 Byte)BUFREQ_OK, RestpufferaltRemaining buffer not sufficient for next blockN_Br runningCanTp_MainFunctionPduR_CanTpCopyRxData(length 0, NULL_PTR)BUFREQ_OK, RestpufferCanIf_Transmit(FC: WAIT)At most WFTmax timesPuffer ausreichendCanIf_Transmit(FC: CTS)Use Case: Letzter Consecutive FrameCanTp_RxIndication(letzter CF)PduR_CanTpCopyRxData()PduR_CanTpRxIndication(E_OK)

Sequence diagram: Segmented reception with buffer negotiation and flow control CTS/WAIT. Sources: [SWS_CanTp_00269], [SWS_CanTp_00222], SWS CanTp p. 38

CanTp handles errors in three ways. It reports development errors to DET and returns E_NOT_OK [SWS_CanTp_00294]. Protocol errors such as timeouts abort the session and are passed to PduR with E_NOT_OK [SWS_CanTp_00205] [SWS_CanTp_00311]. The same applies to aborts upon request via the cancel services [SWS_CanTp_00255] [SWS_CanTp_00263]. For invalid IDs in the cancel services, R20-11 requires CANTP_E_PARAM_ID [SWS_CanTp_00254], whereas newer releases specify different codes.

Role in the CAN stack: Transport protocol between PduR and CanIf

CanTp is the CAN Transport Layer. It segments messages that do not fit into a single CAN frame into segments, controls data flow, and reassembles received segments (SWS CanTp p. 24, SWS CanTp p. 17). The basis is ISO 15765-2: Every recommendation of this standard applies unless the specification explicitly excludes it [SWS_CanTp_00033]. CanTp executes segmentation and reassembly only in state CANTP_ON [SWS_CanTp_00238].

Upwards, CanTp provides the following services to PduR: CanTp_Transmit [SWS_CanTp_00212], CanTp_CancelTransmit [SWS_CanTp_00246], and CanTp_CancelReceive [SWS_CanTp_00257]. CanTp itself invokes PduR_CanTpStartOfReception, PduR_CanTpCopyRxData, PduR_CanTpCopyTxData, PduR_CanTpRxIndication, and PduR_CanTpTxConfirmation upwards, and CanIf_Transmit [SWS_CanTp_00216] downwards. The lower layer reports received frames via CanTp_RxIndication [SWS_CanTp_00078] and transmit confirmations via CanTp_TxConfirmation [SWS_CanTp_00076]. Both functions must be callable in interrupt context [SWS_CanTp_00235] [SWS_CanTp_00236]. Newer document passages specify the L-SDU Router (LSduR) as caller (SWS CanTp p. 27). In contrast, the requirements of R20-11 refer to the CAN Interface, such as [SWS_CanTp_00031] and [SWS_CanTp_00335].

CanTp has no payload buffer of its own. It fetches transmit data directly from the upper layer [SWS_CanTp_00298], and copies received data directly into its memory (SWS CanTp p. 35). This results in locking periods for the upper layer (SWS CanTp p. 35):

  • It keeps the transmit buffer locked as soon as CanTp_Transmit returns with E_OK until PduR_CanTpTxConfirmation arrives.
  • It keeps the receive buffer locked as soon as it has provided BUFREQ_OK in response to PduR_CanTpStartOfReception until PduR_CanTpRxIndication arrives.
kontext Nutzer DCM / Com (TP-Nutzer) PduR PduR Nutzer->PduR TP-Dienste CanTp CanTp PduR->CanTp CanTp_Transmit CanTp_CancelTransmit / CanTp_CancelReceive CanTp_ChangeParameter / CanTp_ReadParameter CanTp->PduR PduR_CanTpStartOfReception PduR_CanTpCopyRxData / PduR_CanTpCopyTxData PduR_CanTpRxIndication / PduR_CanTpTxConfirmation CanIf CanIf CanTp->CanIf CanIf_Transmit (SF, FF, CF, FC) Det DET CanTp->Det Det_ReportError Det_ReportRuntimeError CanIf->CanTp CanTp_RxIndication CanTp_TxConfirmation BswM BswM (Modusmanagement) BswM->CanTp CanTp_Init / CanTp_Shutdown Sched Schedule Manager (zyklischer Task) Sched->CanTp CanTp_MainFunction

Context diagram: CanTp is situated between PduR and CanIf. It is initialized by mode management, triggered cyclically by the scheduler, and reports errors to DET. Sources: [SWS_CanTp_00216], [SWS_CanTp_00217], [SWS_CanTp_00164], SWS CanTp p. 17, Mode Management Guide p. 54

Lifecycle: CANTP_OFF, CanTp_Init, and independent connection channels

CanTp recognizes the states CANTP_OFF and CANTP_ON [SWS_CanTp_00027]. After power-on, the module is in CANTP_OFF [SWS_CanTp_00168]; the post-build configuration may only be updated there [SWS_CanTp_00169].

CanTp_Init receives a pointer to CanTp_ConfigType [SWS_CanTp_00208] [SWS_CanTp_00340]. The function initializes all global variables and sets each connection to the idle state CANTP_RX_WAIT or CANTP_TX_WAIT [SWS_CanTp_00030]; thereafter, CANTP_ON [SWS_CanTp_00170] applies. The environment must call CanTp_Init prior to any further usage [SWS_CanTp_00199]. In the guide to mode management, a BswM rule takes care of this after NvM_ReadAll (Mode Management Guide p. 54). A repeated call in CANTP_ON discards all running connections and returns to the idle state [SWS_CanTp_00273] [SWS_CanTp_00111].

CanTp_Shutdown closes all open connections, frees resources, and sets CANTP_OFF [SWS_CanTp_00202]. In doing so, CanTp notifies no one of aborted transmissions [SWS_CanTp_00200] (SWS CanTp p. 58).

In CANTP_ON, several connections run concurrently [SWS_CanTp_00096]:

  • Each N-SDU is statically assigned to a connection channel. Each channel has its own timers, buffers, and its own state machine [SWS_CanTp_00121] [SWS_CanTp_00122].
  • Channels are visible only internally [SWS_CanTp_00285]. Their number is determined by the configuration tool [SWS_CanTp_00289].
  • If a transmit channel is in CANTP_TX_PROCESSING, CanTp rejects new requests via CanTp_Transmit with E_NOT_OK [SWS_CanTp_00123]. The same applies to an N-SDU that is already engaged in an active session [SWS_CanTp_00206].
  • If multiple N-SDUs share a channel and no free channel is available, CanTp rejects transmission or aborts reception, respectively [SWS_CanTp_00288] (SWS CanTp p. 42).
lebenszyklus cluster_on CANTP_ON cluster_rx Rx-Verbindungskanal cluster_tx Tx-Verbindungskanal PowerUp Einschalten OFF CANTP_OFF (post-build configuration changeable) PowerUp->OFF RXW CANTP_RX_WAIT OFF->RXW CanTp_Init (erfolgreich) TXW CANTP_TX_WAIT OFF->TXW CanTp_Init (erfolgreich) RXP CANTP_RX_PROCESSING RXW->RXP SF/FF empfangen RXP->RXW No further N-PDU expected or abort TXP CANTP_TX_PROCESSING TXW->TXP CanTp_Transmit = E_OK TXP->OFF CanTp_Shutdown (without notification) TXP->TXW Transmission completed or abort

State diagram: After CanTp_Init, receive and transmit channels switch independently of one another between WAIT and PROCESSING; CanTp_Shutdown leads back to CANTP_OFF. Sources: [SWS_CanTp_00027], [SWS_CanTp_00030], [SWS_CanTp_00170], [SWS_CanTp_00202], SWS CanTp p. 27

Transmission: From CanTp_Transmit to confirmation

CanTp_Transmit receives TxPduId and PduInfoPtr [SWS_CanTp_00212]. Without MetaData, CanTp evaluates only the total length SduLength and does not access the data buffer [SWS_CanTp_00225] [SWS_CanTp_00299]. With MetaData, it additionally stores the addressing information for all SF, FF, and CF [SWS_CanTp_00334]. If the data fits into an N-PDU, CanTp transmits an SF, otherwise it opens a multi-frame session [SWS_CanTp_00232] (SWS CanTp p. 60). The maximum transmission length (TX_DL) results from PduLength in EcuC [SWS_CanTp_00354]. Interpretation: The call reports synchronously only whether the request is accepted; the actual transfer runs asynchronously [SWS_CanTp_00176]. Question Q-b6d13590324e2906 (open) After acceptance, CanTp reports the end in any case via PduR_CanTpTxConfirmation [SWS_CanTp_00177] [SWS_CanTp_00204].

For each segment (SF, FF, CF), CanTp invokes PduR_CanTpCopyTxData [SWS_CanTp_00086]; timer N_Cs runs until the first invocation [SWS_CanTp_00167]. If the upper layer returns BUFREQ_E_BUSY, CanTp tries again later [SWS_CanTp_00184]. CanTp always sets the retry parameter to NULL because ISO 15765-2 does not know retries [SWS_CanTp_00272].

After the FF and after the last CF of each block, CanTp waits under N_Bs for a Flow Control frame [SWS_CanTp_00315]. With it, the receiver enables or delays further CFs [SWS_CanTp_00282]. Once the session is successfully concluded, PduR_CanTpTxConfirmation with E_OK follows [SWS_CanTp_00090]. The same pull flow is shown by the 50-byte example (SWS CanTp p. 37) and the path from DCM to CanTp (SWS PduR p. 104).

Segmented transmission of an N-SDUPduRCanTpCanIfUse Case: TriggerCanTp_Transmit(TxPduId, PduInfoPtr)Only SduLength (+ MetaData)E_OKN_Cs runningUse Case: First FramePduR_CanTpCopyTxData()BUFREQ_OKCanIf_Transmit(FF)CanTp_TxConfirmation(E_OK)N_Bs running: waiting for FCCanTp_RxIndication(FC: CTS, BS, STmin)loopFor each CF of a block (BS frames, separation STmin)PduR_CanTpCopyTxData()BUFREQ_OKCanIf_Transmit(CF)CanTp_TxConfirmation(E_OK)Wait for FC again after each block (N_Bs)Use Case: AbschlussPduR_CanTpTxConfirmation(E_OK)

Sequence diagram: CanTp requests data segment by segment from PduR, waits for flow control after FF and each block, and finally confirms with E_OK. Sources: [SWS_CanTp_00212], [SWS_CanTp_00086], [SWS_CanTp_00315], [SWS_CanTp_00090], SWS CanTp p. 73

Reception: Buffer negotiation, flow control, and reassembly

Upon each incoming SF or FF, CanTp indicates start of reception with PduR_CanTpStartOfReception [SWS_CanTp_00079]. The available buffer size is returned via an output parameter and may be smaller than the N-SDU [SWS_CanTp_00080]. In case of an FF, CanTp starts timer N_Br beforehand [SWS_CanTp_00166]. It transmits the Flow Control only when the result is available; its content depends on this result [SWS_CanTp_00064] [SWS_CanTp_00277]. All FCs of a receive session carry the same values for BS and STmin [SWS_CanTp_00067]. An FC follows after BS consecutive frames in each case [SWS_CanTp_00278].

After each CF, CanTp passes the payload data with PduR_CanTpCopyRxData and thereby learns the remaining buffer [SWS_CanTp_00269]. For CAN 2.0, this is six or seven bytes per CF. If the remaining buffer after the last CF of a block is insufficient for the next block, CanTp starts timer N_Br [SWS_CanTp_00325] [SWS_CanTp_00082]. As long as this timer runs:

When the session ends, successfully or not, CanTp calls PduR_CanTpRxIndication [SWS_CanTp_00084]. With and without padding, CanTp passes only the actually used data bytes to the upper layer [SWS_CanTp_00116].

Segmented reception of an N-SDUCanIfCanTpPduRUse Case: First FrameCanTp_RxIndication(FF)N_Br gestartetPduR_CanTpStartOfReception(TpSduLength)BUFREQ_OK, available buffer sizePduR_CanTpCopyRxData(FF-Daten)CanIf_Transmit(FC: CTS, BS, STmin)loopFor each CF of a blockCanTp_RxIndication(CF)PduR_CanTpCopyRxData(6/7 Byte)BUFREQ_OK, RestpufferaltRemaining buffer not sufficient for next blockN_Br runningCanTp_MainFunctionPduR_CanTpCopyRxData(length 0, NULL_PTR)BUFREQ_OK, RestpufferCanIf_Transmit(FC: WAIT)At most WFTmax timesPuffer ausreichendCanIf_Transmit(FC: CTS)Use Case: Letzter Consecutive FrameCanTp_RxIndication(letzter CF)PduR_CanTpCopyRxData()PduR_CanTpRxIndication(E_OK)

Sequence diagram: Segmented reception with buffer negotiation, block-wise flow control, and wait phase in case of scarce buffer. Sources: [SWS_CanTp_00079], [SWS_CanTp_00269], [SWS_CanTp_00222], [SWS_CanTp_00084], SWS CanTp p. 76

rxstart Ein CanTp_RxIndication: SF or FF received Kanal Kanal in CANTP_RX_PROCESSING? Ein->Kanal Art With MetaData or other N_AI? Kanal->Art yes Sor PduR_CanTpStartOfReception() Kanal->Sor no Ign Frame ignorieren Art->Ign yes Neu laufenden Empfang abbrechen, Frame als neuen Empfang behandeln Art->Neu nein (gleiche N_AI) Neu->Sor Erg Return value? Sor->Erg NotOk Abort reception: no FC, no PduR_CanTpRxIndication Erg->NotOk BUFREQ_E_NOT_OK Ovfl FF: FC(OVFLW) senden, abbrechen SF: abbrechen Erg->Ovfl BUFREQ_E_OVFL Typ Frame-Typ? Erg->Typ BUFREQ_OK Sf SF: Daten kopieren, PduR_CanTpRxIndication Typ->Sf SF Puf FF: buffer sufficient for next block? Typ->Puf FF Cts FC(CTS) senden Puf->Cts yes Br N_Br starten, Puffer in MainFunction abfragen Puf->Br no

Activity diagram: How CanTp decides on an incoming SF or FF based on channel state and the result of PduR_CanTpStartOfReception. Sources: [SWS_CanTp_00124], [SWS_CanTp_00337], [SWS_CanTp_00081], [SWS_CanTp_00318], [SWS_CanTp_00353], SWS CanTp p. 67

Addressing, MetaData, and padding

Functional addressing (1:n) is permitted only for SF [SWS_CanTp_00092]. CanTp rejects a segmented session via a functional handle and reports CANTP_E_INVALID_TATYPE [SWS_CanTp_00093] (SWS CanTp p. 39). In case of extended or mixed addressing, CanTp determines the N-SDU from N_TA or N_AE in the first data byte [SWS_CanTp_00095] [SWS_CanTp_00284] [SWS_CanTp_00283]. For the assignment of identifiers, the following applies (SWS CanTp p. 44):

  • Each NSduId is assigned to exactly one LSduId [SWS_CanTp_00035].
  • The LSduId of an FC together with N_TA or N_AE identifies exactly one NSduId [SWS_CanTp_00094].
  • Multiple N-SDUs may reference the same N-PDU only with extended/mixed addressing or with MetaData [SWS_CanTp_00328].

Generic connections operate with MetaData. CanTp stores the addressing information from SF or FF [SWS_CanTp_00330], forwards it to PduR_CanTpStartOfReception [SWS_CanTp_00331], and checks subsequent CFs against it [SWS_CanTp_00333]. If the channel is already receiving, CanTp ignores a further SF or FF with MetaData [SWS_CanTp_00337].

Padding is enabled per N-SDU (SWS CanTp p. 43). The fill value is CANTP_PADDING_BYTE [SWS_CanTp_00059]. For frames with at most 8 bytes of payload, the following applies:

If a transmit length does not match any valid DLC, CanTp pads up to the next higher valid value [SWS_CanTp_00351]. CanTp derives the receive length RX_DL from the first received CAN_DL [SWS_CanTp_00350].

Time monitoring, runtime parameters, and abort upon request

CanTp_MainFunction [SWS_CanTp_00213] is called cyclically. It monitors N_As, N_Bs, N_Cs, N_Ar, N_Br, N_Cr, and STmin [SWS_CanTp_00164] (SWS CanTp p. 63). Its cycle time is based on CanTpMainFunctionPeriod [SWS_CanTp_00300]. This value shall correspond to the cycle time of the calling task (SWS CanTp p. 77). As an example, the timing analysis cites a 5-ms task (TR Timing Analysis p. 117).

Two services access the receive parameters BS and STmin of an N-SDU at runtime: CanTp_ChangeParameter changes them [SWS_CanTp_00302], CanTp_ReadParameter reads them [SWS_CanTp_00323]. Both exist only if CanTpChangeParameterApi = TRUE (SWS CanTp p. 61). BS is only an upper limit, which CanTp may undercut due to buffer reasons [SWS_CanTp_00091]. Between FF and the last CF of an ongoing receive session, CanTp rejects any change with E_NOT_OK [SWS_CanTp_00303] [SWS_CanTp_00304]. For generic connections, a change applies to all [SWS_CanTp_00338].

Ongoing transmissions can be aborted upon request:

Behavior in the event of an error

Development errors. If detection is active, CanTp reports the error to DET and returns E_NOT_OK [SWS_CanTp_00294] [SWS_CanTp_00217] (SWS CanTp p. 49). The codes are defined by [SWS_CanTp_00293]. Typical cases:

Discrepancy between releases: For an invalid PduId in the cancel services, R20-11 requires CANTP_E_PARAM_ID [SWS_CanTp_00254] [SWS_CanTp_00260]. Newer document passages state CANTP_E_INVALID_TX_ID or CANTP_E_INVALID_RX_ID instead (SWS CanTp p. 59). For R20-11, the requirement applies.

Runtime errors. They go to the Default Error Tracer [SWS_CanTp_00352]:

Protocol errors. They terminate the session with E_NOT_OK to the upper layer [SWS_CanTp_00205]:

PduR forwards the negative confirmation to the user, e.g. to DCM, which then takes care of recovery (Error Description p. 29, Error Description p. 28). Production errors are handled by DEM via FiM [SWS_CanTp_00291].

abbruch cluster_tx Sendeseite cluster_rx Empfangsseite t1 PduR_CanTpCopyTxData = BUFREQ_E_NOT_OK TA Sendesitzung abbrechen t1->TA t2 N_Cs abgelaufen t2->TA t3 N_As abgelaufen t3->TA t4 N_Bs abgelaufen t4->TA t5 FC with OVFLW or invalid FS t5->TA t6 FC shorter than 8 bytes with Tx padding t6->TA t7 CanIf_Transmit(SF/FF/CF) = E_NOT_OK t7->TA t8 CanTp_TxConfirmation(E_NOT_OK) t8->TA t9 CanTp_CancelTransmit = E_OK t9->TA r1 N_Ar abgelaufen RA Empfangssitzung abbrechen r1->RA r2 N_Cr abgelaufen r2->RA r3 PduR_CanTpCopyRxData = BUFREQ_E_NOT_OK r3->RA r4 WFTmax FC(WAIT) erreicht r4->RA r5 Last CF too short with Rx padding r5->RA r6 CanIf_Transmit(FC) = E_NOT_OK r6->RA r7 CanTp_CancelReceive = E_OK r7->RA TC PduR_CanTpTxConfirmation(E_NOT_OK) TA->TC RC PduR_CanTpRxIndication(E_NOT_OK) RA->RC

Activity diagram: All abort causes lead to a negative notification to PduR for each direction. Sources: [SWS_CanTp_00205], [SWS_CanTp_00343], [SWS_CanTp_00355], [SWS_CanTp_00342], [SWS_CanTp_00223], [SWS_CanTp_00084], Error Description p. 28

Further detailed evidence

AI-generated guide based on specification excerpts for CanTp (R20-11). Only the linked requirements are binding; document passages from other releases serve illustrative purposes only.

CAN Transport Layer (CanTp)

Provides segmentation and reassembly of CAN messages up to 4095 bytes (ISO 15765-2).

Funktionen — Übersicht

Typen — Übersicht

Funktionen & Typen — Detailansicht

function CanTp_Init [SWS_CanTp_00208] 📄 PDF

void CanTp_Init (const CanTp_ConfigType* CfgPtr);

This function initializes the Can Tp module.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 62b706f68200 Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The synchronous and non-reentrant function CanTp_Init initializes the CanTp module [SWS_CanTp_00208]. Via the parameter CfgPtr, it takes a pointer to the post-build configuration data (CanTp_ConfigType) and has no return value [SWS_CanTp_00208]. The module environment must call CanTp_Init before the module can be used for further processing [SWS_CanTp_00199].

During initialization, all global variables of the module are initialized and all transport protocol connections are set to a sub-state of CANTP_ON in which neither segmented transmission nor segmented reception is active [SWS_CanTp_00030]. In this process, the receive paths are in the state CANTP_RX_WAIT and the transmit paths are in the state CANTP_TX_WAIT [SWS_CanTp_00030]. After successful execution, the module transitions to the internal state CANTP_ON [SWS_CanTp_00170].

If CanTp_Init is called when the module is already in the global state CANTP_ON, the function resets the module to the Idle state so that neither transmission nor reception operations are running [SWS_CanTp_00111].

If Development Error Detection is enabled, the CanTp module reports the error CANTP_E_UNINIT if the PDU Router or the CAN Interface attempts to execute functions of the module (with the exception of CanTp_GetVersionInfo) prior to the call to CanTp_Init [SWS_CanTp_00031].

This text was generated by an AI based on the specification.

Implementer's Guide to follow (complexity I2)

function CanTp_Shutdown [SWS_CanTp_00211] 📄 PDF

void CanTp_Shutdown (void);

This function is called to shutdown the Can Tp module.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: e5430e2cac5b Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

Usage and Call Context

Function CanTp_Shutdown serves to shut down the entire CanTp module in an orderly manner ([SWS_CanTp_00211]). The interface is provided via header file CanTp.h and has service ID 0x02 ([SWS_CanTp_00211]). The call is processed synchronously, takes no input parameters, and returns no return value ([SWS_CanTp_00211]).

State Transition and Cleanup

Upon execution, CanTp_Shutdown closes all still-pending transport protocol connections, frees all allocated resources, and transitions the CanTp module into state CANTP_OFF ([SWS_CanTp_00202]). An essential aspect of the abort behavior is that explicitly no notification whatsoever may be triggered to upper layers for pending frame transmissions or frame reception processes ([SWS_CanTp_00200]).

Concurrency and Constraints

The function is specified as non-reentrant (Non Reentrant) ([SWS_CanTp_00211]). Consequently, it must not be called simultaneously from different execution contexts or interrupt routines. Specific error codes or notifications to error management are not defined in the scope of the interface.

This usage note was created automatically based on the specification AUTOSAR Classic Release R20-11.

Implementer's Guide to follow (complexity I1)

function CanTp_Transmit [SWS_CanTp_00212] 📄 PDF

Std_ReturnType CanTp_Transmit (PduIdType TxPduId, const PduInfoType* PduInfoPtr);

Requests transmission of a PDU.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 7a5280a26edd Provenance Open questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

use

The function CanTp_Transmit serves to request the transmission of an N-SDU via the CAN transport layer [SWS_CanTp_00212]. The identifier of the PDU to be transmitted (TxPduId) as well as a pointer to data, length, and metadata (PduInfoPtr) are passed as parameters [SWS_CanTp_00212]. The call reports back with E_OK the successful acceptance or with E_NOT_OK the rejection of the request [SWS_CanTp_00212]. While the call is acknowledged synchronously, the handling of the transmission is asynchronous [SWS_CanTp_00176] (Interpretation: The indication "Synchronous" in the specification table is likely to refer to the acceptance of the request). Question Q-df438ddaa4963aba (open)

Interaction and PDU Processing

For N-SDUs with metadata, the module stores the address information (depending on the addressing format such as Normal, Extended, Mixed 11 bit, Normal fixed, or Mixed 29 bit) in order to use it for SF, FF, and CF N-PDUs as well as for identifying FC N-PDUs [SWS_CanTp_00334]. If no metadata is used, CanTp_Transmit accesses only the length specification SduLength to prepare the SF or FF PCI and does not use the N-SDU data buffer [SWS_CanTp_00225].

Error Handling and Concurrency

  • Error checking: If DET is enabled and PduInfoPtr is a NULL pointer, the function reports the error CANTP_E_PARAM_POINTER and returns without further action [SWS_CanTp_00321].
  • Channel occupancy: If the assigned channel is in the CANTP_TX_PROCESSING state or a session is already running for the N-SDU identifier, the transmission request is rejected and E_NOT_OK is returned [SWS_CanTp_00123], [SWS_CanTp_00206].
  • Reentrancy: The service is reentrant for different PDU IDs, but not reentrant for the same PDU ID [SWS_CanTp_00212].

This text was generated by an AI based on the specification AUTOSAR Classic R20-11.

Implementer's Guide to follow (complexity I2)

function CanTp_CancelTransmit [SWS_CanTp_00246] 📄 PDF

Std_ReturnType CanTp_CancelTransmit (PduIdType TxPduId);

Requests cancellation of an ongoing transmission of a PDU in a lower layer communication module.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: f7624766b8a1 Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The synchronous function CanTp_CancelTransmit requests the cancellation of an ongoing PDU transmission in a lower-layer communication module [SWS_CanTp_00246], thereby initiating the cancellation of the transmission process [SWS_CanTp_00274]. The identifier of the affected PDU (TxPduId) is passed as a parameter [SWS_CanTp_00246]. As the return value, E_OK signals successful execution of the cancellation by the target module, while E_NOT_OK indicates rejection [SWS_CanTp_00246].

After the function call, the transmission on the affected connection is cancelled [SWS_CanTp_00243]. If the cancellation was executed successfully, the module CanTp is required to call the confirmation PduR_CanTpTxConfirmation with the negative result E_NOT_OK in order to inform the upper layers about the cancellation [SWS_CanTp_00255].

With Development Error Detection enabled, CanTp_CancelTransmit checks the validity of TxPduId: in case of an invalid parameter, the development error CANTP_E_PARAM_ID is generated and E_NOT_OK is returned [SWS_CanTp_00254]. If cancellation is requested for an N-SDU that is not currently in the transmission process, the module reports the runtime error CANTP_E_OPER_NOT_SUPPORTED to the Default Error Tracer (DET) and likewise returns E_NOT_OK [SWS_CanTp_00254].

Regarding concurrency, the function is reentrant for different PDU-IDs, but must not be called concurrently for the same TxPduId [SWS_CanTp_00246].

This usage note was generated automatically based on the AUTOSAR specification.

Implementer's Guide to follow (complexity I2)

function CanTp_CancelReceive [SWS_CanTp_00257] 📄 PDF

Std_ReturnType CanTp_CancelReceive (PduIdType RxPduId);

Requests cancellation of an ongoing reception of a PDU in a lower layer transport protocol module.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: ccccdf72ba41 Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The function CanTp_CancelReceive synchronously aborts the ongoing reception of a PDU in a lower-layer transport protocol module [SWS_CanTp_00257]. It is available via the header file CanTp.h and has the service ID 0x4c [SWS_CanTp_00257].

Usage and Call Conditions

The identifier of the PDU to be cancelled is passed via the input parameter RxPduId [SWS_CanTp_00257]. The call is processed synchronously and is specified as non-reentrant (Non Reentrant) [SWS_CanTp_00257]. As return value, the interface of type Std_ReturnType provides:

  • E_OK: The cancellation was successfully executed by the target module [SWS_CanTp_00257].
  • E_NOT_OK: The cancellation was rejected by the target module [SWS_CanTp_00257].

Error handling

With Development Error Detection enabled, the function validates the parameter RxPduId [SWS_CanTp_00260]:

  • If the value of RxPduId is invalid, CanTp_CancelReceive reports the development error CANTP_E_PARAM_ID and returns E_NOT_OK [SWS_CanTp_00260].
  • If a cancellation is requested for an N-SDU that is not currently in an ongoing reception process, the module reports the runtime error CANTP_E_OPER_NOT_SUPPORTED to the Default Error Tracer and returns E_NOT_OK [SWS_CanTp_00260].

Interaction with Neighboring Modules

If the reception cancellation was executed successfully, CanTp calls the callback function PduR_CanTpRxIndication with the notification result E_NOT_OK to inform the upper layer about the cancellation [SWS_CanTp_00263].

This usage note is based on the AUTOSAR Classic R20-11 specification and was generated automatically.

Implementer's Guide to follow (complexity I1)

function CanTp_ChangeParameter [SWS_CanTp_00302] 📄 PDF

Std_ReturnType CanTp_ChangeParameter (PduIdType id, TPParameterType parameter, uint16 value);

Request to change a specific transport protocol parameter (e.g. block size).

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 2d391dbc31e8 Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The synchronous function CanTp_ChangeParameter is used to change a specific transport protocol parameter, such as the block size ([SWS_CanTp_00302]), at runtime. Provided via the header file CanTp.h, the service takes the PDU identifier (id), the identifier of the parameter (parameter), and the new value to be set (value) ([SWS_CanTp_00302]). Upon successful execution, the function returns E_OK; if the change fails or is rejected, it returns E_NOT_OK ([SWS_CanTp_00302]).

Regarding concurrency and call conditions, the following requirements apply:

  • The interface is designed as non-reentrant (Non Reentrant) ([SWS_CanTp_00302]).
  • If the affected N-SDU is already in an ongoing reception process at the time of the call, CanTp_ChangeParameter aborts immediately, returns E_NOT_OK, and does not change the parameter value ([SWS_CanTp_00304]).

A special interaction exists for generic connections: if the function is called for an N-SDU with MetaData, the parameter change is applied to all generic connections and adopted for all subsequent reception operations ([SWS_CanTp_00338]).

This usage note was generated automatically based on the specification requirements.

Implementer's Guide to follow (complexity I1)

function CanTp_ReadParameter [SWS_CanTp_00323] 📄 PDF

Std_ReturnType CanTp_ReadParameter (PduIdType id, TPParameterType parameter, uint16* value);

This service is used to read the current value of reception parameters BS and STmin for a specified N - SDU.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 949f6cb3df18 Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

use

The synchronous function CanTp_ReadParameter is used to read out the current value of the reception parameters BS (Block Size) or STmin (Separation Time minimum) for a specified receive N-SDU [SWS_CanTp_00323]. The declaration is available via the header file CanTp.h [SWS_CanTp_00323].

The interface has the following parameters:

  • id (in): Identifier of the received N-SDU (type PduIdType) for which the reception parameter is read [SWS_CanTp_00323].
  • parameter (in): Determines the parameter to be read (BS or STmin of type TPParameterType) [SWS_CanTp_00323].
  • value (out): Pointer to uint16 via which the read parameter value is provided [SWS_CanTp_00323].

As return value, the function provides Std_ReturnType; here, E_OK indicates acceptance of the request and E_NOT_OK rejection [SWS_CanTp_00323].

Error handling

If Development Error Detection is enabled, CanTp_ReadParameter checks the validity of parameters id and parameter [SWS_CanTp_00324]. If one of these parameters is invalid, the function reports the development error CANTP_E_PARAM_ID and returns E_NOT_OK [SWS_CanTp_00324].

Concurrency and Limitations

The function is specified as non-reentrant (Non Reentrant) [SWS_CanTp_00323]. Callers must avoid concurrent accesses to the same interface.

This text was generated by an AI based on the AUTOSAR R20-11 specification documents.

Implementer's Guide to follow (complexity I1)

function CanTp_MainFunction [SWS_CanTp_00213] 📄 PDF

void CanTp_MainFunction (void);

The main function for scheduling the CAN TP.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 64a7b42182e1 Provenance Open questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The function CanTp_MainFunction serves as the central entry point for the periodic scheduling of the CAN Transport Protocol (CAN TP) [SWS_CanTp_00213], [SWS_CanTp_00164]. It has the service ID 0x06, has the signature void CanTp_MainFunction(void), and is available via the header SchM_CanTp.h [SWS_CanTp_00213]. It takes no parameters and returns no return value [SWS_CanTp_00213].

Call Context and Timing Control

Depending on the required period, the call is initiated either by the Schedule Manager or by the Free Running Timer module [SWS_CanTp_00164]. Within the module, CanTp_MainFunction handles the timing supervision and control of the protocol sequences [SWS_CanTp_00164]. Specifically, the function is involved in handling the following timers and timing conditions:

  • The protocol timeouts for transmission and confirmation: N_As, N_Bs, N_Cs as well as N_Ar, N_Br, and N_Cr [SWS_CanTp_00164].
  • Compliance with the minimum frame separation time STMmin [SWS_CanTp_00164].

Error Handling and Concurrency

Specific error codes for DET or DEM are not defined for this function in the payload. Interpretation: As a cyclically called scheduling function, CanTp_MainFunction is likely non-reentrant and requires a consistent call rate to ensure correct decrementing of the internal timers. Question Q-2fe22e31085abf49 (open)

This text was generated by an AI based on the AUTOSAR specification R20-11.

Implementer's Guide to follow (complexity I1)

function CanTp_RxIndication [SWS_CanTp_00214] 📄 PDF

void CanTp_RxIndication (PduIdType RxPduId, const PduInfoType* PduInfoPtr);

Indication of a received PDU from a lower layer communication interface module.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 38e732456055 Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

Usage and Semantics

The synchronous function [SWS_CanTp_00214] reports the reception of an N-PDU by an underlying communication interface module to the CAN transport module. The call passes the identification of the received PDU (RxPduId) and, via pointer PduInfoPtr, the length (SduLength), payload (SduDataPtr), and associated metadata. The function has no return value.

Concurrency and Call Context

The function is reentrant for different PDU IDs, but not reentrant for the same PDU ID [SWS_CanTp_00214]. CanTp_RxIndication may be called in interrupt context, for example directly from the CAN receive interrupt [SWS_CanTp_00235].

Interaction for Generic Connections

When called for Single Frames (SF) or First Frames (FF) with metadata, CanTp stores the contained address information (such as N_SA and N_TA in normal fixed or mixed 29-bit addressing). This information is used for connection establishment to the upper layer, for transmitting Flow Control frames (FC), and for detecting Consecutive Frames (CF) [SWS_CanTp_00330]. For subsequent CF and received FC frames, CanTp checks the address data of the metadata against the stored values [SWS_CanTp_00333], [SWS_CanTp_00336].

Error Handling and Padding

If DET is enabled and PduInfoPtr is a NULL pointer, the function reports error CANTP_E_PARAM_POINTER and returns without action [SWS_CanTp_00322]. If padding verification is enabled for frames with a payload of up to 8 bytes (CanTpRxPaddingActivation or CanTpTxPaddingActivation equal to CANTP_ON), runtime error CANTP_E_PADDING is reported to the DET in case of length errors:

  • An SF with SduLength < 8 is rejected [SWS_CanTp_00345].
  • A last CF with SduLength != 8 aborts the ongoing reception via PduR_CanTpRxIndication() with E_NOT_OK [SWS_CanTp_00346].
  • A received FC with SduLength < 8 aborts the ongoing transmission via PduR_CanTpTxConfirmation() with E_NOT_OK [SWS_CanTp_00349].

This text was generated by an AI and serves as guidance. The AUTOSAR specification is authoritative.

Implementer's Guide to follow (complexity I2)

function CanTp_TxConfirmation [SWS_CanTp_00215] 📄 PDF

void CanTp_TxConfirmation (PduIdType TxPduId, Std_ReturnType result);

The lower layer communication interface module confirms the transmission of a PDU, or the failure to transmit a PDU.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 2541d17fed91 Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The CanTp module provides the synchronous callback function CanTp_TxConfirmation (service ID 0x40) via header CanTp.h to accept confirmation calls for transmitted PDUs [SWS_CanTp_00076] [SWS_CanTp_00215]. Via this interface, the underlying communication interface module reports the successful transmission or failure of a PDU transmission [SWS_CanTp_00215].

Parameters and Return Values

The function returns no return value (void) and expects two input parameters [SWS_CanTp_00215]:

  • TxPduId: ID of the transmitted PDU [SWS_CanTp_00215].
  • result: Transmission status. Value E_OK confirms successful transmission, whereas E_NOT_OK signals failure of the PDU transmission [SWS_CanTp_00215].

Error handling

If CanTp_TxConfirmation is called with result value E_NOT_OK, the CanTp module aborts the associated transmission session [SWS_CanTp_00355].

Concurrency and Execution Context

Regarding concurrency, the function is reentrant for different PDU IDs, but not reentrant for the same PDU ID [SWS_CanTp_00215]. It must be callable in interrupt context and may be called, for example, directly from the CAN transmit interrupt [SWS_CanTp_00236].

This usage note was generated automatically based on the specification of AUTOSAR Classic Release R20-11.

Implementer's Guide to follow (complexity I2)

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/CP_MOD_CanTp
Status
unspecified
Version
AUTOSAR/AP/record/CP_MOD_CanTp@rel:R20-11#358cc7cc
Content hash
358cc7cc
Source
https://www.autosar.org/fileadmin/standards/R20-11/CP/AUTOSAR_SWS_CANTransportLayer.pdf#nameddest=SWS_CanTp_00208

Initialization and status

This function returns the version information of the Can Tp module.

void CanTp_GetVersionInfo (Std_VersionInfoType* versioninfo);
CanTp_Init function

This function initializes the Can Tp module.

void CanTp_Init (const CanTp_ConfigType* CfgPtr);

Services

Requests cancellation of an ongoing reception of a PDU in a lower layer transport protocol module.

Std_ReturnType CanTp_CancelReceive (PduIdType RxPduId);

Requests cancellation of an ongoing transmission of a PDU in a lower layer communication module.

Std_ReturnType CanTp_CancelTransmit (PduIdType TxPduId);

Request to change a specific transport protocol parameter (e.g. block size).

Std_ReturnType CanTp_ChangeParameter (PduIdType id, TPParameterType parameter, uint16 value);

This service is used to read the current value of reception parameters BS and STmin for a specified N - SDU.

Std_ReturnType CanTp_ReadParameter (PduIdType id, TPParameterType parameter, uint16* value);

This function is called to shutdown the Can Tp module.

void CanTp_Shutdown (void);

Requests transmission of a PDU.

Std_ReturnType CanTp_Transmit (PduIdType TxPduId, const PduInfoType* PduInfoPtr);

Callbacks

Indication of a received PDU from a lower layer communication interface module.

void CanTp_RxIndication (PduIdType RxPduId, const PduInfoType* PduInfoPtr);

The lower layer communication interface module confirms the transmission of a PDU, or the failure to transmit a PDU.

void CanTp_TxConfirmation (PduIdType TxPduId, Std_ReturnType result);

Cyclic

The main function for scheduling the CAN TP.

void CanTp_MainFunction (void);

Types

Data structure type for the post - build configuration parameters.