2021-06-08 04:15 AM
This may be a dumb question, but how can I correctly reboot a programmed board after setting the read out protection?
Hardware: ST Link-V2
Software : STM32 ST-LINK CLI v3.5.0.0
Connect via SWD freq 4000
Please note, that I do not have access to the FW code, I only use the .bin file.
The only "solution" I found is to do 2 x power cycles to the whole board, which seems very ineffective and takes a lot of time.
How is the boot process halted and how could I set the tester to reboot the board without time consuming power cycles?
As an off topic question, how could I enable the log feature from the ST-LINK CLI?
I tried the "-Log location\file.txt" but it doesn't work.
From the STM32 ST-LINK Utility the log feature works as intended.
Best regards,
John
2021-06-08 05:57 AM
For your log issue:
From ST-Link Utility documentation:
-Log
Description: Enables Trace LOG file generation.
The log file is generated under %userprofile%\STMicroelectronics\ST-LINK utility
Maybe you try to redirect with
ST-LINK_CLI.exe [your options] > filename.txt
Or Use STM32CubeProgrammer_CLI instead, its -log option is more flexible
2021-06-10 08:02 AM
Thanks for the input and advice.
The log option is better on the STM32CubeProgrammer_CLI, however I ran into another issue while retesting programmed microcontrollers:
With ST-LINK_CLI:
start /wait ST-LINK_CLI.exe -c ID=0 UR SWD freq=4000 -P <Firmware_location\firmware_file.bin> 0x08000000 -log
Output: -> OK
Some flash sectors are write protected.
The write protection will be disabled then restored after flash programming
in case there is no option bytes segment within the file.
Memory programming...
█████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ 27%
With STM32_Programmer_CLI:
start /wait STM32_Programmer_CLI.exe -c port=SWD UR freq=4000 -rdu -d <Firmware_location\firmware_file.bin> 0x08000000 -log <log_location>
Output: -> NOK
Error: failed to erase memory
What parameter should I use in order to disable write protection while programming?
Best regards, John
2021-06-10 08:14 AM
Regarding the reboot after setting RDP=1 :
Trying a soft reset:
17:46:29:976 Command line: -c port=SWD freq=4000 ur -vb 3 -rst -score -log ...\soft_reset.log
17:46:30:108 STLinkUSBDriver.dll loaded
17:46:30:108 STLinkUSBDriver.dll loaded
17:46:30:108 ST-LINK SN : 56FF6F068370545248180967
17:46:30:108 ST-LINK FW : V2J37S7
17:46:30:108 Board : --
17:46:30:108 Voltage : 3.21V
17:46:30:108 SWD freq : 4000 KHz
17:46:30:108 Connect mode: Normal
17:46:30:108 Reset mode : Software reset
17:46:30:108 Device ID : 0x451
17:46:30:108 Revision ID : Rev Z
17:46:30:124 Reading data...
...
17:46:30:140 Reading data...
17:46:30:140 r ap 0 @0x1FF0F442 0x00000004 bytes Data 0x00000000
17:46:30:140 failed to read the requested memory content
17:46:30:140 Flash size : 2 MBytes (default)
17:46:30:140 Device type : MCU
17:46:30:140 Device CPU : Cortex-M7
17:46:30:140
17:46:30:140 reset ap 0
17:46:30:140 MCU Reset
17:46:30:140 run ap 0
17:46:30:140 Software reset is performed
17:46:30:140 Core is locked up
Trying a hard reset:
17:45:39:459 Command line: -c port=SWD freq=4000 ur -vb 3 -hardrst -score -log ...\hard_reset.log
17:45:39:606 STLinkUSBDriver.dll loaded
17:45:39:606 STLinkUSBDriver.dll loaded
17:45:39:606 ST-LINK SN : 56FF6F068370545248180967
17:45:39:606 ST-LINK FW : V2J37S7
17:45:39:606 Board : --
17:45:39:606 Voltage : 3.21V
17:45:39:606 SWD freq : 4000 KHz
17:45:39:606 Connect mode: Normal
17:45:39:606 Reset mode : Software reset
17:45:39:621 Device ID : 0x451
17:45:39:621 Revision ID : Rev Z
17:45:39:621 Reading data...
...
17:45:39:637 Database: Config 4 is active.
17:45:39:637 Device name : STM32F76x/STM32F77x
17:45:39:637 Reading data...
17:45:39:637 r ap 0 @0x1FF0F442 0x00000004 bytes Data 0x00000000
17:45:39:637 failed to read the requested memory content
17:45:39:637 Flash size : 2 MBytes (default)
17:45:39:637 Device type : MCU
17:45:39:637 Device CPU : Cortex-M7
17:45:39:653 Hard reset is performed
17:45:39:653 Hard reset is performed
17:45:39:653 Core is halted
If the board is power cycled one or two times, the STM32 will boot normally.
Any idea how to get it to boot without the power cycles?
Best regards, John
2021-06-10 09:53 AM
1) your command line is not correct:
please change to "mode=UR" instead of just "ur"
2) I don't know solution for restarting after RDP is set to 1.
2021-06-10 11:15 PM
1)
Ah, rookie mistake, thanks for that.
I changed it to mode=UR, and now it connects in all cases with Connect mode: Under Reset and Reset mode : Hardware reset
However, before programming with STM32_Programmer_CLI, it still tries to:
Erasing internal memory sectors [0 22]
...
Error: failed to erase memory
Somehow, I think ST-LINK_CLI automatically detects that "Some flash sectors are write protected." and temporary disables the write protection while programming.
Question would be, how to replicate this behavior for STM32_Programmer_CLI.
Many thanks and best regards,
John