Can I program or flash a microcontroller using UART? I previously thought UART is only for communication purposes.


closed as too broad by Chris Stratton, Dmitry Grigoryev, Lior Bilia, Voltage Spike, diverger Aug 24 '18 at 0:52

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    \$\begingroup\$ If there's something in the microcontroller that is able to turn communication into flash operations, then yes. Otherwise, no. The same goes for most any other communication interface. Most typically for a UART, that would be a "bootloader" either in factory ROM or already put in flash by some other method. \$\endgroup\$ – Chris Stratton Aug 14 '18 at 19:55
  • \$\begingroup\$ @Arkojit Please be more specific \$\endgroup\$ – Voltage Spike Aug 20 '18 at 21:48

A few micro's have a uart bootloader rom from the factory. mid range STM8's for example.

Others can have a bootloader programmed into flash. Arduinos come with Optiboot put into the flash by the pcb assembler (not Atmel).

To have a bootloader requires in-system self-programmability. It helps if it can execute code from ram, but this is not needed (PIC). Some micros (e.g AVR) have code protect arrangements specifically to protect a bootloader area of flash.

It might be useful for people to note micros that have a factory bootloader in the comments below as it is a useful feature manufacturers sometimes hide on page 570


Many microcontrollers can be programmed over UART, provided that the microcontroller in question has a suitable bootloader. Google "uart bootloader" and you'll see many examples.

  • \$\begingroup\$ I would say any microcontroller with UART and a bootloader supporting UART firmware uploading can be... \$\endgroup\$ – Eugene Sh. Aug 14 '18 at 21:10
  • 1
    \$\begingroup\$ The microcontroller also needs to support in-system flash programming of the executable code memory, which is tricky if the bootloader has to run from the same memory space. Often there's a way to partition the memory or erase one page while the bootloader is running in the other page. \$\endgroup\$ – MarkU Aug 14 '18 at 21:17
  • \$\begingroup\$ @MarkU Depends on what is required. It can get loaded into RAM after each boot from host/external flash. \$\endgroup\$ – Eugene Sh. Aug 14 '18 at 21:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.