目录关键词平台说明一、缩写对照表二、Functional Descriptionvector2.1 Asynchronous and Synchronous behavior of CanTp_Transmit2.1.1 asynchronous2.1.2 synchronous2.2 Separation Time by Application三、CanTpChannels3.1 接收端3.2 发送端四、CanTpGeneral关键词嵌入式、C语言、autosar、OS、BSW平台说明项目ValueOSautosar OSautosar厂商vector EB芯片厂商TI 英飞凌编程语言CC编译器HighTec (GCC)autosar版本4.3.1回到总目录一、缩写对照表PDU SDU PCI 见 [AutoSar]BSW_Com02 PDU详解项目描述CAN N-SDU Info Structure这是一个CAN传输层内部常量结构包含特定的CAN传输层信息用于处理相关CAN N-SDU的传输、接收、分段和重组CAN NSduId在CAN传输层中唯一的SDU标识符。用来引用N-SDU的路由属性。因此为了通过其API与CAN传输层交互上层使用CAN NSduId来引用CAN N-SDU信息结构。BSBlock SizeCanCAN Driver moduleCAN CFCAN Consecutive Frame N-PDUCAN FCCAN Flow Control N-PDUCAN FFCAN First Frame N-PDUCAN SFCAN Single Frame N-PDUDLCData Length Code (part of CAN PDU that describes the SDU length)FIMFunction Inhibition ManagerMtypeMessage Type (possible value: diagnostics, remote diagnostics)N_AINetwork Address Information (see ISO 15765-2).N_ArTime for transmission of the CAN frame (any N-PDU) on the receiver side (see ISO 15765-2).N_AsTime for transmission of the CAN frame (any N-PDU) on the sender side (see ISO 15765-2).N_BrTime until transmission of the next flow control N-PDU (see ISO 15765-2).N_BsTime until reception of the next flow control N-PDU (see ISO 15765-2).N_CrTime until reception of the next consecutive frame N-PDU (see ISO 15765-2).N_CsTime until transmission of the next consecutive frame N-PDU (see ISO 15765-2).N_DataData information of the transport layerN_PCIProtocol Control Information of the transport layerN_SANetwork Source Address (see ISO 15765-2).N_TANetwork Target Address (see ISO 15765-2). It might already contain the N_TAtype(physical/function) in case of ExtendedAddressing.N_AENetwork address extendN_TAtypeNetwork Target Address type (see ISO 15765-2).FSFlow StatusCAN FDCAN flexible data rateCAN_DLCAN frame data lengthTX_DLTransmit data link layer data lengthRX_DLReceived data link layer data lengthSF_DLSingleFrame data length in bytesCTSClearToSend status (FC(CTS))STminis the minimum separation time, which is provided by the receiver. If the transmitter sends the CFs faster than requested, there is no guarantee that the receiver of the segmented data transmission will correctly receive and process all frames. Another purpose of STmin is to reduce the bus load produced by CanTp communication.N_Csis the maximum separation time, after which the transmission of the next CF has to be started. If the delay is longer than N_Cs, the receiver side may detect an N_Cr timeout.二、Functional Descriptionvector2.1 Asynchronous and Synchronous behavior of CanTp_Transmit2.1.1 asynchronous默认情况下API CanTp_Transmit是异步的。这意味着它只准备连接而向上层请求有效载荷数据和传输第一个CAN帧将在下一个任务周期中完成。2.1.2 synchronous可以配置CanTp使CanTp_Transmit同步。然后在上下文中完成对上层的有效负载请求和对CanIf的传输请求CanTp_Transmit。这将略微提高传输速度但也要求上层能够在CanTp_Transmit返回之前处理对CopyTxData函数的调用。2.2 Separation Time by ApplicationCanTp计算的STmin的精度取决于它的任务周期。如果需要的STmin值在CanTp任务周期时间范围内或以下则可能不可接受。一种解决方案是缩短任务周期时间但是它会产生过高的CPU负载。采用外部计时器(如在操作系统或硬件中)也是一种选择。为了解决上述情况CanTp提供了一个可选的调用它在任何时候通知应用程序需要启动STmin。通过通知函数的返回值应用程序可以决定是自己处理STmin还是将其留给CanTp。如果应用程序接受处理分离时间它必须设置一个计时器并调用CanTp_StopSeparationTime()当计时器过期时。这将触发下一个CF的传输。允许在调用Appl_StartSeparationTime()和配置的N_Cs时间结束之前的任何时间调用CanTp_StopSeparationTime()。为了实现上述功能必须配置下图callback三、CanTpChannels该容器包含CanTp模块通过CanTpChannel接收到的每个CAN N-SDU所需的配置(参数)。3.1 接收端N_Ar/N_Br/N_Cr:根据14229/15765/11898和主机厂释放的网络规范进行配置。CanTpRxAddressingFormat定义Rx_PDU寻址方式。寻址方式区别后续单独更新。CanTpRxPaddingActivation该参数定义Rx N-SDU是否使用填充。如果填充被启用所有接收到的sf, ff和cf都被检查为DLC为8。要传输的fc被填充到8字节的长度。CanTpRxTaType声明该Rx N-SDU的通信类型。当长度超过8byte应该被设为CANTP_CANFD_PHYSICAL或者CANTP_CANFD_FUNCTIONALCanTpSTmin该值指定CanTp发送方在两个连续帧传输之间必须等待的最小时间。该值作为FC.CTS的一部分由接收方发送。3.2 发送端参考接收端。四、CanTpGeneralCanTpEnableConstantBS该参数定义在整个接收过程中块大小是否保持不变或者是否可以为每个流控制传输进行调整。如果启用此开关则CanTp仅在接收开始时计算一次BS。否则将根据可用缓冲区为每个流控制帧重新计算BS。建议开启。CanTpOnlyNotifyInformedApplautosar 版本4.1 以上使用使能后只有RxIndication函数在相应的缓冲区返回的值不等于bufreqe_not_ok时才会被调用。建议开启。CanTpPaddingActive该参数定义填充是全局启用还是禁用。通过使能该开关每个Rx/Tx N-SDU可以单独配置带或不带填充。如果此开关被禁用则任何Rx/Tx N-SDU都不能使用填充。CanTpPaddingByte该值指定用于初始化未使用字节的字节值。ISO 15765-2指定的默认值是0xCC。回到总目录