2024-10-08 10:46 PM - last edited on 2024-10-09 04:51 AM by SofLit
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
Solved! Go to Solution.
2024-10-09 03:18 AM
The system bootloader needs this UART config otherwise it won't work.
In conclusion, you need to redesign your PCB or make a patch on your board.
2024-10-09 01:29 AM
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?
2024-10-09 02:31 AM - edited 2024-10-09 02:33 AM
Hello @SofLit
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
2024-10-09 02:39 AM - edited 2024-10-09 02:42 AM
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?:
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:
2024-10-09 02:56 AM
I'm using UART2 for flashing i.e., PA2-Tx, PA3-Rx and selected UART as interface
Connected BOOT0 to VCC and applying reset before flashing
Unable to connect with UART interface
Getting Error: Activating device: KO. Please, verify the boot mode configuration and check the serial port configuration. Reset your device then try again...
I have attached snapshot
2024-10-09 03:07 AM - edited 2024-10-09 03:08 AM
@Vaishnavi wrote:
I'm using UART2 for flashing i.e., PA2-Tx, PA3-Rx and selected UART as interface
But as I indicated in my previous comment USART2 is using PD6 and PD5 for communication not PA2 and PA3!
Please review the AN2606 / section 34 STM32F412xx devices
2024-10-09 03:16 AM
In my custom board I don't have PD6 and PD5 pins, Is there any other way to flash my hex file using UART
Or I need to redesign my board?
2024-10-09 03:18 AM
The system bootloader needs this UART config otherwise it won't work.
In conclusion, you need to redesign your PCB or make a patch on your board.
2024-10-09 03:31 AM
Thank u for your time @SofLit
Will do rework on my custom board
2024-10-09 03:37 AM
Hello @SofLit
Can I flash my hex file with stlink, I'm using PA13-SWDIO and PA14-SWCLK
But unable to flash getting error, after connecting
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
And application is closing automatically