Skip to main content
SSaha.1
Associate III
March 24, 2021
Solved

STLink detects MCU but fails to flash

  • March 24, 2021
  • 10 replies
  • 6298 views

Circuit (programmer given by SAMTECH part) (zoom in to see):

0693W000008xjpxQAA.pngWhen I connect STLINK V3 Mini to program the STM32L4676RG MCU, it detects the chip without errors. However, when I try to flash, STLINK generates fail.text.

Any idea what's happening?

This topic has been closed for replies.
Best answer by SSaha.1

Ok I found the problem. The reset switch I used has the switch arranged diagonally (see the picture to comprehend what I mean):

0693W000008yLdGQAU.pngBasically, the reset switch was shorted to GND all the time. I fixed it by desoldering the reset switch.

10 replies

RBharol
Associate III
March 24, 2021

Please share the entire fail messages log.

Uwe Bonnes
Chief
March 24, 2021

Stlink V3 is very picky about sleeping MCUs. It is a pity that it does not do better. Try to connect under reset

SSaha.1
SSaha.1Author
Associate III
March 24, 2021

@RBharol​ : The error in the fail.txt is as follows: The interface firmware FAILED to download the flash programming algorithms to the target MCU. This is the only error that is visible as I am uploading the bin file of the program generated by Mbed online compiler. I don't see any error on the Serial monitor.

@Uwe Bonnes​  can you elaborate on the reset part? I did try pushing the reset button during uploading but it doesn't seem to make a difference.

Uwe Bonnes
Chief
March 24, 2021

I did not notice that you flashed via the MSD way. Connect under reset needs reset controlled by the STlink. Pushing the reset button by hand is not fine-grained enough. When you use the stlink as debugger, most debug programs allow to connect under reset.

SSaha.1
SSaha.1Author
Associate III
March 24, 2021

Should I use Mbed Studio and upload the program in debug mode?

SSaha.1
SSaha.1AuthorBest answer
Associate III
March 30, 2021

Ok I found the problem. The reset switch I used has the switch arranged diagonally (see the picture to comprehend what I mean):

0693W000008yLdGQAU.pngBasically, the reset switch was shorted to GND all the time. I fixed it by desoldering the reset switch.