CCP:CAN Calibration Protocol是基于CAN总线应用层协议。

  在学习CCP之前,先了解一下CAN总线。

1 CAN是什么?

  CAN 是Controller Area Network****(控制器局域网) 的缩写(以下称为CAN),是ISO*1 国际标准化的串行通信协议。
  CAN总线的作用就是将整车中各种不同的控制器连接起来,实现信息的可靠共享,并减少整车线束数量。

1.1 CAN总线的工作原理

  CAN总线的通信是通过一种类似于“会议”的机制实现的,每一个会议参加人员都可以自由的提出会议议题(多主通信模式)。

1.2 CAN收发器

按照BOSCH CAN总线标准将0或1逻辑信号转换为标准中规定的电平,同时有反馈功能。
CAN2.0A/B标准规定:总线空闲时,CAN_H和CAN_L上的电压为2.5V
在数据传输时,
 显性电平(逻辑0):CAN_H 3.5V CAN_L 1.5V
 隐性电平(逻辑1):CAN_H 2.5V CAN_L 2.5V

1.3何为CAN控制器?

CAN控制器主要实现了两部分的功能
  • 数据链路层的全部功能;
  • 物理层的位定时功能

1.4 帧的种类

 通信是通过以下5种类型的帧进行的。
   数据帧、遥控帧、错误帧、过载帧、帧间隔。
 另外,数据帧和遥控帧有标准格式和扩展格式两种格式。标准格式有11 个位的标识符(Identifier: 以下称ID),扩展格式有29 个位的ID。

帧用途
数据帧 用于发送单元向接收单元传送数据的帧。
遥控帧 用于接收单元向具有相同ID的发送单元请求数据的帧。
错误帧 用于当检测出错误时向其它单元通知错误的帧。
过载帧 用于接收单元通知其尚未做好接收准备的帧。
帧间隔 用于将数据帧及遥控帧与前面的帧分离开来的帧。

2 CCP协议

2.1 基本概念

  • ECU

    Electronic Control Unit(电子控制单元):一种具有中央处理单元的电子装置,其外围电路可执行编程功能。

  • CRM

    Command Return Message(命令返回消息) : 从从设备发送到主设备的一种消息,包含命令/错误代码和命令计数器。

  • CRO

    Command Receive Object(命令接收对象) :从主设备发送到从设备的消息。

  • DTO

    Data Thansmission Object (数据传输对象):从设备发送到主设备的消息(命令返回消息或事件消息或数据采集消息)。

  • DAQ

    Data Acquisition:从从设备向主设备发送的用于从ECU快速数据采集的过程和消息的定义。

  • ODT

    Obiect Descriptor Table: 元素(变量)列表,用于组织数据采集。

2.2 CCP的应用范围和领域

  • 任何基于CAN的分布式电控系统ECU开发
  • 对ECU进行功能和环境测试的系统
  • 被控设备的测试系统和测试台架(发动机、变速箱、悬挂系统、空调控制系统、车身控制系统、刹车防抱死系统)
  • 预研车系的测试和测量系统

2.3 报文对象描述

DTO:Data Transmit Object ——从Slave到Master 根据PID(Packet ID)的不同,DTO可分为:
?

  • PID=255:Command Return Message(CRM-DTO )

主要是从设备反馈给主设备的响应 ?

  • PID=254:Event Message

当从设备检测到内部发生错误机制时,由从设备自行向主设备发送, 报告其当前的运行状态,并请求主设备暂停当前工作进程以处理发生 的错误。 ?

  • 0≤PID ≤253:Data Acquisition Message(DAQ-DTO)

用在DAQ模式中,由从设备组织,周期性向主设备发送。

2.4 11个基本命令

