AUTOSAR SWS CANNetworkManagement
AUTOSAR SWS CANNetworkManagement
AUTOSAR CP R21-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
intellectual 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.
Table of Contents
1 Introduction and Functional Overview ................................................................... 8
2 Acronyms and abbreviations.................................................................................. 9
3 Related documentation ........................................................................................ 10
3.1 Input documents ................................................................................................. 10
3.2 Related standards and norms ............................................................................ 10
3.3 Related specification ........................................................................................... 10
4 Constraints and assumptions............................................................................... 12
4.1 Limitations ........................................................................................................... 12
4.2 Applicability to car domains ................................................................................ 12
5 Dependencies to other modules .......................................................................... 13
5.1 File Structure....................................................................................................... 14
5.1.1 Code File Structure .................................................................................. 14
5.1.2 Header File Structure ............................................................................... 14
6 Requirements traceability .................................................................................... 15
7 Functional specification ........................................................................................ 22
7.1 Coordination algorithm........................................................................................ 22
7.2 Operational Modes ............................................................................................. 23
7.2.1 Network Mode .......................................................................................... 23
7.2.2 Prepare Bus-Sleep Mode ......................................................................... 26
7.2.3 Bus-Sleep Mode ....................................................................................... 28
7.3 Network states .................................................................................................... 29
7.4 Initialization ......................................................................................................... 29
7.5 Execution ............................................................................................................ 30
7.5.1 Processor architecture ............................................................................. 30
7.5.2 Timing parameters ................................................................................... 30
7.6 Network Management PDU Structure ................................................................ 31
7.7 Communication Scheduling ................................................................................ 33
7.7.1 Transmission ............................................................................................ 33
7.7.2 Reception ................................................................................................. 36
7.8 Bus Load Reduction Mechanism ........................................................................ 36
7.9 Additional features .............................................................................................. 37
7.9.1 Detection of Remote Sleep Indication ...................................................... 37
7.9.2 User Data ................................................................................................. 38
7.9.3 Passive Mode ........................................................................................... 39
7.9.4 Network Management PDU Rx Indication ............................................... 39
7.9.5 State change notification .......................................................................... 39
7.9.6 Communication Control ............................................................................ 39
7.9.7 Coordinator Synchronization Support ...................................................... 40
7.10 Car Wakeup ........................................................................................................ 41
7.10.1 Rx Path ..................................................................................................... 41
7.10.2 Tx Path ..................................................................................................... 41
7.11 Partial Networking ............................................................................................... 41
7.11.1 Rx Handling of NM PDUs ......................................................................... 41
7.11.2 Tx Handling of NM PDUs ......................................................................... 44
5 of 117 Document ID 13: AUTOSAR_SWS_CANNetworkManagement
Specification of CAN Network Management
AUTOSAR CP R21-11
1
This includes all in AUTOSAR specified CAN protocols like CAN 2.0, CAN FD or TT CAN.
8 of 117 Document ID 13: AUTOSAR_SWS_CANNetworkManagement
Specification of CAN Network Management
AUTOSAR CP R21-11
Acronym/abb Description:
reviation:
CanIf Abbreviation for the CAN Interface
CanNm Abbreviation for CAN Network Management
CBV Control Bit Vector
CWU Car Wakeup
ERA External Request Array
EIRA External and Internal Request Array
NM Network Management
PNC Partial Network Cluster
PNI Partial Network Information
PNL Partial Network Learning
SNI Source Node Identifier
Term Description:
PDU This means that the Network Management PDU transmission has been disabled by
transmission the service CanNm_DisableCommunication.
ability is
disabled
Repeat CanNm_RxIndication finds the RptMsgRequest set in the Control Bit Vector of a
Message received Network Management PDU.
Request Bit
Indication
PN filter mask Vector of filter mask bytes defined by configuration container(s)
CanNmPnFilterMaskByte
Top-level PNC The top-level PNC coordinator is an ECU that acts as PNC gateway in the network
coordinator and that handles at least one PNC as actively coordinated on all assigned
channels. If synchronized PNC shutdown is enabled, the top-level PNC coordinator
triggers for these PNCs the shutdown, if no other ECU in the network request
them.
Intermediate An intermediate PNC coordinator is an ECU that acts as PNC gateway in the
PNC network and that handles at least one PNC as passively coordinated on at least
coordinator one assigned channel. If synchronized PNC shutdown is enabled, it forwards
received shutdown requests for these PNCs to the corresponding actively
coordinated channels and starts their shutdown accordingly.
PNC leaf node A PNC leaf node is an ECU that acts not as a PNC coordinator at all in the
network. It processes PN shutdown message as usual NM messages.
PN shutdown A top-level PNC coordinator transmit PN shutdown messages to indicate a
message synchronized PNC shutdown across the PN topology. A PN shutdown message is
as NM message which has PNSR bit in the control bit vector and all PNCs which
are indicated for a synchronized shutdown set to '1'.
3 Related documentation
Not available.
Thus, the specification SWS BSW General shall be considered as additional and
required specification for CAN Network Management.
4.1 Limitations
«module»
:Nm
«module»
:CanNm
«module»
:CanIf
The CanNm module can be applied to any car domain under limitations provided
above.
«derived_generic_interface» «derived_generic_interface»
«derived_generic_interface» PduR_CanNmTxConfirmation PduR_CanNmRxIndication Det_ReportError
CanNm_Transmit «derived_generic_interface»
PduR_CanNmTriggerTransmit
«module»
CanNm
Please refer to the chapter 5.1.6 Code file structure in “SWS_BSWGeneral” [10].
Please refer to the chapter 5.1.7 Header file structure in “SWS_BSWGeneral” [10].
6 Requirements traceability
microcontroller abstraction
layer which provides a
standardized interface to
higher software layers
SRS_BSW_00162 The AUTOSAR Basic SWS_CanNm_NA_00001
Software shall provide a
hardware abstraction layer
SRS_BSW_00164 The Implementation of SWS_CanNm_NA_00001
interrupt service routines
shall be done by the
Operating System, complex
drivers or modules
SRS_BSW_00168 SW components shall be SWS_CanNm_NA_00000
tested by a function defined
in a common API in the
Basis-SW
SRS_BSW_00170 The AUTOSAR SW SWS_CanNm_NA_00000
Components shall provide
information about their
dependency from faults,
signal qualities, driver
demands
SRS_BSW_00172 The scheduling strategy SWS_CanNm_NA_00008
that is built inside the Basic
Software Modules shall be
compatible with the strategy
used in the system
SRS_BSW_00301 All AUTOSAR Basic SWS_CanNm_00305, SWS_CanNm_00307,
Software Modules shall only SWS_CanNm_00308, SWS_CanNm_00309,
import the necessary SWS_CanNm_00312, SWS_CanNm_00326
information
SRS_BSW_00314 All internal driver modules SWS_CanNm_NA_00001
shall separate the interrupt
frame definition from the
service routine
SRS_BSW_00323 All AUTOSAR Basic SWS_CanNm_00244
Software Modules shall
check passed API
parameters for validity
SRS_BSW_00325 The runtime of interrupt SWS_CanNm_NA_00001
service routines and
functions that are running in
interrupt context shall be
kept short
SRS_BSW_00334 All Basic Software Modules SWS_CanNm_NA_00008
shall provide an XML file
that contains the meta data
SRS_BSW_00336 Basic SW module shall be SWS_CanNm_91002, SWS_CanNm_NA_00006
able to shutdown
SRS_BSW_00341 Module documentation shall SWS_CanNm_NA_00008
contains all needed
informations
SRS_BSW_00347 A Naming seperation of SWS_CanNm_NA_00001
19 of 117 Document ID 13: AUTOSAR_SWS_CANNetworkManagement
Specification of CAN Network Management
AUTOSAR CP R21-11
7 Functional specification
The main concept of the AUTOSAR CanNm algorithm can be defined by the
following two key-requirements:
The overall state machine of the AUTOSAR CanNm algorithm can be defined as
follows:
Note: State transitions have to be performed latest within the next main function.
Note: An UML state chart of the AUTOSAR CanNm state machine from point of view
of one single node in the network management cluster can be found in detail in the
API specification chapter 8).
22 of 117 Document ID 13: AUTOSAR_SWS_CANNetworkManagement
Specification of CAN Network Management
AUTOSAR CP R21-11
In the following chapter operational modes of the AUTOSAR CanNm algorithm are
described in detail.
[SWS_CanNm_00097] ⌈When the Network Mode is entered, CanNm shall notify the
upper layer of the new current operational mode by calling the callback function
Nm_NetworkMode.⌋ (RS_Nm_00051)
[SWS_CanNm_00381] {DRAFT} ⌈If the bits Partial Network Learning and Repeat
Message Request both are received with value 1 on a channel where
CanNmDynamicPncToChannelMappingEnabled is set to TRUE and CanNm is in the
Network Mode, then CanNm shall set the Partial Network Learning Bit in the CBV to
1 on this channel and change to or restart the Repeat Message State.⌋()
For nodes that are not in passive mode (refer to chapter 7.9.3) the Repeat Message
State ensures, that any transition from Bus-Sleep or Prepare Bus-Sleep to the
Network Mode becomes visible to the other nodes on the network. Additionally, it
ensures that any node stays active for a minimum amount of time. It can be used for
detection of present nodes.
[SWS_CanNm_00103] ⌈When Repeat Message State is left and if the network has
been requested (see SWS_CanNm_00104), the CanNm module shall enter the
Normal Operation State.⌋(RS_Nm_00047)
[SWS_CanNm_00106] ⌈When Repeat Message State is left and if the network has
been released (see SWS_CanNm_00105), the CanNm module shall enter the Ready
Sleep State.⌋(RS_Nm_00047)
The Normal Operation State ensures that any node can keep the network
management cluster awake as long as the network is requested.
The Ready Sleep State ensures that any node in the network management cluster
waits with transition to the Prepare Bus-Sleep Mode as long as any other node keeps
the network management cluster awake.
[SWS_CanNm_00110] ⌈When the network is requested and the current state is the
Ready Sleep State, the CanNm module shall enter Normal Operation State (refer to
SWS_CanNm_00104).⌋ (RS_Nm_00047)
The purpose of the Prepare Bus-Sleep Mode is to ensure that all nodes have time to
stop their network activity before the Bus-Sleep Mode is entered. In Prepare Bus-
Sleep Mode the bus activity is calmed down (i.e. queued messages are transmitted
in order to make all Tx-buffers empty) and finally there is no activity on the bus in the
Prepare Bus-Sleep Mode.
Rationale: Other nodes in the cluster are still in Prepare Bus-Sleep Mode; in the
exceptional situation described above transition into the Bus-Sleep Mode shall be
avoided and bus-communication shall be restored as fast as possible.
Caused by the transmission offset for Network Management PDUs in CanNm, the
transmission of the first Network Management PDU in Repeat Message State can be
delayed significantly. In order to avoid a delayed re-start of the network the
transmission of a Network Management PDU can be requested immediately.
The purpose of the Bus-Sleep Mode is to reduce power consumption in the node
when no messages are to be exchanged. The communication controller is switched
into the sleep mode, respective wakeup mechanisms are activated and finally power
consumption is reduced to the adequate level in the Bus-Sleep Mode.
In the best case only oscillator’s drift should be taken into account for a configurable
amount of time determined by the value CanNmTimeoutTime +
CanNmWaitBusSleepTime (both configuration parameters).
Rationale: To avoid race conditions and state inconsistencies between Network and
Mode Management, CanNm will not automatically perform the transition from Bus-
Sleep Mode to Network Mode. CanNm will only inform the upper layers which have
to make the wake-up decision. Network Management PDU reception in Bus-Sleep
Mode must be handled depending on the current state of the ECU shutdown/startup
process.
Note: In the Prepare Bus-Sleep Mode and Bus-Sleep Mode is assumed that the
network is released, unless bus communication is explicitly requested.
Network states (i.e. ‘requested’ and ‘released’) are two additional states of the
AUTOSAR CanNm state machine that exist in parallel to the state machine. Network
states denote, whether the software components need to communicate on the bus
(the network state is then ‘requested’); or whether the software components don’t
have to communicate on the bus (the bus network state is then ‘released’); note that
if the network is released an ECU may still communicate because some other ECU
still request the network.
7.4 Initialization
Note: The CanNm module should be initialized after CanIf is initialized and before
any other network management service is called.
[SWS_CanNm_00143] ⌈When initialized, by default, the CanNm module shall set the
network state to ‘released’⌋()
[SWS_CanNm_00025] ⌈During initialization the CanNm module shall set each byte
of the user data to 0xFF.⌋()
[SWS_CanNm_00085] ⌈During initialization the CanNm module shall set the Control
Bit Vector to 0x00.⌋()
7.5 Execution
The figure below shows the format of the Network Management PDU for an example
with 8 bytes where Source Node Identifier (SNI) is located in the first byte and the
Control Bit Vector (CBV) at the second byte, user data is used and partial network is
enabled. User data range is located between the system bytes and the PNC bit
vector:
Note: Setting the CanNmPduNidPosition to off means that in the NM PDU no space is
occupied by the Source Node Identifier. Hence one more byte is available for user
data or PNC bit vector.
Note:
Setting the CanNmPduCbvPosition to off means that in the NM PDU no space is
occupied by the CBV. Hence one more byte is available for user data.
The location of the PNC bit vector is configurable by means of
NmPncBitVectorOffset and NmPncBitVectorLength of the corresponding NM-
channel. The location of the PNC bit vector is placed after the system bytes
(CBV and SNI) and within the PduLength of the NM-PDU.
Note: The length of the Network Management PDU is defined by the PduLength
parameter in the "global" ECUC module ([EcuC003_Conf], see Ecu Configuration
specification).
The figure below describes the format of the Control Bit Vector:
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Partial Partial NM PN
Active Repeat
Reserv Network Network Coordinat Shutdown
CBV Wakeup Reserved Message
ed Informat Learnin or Sleep Request
Bit Request
ion Bit g Bit Ready Bit Bit
Figure 7-2 Control Bit Vector
Note: Bits 1 and 2 were used in R3.2 as NM Coordinator ID (Low Bit)
Note: The CBV is initialized with 0x00 during initialization (also refer to
SWS_CanNm_00085).
[SWS_CanNm_00013] ⌈The CanNm module shall set the Source Node Identifier
with the configuration parameter CanNmNodeId unless CanNmPduNidPosition is set to
off.⌋ (RS_Nm_02503)
[SWS_CanNm_00401] ⌈If the CanNm performs a state change from Bus Sleep
Mode or Prepare Bus Sleep Mode to Network Mode due to a call to
CanNm_NetworkRequest (i.e. due to an active wakeup) and
CanNmActiveWakeupBitEnabled is TRUE, the CanNm shall set the ActiveWakeupBit in
the CBV.⌋()
[SWS_CanNm_00402] ⌈If the CanNm module leaves the Network Mode and
CanNmActiveWakeupBitEnabled is TRUE, the CanNm module shall clear the
ActiveWakeupBit in the CBV.⌋()
7.7.1 Transmission
Note: The transmission mechanisms described in this chapter are only relevant if the
Network Management PDU transmission ability is enabled.
Note: The transmission mechanisms described in this chapter are only relevant if
CanNmPassiveModeEnabled is FALSE.
The periodic transmission mode is used in "Repeat Message State" and "Normal
Operation State". Periodic transmission mode with bus load reduction is only
available in "Normal Operation State"
Note: The periodic transmission mode is used in the "Repeat Message State" and
"Normal Operation State" if the bus load reduction mechanism is disabled.
The periodic transmission mode with bus load reduction is only used, in the "Normal
Operation State" if the bus load reduction mechanism is enabled.
Rationale: If the bus access is completely regulated through an offline system design
tool, the actual transmit confirmation to inform the Nm about a successful
transmission can be regarded as redundant. Since the maximum arbitration time is
known it is acceptable to immediately raise the confirmation at the transmission
request time.
Moreover, implementation of superfluous actual transmission confirmation in such a
system only for one NM message would mean a significant performance loss
regarding the execution time of the overall CAN Interface/Driver layer making the
calculated time schedule inefficient.
[SWS_CanNm_00334] ⌈When entering the Repeat Message State from Bus Sleep
Mode or Prepare Bus Sleep Mode because of CanNm_NetworkRequest() (active
wakeup) and if CanNmImmediateNmTransmissions is greater zero, the NM PDUs shall
be transmitted using CanNmImmediateNmCycleTime as cycle time. The transmission
of the first NM PDU shall be triggered as soon as possible. After the transmission the
Message Cycle Timer shall be reloaded with CanNmImmediateNmCycleTime. The
CanNmMsgCycleOffset shall not be applied in this case.⌋ ()
Note: If the function call of CanIf_Transmit fails the Transmission Error handling
described in chapter 7.12 informs the CanNm module.
Note:
- The synchronized PNC shutdown has to be sent immediately and therefore
processing of cylic NM messages transmitted with CanNmMsgCycleTime has to
be delayed. In rare cases this could lead to a delay of more than one main
function cycle time.
- The NM timing has to consider that an NM message transmitted with
CanNmMsgCycleTime may be delayed for more than one main function cycle
time. Therefore, the following condition has to be fulfilled to tolerate multiple
delays of those NM Messages:
(CanNmPnResetTime – CanNmMsgCycleTime) > n * CanNmMainFunctionPeriod,
where n denotes the number of tolerated delays before the PnResetTime
expires, if no NM message is received.
[SWS_CanNm_00040] ⌈If the CanNm Message Cycle Timer expires the CanNm
module shall restart with CanNmMsgCycleTime.⌋ ()
35 of 117 Document ID 13: AUTOSAR_SWS_CANNetworkManagement
Specification of CAN Network Management
AUTOSAR CP R21-11
7.7.2 Reception
If a NM PDU has been successfully received, the CanIf module will call the callback
function CanNm_RxIndication.
The algorithm ensures that the bus load is limited to a maximum two Network
Management PDUs per CanNmMsgCycleTime.
Sleep State, the module CanNm shall call the callback function
Nm_RemoteSleepCancellation.⌋(RS_Nm_02509)
Note: If user data is configured it will be sent for sure in Repeat Message State. In
Normal Operation State it depends on the configuration of busload reduction whether
user data is sent. In Ready Sleep State user data will not be sent.
Note: The transmission of outdated NM data can be avoided by not stopping the IPdu
in COM used for NmUserData transmission.
In the Passive Mode the node is only receiving Network Management PDUs but not
transmitting any Network Management PDUs.
Note: Passive Mode has to be either enabled or disabled for all NM networks within
one ECU.
Note: This behavior shall also be applied in Repeat Message State. Communication
Control feature does not influence the duration of the Repeat Message State.
When having more than one coordinator connected to the same bus a special bit in
the CBV, the NmCoordinatorSleepReady bit is used to indicate that the main
coordinator requests to start shutdown sequence. The main functionality of the
algorithm is described in the Nm module.
7.10.1 Rx Path
[SWS_CanNm_00406] ⌈If the Car Wakeup bit within any received NM-PDU is 1,
CanNmCarWakeUpRxEnabled is TRUE, and CanNmCarWakeUpFilterEnabled is FALSE
CanNm shall call Nm_CarWakeUpIndication and perform the standard Rx indication
handling.⌋()
Note: This is required to enable the ECU to identify detail about the sender of the Car
Wakeup request.
Note: The Car Wakeup filter is necessary to realize sub gateways that only consider
the Car Wakeup of the central Gateway to avoid wrong wakeups.
7.10.2 Tx Path
The transmission of the Car Wakeup bit shall be handled by the application using the
NM user data mechanism provided by the CanNm module.
[SWS_CanNm_00409] ⌈If the CanNmPnEnabled is FALSE, the CanNm shall not drop
NM PDUs from further Rx Indication handling and the partial networking extensions
shall be disabled.⌋ (RS_Nm_02517)
[SWS_CanNm_00410] ⌈If CanNmPnEnabled is TRUE, the PNI bit in the received NM-
PDU is 0 and CanNmAllNmMessagesKeepAwake is TRUE, the CanNm module shall not
drop NM PDUs from further Rx Indication handling omitting the extensions for partial
networking.⌋ (RS_Nm_02517, RS_Nm_02527)
Note: This is required to enable the Gateway to stay awake on any kind of NM-PDU.
[SWS_CanNm_00411] ⌈If CanNmPnEnabled is TRUE, the PNI bit in the received NM-
PDU is 0 and CanNmAllNmMessagesKeepAwake is FALSE, the CanNm module shall
ignore the received NM-PDU.⌋ (RS_Nm_02517, RS_Nm_02527)
Note:
CanNmAllNmMessagesKeepAwake is required to enable a gateway to stay
awake on any kind of NM-PDU.
If PN availability was not confirmed by CanSM, all PNC requests are
considered as relevant and therefore the Nm restarts the NM-Timeout Timer
when receiving a NM-PDU. This is required to allow a malfunctioning partial
network depending hardware (e.g. PN capable CAN transceiver) to shut down
synchronously with the remaining network.
As consequence of [SWS_CanNm_00503], a NM PDU is not considered for
further processing if not all messages shall keep the ECU awake and the PN
availability was confirmed but no relevant PN information was detected.
Example:
- CanNmPduCbvPosition =0
42 of 117 Document ID 13: AUTOSAR_SWS_CANNetworkManagement
Specification of CAN Network Management
AUTOSAR CP R21-11
- CanNmPduNidPosition =1
- NmPncBitVectorOffset =4
- NmPncBitVectorLength = 4
- Calculated length of user data range =2
Note: The offset for the PNC bit vector is derived from the Nm module
(NmPncBitVectorOffset). The PNC bit vector length is derived form the Nm module
per NM-channel (NmPncBitVectorLength). The PN filter mask
(NmPnFilterMaskByteIndex and NmPnFilterMaskByteValue) is located and used in
the Nm module.
[SWS_CanNm_00413] ⌈If CanNmPnEnabled is TRUE the CanNm module shall set the
value of the transmitted PNI bit to 1.⌋ (RS_Nm_02517, RS_Nm_02519)
Note: The usage of the CBV is mandatory in case Partial Networking is used.
[SWS_CanNm_00414] ⌈If CanNmPnEnabled is FALSE the CanNm module shall set the
value of the transmitted PNI bit always to 0.⌋ (RS_Nm_02517, RS_Nm_02519)
Note: The aggregation of all PNCs which are requested for a synchronized PNC
shutdown and the transmission as PN shutdown message (set the PNSR bit in the
CBV to 1) is done asynchronously in the context of CanNm_Mainfunction.
Note: The CanNm modul has to aggregate all PNCs which were indicated for a
synchronized PNC shutdown and transfer the pncId’s to a byte array (PN Info range).
Each bit (PN bit) of the PN Info range represent a particular PNC. The byteIndex and
bitindex within the PN Info range of PN bit can be determined as follows:
byteIndex = (PncId div 8)
bitIndex = (PncId mod 8)
[SWS_CanNm_00468] {DRAFT} ⌈ If
CanNmPnShutdownMessageRetransmissionDuration is configured and transmission of a
PN shutdown message is requested (refer to [SWS_CanNm_00506]) for the first
time, then the corresponding retransmission timer for PN shutdown messages shall
be started with CanNmPnShutdownMessageRetransmissionDuration on all affected NM-
channels.⌋(RS_Nm_02545)
Note: CanNm has to ensure that new request for a synchronized PNC shutdown
(indicated via CanNm_RequestSynchronizedPncShutdown) are not lost, during an
ongoing transmission of a PN shutdown NM frame.
Note:
- CanNm has to perform a retry transmission handling for PN shutdown
messages in the context of the main function calls, if transmission of the PN
shutdown message was not accepted or not confirmed by the lower layer. The
retry transmission requests should cover error cases, where the lower layer
cannot transmit the Nm messages. In the worst case this collides with a post
poned NM message transmitted with CanNmMsgCycleTime (see
[SWS_CanNm_00460]). But in any case, if the capability to transmitted NM
messages is not re-covered within the PN reset time (EIRA), the PNCs will
shutdown not synchronized, which migth lead to timeout errors on application
level.
- The dependency to a pending transmission confirmation indicated by the lower
layer, should support reliable communication, e.g., ensure PN shutdown
message was transmitted on the bus or avoid transmissions of outdated PN
shutdown messages, if for example queueing in the lower layer is configured.
All internal PNC requests are maintained by ComM. ComM forwards the aggregated
internal PNC requests per channel as PNC bit vector to NmIf. This PNC bit vector
carries the so-called “Internal Request Array”. The CanNm has to retrieve the latest
IRA from NmIf every time an NM PDU is transmitted. NmIf provides the IRA
information to CanNm and updates the PNC reset timer (each time a relevant PNC
is transmitted, the PNC reset timer is re-started).
Note: For all configured NM-channel where CanNmPnEnabled is set TRUE, the CanNm
will call Nm_PncBitVectorTxIndication(<NM-channel>, < buffer to store the unfiltered
PNC bit vector of aggregated internal PNC requests>) (see [SWS_CanNm_00505] and
[SWS_CanNm_00508]) to indicate the transmission and to retrieve the current
internal PNC requests as PNC bit vector with respect to the configured
NmPncBitVectorLength. The CanNm will copy received internal PNC requests to the
PNC bit vector bytes of the NM-PDU.
The intention of the NM-PDU filter algorithm is to drop all received NM-PDUs that are
not relevant for the ECU. If there is no NM-PDU on the network, that is relevant for
the receiving ECU, the NM Timeout Timer is no longer restarted and the CanNm
module changes to Prepare Bus Sleep Mode during active bus communication.
In order to distinguish between NM-PDUs that are relevant for the ECU and PDUs
that are not relevant, the CanNm evaluates the NM User Data that contains the PN
requests provided by requesting ECU. Every bit of the PN request information
represents one PN.
It is statically configured if the ECU (CanNm) is part of one specific partial network or
not. The NM-PDUs are ignored if the ECU is not part of the requested partial
networks.
Note: If the NM-PDU filter algorithm is not enabled (e.g. due to malfunctioning PN
transceiver) the CanNm restarts the NM-Timeout Timer when receiving a NM-PDU.
Therefore normal shutdown behavior is performed.
47 of 117 Document ID 13: AUTOSAR_SWS_CANNetworkManagement
Specification of CAN Network Management
AUTOSAR CP R21-11
Note: This feature is used by every ECU that has to switch I-PDU-Groups because of
the activity of partial networks. (e.g. to prevent false timeouts) I-PDU-Groups shall be
switched on if the corresponding PN is requested internally or externally. I-PDU-
Groups shall be switched off not until all internal and external requests for the
corresponding PN are released.
The logic for switching the IPDU-Groups is implemented by ComM. The CanNm only
provides the information if a PN is requested or not. The COM module is used to
transfer the data to the upper layers.
To switch the I-PDU-Groups synchronously on all direct connected ECUs, CanNm
shall provide the information of a request change to the upper layer at (almost) the
same time on every ECU. This is why the reset timer is restarted on every received
and every sent NM PDU (see below).
The aggregated state of the internal/external requested PNs is called External
48 of 117 Document ID 13: AUTOSAR_SWS_CANNetworkManagement
Specification of CAN Network Management
AUTOSAR CP R21-11
Note: This means, only one timer is required to handle one PN on multiple connected
physical channels. For example: only 8 EIRA reset timers are required to handle the
requests of a Gateway with 6 physical channels and 8 partial networks.
This is possible because the switch of PN PDU-Groups is done global for the ECU
and not dependent of the physical channel.
Note: This feature is used by the Gateways to collect only the external PN requests.
The external PN requests are mirrored back to the requesting bus and provided to
other (required) physical channels of a central gateway. In case of a sub gateway the
requests bit must not be mirrored back to the requesting physical channel in order to
avoid static waking between central- and sub gateways. This logic shall be
implemented by the ComM. The CanNm module provides the information if the PN is
externally requested or not. The COM module is used for data transmission to the
upper layer.
The aggregated state of the external requested PNs is called “External Request
Array” (ERA).
Note: This means, a separate timer is required to handle one PN on multiple physical
channels.
For example: 48 ERA reset timers are required to handle the requests of a gateway
with 6 physical channels and 8 partial networks. It is not possible to combine the
reset timer like EIRA timers, because the external request mustn’t be mirrored back
to the requesting bus by a sub gateway. Thus it is required to detect the physical
channel that is the source of the request bit.
Depending on configuration the CanNm will evaluate the confirmation function that a
Network Management PDU has been successfully transmitted or not. CanNm will
monitor these confirmations and alarm the upper layers if a transmission confirmation
is received with result E_NOT_OK or not received within a specific amount of time.
Timeout Monitoring is required for Partial Networking to ensure that the first message
gets acknowledged when all ECUs on the network use Partial Network transceivers.
Otherwise CanSM is informed and will restart CAN Driver (see also SWS CanSM).
(call of CanIf_Transmit) then CanNm shall start the NM Message Tx Timeout Timer
with CanNmMsgTimeoutTime.⌋ (RS_Nm_00137)
Note: When Repeat Message Bit is received NM will enter or restart Repeat
Message State, but the bits will still be received as requestor will send until he leaves
Repeat Message State to be fault-tolerant regarding possible loss of messages.
State Change and callout are only needed once the first time the node received it.
Based on this foundation, the following section specifies particular errors arranged in
the respective subsections below.
[SWS_CanNm_00316]⌈
Error
Type of error Related error code
value
CANNM_E_INVALID_
API service called with wrong channel handle 0x02
CHANNEL
CANNM_E_INVALID_
API service called with wrong PDU-ID 0x03
PDUID
CANNM_E_PARAM_
Null pointer has been passed as an argument 0x12
POINTER
DeInit API service called when not all CAN networks are CANNM_E_NOT_IN_BUS_
0x13
in Bus Sleep mode SLEEP
⌋()
[SWS_CanNm_00317]⌈
Error
Type of error Related error code
value
CANNM_E_NET_
Reception of NM PDUs in Bus-Sleep Mode. 0x04
START_IND
CANNM_E_
Retransmission timer for a PN shutdown message has expired,
TRANSMISSION_OF_
because a PN shutdown message could not be Transmitted on 0x21
PN_SHUTDOWN_
the network within the configured duration of re-transmission.
MESSAGE_FAILED
⌋()
Note: Since the shutdown of CanNm can be done at any time, the call of the API
Nm_SynchronizationPoint is not supported.
This section gives a summary of the CanNm timing requirements. Please note that
this chapter is a summary only and does not replace or act as requirement. Moreover
this section does not require any specific way of implementation
55 of 117 Document ID 13: AUTOSAR_SWS_CANNetworkManagement
Specification of CAN Network Management
AUTOSAR CP R21-11
The following figure shows an UML state diagram with respect to the API
specification. Mode change related transitions are denoted in green, error handling
related transitions in red and optional node detection / Dynamic PNC-to-channel-
mapping related transitions in blue.
PowerOn CanNm_Init() PowerOff
/Initialization
of CanNm
PowerOff
CanNm_DeInit()
CanNm_RxIndication();
CanNm_PassiveStartup();
CanNm_NetworkRequest();
CanNm_RxIndication(); CanNm_PassiveStartUp();
/Nm_NetworkStartIndication(); Network
Mode
CanNm_NetworkRequest();
/ Start NM-Timeout Timer;
Start Repeat Message Timer;
NM-Timeout Timer has
Nm_NetworkMode();
CanNm_RxIndication(); CanNm_TxConfirmation(Result: E_OK); expired
/ Start NM-Timeout / Start NM-Timeout Timer; / Start NM-Timeout Timer; / Start Wait Bus-Sleep Timer;
Timer; Start Repeat Message Timer; Nm_PrepareBusSleepMode();
Nm_NetworkMode();
Repeat Message
Timer has
expired;
CanNm_NetworkRelease();
8 API specification
[SWS_CanNm_00189] ⌈The CanNm module shall not return development errors by
API functions; in case of a development error, the execution of the respective API
function shall be aborted and E_NOT_OK shall be returned, if applicable.⌋()
Note: The network handle is invalid if it is different from allowed configured values.
AUTOSAR CanNm API consists of services, which are CAN specific and can be
called whenever they are required; each service apart from CanNm_Init refers to one
NM channel only.
In this chapter all types included from the following modules are listed:
[SWS_CanNm_00245]⌈
Module Header File Imported Type
ComStack_Types.h NetworkHandleType
ComStack_Types.h PduIdType
ComStack_Types.h PduInfoType
ComStack_Types.h PduLengthType
NmStack_types.h Nm_ModeType
Nm
NmStack_types.h Nm_StateType
Std_Types.h Std_ReturnType
Std
Std_Types.h Std_VersionInfoType
⌋()
For further details of these types refer to the according specifications [5], [7] and [9].
8.2.1 CanNm_ConfigType
[SWS_CanNm_00447]⌈
Name CanNm_ConfigType
Kind Structure
implementation specific
Elements Type --
Comment --
This type shall contain at least all parameters that are post-build able according to
Description
chapter 10.
Available
CanNm.h
via
⌋()
8.3.1 CanNm_Init
[SWS_CanNm_00208]⌈
Service Name CanNm_Init
void CanNm_Init (
Syntax const CanNm_ConfigType* cannmConfigPtr
)
Sync/Async Synchronous
⌋()
8.3.2 CanNm_DeInit
[SWS_CanNm_91002]⌈
Service Name CanNm_DeInit
void CanNm_DeInit (
Syntax void
)
Sync/Async Synchronous
⌋(SRS_BSW_00336)
Caveat: Caller of the CanNm_DeInit function has to ensure all CAN networks are in
the Bus Sleep mode.
8.3.3 CanNm_PassiveStartUp
[SWS_CanNm_00211]⌈
Service Name CanNm_PassiveStartUp
Std_ReturnType CanNm_PassiveStartUp (
Syntax NetworkHandleType nmChannelHandle
)
Service ID
0x01
[hex]
Sync/Async Asynchronous
Parameters
nmChannelHandle Identification of the NM-channel
(in)
Parameters
None
(inout)
Parameters
None
(out)
E_OK: No error
Return value Std_ReturnType E_NOT_OK: Passive startup of network management has
failed
Passive startup of the AUTOSAR CAN NM. It triggers the transition from Bus-Sleep
Description Mode or Prepare Bus Sleep Mode to the Network Mode in Repeat Message State.
Caveats: CanNm is initialized correctly.
⌋()
[SWS_CanNm_00254] ⌈Caveats of CanNm_PassiveStartUp: The CanNm module is
initialized correctly.⌋()
8.3.4 CanNm_NetworkRequest
[SWS_CanNm_00213]⌈
Service Name CanNm_NetworkRequest
Std_ReturnType CanNm_NetworkRequest (
Syntax NetworkHandleType nmChannelHandle
)
Sync/Async Asynchronous
E_OK: No error
Return value Std_ReturnType
E_NOT_OK: Requesting of network has failed
Description Request the network, since ECU needs to communicate on the bus.
⌋()⌋()
8.3.5 CanNm_NetworkRelease
[SWS_CanNm_00214]⌈
Service Name CanNm_NetworkRelease
Std_ReturnType CanNm_NetworkRelease (
Syntax NetworkHandleType nmChannelHandle
)
Sync/Async Asynchronous
E_OK: No error
Return value Std_ReturnType
E_NOT_OK: Releasing of network has failed
Description Release the network, since ECU doesn't have to communicate on the bus.
⌋()
[SWS_CanNm_00259] ⌈Caveats of CanNm_NetworkRelease: The CanNm module is
initialized correctly.⌋()
8.3.6 CanNm_DisableCommunication
[SWS_CanNm_00215]⌈
Service Name CanNm_DisableCommunication
Std_ReturnType CanNm_DisableCommunication (
Syntax NetworkHandleType nmChannelHandle
)
Sync/Async Asynchronous
Parameters
None
(inout)
E_OK: No error
Return value Std_ReturnType E_NOT_OK: Disabling of NM PDU transmission ability has
failed
⌋()
[SWS_CanNm_00261] ⌈Caveats of CanNm_DisableCommunication: The CanNm
module is initialized correctly.⌋()
8.3.7 CanNm_EnableCommunication
[SWS_CanNm_00216]⌈
Service Name CanNm_EnableCommunication
Std_ReturnType CanNm_EnableCommunication (
Syntax NetworkHandleType nmChannelHandle
)
Sync/Async Asynchronous
Parameters
None
(inout)
E_OK: No error
Return value Std_ReturnType E_NOT_OK: Enabling of NM PDU transmission ability has
failed
⌋()
[SWS_CanNm_00176] ⌈The service CanNm_EnableCommunication shall enable the
Network Management PDU transmission ability if the Network Management PDU
transmission ability is disabled.⌋ (RS_Nm_02512)
8.3.8 CanNm_SetUserData
[SWS_CanNm_00217]⌈
Service Name CanNm_SetUserData
Std_ReturnType CanNm_SetUserData (
NetworkHandleType nmChannelHandle,
Syntax
const uint8* nmUserDataPtr
)
Sync/Async Synchronous
nmChannel
Identification of the NM-channel
Handle
Parameters (in)
Pointer where the user data for the next transmitted NM PDU
nmUserDataPtr
shall be copied from
Parameters
None
(inout)
Parameters
None
(out)
Description Set user data for NM PDUs transmitted next on the bus.
⌋()
[SWS_CanNm_00265] ⌈Caveats of CanNm_SetUserData: The CanNm module is
initialized correctly.⌋()
8.3.9 CanNm_GetUserData
[SWS_CanNm_00218]⌈
Service Name CanNm_GetUserData
Std_ReturnType CanNm_GetUserData (
NetworkHandleType nmChannelHandle,
Syntax
uint8* nmUserDataPtr
)
Sync/Async Synchronous
Reentrancy Reentrant
nmChannel
Parameters (in) Identification of the NM-channel
Handle
Parameters
None
(inout)
Parameters Pointer where user data out of the most recently received NM
nmUserDataPtr
(out) PDU shall be copied to
Description Get user data out of the most recently received NM PDU.
⌋()
[SWS_CanNm_00267] ⌈Caveats of CanNm_GetUserData: The CanNm module is
initialized correctly.⌋()
8.3.10 CanNm_Transmit
[SWS_CanNm_00331]⌈
Service Name CanNm_Transmit
Std_ReturnType CanNm_Transmit (
PduIdType TxPduId,
Syntax
const PduInfoType* PduInfoPtr
)
Sync/Async Synchronous
Reentrancy Reentrant for different PduIds. Non reentrant for the same PduId.
Parameters None
(inout)
⌋()
[SWS_CanNm_00330] ⌈If CanNmComUserDataSupport or CanNmGlobalPnSupport is
enabled the CanNm implementation shall provide an API CanNm_Transmit.⌋()
8.3.11 CanNm_GetNodeIdentifier
[SWS_CanNm_00219]⌈
Service Name CanNm_GetNodeIdentifier
Std_ReturnType CanNm_GetNodeIdentifier (
NetworkHandleType nmChannelHandle,
Syntax
uint8* nmNodeIdPtr
)
Service ID
0x06
[hex]
Sync/Async Synchronous
Reentrancy Reentrant
Parameters nmChannel
Identification of the NM-channel
(in) Handle
Parameters
None
(inout)
Parameters nmNodeId Pointer where node identifier out of the most recently received NM
(out) Ptr PDU shall be copied to
E_OK: No error
Std_Return- E_NOT_OK: Getting of the node identifier out of the most recently
Return value
Type received NM PDU has failed or is not configured for this network
handle.
Description Get node identifier out of the most recently received NM PDU.
⌋()
[SWS_CanNm_00132] ⌈The service call CanNm_GetNodeIdentifier shall provide the
node identifier out of the most recently received Network Management PDU if
CanNmNodeIdEnabled is set to TRUE.⌋ (RS_Nm_02506)
8.3.12 CanNm_GetLocalNodeIdentifier
[SWS_CanNm_00220]⌈
Service Name CanNm_GetLocalNodeIdentifier
Std_ReturnType CanNm_GetLocalNodeIdentifier (
NetworkHandleType nmChannelHandle,
Syntax
uint8* nmNodeIdPtr
)
Service ID
0x07
[hex]
Sync/Async Synchronous
Reentrancy Reentrant
nmChannel
Parameters (in) Identification of the NM-channel
Handle
Parameters
None
(inout)
Parameters
nmNodeIdPtr Pointer where node identifier of the local node shall be copied to
(out)
E_OK: No error
Std_Return-
Return value E_NOT_OK: Getting of the node identifier of the local node has
Type
failed or is not configured for this network handle.
⌋()
[SWS_CanNm_00133] ⌈The service call CanNm_GetLocalNodeIdentifier shall provide
the node identifier configured for the local host node if CanNmNodeIdEnabled is set to
TRUE.⌋(RS_Nm_02508)
8.3.13 CanNm_RepeatMessageRequest
[SWS_CanNm_00221]⌈
Service Name CanNm_RepeatMessageRequest
Std_ReturnType CanNm_RepeatMessageRequest (
Syntax NetworkHandleType nmChannelHandle
)
Service ID
0x08
[hex]
Sync/Async Asynchronous
nmChannel
Parameters (in) Identification of the NM-channel
Handle
Parameters
None
(inout)
Parameters
None
(out)
E_OK: No error
Std_Return-
Return value E_NOT_OK: Setting of Repeat Message Request Bit has failed or
Type
is not configured for this network handle.
Description Set Repeat Message Request Bit for NM PDUs transmitted next on the bus.
⌋()
8.3.14 CanNm_GetPduData
[SWS_CanNm_00222]⌈
Service Name CanNm_GetPduData
Std_ReturnType CanNm_GetPduData (
NetworkHandleType nmChannelHandle,
Syntax
uint8* nmPduDataPtr
)
Sync/Async Synchronous
Reentrancy Reentrant
Handle
Parameters
None
(inout)
Parameters
nmPduDataPtr Pointer where NM PDU shall be copied to
(out)
E_OK: No error
Std_Return-
Return value E_NOT_OK: Getting of NM PDU Data has failed or is not
Type
configured for this network handle.
Description Get the whole PDU data out of the most recently received NM PDU.
⌋()
[SWS_CanNm_00275] ⌈Caveats of CanNm_GetPduData: The CanNm module is
initialized correctly.⌋()
8.3.15 CanNm_GetState
[SWS_CanNm_00223]⌈
Service Name CanNm_GetState
Std_ReturnType CanNm_GetState (
NetworkHandleType nmChannelHandle,
Syntax Nm_StateType* nmStatePtr,
Nm_ModeType* nmModePtr
)
Sync/Async Synchronous
Reentrancy Reentrant
nmChannel
Parameters (in) Identification of the NM-channel
Handle
Parameters
None
(inout)
E_OK: No error
Return value Std_ReturnType
E_NOT_OK: Getting of NM state has failed
70 of 117 Document ID 13: AUTOSAR_SWS_CANNetworkManagement
Specification of CAN Network Management
AUTOSAR CP R21-11
Description Returns the state and the mode of the network management.
⌋()
[SWS_CanNm_00277] ⌈Caveats of CanNm_GetState: The CanNm module is
initialized correctly.⌋()
8.3.16 CanNm_GetVersionInfo
[SWS_CanNm_00224]⌈
Service Name CanNm_GetVersionInfo
void CanNm_GetVersionInfo (
Syntax Std_VersionInfoType* versioninfo
)
Sync/Async Synchronous
Reentrancy Reentrant
Parameters (out) versioninfo Pointer to where to store the version information of this module
⌋()
8.3.17 CanNm_RequestBusSynchronization
[SWS_CanNm_00226]⌈
Service Name CanNm_RequestBusSynchronization
Std_ReturnType CanNm_RequestBusSynchronization (
Syntax NetworkHandleType nmChannelHandle
)
Sync/Async Synchronous
E_OK: No error
Return value Std_ReturnType
E_NOT_OK: Requesting of bus synchronization has failed
⌋(RS_Nm_02516)
[SWS_CanNm_00279] ⌈Caveats of CanNm_RequestBusSynchronization: The CanNm
module is initialized correctly.⌋()
Rationale: This service is typically used for supporting the NM gateway extensions.
8.3.18 CanNm_CheckRemoteSleepIndication
[SWS_CanNm_00227]⌈
Service Name CanNm_CheckRemoteSleepIndication
Std_ReturnType CanNm_CheckRemoteSleepIndication (
NetworkHandleType nmChannelHandle,
Syntax
boolean* nmRemoteSleepIndPtr
)
Sync/Async Synchronous
Reentrancy Reentrant
Parameters
None
(inout)
E_OK: No error
Return value Std_ReturnType
E_NOT_OK: Checking of remote sleep indication bits has
failed
⌋()
[SWS_CanNm_00153] ⌈Service call CanNm_CheckRemoteSleepIndication shall
provide the information about current status of Remote Sleep Indication (i.e. already
detected or not).⌋(RS_Nm_00052, RS_Nm_02509)
8.3.19 CanNm_SetSleepReadyBit
[SWS_CanNm_00338]⌈
Service Name CanNm_SetSleepReadyBit
Std_ReturnType CanNm_SetSleepReadyBit (
NetworkHandleType nmChannelHandle,
Syntax
boolean nmSleepReadyBit
)
Sync/Async Synchronous
nmChannel
Identification of the NM-channel
Handle
Parameters (in)
nmSleepReadyBit Value written to ReadySleep Bit in CBV
Parameters
None
(inout)
E_OK: No error
Return value Std_ReturnType E_NOT_OK: Writing of remote sleep indication bit has
failed
Description Set the NM Coordinator Sleep Ready bit in the Control Bit Vector
⌋()
8.3.20 CanNm_PnLearningRequest
[SWS_CanNm_91004]{DRAFT} ⌈
Service
CanNm_PnLearningRequest (draft)
Name
Std_ReturnType CanNm_PnLearningRequest (
Syntax NetworkHandleType nmChannelHandle
)
Service ID
0xf2
[hex]
Sync/Async Asynchronous
Parameters nmChannel
Identification of the NM-channel
(in) Handle
Parameters
None
(inout)
Parameters
None
(out)
E_OK: No error
Return value Std_ReturnType E_NOT_OK: PN Learning Requesthas failed or is not
configured for this network handle.
Set Repeat Message Request Bit and Partial Network Learning Bit for NM
messages transmitted next on the bus. This will force all nodes to enter the PNC
Description Learning Phase. This is needed for the optional Dynamic PNC-to-channel-mapping
feature.
Tags: atp.Status=draft
⌋()
8.3.21 CanNm_RequestSynchronizedPncShutdown
[SWS_CanNm_91003]{DRAFT} ⌈
Service Name CanNm_RequestSynchronizedPncShutdown (draft)
Std_ReturnType CanNm_RequestSynchronizedPncShutdown (
NetworkHandleType nmChannelHandle,
Syntax
PNCHandleType pncId
)
Sync/Async Synchronous
Reentrant for different nmChannelHandle. Non reentrant for the same nmChannel
Reentrancy
Handle.
Parameters
None
(inout)
Parameters
None
(out)
⌋(RS_Nm_02545)
8.4.1 CanNm_TxConfirmation
[SWS_CanNm_00228]⌈
Service Name CanNm_TxConfirmation
void CanNm_TxConfirmation (
PduIdType TxPduId,
Syntax
Std_ReturnType result
)
75 of 117 Document ID 13: AUTOSAR_SWS_CANNetworkManagement
Specification of CAN Network Management
AUTOSAR CP R21-11
Sync/Async Synchronous
Reentrancy Reentrant for different PduIds. Non reentrant for the same PduId.
Parameters
None
(inout)
Parameters
None
(out)
⌋()
[SWS_CanNm_00283] ⌈Caveats of CanNm_TxConfirmation:
The call context is either on interrupt level (interrupt mode) or on task level
(polling mode). This callback service is re-entrant for multiple CAN controller
usage.
The CanNm module is initialized correctly.⌋()
8.4.2 CanNm_RxIndication
[SWS_CanNm_00231]⌈
Service Name CanNm_RxIndication
void CanNm_RxIndication (
PduIdType RxPduId,
Syntax
const PduInfoType* PduInfoPtr
)
Service ID
0x42
[hex]
Sync/Async Synchronous
Reentrancy Reentrant for different PduIds. Non reentrant for the same PduId.
Parameters RxPdu
ID of the received PDU.
(in) Id
Parameters
None
(inout)
Parameters
None
(out)
Description Indication of a received PDU from a lower layer communication interface module.
⌋()
Note: The callback function CanNm_RxIndication called by the CAN Interface and
implemented by the CanNm module. It is called in case of a receive indication event
of the CAN Driver.
8.4.3 CanNm_ConfirmPnAvailability
[SWS_CanNm_00344]⌈
Service Name CanNm_ConfirmPnAvailability
void CanNm_ConfirmPnAvailability (
Syntax NetworkHandleType nmChannelHandle
)
Service ID
0x16
[hex]
Sync/Async Synchronous
Parameters
nmChannelHandle Identification of the NM-channel
(in)
Parameters
None
(inout)
Parameters
None
(out)
⌋()
[SWS_CanNm_00345] ⌈ Caveats of CanNm_ConfirmPnAvailability: The CanNm
module is initialized correctly.⌋ ()
8.4.4 CanNm_TriggerTransmit
[SWS_CanNm_91001]⌈
Service
CanNm_TriggerTransmit
Name
Std_ReturnType CanNm_TriggerTransmit (
PduIdType TxPduId,
Syntax
PduInfoType* PduInfoPtr
)
Service ID
0x41
[hex]
Sync/Async Synchronous
Reentrancy Reentrant for different PduIds. Non reentrant for the same PduId.
Parameters
TxPduId ID of the SDU that is requested to be transmitted.
(in)
Parameters
None
(out)
E_OK: SDU has been copied and SduLength indicates the number of
Std_-
copied bytes.
Return value Return-
E_NOT_OK: No SDU data has been copied. PduInfoPtr must not be
Type
used since it may contain a NULL pointer or point to invalid data.
Within this API, the upper layer module (called module) shall check whether the
available data fits into the buffer size reported by PduInfoPtr->SduLength. If it fits, it
Description shall copy its data into the buffer provided by PduInfoPtr->SduDataPtr and update
the length of the actual copied data in PduInfoPtr->SduLength. If not, it returns E_
NOT_OK without changing PduInfoPtr.
⌋()
78 of 117 Document ID 13: AUTOSAR_SWS_CANNetworkManagement
Specification of CAN Network Management
AUTOSAR CP R21-11
Note: The CanNm modul has to aggregate all PNCs which were indicated for a
synchronized PNC shutdown and transfer the pncId’s to a byte array (PN Info range).
Each bit (PN bit) of the PN Info range represent a particular PNC. The byteIndex and
bitindex within the PN Info range of PN bit shall be determined as follows:
byteIndex = (PncId div 8)
bitIndex = (PncId mod 8)
8.5.1 CanNm_MainFunction
[SWS_CanNm_00234]⌈
Service Name CanNm_MainFunction
void CanNm_MainFunction (
Syntax void
)
Service ID
0x13
[hex]
Main function of the CanNm which processes the algorithm describes in that
Description
document.
⌋()
In this chapter all interfaces required from other modules are listed.
This chapter defines all interfaces which are required to fulfill the core functionality of
the module.
80 of 117 Document ID 13: AUTOSAR_SWS_CANNetworkManagement
Specification of CAN Network Management
AUTOSAR CP R21-11
[SWS_CanNm_00324]⌈
Header
API Function Description
File
Det_Report- Service to report runtime errors. If a callout has been configured then
Det.h
RuntimeError this callout shall be called.
Nm_Network-
Nm.h Notification that the network management has entered Network Mode.
Mode
Nm_Prepare- Notification that the network management has entered Prepare Bus-
Nm.h
BusSleepMode Sleep Mode.
⌋()
This chapter defines all interfaces which are required to fulfill an optional functionality
of the module.
[SWS_CanNm_00325]⌈
Header
API Function Description
File
This function shall notify the CanSM module, that the CanNm has
CanSM_Tx- CanSM_ detected for the affected partial CAN network a tx timeout exception,
TimeoutException CanIf.h which shall be recovered within the respective network state machine
of the CanSM module.
Nm_CoordReady-
Cancels an indication, when the NM Coordinator Sleep Ready bit in
ToSleep- Nm.h
the Control Bit Vector is set back to 0.
Cancellation
Nm_CoordReady- Sets an indication, when the NM Coordinator Sleep Ready bit in the
Nm.h
ToSleepIndication Control Bit Vector is set
Nm_PduRx-
Nm.h Notification that a NM message has been received.
Indication
Notification that the network management has detected that not all
Nm_Remote-
Nm.h other nodes on the network are longer ready to enter Bus-Sleep
SleepCancellation
Mode.
Nm_Remote- Notification that the network management has detected that all other
Nm.h
SleepIndication nodes on the network are ready to enter Bus-Sleep Mode.
Nm_State-
Change- Nm.h Notification that the state of the lower layer <BusNm> has changed.
Notification
Nm_TxTimeout-
Nm.h Service to indicate that an attempt to send an NM message failed.
Exception
PduR_
PduR_CanNmRx- Indication of a received PDU from a lower layer communication
Can
Indication interface module.
Nm.h
Within this API, the upper layer module (called module) shall check
whether the available data fits into the buffer size reported by Pdu
PduR_
PduR_CanNm- InfoPtr->SduLength. If it fits, it shall copy its data into the buffer
Can
TriggerTransmit provided by PduInfoPtr->SduDataPtr and update the length of the
Nm.h
actual copied data in PduInfoPtr->SduLength. If not, it returns E_
NOT_OK without changing PduInfoPtr.
PduR_
PduR_CanNmTx- The lower layer communication interface module confirms the
Can
Confirmation transmission of a PDU, or the failure to transmit a PDU.
Nm.h
⌋()
8.6.3 Configurable interfaces
9 Sequence diagrams
TimerExpired()
CanIf_Transmit()
StartTimer(CANNM_MSG_CYCLE_TIME)
StartTimer(CANNM_MSG_TIMEOUT_TIME)
CanNm_TxConfirmation(PduIdType, E_OK)
CanNm_TxConfirmation()
StopTimer()
CanNm_RxIndication(PduIdType, PduInfoType*)
opt CANNM_BUS_LOAD_REDUCTION_ENABLED = ON
StartTimer(CANNM_MSG_TIMEOUT_TIME)
StartTimer(CANNM_MSG_REDUCED_TIME)
CanNm_RxIndication
()
9.3 Nm Coordination
«module» «module» «module» «module» «module» «module»
ComM Nm FrNm CanNm FrSm CanSM
Nm_NetworkRelease(Std_ReturnType,
NetworkHandleType)
Nm_RemoteSleepIndication(NetworkHandleType)
The NM Coordinator ECU
"ready to sleep" but cluster
Nm_RemoteSleepIndication(NetworkHandleType)
to be coordinated is not.
Thus NM must not "release
bus communication" yet.
Repetition cycle
boundary()
Nm_SynchronizationPoint(NetworkHandleType)
Start shutdown
timers()
FrNm_RequestBusSynchronization(Std_ReturnType,
NetworkHandleType)
FrNm_NetworkRelease(Std_ReturnType,
NetworkHandleType)
Repetition cycle
boundary()
Network Mode
Ready Sleep
Last repetition
Nm_BusSleepMode(NetworkHandleType) cycle finished()
[CAN]
Shutdown timer expires()
CanNm_RequestBusSynchronization(Std_ReturnType,
NetworkHandleType)
CanNm_NetworkRelease(Std_ReturnType,
NetworkHandleType)
Network Mode
Ready Sleep
Timer expires
()
Nm_PrepareBusSleepMode(NetworkHandleType)
Nm_BusSleepMode(NetworkHandleType)
ComM_Nm_BusSleepMode
(NetworkHandleType) Bus-Sleep Mode
No Communication
CanSM_RequestComMode(Std_ReturnType, NetworkHandleType,
ComM_ModeType)
10 Configuration specification
In general, this chapter defines configuration parameters and their clustering into
containers. In order to support the specification chapter 10.1 describes fundamentals.
It also specifies a template (table) you shall use for the parameter specification. We
intend to leave chapter 10.1 in the specification to guarantee comprehension.
Chapter 10.2 specifies the structure (containers) and the parameters of the module
CanNm.
The configuration parameters as defined in this chapter are used to create a data
model for an AUTOSAR tool chain. The realization in the code is implementation
specific.
The configuration parameters as defined in this chapter are used to create a data
model for an AUTOSAR tool chain. The realization in the code is implementation
specific.
The configuration parameters are divided in parameters which are used to enable
features, parameters which affect all channels of the CanNm and parameters which
affect the respective channels of the CanNm.
CanNmDevErrorDetect: EcucBooleanParamDef
+parameter
CanNmGlobalConfig:
EcucParamConfContainerDef defaultValue = false
defaultValue = false
+parameter CanNmUserDataEnabled:
EcucBooleanParamDef
+parameter CanNmRemoteSleepIndEnabled:
EcucBooleanParamDef
+parameter CanNmBusSynchronizationEnabled:
EcucBooleanParamDef
CanNmGlobalPnSupport:
+parameter
EcucBooleanParamDef
defaultValue = false
+parameter CanNmBusLoadReductionEnabled:
EcucBooleanParamDef
+parameter CanNmImmediateRestartEnabled:
EcucBooleanParamDef
+parameter CanNmPassiveModeEnabled:
EcucBooleanParamDef
+parameter CanNmPduRxIndicationEnabled:
EcucBooleanParamDef
+parameter CanNmStateChangeIndEnabled:
EcucBooleanParamDef
+parameter CanNmComControlEnabled:
EcucBooleanParamDef
CanNmMainFunctionPeriod:
+parameter EcucFloatParamDef
+parameter CanNmComUserDataSupport:
EcucBooleanParamDef
+parameter CanNmCoordinatorSyncSupport:
EcucBooleanParamDef
CanNmChannelConfig:
+subContainer EcucParamConfContainerDef
upperMultiplicity = *
lowerMultiplicity = 1
+parameter CanNmPnSyncShutdownErrorReactionEnabled:
EcucBooleanParamDef
+parameter CanNmDynamicPncToChannelMappingSupport:
EcucBooleanParamDef
CanNmPnShutdownMessageRetransmissionDuration:
+parameter EcucFloatParamDef
min = 0.001
max = 65.535
lowerMultiplicity = 0
upperMultiplicity = 1
10.2.2 CanNm
SWS Item ECUC_CanNm_00087 :
Module Name CanNm
Module Description Configuration Parameters for the Can Nm module.
Post-Build Variant Support true
Supported Config Variants VARIANT-LINK-TIME, VARIANT-POST-BUILD, VARIANT-PRE-COMPILE
Included Containers
Container Name Multiplicity Scope / Dependency
This container contains the global configuration parameter of
the CanNm. The parameters and the parameters of the sub
CanNmGlobalConfig 1 containers shall be mapped to the C data type
CanNm_ConfigType (for parameters where it is possible)
which is passed to the CanNm_Init function.
10.2.3 CanNmGlobalConfig
SWS Item ECUC_CanNm_00001 :
Container Name CanNmGlobalConfig
Parent Container CanNm
This container contains the global configuration parameter of the CanNm.
The parameters and the parameters of the sub containers shall be mapped
Description
to the C data type CanNm_ConfigType (for parameters where it is
possible) which is passed to the CanNm_Init function.
Configuration Parameters
Multiplicity 1
Type EcucBooleanParamDef
Default value false
Post-Build Variant Value false
Value Configuration Class Pre-compile time X All Variants
Link time --
Post-build time --
Scope / Dependency scope: local
Post-build time --
Scope / Dependency scope: local
dependency: Must not be defined if CanNmPassiveModeEnabled==true
Link time --
Post-build time --
Scope / Dependency scope: ECU
dependency: calculationFormula = Equal(NmPduRxIndicationEnabled)
Included Containers
Container Name Multiplicity Scope / Dependency
This container contains the channel specific configuration
CanNmChannelConfig 1..*
parameter of the CanNm.
PN information configuration
CanNmPnInfo 0..1 Tags:
atp.Status=obsolete
CanNmBusLoadReductionActive:
CanNmChannelConfig: +parameter EcucBooleanParamDef
EcucParamConfContainerDef
CanNmCarWakeUpRxEnabled:
upperMultiplicity = * EcucBooleanParamDef
lowerMultiplicity = 1 +parameter
defaultValue = false
CanNmTimeoutTime:
+parameter EcucFloatParamDef
CanNmCarWakeUpBitPosition:
max = 65.535 EcucIntegerParamDef
min = 0.002
+parameter
max = 7
min = 0
CanNmWaitBusSleepTime: lowerMultiplicity = 0
EcucFloatParamDef upperMultiplicity = 1
+parameter
min = 0.001
max = 65.535
lowerMultiplicity = 0
upperMultiplicity = 1 CanNmCarWakeUpBytePosition:
+parameter
EcucIntegerParamDef
CanNmRepeatMessageTime: min = 0
+parameter EcucFloatParamDef max = 7
lowerMultiplicity = 0
max = 65.535 upperMultiplicity = 1
min = 0
+parameter
CanNmCarWakeUpFilterEnabled:
CanNmRemoteSleepIndTime: EcucBooleanParamDef
EcucFloatParamDef
+parameter defaultValue = false
min = 0.001 lowerMultiplicity = 0
max = 65.535 upperMultiplicity = 1
lowerMultiplicity = 0
upperMultiplicity = 1
CanNmCarWakeUpFilterNodeId:
CanNmMsgCycleTime:
EcucIntegerParamDef
+parameter EcucFloatParamDef
max = 255
max = 65.535
min = 0.001 min = 0
lowerMultiplicity = 0
+parameter upperMultiplicity = 1
+literal CANNM_PDU_BYTE_1:
EcucEnumerationLiteralDef
CanNmPduNidPosition:
+parameter +literal
EcucEnumerationParamDef
CANNM_PDU_OFF:
EcucEnumerationLiteralDef
+literal
CANNM_PDU_BYTE_0:
CanNmPduCbvPosition: EcucEnumerationLiteralDef
+parameter EcucEnumerationParamDef +literal
CANNM_PDU_BYTE_1:
EcucEnumerationLiteralDef
+literal
CanNmMsgCycleOffset: CANNM_PDU_BYTE_0:
+parameter EcucFloatParamDef EcucEnumerationLiteralDef
+literal
max = 65.535
CANNM_PDU_OFF:
min = 0
EcucEnumerationLiteralDef
CanNmMsgReducedTime:
+parameter EcucFloatParamDef
CanNmActiveWakeupBitEnabled:
max = 65.535
EcucBooleanParamDef
min = 0.001
+parameter
defaultValue = false
lowerMultiplicity = 0
CanNmMsgTimeoutTime: upperMultiplicity = 1
EcucFloatParamDef
+parameter
min = 0.001
max = 65.535
lowerMultiplicity = 0
upperMultiplicity = 1
CanNmNodeId: EcucIntegerParamDef
+parameter
max = 255
min = 0
CanNmImmediateNmTransmissions:
+parameter EcucIntegerParamDef
min = 0
max = 255 CanNmImmediateNmCycleTime:
EcucFloatParamDef
+parameter
min = 0.0010
max = 65.535
lowerMultiplicity = 0
upperMultiplicity = 1
CanNmTxPdu:
+subContainer EcucParamConfContainerDef CanNmTxPduRef: EcucReferenceDef
+reference
lowerMultiplicity = 0 lowerMultiplicity = 1
upperMultiplicity = 1 upperMultiplicity = 1
CanNmRxPdu:
+subContainer EcucParamConfContainerDef CanNmRxPduRef: EcucReferenceDef
+reference
lowerMultiplicity = 1 lowerMultiplicity = 1
upperMultiplicity = * upperMultiplicity = 1
+parameter CanNmNodeDetectionEnabled:
EcucBooleanParamDef
+parameter CanNmStayInPbsEnabled:
EcucBooleanParamDef
+parameter CanNmNodeIdEnabled:
EcucBooleanParamDef
ComMChannel:
CanNmComMNetworkHandleRef:
+reference
EcucReferenceDef +destination EcucParamConfContainerDef
lowerMultiplicity = 1
requiresSymbolicNameValue = true upperMultiplicity = 256
+parameter
CanNmSynchronizedPncShutdownEnabled:
EcucBooleanParamDef
defaultValue = false
+parameter CanNmDynamicPncToChannelMappingEnabled: lowerMultiplicity = 0
EcucBooleanParamDef
upperMultiplicity = 1
defaultValue = false
lowerMultiplicity = 0
upperMultiplicity = 1
10.2.5 CanNmChannelConfig
SWS Item ECUC_CanNm_00017 :
Container Name CanNmChannelConfig
Parent Container CanNmGlobalConfig
This container contains the channel specific configuration parameter of the
Description
CanNm.
Post-Build Variant
true
Multiplicity
Multiplicity Configuration Pre-compile time X VARIANT-PRE-COMPILE, VARIANT-
Class LINK-TIME, VARIANT-POST-BUILD
Link time --
Post-build time --
Configuration Parameters
Range 0 .. 7
Default value --
Post-Build Variant
false
Multiplicity
Post-Build Variant Value false
Multiplicity Configuration Pre-compile time X VARIANT-PRE-COMPILE
Class Link time X VARIANT-LINK-TIME, VARIANT-POST-
BUILD
Post-build time --
Value Configuration Class Pre-compile time X VARIANT-PRE-COMPILE
Link time X VARIANT-LINK-TIME, VARIANT-POST-
BUILD
Post-build time --
Scope / Dependency scope: local
dependency: only available if CanNmCarWakeUpRxEnabled == TRUE
CanNmCarWakeupBytePosition ≥ number of enabled system bytes (CBV,
NID)
Post-Build Variant
false
Multiplicity
Post-Build Variant Value false
Multiplicity Configuration Pre-compile time X VARIANT-PRE-COMPILE
Class Link time X VARIANT-LINK-TIME, VARIANT-POST-
BUILD
Post-build time --
Value Configuration Class Pre-compile time X VARIANT-PRE-COMPILE
Link time X VARIANT-LINK-TIME, VARIANT-POST-
BUILD
Post-build time --
Scope / Dependency scope: local
dependency: This parameter is only valid if
CanNmImmediateNmTransmissions is greater one.
BUILD
Post-build time --
Value Configuration Class Pre-compile time X VARIANT-PRE-COMPILE
Link time X VARIANT-LINK-TIME, VARIANT-POST-
BUILD
Post-build time --
Scope / Dependency scope: local
dependency: CanNmMsgTimeoutTime < CanNmMsgCycleTime
BUILD
Post-build time --
Scope / Dependency scope: ECU
dependency: calculationFormula = Equal(NmNodeIdEnabled)
ImplementationType: CanNm_PduPositionType
Multiplicity 1
Type EcucEnumerationParamDef
Range CANNM_PDU_BYTE_0 Byte 0 is used
CANNM_PDU_BYTE_1 Byte 1 is used
CANNM_PDU_OFF Control Bit Vector is not used
Post-Build Variant
false
Value
Value Pre-compile time X VARIANT-PRE-COMPILE
Configuration Link time X VARIANT-LINK-TIME, VARIANT-
Class POST-BUILD
Post-build time --
Scope / scope: ECU
Dependency dependency: CanNmPduNidPosition; If CanNmNodeDetectionEnabled == true
then CanNmPduCbvPosition != CANNM_PDU_OFF
ImplementationType: CanNm_PduPositionType
Multiplicity 1
Type EcucEnumerationParamDef
Range CANNM_PDU_BYTE_0 Byte 0 is used
CANNM_PDU_BYTE_1 Byte 1 is used
CANNM_PDU_OFF Node Identification is not used
Post-Build Variant
false
Value
Value Pre-compile time X VARIANT-PRE-COMPILE
Configuration Link time X VARIANT-LINK-TIME, VARIANT-
Class POST-BUILD
Post-build time --
Scope / scope: ECU
Name CanNmPnHandleMultipleNetworkRequests
Parent Container CanNmChannelConfig
Description Specifies if CanNm performs an additional transition from Network Mode to
Repeat Message State (true) or not (false).
Multiplicity 0..1
Type EcucBooleanParamDef
Default value false
Post-Build Variant
false
Multiplicity
Post-Build Variant Value false
Multiplicity Configuration Pre-compile time X VARIANT-PRE-COMPILE
Class Link time X VARIANT-LINK-TIME, VARIANT-POST-
BUILD
Post-build time --
Value Configuration Class Pre-compile time X VARIANT-PRE-COMPILE
Link time X VARIANT-LINK-TIME, VARIANT-POST-
BUILD
Post-build time --
Scope / Dependency scope: local
dependency: only valid if CanNmGlobalPnSupport == true
DRAFT:
Only available if CanNmPnEnabled == TRUE and NmPnEraCalcEnabled
== TRUE.
Type EcucFloatParamDef
Range [0.001 .. 65.535]
Default value --
Post-Build Variant Value false
Value Configuration Class Pre-compile time X VARIANT-PRE-COMPILE
Link time X VARIANT-LINK-TIME, VARIANT-POST-
BUILD
Post-build time --
Scope / Dependency scope: local
dependency: It shall be equal for all nodes in the cluster.
It shall be long enough to make all Tx-buffer empty.
In case CanNmStayInPbsEnabled is disabled this parameter shall be
mandatory.
Included Containers
Container Name Multiplicity Scope / Dependency
This container is used to configure the Rx PDU properties that
CanNmRxPdu 1..*
are used for the CanNm Channel.
CanNmTxPdu 0..1 This container contains the CanNmTxConfirmationPduId and
109 of 117 Document ID 13: AUTOSAR_SWS_CANNetworkManagement
Specification of CAN Network Management
AUTOSAR CP R21-11
the CanNmTxPduRef.
This optional container is used to configure the UserNm PDU.
CanNmUserDataTxPdu 0..1 This container is only available if
CanNmComUserDataSupport is enabled.
10.2.6 CanNmRxPdu
SWS Item ECUC_CanNm_00038 :
Container Name CanNmRxPdu
Parent Container CanNmChannelConfig
This container is used to configure the Rx PDU properties that are used for
Description
the CanNm Channel.
Configuration Parameters
No Included Containers
10.2.7 CanNmTxPdu
SWS Item ECUC_CanNm_00036 :
Container Name CanNmTxPdu
Parent Container CanNmChannelConfig
This container contains the CanNmTxConfirmationPduId and the
Description
CanNmTxPduRef.
Configuration Parameters
Description Handle Id to be used by the Lower Layer to confirm the transmission of the
CanNmTxPdu to the LowerLayer.
Multiplicity 1
Type EcucIntegerParamDef (Symbolic Name generated for this parameter)
Range 0 .. 65535
Default value --
Post-Build Variant Value false
Value Configuration Class Pre-compile time X All Variants
Link time --
Post-build time --
Scope / Dependency scope: ECU
No Included Containers
10.2.8 CanNmUserDataTxPdu
SWS Item ECUC_CanNm_00045 :
Container Name CanNmUserDataTxPdu
Parent Container CanNmChannelConfig
This optional container is used to configure the UserNm PDU. This
Description
container is only available if CanNmComUserDataSupport is enabled.
Configuration Parameters
No Included Containers
10.2.9 CanNmPnInfo
SWS Item ECUC_CanNm_00071 : (Obsolete)
Container Name CanNmPnInfo
Parent Container CanNmGlobalConfig
PN information configuration
Description Tags:
atp.Status=obsolete
Configuration Parameters
Included Containers
Container Name Multiplicity Scope / Dependency
112 of 117 Document ID 13: AUTOSAR_SWS_CANNetworkManagement
Specification of CAN Network Management
AUTOSAR CP R21-11
PN information configuration
CanNmPnFilterMaskByte 1..63 Tags:
atp.Status=obsolete
10.2.10 CanNmPnFilterMaskByte
SWS Item ECUC_CanNm_00069 : (Obsolete)
Container Name CanNmPnFilterMaskByte
Parent Container CanNmPnInfo
PN information configuration
Description Tags:
atp.Status=obsolete
Configuration Parameters
No Included Containers
11 Examples
Three nodes are connected to the bus and are in “normal operation” state. The
nodes (Node 1 and Node 2) with the smallest CanNmMsgReducedTime are sending
alternating their Network Management PDUs. After a while node 1 goes into “ready
sleep” state. Now node 2 and node 3 are sending alternating Network Management
PDU. After a while also node 2 goes into “ready sleep” state. Since node 3 is the last
node on the bus only node 3 is sending messages with CanNmMsgCycleTime.
Assume an example network of three nodes 1, 2, 3 (see also Figure 11-2). Nodes
specific cycle offsets are equal respectively to t1 < t2 < t3 < T. NM cycle time is equal
to T (see Figure 11-3).
Network Management PDUs sent on the bus within the Repeat Message State are
presented in the Figure 11-4, and within the Normal Operation / Ready Sleep State in
Figure 11-5. Each dot in Figure 11-5 denotes restart of the NM-Timeout Timer.