Mode Management
Mode management is essential to synchronize all the modules in an Autosar environment. Learn what it's all about
In Autosar, there are multiple managers, both for the global state of an ECU, which is the focus today, or its submodules, such as communication, with state and network managers for the standards bus's (CAN, Lin, FlexRay and Ethernet), for the entire COM and even a global manager for the vehicle network, NM.
Today, the focus will be on the ECU state machine itself, by knowing what are the different ECU modes and we'll learn briefly about what the modules in play are and how they infuence these states. It's a relatively complex topic, the more you look at it. So, let's start small.
What is the ECU state machine?
To answer this question, let's start by learning a bit about the EcuM (ECU State Manager). It's the BSW module that manages the different modes and transitions between the states within the ECU, where the states are OFF, RUN and SLEEP, and their transitions correspond to STARTUP, WAKEUP and SHUTDOWN. The state machine looks as such:
ECUM state machine, as per Autosar Specification
Now, let's take a look at the definition for each ECU state and transition:
-
STARTUP - its purpose is to initialize the BSW modules. It's separated internally into two states: before and after OS initialization
-
RUN - at this point, the RTE and all the BSW modules are initialized. It's used to communicate to the Software Components above the RTE that all BSW modules are initialized and ready to operate. It also includes a mechanism to synchronize the shutdown of the application, by including a POST_RUN mode, as an extra step before the ECU goes to sleep
-
SHUTDOWN - manages the controlled shutdown of BSW modules, resulting in some kind of shutdown of the ECU (sleep, off, reset). An important activity it triggers is the writing of data into the NVRAM
-
SLEEP - an energy saving state, so your ECU still has power being supplied. At this point, code is not executed inside the ECU, but you can still wake it up (for example, through a CAN message or activity in a communication bus). You can configure different sleep modes, as you would do in a microcontroller, having a trade-off between power consumption and wake-up time
-
WAKEUP - state transition when the ECU wakes up from sleep. It performs the validation of wake-up events, checking whether it was an intentional wake-up and we should go to RUN mode or go to sleep, in case it was unintentional. A good example for this is when you have wake-up functionality through CAN, but your hardware does not support waking up the system on specific messages (CAN-ID's), only on bus activity, and the message received does not correspond to a wake-up message for your ECU. Know little about CAN? It's a good time to check our article Autosar CAN Module (coming soon), where we go into details on how the CAN module can be configured in Autosar
-
OFF - state when your ECU is not powered at all
What controls the ECU state machine?
Now that you know where the ECU state machine lies (EcuM) and what the states are, it's time to know how to control it. The module responsible for deciding which mode the ECU is transitioned to is the BswM (BSW Mode Manager). The BswM provides interfaces for the Software Components to request or get notified of a transition / current mode, through interfaces (to learn more about interfaces, please consult the article Types of Interfaces and Ports (opens in a new tab)). The BswM controls all the different mode management modules, and the EcuM is no exception. It contains two kinds of ports: mode request ports (request a new mode) and mode switch ports (get notified of the current mode):
Mode management ports contained in the BswM, as per Autosar Specification
Fixed (EcuMFixed) vs Flexible (EcuMFlex) Ecu management:
Lastly, we want to touch on the two variants of Ecu state management: fixed (EcuMFixed) and flexible (EcuMFlex). The flexible ECU state management is more powerful than the fixed state management, by adding the following differences:
- Fast startup, with the ECU starting with limited functionality. The decision between continuing startup or not is done via the application
- Interleaved startup, consisting of the ECU starting with limited functionality, just to start the RTE and run Software Components as soon as possible. Both the SW-C's and BSW modules start gradually together, interleaving the BSW and ASW functionality
- More operation modes. Multiple RUN and SLEEP states can be defined, which is useful, for example, to take advantage of the sleep modes of modern microcontrollers
- Multi-Core ECU modes, coordinating the modes on all cores of the ECU
- More generic mode management: grouping the BSW Scheduler and the RTE into a single module, allowing configurable BSW and application modes and implementing mode-switching conditions for switching ECU modes and action lists to evaluate this switching, inside the BswM
Closing this article, I hope now you have a fair bit more knowledge regarding the different ECU modes, how they influence the ECU's behavior and the different modules involved in controlling them.
Author: Micael Coutinho (opens in a new tab)
References:
- Specification of ECU State Manager - Autosar Specification (opens in a new tab)
- Guide to Mode Management - Autosar Specification (opens in a new tab)
© AutosarToday —@LinkedIn