Command Code TimeOut to ACK[ms] Remark
CONNECT 0x01 25
GET_CCP_VERSION 0x1B 25
EXCHANG_ID 0x17 25
SET_MTA 0x02 25
DNLOAD 0x03 25
UPLOAD 0x04 25
GET_DAQ_SIZE 0x14 25
SET_DAQ_PTR 0x15 25
WRITE_DAQ 0x16 25
START_STOP 0x06 25
DISCONNECT 0x07 25

2.5 17个可选命令

Command Code TimeOut to ACK[ms] Remark
GET_SEED 0X12 25
UNLOCK 0X13 25
DNLOAD_6 0X23 25
SHORT_UP 0X0F 25
SELECT_CAL_PAGE 0X11 25
GET_ACTIVE_CAL_PAGE 0X09 25
SET_S_STATUS 0X0C 25
GET_S_STATUS 0X0D 25
BUILD_CHKSUM 0X0E 30000
CLEAR_MEMORY 0X10 30000
PROGRAM 0X18 100
PROGRAM_6 0X22 100
MOVE 0X19 30000
TEST 0X05 25
DIAG_SERVICE 0X20 500
ACTION_SERVICE 0X21 5000
START_STOP_ALL 0X08 25

2.6 命令返回码和错误类别


2.7 基本命令描述

2.7.1 CONNECT——建立连接(0x01)
CRO:

Position Type Description
0 byte Command Code = CONNECT 0x01
1 byte Command Counter = CTR
2 word station address (Intel format)
4…7 byte don’t care

DTO:

Position Type Description
0 byte Packet ID: 0xFF
1 byte Command Return Code
2 byte Command Counter = CTR
3…7 bytes don’t care

2.7.2 GET_CCP_VERSION ——获得CCP版本(0X1B)

CRO:

Position Type Description
0 Byte Command Code = GET_CCP_VERSION 0x1B
1 Byte Command Counter = CTR
2 Byte Main Protocol version (desired)
3 Byte Release within version (desired)
4 …7 Bytes don’t care

DTO:

Position Type Description
0 Byte Packet ID: 0xFF
1 Byte Command Return Code
2 Byte Command Counter = CTR
3 Byte Main Protocol version as implemented
4 Byte Release within version as implemented
5 … 7 Bytes don’t care

2.7.3 EXCHANGE_ID—加粗样式—交换ID(0x17)
CRO:

Position Type Description
0 byte Command Code = EXCHANGE_ID 0x17
1 byte Command Counter = CTR
2… bytes CCP master device ID information (optional and implementation specific)

DTO:

Position Type Description
0 byte Packet ID: 0xFF
1 byte Command Return Code
2 byte Command Counter = CTR
3 byte length of slave device ID in bytes
4 byte data type qualifier of slave device ID (optional and implementation specific)
5 byte Resource Availability Mask
6 byte Resource Protection Mask
7 byte Don’t care

2.7. 4. SET_MTA——设置内存传输地址(0X02)
CRO:

Position Type Description
0 byte Command
1 byte Command
2 byte Memory transfer address MTA number (0,1)
3 byte Address extension
4…7 unsigned long Address

DTO:

Position Type Description
0 byte Packet ID: 0xFF
1 byte Command Return Code
2 byte Command Counter = CTR
3…7 bytes don’t care

2.7. 5. DNLOAD——数据下载(0x03)
CRO:

Position Type Description
0 byte Command Code = DNLOAD 0x03
1 byte Command Counter = CTR
2 byte size of data block to follow in bytes
3…7 bytes data to be transferred (up to 5 bytes)

DTO:

Position Type Description
0 byte Packet ID: 0xFF
1 byte Command Return Code
2 byte Command Counter = CTR
3 byte MTA0 extension (after post-increment)
4…7 unsigned long MTA0 address (after post-increment)

2.7.6. UPLOAD——数据上载(0x04)
CRO:

Position Type Description
0 byte Command Code = UPLOAD 0x04
1 byte Command Counter = CTR
2 byte Size of data block to be uploaded in bytes
3…7 bytes don’t care

DTO:

