结构如下:
KWP on CAN Identifier
Parameter | Value [n] | Description |
---|---|---|
Transmit ID | 0x18DAFA00 | ECU ->tester |
Receive ID | 0x18DA00FA | Tester -> ECU |
KWP 2000 on CAN协议基于握手报文。对于来自测试人员的每个请求,ECU必须在新请求之前生成一个积极或消极的响应。
Single Frame:如果要传输的数据数量小于7(标准添加)/ 6(扩展添加)数据字节,则使用单帧报文。第一个(标准寻址)/第二个(扩展寻址)字节是PCI字节。PCI字节的上4位包含0x0的代码,而低四位表示:包括SID在内的参数的数量。
Bytes of the Single Frame message
Bytes | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
---|---|---|---|---|---|---|---|---|
Normal addressing | 0x0 len | SID | par | par | par | par | par | par |
Extended addressing | ext. addr. | 0x0 len | SID | par | par | par | par | par |
第一帧的布局与单帧的布局相似。一个区别是额外的长度(len)字节已经添加(12位len允许最多传输4095字节的数据)。第一帧的代码是0x1。
在PCI字节的下4字节中存储了一个计数器(ctr)。计数器的初始值是0x01。它对每个连续的帧递增。当到达0x0F的值时,计数器被重新设置为0x00。
如果接收到类型为0x01的流控制,即发送(CTS)消息,发送方可以继续传输。如果类型是0x01(流控制等待),发送方必须重新启动超时计时器。通过流控制等待消息,接收端可以延迟数据字节的进一步传输。参数BSmax定义了在发送方等待接收方生成的流控制消息之前,允许发送方发送的连续帧数。STmin定义了分离时间,即两个连续帧之间的最小持续时间。发送方必须确保此分离时间不属于STmin。
驱动模式是控制单元接受汽车相关控制任务的正常运行状态。
KWP services for flash programming in driving mode
Service name | Service ID | Usage |
---|---|---|
securityAccess | 0x27 | Security level for flash programming |
startDiagnosticSession | 0x10 | Start flash programming mode |
readECUIdentification | 0x1A | Read ECU identification |
编程模式是实际的flash编程模式,支持flash编程所需的所有KWP服务
KWP services in the programming mode
Service name | Service ID | Usage |
---|---|---|
startCommunication | 0x81 | Start of KWP communication |
stopCommunication | 0x82 | Stop of KWP communication |
startDiagnosticSession | 0x10 | Start flash programming mode |
securityAccess | 0x27 | Security access #1 and #2 |
accessTimingParameter | 0x83 | Get and set the timing |
testerPresent | 0x3E | Keep communication alive |
writeDataByLocalIdentifier | 0x3B | Writing entry in historical zone |
readECUIdentification | 0x1A | Bootblock version, identifier block |
startRoutineByLocalIdentifier | 0x31 | Start erasing flash |
startRoutineByLocalIdentifier | 0x31 | Start checksum verification of flash |
stopRoutineByLocalIdentifier | 0x32 | Stop checksum or erase routine |
requestDownload | 0x34 | Request for download of code and data |
transferData | 0x36 | Send to ECU code and data |
requestTransferExit | 0x37 | End of data transfer for programming |
这种模式是一种临时的运行状态,软件在RAM中运行,因为flash刚刚被删除,因此无法访问flash。当删除完成时,软件会自动跳到引导块模式。
KWP services in the “RAM” mode
Service name | Service ID | Usage |
---|---|---|
StartRoutineByLocalId | 0x31 | Start erase flash |
TesterPresent | 0x3E | Keep communication alive |