Communication Services (ComStack CANTP) in AUTOSAR – Part 3

In this article we will discuss about the interaction between the modules like the PDU Router(Services Layer), CAN Transport Layer(Services Layer), CAN Interface(ECU Abstraction Layer) and CAN Driver(MCAL Layer). This article will be more focused towards CanTp module as the other modules are discussed in the previous articles. But will touch up on the other modules (PduR, CanIf and CanDrv) when there is an interaction between them and CanTp.

CAN Stack
CAN Stack

CAN Transport Layer

The basic services offered by the Can Tp module are segmentation of messages which have a payload of more than 8 bytes, transmission of the messages with flow control and reassemble the segmented messages at the receiver.

The CanTp module should comply with the ISO 15765-2 standard for message segmentation, segmented transmission and reassembly of segmented data. Transport protocol is mostly used for peer-to-peer communication in CAN.

Lets go through the basic Network Layer Protocol functions as specified by ISO 15765-2.

Network Layer Protocol performs transmission/reception of data of up to 4095 bytes and reporting of transmission/reception completion.

Single Frame (SF) Transmission :

Transmission/Reception of message of up to 7 data bytes is performed using a unique N_PDU. Single frame is used by the tester only in case of functional addressing wherein the tester is not aware of the physical address of the ECU or if the functionality of the ECU is implemented as a distributed server over several ECUs.

Multiple Frame Transmission :

Transmission of messages with longer data bytes is performed by segmenting the message and transmitting as multiple N_PDU. Reception is performed by reassembling the multiple received N_PDU’s.

First Frame (FF) : The FF data unit mostly contains the length of data in bytes which will be a part of the consecutive frame (CF) and remaining bytes can be used data bytes.

Flow Control Frame (FC) : The receiver has the possibility of adapting the transmitters throughput by using the FC frame. Using the FC frame the receiver can request the transmitter to send data bytes of certain block size(BS – maximum number of N_PDU’s the receiver allows the sender to send before it allows the sender to send the N_PDU’s again) and at a fixed rate(STmin – minimum time the sender has to wait before transmission of the next Consecutive N_PDU) so that the receiver the process the received data.

Consecutive Frame (CF) : It contains the transmitted data bytes along with the sequence number (SN) which specifies the CF number and this SN is used while assembling the data at the receiver.

Segmented Transmission
Segmented Transmission

There are many timing parameters involved in the transport protocol communication. Go through ISO 15765-2 for the description of all of them.

Consider if 49 bytes of data has to be transmitted using normal addressing then the flow of PDU’s might look like, first frame will contain the number of bytes to be transmitted, 49, the number of CF’s that will be used for the transmission of these 49 bytes, 7. The FC frame will have the BS and the STmin values specific to the receiver. The seven CF frames will contain the data bytes.

Interaction of CanTp with other modules

CanIf interacts with CanTp will giving the TxConfirmation and RxIndication about the transmitted and received PDU.

CanTp does not has its own buffer, so it uses the buffer of the upper layers (PDUR, DCM or COM). So to maintain the data consistency during Tx/Rx, buffer are locked. During the reception of data the CanTp module notifies the upper layer (PDUR) and the upper layer reserves the and locks the buffer for reception.

If the upper layer cannot make the buffer available for reception because of some error or resource limitation, it returns with an error. The CanTp then aborts the reception and the FC frame transmission depends on the error code from the upper layer.


During the transmission, the CanTp uses the addressing format to send the SF, FF and the CF frames. Transmission can fail if the upper layers are not able to make the data for transmission available before the internal timers elapse (please refer ISO 15765-2). CanTp resumes the transmission when data is available from the upper layer.

PDU Router module is first notified with a start of reception notification when receiving a first frame (FF) or single frame (SF). This call is be forwarded to the related upper layer module. The payload of each segment (N-PDU) is copied in the destination upper layer module. After reception of the last N-PDU the transport protocol module will indicate the PDU Router module that the complete I-PDU has been received and the PDU Router module will forward this indication to the related upper layer module.

The transmit operation of the PDU Router module is triggered by a PDU transmit request from a source upper layer source module and forwards the request to a destination lower layer module. During transmission PDUR does not buffers the PDU.

Gatewaying-on-the-fly : routing between two TP modules where forwarding of data is started (when a specified threshold is reached) before all data have been received. If larger amount of data is transported between two interfaces it is desirable to be able to start the transmission on the destination network before receiving all data from the source network. This saves memory and time.

3 thoughts on “Communication Services (ComStack CANTP) in AUTOSAR – Part 3

  1. Great work Sandeep!!!
    Thank you soo much for making it simpler and more clear .
    Your articles are THE BEST .
    Keep it up

Leave a Reply

Your email address will not be published.