《AUTOSAR_PRS_E2EProtocol》入门2(Profile1、Profile2、Profile4、Profile5 规范)

本文详细解读了E2EProfile中的数据布局、计数器设计、DataID的使用、CRC计算方法以及Profile1到Profile5的差异,包括Autosar标准下的各种控制字段和协议示例。
摘要由CSDN通过智能技术生成

书接上回

6.3.1 Data layout

In the E2E Profile 1, the layout is in general free to be defined by the user, as long as
the basic limitations of signal alignment are followed:
• signals that have length < 8 bits should be allocated to one byte of an I-PDU, i.e.
they should not span over two bytes.
• signals that have length >= 8 bits should start or finish at the byte limit of an
message.
However, predefined E2E Profile 1 variants define specific data layouts regarding the
protocol data fields, see subsection 6.3.6.

 信号长度<8bits应该配置成1个byte,不应该超过2个bytes;信号长度>=8bits 应该开始或结束在报文限制的长度。

部分特殊的E2E profile1  layout 变形形式,在6.3.6。有关 E2E profile1A/B/C的描述。

6.3.2  Counter

 在E2E Profile 1中,Counter的长度固定为4bits。
在发送方,对于数据元素的第一个传输请求,计数器应初始化为0x0,并且对于每个后续的发送请
求,计数器应增加1。当计数器达到最大值(0xE)时,即0→14递增,下一个发送请求将从0x0重新开始。
计数器值0xF被保留为特殊的无效值。

6.3.3  Data ID

Data ID用于验证每个传输的与安全相关的数据元素的身份,在通信系统网络中它是唯一的。
Data ID长度设置为16bits。
Data ID不传输,但包含在CRC计算中(隐式传输)。
Data ID模式设置为E2E_P11_DA T AID_BOTH:在CRC计算中使用Data ID的两个字节,计算顺序为先低字节,后高字节。

6.3.4  CRC 计算

Profile 1 的 CRC 采 用 CRC-8-SAE J1850 算 法 , 详 情 可 参 见 文 档
AUTOSAR_SWS_CRCLibrary。
Profile 1的CRC计算序列为:

1、首先是Data ID的两个字节;
2、然后是与安全相关的数据元素的所有传输字节(CRC字节除外)。

示例:
报文数据为:CRC 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Data ID 为 0x00,0x12,Data_byte_array=0x12 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00,
计算后,CRC 值为 0xD4。

CRC 相关的参数,在之前也已经有定义,参数 值
CRC result width :8 bits
Polynomial: 0x1D
Initial value: 0x00
Input data reflected :No
Result data reflected :No
XOR value :0x00
Check:0x37
Magic check :0x00

如下在线计算,可以检查计算CRC 结果

CRC(循环冗余校验)在线计算_ip33.com

6.3.5  Timeout 检测

CRC counter 和Data ID 能检测接收数据的有效性,当接收器独立于数据传输执行时,即当接收器不阻塞等待数据元素或各自的信号组时,而是当接收器读取当前可用的数据时(即检查是否有新的数据可用)。然后,通过计数器,接收方可以检测通信丢失和超时。

属性State->Status = E2E_P01STATUS_REPEATED表示存在重复(由前一条消息的通信丢失、延迟或重复引起)。接收端使用State->Status来检测通信超时。

6.3.6  E2E Profile 1 变形体(profile1A/B/C)

该部分主要是不同layout形式及相关参数。

6.3.7  E2E P01 Protect

说明函数 E2E_P01Protect()应:
1. 在Data中写入counter,
2. 如果使用E2E_P01_DATAID_NIBBLE配置,则在Data中写入DataID nibble
3. 计算DataID和Data上的CRC
4. 在数据中写入CRC
5. 增加计数器(将在下次调用中使用E2E_P01Protect ())

原文有详细的函数逻辑框图。

6.3.8  Calculate CRC

CRC 计算算法在函数E2E_P01Protect() (see above chapter),E2E_P01Forward() and E2E_P01Check() (see below chapters)  中有使用。主要是逻辑框图。

6.3.9  E2E_P01Forward

Autosar中显示是Draft状态。

6.3.10  E2E_P01Check

输入参数:Config:E2E_P01的配置参数
Data :需要E2E校验的数据
输入输出参数:State:当前E2E_P01的通信状态
E2E_P01Check主要用来根据输入的DATA和DATA ID等校验数据是否正常

6.3.12  E2E Profile 1 Protocol Examples

E2E Profile1 配置示例

