I am working on a project using the STM32L442 32 pin version.

I am using all pins, pins for external oscillator as GPIO input and pins for STLINK programming as GPIO output.

I am planning to program the MCU by setting BOOT0 pin to 3.3V in programming phase and using UART.

Will i have any problem not using external oscillator and programming the board with the internal bootloader? I could use the larger version of the MCU but I would like to keep it smallest possible.

  • 2
    \$\begingroup\$ Why use UART and not SWD though? UART is horribly slow and also error-prone - it might make sense for flashing MCUs out on the field, in production not so much. (Those who have waded through the floods of crap interfaces that we had before standardized single wire debuggers wouldn't dream of using anything else - the era of crappy, broken programming interfaces ended somewhere around 2005.) \$\endgroup\$
    – Lundin
    Sep 21, 2020 at 9:46
  • \$\begingroup\$ @Lundin I just checked the pin for SWD programming and it's the same amount of uart, SWDIO, SWCLK, GND and VDD. I thought that using SWD i needed also RST pin so 5 pins instead of 4 using UART. SWD then is the solution, do I miss something? \$\endgroup\$
    – Raul Rosa
    Sep 21, 2020 at 10:33
  • \$\begingroup\$ The amount of pins shouldn't matter. What matters is that you can buy a pre-made production programmer "flasher" from a professional vendor, instead of some icky, home-brewed UART boatloader. Keep in mind that UART is 1960s technology and therefore you won't find many computers with "serial ports" nowadays. So you end up using some USB-to-RS232 converter with any number of problems of it's own. Just don't. \$\endgroup\$
    – Lundin
    Sep 21, 2020 at 10:39
  • 1
    \$\begingroup\$ RST is not needed. SWDIO, SWCLK, GND and VDD are sufficient. \$\endgroup\$
    – Codo
    Sep 21, 2020 at 12:49
  • \$\begingroup\$ @Codo that depends on the state of what is in the chip; reset can be needed. But reset shouldn't be a challenge for the asker. \$\endgroup\$ Sep 21, 2020 at 14:26

1 Answer 1


The internal bootloader does not use an external crystal for UART programming anyway, so whether the MCU has a crystal connected or not will be irrelevant.

So yes, the programming over UART with the internal bootloader will work just as reliably without an external crystal.

  • \$\begingroup\$ "Just as reliably" meaning what? Some +/- 1% baudrate inaccuracy or far worse? Internal RC oscillators aren't typically very accurate at all. \$\endgroup\$
    – Lundin
    Sep 21, 2020 at 10:42
  • \$\begingroup\$ The baud rate is not fixed so it does not matter what the internal RC oscillator absolute frequency is, but it does have 1% tolerance. The first byte sent from PC has a special pattern that is used to autodetect the baud rate, or rather, measure it, and that measurement result is used for subsequent communication. Any arbitrary baud rate can be used, as long as it is within the specified min and max range (might vary between different STM32 models). \$\endgroup\$
    – Justme
    Sep 21, 2020 at 11:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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