基于CAN总线的KWP2000协议

结构如下:
              CAN Bus

KWP on CAN Identifier

ParameterValue [n]Description
Transmit ID0x18DAFA00ECU ->tester
Receive ID0x18DA00FATester -> ECU

    KWP 2000 on CAN协议基于握手报文。对于来自测试人员的每个请求,ECU必须在新请求之前生成一个积极或消极的响应。

    Single Frame:如果要传输的数据数量小于7(标准添加)/ 6(扩展添加)数据字节,则使用单帧报文。第一个(标准寻址)/第二个(扩展寻址)字节是PCI字节。PCI字节的上4位包含0x0的代码,而低四位表示:包括SID在内的参数的数量。

Bytes of the Single Frame message

Bytes12345678
Normal addressing0x0 lenSIDparparparparparpar
Extended addressingext. addr.0x0 lenSIDparparparparpar

                single message
               single transfer
                parameter
    第一帧的布局与单帧的布局相似。一个区别是额外的长度(len)字节已经添加(12位len允许最多传输4095字节的数据)。第一帧的代码是0x1。
                first frame
    在PCI字节的下4字节中存储了一个计数器(ctr)。计数器的初始值是0x01。它对每个连续的帧递增。当到达0x0F的值时,计数器被重新设置为0x00
                consecutive frame
    如果接收到类型为0x01的流控制,即发送(CTS)消息,发送方可以继续传输。如果类型是0x01(流控制等待),发送方必须重新启动超时计时器。通过流控制等待消息,接收端可以延迟数据字节的进一步传输。参数BSmax定义了在发送方等待接收方生成的流控制消息之前,允许发送方发送的连续帧数。STmin定义了分离时间,即两个连续帧之间的最小持续时间。发送方必须确保此分离时间不属于STmin。
                control frame
                software operating states
驱动模式是控制单元接受汽车相关控制任务的正常运行状态。

KWP services for flash programming in driving mode

Service nameService IDUsage
securityAccess0x27Security level for flash programming
startDiagnosticSession0x10Start flash programming mode
readECUIdentification0x1ARead ECU identification

编程模式是实际的flash编程模式,支持flash编程所需的所有KWP服务
KWP services in the programming mode

Service nameService IDUsage
startCommunication0x81Start of KWP communication
stopCommunication0x82Stop of KWP communication
startDiagnosticSession0x10Start flash programming mode
securityAccess0x27Security access #1 and #2
accessTimingParameter0x83Get and set the timing
testerPresent0x3EKeep communication alive
writeDataByLocalIdentifier0x3BWriting entry in historical zone
readECUIdentification0x1ABootblock version, identifier block
startRoutineByLocalIdentifier0x31Start erasing flash
startRoutineByLocalIdentifier0x31Start checksum verification of flash
stopRoutineByLocalIdentifier0x32Stop checksum or erase routine
requestDownload0x34Request for download of code and data
transferData0x36Send to ECU code and data
requestTransferExit0x37End of data transfer for programming

    这种模式是一种临时的运行状态,软件在RAM中运行,因为flash刚刚被删除,因此无法访问flash。当删除完成时,软件会自动跳到引导块模式。
KWP services in the “RAM” mode

Service nameService IDUsage
StartRoutineByLocalId0x31Start erase flash
TesterPresent0x3EKeep communication alive
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值