Position Type Description
0 byte Packet ID: 0xFF
1 byte Command Return Code
2 byte Command Counter = CTR
3 … 7 bytes requested data bytes

2.7. 7. GET_DAQ_SIZE ——获得DAQlist大小(0X14)
CRO:

Position Type Description
0 byte Command Code = GET_DAQ_SIZE 0x14
1 byte Command Counter = CTR
2 byte DAQ list number (0,1,…)
3 byte don’t care
4…7 unsigned long CAN Identifier of DTO dedicated to list number

DTO:

Position Type Description
0 byte Packet ID: 0xFF
1 byte Command Return Code
2 byte Command Counter = CTR
3 byte DAQ list size (= number of ODTs in this list)
4 byte First PID of DAQ list
5 … 7 bytes don’t care

2.7.8. SET_DAQ_PTR ——设置DAQlist指针(0X15)
CRO:

Position Type Description
0 byte Command Code = SET_DAQ_PTR 0x15
1 byte Command Counter = CTR
2 byte DAQ list number (0,1,…)
3 byte Object Descriptor Table ODT number (0,1,…)
4 byte Element number within ODT (0,1,…)
5…7 bytes don’t care

DTO:

Position Type Description
0 byte Packet ID: 0xFF
1 byte Command Return Code
2 byte Command Counter = CTR
3 … 7 bytes don’t care

2.7. 9. WRITE_DAQ ——写DAQlist入口(0X16)
CRO:

Position Type Description
0 byte Command Code = WRITE_DAQ 0x16
1 byte Command Counter = CTR
2 byte Size of DAQ element in bytes { 1, 2, 4 }
3 byte Address extension of DAQ element
4…7 unsigned long Address of DAQ element

DTO:

Position Type Description
0 byte Packet ID: 0xFF
1 byte Command Return Code
2 byte Command Counter = CTR
3 … 7 bytes don’t care

2.7.10 DISCONNECT ——断开连接(0X07)
CRO:

Position Type Description
0 byte Command Code = DISCONNECT 0x07
1 byte Command Counter = CTR
2 byte 0x00 temporary, 0x01 end of session
3 byte don’t care
4,5 word Station address (Intel format)
6…7 bytes don’t care

DTO:

Position Type Description
0 byte Packet ID: 0xFF
1 byte Command Return Code
2 byte Command Counter = CTR
3 … 7 bytes don’t care

2.7.11. STOP_START ——开始/停止数据传输(0X06)
CRO:

Position Type Description
0 byte Command Code = START_STOP 0x06
1 byte Command Counter = CTR
2 byte Mode : start / stop / prepare data tranmission
3 byte DAQ list number
4 byte Last ODT number
5 byte Event Channel No.
6, 7 word Transmission rate prescaler

DTO:

Position Type Description
0 byte Packet ID: 0xFF
1 byte Command Return Code
2 byte Command Counter = CTR
3 … 7 bytes don’t care

2.8 可选命令描述

2.8.1. GET_SEED——获取被请求资源的种子(0x12)
CRO:

Position Type Description
0 byte Command Code = GET_SEED 0x12
1 byte Command Counter = CTR
2 byte Requested slave resource or function (Resource Mask)
3…7 bytes don’t care

DTO:

Position Type Description
0 byte Packet ID: 0xFF
1 byte Command Return Code
2 byte Command Counter = CTR
3 byte Protection status (TRUE or FALSE)
4…7 bytes ‘seed’ data

2.8.2. UNLOCK——解锁保护(0x13)
CRO:

Position Type Description
0 byte Command Code = UNLOCK 0x13
1 byte Command Counter = CTR
2… bytes ‘key’

DTO:

Position Type Description
0 byte Packet ID: 0xFF
1 byte Command Return Code
2 byte Command Counter = CTR
3 byte Current Privilege Status (Resource Mask)
4…7 bytes don’t care

2.8.3 DNLOAD_6 ——数据下载6个字节(0X23)
CRO:

