Skip to main content
Associate II
October 9, 2024
Solved

Flash hex file to stm32f412 with uart using stm32cubeprogrammer

  • October 9, 2024
  • 1 reply
  • 5463 views

Tried flashing stm32f412 custom controller using uart but facing error while going to boot mode.

I need to flash my hex file to custom stm32f412 board but unable to connect using uart and facing issue while erase memory

Best answer by mƎALLEm

The system bootloader needs this UART config otherwise it won't work.

SofLit_0-1728466660725.png

In conclusion, you need to redesign your PCB or make a patch on your board.

1 reply

mƎALLEm
Technical Moderator
October 9, 2024

Hello @Vaishnavi and welcome to the community,

Sorry your question is not clear.

Are you using the system bootloader over UART to upload your application or with ST-Link?

As per the image you shared you are using ST-LINK with STM32CubeProgrammer not the UART, could you please provide more details about the interface you are using to upload your application?


 

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question."
VaishnaviAuthor
Associate II
October 9, 2024

Hello @mƎALLEm 

I tried with both uart and stlink to flash stm32f412 using stm32cube programmer but both are not working fine

uart:  Error: Activating device: KO. Please, verify the boot mode configuration and check the serial port configuration. Reset your device then try again... 

stlink:  15:01:09 : Erasing memory corresponding to segment 0:
15:01:09 : Erasing internal memory sector 0
15:01:09 : Error: failed to erase memory
15:01:09 : Error: failed to erase memory

I have attached snapshot of it

mƎALLEm
Technical Moderator
October 9, 2024

As you are using a custom board you need to check your schematics and refer to the getting started HW: https://www.st.com/resource/en/application_note/an4488-getting-started-with-stm32f4xxxx-mcu-hardware-development-stmicroelectronics.pdf

For Boot mode using UART, you need to refer to the AN2606 "STM32 microcontroller system memory boot mode"

What UART instance you are using for the bootloader?

Are you using these Tx/Rx pins?:

SofLit_0-1728466660725.png

Are you configuring the MCU to enter to the system bootloader (BOOT pin(s)) and applying the reset before programming the MCU? Did you select UART as interface in the STM32CubeProgrammer?

For STLINK programming try to connect under Hardware reset:


 
Updating Media

 

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question."