cancel
Showing results for 
Search instead for 
Did you mean: 

How to reset STM32L4 after activating ReadOut Protection Level 1?

MSood.1
Associate

Hello!

I have a problem with STM32L496RG booting from flash after activating readout protection level 1. The issue is that MCU seems to get stuck in system bootloader code. The only way to get it to boot from main flash is to apply power on reset.

Accroding to RM0351 section 3.5.1 the readout protection is activated by system reset or power-on reset if debug was active. In my case I have no debugger connected and still the system reset is not enough to activate RDP and boot from main flash.

I have tried activating readout protection option bit via STM32CubeProgrammer and also from my firmware. In firmware, after calling HAL_FLASH_OB_Launch() the MCU ends up in unknown state where it does not respond to system bootloader command nor start executing program from main flash.

In my application I have backup power source constantly connected and there is no easy way for end user to apply power-on reset after firmware update. Is it known bug/feature for this device or am I doing something wrong? Is there any possible way to reset the MCU after RDP is activated?

8 REPLIES 8
Anttu Koski
Associate III

I'm seeing similar issue with STM32L462 when using the ROM bootloader via UART to enable readout protection. It just hangs after enabling RDP level 1 and requires power cycling to recover. With several other STM32 MCUs (F0, F3, H7, ...) this seems to work ok when doing it identically.

Andreas Bolsch
Lead II

Didn' verify this, so can't promise it will help: 6.1.1 says POR is generated when exiting from Standby or Shutdown mode. So, try to enter Standby mode with a wakeup by RTC or similar. And ensure that DBG_STANDBY is not set.

TUT.1
Associate II

Hello, same issue on STM32L476RE. In the code I program some option bytes (BOR level, BFB2..) and than launch the programming with HAL_FLASH_OB_Launch() and everything works okay: the MCU reset and the option are applied. When including the RDP level in these option the MCU did not reset anymore but get stuck and need a powering on-off cycle to restart... Any advice?

MSood.1
Associate

I got the solution from Frantz LEFRERE (ST Employee). He provided the attached example project that solved the issue for me.

Thanks, it works! I only had to add "CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY);" before entering in standby mode, otherwise the OB programming procedure did not works. (Thanks to the comment of @Andreas Bolsch​ )

Anttu Koski
Associate III

Is it possible to get this working when the flashing is done using the stock bootloader via UART?

Same question for me.. did you find a workaround?

No. I tried doing version of that TEST_RDP code that would run off from RAM, but for some reason I cannot get it to run..