cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB stack programming/update from cube programmer gui-cli in swd-dfu mode don't work in all mode

LBera.1
Associate II

HI

I am doing experiments with board P-Nucleo WB55, in particular I wanted to update the ble firmware in the allowed ways:

1 - Connection in dfu mode via usb with the cube programmer gui

2 - Connection in swd mode with the cube programmer gui

3 - Connection in dfu mode with cube programmer cli

4 - Connection in swd mode with cube porogrammer cli

Initially I was able to connect in dfu mode (with cn7.5 and cn7.7 in short circuit and jp1 on usb mcu), and in device manager I saw the dfu device, from a certain point on it no longer recognizes the dfu mode, not even on another pc where a similar card is recognized correctly, and in the device manager nothing happens when I connect it. This prevents me from doing experiments 1 and 3 listed above.

For experiments 2 I do everything correctly, so I can update both the fus and the stack, and if I run delete stack and try to load a ble firmware it doesn't work, so it delete the stack as it should be , and if I run update stack and then load a blue firmware it runs correctly.

For the experiment at point 4 I can't do anything, or rather, when the stack is on the board, and I execute the firmware update command it gives me error messages but it seems to execute correctly, but having doubts about the messages I don't know if he has actually rewritten the stack or if he is running the one already present.

If I execute the command with the stack deleted (deleting it from cube programmer gui then it always gives me error, either if I choose the firstinstall option to 1 or 0. So in this situation where I am emulating the production microcontrollers without a stack to update via cli in an automated way I can't do it.

Ultimately, how can I make it work in dfu mode?

How can I update the stack in swd mode?

How can I do both actions correctly with programmer gui and with programmer cli

The cli command follows, both with stack present and with stack not present.

COMMAND CLI WITH NO STACK INTALLED:

C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin>STM32_Programmer_CLI.exe -c port=swd mode=UR -fwupgrade C:\STM32Cube_FW_WB_V1.11.1\Projects\STM32WB_Copro_Wireless_Binaries\STM32WB5x\stm32wb5x_BLE_Stack_full_fw.bin Install@0x080CA000 firstinstall=1 startstack=1 -v -startwirelessstack

   -------------------------------------------------------------------

            STM32CubeProgrammer v2.7.0

   -------------------------------------------------------------------

ST-LINK SN : 0677FF393132534E43051442

ST-LINK FW : V2J37M27

Board    : P-NUCLEO-WB55

Voltage   : 3.27V

SWD freq  : 4000 KHz

Connect mode: Under Reset

Reset mode : Hardware reset

Device ID  : 0x495

Revision ID : Rev Y

Device name : STM32WB5x

Flash size : 1 MBytes

Device type : MCU

Device CPU : Cortex-M4

Error: The fwupgrade command you trying to perform (-fwupgrade "C:\STM32Cube_FW_WB_V1.11.1\Projects\STM32WB_Copro_Wireless_Binaries\STM32WB5x\stm32wb5x_BLE_Stack_full_fw.bin") is missing some arguments. Please refer to the Help to see how to use it.

Warning: Option Byte: nSWboot0, value: 0x0, was not modified.

Warning: Option Byte: nboot0, value: 0x1, was not modified.

Warning: Option Byte: nboot1, value: 0x1, was not modified.

Warning: Option Bytes are unchanged, Data won't be downloaded

Succeeded to set nSWboot0=0 nboot1=1 nboot0=1

Memory Programming ...

Opening and parsing file: 0x495_FUS_Operator.bin

 File     : 0x495_FUS_Operator.bin

 Size     : 8 KBytes

 Address    : 0x08000000

Erasing memory corresponding to segment 0:

Erasing internal memory sectors [0 1]

Download in Progress:

██████████████████████████████████████████████████ 100%

File download complete

Time elapsed during download operation: 00:00:00.290

Application is running, Please Hold on...

Reconnecting...

Reconnected !

Error: FUS_STATE_IMG_NOT_FOUND

Error: startwirelessStack Operation Failure! Please, try again

C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin>

COMMAND CLI WITH STACK INTALLED:

C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin>STM32_Programmer_CLI.exe -c port=swd mode=UR -fwupgrade C:\STM32Cube_FW_WB_V1.11.1\Projects\STM32WB_Copro_Wireless_Binaries\STM32WB5x\stm32wb5x_BLE_Stack_full_fw.bin Install@0x080CA000 firstinstall=1 startstack=0 -v -startwirelessstack

   -------------------------------------------------------------------

            STM32CubeProgrammer v2.7.0

   -------------------------------------------------------------------

ST-LINK SN : 0677FF393132534E43051442

ST-LINK FW : V2J37M27

Board    : P-NUCLEO-WB55

Voltage   : 3.27V

SWD freq  : 4000 KHz

Connect mode: Under Reset

Reset mode : Hardware reset

Device ID  : 0x495

Revision ID : Rev Y

Device name : STM32WB5x

Flash size : 1 MBytes

Device type : MCU

Device CPU : Cortex-M4

Error: The fwupgrade command you trying to perform (-fwupgrade "C:\STM32Cube_FW_WB_V1.11.1\Projects\STM32WB_Copro_Wireless_Binaries\STM32WB5x\stm32wb5x_BLE_Stack_full_fw.bin") is missing some arguments. Please refer to the Help to see how to use it.

Warning: Option Byte: nSWboot0, value: 0x0, was not modified.

Warning: Option Byte: nboot0, value: 0x1, was not modified.

Warning: Option Byte: nboot1, value: 0x1, was not modified.

Warning: Option Bytes are unchanged, Data won't be downloaded

Succeeded to set nSWboot0=0 nboot1=1 nboot0=1

Memory Programming ...

Opening and parsing file: 0x495_FUS_Operator.bin

 File     : 0x495_FUS_Operator.bin

 Size     : 8 KBytes

 Address    : 0x08000000

Erasing memory corresponding to segment 0:

Erasing internal memory sectors [0 1]

Download in Progress:

██████████████████████████████████████████████████ 100%

File download complete

Time elapsed during download operation: 00:00:00.297

Application is running, Please Hold on...

Reconnecting...

Reconnected !

FusStartWS activated successfully

startwirelessStack command execution finished

C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin>

Best regards,

Luigi Berardi

6 REPLIES 6
Remi QUINTIN
ST Employee

Install@0x080CA000 is not an expected parameter. 0x080CA000 is enough as an hexa value. I think Install@0x080CA000 is not recognized as a valid parameter.

I confirm firstinstall has no influence.

Remi QUINTIN
ST Employee

Now I dont understand why it should prevent any further update of the stack team.

Could you download the option bytes of your board?

in the log, it seems that the update is not performed because the same stack version is already installed.

LBera.1
Associate II

Hi the parameter 0x080CA000 and the command are take from your relase notes, as you can see in screenshot attached.

When I read option byte I see this:

 10:14:15 : Time elapsed during the read operation is: 00:00:00.000

 10:14:25 : UPLOADING ...

 10:14:25 :  Size     : 4 Bytes

 10:14:25 :  Address    : 0xE000EE08

 10:14:25 : Read progress:

 10:14:25 : Data read successfully

I cant' upload two screenshot for option bytes also, I'll send you another reply

Also if it don't update because of the same version, it don't work when there is no stack programmed and it don't work in dfu mode...

these are option bytes

Remi QUINTIN
ST Employee

Ok What I wanted to point is that "install@0x080CA000" in the command is not an expected hex value.

The option bytes look OK for a proper execution with the FW stack.

Now regarding the fact that you cannot connect via the USB port in DFU mode after a trail via the SWD port, you need to check the user option bytes that may h    ave been modified. For the DFU mode the nSWBOOT0 must be set to 1.

One point on sending a new FUS command (experiment 2) when the new FW stack is installed: After a stack update, M0+ is running the new installed stack, not FUS !

To load and install a new stack, it’s necessary to execute the “START FUS�? command (return to FUS) then use option “firstinstall = 0�?.

For experiment 4 and for all new commends to be processed by the FUS once the stack is installed and running on the M0+ core, START FUS command execution is mandatory to continue installing other stacks (of course with option firstinstall = 0),. Once the stack installation is finished, the M0+ is executing the FW stack, not the FUS. So you can’t communicate with FUS before M0+ jump to FUS start address using the START FUS command.. so it’s normal to have such errors..

LBera.1
Associate II

Hi,

So, in order, the main problem for dfu mode was what you said, that is nSWBOOT0 must be set to 1, I see this parameter goes back to zero when I connect in swd mode from cube programmer gui and run start fuse or start wireless stack, so if I want to use the board in dfu mode I have to set it by hand, connecting in swd mode with programmer gui, set the value and execute apply.

I did not understand if this value can do the automatic switch from zero to one and vice versa when I want to switch from swd to dfu and vice versa or if it must be set by hand every time, as if I update it in dfu mode and connect it in swd a cube ide and program it with a ble firmware, it starts, so it's running the stack,

and if I reconnect in dfu it connects automatically, it does not lose that setting, so I did not understand that it loses that setting and when not.

For the swd mode command with cube programmer cli I didn't log the startfus command but I always ran the startfuse command first for the reasons you explained, that was clear to me, here the problem was the error on the parameter that gives " install @ 0x080CA000 "was replaced with the only address" 0x080CA000 ",

so the definitive correct commands in sequence were:

STM32_Programmer_CLI.exe -c port = swd -startfus

STM32_Programmer_CLI.exe -c port=swd mode=UR -fwupgrade C:\STM32Cube_FW_WB_V1.11.1\Projects\STM32WB_Copro_Wireless_Binaries\STM32WB5x\stm32wb5x_BLE_Stack_full_fw.bin 0x080CA000 firstinstall=0 startstack=0 -v -startwirelessstack

Now I can upgrade firmware with dfu and swd in gui or cli mode, but my doubt was when SWBOOT0 keep the value and when loose it.

thank you

best regard