TransferData (0x36) service
- 刷写过程,即Tester向ECU中下载数据的过程叫
download
- Teser向ECU请求返回数据,即ECU向Tester传输数据的过程叫
upload
请求格式
/*! Call out function for service 0x36 */
/**********************************************************************************************************************
* Dcm_ProcessTransferDataWrite()
*********************************************************************************************************************/
/*! \brief Transfers data during a download sequence.
* \details This call-out is used during software download processing, if TransferData is configured.
* \param[in] OpStatus Operation status
* \param[in] MemoryIdentifier Identifier of the Memory Block
* \param[in] MemoryAddress Starting address of server memory from which data is to be retrieved
* \param[in] MemorySize Number of bytes in the MemoryData
* \param[in] MemoryData Data to write (Points to the diagnostic buffer in DCM)
* \param[out] ErrorCode Negative response code in case return value is DCM_E_NOT_OK
* \return DCM_WRITE_OK Write was successful
* \return DCM_WRITE_FAILED Write was not successful
* \return DCM_WRITE_PENDING Write is not yet finished
* \return DCM_WRITE_FORCE_RCRRP Enforce RCR-RP transmission (vendor extension)
* \context TASK
* \reentrant FALSE
* \synchronous FALSE
* \config This function is only available if DCM_FBLMGR_SUPPORT_ENABLED = STD_ON.
* \pre -
*********************************************************************************************************************/
FUNC(Dcm_ReturnWriteMemoryType, DCM_CALLOUT_CODE) Dcm_ProcessTransferDataWrite(
Dcm_OpStatusType OpStatus,
uint8 MemoryIdentifier,
uint32 MemoryAddress,
uint32 MemorySize,
P2CONST(uint8, AUTOMATIC, DCM_APPL_DATA) MemoryData,
Dcm_NegativeResponseCodePtrType ErrorCode
);
blockSequenceCounter
:数据传输计数器,第一帧从1开始,到了0xFF后,再从0开始,循环往复,直到下载完毕transferRequestParameterRecord
:传输数据,正常来说就是(maxNumberOfBlockLength - 2)
maxNumberOfBlockLength
这个是34服务的正响应反馈的Block大小
举例说明:
blockSequenceCounter
这个 01,代表第一次传输,第一次传输 0xFFF个字节,
这是第二此传输。一次类推
这是201此传输,这一次传输0x25A个字节。
正响应格式:
blockSequenceCounter
: 响应的结果和请求时一样- transferRequestParameterRecord : 刷写过程是没有这个参数的,35服务请求数据时,才有这个参数
- 34和35服务,互为逆过程,36服务的请求和响应也是互逆的。
负响应格式:
- 0x24 : 不先请求34或者35服务,会响应这个NRC
- 0x71:xxxxx
- 0x72:xxxxx
- 0x73:传输Block计数器错误,比如第一帧传输时不是1,或者,不连续
- 0x92/0x93: 刷写时电压过高或者过低