cancel
Showing results for 
Search instead for 
Did you mean: 

STM32_Programmer_CLI.exe question

tabekb
Associate III

I have a custom board with STM32G070RB micro. I programmed the board several times for debugging in the development phase using theST-LINK//V2 in CubeIDE.

Now I would like to generate a .bat file to program the boards, but I am facing some problems.

My command line is the following (I am using ST-LINK/V2):

STM32_Programmer_CLI.exe -c port=SWD freq=4000 mode=UR -e all -w "file.hex" -v -ob RDP=0xBB and it worked well.

In order to reprogram the board I did:

STM32_Programmer_CLI.exe -c port=SWD freq=4000 mode=UR -ob RDP=0xAA.

After this I can reprogram the board using the first command. Everything looked good at that moment, but I tried to program the board again from the CubeIDE (like I did for several times) and the programming from CubeIDE failed. I thought that I have to put the read protection to level; 0 and I tried to send the command STM32_Programmer_CLI.exe -c port=SWD freq=4000 mode=UR -ob RDP=0xAA but no more worked. It responds with "Error: No STM32 target found!" message.

I tried to connect to the board with ST LINK Utility and STM32CubeProgrammer GUI without success. My board now is locked, I cannot reprogram the board. I will replace the MCU, but the question is why the MCU cannot be programmed?

p.s.: In my code I've configured the SWD pins to Serial Wire.

14 REPLIES 14

Hello @CHand.3​ ,

Thanks for your feedback,

You can find the commands list in STM32CubeProgrammer user manual, UM2237 section 3.

Sara.

Hi @tabekb 

the following caution has been added to the corresponding reference manual (RM0444):

Caution: If BOOT_LOCK is set in association with RDP Level 1, the debug capabilities of the device are stopped and the reset value of the DBG_SWEN bit of the FLASH_ACR
register becomes zero. If DBG_SWEN bit is not set by the application code after
reset, there is no way to recover from this situation.

 

JaroslavBECKA_0-1701337490901.png

 

Best regards
Jaroslav

In addition to that, the limitation present in the silicon revision Rev B has been removed in the latest silicon revision (Rev Y).
If the option byte programming is interrupted, for example, by a reset or power outage, the BOOT_LOCK bit will be now cleared (=0), which ensures that the debug connection will remain available.
(This applies for the Rev Y. Please refer to the errata sheet ES0412 for more details.)

However, please note that when configuring the Option Bytes manually, for instance in STM32CubeProgrammer, you still need to be careful with RDP level 1 and BOOT_LOCK = 1.

 

JaroslavBECKA_1-1701338634906.png

 

Hello @CHand.3 ,

The list of available command lines can be found in STM32CubeProgarmmer user manual UM2237, section 3.

I hope this helps!

Sara.

Thank you for answering, Sarah.

Yes, I have used it: helpful!