UdpNm¶
文档信息 Document Information¶
版本历史 Version History¶
日期(Date) |
作者(Author) |
版本(Version) |
状态(Status) |
说明(Description) |
|---|---|---|---|---|
2025/2/22 |
caihong.liu |
V0.1 |
发布(Release) |
首次发布(First release) |
2025/04/04 |
caihong.liu |
V1.0 |
发布(Release) |
正式发布(Official release) |
参考文档 References¶
编号(Number) |
分类(Classification) |
标题(Title) |
版本(Version) |
|---|---|---|---|
1 |
Autosar |
AUTOSAR_FO_PRS_NetworkManagementProtocol.pdf |
R23-11 |
2 |
Autosar |
AUTOSAR_CP_SWS_NetworkManagementInterface.pdf |
R23-11 |
3 |
Autosar |
AUTOSAR_FO_RS_NetworkManagement.pdf |
R23-11 |
4 |
Autosar |
AUTOSAR_CP_TPS_ECUConfiguration.pdf |
R23-11 |
术语与简写 Terms and Abbreviations¶
术语 Terms¶
术语(Terms) |
解释(Explanation) |
|---|---|
NM PDU |
指数据包中传输的有效载荷,包括NM用户数据以及控制位向量和源节点标识符。(The payload transmitted within a data packet, which includes NM user data, the Control Bit Vector, and the Source Node Identifier.) |
NM Packet |
指一个以太网帧:除了有效载荷部分的网管传输数据( PDU )外,还包含一个IP和一个UDP报头。(An Ethernet frame that, in addition to the network management transmission data (PDU) of the payload section, also contains an IP and a UDP header.) |
NM Message |
在NM算法的方法论内转移的任何单一信息项。(Any single item of information transferred within the methodology of the NM algorithm.) |
Bus-Off state |
指没有电缆连接到以太网HW的情况。(The state where no cable is connected to the Ethernet HW.) |
PDU transmission ability is disabled |
这意味着NM-PDU传输已经被UdpNm_DisableCommunication服务禁用。(This means that NM-PDU transmission has been disabled by the UdpNm_DisableCommunication service.) |
Repeat Message Request Bit Indication |
UdpNm_SoAdIfRxIndication在接收到的NM-PDU的CBV字节中找到Repeat Message Request比特位为TRUE。(UdpNm_SoAdIfRxIndication finds the Repeat Message Request bit to be TRUE in the CBV byte of a received NM-PDU.) |
Top-level PNC coordinator |
ECU作为顶层的PNC协调器,负责在所有分配的通道上进行主动协调的PNC。该ECU具有启用的PNC网关功能。顶层PNC协调器触发这些PNC的同步PNC停机,如果网络中没有其他ECU请求它们,如果同步PNC停机被启用。(An ECU acting as a top-level PNC coordinator, which is responsible for the active coordination of PNC on all its assigned channels. This ECU has the PNC gateway function enabled. The top-level PNC coordinator triggers a synchronized PNC shutdown for these PNCs if no other ECU in the network requests them and if synchronized PNC shutdown is enabled.) |
Intermediate PNC coordinator |
一个ECU作为中间的PNC协调器,为那些在至少一个通道上被动协调的PNC提供协调。该ECU具有启用的PNC网关功能。如果同步PNC关断被启用,中间PNC协调器将同步PNC关断转发给被动协调的PNC的主动协调通道。(An ECU acting as an intermediate PNC coordinator, which provides coordination for those PNCs that are passively coordinated on at least one channel. This ECU has the PNC gateway function enabled. If synchronized PNC shutdown is enabled, the intermediate PNC coordinator will forward the synchronized PNC shutdown to the actively coordinating channels of the passively coordinated PNCs.) |
PNC leaf node |
一个PNC叶子节点是一个ECU,它在网络中完全不充当PNC协调器。它与通常的NM消息一样处理PN关机消息。(A PNC leaf node is an ECU that does not act as a PNC coordinator at all within the network. It handles PN shutdown messages like regular NM messages.) |
PN shutdown message |
顶层PNC协调器发送PN关断消息,以指示整个PN拓扑的同步PNC关断。一个PN关断消息作为NM消息,在控制比特向量中具有PNSR位,对于一个同步关断设置为” 1 “表示的所有PNC。(A PN shutdown message is sent by a top-level PNC coordinator to indicate a synchronized PNC shutdown for the entire PN topology. A PN shutdown message is an NM message with the PNSR bit in the Control Bit Vector set to “1” for all PNCs for which a synchronized shutdown is indicated.) |
简写 Abbreviations¶
简写(Abbreviation) |
全称(Full name) |
解释(Explanation) |
|---|---|---|
API |
Application Programming Interface |
应用程序接口 |
EthIf |
Ethernet Interface |
以太网接口 |
UdpNm |
UDP Network Management |
Udp 网络管理模块缩写 |
CBV |
Control Bit Vector |
NM-PDU中控制位向量 |
CWU |
Car Wakeup |
车辆唤醒 |
SduR |
Service Data Unit |
服务数据单元 |
NM |
Network Management |
网络管理 |
PNC |
Partial Network Cluster |
部分网络簇 |
PNI |
Partial Network Information |
部分网络信息 |
PNL |
Partial Network Learning |
部分网络学习 |
SNI |
Source Node Identifier |
源节点标识符 |
UDP |
User Datagram Protocol |
用户数据包协议 |
TCP/IP |
A family of communication protocols used in computer networks |
计算机网络中使用的一簇通信协议 |
简介 Introduction¶
UdpNm模块的核心功能是协调网络正常运行和总线睡眠模式之间的转换,除此之外,还提供了可选功能,例如检测当前节点或检测其他所有节点是否准备休眠等。
The core function of the UdpNm module is to coordinate the transition between normal network running and bus-sleep mode. In addition, it provides optional functions, such as detecting whether the local node or all other nodes are ready to sleep.
UdpNm提供网络管理接口(Nm)和TCP/IP协议栈之间的适配。UdpNm通过调用SoAd模块的发送API来传输数据,并提供接收API给SoAd用于接收下层网络管理报文。Nm模块调用UdpNm模块API来更改UdpNm的当前状态机状态,UdpNm的状态机模式切换需要通知给Nm模块。
UdpNm provides the adaptation between the Network Management interface (Nm) and the TCP/IP protocol stack. UdpNm transmits data by calling the transmission APIs of the SoAd module and provides reception APIs for SoAd to receive network management messages from the lower layers. The Nm module calls the APIs of the UdpNm module to change the current state machine state of UdpNm, and state machine mode switches in the UdpNm module need to be notified to the Nm module.
Autosar通信栈 (Autosar Communication Stack)¶
功能描述 Functional Description¶
特性 Features¶
AUTOSAR UdpNm基于分散的直接网络管理策略,这意味着每个网络节点仅根据在通信系统内接收和/或发送报文,执行自给自足的活动。
AUTOSAR UdpNm is based on a decentralized direct network management strategy, which means that each network node performs self-sufficient activities based solely on the messages it receives and/or transmits within the communication system.
AUTOSAR UdpNm协调算法基于周期性的NM数据包,集群中的所有节点都通过广播传输接收这些数据包。接收到NM数据包表明发送节点要保持NM集群处于唤醒状态。如果任何节点准备好进入总线睡眠模式,它将停止发送NM数据包,但是只要接收到来自其他节点的NM数据包,它就会推迟过渡到总线睡眠模式。如果在专用计时器超时前都未接收到NM数据包,则每个节点都会启动到总线休眠模式的转换。UdpNm通过状态机切换和各状态定时器管理来完成协调算法
The AUTOSAR UdpNm coordination algorithm is based on periodic NM packets, which are received via broadcast by all nodes in the cluster. The reception of an NM packet indicates that the sending node wants to keep the NM cluster awake. If any node is ready to enter the bus-sleep mode, it stops sending NM packets but postpones the transition to bus-sleep mode as long as it receives NM packets from other nodes. If no NM packets are received before a dedicated timer expires, each node initiates the transition to the bus-sleep mode. UdpNm accomplishes this coordination algorithm through state machine switches and the management of various state timers.
通道状态管理功能 Channel State Management Function¶
从网络管理集群中单个节点的角度来看,AUTOSAR UdpNm状态机包含算法所需的状态、切换和触发。通道的状态切换在触发切换后的下一个主函数中处理,且每当模式切换完成后通过API将状态通知到上层节点(NmIf)。
From the perspective of a single node in the network management cluster, the AUTOSAR UdpNm state machine contains the states, switches, and triggers required by the algorithm. Channel state switches are processed in the next main function after a switch is triggered, and whenever a mode switch is completed, the state is notified to the upper layer module (NmIf) via an API.
AUTOSAR UdpNm状态机包含三种操作模式(Mode):
The AUTOSAR UdpNm state machine consists of three operating modes:
Network Mode(网络模式)
Prepare Bus-Sleep Mode(总线预睡眠模式)
Bus-Sleep Mode(总线睡眠模式)
UdpNm Stack Machine¶
网络模式 Network Mode¶
网络模式包含以下三个子状态(State):
The Network Mode contains the following three sub-states:
Repeat Message State(重复报文状态)
Normal Operation State(正常运行状态)
Ready Sleep State(准备睡眠状态)
重复报文状态 Repeat Message State¶
当节点配置为Passive Mode的节点,意味着该节点只能接受报文而不能传输任何报文,关于Passive Mode具体的将在下面章节中进行说明。
When a node is configured in Passive Mode, it means that the node can only receive messages and cannot transmit any messages. Passive Mode will be explained in more detail in a later section.
对于非Passive Mode的节点,Repeat Message State可确保从Bus-Sleep或Prepare Bus-Sleep到Network Mode的任何过渡对于网络上的其他节点都是可见的。此外,它确保所有节点在UdpNmRepeatMessageTime(配置参数)内保持活动状态。当UdpNmRepeatMessageTime配置为0,表示未配置Repeat Message State。这意味着Repeat Message State是瞬态的,在进入后立即离开,因此无法保证启动稳定性,并且无法执行节点检测过程。当UdpNmRepeatMessageTime超时后,节点将离开Repeat Message State而切至其他状态。若当前网络状态为请求,切换到Normal Operation State,若当前网络状态为释放,切换到Ready Sleep State。
For nodes not in Passive Mode, the Repeat Message State ensures that any transition from Bus-Sleep or Prepare Bus-Sleep to Network Mode is visible to other nodes on the network. Furthermore, it ensures that all nodes remain active within the UdpNmRepeatMessageTime (a configuration parameter). If UdpNmRepeatMessageTime is configured to 0, it indicates that the Repeat Message State is not configured. This means that the Repeat Message State is transient and is exited immediately upon entry. Consequently, startup stability cannot be guaranteed, and the node detection procedure cannot be performed. When UdpNmRepeatMessageTime expires, the node will leave the Repeat Message State and transition to another state. If the current network state is “requested”, it switches to the Normal Operation State. If the current network state is “released”, it switches to the Ready Sleep State.
当非Passive Mode的节点从Bus-Sleep Mode, Prepare-Bus-Sleep Mode,Normal Operation State或Ready Sleep State进入Repeat Message State时,传输功能应该被重启,为了防止总线数据爆发,降低负载,每次进入Repeat Message State时,都要延迟UdpNmMsgCycleOffset(配置参数)段时间后,再开始传输数据,若配置UdpNmImmediateNmTransmissions并且网络被请求则不需要延迟UdpNmMsgCycleOffset时间。
When a non-Passive Mode node enters the Repeat Message State from Bus-Sleep Mode, Prepare-Bus-Sleep Mode, Normal Operation State, or Ready Sleep State, the transmission function shall be restarted. To prevent a burst of data on the bus and to reduce the load, a delay of UdpNmMsgCycleOffset (a configuration parameter) is introduced each time the Repeat Message State is entered before data transmission begins. However, if UdpNmImmediateNmTransmissions is configured and the network is requested, the UdpNmMsgCycleOffset delay is not necessary.
正常运行状态 Normal Operation State¶
Normal Operation State可确保只要需要网络功能,任何节点都可以使NM集群保持唤醒状态。当处于Normal Operation State,节点按照UdpNmMsgCycleTime周期发送报文,当网络释放后,UdpNm进入Ready Sleep state。
The Normal Operation State ensures that any node can keep the NM cluster awake as long as network functionality is required. While in the Normal Operation State, the node sends messages periodically according to UdpNmMsgCycleTime. When the network is released, UdpNm enters the Ready Sleep state.
准备睡眠状态 Ready Sleep State¶
Ready Sleep State可确保NM群集中的任何节点都在等待过渡到Prepare Bus-Sleep Mode。
The Ready Sleep State ensures that any node in the NM cluster is waiting to transition to the Prepare Bus-Sleep Mode.
当进入Ready Sleep State,本节点就不再传输数据。当节点接收到其他节点传输的报文时,会将NM-Timeout定时器重置,当NM-Timeout定时器超时且处于Ready Sleep State时,网络管理进入Prepare Bus-Sleep Mode。其中NM-Timeout定时器的时间是由UdpNmTimeoutTime(配置参数)决定的。
Upon entering the Ready Sleep State, the local node stops transmitting data. When the node receives a message transmitted by another node, it resets the NM-Timeout timer. When the NM-Timeout timer expires and the node is in the Ready Sleep State, the network management enters the Prepare Bus-Sleep Mode. The duration of the NM-Timeout timer is determined by UdpNmTimeoutTime (a configuration parameter).
总线预睡眠模式 Prepare Bus-Sleep Mode¶
Prepare Bus Sleep state目的是确保所有节点都有时间在进入总线休眠状态之前停止其网络活动,使总线活动平静下来,最后在“准备总线睡眠模式”下总线上没有任何活动。
The purpose of the Prepare Bus Sleep state is to ensure that all nodes have time to stop their network activities before entering the bus-sleep state, allowing bus activity to quiet down. Ultimately, there shall be no activity on the bus in the “Prepare Bus-Sleep Mode”.
当本节点进入Prepare Bus-Sleep Mode,UdpNmWaitBusSleepTime(配置参数)定时器被启动,当UdpNmWaitBusSleepTime定时器超时,当前状态将由Prepare Bus-Sleep Mode切换至Bus-Sleep Mode。
When the local node enters the Prepare Bus-Sleep Mode, the UdpNmWaitBusSleepTime (a configuration parameter) timer is started. When the UdpNmWaitBusSleepTime timer expires, the current state switches from Prepare Bus-Sleep Mode to Bus-Sleep Mode.
如果在Prepare Bus-Sleep Mode接收到其他节点传输的网络管理报文时,当前UdpNm状态将由Prepare Bus-Sleep Mode切换至Network Mode, 默认情况下,将进入Repeat Message State。
If a network management message from another node is received in the Prepare Bus-Sleep Mode, the current UdpNm state will switch from Prepare Bus-Sleep Mode to Network Mode, and by default, will enter the Repeat Message State.
如果在Prepare Bus-Sleep Mode接收到网络请求时,当前状态将由Prepare Bus-Sleep Mode切换至Network Mode, 默认情况下,将进入Repeat Message State。如果UdpNmImmediateRestartEnabled(配置参数)被设置为TRUE,那么在这种情况下会立刻触发一次传输,这样做的理由是:集群中的其他节点仍处于Prepare Bus-Sleep Mode,在这种特殊情况下,应避免过渡到Bus-Sleep Mode,并应尽快恢复总线通信。由于UdpNm中网络管理PDU的传输偏移导致,处于Repeat Message State的第一个网络管理PDU的传输可能会大大延迟。为了避免延迟重新启动网络可以立即请求发送网络管理PDU。
If a network request is received in the Prepare Bus-Sleep Mode, the current state will switch from Prepare Bus-Sleep Mode to Network Mode, and by default, will enter the Repeat Message State. If UdpNmImmediateRestartEnabled (a configuration parameter) is set to TRUE, a transmission will be triggered immediately in this case. The rationale for this is that other nodes in the cluster are still in the Prepare Bus-Sleep Mode, and in this specific situation, the transition to Bus-Sleep Mode shall be avoided, and bus communication shall be restored as quickly as possible. Due to the transmission offset of the network management PDU in UdpNm, the transmission of the first network management PDU in the Repeat Message State can be significantly delayed. To avoid a delayed network restart, a request to send the network management PDU can be made immediately.
总线睡眠模式 Bus-Sleep Mode¶
Bus-Sleep state的目的是在不交换任何消息时降低节点的功耗。将通信控制器切换到睡眠模式,激活相应的唤醒机制,最后将功耗降低到总线睡眠模式下的适当水平。
The purpose of the Bus-Sleep state is to reduce the power consumption of the node when no messages are being exchanged. This is achieved by switching the communication controller to a sleep mode, activating the appropriate wake-up mechanisms, and finally reducing power consumption to a level suitable for the bus-sleep mode.
当UdpNm处于Bus-Sleep Mode接收到网络管理报文时,此时UdpNm不会切换至Network Mode,而是通知Nm模块,由上层模块做决策。
When UdpNm is in Bus-Sleep Mode and receives a network management message, it does not switch to Network Mode. Instead, it notifies the Nm module, and the upper-layer module makes the decision.
当UdpNm处于Bus-Sleep Mode接收到被动请求或网络请求时,当前状态将由Bus-Sleep Mode切换至Network Mode, 默认情况下,将进入Repeat Message State。
When UdpNm is in Bus-Sleep Mode and receives a passive request or a network request, the current state switches from Bus-Sleep Mode to Network Mode, and by default, will enter the Repeat Message State.
AUTOSAR NM 报文格式 AUTOSAR NM Message Format¶
AUTOSAR NM 报文有特定的格式要求,NM报文总长度视总线特性而定,受总线MTU限制。报文数据段格式如图:
AUTOSAR NM messages have a specific format requirement. The total length of an NM message depends on the bus characteristics and is limited by the bus MTU. The format of the message data segment is as follows:
NM message layout example¶
1.Control Bit Vector(CBV):长度为一字节的可选字段,根据配置可以处于NM报文第一、二字节或者不使用。FlexRay总线仅可处于第一字节或不使用。该字节信息如下图
1.Control Bit Vector (CBV): An optional one-byte field that, depending on the configuration, can be located in the first or second byte of the NM message, or not used at all. For the FlexRay bus, it can only be in the first byte or not used. This byte contains information as shown in the figure below.
CBV layout¶
2.Source Node ID (SNI):长度为一字节的可选字段,根据配置可以处于NM报文第一、二字节或者不使用。FlexRay总线仅可处于第二字节或不使用。该字节数据根据通道配置决定。
2.Source Node ID (SNI): An optional one-byte field that, depending on the configuration, can be located in the first or second byte of the NM message, or not used at all. For the FlexRay bus, it can only be in the second byte or not used. The data in this byte is determined by the channel configuration.
3.User Data of n Bytes:若干字节的可选字段,CBV和SNI之外的字节都为User Data部分。该字段包含两部分,即User data和PNC bit Vector,这两部分均为根据配置决定是否支持,若同时支持则严格要求ser data和PNC bit Vector各自的字节必须连续
3.User Data of n Bytes: An optional field of several bytes. Any bytes other than the CBV and SNI are part of the User Data. This field consists of two parts: User data and the PNC bit Vector. Support for both parts is determined by the configuration. If both are supported, it is strictly required that the bytes for the user data and the PNC bit Vector are contiguous.
通信调度功能 Communication Scheduling Function¶
UdpNm提供周期性网络管理报文发送功能:该功能根据配置项UdpPassiveModeEnabled决定是否启用,当UdpPassiveModeEnabled为TRUE意为启动Udp模块启动被动模式,仅接收报文并不主动参加网络管理;该功能也可动态的被诊断通信控制服务启停。
UdpNm provides a function for the periodic transmission of network management messages. This function is enabled or disabled based on the UdpPassiveModeEnabled configuration item. When UdpPassiveModeEnabled is TRUE, it means that the Udp module is in passive mode, only receiving messages but not actively participating in network management. This function can also be dynamically started and stopped by diagnostic communication control services.
UdpNm提供配置项UdpMsgCycleTime作为常规的报文周期,提供UdpMsgCycleOffset、UdpImmediateNmTransmissions、UdpBusLoadReductionEnabled作为网络管理报文发送方向上特殊场景的附加属性。
UdpNm provides UdpMsgCycleTime as the regular message cycle, and UdpMsgCycleOffset, UdpImmediateNmTransmissions, and UdpBusLoadReductionEnabled as additional attributes for special scenarios in network management message transmission.
如果一个NM PDU被成功接收,下层(例如.SoAd )通过函数调用UdpNm_SoAdIfRxIndication通知Udp。Udp根据PduId匹配相应的通道配置,如是否支持CBV,若支持则根据CBV字节位置逐bit解析、若使能PN则处理PNC Bit Vector字段、重置NM-Timeout计时器等
If an NM PDU is successfully received, the lower layer (e.g., SoAd) notifies Udp via the function call UdpNm_SoAdIfRxIndication. Udp then matches the PduId to the corresponding channel configuration to determine, for example, whether CBV is supported. If supported, it parses the CBV byte bit by bit. If PN is enabled, it processes the PNC Bit Vector field and resets the NM-Timeout timer, etc.
快速发送 Immediate Transmission¶
快速发送机制根据配置参数UdpNmImmediateNmTransmissions决定。该改参数为0时意为不启动;当该参数配置大于0时意为快速发送的报文次数,需要再配置UdpNmImmediateNmCycleTime作为快速发送时报文发送周期。
The immediate transmission mechanism is determined by the UdpNmImmediateNmTransmissions configuration parameter. A value of 0 for this parameter means that the mechanism is not activated. If the parameter is configured to be greater than 0, it indicates the number of messages to be sent immediately. In this case, UdpNmImmediateNmCycleTime must also be configured as the message transmission cycle for immediate transmission.
快速发送机制仅作用于Repeat Message State阶段,当通道被主动请求第一次进入网络模式时,或UdpNmPnHandleMultipleNetworkRequests为TRUE且有网络请求时,进入Repeat Message State触发快速发送UdpNmImmediateNmTransmissions次网络管理报文。当快速发送次数结束时,恢复常规的发送周期。
The immediate transmission mechanism is only active during the Repeat Message State. When a channel is actively requested to enter the Network Mode for the first time, or when UdpNmPnHandleMultipleNetworkRequests is TRUE and there is a network request, the node enters the Repeat Message State and triggers the immediate transmission of UdpNmImmediateNmTransmissions network management messages. After the immediate transmissions are complete, the regular transmission cycle is resumed.
报文失败重发 Message Retransmission on Failure¶
报文发送失败为UdpNm的可选机制,因为UdpNm通道状态切换为异步处理,且以太网需要链路层连接,因此可能造成网络管理报文发送时,通道状态未切换导致发送被拒绝。
Message retransmission on failure is an optional mechanism in UdpNm. Since UdpNm channel state switches are handled asynchronously and Ethernet requires a link-layer connection, it is possible that when a network management message is to be sent, the channel state has not yet switched, leading to the transmission being rejected.
失败重发存在两种触发场景:
There are two scenarios that can trigger a retransmission:
1.UdpNmImmediateNmTransmissions大于0,确保快速发送次数均能成功发送
1.When UdpNmImmediateNmTransmissions is greater than 0, ensure that all immediate transmissions are successful.
快速发送阶段,每当SoAd_IfTransmit返回E_NOT_OK时,则在后续每次主函数中调用一次SoAd_IfTransmit直到返回E_OK并递减快速发送次数,直到完成全部次数快速发送。最坏情况若存在某次报文始终无法成功发送,则在离开Repeat Message State关闭快速发送时一并停掉重发功能。
During the immediate transmission phase, whenever SoAd_IfTransmit returns E_NOT_OK, SoAd_IfTransmit is called once in each subsequent main function until it returns E_OK, at which point the count of immediate transmissions is decremented until all have been sent. In the worst-case scenario, if a message can never be sent successfully, the retransmission function is stopped when the immediate transmission phase is exited upon leaving the Repeat Message State.
2.UdpNmRetryFirstMessageRequest配置为TRUE,确保进入网络模式的首帧报文一定成功发送
2.When UdpNmRetryFirstMessageRequest is configured to TRUE, ensure that the first message upon entering the Network Mode is successfully sent.
当通道状态第一次切换到网络模式时,根据配置决定是否确保首帧发送成功。若调用SoAd_IfTransmit返回E_NOT_OK,则在后续每次主函数中调用一次SoAd_IfTransmit直到返回E_OK。最坏情况若SoAd_IfTransmit始终返回E_NOT_OK,则若通道状态进入Normal Opeartion State时仍可在后续主函数中触发发送,若进入Ready Sleep State停止网络管理报文发送功能时一并停掉重发功能。
When the channel state first switches to the Network Mode, the configuration determines whether to ensure the successful transmission of the first frame. If SoAd_IfTransmit returns E_NOT_OK, SoAd_IfTransmit is called once in each subsequent main function until it returns E_OK. In the worst-case scenario, if SoAd_IfTransmit consistently returns E_NOT_OK, the transmission can still be triggered in a subsequent main function if the channel state enters the Normal Operation State. If it enters the Ready Sleep State, the network management message transmission function is stopped, and the retransmission function is also stopped.
UdpNm附加功能 UdpNm Additional Functions¶
检测远程睡眠指示 Remote Sleep Indication Detection¶
远程睡眠指示应用于一种情况,当处于Normal Operation State的节点发现集群中的所有其他节点都准备睡眠,但处于Normal Operation State状态的节点仍将保持总线苏醒。为了避免这种情况,可以使能远程睡眠指示功能。
Remote sleep indication is used in a situation where a node in the Normal Operation State detects that all other nodes in the cluster are ready to sleep, but the node in the Normal Operation State would otherwise keep the bus awake. To avoid this, the remote sleep indication function can be enabled.
如果当前UdpNm状态为Normal Operation State,并且在UdpNmRemoteSleepIndTime(配置参数)定时器内未收到其他节点发送的网络管理报文,则通知上层Nm模块集群内的其他节点均已准备睡眠。
If the current UdpNm state is Normal Operation State and no network management messages have been received from other nodes within the UdpNmRemoteSleepIndTime (a configuration parameter) timer, the upper-layer Nm module is notified that all other nodes in the cluster are ready to sleep.
如果UdpNm已通知上层Nm模块,而在Normal Operation State或Ready Sleep State下又收到了网络管理报文,或者UdpNm从Normal Operation State切换至Repeat Message State,UdpNm需要通知上层Nm模块集群中的某些节点不再准备睡眠。
If UdpNm has already notified the upper-layer Nm module, and a network management message is received in the Normal Operation State or Ready Sleep State, or if UdpNm switches from the Normal Operation State to the Repeat Message State, UdpNm needs to notify the upper-layer Nm module that some nodes in the cluster are no longer ready to sleep.
用户数据 User Data¶
使用UdpNmUserDataEnabled开关(配置参数)对NM用户数据的支持进行静态配置。
Support for NM user data is statically configured using the UdpNmUserDataEnabled switch (a configuration parameter).
当用户数据功能使能,可以调用UdpNm_SetUserData,该函数可以设置总线上接下来发送的NM数据包的NM用户数据。也可以调用UdpNm_GetUserDat,该函数可以提供包含在最近接收到的NM PDU的有效载荷中的NM用户数据。
When the user data function is enabled, UdpNm_SetUserData can be called to set the NM user data for the next NM packet to be sent on the bus. UdpNm_GetUserData can also be called to retrieve the NM user data contained in the payload of the most recently received NM PDU.
如果UdpNmComUserDataSupport(配置参数)配置为使能,UdpNm将在每次请求发送相应的NM消息之前从引用的NM I-PDU收集NM用户数据,并将用户数据与其他NM字节合并。此时就不能再通过UdpNm_SetUserData函数设置用户数据。
If UdpNmComUserDataSupport (a configuration parameter) is enabled, UdpNm will collect the NM user data from the referenced NM I-PDU before each request to send the corresponding NM message and will merge the user data with the other NM bytes. In this case, the UdpNm_SetUserData function can no longer be used to set the user data.
被动模式 Passive Mode¶
在被动模式下,节点仅接收NM消息,但不发送任何NM消息。被动模式应使用UdpNmPassiveModeEnabled开关(配置参数)进行静态配置。
In passive mode, the node only receives NM messages but does not send any NM messages. Passive mode shall be statically configured using the UdpNmPassiveModeEnabled switch (a configuration parameter).
NM-Pdu接收 NM-Pdu Reception¶
若UdpNmPduRxIndicationEnabled(配置参数)使能,在成功接收NM PDU时,UdpNm应通过调用Nm_PduRxIndication通知上层
If UdpNmPduRxIndicationEnabled (a configuration parameter) is enabled, UdpNm shall notify the upper layer by calling Nm_PduRxIndication upon the successful reception of an NM PDU.
状态改变通知 State Change Notification¶
如果UdpNmStateChangeIndEnabled(配置参数)使能,则UdpNm需要将UdpNm状态的所有更改通知上层Nm。
If UdpNmStateChangeIndEnabled (a configuration parameter) is enabled, UdpNm needs to notify the upper layer Nm of all changes to the UdpNm state.
通信控制 Communication Control¶
使用UdpNmComControlEnabled开关(配置参数),可以静态配置通信控制。当UdpNm_DisableCommunication函数被调用,UdpNm模块NM报文的传输能力将被停止,直到调用UdpNm_EnableCommunication,UdpNm的nm报文传输能力被恢复。
Communication control can be statically configured using the UdpNmComControlEnabled switch (a configuration parameter). When the UdpNm_DisableCommunication function is called, the NM message transmission capability of the UdpNm module is stopped until UdpNm_EnableCommunication is called, at which point the NM message transmission capability of UdpNm is restored.
Hint
网络释放时,UdpNm_DisableCommunication和UdpNm_EnableCommunication成对使用。
When the network is released, UdpNm_DisableCommunication and UdpNm_EnableCommunication are used in pairs.
当UdpNm_DisableCommunication函数被调用,UdpNm的NM-Timeout定时器将被停止,调用函数UdpNm_EnableCommunication,NM-Timeout定时器将被恢复。因此在UdpNm_EnableCommunication尚未调用前,若释放网络,通道状态将停留在ReadySleep状态,休眠将被阻塞,需要在UdpNm_EnableCommunication调用后才可进入Prepare-Bus-Sleep模式。
When the UdpNm_DisableCommunication function is called, the NM-Timeout timer of UdpNm is stopped. When the UdpNm_EnableCommunication function is called, the NM-Timeout timer is restored. Therefore, if the network is released before U-dpNm_EnableCommunication is called, the channel state will remain in the ReadySleep state, and sleep will be blocked. The node can only enter the Prepare-Bus-Sleep mode after UdpNm_EnableCommunication is called.
协调同步 Coordination Synchronization¶
当有多个协调器连接到同一条总线时,在CBV中,NmCoordinatorSleepReady位用于指示主协调器请求启动关闭。
When multiple coordinators are connected to the same bus, the NmCoordinatorSleepReady bit in the CBV is used to indicate that the master coordinator is requesting to initiate a shutdown.
当UdpNm处于网络模式,接收网络管理报文的CBV中NmCoordinatorSleepReady=1,则UdpNm通知上层协调睡眠功能被请求。
When UdpNm is in network mode and receives a network management message with NmCoordinatorSleepReady=1 in the CBV, UdpNm notifies the upper layer that the coordinated sleep function has been requested.
当UdpNm已通知上层协调睡眠功能被请求,接收网络管理报文的CBV中NmCoordinatorSleepReady=0,则UdpNm通知上层协调睡眠功能请求被取消。
When UdpNm has already notified the upper layer that the coordinated sleep function has been requested and then receives a network management message with NmCoordinatorSleepReady=0 in the CBV, UdpNm notifies the upper layer that the coordinated sleep function request has been canceled.
车辆唤醒 Car Wake-up¶
当UdpNmCarWakeUpRxEnabled(配置参数)使能时,车辆唤醒功能被启用,目前暂时没有使用场景。如果任何接收到的NM-PDU中的Car Wakeup位为1,都会通知上层Nm。
When UdpNmCarWakeUpRxEnabled (a configuration parameter) is enabled, the vehicle wake-up function is enabled. There are currently no use cases for this. If the Car Wakeup bit in any received NM-PDU is 1, the upper layer Nm will be notified.
当UdpNmCarWakeUpRxEnabled(配置参数)使能,UdpNmCarWakeUpFilterEnabled(配置参数)也使能时,只有收到NodeId等于UdpNmCarWakeUpFilterNodeId的报文时,才会通知上层。
When UdpNmCarWakeUpRxEnabled (a configuration parameter) is enabled and UdpNmCarWakeUpFilterEnabled (a configuration parameter) is also enabled, the upper layer will be notified only when a message with a NodeId equal to UdpNmCarWakeUpFilterNodeId is received.
PNC¶
Autosar4.x版本开始支持PN功能,Pn功能的目的是基于功能划分网络,形成局域网;这种功能的划分由整车设计完成,对于各节点只需要关心自身存在的网段。只有在UdpGlobalPnSupport(配置参数)和各通道下的UdpPnEnabled(配置参数)使能的情况下,Pn功能才能正常工作。
Starting with Autosar4.x, the PN function is supported. The purpose of the PN function is to partition the network based on the function, forming local area networks. This function partitioning is handled by the overall vehicle design; individual nodes only need to be concerned with their own network segments. The PN function can work correctly only when UdpGlobalPnSupport (a configuration parameter) and UdpPnEnabled (a configuration parameter) for each channel are enabled.
如果UdpPnEnabled(配置参数)为FALSE,则Udp将执行常规的Rx处理,并且应禁用Pn功能。如果UdpPnEnabled为TRUE,接收到的NM-PDU CBV中的PNI位为0,则Udp模块应执行常规的Rx处理,从而省去了Pn功能的扩展。如果UdpPnEnabled为TRUE并且接收到的NM-PDU CBV中的PNI位为1,则Udp模块处理NM-PDU的Pn信息。
If UdpPnEnabled (a configuration parameter) is FALSE, Udp will perform regular Rx processing, and the PN function shall be disabled. If UdpPnEnabled is TRUE and the PNI bit in the CBV of a received NM-PDU is 0, the Udp module shall perform regular Rx processing, thus bypassing the extensions of the PN function. If UdpPnEnabled is TRUE and the PNI bit in the CBV of a received NM-PDU is 1, the Udp module processes the PN information of the NM-PDU.
如果UdpPnEnabled为TRUE,则必须使用CBV,且发送报文时应将CBV中发送的PNI位的值设置为1;如果UdpPnEnabled为FALSE,若使用CBV,则发送报文时应将CBV中的PNI位的值始终设置为0。
If UdpPnEnabled is TRUE, the CBV must be used, and the value of the PNI bit sent in the CBV shall be set to 1 when transmitting a message. If UdpPnEnabled is FALSE and the CBV is used, the value of the PNI bit in the CBV shall always be set to 0 when transmitting a message.
PNC是Partial Network Cluster的缩写,它是指为了在车辆网络中支持一个或多个车辆功能而由多个ECU构成的集群。PNC的编号我们称为PNC ID,范围8~63,整车网络统一编号,关于PNC id与UdpPdu映射关系说明:PNC ID对应UdpPdu中的一个bit,例如PNC ID=8,对应UdpPduByte1的bit0;PNC ID=63,对应Byte7的bit7;PNC ID对应的bit数值为1,则表示当前PN网络被请求,为0则表示网络释放。
PNC is an abbreviation for Partial Network Cluster, which refers to a cluster of multiple ECUs that support one or more vehicle functions in a vehicle network. The number of a PNC is called the PNC ID, which ranges from 8 to 63 and is uniformly numbered throughout the vehicle network. The mapping relationship between the PNC ID and the UdpPdu is as follows: The PNC ID corresponds to one bit in the UdpPdu. For example, PNC ID=8 corresponds to bit0 of UdpPduByte1; PNC ID=63 corresponds to bit7 of Byte7. If the bit corresponding to the PNC ID has a value of 1, it indicates that the current PN network is requested; a value of 0 indicates that the network is released.
Pn信息的位置位于网络管理报文的用户数据部分中,具体的位置根据Nm模块配置决定:NmPncBitVectorOffset和NmPncBitVectorLength。
The location of the PN information is in the user data portion of the network management message. The specific location is determined by the Nm module configuration: NmPncBitVectorOffset and NmPncBitVectorLength.
例如当NmPncBitVectorOffset = 3,NmPncBitVectorLength = 2,代表NM报文只有字节3和字节4包含PN请求信息。
For example, when NmPncBitVectorOffset = 3 and NmPncBitVectorLength = 2, it means that only byte 3 and byte 4 of the NM message contain PN request information.
接收 Reception¶
当通道使能UdpNmPnEnabled为TRUE,且CBV中PNI为1,则需要对PNC Bit Vector字段进行过滤。
When UdpNmPnEnabled for a channel is TRUE and the PNI in the CBV is 1, the PNC Bit Vector field needs to be filtered.
过滤操作由Nm模块完成,通过提供PNC bit vector字段起始地址调用Nm_PncBitVectorRxIndication接口,根据返回值RelevantPncRequestDetected判断接收到的报文是否与该通道相关,若相关则属于过滤通过,可以对报文进行后续处理。若过滤不通过则丢弃本次接收到的报文,不做任何处理。
The filtering operation is performed by the Nm module. The Nm_PncBitVectorRxIndication interface is called with the starting address of the PNC bit vector field. Based on the return value RelevantPncRequestDetected, it is determined whether the received message is relevant to the channel. If it is relevant, it passes the filter and can be further processed. If it does not pass the filter, the received message is discarded without any processing.
当通道使能UdpNmPnEnabled为TRUE,且CBV中PNI为0,视为过滤失败则丢弃本次接收到的报文,不做任何处理。
When UdpNmPnEnabled for a channel is TRUE and the PNI in the CBV is 0, it is considered a filter failure, and the received message is discarded without any processing.
当过滤失败时,若配置项UdpNmAllNmMessagesKeepAwake为TRUE则也可进行后续处理而不丢弃报文。
In the case of a filter failure, if the UdpNmAllNmMessagesKeepAwake configuration item is TRUE, the message can still be further processed instead of being discarded.
当通道使能UdpNmPnEnabled为FALSE,则不进行过滤,对报文进行后续处理而不丢弃报文。
When UdpNmPnEnabled for a channel is FALSE, no filtering is performed, and the message is further processed without being discarded.
发送 Transmission¶
如果网络被请求并且UdpNmPnHandleMultipleNetworkRequests(配置参数)设置为TRUE,无论UdpNm处于Ready Sleep State,Normal Operation State或Repeat Message State,UdpNm应更改为或重新启动为Repeat Message State。并且,UdpNm会传输UdpNmImmediateNmTransmissions(配置参数)数量的报文,其中第一条报文立即传输,其他报文按UdpNmImmediateNmCycleTime传输(配置参数)。
If the network is requested and UdpNmPnHandleMultipleNetworkRequests (a configuration parameter) is set to TRUE, regardless of whether UdpNm is in the Ready Sleep State, Normal Operation State, or Repeat Message State, UdpNm shall change to or restart in the Repeat Message State. Furthermore, UdpNm will transmit a number of messages equal to UdpNmImmediateNmTransmissions (a configuration parameter), with the first message being transmitted immediately and the others being transmitted according to UdpNmImmediateNmCycleTime (a configuration parameter).
当通道使能UdpNmPnEnabled为TRUE,每次发送网络管理报文时,提供PNC bit vector字段起始地址调用Nm_PncBitVectorTxIndication接口以填充该字段。
When UdpNmPnEnabled for a channel is TRUE, each time a network management message is sent, the Nm_PncBitVectorTxIndication interface is called with the starting address of the PNC bit vector field to fill that field.
多变体支持 Multi-variant Support¶
UdpNm 支持在不同变体中:
UdpNm supports in different variants:
1.支持报文发送前的不同的偏移周期
1.Supports different offset periods before message transmission
2.支持配置不同的节点ID
2.Supports the configuration of different node IDs
3.支持配置是否启用PNC功能
3.Supports the configuration of whether to enable the PNC function
4.支持不同的NM-Pdu收发路径
4.Supports different NM-PDU reception and transmission paths
偏差 Deviation¶
1.不支持 Dynamic PNC-to-channel-mapping。
1.Dynamic PNC-to-channel-mapping is not supported.
2.不支持 Pnc shutdown
2.PNC shutdown is not supported.
扩展 Extension¶
1.UdpNmRetryFirstMessageRequest配置参数影响范围扩大
1.The scope of the UdpNmRetryFirstMessageRequest configuration parameter has been expanded.
该配置不仅限于BusSleep Mode主动唤醒时确保首帧发送成功,作用范围增大到任意方式导致进入网络模式都将确保首帧成功发送
This configuration is no longer limited to ensuring the successful transmission of the first frame upon an active wake-up from BusSleep Mode. Its scope has been extended to ensure the successful transmission of the first frame regardless of how the node enters network mode.
集成 Integration¶
文件列表 File List¶
静态文件 Static Files¶
文件(File) |
描述(Description) |
|---|---|
UdpNm.h |
UdpNm模块头文件,包含API函数的扩展声明。(The UdpNm module header file, which contains extension declarations for API functions.) |
UdpNm.c |
UdpNm模块源文件,包含了API函数的实现。(The UdpNm module source file, which contains the realization of API functions.) |
UdpNm_Type.h |
UdpNm数据类型定义文件,定义了配置和内部数据结构。(The UdpNm data type definition file, which defines the configuration and internal data structure.) |
UdpNm_Internal.h |
UdpNm内部数据类型定义文件,定义了部分宏定义,内部使用的变量扩展声明。(The UdpNm internal data type definition file, which defines partial macros and extension declarations of internally used variables.) |
动态文件 Dynamic Files¶
文件(File) |
描述(Description) |
|---|---|
UdpNm_Cfg.h |
定义UdpNm模块预编译时用到的配置参数。(Defines configuration parameters used in the pre-compilation of the UdpNm module.) |
UdpNm_Cfg.c |
定义UdpNm模块生成的配置参数。(Defines configuration parameters generated by the UdpNm module.) |
UdpNm_PBcfg.c |
定义UdpNm模块向外部模块提供的配置参数。(Defines configuration parameters that the UdpNm module provides to external modules.) |
错误处理 Error Handling¶
开发错误 Development Errors¶
Error code |
Value[hex] |
Description |
|---|---|---|
UDPNM_E_UNINIT |
0x01 |
API service used without module initialization |
UDPNM_E_INVALID_CHANNEL |
0x02 |
API service called with wrong channel handle |
UDPNM_E_INVALID_PDUID |
0x03 |
API service called with wrong PDU-ID |
UDPNM_E_INIT_FAILED |
0x05 |
UdpNm initialization has failed, e.g. selected configuration set doesn’t exist. |
UDPNM_E_PARAM_POINTER |
0x12 |
Null pointer has been passed as an argument. |
产品错误 Product Errors¶
None
运行时错误 Runtime Errors¶
Error code |
Value[hex] |
Description |
|---|---|---|
UDPNM_E_NETWORK_TIMEOUT |
0x11 |
NM-Timeout timer has expired outside Ready Sleep State (either in Repeat Message state or in Normal Operation state). |
UDPNM_E_INVALID_PN_SYNC_SHUTDOWN_REQUEST |
0x20 |
A NM message with PN Shutdown Request Bit was received on a channel that is actively coordinated by the ComM PNC Gateway. |
类型定义 Type Definitions¶
None
提供的服务 Services¶
UdpNm_Init¶
void UdpNm_Init(const UdpNm_ConfigType *UdpNmConfigPtr)
Initialize the complete UdpNm module.
- Sync/Async
Synchronous
- Reentrancy
Non Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
UdpNmConfigPtr |
Pointer to a selected configuration |
- Return type
void
UdpNm_PassiveStartUp¶
Std_ReturnType UdpNm_PassiveStartUp(NetworkHandleType nmChannelHandle)
Passive startup of the AUTOSAR UdpNm.
- Sync/Async
Asynchronous
- Reentrancy
Reentrant(but not for the same NM-Channel)
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
nmChannelHandle |
Identification of the NM-channel |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
No error |
E_NOT_OK |
Passive startup of network management has failed |
UdpNm_NetworkRequest¶
Std_ReturnType UdpNm_NetworkRequest(NetworkHandleType nmChannelHandle)
Request the network, since ECU needs to communicate on the bus.
- Sync/Async
Asynchronous
- Reentrancy
Reentrant(but not for the same NM-Channel)
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
nmChannelHandle |
Identification of the NM-channel |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
No error |
E_NOT_OK |
Requesting of network has failed |
UdpNm_NetworkRelease¶
Std_ReturnType UdpNm_NetworkRelease(NetworkHandleType nmChannelHandle)
Release the network,since ECU doesn’t have to communicate on the bus.
- Sync/Async
Asynchronous
- Reentrancy
Reentrant(but not for the same NM-Channel)
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
nmChannelHandle |
Identification of the NM-channel |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
No error |
E_NOT_OK |
Releasing of network has failed |
UdpNm_DisableCommunication¶
Std_ReturnType UdpNm_DisableCommunication(NetworkHandleType nmChannelHandle)
Disable the NM PDU transmission ability due to a ISO14229 Communication Control (0x28) service.
- Sync/Async
Asynchronous
- Reentrancy
Reentrant(but not for the same NM-Channel)
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
nmChannelHandle |
Identification of the NM-channel |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
No error |
E_NOT_OK |
Disabling of NM PDU transmission ability has failed |
UdpNm_EnableCommunication¶
Std_ReturnType UdpNm_EnableCommunication(NetworkHandleType nmChannelHandle)
Enable the NM PDU transmission ability due to a ISO14229 Communication Control (0x28) service.
- Sync/Async
Asynchronous
- Reentrancy
Reentrant(but not for the same NM-Channel)
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
nmChannelHandle |
Identification of the NM-channel |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
No error |
E_NOT_OK |
Enabling of NM PDU transmission ability has failed |
UdpNm_SetUserData¶
Std_ReturnType UdpNm_SetUserData(NetworkHandleType nmChannelHandle, const uint8 *nmUserDataPtr)
Set user data for all NM messages transmitted on the bus after this function has returned without error.
- Sync/Async
Synchronous
- Reentrancy
Non Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
nmChannelHandle |
Identification of the NM-channel |
[in] |
nmUserDataPtr |
Pointer where the user data for the next transmitted NM message shall be copied from. |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
No error |
E_NOT_OK |
Setting of user data has failed. |
UdpNm_GetUserData¶
Std_ReturnType UdpNm_GetUserData(NetworkHandleType nmChannelHandle, uint8 *nmUserDataPtr)
Get user data from the most recently received NM message.
- Sync/Async
Synchronous
- Reentrancy
Non Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
nmChannelHandle |
Identification of the NM-channel |
[in] |
nmUserDataPtr |
Pointer where user data out of the most recently received NM PDU shall be copied to. |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
No error |
E_NOT_OK |
Getting of user data has failed |
UdpNm_GetNodeIdentifier¶
Std_ReturnType UdpNm_GetNodeIdentifier(NetworkHandleType nmChannelHandle, uint8 *nmNodeIdPtr)
Get node identifier from the most recently received NM PDU.
- Sync/Async
Synchronous
- Reentrancy
Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
nmChannelHandle |
Identification of the NM-channel |
[out] |
nmNodeIdPtr |
Pointer where node identifier out of the most recently received NM PDU shall be copied to. |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
No error |
E_NOT_OK |
Getting of the node identifier out of the most recently received NM PDU has failed or is not configured for this network handle. |
UdpNm_GetLocalNodeIdentifier¶
Std_ReturnType UdpNm_GetLocalNodeIdentifier(NetworkHandleType nmChannelHandle, uint8 *nmNodeIdPtr)
Get node identifier configured for the local node.
- Sync/Async
Synchronous
- Reentrancy
Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
nmChannelHandle |
Identification of the NM-channel |
[out] |
nmNodeIdPtr |
Pointer where node identifier of the local node shall be copied to. |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
No error |
E_NOT_OK |
Getting of the node identifier of the local node has failed or is not configured for this network handle. |
UdpNm_RepeatMessageRequest¶
Std_ReturnType UdpNm_RepeatMessageRequest(NetworkHandleType nmChannelHandle)
Set Repeat Message Request Bit for all NM messages transmitted on the bus after this function has returned without error.
- Sync/Async
Asynchronous
- Reentrancy
Reentrant(but not for the same NM-Channel)
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
nmChannelHandle |
Identification of the NM-channel |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
No error |
E_NOT_OK |
Setting of Repeat Message Request Bit has failed or is not configured for this network handle. |
UdpNm_GetPduData¶
Std_ReturnType UdpNm_GetPduData(NetworkHandleType nmChannelHandle, uint8 *nmPduDataPtr)
Get the whole PDU data out of the most recently received NM message. @id 0x0a.
- Sync/Async
Synchronous @reentrancy Reentrant
- Reentrancy
Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
nmChannelHandle |
Identification of the NM-channel |
[out] |
nmPduDataPtr |
Pointer where NM PDU shall be copied to. |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
No error |
E_NOT_OK |
Getting of NM PDU Data has failed or is not configured for this network handle. |
UdpNm_GetState¶
Std_ReturnType UdpNm_GetState(NetworkHandleType nmChannelHandle, Nm_StateType *nmStatePtr, Nm_ModeType *nmModePtr)
Returns the state and the mode of the network management.
- Sync/Async
Synchronous
- Reentrancy
Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
nmChannelHandle |
Identification of the NM-channel |
[out] |
nmStatePtr |
Pointer where state of the network management shall be copied to. |
[out] |
nmModePtr |
Pointer where the mode of the network management shall be copied to |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
No error |
E_NOT_OK |
Getting of NM state has failed |
UdpNm_GetVersionInfo¶
void UdpNm_GetVersionInfo(Std_VersionInfoType *versioninfo)
Returns the version information of this module.
- Sync/Async
Synchronous
- Reentrancy
Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
versioninfo |
Pointer to where to store the version information of this module |
- Return type
void
UdpNm_RequestBusSynchronization¶
Std_ReturnType UdpNm_RequestBusSynchronization(NetworkHandleType nmChannelHandle)
Request bus synchronization.
- Sync/Async
Asynchronous
- Reentrancy
Non Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
nmChannelHandle |
Identification of the NM-channel |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
No error |
E_NOT_OK |
Requesting of bus synchronization has failed |
UdpNm_CheckRemoteSleepIndication¶
Std_ReturnType UdpNm_CheckRemoteSleepIndication(NetworkHandleType nmChannelHandle, boolean *nmRemoteSleepIndPtr)
Check if remote sleep indication takes place or not.
- Sync/Async
Synchronous(but not for the same NM-Channel)
- Reentrancy
Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
nmChannelHandle |
Identification of the NM-channel |
[out] |
nmRemoteSleepIndPtr |
Pointer where check result of remote sleep indication shall be copied to. |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
No error |
E_NOT_OK |
Checking of remote sleep indication bits failed |
UdpNm_SetSleepReadyBit¶
Std_ReturnType UdpNm_SetSleepReadyBit(NetworkHandleType nmChannelHandle, boolean nmSleepReadyBit)
Set the NM Coordinator Sleep Ready bit in the Control Bit Vector.
- Sync/Async
Synchronous
- Reentrancy
Non Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
nmChannelHandle |
Identification of the NM-channel |
[in] |
nmSleepReadyBit |
Value written to ReadySleep Bit in CBV |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
No error |
E_NOT_OK |
Writing of remote sleep indication bit has failed |
UdpNm_Transmit¶
Std_ReturnType UdpNm_Transmit(PduIdType TxPduId, const PduInfoType *PduInfoPtr)
Requests transmission of a PDU.
- Sync/Async
Synchronous
- Reentrancy
Reentrant(for different PduIds. Non reentrant for the same PduId)
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
TxPduId |
Identifier of the PDU to be transmitted |
[in] |
PduInfoPtr |
Length of and pointer to the PDU data and pointer to MetaData. |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
Transmit request has been accepted. |
E_NOT_OK |
Transmit request has not been accepted. |
UdpNm_SoAdIfTxConfirmation¶
void UdpNm_SoAdIfTxConfirmation(PduIdType TxPduId, Std_ReturnType result)
The lower layer communication interface module confirms the transmission of an IPDU, or the failure to transmit a PDU.
- Sync/Async
Synchronous
- Reentrancy
Reentrant(for different PduIds. Non reentrant for the same PduId)
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
TxPduId |
Identifier of the PDU to be transmitted |
[in] |
result |
E_OK: The PDU was transmitted. E_NOT_OK: Transmission of the PDU failed. |
- Return type
void
UdpNm_SoAdIfRxIndication¶
void UdpNm_SoAdIfRxIndication(PduIdType RxPduId, const PduInfoType *PduInfoPtr)
Indication of a received PDU from a lower layer communication interface module.
- Sync/Async
Synchronous
- Reentrancy
Reentrant(for different PduIds. Non reentrant for the same PduId.)
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
RxPduId |
ID of the received PDU. |
[in] |
PduInfoPtr |
Contains the length (SduLength) of the received I-PDU and a pointer to a buffer (SduDataPtr) containing the I-PDU. |
- Return type
void
UdpNm_SoAdIfTriggerTransmit¶
Std_ReturnType UdpNm_SoAdIfTriggerTransmit(PduIdType TxPduId, PduInfoType *PduInfoPtr)
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 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.
- Sync/Async
Synchronous
- Reentrancy
Reentrant(for different PduIds. Non reentrant for the same PduId.)
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
TxPduId |
ID of the SDU that is requested to be transmitted. |
[in] |
PduInfoPtr |
Contains a pointer to a buffer (SduDataPtr) to where the SDU data shall be copied, and the available buffer size in SduLengh. On return, the service will indicate the length of the copied SDU data in SduLength. |
- Return type
Std_ReturnType
UdpNm_MainFunction¶
void UdpNm_MainFunction(UdpNm_ChannelIndexType chIndex)
Main function of the UdpNm which processes the algorithm describes in that document.
- Sync/Async
Synchronous
- Reentrancy
Reentrant(for different NM-channel)
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
chIndex |
Index value of the NM-channel. |
- Return type
void
配置 Configuration¶
基础配置 Basic Configuration¶
- UdpNmChannelConfig中为该通道配置基础的运行参数,包括通道的主函数运行周期、报文发送周期、自动流转状态的持续时间、引用ComM的Channel配置。
In UdpNmChannelConfig, configure the basic running parameters for the channel, including the channel’s main function cycle, message transmission cycle, duration for automatic state transitions, and a reference to the ComM Channel configuration.
UdpNmChannelConfig基础配置 (Basic Configuration of UdpNmChannelConfig)¶
- 每个UdpNmChannelConfig需要创建UdpNmRxPdu和UdpNmTxPdu。UdpNmRxPdu可以创建多个,UdpNmTxPdu仅一个。UdpNmRxPdu和UdpNmTxPdu容器中引用的Pdu需要配置在SoAd模块的SoAdPduRoute和SoAdSocketRoute,详细操作参考SoAd手册。
Each UdpNmChannelConfig needs to create UdpNmTxPdu and UdpNmRxPdu. Multiple UdpNmRxPdu can be created, but only one UdpNmTxPdu can be created. The PDUs referenced within the UdpNmRxPdu and UdpNmTxPdu containers must be configured in the SoAdPduRoute and SoAdSocketRoute of the SoAd module. For detailed instructions, refer to the SoAd Manual.
UdpNmPdu基础配置 (Basic Configuration of UdpNmPdu)¶
UserData¶
1.启动UdpNm的UserData功能需要在Nm模块勾选NmGlobalFeatre/NmUserDataEnabled,将默认勾选所有<Bus>NmUserDataEnabled
1.To enable the UserData feature of UdpNm, check NmGlobalFeature/NmUserDataEnabled in the Nm module. By default, all <Bus>NmUserDataEnabled options are checked.
NmUserDataEnabled¶
2.此时UdpNmComUserDataSupport未勾选则启动API方式通过Nm模块透传设置网络管理报文UserData字段
2.If UdpNmComUserDataSupport is not checked at this point, the API mode is enabled, allowing the UserData field of the network management message to be set via pass-through from the Nm module.
UdpNmUserData¶
3.若UdpNmComUserDataSupport勾选,则屏蔽掉API,使能ComSignal形式设置网络管理报文UserData字段。此时需要配置UdpNmUserDataTxPdu,该容器每个通道仅可配置一个。需要在PduR配置PduRRoutingPath将该Pdu配置到PduRDestPdu,并配置ComSignal以及相应的Pdu到PduRSrcPdu
3.If UdpNmComUserDataSupport is checked, the API is disabled, and the ComSignal method is enabled for setting the UserData field of the network management message. In this case, a UdpNmUserDataTxPdu must be configured. Only one such container can be configured per channel. You need to configure PduRRoutingPath in the PduR to configure this Pdu to PduRDestPdu, and configure ComSignal and corresponding Pdu to PduRSrcPdu.
UdpNmUserDataTxPdu¶
快速发送 Immediate Transmission¶
快速发送机制需要先配置UdpNmImmediateNmTransmission决定快速发送的次数,当UdpNmImmediateNmTransmission > 0时才可配置UdpNmImmediateNmCycleTime报文的快速发送周期
The immediate transmission mechanism requires first configuring UdpNmImmediateNmTransmission to determine the number of immediate transmissions. Only when UdpNmImmediateNmTransmission is greater than 0 can the immediate transmission cycle UdpNmImmediateNmCycleTime be configured.
UdpNmImmediateNmTransmission¶
车辆唤醒 Car Wake-up¶
车辆唤醒功能是通过在接收到的网络管理报文中检测UserData字段中指定bit触发。
The car wake-up function is triggered by detecting a specific bit within the UserData field of a received network management message.
首先需要勾选UdpNmChannelConfig/UdpNmCarWakeUpRxEnabled,在配置UdpNmCarWakeUpBitPosition和UdpNmCarWakeUpBytePosition。
First, check UdpNmChannelConfig/UdpNmCarWakeUpRxEnabled, and then configure UdpNmCarWakeUpBitPosition and UdpNmCarWakeUpBytePosition.
若要启动过滤功能则勾选UdpNmChannelConfig/UdpNmCarWakeUpFilterNodeId,并填写指定的NodeId到UdpNmCarWakeUpFilterNodeId
To enable the filtering function, check UdpNmChannelConfig/UdpNmCarWakeUpFilterEnabled, and enter the specified Node ID into UdpNmCarWakeUpFilterNodeId.
UdpNmCarWakeUp¶