Home / Learn Embedded C / Firmware Update over UART

Firmware Update over UART

Receiving a new firmware image through a simple serial connection.

The gistReceiving a new firmware image through a simple serial connection.

The idea, explained simply

In plain terms

A UART-based firmware update protocol receives the new firmware image byte-by-byte (or in packets) over a serial connection, writing it into the application flash region while validating it (often via CRC/checksum) before considering the update complete.

Why we use it

UART is one of the simplest, most universally available channels for firmware updates in the field — many devices expose a UART connector or pins specifically for this purpose, even if normal operation does not otherwise use serial communication.

Under the hood

A robust UART update protocol typically includes packet framing (so corrupted or dropped bytes can be detected and retried), progress acknowledgment, and a final whole-image CRC check before the bootloader considers the new application valid and bootable.

Real-world use

  • Field firmware updates
  • Simple update mechanisms
  • Reliable image transfer protocols

Try it

A tiny simulated UART update: receiving framed packets with a sequence checkC: edit and run

A real protocol would also retry a missing or corrupted packet; here the sequence check is just enough to show the idea.

Try it: retrying a packet after a detected checksum failure

Retrying a corrupted packet up to a fixed number of attemptsC: edit and run

A real UART protocol retries a specific corrupted packet rather than restarting the whole transfer, and gives up and aborts only after exhausting a bounded number of attempts.

Quick quiz

1. Why does a robust UART firmware update protocol need packet framing and a final CRC check?