Sitemap
Nikhilgunda

Nikhilgunda

🚗 Flashing an ECU Using UDS Over CAN

3 min readNov 29, 2025
Press enter or click to view image in full size

What Does “Flashing an ECU” Mean?

Flashing means updating or reprogramming the software stored inside an ECU (Electronic Control Unit).

This is like updating the operating system on your phone — but for a vehicle’s control unit.

Flashing allows:

  • Fixing software bugs
  • Adding new features
  • Updating calibration or parameters
  • Meeting new emission or safety standards

The process is done without opening the ECU — through the vehicle’s CAN communication line.

What Is UDS Over CAN?

UDS (Unified Diagnostic Services) = The language used to talk to the ECU.
CAN (Controller Area Network) = The communication wire that carries those messages.

Together → “UDS over CAN” = Using standard diagnostic commands over CAN to communicate, diagnose, and flash ECUs.

Layers Involved in Flashing:

Why ECUs Have a Bootloader?

Every ECU has a small built-in program called a bootloader.
It starts first whenever the ECU powers up.
The bootloader can:

  • Communicate with external tools over CAN
  • Erase and rewrite flash memory safely
  • Verify checksum to ensure software integrity
  • Start the main application after flashing

Without a bootloader, the ECU cannot be updated externally.

Step-by-Step Flashing Sequence (UDS over CAN):

Below is the standard sequence used by most OEM bootloaders (with example hex frames).

Step 1: Diagnostic Session Control (0x10)

Switch ECU into programming mode.

Press enter or click to view image in full size

Step 2: Security Access (0x27)

Unlock programming access using a Seed-Key algorithm.

Press enter or click to view image in full size

Step 3: Request Download (0x34)

Get Nikhilgunda’s stories in your inbox

Join Medium for free to get updates from this writer.

Inform ECU of upcoming data (address + size + format).

Press enter or click to view image in full size

Step 4: Transfer Data (0x36)

Send the actual firmware data block by block.

Press enter or click to view image in full size

Step 5: Request Transfer Exit (0x37)

Tell ECU that all data has been transferred.

Step 6: Routine Control (0x31)

Ask ECU to verify data integrity (checksum or CRC check).

Press enter or click to view image in full size

Step 7: ECU Reset (0x11)

Reboot ECU to start new application.

🔒 Security: Seed-Key Unlock:

To prevent unauthorized flashing:

  • ECU sends a Seed (random number)
  • Tester calculates a Key using a hidden algorithm
  • ECU checks it — only a correct key allows flashing

Each OEM defines its own secret algorithm.

Transport Layer (ISO 15765–2) Example:

Because of CAN frame = max 8 bytes, long UDS messages are split into multiple CAN frames.

Example for a long message (e.g., Request Download):

Press enter or click to view image in full size

Common Error Responses (Negative Response Codes):

🏁 Final Takeaway

Flashing an ECU using UDS over CAN is one of the core skills in automotive electronics.
It’s:

✔ Standardized (ISO 14229 + ISO 15765–2)
✔ Safe (secure access + checksum)
✔ Universal (works across ECUs)
✔ Critical for embedded, diagnostics, and validation teams

As vehicles become more software-driven, mastering this flashing flow becomes essential for every automotive engineer.

--

--