Automotive SW - AUTOSAR Communication Stack(COM Stack)

Automotive SW - AUTOSAR Communication Stack(COM Stack)

#Article_2/3 #AUTOSARhandson_byCM

Article 2: ECU RUN State – Transmission and reception of a PDU

?In last #Article_1/3(find in my previous post)., When ECU triggers the function call “Com_IpduGroupStart(PduGroupID, TRUE)” from BswM Module at Startup phase.,

Transmitter side(TX): Frames/PDUs/Messages which are configured as “Period” transmission mode will start transmitting from ECU at periodic time.

Receiver side (RX): Frames/PDUs/Messages which are configured as Receive., ECU will Reinitialize Rx- timeouts and start receiving these with Com_RxIndication/ Com_TpRxIndication / Com_ReceiveSignal, and Com_ReceiveSignalGroup functions.

Here we will discuss about how PDUs are transmitted and received by the ECUs. In this article we are considering COMStack on CAN Bus.

Transmission of PDU:

Whenever user want to transmit a PDU from application software(A-SWC)., User can trigger API “Rte_write_xx”(here ”xx” is the signal name) and further AUTOSAR SW triggers below mentioned API’s consecutively to transmit a PDU from ECU to specific protocol hardware bus(CAN Bus/Eth Bus/Flexray Bus etc.,).,

Below figure shows APIs which are involved in Transmission of a PDU:

?

?

When user triggers API “Rte_write_xx” how AUTOSAR COM Module will transmit the PDU is depends on four(4) Key factors mentioned below.,

??????? KEY FACTORS FOR TRANSMITTING PDU are “4”

1.???? COM Transfer Mode(Applicable to PDU)

2.???? COM Transfer property(Applicable to Signals which is in PDU)

3.???? COM Tx Filtering(Applicable to Signals which is in PDU)

4.???? COM Tx Mode selection(Applicable to PDU, Evaluated based on Signals filtering)

?

1.??COM Transfer Mode (PDU transmission modes):

  • DIRECT: The message is transmitted in the next Com_MainFunctionTx() call after a trigger event occurred.
  • ?PERIODIC: The IPDU is transmitted with the specified cycle time (ComTxModeTimePeriod).
  • MIXED: Combines the transmission modes of CYCLIC and DIRECT.
  • NONE: COM does not transmit the I-PDU. The transmission must be triggered by the lower layer through Com_TriggerTransmit().

??????? All transmission modes, except NONE, maintain the Minimum Delay Time (ComTxIPduMinimumDelayTime) and delay a transmission if required.

??????? The transmission mode None shall not have any further sub-attributes in the ComTxMode object.

?

2.? COM Transfer property (Applicable to Signals which is in PDU):

???The transfer behavior for the transmission mode DIRECT or MIXED when ???writing to the signal can either be

  • TRIGGERED: the transmission of the message is triggered if the signal is written regardless of the signal value
  • TRIGGERED_WITHOUT_REPETITION: the transmission of the message is triggered just once without a repetition
  • TRIGGERED_ON_CHANGE: the transmission of the message is triggered if the signal is written and the signal value has changed
  • TRIGGERED_ON_CHANGE_WITHOUT_REPETITION: the transmission of the message is triggered just once without a repetition
  • PENDING: writing to the signal does not cause direct transmission.

3.? Filtering algorithms :

AUTOSAR COM module can apply a filter to the received signals on the receiver side to filter some out.

AUTOSAR COM modules can also use the filtering mechanisms on sender side for Transmission Mode Conditions(TMC).

Filter can be chosen from below filters for ComFilterAlgorithms :

? ?Always: This filter always evaluates to TRUE

? ?Never: This filter always evaluates to FALSE

? ?MaskedNewDiffersMaskedOld: ((new & mask) != (old & mask))

? ?MaskedNewEqualsX:? ((new & mask) == x)

? ?MaskedNewDiffersX:? ((new & mask) != x)

? ?NewIsOutside: ((new < min) || (max < new))

? ?NewIsWithin: ((min <= new) && (new <= max))

?