Position Type Description
0 byte Command Code = DNLOAD_6 0x23
1 byte Command Counter = CTR
2…7 bytes 6 bytes of data to be transferred

DTO:

Position Type Description
0 byte Packet ID: 0xFF
1 byte Command Return Code
2 byte Command Counter = CTR
3 byte MTA0 extension (after post-increment)
4…7 unsigned long MTA0 address (after post-increment)

2.8.4 SHORT_UP ——上传数据最多为5个字节(0X0F)
CRO:

Position Type Description
0 Byte Command Code = SHORT_UP 0x0F
1 Byte Command Counter = CTR
2 Byte Size of data block to be uploaded in bytes (1…5)
3 Byte Address extension
4 unsigned long Address

DTO:

Position Type Description
0 Byte Packet ID: 0xFF
1 Byte Command Return Code
2 Byte Command Counter = CTR
3 … 7 bytes requested data bytes

2.8.5 SET_S_STATUS ——设置Session状态(0X0C)
CRO:

Position Type Description
0 Byte Command Code = SET_S_STATUS 0x0C
1 Byte Command Counter = CTR
2 Byte Session status bits (see table below)
3…7 Byte don’t care

DTO:

Position Type Description
0 Byte Packet ID: 0xFF
1 Byte Command Return Code
2 Byte Command Counter = CTR
3 … 7 bytes don’t care

2.8.6 GET_S_STATUS ——获得Session状态(0X0D)
CRO:

Position Type Description
0 Byte Command Code = GET_S_STATUS 0x0D
1 Byte Command Counter = CTR
2…7 bytes don’t care

DTO:

Position Type Description
0 Byte Packet ID = 0xFF
1 Byte Command Return Code
2 Byte Command Counter = CTR
3 Byte Session status
4 Byte additional status information qualifier
5 bytes additional status information (optional)

2.8.7 BUILD_CHESUM ——计算校验和(0X0E)
CRO:

Position Type Description
0 Byte Command Code = BUILD_CHKSUM 0x0E
1 Byte Command Counter = CTR
2…5 unsigned long block size in bytes
6, 7 bytes don’t care

DTO:

Position Type Description
0 Byte Packet ID: 0xFF
1 Byte Command Return Code
2 Byte Command Counter = CTR
3 Byte size of checksum data
4 … 7 bytes checksum data (implementation specific)

2.8.8 CLEAR_MEMORY ——清除某内存范围(0X10)
CRO:

Position Type Description
0 Byte Command Code = CLEAR_MEMORY 0x10
1 Byte Command Counter = CTR
2…5 long Memory size
3…7 bytes don’t care

DTO:

Position Type Description
0 Byte Packet ID: 0xFF
1 Byte Command Return Code
2 Byte Command Counter = CTR
3 … 7 bytes don’t care

2.8.9 PROGRAM ——下载最多5个编程字节(0X18)

CRO:

Position Type Description
0 Byte Command Code = PROGRAM 0x18
1 Byte Command Counter = CTR
2 Byte Size of data block to follow (bytes)
3…7 bytes Data to be programmed (max. 5 bytes)

DTO:

Position Type Description
0 Byte Packet ID: 0xFF
1 Byte Command Return Code
2 Byte Command Counter = CTR
3 Byte MTA0 extension (after post-increment)
4 unsigned long MTA0 address (after post-increment)

2.8.10 PROGRAM_6 ——下载6个编程字节(0X22)
CRO:

Position Type Description
0 Byte Command Code = PROGRAM_6 0x22
1 Byte Command Counter = CTR
2…7 bytes Data to be programmed (6 bytes)

DTO:

Position Type Description
0 Byte Packet ID: 0xFF
1 Byte Command Return Code
2 Byte Command Counter = CTR
3 Byte MTA0 extension (after post-increment)
4 unsigned long MTA0 address (after post-increment)

2.8.11 MOVE ——移动某内存块(0X19)
CRO:

