We need to send uds request to erase flash using routing control and flash hex file.
(1) How we can send UDS request to erase flash? What changes require for testRoutineControl API?
(2) To erase the flash we require more time How we need to handle this problem? or It will take care by testRoutineControl API of PCAN UDS Client project?
(3) How we can handle sending the hex file content to ECU for programming? How to handle multiple uds data request?
(1) Please refer to your ECU specifications, it is usually a call to UDS service RoutineControl (with a start command and the standardized "EraseMemory" routineId), but the parameters (a buffer of byte) are specific to your ECU:
- UDS_SvcRoutineControl(CanHandle, msgReq, PUDS_SVC_PARAM_RC_STR, PUDS_SVC_PARAM_RC_RID_EM_, buffer, buffer_length);
(3) Sending hex file is out of the scope of the UDS API, your process should include a way to convert hex file to binary (search for tools like hex2bin for example).
Sending content to an ECU is explained in UDS protocol (please check ISO-14229):
- First you need to make a request to download data to your ECU using UDS_SvcRequestDownload.
- Then in a loop, make UDS requests to transfer data with UDS_SvcTransferData until all the data are sent (the maximum size of the chunks of data is part of the response to the UDS service RequestDownload).
- Finally complete the transfer with UDS_SvcRequestTransferExit.