Skip to main content UDS Flashing Flow | IoT Worker

UDS Flashing Flow

UDS Flashing Flow

In ECU flashing captures, the first services you usually notice are Request Download, Transfer Data, and Request Transfer Exit. At first glance, it seems simple: tell the ECU to get ready, send the binary in chunks, and then finish. But real engineering is never that simple. Flashing is hard not because segmented transfer is complicated by itself, but because it is a high-risk business chain: if permissions are wrong, the session is wrong, erase is wrong, the block order is wrong, verification fails, or activation fails, the ECU can be left in a state worse than “not upgraded.”

The most important judgment about UDS flashing is this: it is not a long-message transfer. It is an update flow with prerequisites, state transitions, staged commit, and failure judgment. Services like Request Download are only nodes in that flow, not the whole thing.

Why Flashing Cannot Be Simplified to “Send the File”

If you only look at the transfer of firmware content in chunks, many protocols could do that in theory. Flashing, however, has to solve several more difficult problems.

First, the ECU must confirm whether it is allowed to enter an update state. A controller running normally cannot accept a rewrite at any time. Second, the target area usually needs erase, reservation, and context switching before it can accept new data. Third, sending the data does not mean the ECU already treats the image as bootable. There is usually integrity checking, dependency checking, activation switching, and even post-reboot self-test in between. Fourth, failures must remain as diagnosable as possible. The tool needs to know whether the problem was permission, transfer interruption, block-order failure, checksum failure, or activation failure.

So the flashing flow optimizes for controlled state and recoverability, not for the fewest messages.

The Smallest Useful Mental Model for the Flow

It is more accurate to think of UDS flashing as “a controlled software-delivery process” than as “three download services.”

The flow usually contains at least six things:

  • enter a diagnostic context that allows flashing
  • obtain the needed permissions through security access
  • let the ECU prepare storage and internal state for the incoming image
  • transfer the data in stable, agreed blocks
  • explicitly finish the transfer with a closing and consistency step
  • decide when and how the new software will be activated

Once you hold those six points, the service IDs and timing make sense.

A Typical Successful Path

The best way to understand it is to follow one successful flash path.

The tool usually first switches to a programming-related session and, if needed, maintains keep-alive so the ECU does not drop back to default mode during the long process. Then it enters security access. Only once permission is granted do erase, download, and activation-related operations open up.

Next, many implementations use a routine or a preparatory service to make the ECU erase the target area, check voltage conditions, or switch to an internal state suitable for update. Only after those prep steps succeed does the tool send Request Download, telling the ECU which logical address range will be written, how much data is coming, and in what format.

After the ECU accepts that, the sender starts transmitting Transfer Data blocks one by one. These blocks are not just “send some bytes.” They are sequential transfers with block-number semantics. The receiver must know which block it is on, whether the sequence is continuous, and whether it is complete.

When all blocks are sent, the tool sends Request Transfer Exit. That does not mean “polite end of conversation.” It tells the ECU that the transfer phase is now over and it can start final receive confirmation, storage handling, and later verification.

If verification, signature checking, boot-flag switching, or reboot into the new software is still needed, the flow often combines Routine Control, ECU Reset, or vendor-specific steps.

The core idea is clear: flashing is not “pour the file in.” It is “authorization -> preparation -> transfer -> closeout -> verification -> activation” as a state chain.

What Request Download Is Really Handling

Many people think of Request Download as the “start sending data” switch, but what it really solves is the preparation problem.

The ECU first needs to know what kind of data is coming: where it will be written, how large it is, and what addressing and length format will be used. Only when that is known can the receiver prepare its buffer, storage, and internal state correctly.

The cost is direct: once this step begins, flashing is no longer stateless file upload. It is a clear transition into a download context. If this step fails in the field, the first things to check are usually not the data blocks themselves, but whether the current session, permissions, target range, and ECU conditions actually allow download.

Why Transfer Data Is More Than Just Chunking a Large File

Transfer Data does carry the job of moving data in pieces, but its key value is not “chunking.” It is “predictable, checkable continuous chunking.”

