AUTOSAR EXP ModeManagementGuide
AUTOSAR EXP ModeManagementGuide
AUTOSAR CP R22-11
Disclaimer
This work (specification and/or software implementation) and the material contained in
it, as released by AUTOSAR, is for the purpose of information only. AUTOSAR and the
companies that have contributed to it shall not be liable for any use of the work.
The material contained in this work is protected by copyright and other types of intel-
lectual property rights. The commercial exploitation of the material contained in this
work requires a license to such intellectual property rights.
This work may be utilized or reproduced without any modification, in any form or by
any means, for informational purposes only. For any other purpose, no part of the work
may be utilized or reproduced, in any form or by any means, without permission in
writing from the publisher.
The work has been developed for automotive applications only. It has neither been
developed, nor tested for non-automotive applications.
The word AUTOSAR and the AUTOSAR logo are registered trademarks.
Contents
1 Introduction 8
1.1 Further Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2 Overall mechanisms and concepts 9
2.1 Declaration of modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2 Mode managers and mode users . . . . . . . . . . . . . . . . . . . . . 10
2.3 Modes in the RTE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.4 Modes in the Basic Software Scheduler . . . . . . . . . . . . . . . . . 12
2.5 Communication of modes . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.5.1 Mode switch . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.5.2 Mode request . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.5.3 Conformance of mode switches and mode requests . . . . . 14
2.5.4 Mode proxies . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.5.5 Mode communication on multi core ECUs . . . . . . . . . . . 15
3 Configuration of the Basic Software Modemanager 17
3.1 Process how to configure and integrate a BswM . . . . . . . . . . . . . 17
3.2 Semantics of BswM Configuration: Interfaces and behavioral aspects . 18
3.2.1 Interface of the BswM . . . . . . . . . . . . . . . . . . . . . . 18
3.2.1.1 Mode Requests . . . . . . . . . . . . . . . . . . . . . 18
3.2.1.2 Available Actions . . . . . . . . . . . . . . . . . . . . 19
3.2.2 Definition of the interface in pseudo code . . . . . . . . . . . 20
3.2.2.1 Mode switch and mode request interfaces . . . . . . 20
3.2.2.2 ModeRequestPorts defined by the standardized in-
terface of the BswM . . . . . . . . . . . . . . . . . . 22
3.2.2.3 Configurable ModeRequestPorts . . . . . . . . . . . 29
3.2.2.4 Configurable ModeSwitchPorts . . . . . . . . . . . . 30
3.2.3 Configuration of the BswM behavior . . . . . . . . . . . . . . 30
3.3 ECU state management . . . . . . . . . . . . . . . . . . . . . . . . . . 32
3.3.1 ECU Mode Handling . . . . . . . . . . . . . . . . . . . . . . . 32
3.3.1.1 Startup . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.3.1.2 Running . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.3.1.3 Shutdown and Sleep . . . . . . . . . . . . . . . . . . 34
3.3.2 Startup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.3.3 Run . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.3.4 Shutdown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.3.5 Sleep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.3.6 Wakeup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.3.7 Reset of partitions . . . . . . . . . . . . . . . . . . . . . . . . 38
3.4 Communication Management . . . . . . . . . . . . . . . . . . . . . . . 39
3.4.1 Startup and Shutdown . . . . . . . . . . . . . . . . . . . . . . 39
3.4.2 Partial Network Cluster . . . . . . . . . . . . . . . . . . . . . 39
3.4.2.1 Aggregation of internal and external Partial Network
Cluster . . . . . . . . . . . . . . . . . . . . . . . . . . 41
References
[1] Software Component Template
AUTOSAR_TPS_SoftwareComponentTemplate
[2] Meta Model
AUTOSAR_MMOD_MetaModel
[3] Basic Software Module Description Template
AUTOSAR_TPS_BSWModuleDescriptionTemplate
[4] Specification of Basic Software Mode Manager
AUTOSAR_SWS_BSWModeManager
[5] Specification of Diagnostic Communication Manager
AUTOSAR_SWS_DiagnosticCommunicationManager
[6] Glossary
AUTOSAR_TR_Glossary
1 Introduction
This document is a general introduction to AUTOSAR mode management for the Re-
lease 4.0.3 onwards. Its main purpose is to give users as well as developers of
AUTOSAR an detailed overview of the different aspects of AUTOSAR mode manage-
ment based on examples, which are explained in context. The code listings in this
document together form the configuration of a sample ECU.
Chapter 2 explains the basic mode management concepts e.g. modes in general, how
mode switches are implemented, roles of mode managers and mode users etc. It sec-
ondly gives an introduction to Application Mode management and the dependencies to
Basic Software Mode management, which are closely related.
The Basic Software Modemanager is the central mode management module in
AUTOSAR R4.0. It is configurable to a high degree. How this configuration can be
achieved is the topic of chapter 3.
1
In R4.0 this is limited to a single partition
AbstractProvidedPortPrototype AbstractRequiredPortPrototype
«isOfType»
«isOfType» «isOfType» «atpVariation,atpSplitable»
+providedInterface
+requiredInterface
Interface InternalBehavior and Runnables
0..1 0..1 0..1
+internalBehavior 0..1
{redefines {redefines {redefines
atpType} atpType} atpType} InternalBehavior
ARElement SwcInternalBehavior
AtpBlueprint
AtpBlueprintable
AtpType
PortInterface «atpVariation,atpSplitable» «atpVariation,atpSplitable»
+event 0..* +runnable 0..*
AbstractEvent AtpStructureElement
+startOnEvent
AtpStructureElement ExecutableEntity
RTEEvent 0..1 RunnableEntity
ModeSwitchInterface
«instanceRef,atpSplitable»
+modeGroup 0..1
AtpPrototype
SwcModeSwitchEvent ModeSwitchedAckEvent
ModeDeclarationGroupPrototype
«isOfType» «instanceRef»
0..1 ModeDeclaration
+type +mode 0..2 {ordered} +disabledMode 0..*
{redefines atpType}
ARElement +modeDeclaration AtpStructureElement
AtpBlueprint Identifiable
AtpBlueprintable «atpVariation,atpSplitable» 0..*
ModeDeclaration
AtpType +initialMode
ModeDeclarationGroup
0..1
+enteredMode 0..1 +exitedMode 0..1
+modeTransition 0..*
AtpStructureElement
Referrable
ModeTransition
tion. Mode users are informed of Mode switches via well-defined mechanisms
and have the possibility to read the currently active mode at any time. If a Mode user
wants to change into a different mode it can request a Mode switch from the corre-
sponding Mode manager.
application mode manager application mode user basic software mode user basic software mode user
mode request mode switch mode request mode switch mode request mode switch
mode switch mode request port port
port port port port port port
Runtime Environment
System Services
Previous versions of the Basic Software Modules especially the ECU state manager
module have differentiated between ECU states and ECU modes. ECU modes were
longer lasting operational ECU states that were visible to applications i.e. starting
up, shutting down, going to sleep and waking up. The ECU Manager states were
generally continuous sequences of ECU Manager module operations terminated by
waiting until external conditions were fulfilled. Startup1, for example, contained all BSW
initialization before the OS was started and terminated when the OS returned control to
the ECU Manager module. With flexible ECU management the ECU state machine is
implemented as general modes under the control of the BSW Mode Manager module.
To overcame this terminology problem states are used only internally and are not visible
to the application. For interaction with the application the basic software has to use
modes.
«isOfType»
0..1
+type {redefines atpType}
ARElement +modeDeclaration AtpStructureElement
AtpBlueprint Identifiable
AtpBlueprintable «atpVariation,atpSplitable» 0..*
ModeDeclaration
AtpType
ModeDeclarationGroup + value: PositiveInteger [0..1]
+initialMode
+ onTransitionValue: PositiveInteger [0..1] 0..1
Mode requests are distributed on the way from the mode requester (Mode Arbitration
SWC or a generic SWC) to the mode manager. The mode managers on each ECU
then have to decide and initiate the local mode switch. Thus the arbitration result is
communicated only locally on each ECU using RTE mode switch mechanism.
For mode requests, the communication of modes works slightly differently as for
mode switches: without ModeDeclarationGroups.
The request of modes is done via standard SenderReceiverInterfaces. Contrarily
to ModeSwitchInterfaces the requested mode is not given by a ModeDeclara-
tionGroup but by a VariableDataPrototype that has to contain an enumeration.
This enumeration consists of a set which contains the modes that can be requested.
Mode requests can be distributed in the whole system. For application and vehicle
modes, the requests of the mode requester have to be distributed to all affected ECUs.
This implies a 1:n-connection between the mode requester and the mode Managers.
Currently AUTOSAR has a constraint that only local software components are allowed
to communicate with ServiceComponents. So it is not possible that a SoftwareCom-
ponent can request modes from a remote e.g Basic Software Mode Manager. To over-
come this limitation so called ServiceProxySwComponentType were introduced in
AUTOSAR Release 4.0. Figure 2.4 depicts this concept.
For the application software and the RTE a ServiceProxySoftwareComponentType
behaves like a "normal" AtomicSwComponentType, but it is actually a proxy for an
AUTOSAR Service. This means that on the one side it has to communicate over ser-
vice ports with the ECU-local ServiceSwComponentType it represents. On the other
side it has to offer the corresponding PortPrototypes to the ApplicationSwCom-
ponentTypes. In the meta-model, the ServiceProxySwComponentType does not
differ from an ApplicationSwComponentType except by its class. It is up to the im-
plementer to meet the restrictions imposed by the semantics as a proxy. The main
difference between a ServiceProxySwComponentType and an Application-
SwComponentType is on system level: A prototype of a ServiceProxySwCompo-
nentType can be mapped to several ECUs even if it appears only once in the VFB
system, because such a prototype is required on each ECU, where it has to address
a local ServiceSwComponentType. As a result of this, a ServiceProxySwCompo-
nentType can only receive but not send signals over the network. (see also [1]).
ECU1 ECU2
Runtime Environment
System Services
Core1 Core2
1
This documents assumes that the Implementation of the BswM is generated to a large extend.
The following paragraphs define the interface of the BswM in pseudo code.
<SENDER-RECEIVER-INTERFACE>
<SHORT-NAME>exampleModeRequestPort</SHORT-NAME>
<IS-SERVICE>false</IS-SERVICE>
<DATA-ELEMENTS>
<VARIABLE-DATA-PROTOTYPE>
<SHORT-NAME>exampleModeRequest</SHORT-NAME>
...
<TYPE-TREF DEST="APPLICATION-PRIMITIVE-DATA-TYPE">ENUM_ApplicationModes
</TYPE-TREF>
</VARIABLE-DATA-PROTOTYPE>
</DATA-ELEMENTS>
</SENDER-RECEIVER-INTERFACE>
...
<APPLICATION-PRIMITIVE-DATA-TYPE>
<SHORT-NAME>ENUM_ApplicationModes</SHORT-NAME>
<CATEGORY>VALUE</CATEGORY>
<SW-DATA-DEF-PROPS>
<SW-DATA-DEF-PROPS-VARIANTS>
<SW-DATA-DEF-PROPS-CONDITIONAL>
<COMPU-METHOD-REF DEST="COMPU-METHOD">ENUM_ApplicationModes_def</
COMPU-METHOD-REF>
</SW-DATA-DEF-PROPS-CONDITIONAL>
</SW-DATA-DEF-PROPS-VARIANTS>
</SW-DATA-DEF-PROPS>
</APPLICATION-PRIMITIVE-DATA-TYPE>
...
<COMPU-METHOD>
<SHORT-NAME>ENUM_ApplicationModes_def</SHORT-NAME>
<CATEGORY>TEXTTABLE</CATEGORY>
<COMPU-INTERNAL-TO-PHYS>
<COMPU-SCALES>
<COMPU-SCALE>
<LOWER-LIMIT INTERVAL-TYPE="CLOSED">0</LOWER-LIMIT>
<UPPER-LIMIT INTERVAL-TYPE="CLOSED">0</UPPER-LIMIT>
<COMPU-CONST>
<VT>ModeA</VT>
</COMPU-CONST>
</COMPU-SCALE>
<COMPU-SCALE>
<LOWER-LIMIT INTERVAL-TYPE="CLOSED">1</LOWER-LIMIT>
<UPPER-LIMIT INTERVAL-TYPE="CLOSED">1</UPPER-LIMIT>
<COMPU-CONST>
<VT>ModeB</VT>
</COMPU-CONST>
</COMPU-SCALE>
<COMPU-SCALE>
<LOWER-LIMIT INTERVAL-TYPE="CLOSED">2</LOWER-LIMIT>
<UPPER-LIMIT INTERVAL-TYPE="CLOSED">2</UPPER-LIMIT>
<COMPU-CONST>
<VT>ModeC</VT>
</COMPU-CONST>
</COMPU-SCALE>
</COMPU-SCALES>
</COMPU-INTERNAL-TO-PHYS>
</COMPU-METHOD>
Listing 3.3: Excerpt of the mode request interface’s ARXML description
Every mode request to the BswM has to be mapped to an restricted set of values,
which allows the integrator the define the arbitration rules.
The ECU modes can be set by BswM using the EcuM_SetState API.
Purpose: Via this interface BswM sets the current state of the EcuM.
Signature: EcuM_SetState(EcuM_StateType State)
Modes: modeGroup EcuM_StateType {
ECUM_STATE_STARTUP,
ECUM_STATE_APP_RUN,
ECUM_STATE_APP_POST_RUN,
ECUM_STATE_SHUTDOWN,
ECUM_STATE_SLEEP
}
In the BswM configuration, the mode request sources have to be defined. The fol-
lowing ModeRequestPorts are implicitly defined by API of the BswM. This subsection
summarizes the port interface.
The following ModeDeclarationGroups are defined in the particular SWS docu-
ments of the AUTOSAR specification as C-Enums. Nevertheless they are referenced
here in form of BswM configurations which act as a base for the rest of this document.
Refer to the definition of C-Enums in the SWS documents for the definition of modes.
3.2.2.2.1 BswMComMIndication
3.2.2.2.2 BswMComMPncRequest
3.2.2.2.3 BswMDcmComModeRequest
3.2.2.2.4 BswMCanSMIndication
3.2.2.2.5 BswMEthSMIndication
3.2.2.2.6 BswMFrSMIndication
3.2.2.2.7 BswMLinSMIndication
Note: This ModeRequestSource has to be created once for each Lin chan-
nel.
3.2.2.2.8 BswMEcuMRequestedState
Purpose: Via this interface EcuM requests a state from BswM based on the
result of the RUN Request Protocol.
Signature: BswM_EcuM_RequestState(
EcuM_StateType State,
EcuM_RunStatusType CurrentStatus)
Modes: modeGroup EcuM_StateType {
ECUM_STATE_APP_RUN,
ECUM_STATE_APP_POST_RUN
}
Parameter: EcuM_RunStatusType {
ECUM_RUNSTATUS_UNKNOWN,
ECUM_RUNSTATUS_REQUESTED,
ECUM_RUNSTATUS_RELEASED
}
3.2.2.2.9 BswMEcuMCurrentState
3.2.2.2.10 BswMEcuMWakeupSource
Purpose: Function called by the ECUM to indicate the current state of the
wakeup sources.
Signature: void BswM_EcuM_CurrentWakeup(
EcuM_WakeupSourceType source,
EcuM_WakeupStatusType state
)
Modes: modeGroup EcuM_WakeupStatusType
3.2.2.2.11 BswMLinScheduleIndication
Modes: The reported modes depend on the configured schedules in the Lin
Statemanager.
Example: request LinScheduleIndication LinSM1_CurrentSchedule {
processing IMMEDIATE
initialValue TBD
source MyLinSM.LinSMChannel
}
3.2.2.2.12 BswMLinTpModeRequest
3.2.2.2.13 BswMNvMJobModeIndication
Purpose: Indicates the current status of the multiblock job. The job is iden-
tified via BswMNvmService, e.g. 0x0c for NvmReadAll, 0x0d for
NvmWriteAll.
Signature: void BswM_NvM_CurrentJobMode(
uint8 ServiceId,
NvM_RequestResultType CurrentJobMode
)
Modes: modeGroup NvM_RequestResultType
3.2.2.2.14 BswMNvMRequest
Purpose: Via this Mode Request Source the NvM indicates the current status
of the specified block.
Signature: void BswM_NvM_CurrentBlockMode(
NvM_BlockIdType Block,
NvM_RequestResultType CurrentBlockMode
)
Modes: modeGroup NvM_RequestResultType
3.2.2.2.15 BswMJ1939NmIndication
3.2.2.2.16 BswMWdgMRequestPartitionReset
3.2.2.2.17 BswMJ1939DcmBroadcastStatus
Note: This is a notification of the desired broadcast status per network, trig-
gered via DM13.
Besides the interface, which is defined by the standardized interface of the BswM,
additional mode request ports can be defined via the configuration parameters.
E.g it is necessary for the interaction with applications, that an application software
component at least notifies the BswM about it’s current state. This can be achieved by
definition of a ModeRequestPort as shown in Listing 3.4. The BswM will than create
a corresponding RPort typed by a SenderReceiverInterface.
request SwcModeRequest App1ModeRequest {
source MSIF_ApplicationModes.appMode
processing IMMEDIATE
initialValue ModeA
}
Listing 3.4: Application ModeRequestPort
Listing 3.5 shows the declaration of a mode notification port. Note that in contrast
to 3.4 the BswM will generate a RPort typed by a ModeSwitchInterface in this
case. The BswM then gets informed via a ModeSwitchNotification if the mode
manager initiates a mode switch.
Listing 3.6 shows the declaration of a mode notification port. If such a port is config-
ured, the BswM configuration tool will create a requiredModeGroup ModeDecla-
rationGroupPrototype, so that the BswM gets informed of mode switches via the
Schedule Manager, if the corresponding mode manager initiates a mode switch with a
call to SchM_Switch API.
The BswM can send mode switches through a configured BswMSwitchPort. For a
configured BswMSwitchPort the BswM may generate a PPortPrototype, a pro-
videdModeGroups.ModeDeclarationGroupPrototype or both of them, depend-
ing on the configuration (see BswM SWS). 3.7 shows an example for a BswMSwitch-
Port.
switchport EcuMode {
modeSwitchinterface MSIF_EcuMode
}
Listing 3.7: Example for a configurable mode switch port
The behavior of the BswM is specified via rules and action lists. A rule is a logical
expression, which combines the current values of ModeRequestTypeMaps. The eval-
uation of each rule either results in the execution of its true or false action lists.
The ModeControlContainer contains these ActionLists. An ActionList can
consist of a set of atomic actions, other “nested” ActionLists or it can reference
(nested) rules which are then evaluated in the context of this Actionlist.
The following example shows a simple rule, which activates the IPDU Groups
of a dedicated CAN channel. According to this rule, the BswM has to pro-
vide a ModeRequestPort of type CanSMIndication named Can1_Indication.
This is a ModeRequest from a basic software module in this case from the
Can State manager. In code this ModeRequestPorts corresponds to the API
BswM_CanSM_CurrentState as described in [SWS_BswM_00049] in [4]. The
source parameter identifies the network to which this ModeRequestSourcePort
belongs to. It’s up to the configuration tool of the BswM to allocate the right parameters
for the API corresponding to the referenced ECUC Container.
At which point in time a rule is executed, after an event has occurred depends on
the parameter BswMActionListExecution. Either it is executed every time the
rule is evaluated with the corresponding result, or only when the evaluation result has
changed from the previous evaluation. This is called triggered respectively condi-
tional execution.
Table 3.1 gives an overview in which situations an ActionList is executed or not.
Triggered ActionLists are executed (triggered) if the result of the rule evaluation
changes. Conditional ActionLists depend only on the current result (condition) of
the evaluation independent if it has changed or not.
eval. result false ->
true -> true true -> false false -> true
(old) -> (new) false
TRIGGERED/
TrueActionList CONDITION - -
CONDITION
TRIGGERED/
FalseActionList - CONDITION -
CONDITION
ECU Mode Handling is introduced with AUTOSAR 4.2.1 in BSW modules ECU State
Manager with flexible state machine and BSW Mode Manager. ECU State Manager
provides a common interface to SW-Cs to request and release the Modes RUN and
POST_RUN.
The ECU State Manager (EcuM) does not contain an own state machine. It shall
receive state notifications from BswM and propagate these to the RTE.
The following API is provided for ECU Mode Handling:
Purpose: Via this interface EcuM notifies BswM about the current Mode of ECU
Mode.
Modes: modeGroup EcuM_StateType {
ECUM_STATE_STARTUP,
ECUM_STATE_APP_RUN,
ECUM_STATE_APP_POST_RUN,
ECUM_STATE_SHUTDOWN,
ECUM_STATE_SLEEP
}
3.3.1.1 Startup
The Mode STARTUP is applied during startup of RTE. After all drivers are initialized,
the RUN Mode is set:
rule SwitchToStartup initially false {
if (EcuMode == ECUM_STARTUP) {
actionlist SwitchToStartup
}
}
3.3.1.2 Running
When all EcuM users have released the RUN Mode, EcuM sets the RUNRequested
Mode to RELEASED.
Rule SwitchToPostRun initially false {
if (EcuM_CurrentState==RUN && RUNRequested == RELEASED) {
actionlist SwitchToPostRun
}
}
SWCs can request RUN Mode during POST_RUN. The following BswM rule switches
back to RUN Mode in case at least one EcuM user has requested the RUN Mode.
rule SwitchBackToRunMode initially false {
if (EcuM_CurrentState==POST_RUN && RUNRequested == REQUESTED &&
POSTRUNRequested == RELEASED) {
actionlist SwitchBackToRunMode
}
The BswM rules below illustrate only the switch to SLEEP Mode.
rule SwitchToShutdownMode initially false {
if (EcuM_CurrentState==POST_RUN && RUNRequested == RELEASED &&
POSTRUNRequested == RELEASED) {
actionlist SwitchToShutdownMode
}
Note that further BswM rules are needed for a complete running system.
3.3.2 Startup
The ECUM starts the operating system and afterwards its post OS se-
quence starts the Schedule Manager (SchM_Start()), initializes the BswM
(BswM_Init()) and afterwards finishes the initilization of the SchM (SchM_Init()
and SchM_StartTiming()). The BswM after its initialization has to take care, that
all necessary init routines of the basic software modules are called and that the RTE is
started (First Rte_Start(), then Rte_Init() and at last Rte_StartTiming()).
In this scenario it is expected that the BswM has the following ModeDeclara-
tionGroup. The purpose of this modeGroup is to track the current state/mode of the
ECU similar to the states of the ECU State manager in previous AUTOSAR releases.
Rule InitBlockII specifies the initialization of basic drivers to access the NVRAM
and initiates NvM_ReadAll. As the EcuMode source has the processing attribute set
to DEFERRED this rule will be evaluated every time the main function of the BswM is
called. After the first run it sets the EcuMode to ECU_STARTUP_TWO so that the action
list will never be invoked again.
In order to ensure that the RTE is properly initialized before runnables in service mod-
ules call RTE API functions, those runnables can be disabled by a mode disabling de-
pendency deactivating the runnable in all modes except EcuM mode RUN. For server
runnables - which cannot be disabled - the Rte will ignore incoming client server re-
quests as long as it is not initialized.
When the RTE is started the runnables will be started. Now it is up to the application
to keep the ECU running. To achieve this the BswM can for example provide a Mod-
eRequestPort as depicted in example 3.4. For the further reading is is expected,
that the application software requests the mode APP1_ACTIVE from the BswM. If this
mode is requested the BswM shall not shutdown the ECU.
rule checkApp1Request initially false {
if ( App1ModeRequest == MDG_ApplicationModes.ModeA && EcuMode ==
MDG_EcuMode.ECU_RUN) {
actionlist checkApp1RequestTrueActions
}
}
3.3.3 Run
As the BswM is a highly flexible module it depends to a high extend to the integrator,
how it is determined if an ECU shall shut down or not. Many different variants are con-
ceivable. This document proposes an approach, which is quite similar to the concept
of the ECUM in AUTOSAR R3.1. The general concept is, that a ECU keeps running as
long as at least one application software component requests the run state.
The information if an application can be shut down in a certain mode has to be pro-
vided by the software component developer. Example 3.12 shows a simplified rule for
an ECU with one software component. If switches its mode to INACTIVE the BswM
initiates the shutdown sequence.
rule checkApp1Request initially false {
if ( App1ModeRequest == MDG_ApplicationModes.APP_INACTIVE && EcuMode ==
MDG_EcuMode.ECU_RUN) {
actionlist checkApp1RequestActions
}
}
3.3.4 Shutdown
In state ECU_APP_POST_RUN the BswM waits until all channels report, that no requests
are pending any more. The rule in listing 3.12 is triggered every time the mode of a
ComM channel changes. If there are mmultiple ComM channels, they have to be
combined to a single expression.
rule InitiateShutdown initially false {
if ( ComM_Mode_Channel1 == COMM_NO_COM_REQUEST_PENDING && EcuMode ==
MDG_EcuMode.ECU_APP_POST_RUN) {
actionlist InitiateShutdownActions
}
}
Note that the in the configuration of the ECUM the module id of the
BswM has to be added as a valid user to EcuMFlexUserConfig.
===================================================
3.3.5 Sleep
Entering a sleep state is similar to the shutdown sequence 3.12 except that
EcuM_GoHalt resp. EcuM_GoPoll is called instead of EcuM_GoDown.
3.3.6 Wakeup
Example 3.14 shows a rule which starts the ECU only, if a certain wakeup event, iden-
tified by EcuM_WakeupSource has occured. Otherwise the ECU will be immediately
shut down.
In the case that an error occurred in a particular partition and it has to be restarted,
the BSW Modules which are partitioned to the partition have to be reinitialized. In
order to determine the partition which has been restarted, the Mode Request Source
BswMPartitionRestarted can be utilized.
rule InitBlockII initially false {
if ( EcuMode == MDG_EcuMode.ECU_STARTUP_ONE ) {
actionlist InitBlockIIActions
}
}
custom "Can_Init(null)"
custom "CanIf_Init(null)"
custom "CanSM_Init(null)"
custom "CanTp_Init(null)"
...
}
Listing 3.15: reset sequence of partition
Besides the initialization of the communication stack the BswM can be configured to
initialize further modules or execute customs actions depending on the ECU’s needs.
Due to the flexibility of the BswM it is also possible, that after a wake up event only a
part of the communication stack is started.
Analogue to Startup, it is possible to configure additional actions to be executed on
shutdown.
A Partial Network Cluster (PNC) is a (logical) group of ECUs which have to be active
at the same time to realize some distributed functionality. A PNC can be assigned to
one or multiple users (configuration in ComM) and specific software components can
superior PNC coordinator, which is connected via the so-called connector type "pas-
sive". The superior PNC coordinators will aggregate the subordinate coordinators PNC
request states, so the top-level coordinator will know about all active PNC requests in
the network, and send that info to the subordinate nodes.
This feature is used by every ECU that is member of a Partial Network Cluster (PNC).
Active PNC requests are forwarded by the ComM via the Nm to the <Bus>Nms. Pas-
sive PNC requests are received by the <Bus>Nms and forwarded to the Nm. Nm
handles received PNC request with respect to a so-called PN filter mask. The PN filter
mask define which of the received PNC requests are relevant. Nm collects and main-
tains internal and external PNC requests. The aggregation of internal and external
requested PNCs is called "External Internal Request Array (EIRA)". Changes of the
EIRA are forwarded by Nm to ComM. ComM needs this information to handle changes
in the corresponding PNC state machines.
The provided information of a request change (PNC request changed from requested
to released and vice versa) to ComM at (almost) the same time on every ECU, results
to switch the I-PDU-Groups synchronously on all direct connected ECUs. Therefore
the Nm maintain timers (so-called PNC reset timer) of each PNC request in the EIRA.
The PNC reset timer is restarted every time the corresponding PNC is requested within
received PNC bit vector and every time the corresponding PNC request is transmitted.
This feature is used by the ECUs where the PNC Gateway functionality is enabled to
collect the external PNC requests per channel. The external PNC requests have to be
coordinated across all affected channels. The logic of the PNC coordination is provided
by ComM. There, for each channel it is configured if it is actively or passively coordi-
nated. On actively coordinated channels, external PNC requests are mirrored back to
the channel where the PNC request was received and also forwarded to all other coor-
dinated channels (either passively or actively coordinated) where this PNC is assigned
to. On passive coordinated channels external PNC requests are forwarded to other
actively coordinated channels where this PNC is assigned to without mirroring back on
the channel from where the external PNC request was received. This avoids endless
mirroring of partial network cluster requests, if 2 ECUs have PNC Gateway function-
ality enabled and are connected to the same channel. The Nm module provides the
information if PNCs are externally requested or released to ComM and manages the
PNC timer handling for each relevant PNC and per channel. The aggregated state of
the external requested PNCs is called "External Request Array" (ERA).
In order to avoid timeout failure on application level, the PNC shall shutdown in a syn-
chronized way (all nodes in the PNC will shutdown at the same point in time). The syn-
chronized PNC shutdown is a functionality which is a cooperation of ComM, Nm and
<Bus>Nm to ensure a synchronized PNC shutdown at almost the same point in time
across the whole PN topology. A synchronized PNC shutdown is handled by ECUs in
role of a top-level PNC coordinator or intermediate PNC coordinator if the PNC Gate-
way is enabled. If the ComM of an ECU in the role of a top-level PNC coordinator
detects that a PNC is released (PNC is no longer internally or externally requested),
the ComM requests a synchronized PNC shutdown. The Nm module stores all re-
quests and handles them in the context of the Nm_Mainfunction. The Nm module
indicates the affected <Bus>Nms regarding an activated PNC shutdown process. The
<Bus>Nms call the Nm module to provide the aggregated requests for a synchronized
PNC shutdown as PNC bit vector per given NM-Channel. The <Bus>Nms use the pro-
vided PNC bit vector to assemble a NM-PDU as PN shutdown message and transmit
this message on the according NM channel. If a PN shutdown message is received
by an ECU in the role of an intermediate PNC coordinator, the <Bus>Nms extract
the PNC bit vector from the received PN shutdown message and forwards the infor-
mation by calling the callback function Nm_ForwardSynchronizedPncShutdown.
The callback function will immediately forward the indication to ComM by calling
ComM_Nm_ForwardSynchronizedPncShutdown. ComM will immediately request
a synchronized PNC shutdown of all actively PNC coordinated (coordinated by a PNC
gateway) ComMChannels. The requests for a synchronized PNC shutdown are for-
warded to the Nm module per NM-Channel and handled in the same way as described
in the previous section. If a PNC leaf node receives a PN shutdown message, then it
will handle the message as a usual NM message (update the local PN info and reset
PN reset time).
During integration of the modules, it must be considered that the processing of specific
requests is done asynchronously in the basic software (e.g. transmission requests,
some requests from the application) and also that specific actions may be processed
decoupled in the context of the main processing cycle of the involved modules (e.g.
transmission in the <Bus>Nms, processing of timers, state changes and notifications
to upper layers).
For the I-PDU group switching it is expected that dedicated I-PDU groups for outgoing
and incoming I-PDUs in COM exist for each channel or partial network. AUTOSAR
COM takes care that an I-PDU is active (started) if at least one I-PDU group containing
this I-PDU is active.
Please note that the handling of the I-PDU Groups is highly project specific and certain
use cases must be considered in the scope of the project (e.g. usage of <Bus>Sm
states instead of ComM modes or usage of both <Bus>Sm states AND ComM modes).
To illustrate how the I-PDUs of an ECU can be managed the following simplified sce-
nario is created to describe the handling. The exemplary ECU shall have two CAN
channels and three partial networks. The mode request ports for the channels are
named ComM_Mode_Channel1 and ComM_Mode_Channel2, the request sources for
the partial networks are named PNC1, PNC2 and PNC3. I-PDUs of PNC1 shall be com-
municated only over Channel1. I-PDUs of PNC2 shall be communicated over Chan-
nel1 and Channel2. I-PDUs of PNC3 shall be communicated only over Channel2.
I-PDU Groups used in this example are defined in the tables below.
I-PDU Groups PNC Direction Channel
PNC1PDUS_TX PNC1 TX Channel1
PNC1PDUS_RX PNC1 RX Channel1
PNC2PDUS_CH1_TX PNC2 TX Channel1
PNC2PDUS_CH1_RX PNC2 RX Channel1
PNC2PDUS_CH2_TX PNC2 TX Channel2
PNC2PDUS_CH2_RX PNC2 RX Channel2
PNC3PDUS_TX PNC3 TX Channel2
PNC3PDUS_RX PNC3 RX Channel2
}
DeadlineMonitoring {
disable ArMmExample.EcuC.MyCom.PNC1IPDUS_RX
}
}
PduGroupSwitch {
init true
disable ArMmExample.EcuC.MyCom.PNC1IPDUS_TX, ArMmExample.EcuC.MyCom
.PNC1IPDUS_RX
}
}
In contrast to current AUTOSAR network management, the task of J1939 network man-
agement is not to handle sleep and wake-up of ECUs, but to assign unique addresses
to each node represented by an ECU.
This is achieved by sending the AddressClaimed (AC, 0x0EE00) parameter group at
start-up, which announces the desired address. If another node claims the same ad-
dress, and has higher priority, the node has to go silent after sending the Cannot-
ClaimAddress parameter group (AC with null address as SA), or try to use another
address.
To support this use case the BswM is extended to accept state change indications from
the J1939Nm via the API function BswM_J1939Nm_StateChangeNotification()
(see also 3.2.2.2.15).
Depending on the state indicated by the network management the BswM needs to
switch ComIPduGroups of COM, PduRRoutingPathGroups of PduR, and general re-
quest handling of the J1939Rm.
The first two actions are realized via BswMPduGroupSwitch- and BswMPduRouter-
Control -actions. The J1939 Request Manager shall be switched using the
BswMJ1939Rm action.
COM is expected to have IPDU groups containing all locally received and transmitted
I-PDUs for each network. The PduR shall be configured in the same way, having
RoutingPathGroups for all locally received and transmitted IPDUs for each channel,
excluding the received I-PDU for the Request message forwarded to the J1939Rm.
The BswM must then be configured to switch on and off the aforementioned IPDU
groups and PduRRoutingPathGroups depending on the reported NM states, as well as
general request handling of the J1939 Request Manager. The following rule shows the
actions of the BswM depending on the NM states. 2
rule J1939_nm_normal_operation initially false {
if ( J1939NmState == NM_STATE_NORMAL_OPERATION ) {
actionlist J1939NormalOperationActions
}
}
}
Listing 3.22: Rule to implement network management according to J1939
In addition to address assignment the BswM has also to supervise the sending of
broadcast messages in a J1939 environment. Each IPDU group represents the broad-
cast messages (J1939 PGs with PDU2 format PGN or PDU1 format PGN and broad-
cast destination address) of one network.
For this purpose it is also expected that COM contains one IPDU group for each chan-
nel, which contains the broadcast messages of this ECU.
rule J1939_broadcast_management initially false {
if ( BswMJ1939DcmBroadcastStatus == NETWORK_ENABLED) {
actionlist J1939ActivateBroadcastActions
} else {
actionlist J1939DeactivateBroadcastActions
}
}
The BswM is able to switch the schedule tables LIN channels based on requests from
Application SWCs.
The SWC requests a LIN schedule table from the BswM in form of an application mode.
After the successful switch the BswM switches to the requested mode.
In the following, an example for this behavior is shown. At first, a ModeDeclara-
tionGroup is needed which is used by the Application SWCs to request a certain
schedule to which the LIN channel shall be switched.
modeGroup MDG_LinScheduleTables {
Schedule1,
Schedule2
}
The following BswM rule switches the schedule table of a LIN channel when the appli-
cation SWC request another application mode.
rule LinChannel1Schedule1Request initially false {
if (LinChannel1ScheduleTableRequestPort == Schedule1)
{
LinScheduleSwitch(LinSchedule1)
}
}
The following BswM rule switches the application mode to the mode which was previ-
ously requested by the application. It is triggered when the LinSM notifies the BswM
that a LIN schedule table switch occurred.
rule LinChannel1Schedule1Switched initially false {
if (LinSM_CurrentState == LinSchedule1)
{
RteSwitch(LinScheduleMode, Schedule1)
}
}
And finally the corresponding rules for the LIN schedule table LinSchedule2:
rule LinChannel1Schedule2Request initially false {
if (LinChannel1ScheduleTableRequestPort == Schedule2)
{
LinScheduleSwitch(LinSchedule2)
}
}
rule LinChannel2Schedule1Switched initially false {
if (LinSM_CurrentState == Schedule2)
{
RteSwitch(LinScheduleMode, LinSchedule2)
}
}
For Ethernet switch port switching it is expected that EthSwtPorts are condensed to
EthIfSwitchPortGroups. EthIfSwitchGroups could be derived from the Sys-
temDescriptionExtract. According to the modelling each EthSwitchPortGroup is
mapped to at least one PNC. The switching of EthIfSwitchPortGroup is real-
ized with particular BswM rules. Therefore, ComM reports the current mode of a
PNC via BswM_ComM_CurrentPNCMode. The mapping between PNCs and Eth-
SwitchPortGroup is known by the BswM. Thus, the BswM forward the reported
current mode of a PNC to the EthIf by calling EthIf_SwitchPortGroupRequestMode
with corresponding EthIfSwitchPortGroup. According to the given PortMode (ei-
ther ETH_MODE_DOWN or ETH_MODE_ACTIVE) the EthIf manages the requests
for EthIfSwitchPortGroups and decides to switch off or switch on EthSwtPorts. To
illustrate how the switching of EthIfSwitchPortGroups can be managed the follow-
ing scenario is created. The exemplary ECU shall have two partial networks (named
PNC1 and PNC2) and two according EthIfSwtPortGroups (named EthIfSwtPortGroup1
and EthIfSwtPortGroup2) configured:
• If PNC1 is requested,than EthIf_SwitchPortGroupRequestMode is called with
EthSwtPortGroup1 and ETH_MODE_ACTIV
• If PNC1 is released, than EthIf_SwitchPortGroupRequestMode is called with
EthSwtPortGroup1 and ETH_MODE_DOWN
• If PNC2 is requested, than EthIf_SwitchPortGroupRequestMode is called with
EthSwtPortGroup2 and ETH_MODE_ACTIVE
• If PNC2 is released,than EthIf_SwitchPortGroupRequestMode is called with
EthSwtPortGroup2 and ETH_MODE_DOWN
If a partial network is requested than the corresponding EthSwtPortGroup is
switched on.
rule pnc1requested initially false {
if ( PNC1 == COMM_PNC_REQUESTED ||
PNC1 == COMM_PNC_READY_SLEEP ||
PNC1 == COMM_PNC_PREPARE_SLEEP ){
actionlist pnc1requestedActions
}
}
EthIfSwitchPortGroupRequestMode {
init false
enable EthIfSwtPortGroup1
}
}
PduR routing path group switching is used to switch routing path of I-PDUs which are
not assigned to a Com I-PDU group (see chapter 3.4.4 I-PDU Group Switching), e.g.
I-PDUs transmitted via LdCom. LdCom has not the capability to control I-PDU groups
as it is provided by Com.
Therefore it is possible to control the affected PudR routing paths by configured PduR
routing path groups (similar to I-PDU groups in Com).
The PduR routing path groups are controlled via the following API:
PduR_EnableRouting(<routing path group id>) and PduR_DisableRouting(<routing
path group id>).
The APIs could be called by BswM based on particular BswM rules. This enable the
switching of PduR routing path groups in combination with partial networking, e.g.
ComM indicate the current PNC state to BswM, BswM evaluate the trigger conditions
of the dedicated BswM rules and trigger the BswM action (control the PduR routing
path groups).
Please note:
• If I-PDUs should be controlled, then it is recommended to control Com I-PDUs
via Com I-PDU groups and the remaining I-PDUs via switching of PduR routing
path groups.
The following scenarios illustrate how PduR routing path groups of an ECU can be
managed. The exemplary ECU shall have one physical Ethernet channel with two
VLANs and three partial network clusters.
The mode request ports for the VLANs are named EthSM_Vlan1 and EthSM_Vlan2,
the request sources for the partial network clusters are named PNC1, PNC2 and
PNC3. I-PDUs of PNC1 shall be communicated only over Vlan1. I-PDUs of PNC2
shall be communicated over Vlan1 and Vlan2. I-PDUs of PNC3 shall be communi-
cated only over Vlan2. In case of an indication by a bus state manager the BswM shall
check, which partial network clusters are requested.
rule activeWakeupVlan1 initially false {
if ( EthSM_Vlan1 == ETHSM_BSWM_FULL_COMMUNICATION){
actionlist activeWakeupVlan1Actions
}
If the bus state manager reports that a VLAN is going offline the BswM disable the
corresponding I-PDU routing path groups. If the channel is part of a partial network the
whole partial network has to be disabled.
rule offlineVlan1 initially false {
if (EthSM_Vlan1 == ETHSM_BSWM_NO_COMMUNICATION){
actionlist offlineVlan1Actions }
}
In case that a single partial network cluster is released the I-PDU routing path group
representing this network has to be disabled.
rule pnc1nocom initially false {
if ( PNC1 == PNC_NO_COMMUNICATION ) {
actionlist pnc1nocomTrueActions
}
}
If a partial network cluster is requested the corresponding I-PDU routing path groups
are enabled.
rule pnc1requested initially false {
if ( PNC1 == PNC_REQUESTED ||
PNC1 == PNC_READY_SLEEP )
{ actionlist pnc1requestedActions }
}
actions pnc1requestedActions on condition {
PduRRoutingPathGroupSwitch
{ init true enable ArMmExample.EcuC.MyPduR.PNC1_IPDU_ROUTING_PATHS }
}
rule pnc2requested initially false {
if ( PNC2 == PNC_REQUESTED ||
PNC2 == PNC_READY_SLEEP )
{ actionlist pnc2requestedActions }
}
actions pnc2requestedActions on condition {
PduRRoutingPathGroupSwitch
{ init true enable ArMmExample.EcuC.MyPduR.PNC2_IPDU_ROUTING_PATHS }
}
rule pnc3requested initially false
{ if ( PNC3 == PNC_REQUESTED || PNC3 == PNC_READY_SLEEP ) { actionlist
pnc3requestedActions }
}
actions pnc3requestedActions on condition
{ PduRRoutingPathGroupSwitch { init true enable ArMmExample.EcuC.MyPduR.
PNC2_IPDU_ROUTING_PATHS }
}
Listing 3.30: PNC reports PNC_REQUESTED or PNC_READY_SLEEP
3.5 Diagnostics
In AUTOSAR release 4.0.3 onwards the DCM is the overall mode manager for all di-
agnostic use cases. The BswM is responsible to change the state of the other basic
software modules accordingly.
The DCM acting as a mode manager can inform other BSW modules about the cur-
rent mode of the session control service and if needed set the basic software in the
corresponding mode. Listing 3.32 shows the corresponding mode switch interface.
Note that the same interface can also be used to inform the application software about
the current diagnostic session.
request BswModeNotification DiagnosticSessionControl {
source MSIF_DcmDiagnosticSessionControl.diagnosticSessionControl
processing IMMEDIATE
initialValue DefaultSession
}
Listing 3.32: ModeRequestPort for session control service of the DCM
In case of ECU Reset, the interaction between DCM and BswM is more complex. The
Specification of the Diagnostic Communication Manager [5] specifies for this purpose
the interface as described in listing 3.33. Via this interface the DCM signals the BswM
to
1. prepare the ECU to execute a specific reset.
2. to explicitly execute this reset.
modeGroup DcmEcuReset{
NONE,
HARD,
KEYONOFF,
SOFT,
JUMPTOBOOTLOADER,
JUMPTOSYSSUPPLIERBOOTLOADER ,
EXECUTE
}
[SWS_Dcm_00373] states that on reception of a request for UDS Service with the
sub functions other than enableRapidPowerShutDown (0x04) or disableRapidPower-
ShutDown (0x05), the DCM module shall switch the ModeDeclarationGroupPrototype
DcmEcuReset to the received resetType. After the mode switch is requested the DCM
triggers the start of the positive response message transmission.
According to [SWS_Dcm_00594] on the transmit confirmation (call to
Dcm_TpTxConfirmation) of the positive response, the DCM module shall trigger
the mode switch of ModeDeclarationGroupPrototype DcmEcuReset to EXE-
CUTE. By this final mode switch the DCM request the BswM to finally shutdown the
ECU and to to perform the reset.
Listing 3.34 depicts how the different reset scenarios specified in the DCM can be
configured in the DCM. Note that in the running example of this document the overall
EcuMode is used to signal to the DCM that the ECU is ready to be reset. Depending
on the diagnostic service the DCM shall wait for this acknowledgment or switch imme-
diately to the EXECUTE mode, which will cause the BswM to invoke EcuM_GoDown.
rule DcmEcuResetHard initially false {
if ( DcmEcuResetMode == DcmEcuReset.HARD) {
actionlist DcmEcuResetHardActions
}
}
}
rule DcmEcuResetSoft initially false {
if ( DcmEcuResetMode == DcmEcuReset.SOFT) {
actionlist DcmEcuResetSoftActions
}
}
}
rule DcmEcuResetBootLoader initially false {
if ( DcmEcuResetMode == DcmEcuReset.JUMPTOBOOTLOADER) {
actionlist DcmEcuResetBootLoaderActions
}
}
}
}
On reception of a request for UDS Service with the sub functions enableRapidPower-
Shutdown (0x04) or disableRapidPowerShutdown (0x05), the DCM module triggers
the mode switch of ModeDeclarationGroupPrototype DcmRapidPowerShut-
Down ENABLE_RAPIDPOWERSHUTDOWN or DISABLE_RAPIDPOWERSHUTDOWN.
In most use cases this is information is interpreted by the application to reduce overrun
times. Nevertheless it also can be provided to the BswM (listing 3.35) if different
shutdown sequences shall be realized by the BswM.
modeGroup DcmRapidPowerShutDown {
ENABLE_RAPIDPOWERSHUTDOWN,
DISABLE_RAPIDPOWERSHUTDOWN
}
If the DCM reports to the BswM that a specified communication control mode is en-
tered, the BswM has to enable resp. disable the corresponding IPDU groups as shown
in listing 3.36.
rule communicationcontrol1 initially false on condition {
if (Dcm_Communication_Control_CAN1 == DCM_ENABLE_RX_TX_NORM )
{
actionlist communicationcontrol_DCM_ENABLE_RX_TX_NORM
}
}
}
}
//----------------------------------------------------------------
actionlist communicationcontrol_DCM_DISABLE_RX_TX_NORM_NM
}
}
actions communicationcontrol_DCM_DISABLE_RX_TX_NORM_NM on trigger {
PduGroupSwitch {
init true
disable ArMmExample.EcuC.MyCom.CAN1NMTXIPDUS,ArMmExample.EcuC.MyCom.
CAN1TXIPDUS, ArMmExample.EcuC.MyCom.CAN1NMRXIPDUS, ArMmExample.EcuC.
MyCom.CAN1RXIPDUS
}
}
//----------------------------------------------------------------
Listing 3.36: Ruleset for diagnostic communication control
modeGroup DcmControlDTCSetting {
ENABLEDTCSETTING,
DISABLEDTCSETTING
}
The Dcm will switch the current status of the Roe per configured Roe Event via a mode
switch of ModeDeclarationGroupPrototype DcmResponseOnEvent_<RoeEventID>
switching the mode to EVENT_STARTED, EVENT_STOPPED and EVENT_CLEARED. The
information is necessary mainly for applications that need to interact with the Dcm if
the events shall be triggered from external.
ModeGroup DcmResponseOnEvent_<RoeEventID> {
EVENT_STARTED,
EVENT_STOPPED,
EVENT_CLEARED
}
Restart of a partition: If a partition is restarted, the local BswM signals to the other
BswM instances that it is in a restart mode. This signalling is done using normal mode-
communication between the BswM service components. Then, the other BswMs can
determine if local applications need to be informed or potentially restarted, and how to
synchronize them to the newly started partition.
4 Backward Compatibility
This chapter describes a setup to reuse software components (legacy SWCs), which
are designed to work with the “ECU State Manager (EcuM) with fixed state machine”
which is not a part of current AUTOSAR specifications anymore. This means that a
setup based on EcuM with flexible state machines and the BswM is described which
emulates the behavior of the EcuM with a fixed state machine.
An overview of the architectural solution is shown in Figure 4.1. To reuse software
components (legacy SWCs), which are designed to work with the "ECU State Manager
with fixed state machine" the option "ECU Mode Handling" has to be activated. A so
called Compatibility SWC is not necessary to realize this behavior.
SWC 1 SWC 2
EcuM User
RTE
EcuM Mode
EcuM_StateRequest
Rte_Switch_currentMode
EcuM BswM
BswM_EcuM_RequestedState
RUN
State
Request EcuM_SetState
Machine
Protocol
Figure 4.1: Default States in EcuM Flex make it possible to reuse legacy SWCs
Figure 4.2 depicts the behavioral aspects of the proposal. The small boxes represent
the states of fixed EcuM. The green boxes mark the phases of the EcuM flexible. Ap-
plication software will only notice changes during the UP phase.
The result is that all states of the fixed EcuM in the UP phase have to be emulated using
the BswM and the software component introduced for this scenario. This software
component has to map modes reported by the BswM to modes defined in the interface
of the EcuM with fixed statemachine.
4.1.1 Startup
During startup phase the same BSW modules shall be initialized as the fixed EcuM
does. This is implemented via BswM rules which are executed after initialization of
EcuM and initialize these modules. The modules which are already initialized by flexible
EcuM are omitted by BswM.
The changed BswM rules can be seen in Listing 4.1.
rule InitBlockII initially false {
if ( EcuMode == MDG_EcuMode.ECU_STARTUP_ONE ) {
actionlist InitBlockIITrueActions
}
}
custom "LinTp_Init(null)"
custom "FrTrcv_Init(null)"
custom "Fr_Init(null)"
custom "FrIf_Init(null)"
custom "FrSM_Init(null)"
custom "FrTp_Init(null)"
custom "PduR_Init(null)"
custom "CANNM_Init(null)"
custom "FrNM_Init(null)"
custom "NmIf_Init(null)"
custom "IpduM_Init(null)"
custom "COM_Init(null)"
custom "DCM_Init(null)"
custom "StartRte()"
custom "ComM_Init(null)"
custom "DEM_Init(null)"
custom "FIM_Init(null)"
custom "EcuM_SetState(ECU_RUN)"
}
Listing 4.1: BswM configuration for fixed EcuM compatible startup
4.1.2 Shutdown
For that shutdown mechanism the BswM configuration of Listing 4.2 is responsible. The
listed rules coordinate the post-run phase, deinitialize the modules and put the ECU
into shut down or sleep. These rules execute the same callouts EcuM_On<Mode>() as
it would happen with a fixed EcuM.
rule checkEcuMCompatibilityModeRequest initially false {
if ( EcuMode == MDG_EcuMode.ECU_APP_RUN) {
actionlist checkEcuMCompatibilityModeRequestActions
}
}
}
}
custom "EcuM_GoDown()"
}
Listing 4.2: BswM configuration for fixed EcuM compatible shutdown
4.1.3 Wakeup
The functionality for correct wakeup from sleep mode has to be fully configured in the
BswM. But as it does not need any adjustments for backward compatibility, there are
no modifications to be done.