2024-07-03 07:33 PM
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.
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?
2024-07-04 12:31 AM - edited 2024-07-04 12:33 AM
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.
2024-07-07 08:26 PM
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.
2024-07-07 09:16 PM
To program the Macronix part you'll need a suitable External Loader for the part on your board.