BswM module of automotive electronics AUTOSAR

Table of contents

foreword

text

Overall Design Framework

mode arbitration process

mode control process

mode arbitration

Mode request sources (ModeRequestPorts)

Mode Condition (ModeCondition)

Logic Expressions

ModeRules

Initialization of pattern rules

mode control

Mode Control Basic Flow

pattern behavior

common function interface


foreword


First of all, I would like to ask you a few questions, you know:

  • Do you know what BswM does?
  • What is the relationship between the often said APP Mode or System state machine and BswM?
  • BswM module is a standard module of AUTOSAR, how to realize the internal working mechanism?
  • How does BswM interact with each SW-C and each BSW module?

。。。

Today, let's explore and answer these questions together. To make it easier for everyone to understand, the following is an outline of the topics of this article:

insert image description here

text


Overall Design Framework


As the name implies, the full name of BswM is Basic Software Management Module (ie Bsw Management) . According to the specific input from BSW or SW-C, this module executes the serialization operation directly on each BSW module under certain rule conditions. From the words I just summarized, it is not difficult to conclude that BswM has the following three notable features:

  • The input comes from each SW-C or each BSW module;
  • Certain rules and conditions need to be met during execution;
  • Realize the serialization operation of each BSW module;


According to the AUTOSAR specification, we can call the first two the mode arbitration process, and the last step is called the mode control process.

In order to facilitate everyone's understanding, firstly, a general introduction is given to the above-mentioned mode arbitration process and mode control process respectively.

mode arbitration process


As shown in Figure 1 below, the BswM module will receive Mode Request t or Mode Indication from the SW-C or BSW module as two input methods for mode arbitration. Usually the Mode Request comes from the SW-C module, and of course the BSW module is not excluded, such as when DCM requests ComM for full communication. Mode Indication always comes from BSW modules, such as CANSM, EcuM, WdgM, etc.

In the figure, you can also see some rule conditions that define the mode request. For example, when only Normal_Mode is TRUE and IFC1_Bus_Off is False, the condition is TRUE, and otherwise it is False. It can be seen that the rule condition in the mode arbitration process is also the truth expression, and the result of the truth expression is the result after the mode arbitration, which is used as the input of the next link mode control process.

insert image description here


Figure 1 Mode arbitration process


Both Mode Indication and Mode Request mentioned in the above process receive arbitration in BswM with the same status, and both types can be reflected in the AUTOSAR standard configuration item BswMModeRequestSource .

At the same time, the BswM module will obtain the current state of each module as the input of the mode arbitration by calling the standard interface of other BSW modules such as EcuM, COM, ComM, SM, and PduR. But it should be noted that if the result returned after calling these standard interfaces is an error (E_NOT_OK), then the BswM module can set DTC to notify the upper layer of the error or cancel the currently executing Action List.

mode control process


Mode control refers to the execution of a corresponding sequence of actions based on the result of the aforementioned mode arbitration (TRUE or FALSE). These behavior sequences are usually called "Action List", and these Action Lists are ordered, which means that the execution order of various Actions can be freely configured according to project needs.

insert image description here

Figure 2 Mode control process


As shown in Figure 2 above, each Action List can correspond to one or more actions, and AUTOSAR supports the free combination and reuse of different actions. Each behavior can be divided into the following three ways to achieve:

  • Directly call the standard interface of other BSW modules or RTE modules to achieve a series of controls (ie BSWM_ATOMIC );

  • ComM: Set the communication mode of the corresponding communication interface or allow communication on the corresponding channel;
  • COM: Realize the switching of IPDU message; (with initial value or without initial value);
  • COM: enable or disable the deadline timeout monitoring of the signal;
  • NM: enable or disable NM communication;
  • Link content in other Action Lists (ie B SWM_LIST );
  • enforce certain arbitration rules (i.e. BSWM_RULE );

In addition, while the mode control can control multiple actions, it can also use the ID number to ensure the execution order of each Action, so the Action List is an ordered list of actions. Certain arbitration rules can become a member of the Action List of a master rule as a subordinate rule.

After introducing the process of mode arbitration and mode control as a whole, I believe you have a basic understanding of the control flow of the BswM module. Next, we will describe the specific details of the mode arbitration and mode control process, so that everyone can understand the configuration process of the BswM module more clearly.

mode arbitration


Mode request sources (ModeRequestPorts)


The mode request source refers to the data source that needs to be judged during the mode arbitration process, and the acquisition of these data sources is a defined standard interface, you only need to configure the corresponding configuration to complete the data acquisition for other Bsw modules, that is BswM will provide and generate the corresponding function interface to obtain the data input of the corresponding Bsw module. Examples of common data request sources are shown in Table 1 below:

