cancel
Showing results for 
Search instead for 
Did you mean: 

ST-LINK error after mass erase

Spencer_Y
Associate II

Hi there,

I want to write a bat file to program STM32 MCU.

After I issue the command below to erase the full chip.

STM32_Programmer_CLI.exe -c port=SWD freq=4000 -e all

The prompt says: 'Mass erase successfully achieved', which indicates the full chip erase is successful.

 

Then I use the following command to download the bootloader:

STM32_Programmer_CLI.exe -c port=SWD freq=4000 -w E:/Programming/xxx/xxx-bootloader.elf -v

The prompt says: ST-LINK error, as the following screenshot shows.

Spencer_Y_0-1720060225224.png

Can I know what is the reason?

 

In addition, what should I do if I want to download the app image after the download the bootloader above? 

 

 

3 REPLIES 3
Kraal
Senior III

Hi,

Please specify the MCU you want to use and then which memory you want to program (internal flash, external QSPI, etc...) ?

Also is E: a network drive ? I have not tried but maybe it can be an issue as well.

Then, about the target voltage: 3.66V is really high for an STM32, is it accurate ?

Finally regarding the programming instruction: if it is for the internal flash I use the following:

STM32_Programmer_CLI.exe -c port=SWD mode=UR freq=4000 -d E:/Programming/xxx/xxx-bootloader.elf -v

In bold the difference with what you do: I ask to connect under reset (UR) and use the download directive (-d) instead of write (-w), even though I am not sure it makes a difference.

The elf file contains all the addresses to program, so providing the app image does not overlap the bootloader image you can program the app image after the bootloader image and it shall not erase the bootloader.

STM32_Programmer_CLI.exe -c port=SWD mode=UR freq=4000 -d E:/Programming/xxx/xxx-image.elf -v

Best regards.

Hi Kraal,

Thanks for you reply.

The MCU is STM32H753VIT6TR, and the memory I want to program is external NOR flash (part number: MX25L6433FM2I-08GTR). 

E: is a local drive.

 

Best regards.

 

 

To program the Macronix part you'll need a suitable External Loader for the part on your board.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..