logo资料库

can入门教程.pdf

第1页 / 共51页
第2页 / 共51页
第3页 / 共51页
第4页 / 共51页
第5页 / 共51页
第6页 / 共51页
第7页 / 共51页
第8页 / 共51页
资料共51页,剩余部分请下载后查看
1. 概要
2. 使用注意事项
3. CAN 是什么?
3.1 CAN的应用示例
3.2 总线拓扑图
4. CAN的特点
5. 错误
5.1 错误状态的种类
5.2 错误计数值
6. CAN协议的基本概念
7. CAN协议及标准规格
7.1 ISO标准化的CAN协议
7.2 ISO11898和ISO11519-2的不同点
7.3 CAN和标准规格
8. CAN协议
8.1 帧的种类
8.2 数据帧
8.3 遥控帧
8.4 错误帧
8.5 过载帧
8.6 帧间隔
8.7 优先级的决定
8.8 位填充
8.9 错误的种类
8.10 错误帧的输出
8.11 位时序
8.12 取得同步的方法
8.13 硬件同步
8.14 再同步
8.15 调整同步的规则
公司主页和咨询窗口
修订记录
Keep safety first in your circuit designs!
Notes regarding these materials
请遵循安全第一进行电路设计
关于利用本资料时的注意事项
致尊敬的顾客 关于产品目录等资料中的旧公司名称 NEC电子公司与株式会社瑞萨科技于2010年4月1日进行业务整合(合并),整合后的 新公司暨“瑞萨电子公司”继承两家公司的所有业务。因此,本资料中虽还保留有旧公司 名称等标识,但是并不妨碍本资料的有效性,敬请谅解。 瑞萨电子公司网址:http://www.renesas.com 2010年4月1日 瑞萨电子公司 【发行】瑞萨电子公司(http://www.renesas.com) 【业务咨询】http://www.renesas.com/inquiry
Notice 1. 2. 3. 4. All information included in this document is current as of the date this document is issued. Such information, however, is subject to change without any prior notice. Before purchasing or using any Renesas Electronics products listed herein, please confirm the latest product information with a Renesas Electronics sales office. Also, please pay regular and careful attention to additional and different information to be disclosed by Renesas Electronics such as that disclosed through our website. Renesas Electronics does not assume any liability for infringement of patents, copyrights, or other intellectual property rights of third parties by or arising from the use of Renesas Electronics products or technical information described in this document. No license, express, implied or otherwise, is granted hereby under any patents, copyrights or other intellectual property rights of Renesas Electronics or others. You should not alter, modify, copy, or otherwise misappropriate any Renesas Electronics product, whether in whole or in part. Descriptions of circuits, software and other related information in this document are provided only to illustrate the operation of semiconductor products and application examples. You are fully responsible for the incorporation of these circuits, software, and information in the design of your equipment. Renesas Electronics assumes no responsibility for any losses incurred by you or third parties arising from the use of these circuits, software, or information. 5. When exporting the products or technology described in this document, you should comply with the applicable export control laws and regulations and follow the procedures required by such laws and regulations. You should not use Renesas Electronics products or the technology described in this document for any purpose relating to military applications or use by the military, including but not limited to the development of weapons of mass destruction. Renesas Electronics products and technology may not be used for or incorporated into any products or systems whose manufacture, use, or sale is prohibited under any applicable domestic or foreign laws or regulations. Renesas Electronics has used reasonable care in preparing the information included in this document, but Renesas Electronics does not warrant that such information is error free. Renesas Electronics assumes no liability whatsoever for any damages incurred by you resulting from errors in or omissions from the information included herein. Renesas Electronics products are classified according to the following three quality grades: “Standard”, “High Quality”, and “Specific”. The recommended applications for each Renesas Electronics product depends on the product’s quality grade, as indicated below. You must check the quality grade of each Renesas Electronics product before using it in a particular application. You may not use any Renesas Electronics product for any application categorized as “Specific” without the prior written consent of Renesas Electronics. Further, you may not use any Renesas Electronics product for any application for which it is not intended without the prior written consent of Renesas Electronics. Renesas Electronics shall not be in any way liable for any damages or losses incurred by you or third parties arising from the use of any Renesas Electronics product for an application categorized as “Specific” or for which the product is not intended where you have failed to obtain the prior written consent of Renesas Electronics. The quality grade of each Renesas Electronics product is “Standard” unless otherwise expressly specified in a Renesas Electronics data sheets or data books, etc. “Standard”: Computers; office equipment; communications equipment; test and measurement equipment; audio and visual equipment; home electronic appliances; machine tools; personal electronic equipment; and industrial robots. “High Quality”: Transportation equipment (automobiles, trains, ships, etc.); traffic control systems; anti-disaster systems; anti- 6. 7. “Specific”: crime systems; safety equipment; and medical equipment not specifically designed for life support. Aircraft; aerospace equipment; submersible repeaters; nuclear reactor control systems; medical equipment or systems for life support (e.g. artificial life support devices or systems), surgical implantations, or healthcare intervention (e.g. excision, etc.), and any other applications or purposes that pose a direct threat to human life. 8. You should use the Renesas Electronics products described in this document within the range specified by Renesas Electronics, especially with respect to the maximum rating, operating supply voltage range, movement power voltage range, heat radiation characteristics, installation and other product characteristics. Renesas Electronics shall have no liability for malfunctions or damages arising out of the use of Renesas Electronics products beyond such specified ranges. Although Renesas Electronics endeavors to improve the quality and reliability of its products, semiconductor products have specific characteristics such as the occurrence of failure at a certain rate and malfunctions under certain use conditions. Further, Renesas Electronics products are not subject to radiation resistance design. Please be sure to implement safety measures to guard them against the possibility of physical injury, and injury or damage caused by fire in the event of the failure of a Renesas Electronics product, such as safety design for hardware and software including but not limited to redundancy, fire control and malfunction prevention, appropriate treatment for aging degradation or any other appropriate measures. Because the evaluation of microcomputer software alone is very difficult, please evaluate the safety of the final products or system manufactured by you. 9. 10. Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental compatibility of each Renesas Electronics product. Please use Renesas Electronics products in compliance with all applicable laws and regulations that regulate the inclusion or use of controlled substances, including without limitation, the EU RoHS Directive. Renesas Electronics assumes no liability for damages or losses occurring as a result of your noncompliance with applicable laws and regulations. 11. This document may not be reproduced or duplicated, in any form, in whole or in part, without prior written consent of Renesas Electronics. 12. Please contact a Renesas Electronics sales office if you have any questions regarding the information contained in this document or Renesas Electronics products, or if you have any other inquiries. (Note 1) “Renesas Electronics” as used in this document means Renesas Electronics Corporation and also includes its majority- owned subsidiaries. (Note 2) “Renesas Electronics product(s)” means any product developed or manufactured by or for Renesas Electronics.
封 RCJ05B0027-0100 G u d e i CAN 入门书 www.renesas.com Rev.1.00 2006.02
应用手册 CAN 入门书 1. 概要 本资料是面向 CAN 总线初学者的 CAN 入门书。对 CAN 是什么、CAN 的特征、标准规格下的位置分布等、 CAN 的概要及 CAN 的协议进行了说明。 2. 使用注意事项 本资料对博世(BOSCH)公司所提出的 CAN 概要及协议进行了归纳,可作为实际应用中的参考资料。对于 具有 CAN 功能的产品不承担任何责任。 目录 1. 概要 ................................................................................................................................................... 1 2. 使用注意事项..................................................................................................................................... 1 3. CAN 是什么?.................................................................................................................................... 2 3.1 CAN 的应用示例................................................................................................................................ 3 3.2 总线拓扑图 ........................................................................................................................................ 4 4. CAN 的特点 ....................................................................................................................................... 5 5. 错误 ................................................................................................................................................... 6 5.1 错误状态的种类 ................................................................................................................................. 6 5.2 错误计数值 ........................................................................................................................................ 8 6. CAN 协议的基本概念......................................................................................................................... 9 7. CAN 协议及标准规格....................................................................................................................... 12 7.1 ISO 标准化的 CAN 协议 .................................................................................................................. 12 7.2 ISO11898 和 ISO11519-2 的不同点................................................................................................ 13 7.3 CAN 和标准规格.............................................................................................................................. 17 8. CAN 协议......................................................................................................................................... 18 8.1 帧的种类 .......................................................................................................................................... 18 8.2 数据帧.............................................................................................................................................. 21 8.3 遥控帧.............................................................................................................................................. 28 8.4 错误帧.............................................................................................................................................. 30 8.5 过载帧.............................................................................................................................................. 31 8.6 帧间隔.............................................................................................................................................. 32 8.7 优先级的决定................................................................................................................................... 33 8.8 位填充.............................................................................................................................................. 36 8.9 错误的种类 ...................................................................................................................................... 37 8.10 错误帧的输出................................................................................................................................... 39 8.11 位时序.............................................................................................................................................. 40 8.12 取得同步的方法 ............................................................................................................................... 42 8.13 硬件同步 .......................................................................................................................................... 43 8.14 再同步.............................................................................................................................................. 44 8.15 调整同步的规则 ............................................................................................................................... 45 RCJ05B0027-0100/Rev.1.00 2006.02 Page 1 of 48
应用手册 3. CAN 是什么? CAN 是 Controller Area Network 的缩写(以下称为 CAN),是 ISO*1 国际标准化的串行通信协议。 在当前的汽车产业中,出于对安全性、舒适性、方便性、低公害、低成本的要求,各种各样的电子控制系统 被开发了出来。由于这些系统之间通信所用的数据类型及对可靠性的要求不尽相同,由多条总线构成的情况很 多,线束的数量也随之增加。为适应“减少线束的数量”、“通过多个 LAN,进行大量数据的高速通信”的需 要,1986 年德国电气商博世公司开发出面向汽车的 CAN 通信协议。此后,CAN 通过 ISO11898 及 ISO11519 进 行了标准化,现在在欧洲已是汽车网络的标准协议。 现在,CAN 的高性能和可靠性已被认同,并被广泛地应用于工业自动化、船舶、医疗设备、工业设备等方面。 图 1 是车载网络的构想示意图。CAN 等通信协议的开发,使多种 LAN 通过网关进行数据交换得以实现。 CAN 〜125 kbps 马达 马达 马达 开关 开关 传感器 安全部 乘客检测 空调 子网 ●LIN 2.4〜19.2kbps 车门 自适应 前灯 仪表板 遥控门 锁 车身部 子网 引爆管 ● Safe- by-Wire (150kbps) 雷 达 白线检测 自适应 巡航 前大灯 窗电动 组合灯 网关 气囊控制 信息部 CAN 500kbps MD/CD 碟盒 音视频 交通信 息导航 电子防 盗系统 发动机・ 传动部 胎压 ITS部 发动机 转向 制动 子网 ●FlexRay*2 (5Mbps) ●MOST ●1394 自动变 速箱 底盘部 故障诊断部 ● CAN (规格) 诊断工具 CAN 125kbps CAN 500kbps 图 1. 车载网络构想 【注】 ISO: International Organization for Standardization (国际标准化组织) *1 *2 FlexRayTM 为戴姆勒克莱斯勒公司注册商标。 RCJ05B0027-0100/Rev.1.00 2006.02 Page 2 of 48
3.1 CAN 的应用示例 图 2 为 CAN 的应用示例 应用手册 Climate Control Motor control Center unit Roof Rain sensor Sunroof Cluster Cluster control Wiper control Winker control Car audio Light control Column switch Automobile phone Engine Sensor Door Side mirror Door lock Power window Door switch : CAN bus: 500kbps : CAN bus: 125kbps : LIN bus: 19.2kbps/9.6kbps : CAN unit / LIN master units : CAN unit / LIN master units : LIN slave unit Seat Motor control Passenger detection Switch control 图 2. CAN 的应用示例 RCJ05B0027-0100/Rev.1.00 2006.02 Page 3 of 48
3.2 总线拓扑图 CAN 控制器根据两根线上的电位差来判断总线电平。总线电平分为显性电平和隐性电平,二者必居其一。发 送方通过使总线电平发生变化,将消息发送给接收方。 图 3 是 CAN 的连接示意图 应用手册 CPU CAN Controller 收发器 CAN H CAN L RxD TxD 收发器 RxD RxD TxD TxD CAN H CAN L DDM … PDM CAN 125kbps 图 3. CAN 连接图 CAN 500kbps ABS SAS ETM ECM … RCJ05B0027-0100/Rev.1.00 2006.02 Page 4 of 48
应用手册 4. CAN 的特点 CAN 协议具有以下特点。 (1) 多主控制 在总线空闲时,所有的单元都可开始发送消息(多主控制)。 最先访问总线的单元可获得发送权(CSMA/CA 方式*1)。 多个单元同时开始发送时,发送高优先级 ID 消息的单元可获得发送权。 (2) 消息的发送 在 CAN 协议中,所有的消息都以固定的格式发送。总线空闲时,所有与总线相连的单元都可以开始发送新 消息。两个以上的单元同时开始发送消息时,根据标识符(Identifier 以下称为 ID)决定优先级。ID 并不 是表示发送的目的地址,而是表示访问总线的消息的优先级。两个以上的单元同时开始发送消息时,对各消 息 ID 的每个位进行逐个仲裁比较。仲裁获胜(被判定为优先级最高)的单元可继续发送消息,仲裁失利的 单元则立刻停止发送而进行接收工作。 (3) 系统的柔软性 与总线相连的单元没有类似于“地址”的信息。因此在总线上增加单元时,连接在总线上的其它单元的软硬 件及应用层都不需要改变。 (4) 通信速度 根据整个网络的规模,可设定适合的通信速度。 在同一网络中,所有单元必须设定成统一的通信速度。即使有一个单元的通信速度与其它的不一样,此单元 也会输出错误信号,妨碍整个网络的通信。不同网络间则可以有不同的通信速度。 (5) 远程数据请求 可通过发送“遥控帧” 请求其他单元发送数据。 (6) 错误检测功能·错误通知功能·错误恢复功能 所有的单元都可以检测错误(错误检测功能)。 检测出错误的单元会立即同时通知其他所有单元(错误通知功能)。 正在发送消息的单元一旦检测出错误,会强制结束当前的发送。强制结束发送的单元会不断反复地重新发送 此消息直到成功发送为止(错误恢复功能)。 (7) 故障封闭 CAN 可以判断出错误的类型是总线上暂时的数据错误(如外部噪声等)还是持续的数据错误(如单元内部 故障、驱动器故障、断线等)。由此功能,当总线上发生持续数据错误时,可将引起此故障的单元从总线上 隔离出去。 (8) 连接 CAN 总线是可同时连接多个单元的总线。可连接的单元总数理论上是没有限制的。但实际上可连接的单元 数受总线上的时间延迟及电气负载的限制。降低通信速度,可连接的单元数增加;提高通信速度,则可连接 的单元数减少。 *1 CSMA/CA: Carrier Sense Multiple Access / Collision Avoidance 【注】 RCJ05B0027-0100/Rev.1.00 2006.02 Page 5 of 48
分享到:
收藏