2023-10-06 02:12 AM
Hi,
I would like to get help from you on a problem that I spent a lot of time on but could not solve. I am trying to do the software update operations of a card of our own design with an STM32WB55 MCU, using STM32_Programmer_CLI.
I wrote a simple C# GUI which calls these commands step by step and waits for STM32_Programmer_CLI app to exit.
Clear nBoot0 and SwBoot0
"STM32CubeProgrammer CLI (Standalone)\Bin\STM32_Programmer_CLI.exe" -c port=usb sn=207834575352 -ob nBoot0=0x00 nSWBOOT0=0x00"
Check if FUS is running
"STM32CubeProgrammer CLI (Standalone)\Bin\STM32_Programmer_CLI.exe" -c port=usb sn=207834575352 -fusgetstate
If Fus is not running => Call fusgetstate 2 times
Step 1
"STM32CubeProgrammer CLI (Standalone)\Bin\STM32_Programmer_CLI.exe" -c port=usb sn=207834575352 -fusgetstate
Step 2
"STM32CubeProgrammer CLI (Standalone)\Bin\STM32_Programmer_CLI.exe" -c port=usb sn=207834575352 -fusgetstate
Read FUS Version
"STM32CubeProgrammer CLI (Standalone)\Bin\STM32_Programmer_CLI.exe" -c port=usb sn=207834575352 -r32 0x20030030 1
Update FUS
irrelevant, never used, FUS always up to date
Update BLE Stack
"STM32CubeProgrammer CLI (Standalone)\Bin\STM32_Programmer_CLI.exe" -c port=usb sn=207834575352 -fwupgrade "STM32CubeProgrammer CLI (Standalone)\Bin\BLE Stack\stm32wb5x_BLE_Stack_full_fw.bin" 0x080CE000 firstinstall=0
Update Our FW
"STM32CubeProgrammer CLI (Standalone)\Bin\STM32_Programmer_CLI.exe" -c port=usb sn=207834575352 -w "STM32CubeProgrammer CLI (Standalone)\Bin\Final.hex" 0x08000000
Set nBoot0 and swBoot0
"STM32CubeProgrammer CLI (Standalone)\Bin\STM32_Programmer_CLI.exe" -c port=usb sn=207834575352 -ob nBoot0=0x01 nSWBOOT0=0x01
Problem is sometimes when "STM32_Programmer_CLI" updating the BLE stack (Update BLE Stack command) "STM32_Programmer_CLI" is hangs. It does not exit, so my C# application waits forever for it's exit signal.
"STM32_Programmer_CLI" never hangs while proccessing other commands.
Strange thing is If ı call these commands by using Windows's CMD and if I write commands by hand I've never seen it hang. Maybe it's a coincidence.
I enabled trace log of "STM32_Programmer_CLI" and attached it. You can find it in attachments. I also take a screenshot of "STM32_Programmer_CLI" when it hanged.
I'm using this simple code in my application to call "STM32_Programmer_CLI " and than I wait for this process to exit.
I'm not sure whether there is an error in the STM32_Programmer_CLI program or a hardware problem on our own board.
string arguments = arguments = "-c port=usb sn=" + serialNumber + " -fwupgrade \"" + AppDomain.CurrentDomain.BaseDirectory + "STM32CubeProgrammer CLI (Standalone)\\Bin\\BLE Stack\\stm32wb5x_BLE_Stack_full_fw.bin\" 0x080CE000 firstinstall=0";
}
var proc = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = AppDomain.CurrentDomain.BaseDirectory + @"STM32CubeProgrammer CLI (Standalone)\Bin\STM32_Programmer_CLI.exe",
Arguments = arguments,
UseShellExecute = false,
CreateNoWindow = false
}
};
proc.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
proc.Exited += Proc_updateBleStackThread_Exited;
proc.EnableRaisingEvents = true;
proc.Start();