STM32 gotchas
201.STM32 with SMPS+LDO may be hard to recover, if inadvertently set to SMPS upon startup

This article has been contributed by M.Dudka.

Some STM32 (for example STM32H725 1) have a built-in Buck-mode (i.e. downconverting) Switched-Mode Power Supply (SMPS). It is not necessary to use it, the core can be supplied also using the built-in LDO (in RM0468, this is shown as variant 1. on Figure 19. System supply configurations), just like in other STM32.

After a new project is created in CubeMX, SMPS-only is set as the initial power supply (even if this is not the factory setting with which the chip starts up!)

screenshot of CubeMX, showing the offending setting

If STM32H725 is connected to not use SMPS and the user forgets to change this setting in CubeMX (or deal with this situation in some other way), after the program starts to run, it switches off the LDO and the core loses its power. In such situation, it is difficult to connect to the chip using debugger (even "connect under reset" does not work).

One theoretical chance how to connect debugger is to use the short moment after the system is powered up (when the system supply is in the initial SMPS+LDO setting). Connection must be established until the problematic program starts to run and disconnects the core supply (which is a matter of milliseconds). Theoretically, reset (NRST pin) could be held externally active (low) during powerup and then debugger should be able to connect in one of the modes with externally controlled reset. I haven't tested this method, though.

Another way to solve this situation is to connect external power supply cca 1.2V to some of the VCAP pins, supplying temporarily the core, and then erase the offending program.

This is quite an unpleasant gotcha by CubeMX.

1. STM32H725 (and its crypto-enabled counterpart, STM32H735) in all packages does support SMPS. However, its marking does not follow the convention from other STM32 with SMPS in that it is not marked with Q suffix.