UDS Basic Firmware Download

The UDS basic firmware download process is the defined sequence of UDS services to download a new firmware to an UDS bootloader. It is the default sequence support both by emotas UDS bootloader and emotas CAN UpdateManager. Additionally, it is supported by the UDS PlugIn for the CDE.

The following explanation shows examples of the basic download sequence. All CAN-IDs can be configured both in the bootloader and in the tool. The pair 0x7e0 and 0x7e8 is just an example.

10h DiagnosticSessionControl

The sequence starts with a DiagnosticSessionControl request to enter the programming session.
CAN Logging of UDS Diagnostic Session Control

27h SecurityAccess

Security Access is based on a Request Seed – Send Key sequence. If the correct key has been send, access to the requested security level will be granted and the bootloader will allow the execution of additional services.
UDS CAN logging for security access

For development purposes it is sometimes useful just to use a simple key==seed algorithm. Of course, it has to be replaced by a more sophisticated algorithm later on both in the bootloader and also in the tool.
The algorithm can also be integrated into a specific .dll/.so which is used by the tool to calculate the key for a given seed automatically.

31h RoutineControl

UDS CAN logging for RoutineControl: Erease Memory
RoutineControl can be used to execute various routines. In this sequence “Erase Memory” is used to erase the flash memory before writing a new firmware to it.

34h RequestDownload

The RequestDownload services allows to specify an address and an length of the firmware. Nevertheless, the UDS bootloader only supports a fixed address and rejects Download requests to other addresses.
UDS Request Download

36h TransferData

Multiple TransferData requests will be used to transfer the complete firmware.
UDS CAN logging: Transfer Data
This example transfers blocks of 256 bytes of payload (+2 bytes for the UDS protocol itself: Service-ID and block counter).

37h RequestTransferExit

This service terminates the transfer of the firmware.
UDS Logging Request Transfer Exit

31h RoutineControl

UDS CAN Logging Routine Control
This service checks if the download had been successfully.

11h ECUReset

Finally the reset command will be send to the bootloader and it resets and it will start the application, if everything went well.
UDS Logging Ecu Reset

In general the bootloader can be adopted to support different download sequences. Additionally emotas can integrate additional download sequences into the CAN UpdateManager on request.