insert image description here

Table 1 Example of source of mode request


For the above-mentioned mode request sources, BswM has the following two ways to query the status of these request sources:

  • event-triggered

In this mode, it will only be executed when a Mode Indication or Mode Request is received, which is suitable for occasions where the source data of the mode request does not change much and is relatively stable;

  • poll traversal

In this mode, BswM will actively query the status of Mode Indication and Mode Request in its Mainfunction function, which is suitable for occasions where Indication or Request changes frequently. In general, you can directly use this mode to query the status of the request data source ;
The above two states can be selected by configuring the parameter BswMRequestProcessing .

Mode Condition (ModeCondition)


A pattern condition refers to a single expression that is compared to a set value based on the pattern request source above. For example, if the mode request source is X, and N is a set constant state, then the mode condition is to configure X == N or X! =N expression.

Logic Expressions


Compared with pattern conditions, logical expressions can realize the logical combination of multiple pattern conditions. Examples are as follows:

If Logic Expression only needs two logical combinations of Mode Indication 1 and Mode Indication 2, of course, theoretically it can support logical combinations of n single expressions, depending on the needs of the actual situation.

Mode Condition 1: X == 3;

Mode Condition 2: Y == 4;

Logic Expression A = (Mode Condition 1 (OR or AND or XOR or NAND) Mode Condition 2);

ModeRules


The pattern rule refers to executing the corresponding Action List according to the result of the above logical expression (TRUE or FALSE). It means that the pattern rule is to realize the mapping relationship between the logical expression and the corresponding Action List.

In order to have a better understanding of the mutual reference relationship and execution correspondence of the three major components (mode request source, mode condition, and logic expression) in the mode arbitration process, the relationship between each other is clearly shown in Figure 3 below. relationship between.

insert image description here

Figure 3 Organizational relationship of the three components of schema arbitration


Initialization of pattern rules


A pattern rule can set the initial value of the logical expression of its Map to be TRUE or FALSE, so that the corresponding Action List will be executed by default.

The initial value can be configured through the parameter BswMModeInitValue, and this parameter belongs to the sub-parameters of BswMRules. If no initial value is configured, the initial value of the mode arbitration is in the state of undefined, which means that BswM will execute once by default after completing its initialization. In most cases, the initial value of the pattern rule is FALSE.

mode control


Mode Control Basic Flow


The basic process of mode control is to execute the corresponding Action List according to the result of mode arbitration. As shown in Figure 4 below, take the SW-C component mode request as an example:

  • S1: SW-C sends mode request information to BswM module via RTE through sender port;
  • S2: The BswM module receives the request through the receive port and obtains the corresponding arbitration result according to the configured mode arbitration rules;
  • S3: Execute the corresponding Bsw-related Action List and RTE state switching;
  • S4: The status transmitted by RTE will be passed to the SW-C that needs to use this mode and return to the SW-C that requests this mode;

insert image description here


Figure 4 Basic process of mode control


pattern behavior


As the basic execution unit of pattern control, pattern behavior also has the following two methods in the process of executing Action List:

  • Cyclic execution (BswM_Condition), as long as the mode arbitration rules are established, it will be executed continuously;
  • Event trigger (BswM_Trigger), only when the pattern rules change, will the corresponding Action List be executed;

These two execution methods can be configured through the parameter BswMActionListExecution in the mode control process .

insert image description here

Figure 5 Triggering method of pattern behavior


Figure 5 above shows the results of executing the Action List under different combinations of BswMruleInitValue and the triggering method of the mode behavior, so that we can notice the relationship between them during the configuration process.

It should be noted that if the return result is E_NOT_OK during the execution of the Action List, then the BswM module should terminate the execution of the Action List. If it needs to be implemented, then the result of the configuration parameter BswMAbortOnFail needs to be set to TRUE .

In the configuration options of mode control, there are generally two types of options, BswMAction and BswMActionList, explained as follows:

  • BswMAction: It is used to configure various standard behaviors; (such as Com module message switching, etc.)
  • BswMActionList: used to define the set of actions (that is, take any free combination from BswMAction);

common function interface


In order to better use the module functions and facilitate debugging of the module when encountering problems, the more important and commonly used functions in the BswM module are listed in Table 2 below.

insert image description here


Table 2 Bsw module common function list

Guess you like

Origin blog.csdn.net/qq_42700289/article/details/131077944