Skip to main content
PFavr.1
Associate
March 2, 2020
Question

Dear ST staff, I am using the nucleo board STM32L476RG to flash a STM32L476ZGT6. I once wrongly connected the SWD pins. I am now only able to erase the microcontroller flash: I cannot flash the microcontroller again. Do you have a clue?

Note:The hardware is still functional, I made sure of it.

This topic has been closed for replies.

5 replies

waclawek.jan
Super User
March 2, 2020

Can you connect to the target e.g. in STLink Utility?

JW

PFavr.1
PFavr.1Author
Associate
March 2, 2020

Hello Jan,

Thanks for your feedback.

I could connect to the target via ST Link:

11:09:56 : Connected via SWD.

11:09:56 : SWD Frequency = 4,0 MHz.

11:09:56 : Connection mode : Connect Under Reset.

11:09:56 : Debug in Low Power mode enabled

PF

Ozone
Principal
March 2, 2020

Most people here are not ST staff.

> I could connect to the target via ST Link:

And what are the error messages when you try to flash ?

PFavr.1
PFavr.1Author
Associate
March 3, 2020

Hello,

The problem came from specific backup registers that needed to be reset.

You can find below the SW excerpt related to the needed action:

HAL_Init(); 

HAL_DBGMCU_EnableDBGStandbyMode();

__HAL_RCC_BACKUPRESET_FORCE();

__HAL_RCC_BACKUPRESET_RELEASE();

Thank you all for your help,

PF

Tesla DeLorean
Guru
March 3, 2020

Strap the BOOT0 pin HIGH, connect, do a mass erase, and set option bytes to defaults.​

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..