One of the most dangerous cases in flashing is when the tool thinks it has sent everything, the ECU thinks a fragment is missing, or both sides have already become misaligned about the current block number. That is why block count, sequence checking, and state retention during the transfer phase matter so much. If one block is missing, duplicated, or out of order, the fact that the total length still looks roughly right does not mean the image is valid.

The cost of this design is that captures and implementations cannot look only at the total byte count. When a download fails, you must first figure out whether the problem is link interruption, CAN TP segmentation, wrong UDS block order, or the ECU actively rejecting later blocks while writing.

Why Request Transfer Exit Cannot Be Skipped

If you think only in terms of file transfer, it is tempting to believe that once the last block is sent, the job is done. But for the ECU, transfer completion and image acceptability are not the same thing.

Request Transfer Exit solves the phase-transition problem. It cleanly separates “data is still arriving” from “all data has been delivered, and now you can do final handling.” Only then can the ECU perform tail checks, write metadata, update state flags, or trigger follow-up routines at the right time.

The cost is equally clear: the sender cannot interpret “the last block was sent successfully” as “the flash succeeded.” Many failures happen after this point, such as image integrity failure, dependency mismatch, or activation condition not being met.

What Is Actually High Risk Is Often Not the Transfer Phase

Field experience shows that many flash incidents are not caused by Transfer Data itself. They are caused by the ends of the chain.

Front-end risk usually comes from the session not being stable, security access not being complete, erase conditions not being met, voltage or environmental conditions being wrong, or the preparatory routine not actually succeeding. Back-end risk usually comes from image verification failure, wrong activation flags, boot failure after reboot, or mismatch between bootloader and application versions.

That is why flashing captures cannot only look at the three download services. What really matters is whether the whole state chain closed correctly, not whether all blocks were sent.

Where Its Boundary Lies Relative to CAN TP and the Bootloader

This is another layer-mixing problem.

CAN TP solves how a long message is segmented and delivered. UDS flashing services solve how the software-download business flow progresses. The bootloader, or a lower-level update execution environment, solves how the image is finally written, verified, and started.

Those three layers are all necessary, but their responsibilities are completely different.

If Transfer Data stops in the middle, check CAN TP and the transport layer first. If Request Download is rejected, check UDS session, permissions, and prerequisites first. If everything downloaded successfully but the device still does not boot after reset, that is more likely a bootloader, image-layout, or activation-policy problem.

Mixing those layers into one sentence like “the flash failed” makes troubleshooting extremely inefficient.

What To Watch First in Flashing Captures

The easiest way to waste time on a flash issue is to start comparing binary contents from the first data block.

A better order is usually:

  • first check whether the correct session was entered and whether security access was completed
  • then check whether erase, pre-check, or preparatory routines actually passed
  • then check whether Request Download accepted the target range and length
  • during transfer, check block order, continuity, and where the interruption happened
  • in the closeout phase, check whether anything after Request Transfer Exit failed, such as verification, a routine, or reboot

That order helps the problem land on the right layer faster. Otherwise a permission issue can look like a data-block issue, or an activation failure can be mistaken for a transfer failure.

Three Final Judgments

To understand UDS flashing, the important thing is not to memorize download service IDs first. It is to remember three points.

First, flashing is a high-risk state chain, not a simple large-file transfer. Second, Request Download, Transfer Data, and Request Transfer Exit are respectively about establishing the download context, moving continuous blocks, and closing the transfer phase; they should not be mistaken for “start sending,” “keep sending,” and “polite ending.” Third, when debugging in the field, first decide whether the issue belongs to session/permission, preparatory handling, transfer continuity, or checksum/activation, and only then decide whether to go down to CAN TP, UDS, or bootloader-level analysis.

If you use those three judgments when looking at flashing logs, update tools, and ECU responses, you will build a stable model much faster than by memorizing service IDs. Field tables can always be looked up later. If the state chain was not understood from the start, flashing problems become very hard to reason about.

Further Reading

  • UDS: first build the basic model of session, security access, negative responses, and application-layer diagnostics
  • CAN TP: how long messages are segmented, flow-controlled, and reassembled on CAN