Skip to main content
SSaha.1
Associate III
Mar 24, 2021 3:03 AM UTC
Solved

STLink detects MCU but fails to flash

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.
SSaha.1
SSaha.1Best answer
Associate III
Mar 30, 2021 11:47 PM UTC

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
Mar 24, 2021 5:20 AM UTC

Please share the entire fail messages log.

Uwe Bonnes
Chief
Mar 24, 2021 11:45 AM UTC

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
Mar 24, 2021 3:42 PM UTC

@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
Mar 24, 2021 4:27 PM UTC

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
Mar 24, 2021 4:29 PM UTC

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

SSaha.1
SSaha.1AuthorBest answer
Associate III
Mar 30, 2021 11:47 PM UTC

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.