logo资料库

can总线外文文献和翻译.doc

第1页 / 共10页
第2页 / 共10页
第3页 / 共10页
第4页 / 共10页
第5页 / 共10页
第6页 / 共10页
第7页 / 共10页
第8页 / 共10页
资料共10页,剩余部分请下载后查看
华北科技学院毕业设计 外文文献及译稿 CAN Bus Protocol Introduction Controller Area Network (CAN) was initially created by German automotive system supplier Robert Bosch in the mid-1980s for automotive applications as a method for enabling robust serial communication. The goal was to make automobiles more reliable, safe and fuel-efficient while decreasing wiring harness weight and complexity. Since its inception, the CAN protocol and automotive/truck applications. Other markets where networked solutions can bring attractive benefits like medical equipment, test equipment and mobile machines are also starting to utilize the benefits of CAN. The goal of this application note is to explain some of the basics of CAN and show the benefits of choosing CAN for embedded systems networked applications. gained widespread automation popularity has in industrial CAN Overview It approach enables this layered approach. sinter operability between products Most network applications follow a layered approach to system implementation. This from different system etic manufacturers. A standard was created by the International Standards Organization (ISO) as a template to follow for is called the ISO Open Systems Interconnection (OSI) Network Layering Reference Model. The CAN protocol itself implements most of the lower two layers of this reference model. The communication medium portion of the model was purposely left out of the Bosch CAN specification to enable system designers to adapt and optimize the communication protocol on multiple media for maximum flexibility (twisted pair, single wire, optically isolated, RF, IR, etc.). With this flexibility, however, comes the possibility of interoperability concerns. To ease some of these concerns, the International Standards Organization and Society of Automotive Engineers (SAE) have defined some protocols based on CAN that include the Media Dependents Interface definition such that all of the lower two layers are specified. ISO11898 is a standard for high-speed applications, ISO11519 is a standard for 第 1页 共 10页
华北科技学院毕业设计 外文文献及译稿 low-speed applications, and J1939 (from SAE) is targeted for truck and bus applications. All three of these protocols specify a 5V differential electrical bus as the physical interface. The rest of the layers of the ISO/OSI protocol stack are left to be implemented by the system software developer. Higher Layer Protocols (HLPs) are generally used to implement the upper five layers of the OSI Reference Model. HLPs are used to: 1) Standardize startup procedures including bit rates used, 2) Distribute addresses among participating nodes or types of messages, 3) Determine the structure of the messages, and 4) Provide system-level error handling routines. This is by no means a full list of the functions HLPs perform; however it does describe some of their basic functionality. CAN Protocol Basics Carrier Sense Multiple Access with Collision Detection (CSMA/CD) The CAN communication protocol is a CSMA/CD protocol. The CSMA stands for Carrier Sense Multiple Access. What this means is that every node on the network must monitor the bus for a period of no activity before trying to send a message on the bus (Carrier Sense). Also, once this period of no activity occurs, every node on the bus has an equal opportunity to transmit a message (Multiple Access). The CD stands for Collision Detection. If two nodes on the network start transmitting at the same time, the nodes will detect the ‘collision’ and take the appropriate action. In CAN protocol, a nondestructive bitwise arbitration method is utilized. This means that messages remain intact after arbitration is completed even if collisions are detected. All of this arbitration takes place without corruption or delay of the higher priority message. There are a couple of things that are required to support non-destructive bitwise arbitration. First, logic states need to be defined as dominant or recessive. Second, the transmitting node must monitor the state of the bus to see if the logic state it is trying to send actually appears on the bus. CAN define a logic bit 0 as a dominant bit and a logic bit 1 as a recessive bit. A dominant bit state will always win arbitration over a recessive bit state, therefore the 第 2页 共 10页
华北科技学院毕业设计 外文文献及译稿 lower the value in the Message Identifier (the field used in the message arbitration process), the higher the priority of the message. As an example, suppose two nodes are trying to transmit a message at the same time. Each node will monitor the bus to make sure the bit that it is trying to send actually appears on the bus. The lower priority message will at some point try to send a recessive bit and the monitored state on the bus will be a dominant. At that point this node loses arbitration and immediately stops transmitting. The higher priority message will continue until completion and the node that lost arbitration will wait for the next period of no activity on the bus and try to transmit its message again. Message-Based Communication CAN protocol is a message-based protocol, not an address based protocol. This means that messages are not transmitted from one node to another node based on addresses. Embedded in the CAN message itself is the priority and the contents of the data being transmitted. All nodes in the system receive every message transmitted on the bus (and will acknowledge if the message was properly received). It is up to each node in the system to decide whether the message received should be immediately discarded or kept to be processed. A single message can be destined for one particular node to receive, or many nodes based on the way the network and system are designed. For example, an automotive airbag sensor can be connected via CAN to a safety system router node only. This router node takes in other safety system information and routes it to all other nodes on the safety system network. Then all the other nodes on the safety system network can receive the latest airbag sensor information from the router at the same time, acknowledge if the message was received properly, and decide whether to utilize this information or discard it. Another useful feature built into the CAN protocol is the ability for a node to request information from other nodes. This is called a Remote Transmit Request(RTR). This is different from the example in the previous paragraph because instead of waiting for information to be sent by a particular node, this node specifically requests data to be sent to it. One additional benefit of this message-based protocol is that additional nodes can be added to the system without the necessity to reprogram all other nodes to recognize this addition. This new node will start receiving messages from the network and, based on the 第 3页 共 10页
华北科技学院毕业设计 外文文献及译稿 message ID, decide whether to process or discard the received information. CAN Message Frame Description CAN protocol define four different types of messages (or Frames). The first and most common type of frame is a Data Frame. This is used when a node transmits information to any or all other nodes in the system. Second is a Remote Frame, which is basically a Data Frame with the RTR bit set to signify it is a Remote Transmit Request. The other two frame types are for handling errors. One is called an Error Frame and one is called an Overload Frame. Error Frames are generated by nodes that detect any one of the many protocol errors defined by CAN. Overload errors are generated by nodes that require more time to process messages already received. Data Frames consist of fields that provide additional information about the message as defined by the CAN specification. Embedded in the Data Frames are Arbitration Fields, Control Fields, Data Fields, CRC Fields, a 2-bit Acknowledge Field and an End of Frame. The Arbitration Field is used to prioritize messages on the bus. Since the CAN protocol defines a logical 0 as the dominant state, the lower the number in the arbitration field, the higher priority the message has on the bus. The arbitration field consists of 12-bits (11 identifier bits and one RTR bit) or 32-bits (29 identifier bits, 1-bit to define the message as an extended data frame, an SRR bit which isunused, and an RTR bit), depending on whether Standard Frames or Extended Frames are being utilized. The current version of the CAN specification, version 2.0B,defines 29-bit identifiers and calls them Extended Frames. Previous versions of the CAN specification defined 11-bitidentifiers which are called Standard Frames. As described in the preceding section, the Remote Transmit Request (RTR) is used by a node when it requires information to be sent to it from another node. To accomplish an RTR, a Remote Frame is sent with the identifier of the required Data Frame. The RTR bit in the Arbitration Field is utilized to differentiate between a Remote Frame and a Data Frame. If the RTR bit is recessive, then the message is a Remote Frame. If the RTR bit is dominant, the message is a Data Frame. The Control Field consists of six bits. The MSB is the IDE bit (signifies Extended Frame) 第 4页 共 10页
华北科技学院毕业设计 外文文献及译稿 which should be dominant for Standard Data Frames. This bit determines if the message is a Standard or Extended Frame. In Extended Frames, this bit is RB1 and it is reserved.The next bit is RB0 and it is also reserved. The four LSBs are the Data Length Code (DLC) bits. The Data Length Code bits determine how many data bytes are included in the message. It should be noted that a Remote Frame has no data field, regardless of the value of the DLC bits. The Data Field consists of the number of data bytes described in the Data Length Code of the Control Field. The CRC Field consists of a 15-bit CRC field and a CRC delimiter, and is used by receiving nodes to determine if transmission errors have occurred. The Acknowledge Field is utilized to indicate if the message was received correctly. Any node that has correctly received the message, regardless of whether the node processes or discards the data, puts a dominant bit on the bus in the ACK Slot bit time The last two message types are Error Frames and Overload Frames. When a node detects one of the many types of errors defined by the CAN protocol, an Error Frame occurs. Overload Frames tell the network that the node sending the Overload Frame is not ready to receive additional messages at this time, or that intermission has been violated. These errors will be discussed in more detail in the next section. Fast, Robust Communication Because CAN was initially designed for use in auto mobiles, a protocol that efficiently handled errors was critical if it was to gain market acceptance. With the release of version 2.0B of the CAN specification, the maximum communication rate was increased 8x over the version 1.0 specification to 1Mbit/sec. At this rate, even the most time-critical parameters can be transmitted serially without latency concerns. In addition to this, the CAN protocol has a comprehensive list of errors it can detect that ensures the integrity of messages. CAN nodes have the ability to determine fault conditions and transition to different modes based on the severity of problems being encountered. They also have the ability to detect short disturbances from permanent failures and modify their functionality accordingly. CAN nodes can transition from functioning like a normal node (being able to transmit and receive messages normally), to shutting down completely (bus-off) based on the severity of the errors detected. This feature is called Fault Confinement. No faulty CAN node or nodes 第 5页 共 10页
华北科技学院毕业设计 外文文献及译稿 will be able to monopolize all of the bandwidth on the network because faults will be confined to the faulty nodes and these faulty nodes will shut off before bringing the network down. This is very powerful because Fault Confinement guarantees bandwidth for critical system information. Conclusion The CAN protocol was optimized for systems that need to transmit and receive relatively small amounts of information (as compared to Ethernet or USB, which are designed to move much larger blocks of data) reliably to any or all other nodes on the network. CSMA/CD allows every node to have an equal chance to gain access to the bus, and allows for smooth handling of collisions. Since the protocol is message-based, not address based, all messages on the bus receive every message and acknowledge every message, regardless of whether in needs the data or not. This allows the bus to operate in node-to-node or multicast messaging formats without having to send different types of messages. Fast, robust message transmission with fault confinement is also a big plus for CAN because faulty nodes will automatically drop off the bus not allowing any one node from bringing a network down. This effectively guarantees that bandwidth will always be available for critical messages to be transmitted. With all of these benefits built into the CAN protocol and its momentum in the automotive world, other markets will begin to see and implement CAN into their systems. 第 6页 共 10页
华北科技学院毕业设计 外文文献及译稿 CAN 总线协议 简介 控制器区域网络(CAN)的最初创建者是80年代中期的德国汽车系统供应商罗伯特博 世,作为汽车应用启用强大的串行通信的方法。其目标是让汽车更可靠,安全,省油同 时减少线束的重量和复杂性。公司自成立以来,已取得了 CAN 协议广泛普及和其在工业 自动化汽车/卡车方面的应用。该总线在其他市场网络解决方案一样能够带来强有力的 利润,例如医疗设备,测试设备和移动机器也开始利用 CAN 总线的优势。本文的目的是 解释一些 CAN 的基本知识,和选择 CAN 通信作为嵌入式系统网络应用的好处。 CAN 总线概述 大多数网络应用程序遵循分层方法实施。这一系统的方法使不同产品之间的制造商 共同创建一个标准的国际标准化组织(ISO)的为模板遵循这种分层方法。这就是所谓 的国际标准组织开放系统互连(OSI)网络分层参考模型。CAN 协议本身实现了较低的最 基本参考模型层的通信模型中的一部分,是故意忽略 CAN 规范,使系统设计调整和优化 的通信协议最大程度的灵活性(双绞线多种媒体,单丝,光隔离,射频,红外线等)。 有了这个灵活性,但是,随之而来的互操作的可能性成为关注。为了缓解这些问题一些 国际标准组织与国际汽车工程师学会(SAE)在原来的基础上定义了一些在 CAN 协议基 础上的定义,这包括在指定两个底层媒体独立接口的定义。 ISO11898是一个用于高速应用的标准,ISO11519是一个低速应用标准,J1939的(从 SAE)对象是卡车和总线的应用。所有这些协议的物理接口指定为一个5V 的差分电气总 线。其余剩下 ISO / OSI 协议栈层由系统软件开发商来实现,更高一层的协议(HLPs) 一般用来实现上面五层的 OSI 参考模型。 HLPs 用于: 1)规范程序,包括比特率启动使用时, 2)参与节点之间分配地址消息或类型, 3)确定的消息结构, 4)提供系统级的错误处理例程。这绝不是一个执行的职能 HLPs 完整列表,但它确实描 述了他们的基本的一些功能。 第 7页 共 10页
华北科技学院毕业设计 外文文献及译稿 CAN 总线协议基础 载波侦听多路访问冲突检测(CSMA / CD) CAN 通讯协议是 CSMA / CD 协议,CSMA 代表载波侦听多路访问。这意味着,每一个 网络节点在尝试往总线上发送一个消息期间,必须监测总线并保证总线处于不活动状态 (载波监听);另外,当总线处于空闲状态,总线上的每一个节点传输消息的机会是平 等的(多址接入)。CD 代表冲突检测。如果两个网络上的节点在同一时间开始发送数据, 节点将检测到冲突并采取适当的行动。在 CAN 协议中,利用无损逐位仲裁的方法。这也 就是说,即使完成冲突检测,仲裁后消息仍然保持完整,所有这一切仲裁均无损坏或延 误的最高优先级的消息。 无损逐位仲裁的实现需要两个条件。第一,逻辑状态必须定义为显性或隐性。第二, 发送节点必须监视总线状态,以此观察正在试图发送到总线上的实际逻辑状态。CAN 总 线定义为一个逻辑显性位0和逻辑隐性位1。一个显性位的状态总能仲裁隐性位的状态, 因此,较低的消息标识符值(消息中的仲裁过程中使用的字段),消息的优先级越高。 例如,假设两个节点试图在同一时间发送消息。每个节点会监察总线,以保证它正试图 发送的位确确实实出现在总线上。 较低的优先级的消息将在某个点尝试发送一个隐性位,并监视总线状态使自己成为 主节点。此时,这个节点失去仲裁,并立即停止发送。更高的优先级消息将持续发送直 到完成,失去仲裁的节点将等待总线的下一个空闲周期,并尝试发送数据。 基于消息的通信 CAN 协议是一个基于消息的协议,而不是一个基于地址的协议,这意味着消息不能 从一个节点地址传送到另一个节点地址上。嵌入式 CAN 消息本身就是优先和正在传输数 据的内容。所有系统中的节点将接收每个传递在总线上的消息(如果消息正确接收并确 认)。它是由系统的每个节点决定是否将接收到的数据立即丢弃还是保存处理。一个单 一的消息可以设计成指定接受一个特定的节点,或许多建立在网络和系统上的节点。例 如,汽车安全气囊传感器只能通过 CAN 连接到安全系统的路由器节点,此路由器节点接 收其他系统安全信息并转发到安全系统网络的其他节点上。安全系统网络上的所有其他 节点可以在同一时间从路由器上收到最新的安全气囊传感器的信息,确认是否被正确接 收后,决定是否利用这些信息,或遗弃它。 另外一个内置在 CAN 协议中的有用的特性是,可以要求一个节点向另一个节点发送 第 8页 共 10页
分享到:
收藏