2022-05-21 06:46 AM
I've spend a lot of time on this, and I am out of ideas.
I'm a test engineer, and I have a bunch of boards my customer wants programmed.
I run the command STM32_Programmer_CLI.exe -c port=swd -w "C:\FW.hex" -v -q but it will fail a lot. I wrote 90% in the title, but it's so odd, because once it works, which may take 10 attempts, it will most likely work again and again if I just keep running that command. I have tried multiple computers, and they all exhibit this behaviour. The customer says they always manage to program the boards with zero issue whatsoever.
It used to work just fine, when I programmed dozens of these boards last year. Maybe the programmer is broken. If I could just buy a new V3, I would, but nowhere is in stock. If anybody knows how I can get one, please give me advice. This is my only unit.
C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin>STM32_Programmer_CLI.exe -c port=swd -w "C:\FW.hex" -v -q
-------------------------------------------------------------------
STM32CubeProgrammer v2.10.0
-------------------------------------------------------------------
ST-LINK SN : 003300413438511134313939
ST-LINK FW : V3J7M2B4S1
Board : STLINK-V3SET
Voltage : 3.26V
Error: No STM32 target found!
2nd connect tentative with a lower frequency (8MHz)
ST-LINK SN : 003300413438511134313939
ST-LINK FW : V3J7M2B4S1
Board : STLINK-V3SET
Voltage : 3.27V
Error: No STM32 target found!
C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin>STM32_Programmer_CLI.exe -c port=swd -w "C:\FW.hex" -v -q
-------------------------------------------------------------------
STM32CubeProgrammer v2.10.0
-------------------------------------------------------------------
ST-LINK SN : 003300413438511134313939
ST-LINK FW : V3J7M2B4S1
Board : STLINK-V3SET
Voltage : 3.28V
SWD freq : 24000 KHz
Connect mode: Normal
Reset mode : Software reset
Device ID : 0x471
Revision ID : Rev Z
Device name : STM32L4Pxxx/STM32L4Qxxx
Flash size : 1 MBytes
Device type : MCU
Device CPU : Cortex-M4
BL Version : --
Debug in Low Power mode enabled
Memory Programming ...
Opening and parsing file: FW.hex
File : FW.hex
Size : 280.17 KB
Address : 0x08020000
Erasing memory corresponding to segment 0:
Erasing internal memory sectors [32 102]
Download in Progress:
File download complete
Time elapsed during download operation: 00:00:07.190
Verifying ...
Download verified successfully
C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin>
Any advice would be HIGHLY appreciated.
Solved! Go to Solution.
2022-05-21 08:39 AM
2022-05-21 07:03 AM
Current firmware
Is the reset pin connected in your use case?
Connect under reset.
Reduced connection speed.
2022-05-21 07:19 AM
OK, I've upgraded FW on the V3 from:
V3J7M2B4S1
to:
V3J9M3B5S1
STM32CubeProgramer is v 2.10.0 (latest)
Yes, STM32_nRST is connected, I just checked with an ohmmeter that it goes from the V3 pin to the header of the board properly.
When you say connect under reset, you mean as a part of my command line?
So I just tried again without changing the speed, and it failed on the first try, then succeeded on the second. Reducing to freq=100 worked on first try, but that might be the phenomenon I described before where if it works once it tends to work multiple times over. Let me try with freq=500 and go through a few units. Thank you for your advice.
2022-05-21 07:38 AM
I'm afraid the problem still persists. I retry multiple times to get it through.
I have also tried multiple cables between the DUT (the customer's board), and the V3 programmer, and it appears to make no difference.
2022-05-21 08:39 AM
Connect mode: Under reset
Reset mode: Hardware reset
2022-05-21 09:20 AM
I've left work. Will try this on Monday. Thank you.
2022-05-22 11:00 PM
Hi, reset=HWrst seems to have done the trick. I have removed the freq=500 line so it uses 8MHz now and it has worked flawlessly for three boards in a row, which was impossible before. Thank you both very much. Extremely good help, and I appreciate it a lot.
So.... man.. I spent so much time on this problem. The default setting for reset appears to be SWrst. That did not work. How would I ever find that out on my own? What is the general advice for SWrst vs HWrst? Why does HWrst work so well?