参数        
CounterOffset8
CRCOffset0
DataID0x123 
E2E_P01_DATAID_BOTH12
DataIDModeE2E_P01_DATAID_BOTH
DataLength64
MaxDeltaCounterInit1
MaxNoNewOrRepeatedData15
SyncCounterInit0

counter 初始化为0

6.4 E2E Profile 2

Profile 2提供以下控制字段:Counter、CRC、Data ID,

控制区域描述
Counter4 bits 。 (显式传输)
CRC8 bits,CRC 算法异或多项式为 0x2F,由 CRC library 提供。(显式传输)
Data ID8 bits 数值,与计数器数值相关联。
DataID List 实际上是 16 个不同的值,每个计数器值都对应一个 DataID 值(由Counter 索引) 。

在E2E Profile 2中,与安全相关的数据元素的Layout不受约束,E2E帧头需要特定的Layout,如下所示。

在发送方,对于数据元素的第一个传输请求,计数器应初始化为 0x0,由于计数器在发送之前递增,第一个 Data 的计数器值为 0x1,对于每个后续的发送请求,计数器应增加 1。当计数器达到最大值(0xF)时,下一个发送请求将从 0x0 重新开始。

DataID应该使用Counter的值作为索引从预定义的DataIDList 中选择。每一个受 CRC 保护的数据都有一个专门的 DataIDList,存储在发送方和所有接收方上。Data ID 不传输,但包含在 CRC 计算中(隐式传输)。

Profile 2 的 CRC 采 用 多 项 式 是 0x2F 的 CRC 算 法  。 详 情 可 参 见 文 档AUTOSAR_SWS_CRCLibrary.

参数
CRC result width8bits
Polynomial0x2F
Initial value0xFF
Input data reflectedNO
Result data reflectedNO
XOR value0xFF
Check0xDF
Magic Check0x42

示例:
报文数据为:CRC 0x01 0x00 0x00 0x00 0x00 0x00 0x00
Data ID 为 0x00,0x12,Data_byte_array=0x12 0x00 0x01 0x00 0x00 0x00 0x00 0x00 0x00,
计算后,CRC 值为 0x89。

6.5 E2E Profile 4

Profile 4 shall provide the following control fields, transmitted at runtime together with the protected data: Length, Counter, CRC, Data ID

控制区域描述
Length16bits,支持动态尺寸长度数据
Counter16bits 
CRC

32 bits,CRC 算法多项式为0x1F4ACFB13,由 CRC library 提供。

Note: This CRC polynomial is different from the CRC-
polynomials used by FlexRay, CAN and LIN and TCPIP.

Data ID32 bits 数值,独特的系统宽度

6.6 E2E Profile 5

Profile 5提供以下控制字段:Counter、CRC、Data ID

Counter:8bits(显式传输)

CRC:16 bits, CRC 算法异或多项式为 0x1021, 由 CRC library 提供。(显式传输)

Data ID:16 bits。(隐式传输)

在E2E Profile 5中,与安全相关的数据元素的Layout不受约束,E2E帧头需要特定的Layout

在E2E Profile 5中,Counter的长度固定为8bits。在发送方,对于数据元素的第一个传输请求,计数器应初始化为0x0,并且对于每个后续的发送请求,计数器应增加1。当计数器达到最大值(0xFF)时,下一个发送请求将从0x0重新开始。计数器值OxFF不是作为特殊的无效值保留,而是作为正常的计数器值使用。

Data ID用于验证每个传输的与安全相关的数据元素的身份,在通信系统网络中它是唯一的。
Data ID长度设置为16bits
Data ID不传输,但包含在CRC计算中(隐式传输)。
Data ID模式设置为E2E_P11_DA T AID_BOTH:在CRC计算中使用Data ID的两个字节,计算顺序为先低字节,后高字节。

Profi5的CRC采用16-bit CRC算法,参数见表所示,详情可参见文档AUTOSAR_SWS_CRCLibrary。
Profile 5的CRC计算序列为:
1、 首先是与安全相关的数据元素的所有传输字节(CRC字节除外)
2、 其次是Data ID的两个字节。

参数
CRC result width16bits
Polynomial0x1021
Initial value0xFFFF
Input data reflectedNO
Result data reflectedNO
XOR value0x0000
Check0x29B1
Magic Check0x0000

 报文数据为:CRC(ByteIndex0) CRC(ByteIndex0) 0x00 0x00 0x00 0x00 0x00 0x00
