CAN2.0B协议详解:从基础到扩展格式

5星 · 超过95%的资源 需积分: 45 254 下载量 9 浏览量 更新于2024-07-26 10 收藏 376KB PDF 举报
"CAN2.0B 协议是CAN(Controller Area Network)总线通信协议的一个版本,主要应用于汽车电子、自动化、工业控制等领域。CAN2.0B协议引入了两种报文格式:标准格式和扩展格式,以满足不同应用中对通信地址范围的需求。标准格式的标识符有11位,而扩展格式则扩展到了29位,提供了更大的灵活性。该协议分为A部分和B部分,A部分描述了按照CAN1.2规范的报文格式,B部分详细介绍了标准和扩展格式。对于兼容性,CAN2.0的设备应至少支持A部分,若使用扩展格式则需支持B部分。在不使用扩展格式的情况下,A部分或旧版本设计的设备能与B部分设计的设备相互通信。CAN2.0B协议涵盖了报文传输、报文校验、编码、错误处理、故障界定以及位定时要求等内容,旨在确保可靠的串行通信。" CAN2.0B协议的核心特点和知识点包括: 1. **报文格式**:CAN2.0B协议提供了两种报文格式,标准格式(11位标识符)和扩展格式(29位标识符)。标准格式适用于简单系统,而扩展格式适用于需要更大地址空间的复杂系统。 2. **兼容性**:CAN2.0B协议的A部分与CAN1.2规范兼容,而B部分增加了对扩展格式的支持。设备间通信时,只要不涉及扩展格式,A部分或旧版本的设备可以与B部分设计的设备互操作。 3. **帧类型**:数据帧用于实际数据传输,远程帧用于请求数据,错误帧用于标识网络中的错误,过载帧用于同步网络速度,帧间空间则是帧之间的间隔,确保正确识别新帧的开始。 4. **发送器/接收器定义**:CAN协议规定了节点如何作为发送器发送报文以及作为接收器接收报文的规则,包括报文的仲裁、确认和错误处理机制。 5. **报文校验**:CAN协议使用CRC校验(Cyclic Redundancy Check)来检测数据传输中的错误,确保数据的完整性。 6. **编码**:CAN协议使用二进制反码编码(Non-Return-to-Zero Inverted, NRZI)和曼彻斯特编码(Manchester Encoding),以减少信号干扰并确定位边界。 7. **错误处理**:CAN协议包含错误检测和错误标定机制,当检测到错误时,节点会通过错误帧进行响应,并进行错误计数和错误状态指示。 8. **故障界定**:协议定义了节点如何进入不同的错误状态,如主动错误状态和被动错误状态,以及如何通过降低传输速率(故障界定模式)来避免进一步的错误。 9. **位定时要求**:CAN协议对位时序有严格要求,确保在不同速度的总线上的正确通信。位定时参数包括位时间、采样点位置等,以适应不同物理环境下的传输。 10. **CAN振荡器容差**:CAN2.0B协议允许一定的振荡器误差,以适应不同硬件的时钟精度差异,并通过协议修改来提高系统的鲁棒性。 CAN2.0B协议通过其灵活的报文格式、强大的错误检测和处理机制,以及对不同设备间通信的兼容性,确保了在复杂工业环境中的高效、可靠的数据通信。
2020-01-23 上传
The Controller Area Network (CAN) is a serial communications protocol which efficiently supports distributed realtime control with a very high level of security. Its domain of application ranges from high speed networks to low cost multiplex wiring. In automotive electronics, engine control units, sensors, anti-skid-systems, etc. are connected using CAN with bitrates up to 1 Mbit/s. At the same time it is cost effective to build into vehicle body electronics, e.g. lamp clusters, electric windows etc. to replace the wiring harness otherwise required. The intention of this specification is to achieve compatibility between any two CAN implementations. Compatibility, however, has different aspects regarding e.g. electrical features and the interpretation of data to be transferred. To achieve design transparency and implementation flexibility CAN has been subdivided into different layers. • the (CAN-) object layer • the (CAN-) transfer layer • the physical layer The object layer and the transfer layer comprise all services and functions of the data link layer defined by the ISO/OSI model. The scope of the object layer includes • finding which messages are to be transmitted • deciding which messages received by the transfer layer are actually to be used, • providing an interface to the application layer related hardware. There is much freedom in defining object handling. The scope of the transfer layer mainly is the transfer protocol, i.e. controlling the framing, performing arbitration, error checking, error signalling and fault confinement. Within the transfer layer it is decided whether the bus is free for starting a new transmission or whether a reception is just starting. Also some general features of the bit timing are regarded as part of the transfer layer. It is in the nature of the transfer layer that there is no freedom for modifications. The scope of the physical layer is the actual transfer of the bits between the different nodes with respect to all electrical properties. Within one network the physical layer, of course, has to be the same for all nodes. There may be, however, much freedom in selecting a physical layer. The scope of this specification is to define the transfer layer and the consequences of the CAN protocol on the surrounding layers.