Roll of Network Management in AUTOSAR
Tags: autosarnm, ecucommunication, faultdetectionandhandling, efficientvehicleoperation
Published: 2023-04-25 10:41:32

Hello All, I'm Pooja Shiraguppe, and I work at **Luxoft India**.Here I would like to provide a brief knowledge about "Roll of Network Management in AUTOSAR."

### Introduction To AUTOSAR CAN Network Management (CanNM)
CanNM is part of AUTOSAR, a standardized automotive software architecture. CanNM is responsible for managing CAN (Controller Area Network) communication networks. CAN is a widely used communication protocol in the automotive industry for interconnecting electronic control units (ECUs). CanNM provides services such as network initialization, state transitions, and error handling for CAN networks. CanNM can operate in master or slave mode, depending on the role of the ECU in the network. CanNM supports different communication modes, such as event-triggered, cyclic, or mixed. CanNM also supports different topologies like star, bus, or hybrid.CanNM is designed to be platform-independent & configurable, to adapt to different hardware and software environments. CanNM is part of the AUTOSAR Basic Software (BSW) layer, which provides a common interface for the application software to access the hardware and network services.

### Functions Of CAN Network Management (CanNM)in AUTOSAR:

- CanNM is an essential component of the AUTOSAR software architecture that provides a standardized approach to managing the communication networks in modern vehicles. By offering a common interface for CAN network initialization, configuration, and operation, CanNM enables more efficient and reliable communication between the electronic control units (ECUs) that control various automotive systems.

- One of the primary functions of CanNM is to facilitate the startup and shutdown of the CAN network, ensuring that all the nodes are synchronized and operational before any data transmission occurs. CanNM also manages the transition of nodes between different network states, such as sleep mode, normal mode, and bus-off mode, in response to events or commands.

- CanNM supports different network topologies, including the popular bus topology, which enables multiple ECUs to communicate over a single shared bus. CanNM manages the arbitration process for messages on the bus, ensuring that only one ECU can transmit at a time and that higher-priority messages are transmitted first.

- CanNM provides various diagnostic and error-handling functions to detect and report faults in the CAN network, such as message lost, message corruption, or bus-off condition. CanNM can also trigger fault-tolerant mechanisms, such as redundant communication paths, to ensure the continued operation of critical automotive functions.

- CanNM supports different communication modes, such as event-triggered, cyclic, or mixed, to suit various application requirements. For example, the event-triggered communication mode sends messages only when certain events occur, while the cyclic communication mode sends messages periodically at fixed intervals. Mixed mode combines both modes to achieve a balance between responsiveness and efficiency.
Below the figure shows the different Nodes connected to the cluster.

![Different Nodes connected to Custer] (https://dev-to-uploads.s3.amazonaws.com/uploads/articles/27xuegewthsumqewxfau.png)

###AUTOSAR CAN Network Management State Machine: -

###1. Prepare Bus-Sleep Mode:
This mode is used to transition from Normal Operation Mode to BUS Sleep Mode gradually, by allowing pending transmissions and receptions to complete before entering the sleep mode. In this mode, the node sends a message to inform other nodes that it is preparing to sleep and waits for their responses before entering sleep mode.
### 2. BUS Sleep Mode:
In this mode, the CAN node stops transmitting and receiving messages but remains synchronized with the network by monitoring the bus activity. The node can wake up from this mode when it receives a wake-up pattern or message from another node or a local event.
### 3. Network Mode:
 When the network Mode is entered from Bus-Sleep Mode or Prepare Bus sleep Mode, the repeat message state shall be entered by default.
Network Mode has 3 types.

### • Repeat Message Mode (Go to Mode):
This mode is used to re-transmit a previously sent message that has not been acknowledged by the recipient. In this mode, the node sends the same message with the same identifier and data payload, hoping that the recipient will receive it successfully.

### • Normal Operation Mode:
This is the default mode of the CAN network, where nodes can transmit and receive messages according to the arbitration rules and protocol. The bus is not in an error state in this mode, and the nodes can operate normally.
### • Ready Sleep Mode:
This mode is similar to BUS Sleep Mode but with an additional feature of a local wake-up source that can initiate a wake-up event without external stimuli. In this mode, the node consumes less power than in Normal Operation Mode but remains ready to wake up quickly.
The below figure shows the Network Management State Machine.

![Network Management State Machine] (https://dev-to-uploads.s3.amazonaws.com/uploads/articles/de1e2lsxppjzzmto15cd.png)

### Preventing Race Conditions and State Inconsistencies in AUTOSAR CanNM:
To prevent race conditions and state inconsistencies between Network and Mode Management in AUTOSAR CanNM, the transition from Bus-Sleep Mode to Network Mode is not automatic. Instead, CanNm will notify the upper layers of the software stack, which are responsible for making the decision to wake up. During Bus-Sleep Mode in AUTOSAR CanNM, the reception of Network Management Protocol Data Units (PDU) must be managed according to the current state of the ECU's shutdown or startup process. This approach ensures that the wake-up decision is made with the necessary context and avoids potential conflicts between different software components.

### Conclusion :
AUTOSAR CAN Network Management (CanNM) is a critical component of the AUTOSAR software architecture, responsible for managing CAN communication networks in modern vehicles. CanNM provides various functions such as network initialization, state transitions, and error handling for CAN networks, and supports different communication modes and topologies to suit various application requirements. Additionally, CanNM is designed to be platform-independent and configurable to adapt to different hardware and software environments. However, to prevent race conditions and state inconsistencies between Network and Mode Management, CanNM's transition from Bus-Sleep Mode to Network Mode is not automatic, and the upper layers of the software stack are responsible for making the wake-up decision.