Data ID 为 0x1234,
Data_byte_array=0x00 0x00 0x00 0x00 0x00 0x00 0x34 0x12
计算后,CRC 值为 0xCA1C: CRC(ByteIndex0)为 0x1C, CRC(ByteIndex1)为 0xCA

如下引用文件,对不同Profile 有很好的归纳。

Profile    保护机制    发送描述    最大保护数据长度
Profile01    Counter(4bit)、Data ID(16bit)、 CRC8、Timeout monitoring    Data ID由Data ID Mode决定是否发送 ,Counter和CRC需要发送    30bytes
Profile02    Counter(4bit)、Data ID List(8bit)、 CRC8    Data ID 不会发送,仅用作 CRC计算,Counter和CRC需要发送    256bytes
Profile04    Counter(16bit)、Data ID(32bit)、CRC32、Length(16bit)    Counter、Data ID、CRC、Length均会发送    4096bytes
Profile05    Counter(8bit)、Data ID(16bit) 、CRC16    Data ID 不会发送,仅用作 CRC计算,Counter和CRC需要发送    4096bytes
Profile06    Counter(8bit)、Data ID(16bit)、CRC16、Length(16bit)    Data ID 不会发送,仅用作 CRC 计算,Counter,CRC和Length需要发送    4096bytes
Profile07    Counter(32bit)、Data ID(32bit)、CRC64、Length(32bit)    Counter、Data ID、CRC、Length均会发送    未知
Profile11    Counter(4bit)、Data ID(16bit or 12bit)、CRC8    Counter、Data ID、CRC均会发送    30bytes
Profile12    Counter(4bit)、Data ID List(16*8bit)、CRC8    Data ID 不会发送,仅用作 CRC计算,Counter和CRC需要发送    未知
————————————————

                            版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
                        
原文链接:https://blog.csdn.net/Oushuwen/article/details/129281855

tcp ip upper tester 1.2 Testability Protocol and Service Primitives 1 Introduction and Functional Overview ................................................................. 5 2 Acronyms and Abbreviations............................................................................... 6 3 Related Documentation....................................................................................... 7 3.1 Input documents........................................................................................... 7 3.2 Related Standards and Norms ..................................................................... 7 3.3 Related specification .................................................................................... 7 4 Constraints and Assumptions.............................................................................. 8 4.1 Limitations .................................................................................................... 8 4.2 Applicability to car domains.......................................................................... 8 5 Intended context and applicability of protocol...................................................... 9 5.1 Dependencies to other protocol layers ......................................................... 9 5.2 Dependencies to other standards and norms............................................... 9 6 Protocol Specification........................................................................................ 10 6.1 Message Format and Protocol Fields......................................................... 10 6.2 Message Exchange.................................................................................... 11 6.3 States of Service Primitives........................................................................ 12 6.4 Default Behavior......................................................................................... 12 6.5 Constraints ................................................................................................. 12 6.6 Extensibility ................................................................................................ 12 6.7 Data Types and Format.............................................................................. 13 6.7.1 Boolean............................................................................................... 13 6.7.2 Unsigned............................................................................................. 13 6.7.3 Signed................................................................................................. 13 6.7.4 Floating Point ...................................................................................... 13 6.7.5 Variable Length................................................................................... 14 6.8 Result IDs................................................................................................... 15 6.8.1 Standard Results................................................................................. 15 6.8.2 Testability Specific .............................................................................. 15 6.8.3 Service Primitive Specific.................................................................... 15 6.9 Service Groups........................................................................................... 16 6.9.1 General Group .................................................................................... 16 6.9.2 UDP Group.......................................................................................... 17 6.9.3 TCP Group.......................................................................................... 17 6.10 Service Primitives....................................................................................... 18 6.10.1 Get Version ......................................................................................... 18 6.10.2 Start Test............................................................................................. 19 6.10.3 End Test.............................................................................................. 19 6.10.4 Close Socket....................................................................................... 20Testability Protocol and Service Primitives AUTOSAR TC Release 1.1.0 4 of 29 Document ID 778: AUTOSAR_PRS_TestabilityProtocolAndServicePrimitives - AUTOSAR Confidential - 6.10.5 Create and Bind .................................................................................. 20 6.10.6 Send Data ........................................................................................... 21 6.10.7 Receive and Forward .......................................................................... 22 6.10.8 Listen and Accept................................................................................ 23 6.10.9 Connect............................................................................................... 23 6.10.10 Configure Socket ..........
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值