Position Type Description
0 Byte Command Code = MOVE 0x19
1 Byte Command Counter = CTR
2…5 long Size (number of bytes) of data block to be moved
6,7 bytes don’t care

DTO:

Position Type Description
0 Byte Packet ID: 0xFF
1 Byte Command Return Code
2 Byte Command Counter = CTR
3 … 7 bytes don’t care

2.8.12 DIAG_SERVICE ——诊断服务(0X20)
CRO:

Position Type Description
0 Byte Command Code = DIAG_SERVICE 0x20
1 Byte Command Counter = CTR
2,3 word Diagnostic service number
4…7 bytes Parameters, if applicable

DTO:

Position Type Description
0 Byte Packet ID = 0xFF
1 Byte Command Return Code
2 Byte Command Counter = CTR
3 Byte length of return information in bytes
4 Byte data type qualifier of return information (to bedefined)
5…7 bytes don’t care

2.8.13 ACTION_SERVICE ——行为服务(0X21)
CRO:

Position Type Description
0 Byte Command Code = ACTION_SERVICE 0x21
1 Byte Command Counter = CTR
2,3 word Action service number
4…7 bytes Parameters, if applicable

DTO:

Position Type Description
0 Byte Packet ID = 0xFF
1 Byte Command Return Code
2 Byte Command Counter = CTR
3 Byte length of return information in bytes
4 Byte data type qualifier of return information (to bedefined)
5…7 bytes don’t care

2.8.14 TEST ——测试可用性(0X05)
CRO:

Position Type Description
0 Byte Command Code = TEST 0x05
1 Byte Command Counter = CTR
2,3 little-endian word station address (Intel format)
4… bytes don’t care

DTO:

Position Type Description
0 Byte Packet ID: 0xFF
1 Byte Command Return Code = ACK 0x00
2 Byte Command Counter = CTR
3 …7 bytes don’t care

2.8.15 START_STOP_ALL ——开始/停止同步数据传输(0X08)
CRO:

Position Type Description
0 Byte Command Code = START_STOP 0x08
1 Byte Command Counter = CTR
2 Byte 0x00 stops, 0x01 starts data transmission
3 … 7 bytes don´t care

DTO:

Position Type Description
0 Byte Packet ID: 0xFF
1 Byte Command Return Code
2 Byte Command Counter = CTR
3 … 7 bytes don’t care

2.8.16 SELECT_CAL_PAGE ——选择标定数据页(0X11)
CRO:

Position Type Description
0 byte Command Code = SELECT_CAL_PAGE 0x11
1 byte Command Counter = CTR
2…7 bytes don’t care

DTO:

Position Type Description
0 byte Packet ID: 0xFF
1 byte Command Return Code = ACKNOWLEDGE 0x00
2 byte Command Counter = CTR
3 … 7 bytes don’t care

2.8.17 GET_ACTIVE_CAL_PAGE —获得当前激活的标定页(0X09)
CRO:

Position Type Description
0 Byte Command Code = GET_ACTIVE_CAL_PAGE 0x09
1 Byte Command Counter = CTR
2…7 Bytes don’t care

DTO:

Position Type Description
0 Byte Packet ID: 0xFF
1 Byte Command Return Code
2 Byte Command Counter = CTR
3 Byte Address extension
4 … 7 unsigned long Address

