cancel
Showing results for 
Search instead for 
Did you mean: 

STLink detects MCU but fails to flash

SSaha.1
Associate III

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?

1 ACCEPTED SOLUTION

Accepted Solutions
SSaha.1
Associate III

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.

View solution in original post

10 REPLIES 10
RBharol
Associate III

Please share the entire fail messages log.

Uwe Bonnes
Principal III

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
Associate III

@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.

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.

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

Worth a try at least.

Ok here's what I tried:

  • Tried to load blink program from Mbed Studio in debug mode, the process fails and I get the same "The interface firmware FAILED to download the flash programming algorithms to the target MCU" error from the STLink. In addition, I get "PyOCD deploy failed, deploying using mass storage device" error when I try to reset the MCU.
  • To further explore the issue, I ran STLink Utility to do a hardware reset via chip erase in connect under reset mode. It seems to automatically detect the chip properly with correct voltage and model and all in hotplug mode. This means my circuit is more or less fine as well as the chip:

0693W000008xqSHQAY.png 

  • However, when I try to connect in "connect under reset" mode, I get the following error:

0693W000008xqPdQAI.png 

  • I don't get the same error in "hotplug" mode, however, I cant do a hardware reset as the following error is shown:

0693W000008xqTPQAY.png

In addition, when I try to forcefully upload a bin file by bypassing readout protection, I get the following error:

0693W000008xqU8QAI.png

0693W000008xqd5QAA.pngOutput of STLink CLI