cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to download firmware again after trying out the SBSFU projects?

Zoey
Associate III

I tried the SBSFU examples (did not change any code) on a NUCLEO-L476RG board and it worked fine. Now I can not use STM32CubeProgrammer to connect the board. Is there any way to download a new firmware ( I mean, a firmware to replace the SBSFU firmware) to the board again? So that I can use this board for other projects.

The configuration of the SBSFU is:

/*#define SECBOOT_DISABLE_SECURITY_IPS*/

/*#define SFU_FINAL_SECURE_LOCK_ENABLE */

#define SFU_DEBUG_MODE

/*#define SFU_FWIMG_BLOCK_ON_ABNORMAL_ERRORS_MODE*/

#define SECBOOT_OB_DEV_MODE

Thanks!

4 REPLIES 4
Jocelyn RICARD
ST Employee

Hello Zoey,

by default, the SBSFU will apply all the protections available.

One of these protections is the RDP level 1 (as long as you didn't uncomment the final secure lock enable).

Also, the GPIOs used for the SWD connection were set to another alternate function.

With the Readout Protection level, you can still attach to the target but you need to set the mode to "Under reset" in the Cube programmer.

Once connected, go to option bytes and set RDP level to 0xAA (RDP level 0)

This will provoke a mass erase and take you back to a clean device.

Another way would be to set the BOOT0 pin to 1 and to connect to the system bootloader through DFU or USART.

The STM32CubeProgrammer is able to handle these communication links and will allow you to do the RDP regression.

Best regards

Jocelyn

Thanks very much, Jocelyn.

I tried to set the mode to "Under reset" in the Cube programmer and with different reset modes (software reset, hardware reset, core reset), it failed to connect and showed the following messages

16:45:52 : STM32CubeProgrammer API v2.1.0

16:45:52 : ST-LINK error (DEV_CONNECT_ERR)

16:46:25 : ST-LINK error (DEV_USB_COMM_ERR)

16:46:25 : Error: Problem occured while trying to connect

16:46:53 : ST-LINK error (DEV_USB_COMM_ERR)

16:46:53 : Error: Problem occured while trying to connect

16:47:06 : ST-LINK error (DEV_USB_COMM_ERR)

16:47:06 : Error: Problem occured while trying to connect

I will try the second way and see.

After setting the BOOT0 pin to 1 and connecting to the system bootloader USART, I could set the RDP level to 0xAA (RDP level 0). However, I could not erase the chip.

09:47:59 : ST-LINK FW : V2J31M21

09:47:59 : Voltage : 3.28V

09:47:59 : SWD freq : 4000 KHz

09:47:59 : Connect mode: Under Reset

09:47:59 : Reset mode : Hardware reset

09:47:59 : Device ID : 0x415

09:47:59 : UPLOADING OPTION BYTES DATA ...

09:47:59 : Bank : 0x00

09:47:59 : Address : 0x40022020

09:47:59 : Size : 20 Bytes

09:47:59 : Bank : 0x01

09:47:59 : Address : 0x40022044

09:47:59 : Size : 16 Bytes

09:47:59 : UPLOADING ...

09:47:59 : Size : 1024 Bytes

09:47:59 : Address : 0x8000000

09:47:59 : Read progress:

09:47:59 : Data read successfully

09:47:59 : Time elapsed during the read operation is: 00:00:00.008

09:48:04 : MASS ERASE ... 

09:48:04 : Error: Mass erase operation failed.Please verify flash protection

How can I make mass erase work? Thanks!

Jocelyn RICARD
ST Employee

Hello Zoey,

One first thing to do would be to update the stlink firmware.

When connected with STM32CubeProgrammer click on firmware upgrade button and follow instructions

Then please launch the following command:

STM32_Programmer_CLI.exe -c port=SWD -ob displ

and just copy paste here the option byte contents.

I will have a look and tell you what to do.

Best regards

Jocelyn