cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U5 enter low power modes after debugger connectivity without powercycle

ArnoutDekimo
Associate III

Hi,

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,

Arnout

 

 

2 REPLIES 2
ArnoutDekimo
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. 

BarryWhit
Senior III

Old thread, but answering for future reference.

 

This is behaving as designed, and there is no way around it AFAICT. If you activate "Low Power Debug" and connect with a debugger, the extra current draw is there until you POR.

 

This is described (in the official docs as well I'm sure) in KB:Tips for using STM32 low-power modes.

- If someone's post helped resolve your issue, thank them by clicking "Accept as Solution".
- Once you've solved your issue, please post an update with any further details.