Professional Documents
Culture Documents
Made By: Eng. Mahmoud Helmy
Made By: Eng. Mahmoud Helmy
4
• Signal
• Signals are the smallest entities for the exchange of information, they
carry a single data value, such as a temperature reading, speed
measurement, or status information.
• Each PDU consists of different signals.
• Signal Groups
• When two or more signals must be transmitted with time coherent values
these signals shall be defined in one signal group.
5
• Configuration and configuration parameters
Configuration parameters
• the variability of the generic part(s) of an implementation of a module.
• The configuration of parameters can be achieved at different times during the software process: before
compile time, before link time or after build time (post build).
Variants
• describe sets of configuration parameters.
• E.g., variant 1: only pre-compile time configuration parameters; variant 2: mix of pre-compile- and post build
time configuration parameters.
• In one variant a parameter can only be of one configuration class.
6
• Configuration and configuration parameters
Containers
• structure the set of configuration parameters. This means:
• all configuration parameters are kept in containers.
• sub-containers can reference sub-containers.
• It is possible to assign a multiplicity to these references. The multiplicity then defines the possible number of
instances of the contained parameters.
7
Service Layer
MCAL
8
• Abstract Microcontroller registers.
• A transceiver is responsible for voltage regulation of the physical can
pins.
• The <Bus Trcv> component is responsible for controlling the
transceiver hardware.
• The <Bus Trcv> component provides an abstraction layer that enables
software components (SWCs) to control and configure the
transceiver's behavior.
• The CAN Hardware Unit combines one or several CAN controllers,
which may be located on-chip or as external standalone devices of
the same type, with common or separate Hardware Objects.
9
• The Can module provides services to control the state of the CAN controllers. Bus-off and Wake-up events are
notified by means of callback functions.
• The Can module shall implement the interrupt service routines for all CAN Hardware Unit interrupts that are
needed.
• The Can module shall disable all unused interrupts in the CAN controller.
• Each CAN controller must then be started separately by calling the function Can_SetControllerMode(CAN_T_START).
• The ECU State Manager module shall call Can_Init at most once during runtime.
• There are two possibilities for triggering state changes by external events:
a. Bus-off event
b. HW wakeup event
• These events are indicated either by an interrupt or by a status bit that is polled in the
Can_MainFunction_BusOff or Can_MainFunction_Wakeup.
10
• Define how many CAN Controllers to use ,Baud rate, Filter Masks, HW objects.
• Filter Masks: used to specify the acceptance criteria for incoming messages. They determine which
messages are received and processed by the ECU.
• The bus driver configuration also includes defining the hardware objects (BasicCAN or a FullCAN)
reception method/ transmission method of the referenced reception unit and to indicate a received L-
PDU to a target upper layer module.
• It includes defining the number of channels supported by the transceiver and how they are controlled.
• The configuration may specify whether the transceiver is controlled through digital input/output (DIO)
pins or controlled via a serial peripheral interface (SPI) or other communication protocols.
11
BasicCAN and FullCAN Reception
• A CAN mailbox (hardware object) for FullCAN operation only enables transmission or reception of single
CanIds.
• BasicCAN enables to transmit or receive a range of CanIds.
12
13
14
Abstract drivers’ access
▪ abstracts the low-level driver operations, allowing SWCs to access and control the hardware
drivers through a standardized interface.
Transmission Buffering
▪ It manages the transmission queue, ensuring that messages are sent in the correct order and
timing as per the bus protocol requirements.
▪ The component provides APIs to enqueue messages for transmission and handles the necessary
processing to transmit the buffered data when the bus resources are available.
15
Reception Indication
▪ provides mechanisms for handling reception indications or notifications of
incoming messages or data from the bus.
▪ It detects incoming messages and triggers appropriate actions to inform SWCs
about the received data. These indications can be in the form of callbacks or
events that notify SWCs about the availability of new data for processing.
Provide APIs for controller modes
▪ allow software components to switch between different controller modes such as
NORMAL operation mode, SLEEP mode, INIT mode..etc
Software filtering
select and process only specific messages of interest.
16
Data length check
▪ verifies the length of the transmitted or received data against the defined constraints or
requirements to ensure that the transmitted or received data matches the expected length
specified by the bus protocol or application.
▪ CAN up to 8 bytes per message.
▪ The CanIf shall provide a ControllerId, which abstracts from the different Controllers of the different
CanDrv instances. The range of the ControllerIds within the CanIf shall start with ‘0’. It shall be
configurable via CANIF_CTRL_ID and same methodology for CAN Transceiver.
17
• During the notification process the CanIf maps the original CAN controller or CAN transceiver parameter
from the Driver module to the CanSm. This mapping is done as the referenced CAN controller or CAN
transceiver parameters are configured with the abstracted CanIf parameters ControllerId or TransceiverId.
18
▪ Hardware Object term is used in relation to CAN bus.
Hardware Object.
19
• Define Messages to be sent and received , their IDs , upper
layer, HW object reference
• The CanIf shall use two types of HOHs to enable access to
the CanDrv:
a. Hardware Transmit Handle (HTH)
b. Hardware Receive Handle (HRH)
• Hardware object handles (HOH) for transmission (HTH) and
for reception (HRH) represent an abstract reference to CAN
mailbox structure, that contains CAN related parameters
such as CanId, DLC and data. Based on the CAN hardware
buffer abstraction each hardware object is referenced in the
CanIf independent of the CAN hardware buffer layout.
20
• The HOH is used as a parameter in the calls of the CanDrv's
interface services and is provided by the CanDrv's
configuration and used by the CanDrv as identifier for
communication buffers of the CAN mailbox.
• The CanIf acts only as user of the Hardware object handle
but does not interpret it based on hardware specific
information.
• The CanIf therefore remains independent of hardware
• Each CanRxPduId shall be assigned to one or more HRH.
21
Transmit Request
• The CanIf’s transmit request function
CanIf_Transmit() is a common interface for
upper layers to transmit PDUs on the CAN
network.
• The upper communication layer modules initiate
the transmission only via the CAN Interface
module's services without direct access to the
CanDrv.
CanIf_Transmit():
• Check initialization status of the CanIf
• Identify CanDrv (only if multiple CanDrvs are used)
22
• Determine HTH for access to the CAN hardware transmit object
• Call Can_Write() of the CanDrv
Transmit Request
• The transmission is successfully completed,
if the transmit request service
CanIf_Transmit() returns E_OK
23
Transmit Confirmation
• If a previous transmit request is completed successfully, the CanDrv notifies it to the CanIf by the call of
CanIf_TxConfirmation()
24
Reception Indication
• In case of a new reception of an L-PDU the CanDrv calls CanIf_RxIndication() of the CanIf.
• The access to the L-PDU specific data is organized by these parameters:
a. Hardware Receive Handle (HRH)
b. Received CAN Identifier (CanId)
c. Received Data Length Code (DLC)
d. Reference to the received L-SDU
• CanIf performs the following steps at a call of CanIf_RxIndication():
a. Software Filtering (only BasicCAN), if configured
b. DLC check, if configured
c. buffer received L-PDU if configured
d. call upper layer receive indication callback service, if configured
25
Reception Indication
26
• The CanTp module offers services for segmentation of long messages – Tx ,
transmission with flow control, and reassembly of segmented messages – Rx.
• Its main purpose is to transmit and receive messages that may or may not fit
into a single CAN frame.
• Messages that do not fit into a single CAN frame are segmented into multiple
parts, such that each can be transmitted in a single CAN frame.
• Concurrent connection The CAN Transport Layer can manage several connections
simultaneously (e.g. a UDS and an OBD request can be received at the same time).
• PDU Padding: adding additional data to the transmitted PDUs to align them with specific
requirements, such as fixed PDU lengths or alignment rules imposed by higher-layer protocols.
27
28
• The CanTp module shall have two internal states,
CANTP_OFF and CANTP_ON.
• The CanTp module shall change to the internal state
CANTP_ON when the CanTp has been successfully
initialized with CanTp_Init().
• CanTp_Init() initialize all global variables of the module
and sets all transport protocol connections in a sub-
state of CANTP_ON in which neither segmented
transmission nor segmented reception are in progress
(Rx thread in state CANTP_RX_WAIT and Tx thread in
state CANTP_TX_WAIT).
29
• The following figure provides an example, to summarize the process of sending a frame, with a length of 50 bytes.
32
CanTp Channel
• A CanTp channel represents a logical connection between the transmitting and receiving entities.
• The main configurations for a CanTp channel include:
a. Channel ID: Each CanTp channel is identified by a unique ID.
b. Communication Type: Specifies whether the channel is used for transmitting (Tx) or receiving (Rx) data.
c. Addressing Format: Defines the addressing scheme used for identifying the N-SDU within the CanTp
channel.
d. Flow Control Type: Determines the flow control mechanism for managing the transmission of N-PDUs.
e. Segmentation Type: Specifies the segmentation strategy used to split large N-SDUs into smaller N-PDUs
during transmission.
f. Block Size and Block Separation Time: Parameters defining the maximum number of consecutive N-PDUs
and the time gap between blocks during segmented transmission.
33
Timing Parameters
• Timing parameters are crucial for proper synchronization and timing control in the CanTp layer.
• Some common timing parameters for CAN TP include:
a. N_Cs (Separation Time): Used in segmented transmission to define the time gap between
consecutive blocks.
b. N_As (Assemble Time): Specifies the maximum time allowed for the CanTp layer to reassemble
received N-PDUs into the complete N-SDU.
c. N_Bs (Block Size Time): Determines the time allowed for the receiver to process each block of
segmented N-PDUs.
d. N_Ar (Acknowledge Time): Defines the maximum time allowed for the sender to receive an
acknowledgment (ACK) from the receiver after sending a block.
34
• The PDU Router module is an I-PDU transfer unit placed above
interface modules and transport protocol modules (lower layer
modules) and below COM and DCM (upper layer modules).
• Beside the PDU Router module is the I-PDU Multiplexer (IpduM)
module that provides support for multiplexed I-PDUs.
35
• From the ECU point of view, the PDU Router module can perform three different classes of operations:
1. PDU Reception to local module(s): receive I-PDUs from lower layer modules and forward them to
upper layer modules.
2. PDU Transmission from local module(s): transmit I-PDUs to lower layer modules on request of
upper layer modules.
3. PDU Gateway: PDU gatewaying in the PduR refers to the conversion or routing of PDUs between
different communication interfaces or protocols. It enables interoperability between different
modules or systems that may use different protocols or data formats.
• receive I-PDUs from an interface module and transmit the I-PDUs immediately via the same or
other communication interface module(s)
• receive I-PDUs from a transport protocol module and transmit the I-PDUs via the same or other
transport protocol module(s).
36
The COM module calls PduR_ComTransmit (here the
PDU Router module will list the I-PDU ID), the PDU Router
module will call CanIf_Transmit (here the CanIf
module configuration will list the I-PDU ID), the CanIf
will call PduR_CanIfTxConfirmation (here the PDU
Router module configuration will list the IPDU ID), and
PDU Router module will call Com_TxConfirmation
(here the COM module configuration will list the I-PDU
ID).
37
• The PDU Router module shall identify routing path uniquely by the combination of source
module I-PDU ID (located in the PDU Router configuration) and destination I-PDU IDs (located in
the called destination module configurations).
• Multicast
Multicast of I-PDU has the following restrictions:
• No update-bits can be used
• No sequence counters can be used
• If deadline monitoring is used, then all destinations must provide transmit confirmations.
38
• the source module and destination module for each PDU. This ensures that the PDUs are correctly routed
from the source module to the intended destination module.
• The configuration defines the mapping between the PDUs and the corresponding modules within the
communication stack.
39
IPduM is responsible for managing the transmission and reception of I-PDUs (Inter-Protocol Data Units) in a
communication system.
• The IpduM has to be considered as an upper layer module when it calls the PDU Router module to transmit
multiplexed IPDUs or when it is called by the PDU Router module for the reception or transmit confirmation
of multiplexed I-PDUs or to provide data via trigger transmit.
• The IpduM has to be considered as Lower layer module when it calls the PDU Router module to forward a
transmit confirmation or a receive indication to an upper layer (e.g. COM) or when it is called by the PDU
Router module to update an I-PDU belonging to a multiplexed I-PDU
40
▪ A multiplexed I-PDU consists of a static part and a dynamic part,
where the static part consists of zero or more signals or signal
groups. The dynamic part consists of the selector field and one or
more signals or signal groups.
▪ The dynamic part of an I-PDU is comparable with a union in “C”
▪ The selector field of one I-PDU shall have a configurable size between
one and eight contiguous bits.
▪ no other modules depend on it and that it is be possible to build a
system without the IpduM module if it is not needed.
41
42
• AUTOSAR COM is a module between the RTE and the PDU Router.
• AUTOSAR COM module provides functionalities such as:
• Packing signals given by upper layer via RTE to I-PDUs and providing them to the lower
layer for transition
• Unpacking received I-PDUs from lower layer and providing unpacked signals to upper
layer.
• Gateways received I-PDUs from lower layer and immediately sends them to the same or
another lower layer module(e.g. CAN-->CAN, CAN-->LIN)
43
Interfacing with RTE
• The Com Module interfaces with the Run-Time Environment (RTE) of the system.
• The RTE acts as an intermediary between the application software and the communication stack.
• The Com Module interacts with the RTE to exchange data and control information, enabling
seamless communication between the application layer and the lower layers of the communication
stack.
Packing/Unpacking of Signals
• The Com Module is responsible for the packing (serialization) and unpacking (deserialization) of
signals into/from Protocol Data Units (PDUs) for communication.
• It ensures that the signals from the application layer are properly formatted and encoded into PDUs
for transmission.
• On the receiving side, it extracts the signals from the received PDUs and delivers them to the
44
application layer.
Communication Protection for Rx and Tx (Replicated PDUs)
• The Com Module provides communication protection mechanisms for both receiving (Rx)
and transmitting (Tx) PDUs. These mechanisms include measures such as error detection,
error correction codes, or checksums to ensure data integrity.
• Replicated PDUs refer to the transmission of duplicate PDUs to increase the likelihood of
successful reception, thereby improving the reliability of communication.
• Deadline monitors within the Com Module track and enforce the timing requirements for
data transmission.
• They ensure that PDUs are transmitted within their specified deadlines.
• If a deadline is missed, appropriate actions can be taken, such as error handling or reporting,
46
1. Transfer Property
a. TRIGGERED: In this transfer property, the I-PDU (Inter-Protocol Data Unit) is immediately
transmitted upon a trigger event, except if periodic transmission is defined for this I-PDU. This means
that whenever a trigger event occurs, the I-PDU is sent right away. For example, when a button is
pressed, a signal indicating the button press can be set to have a triggered transfer property,
TRIGGERED assigned to an I-PDU with ComTxModeMode DIRECT or MIXED, the AUTOSAR COM module
shall immediately (within the next main function at the latest) initiate
48
2. Transmission mode
Direct: In direct transmission mode, the I-PDU is
50
2. Transmission mode
Periodic: In periodic transmission mode, the I-PDU is transmitted cyclically with a specified cycle time.
This mode ensures that the I-PDU is sent at regular intervals. For instance, in a real-time monitoring
system, a sensor's readings may need to be transmitted periodically with a defined cycle time, such as
The following use case is an example to send I-PDU in periodic intervals(Tc time)
51
2. Transmission mode
Mixed: is a combination of DIRECT/N-Times and PERIODIC. In this mode, AUTOSAR COM module is
sending I-PDU periodically to the lower layer. But also, transmissions can be triggered at desired time.
The following use case is an example to send three I-PDUs when requested while AUTOSAR COM module
52
2. Transmission mode
None: the transmission of the I-PDU is triggered by lower layers in the communication stack.
The lower layers determine when and how the I-PDU should be transmitted. An example
would be when the lower layers handle the timing and synchronization of communication,
53
Signal Indication on reception (Unpacking of I-PDUs)
• In order to support both interrupt-driven and polled systems, it can be configured when the signal
indication takes place.
• There are two configurable signal indication modes IMMEDIATE and DEFERRED configurable via
ComIPduSignalProcessing.
▪ IMMEDIATE: AUTOSAR COM module immediately notifies RTE via configured ComNotifications for
the signals and signal groups included within the Com_RxIndication, or Com_TpRxIndication
function respectively, which are called by PduR(PDU Router, lower layer module) as an indication
of a reception of signals.
▪ DEFFERED: AUTOSAR COM module first copies the I-PDUs data given by PduR into COM, then
invokes the configured ComNotifications for the included signals and signal groups
asynchronously in the next call of Com_MainFunctionRx. 54
Signal Indication on reception (Unpacking of I-PDUs)
Immediate Unpacking
Deferred Unpacking
55
Minimum Delay Timer (MDT)
• The AUTOSAR COM module inherits the minimum delay timer mechanism and When an I-PDU is started, the
the MDT can be violated by stopping and starting I-PDUs rapidly. The behavior of the transmission deadline
monitoring timer is not affected by any transmission delay caused by the minimum delay time supervision.
• No minimum delay time monitoring shall take place, if ComMinimumDelayTime is omitted or configured to 0
56
Signal Gatewaying
• the process of transferring and converting signals between different
communication protocols or interfaces within the module itself.
• The signal gateway is an integrated part of the AUTOSAR COM module.
• Any external modules, except the cyclic task call, cannot access the signal
gateway.
• The AUTOSAR COM module’s signal gateway works with (group) signals and
signal groups.
• The AUTOSAR COM module’s signal gateway supports only static routing for the
ComGwMapping configuration container.
• The COM module acts as a gateway or mediator to facilitate communication
between various components or systems that may use different protocols or
57
interfaces.
Update-bits
• By configuration on sender- and receiver-side, it is possible to add separately for each signal and/or
• The value of Update-bit = 0(cleared) means the data has NOT been updated.
• The value of Update-bit = 1(set) means the data has been updated.
• When the RTE updates the value of signal or signal group with Com_SendSignal and Com_Send_SignalGroup
respectively, AUTOSAR COM module sets the update-bit of this signal or signal group.
58
Update-bits
▪ After the I-PDU was sent out via PduR_ComTransmit and PduR_ComTransmit returned E_OK.
▪ After the I-PDU was sent out via PduR_ComTransmit, PduR_ComTransmit returned E_OK and the
• If a signal or signal group with an update bit is received, the AUTOSAR COM module only processes
this signal(e.g. filter, notification, signal based gateway, byte swapping), if the signal’s update bit is
59
set, otherwise, it discards the signal or signal group.
❑ Initialization of COM
▪ Com_Init initializes all internal data that is not yet initialized by the start-up code (e.g. C-structs).
▪ During initialization, AUTOSAR COM module fills unused areas within I-PDU with a value configured in
ComTxIPduUnusedAreasDefault (e.g. 0xFF) and initializes each signals on sender and receiver side with a
▪ Com_Deinit function makes no communication via the AUTOSAR COM module possible, and all started I-PDU
groups stopped.
60
❑ Filtering of received signals and PDUs
▪ MASKED_NEW_DIFFERS_X: Pass messages whose masked value is not equal to a specific value
COMM_NO_COMMUNICATION.
synchronization.
66
67
• The CAN Hardware Unit combines one or several CAN controllers, which may be located on-chip or as
external standalone devices of the same type, with common or separate Hardware Objects.
• A few CAN hardware units support the possibility to combine several CAN controllers by using the CAN
RAM, to extend the number of message objects for one CAN controller. These combined CAN
controllers are handled as one controller by the Can module.
• The Can module provides services to control the state of the CAN controllers. Bus-off and Wake-up
events are notified by means of callback functions.
• The Can module shall implement the interrupt service routines for all CAN Hardware Unit interrupts
that are needed.
• The Can module shall disable all unused interrupts in the CAN controller.
• The Can module shall reset the interrupt flag at the end of the ISR (if not done automatically by
hardware). 68
• Each CAN controller must then be started separately by calling the function
Can_SetControllerMode(CAN_T_START).
• The ECU State Manager module shall call Can_Init at most once during runtime.
• There are two possibilities for triggering state changes by external events:
▪ Bus-off event
▪ HW wakeup event
• These events are indicated either by an interrupt or by a status bit that is polled in the
Can_MainFunction_BusOff or Can_MainFunction_Wakeup.
69