Page 1 of 1

UDS RoutineControl for Erase & UDS Service for Flash

Posted: Tue 19. May 2020, 09:09
by Shail

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?


Re: UDS RoutineControl for Erase & UDS Service for Flash

Posted: Tue 19. May 2020, 11:13
by F.Vergnaud
Hello Shail,

(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);
(2) Your ECU will/should respond that it needs more time to process the request. It is a mechanims that is handled by UDS and ISO-TP communication protocols.

(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):
  1. First you need to make a request to download data to your ECU using UDS_SvcRequestDownload.
  2. 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).
  3. Finally complete the transfer with UDS_SvcRequestTransferExit.