How to unbrick an STM32H7 after setting the wrong power mode (SMPS/LDO)?
1. Introduction
Depending on the application, the user has the choice between SMPS and LDO power supply.
Each power supply has its own advantage and disadvantages, the user decides which one is better to achieve high efficiency and less power consumption.
Setting the wrong power mode can lead to board locking without obvious way to recover it.
This article presents a mechanism to recover from such a situation.
2. Pre-requisite
STM32CubeMX
STM32CubeProgrammer
3. Consequences of setting the wrong power mode
In STM32H7 boards, the default power supply is SMPS. The user needs to apply some hardware changes to switch to LDO power supply (for more details, please check Table 10 page 23 in
UM2408 ).
The power supply source can be selected in RCC configuration.
In case of loading a code in the MCU where LDO is set as a power supply and the hardware configuration corresponds to SMPS, uring Debug, the message “Target is not responding, retrying...” will keep showing up in the IDE console and eventually the connection will be lost.
At this stage, the STLINK can no longer connect to the MCU.
4. Steps to recover the board
4.1. 1st method
Step 1: Power off the board and connect pin BOOT0 to VDD
When BOOT0 is set to 1, the device starts in System memory.
This will prevent booting from the user flash where the power mode settings does not match the hardware configuration.
Step 2: Power on the board and connect using STM32CubeProgrammer
The connection to the board is now possible since the boot is from system memory
Step 3: Erase the user Flash
Erasing the flash memory deletes the wrong power mode configuration.
The board is recovered and can be used normally with matching firmware PWR.
Step 4: Power off the board and remove the short between BOOT0 and VDD
After the Mass erase, the flash memory become empty and ready to be re-programmed correctly. Setting BOOT0 pin to 0 will let the device boot from flash memory where the user code will be loaded.
4.2. 2nd method
Step1: Connect the board in Power down mode using STM32CubeProgrammer
The power down mode allows to put the target in debug mode, even if the application has not started since the target power up. The hardware reset signal must be connected between ST-Link and the target.
Note:
Power down mode can be used only on some of ST boards, it cannot be used on custom boards.
Step2: Erase the user Flash
Same as step 3 in method 1.
5. Links
UM2408 : STM32H7 Nucleo-144 boards
STM32CubeMX v6.5.0 install
linkSTM32CubeProgrammer v2.10.0 install
link