COM Filters - Theory and Configuration

Micael Coutinho,autosarbswcom

COM filters have been inherited from the Interaction Layer (IL) from the OSEK specification, namely, the data filters. But they remain very much relevant to this day, as they are extremely useful and avoid unnecessary processing of messages and cluttering of the communication buses.

During transmission, filtering is used to evaluate the transmission mode conditions, not exactly stopping a transmission. Transmission Mode Selection (TMS) takes place, which decides the transmission mode of the respective I-PDU (you can read about COM transmission modes in our post COM - Demystifying I-PDU Transmission Modes (opens in a new tab)). The TMS selects the ComTxModeMode value of the container ComTxModeTrue in case of an evaluation set to true, or ComTxModeFalse, when the evaluation equates to false. This decision is based on the ComFilter container, which, if defined by a signal transmitted by the I-PDU, then the respective signal contributes to the final decision.

On the receiving end, after the I-Signals have been extracted from the I-PDUs, the filter is applied to provide the values (or not) to the application.

OSEK Definition of Data Filters

On the sender, these filters may be used to discard a message, according to its contents, relieving the underlying layers of unnecessary external communication. It does not apply to internal communication. On the receiver side, it can take part both in internal (intra-ECU) and external transmission (inter-ECU).

Filtering discards the message object received if certain conditions are met. These conditions are defined by configurable functions, which can also be implemented by the user. It is only available for messages that can be interpreted as unsigned integer types, and zero-length and dynamic length messages are also not available for filtering. If a value is filtered-out, it will not be passed on to the IL.

COM Filter Configuration in Autosar

The ComFilters available in the COM are defined in the table below. This table only specifies those defined by Autosar, but OSEK has more:

NameOperation
ALWAYSTrue
NEVERFalse
MASKED_NEW_EQUALS_X(value & mask) == x
MASKED_NEW_DIFFERS_X(value & mask) != x
MASKED_NEW_DIFFERS_MASKED_OLD(value & mask) != (old_value & mask)
NEW_IS_WITHINmin <= value <= max
NEW_IS_OUTSIDE(min > value) or (max < value)
ONE_EVERY_Noccurrence % period == offset

The container ComFilter (as seen in the picture below) is defined within a ComSignal of the COM module, which defines the filtering for a signal (and also for a ComGroupSignal), and is comprised of the following:

Overview of the ComFilter container within the COM

Overview of the ComFilter container within the COM

As for the Autosar meta-model, you can find the DataFilter element associated with an ISignalPort, NonqueuedReceiverComSpec, NonqueuedSenderComSpec and in some instance-references, which configures the same values as you have seen in the COM. By defining the filters in ARXML, you save yourself from doing manual labour, as the Autosar tooling extracts the parameters from the ARXML and maps them to the respective elements of the COM module, configuring it automatically upon the creation of an ECU Extract, by extracting the relevant EcucModuleConfigurationValues for your ECU.

Keep in mind, data filtering can only be applied to elements with an integer base type.

Closing Notes

I hope this post has provided you some clear insights on the role of the COM filters and how to configure them via the DataFilter ARXML container. Make sure to complement your Autosar learning experience by reading more of our posts and subscribing to the waiting list for the upcoming ebook about Classic Autosar!

Author: Micael Coutinho (opens in a new tab)

References:

© AutosarToday —@LinkedIn