2021-08-30 03:52 AM
Since STM32 STLINK Utility Command Line Interface has return codes, why STM32Cube Programmer don't have?
Solved! Go to Solution.
2021-09-06 12:18 AM
Please select my answer as Best to close the question.
2021-08-30 05:40 AM
it seems that STM32CubeProgrammer returns 0 (zero) if no problem and a code different from zero in case of error. But it is not documented in the user manual as ST-LINK Utility.
Example of error case: On a Windows PC, if no STM32 connected to the PC:
STM32_Programmer_CLI.exe -c port=swd --list
-------------------------------------------------------------------
STM32CubeProgrammer v2.8.0
-------------------------------------------------------------------
Error: No debug probe detected.
c:\>echo %ERRORLEVEL%
1
Are you using something else than a Windows PC ? (Linux ? Mac ?)
2021-09-04 12:24 AM
Hi Guillaume,
I m using Windows. it does working.
Thank you so much for your help.
2021-09-06 12:18 AM
Please select my answer as Best to close the question.
2021-09-06 06:35 AM
Please document what the actual return codes are, the answer here isn't particularly satisfactory if someone searched on it, or the forum suggested it as an answer.
2021-09-06 05:54 PM
Yeah agree. It would be good if can have the list of return codes like what we have for STLINK Utility CLI user manual.
2021-09-07 02:28 AM
I backtrack a little: in current version of STM32CubeProgrammer (2.8.0) there are some cases where STM32CubeProgrammer returns 1 in case of error, but some other error cases it returns 0. There are ongoing actions to correct that in future versions.
2021-09-28 12:22 AM
Hopefully can be fixed soon. My product's manufacturing process depends on returned-code to detect failure in programming.
Now always return zero in any condition: STM32CubeProgrammer (2.8.0)
2021-09-28 12:28 AM
Hi Fardi,
Would you mind to share how to get "return value is 0"? Is there any special command?
Thanks
2021-09-28 12:32 AM
This is the script I use:
@echo off
SET COMMAND=stm32_programmer_cli -c port=SWD freq=8000 mode=UR
SET FILE=%1%
echo.
echo %FILE%
echo ===================================================================
echo SURE TO ERASE-PROGRAM-VERIFY? Press Ctrl+C to cancel
echo ===================================================================
echo.
pause
%COMMAND% -rdu -ob WPRMOD=0 WRPOT0=0 WRPOT1=0 WRPOT2=0 WRPOT3=0 WRPOT4=0 WRPOT5=0 WRPOT6=0 WRPOT7=0 -e all
echo return value is %errorlevel%
%COMMAND% -d "%FILE%" -v
echo return value is %errorlevel%
echo.
pause