Skip to main content
Graduate
August 5, 2024
Solved

How to program empty STM32f042C4U6 from UART1 instead of SWCLK-SWDIO?

  • August 5, 2024
  • 2 replies
  • 1209 views

UART_prograaming.jpg

 Is it possible to program an empty STM32F042 using UART1 instead of SWCLK-SWDIO?

I want to flash programming of STM32F042 which is zero. 

    This topic has been closed for replies.
    Best answer by TDK

    Yes

    2 replies

    Super User
    August 5, 2024

    If you hold BOOT0 high during reset, it will boot into the bootloader. You can then use UART to program it.

    STM32CubeProgrammer can do this for you if you have a USB to UART adapter and hook it up to the correct pins. See AN2606 for supported pinout.

    cd00167594-stm32-microcontroller-system-memory-boot-mode-stmicroelectronics.pdf

    UART bootloader protocol is detailed here:

    cd00264342-usart-protocol-used-in-the-stm32-bootloader-stmicroelectronics.pdf

    Graduate
    August 5, 2024

    If I do BOOT0 high (always pulled up) and connect USB to UART adapter TX-RX to STM32f042C4U6 as picture, May I program all flash with STM32CubeProgrammer?

     

    Graduate II
    August 5, 2024

    BOOT0 will need to be Low for normal operation once programmed.

    Graduate
    August 5, 2024

    Ok, so when programming from UART BOOT0 must be high, after programming we have to do low BOOT0 for normal operation, right?