简体   繁体   English

AUTOSAR CAN 堆栈实施提示

[英]AUTOSAR CAN Stack Implementation Hints

My task is to create a software stack for a CAN module using the latest release of AUTOSAR (R19-11).我的任务是使用最新版本的 AUTOSAR (R19-11) 为 CAN 模块创建软件堆栈。 I will not be using any configuration tools.我不会使用任何配置工具。 From what I've read on the AUTOSAR website , these are the modules that I have to implement: CAN Driver, Interface, State Manager, PDU Router and AUTOSAR COM. Since I'm not going to use frames which have more than 8 bytes of data, I won't need the CAN Transport Protocol module.根据我在 AUTOSAR网站上阅读的内容,这些是我必须实现的模块:CAN 驱动程序、接口、State 管理器、PDU 路由器和 AUTOSAR COM。因为我不会使用超过 8 个字节的帧数据,我不需要 CAN 传输协议模块。

When sending PDUs down the stack, some modules add metadata to these received PDUs (which are called SDUs locally), and then send them to the next layer.当将 PDU 向下发送到堆栈时,一些模块将元数据添加到这些接收到的 PDU(在本地称为 SDU),然后将它们发送到下一层。 I've read that we must allocate unique IDs to these PDUs.我读到我们必须为这些 PDU 分配唯一的 ID。 Also, we must have a routing table (inside the PDU Router) which will be used to determine the destination of every PDU based on their IDs.此外,我们必须有一个路由表(在 PDU 路由器内部),用于根据每个 PDU 的 ID 确定目的地。

My questions are:我的问题是:

  • How are IDs assigned? ID是如何分配的?
  • What would an ID look like?身份证是什么样子的?
  • For a given CAN frame, do I have to allocate a different ID based on a PDU's current location in the stack?对于给定的 CAN 帧,我是否必须根据 PDU 在堆栈中的当前位置分配不同的 ID? (COM, State Manager, Interface or Driver) (COM、State 管理器、接口或驱动程序)
  • Knowing that a user (the Application layer) can define an arbitrary number of CAN frames, how does the PDU Router know beforehand what a certain PDU's ID and what it's destination would be?知道用户(应用层)可以定义任意数量的 CAN 帧,PDU 路由器如何预先知道某个 PDU 的 ID 是什么以及它的目的地是什么?
  • What would a message transmission (or reception) look like, starting from the Application layer and ending at the CAN Driver module?从应用层开始到 CAN 驱动程序模块结束的消息传输(或接收)是什么样的?
  • What metadata (or PCI - Protocol Control Information, as it is called in AUTOSAR) will be added by the modules which are receiving a PDU?接收 PDU 的模块将添加哪些元数据(或 PCI - 协议控制信息,如 AUTOSAR 中所称)? For example: The application sends data 0xAA.例如:应用发送数据0xAA。 COM receives this PDU and adds a specific PCI, then sends it down to PDU Router and so on. COM收到这个PDU,加上具体的PCI,然后下发给PDU Router等等。 What would the SDU + PCI = PDU look like at each stage? SDU + PCI = PDU 在每个阶段会是什么样子?

Actually, the advantage of configuration tools in AUTOSAR is, that you do not have to fiddle around in the code and its configuration by hand all the time.实际上,AUTOSAR 中配置工具的优势在于,您不必一直手动摆弄代码及其配置。

Well, not implementing CanTp means too, you do not have customer diagnostics (UDS)?好吧,不实施 CanTp 也意味着您没有客户诊断 (UDS)? And btw., CAN-FD has frames up to 64 bytes.顺便说一句,CAN-FD 的帧最多为 64 字节。

The definition of the PduIdType is in AUTOSAR_SWS_CommunicationStackTypes Ch. PduIdType 的定义在AUTOSAR_SWS_CommunicationStackTypes Ch. 8.1.1. 8.1.1. SWS_COMTYPE_00005, SWS_COMTYPE_00006, SWS_COMTYPE_00007, SWS_COMTYPE_00014 . SWS_COMTYPE_00005, SWS_COMTYPE_00006, SWS_COMTYPE_00007, SWS_COMTYPE_00014

In short, they are unsigned integers, zero-based and consecutive in order to be used as config index into the modules configuration.简而言之,它们是无符号整数,从零开始并且是连续的,以便用作模块配置的配置索引。 And they are created for each BSW module, so you have a set of CanIf-PduIds, PduR-PduIds, IpduM-PduIds, Com-PduIds, SecOC-PduIds, and they could also be split between Rx and Tx (so a set of RxPduIds starting at 0, and set of TxPduIds starting also at 0).它们是为每个 BSW 模块创建的,所以你有一组 CanIf-PduIds、PduR-PduIds、IpduM-PduIds、Com-PduIds、SecOC-PduIds,它们也可以在 Rx 和 Tx 之间拆分(所以一组RxPduIds 从 0 开始,一组 TxPduIds 也从 0 开始)。 So, a CanFrames PDU can have different PDU-IDs in CanIf, PduR, Com, etc. and multiplexed Frames are split into separate PDUs with different PduIds for each multiplexer.因此,一个 CanFrames PDU 可以在 CanIf、PduR、Com 等中具有不同的 PDU-ID,并且多路复用的帧被分成单独的 PDU,每个多路复用器具有不同的 PduId。

Another chapter to read about it is the AUTOSAR_TPS_EcuConfiguration Ch.要阅读的另一章是AUTOSAR_TPS_EcuConfiguration Ch。 3.4 COM-Stack configuration. 3.4 COM 堆栈配置。

It contains the Concept of Handle-IDs, their definition, assignment, even naming convention and some use-cases.它包含句柄 ID 的概念、它们的定义、分配、甚至命名约定和一些用例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM