Showing results for 
Search instead for 
Did you mean: 

STM32U5 enter low power modes after debugger connectivity without powercycle

Associate III


I making a product that has the STM32U5 running from a battery, most of the time being in one of the low power modes. 

I can use the debugger to .. debug my code, step through it, use SWO etc, and this all works great. However, as long as the debugger is connected, the MCU draws +- 300uA constant current in all sleep modes, while if we are in the sleep mode without the debugger ever having been connected, this is +- 3uA.


If I simply power cycle the MCU after my debugging session, all is fine, and I can enter the low power modules without issue. BUT, once I attach with my debugger (which then enables all the SWD registers), I cannot "disable" this high power usage anymore.(Toggling the nRST pin does not turn off SWD etc)


This is "good".. in the sense that we can use the debugger to follow through lots of events, and even detect resets, but this is "bad", in the usecase where I'd like to run my device in low power for most of the time, and sporadically connect the debugger to debug/flash new code, without disconnecting the power.


The obvious solution is to simply power cycle the device after a debugging session, but the question is whether there is a way to fully hard-reset (meaning also disable the SWD core) without power cycling the MCU?


Thanks for your feedback,




Associate III

Some extra information:


When connecting once through STM32CubeProgrammer, the power usage does not drop, also after disconnecting. This was the main issue I logged.

With STM32CubeIDE however:

- when flashing a new binary through STM32CubeIDE through the  ArnoutDekimo_0-1703084962439.png button, the system DOES again go to the best power mode ! There is no constant draw

- If we in cubeIDE went into debugging once, the issue is the same - the draw remains, even after pressing that button.



Perhaps it has to do with the "play" button not enabling SWO debugging registers or something. But in the end, ideally I'd like to flash, debug, and then go back to low power modes without power cycling.