CCP协议学习《一》相关推荐

  1. CCP协议学习-命令解析

    参考文档<ASAM-CCP-V2.1.0> 12指令描述 在本章中,将解释所有带有参数的命令和预期的返回信息,包括每个命令的示例. 12.1 连接 指令标签CONNECT CRO中的数据结 ...

  2. 物联网基础之了解CCP协议,COAP协议,MTQQ协议等

    首先介绍下背景.最近开始研究物联网的套件.公司选中了阿里物联网套件,所以博主就开始投入到漫长的开发文档中.由于博主并非嵌入式开发者,所以一些名字没有听过,这对文档的阅读造成了不少的困扰,所以在此记录一 ...

  3. 标定协议之CCP协议基础知识介绍

    上一篇<标定协议基础知识介绍>中对标定协议进行了初步的介绍,从这一篇文章开始对CCP标定协议进行相关介绍,本篇将对CCP标定协议相关指令进行介绍. CCP通讯报文定义 CCP标定协议标准中 ...

  4. 标定协议之CCP协议实现流程介绍

    之前两篇文章对CCP标定协议作了初步的介绍,大家也应该有了一定的了解,本文将对CCP标定协议的实现进行介绍,让大家能够进一步理解CCP标定协议.目前CCP协议最新版本是V2.1,在Vector的官网上 ...

  5. 苹果ANCS协议学习【转】

    苹果ANCS协议学习 转自:http://www.cnblogs.com/alexcai/p/4321514.html 综述 苹果通知中心(Apple Notification Center Serv ...

  6. Servlet和HTTP请求协议-学习笔记02【Servlet_体系结构与urlpartten配置、HTTP请求协议】

    Java后端 学习路线 笔记汇总表[黑马程序员] Servlet和HTTP请求协议-学习笔记01[Servlet_快速入门-生命周期方法.Servlet_3.0注解配置.IDEA与tomcat相关配置 ...

  7. Servlet和HTTP请求协议-学习笔记01【Servlet_快速入门-生命周期方法、Servlet_3.0注解配置、IDEA与tomcat相关配置】

    Java后端 学习路线 笔记汇总表[黑马程序员] Servlet和HTTP请求协议-学习笔记01[Servlet_快速入门-生命周期方法.Servlet_3.0注解配置.IDEA与tomcat相关配置 ...

  8. RTMP协议学习笔记

    2019独角兽企业重金招聘Python工程师标准>>> RTMP协议学习总结 转载于:https://my.oschina.net/u/2374678/blog/746464

  9. 智能会议系统(9)---流媒体协议学习

    流媒体协议学习 一.协议篇 1. rtsp协议详解(http://www.mikewootc.com/wiki/net/protocol/rtsp.html) 2. rtp与rtcp协议详解(http ...

最新文章

  1. windows如何调用Linux的API,Windows和Native API中的系统调用?
  2. mongodump 备份还原
  3. POJ 2106-Boolean Expressions,双栈运用类似表达式求值!
  4. LeetCode Sumary - Graph
  5. 为什么redis适合操作小数据,memcache适合操作大数据
  6. 如何找到好书?有什么技巧或建议?
  7. 盘点微信的前世今生,微信成功的必然和偶然
  8. mc:Ignorable=d什么意思?
  9. 19年12月六级翻译词汇
  10. Python利用xpath和正则re爬取新浪新闻
  11. Ureport2的表格更改小技巧
  12. Python还原微信好友已撤回的微信消息
  13. Android Studio BMI计算器设计(三种计算标准)
  14. mysql导出excel 科学计数法_mysql导出长数字到excel避免显示为科学记数法 解决方法...
  15. SPI接口的MISO和MOSI连接时注意
  16. C++关于string类的模拟实现
  17. 关于Python的静态变量
  18. 最强docker部署模板
  19. 滤波电路各种形式的分析
  20. c pdf转换html,c HTML文件转pdf文件怎么打开

热门文章

  1. 安卓基础-安卓底层针对不同APP做不同处理
  2. 如何把电脑变成蓝牙音箱?
  3. 张利华:夺命的中国IT互联网行业
  4. html创建字母头像,JavaScript动态生成文字头像
  5. python 逻辑回归,预测银行客户是否购买定期存款
  6. java文件上传最优方案_大规格文件的上传优化
  7. MFC滑块对单击消息的响应(MP3剪切器V1.1)
  8. app逆向(8)| frida和frida-rpc
  9. Sentinel不显示实时监控数据
  10. android on off控件,Turn off/on android screen