4.?? COM Tx Mode selection:(Applicable to PDU, Evaluated based on Signals filtering)

  • If the AUTOSAR COM module evaluates the TMC of a contributing signal as true, then the AUTOSAR COM module shall evaluate the TMS as true.
  • If the AUTOSAR COM module evaluates no TMC of a contributing signal as true, then the AUTOSAR COM module shall evaluate the TMS as false.

?

  • Sender Side: Used TMC for Ipdu mode selection, No filtering out
  • Receiver Side: Filtering out takes only on Receiver side
  • COM stores old value for filter evaluation (comparing with new value)
  • False: COM discards and will not process that signal ( No updation of old value)
  • True: COM accepts and process it (Updation of old value)
  • No transmission of PDU with NONE, Com_Trigger-Transmit can request its transmission
  • Pending signal + PDU = transmitted, if PDU transmiision is triggered by other triggered signal or Tx scheduling because of Periodic/Mixed

?

Refer below diagram to know how above four key factors are contributing to Sending a signal from RTE to lower modules via COM Module.


Refer below table for Summary on Transfer properties and Transfer modules:


*This table is prepared with assumption of "ComFilteralgorithm" is configured as "Always“.

?

Signal Processing on Transmission:

This option determines the call context and the point of time when the signal notification function is called.

DEFERRED? - ?

  • Signal indication / confirmations are deferred for example to a cyclic task
  • The notification function is called on task level during the next call cycle of Com_MainFunctionRx() or Com_MainFunctionTx().

IMMEDIATE –

  • The signal indications/confirmations are performed in Com_RxIndication/ Com_TxConfirmation

Com_RxIndication??? : This function might be called in interrupt context.

  • Com_TpRxIndication: This function might be called in interrupt context

  • The notification function is called within Com_TxConfirmation() or Com_RxIndication(). Depending on the lower layer interface, this might be in interrupt context.

NOTE: Refer “AUTOSAR_SWS_COM.pdf” Chapter:12 Appendix A for Transmission of a PDU Use Cases.

?

Reception of a PDU:

Whenever message receives at physical bus., Controller will get interrupt and further APIs which is involved in processing of Receiving PDU is shown in below.,


?

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.

?Refer below diagram to know how Receiving a signal to ASW from lower modules via COM Module.


?

Update bits of Signal or Signal group:

  • By configuration on sender- and receiver-side, it is possible to add separately for each signal and/or separately for each signal group at most one update-bit.
  • The position of the update-bit is configurable by configuration parameter ComUpdateBitPosition.
  • 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.

??????? Update bits on sender side

?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.

??????? The timing of clearance of Update-bits can be configured to be either

1.???? After the I-PDU was sent out via PduR_ComTransmit and PduR_ComTransmit returned E_OK

2.???? After the I-PDU was sent out via PduR_ComTransmit, PduR_ComTransmit returned E_OK and the I-PDU was successfully confirmed.

3.???? After the contents of this I-PDU was successfully requested by Com_TriggerTransmit.

??????? Update bits on receiver side

?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 set, otherwise, it discards the signal or signal group.

?

END #Article_2/3. This #Article_2/3 is the summary of how AUTOSAR COMModule process the transmission or reception of a PDU.

The next POST_3/3 is about “Overview of error handling in COM Stack” and some “Debug hints”.

?

Please share your thoughts or queries in comment section of this post. If you want to add further technical details please add in comments.

?Thanks, See you with #Post_3/3

Thanh Vo

Embedded Engineer - Automotive Software Testing Engineer

3 周

??

回复
batlanki pujitha

Product Engineer at Harman Connected Services Corp India Private Ltd

9 个月

Thanks for the article.

Rambabu Nadiminti

Software Architect at ZF, AUTOSAR, ADAS, MCAL, CDD, OS, RTE, FUNCTONAL SAFETY,

1 年

Love this

Madikanti Rohith

Software Engineer || Autosar and Core Embedded.

1 年

Worth the time to read this , not that boring theory again , more on practical side?? Filtering was somewhat unclear, except that everything else is best on linkedin till now

要查看或添加评论,请登录

Chandra Mouleeswar Reddy的更多文章

社区洞察

其他会员也浏览了