2022-03-21 01:05 AM
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.
Solved! Go to Solution.
2023-11-30 02:27 AM
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.
2022-03-21 02:53 AM
I made some tests using a NUCLEO-G071RB board. If I set the BOOT_LOCK = 1 and RDP = 0xBB, the MCU is locked. See the attached piucture.
What is that BOOT_LOCK used for? I cannot find in the reference manual a BOOT_LOCK bit in the Option Bytes.
Thanks
2022-03-23 04:14 AM
Hi @tabekb ,
Reference manual for STM32G071 is RM0444, you will find a description for BOOT_LOCK there:
regarding your initial question, @Houda GHABRI 's proposals in this question may help you.
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2022-03-23 04:42 AM
Thank you for the answer, but the link provided does not help me, it is a different situation. I try to be more clear.
With NUCLEO-G071RB:
I set on the NUCLEO-G071RB the BOOT_LOCK bit and I set the RDP to 0xBB. After this I can no more connect to the board! When I press the Connect button in the CubeProgrammer the message is "Error: No STM32 target found!". Everything worked well until I set BOOT_LOCK=1 and RDP=0xBB. Now I cannot clear the read protection because I cannot connect to the board. I have other boards which works, but I do not want to make the experience again...
Now my custom board:
On my custom board I use STM32G070RB, so the Reference Manual is RM0454, and for these MCUs the BOOT_LOCK bit is not implemented, but it is there in the CubeProgrammer! See the picture. So you can set the BIT_LOCK bit even for STM32G070 and doing BOOT_LOCK=1 and RDP=0xBB gives the same result as for NUCLEO-G071RB: no more connection to the board!
2022-03-23 04:48 AM
I confirm: No BOOT_LOCK for STM32G0x0 devices. I let our STM32CubeProgrammer expert @Houda GHABRI investigate the issues for both STM32G071 and STM32G070.
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2022-03-24 09:38 AM
Hi tabekb ,
I confirm according to the reference Manuel RM454 no BOOT_LOCK Option byte for G0x0 , an internal ticket is submitted internally to fix this issue.
Ticket number: 125126 (PS: This is an internal tracking number and is not accessible or usable by customers).
For the second issue it seems not related to CubeProgrammer tool but anyway I will check how we can unlock the board again ,I will come back with more updates very soon.
Houda
2022-03-29 02:37 AM
Any news about the second issue @Houda GHABRI ?
2022-03-30 01:16 AM
Hi @tabekb ,
After checking, unfortunately there is no way to unblock the MCU in this case .
Houda
2022-03-30 02:46 AM
I think this is a serious issue and it is not mentioned in the Reference Manual or in the Errata Sheet. According to the Reference Manual the only way to lock the MCU is when the RDP is set to 0xCC (Level 2 protection).
Leaving aside the fact that I have 2 blocked NUCLEO development boards because of this, what is your solution for the future?
Thank you!
2023-03-02 07:27 AM
Hello, @tabekb , can I please ask where did you get the parameters -e all -w?
I have been reading the documentation UM0892 User Manual, section 4. STM32 ST-LINK utility command line interface (CLI) and could not flash my board. It was until I used your parameters that I made it. Would you please help me by pointing out more documentation on those parameters?
Many thanks.
Consuelo.