CAN协议

介绍

1. CAN(Controller Area Network)协议, 允许微控制器和其他设备不通过主机设备相互通信. CAN协议有独有的总线广播. 可以同时给所有总线上的设备发送消息. 设备可以是传感器, 微控制器.

2. CAN协议是基于消息的协议, 消息携带有消息标识符, 基于标识符, 可以决定优先级. 

3. CAN网络不需要进行结点身份验证, 因此可以很简单的插入或移除结点.

4. CAN协议是半双工异步通信协议

5. CAN协议是两线制通信协议, 设备通过两线制总线被连接到一起.

6. CAN协议一开始主要用于在车内进行通信, 但现在可以用在很多其他的环境, 比如UDS, KWP 2000等

7. CAN协议引用了OSI模型, CAN协议实现了低两层, 应用层由设计者根据功能具体实现. 

8. 设备有一个微控制器, 用于收集设备信息, 并和网络中其他结点交换信息.

特点

1. 成本低, CAN协议总线只有两根线, 制造成本很低

2. 灵活, 可以随意加入和离开网络

3. 速度快, 高达1MBit/s

4. 可靠, CAN提供了错误检测和错误处理机制

5. 任何设备都可以访问总线

6. 消息可以单播, 多播, 广播

协议格式

Various fields in standard CAN are as follows-

{C·         SOF – Start of Frame bit. It indicates  start of message and used to synchronize the nodes on a bus. A dominant bit in the field marks the start of frame.

·         IDENTIFIER – It serves dual purpose one, to determine which node has access to the bus and second to identify the type of message.

·       RTR – Remote Transmission Request. It identifies whether it’s a data frame or a remote frame .RTR is dominant when it is a data frame and recessive when it is a remote frame.

{C}{·         IDE – Identifier Extension. It is used to specify the frame format. Dominant bit is for standard frame and recessive for extended frame.

{C}·        R0 – Reversed bit.  Not used currently and kept for future use.

{C·        DLC – Data Length Code. It is 4 bit data length code that contains the number of bytes being transmitted.

{·          DATA– Used to store up to 64 data bits of application data to be transmitted.

{C}·        CRC– Cyclic Redundancy Check. The 16-bit (15 bits plus delimiter) cyclic redundancy check (CRC) contains the checksum of the preceding application data for error detection.

{·         ACK – Acknowledge (ACK) field. It compromises of the ACK slot and the ACK delimiter. When the data is received correctly the recessive bit in ACK slot is overwritten as dominant bit by the receiver.

{C}·         EOF– End of Frame (EOF). The  7-bit field marks the end of a CAN frame (message) and disables

Bit – stuffing, indicating a stuffing error when dominant.

{C}·         IFS – Inter Frame Space that specifies minimum number of bits separating consecutive messages. It provides the intermission between two frames and consists of three recessive bits known as intermission bits. This time allows nodes for internal processing before the start of next frame.

参考

        CAN protocol: Understanding the controller area network

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值