cancel
Showing results for 
Search instead for 
Did you mean: 

Not entering to sleep mode immediatly after Programming STM32 controller using STlink programmer

darshan-ltts
Associate II

I am working with STM32 U575/U5A5 and L4 series of STM32 controllers in low power mode. I have programmed the controller to wake for every 10s and blink LED. This issue what we observed is once  immediately flashing hex file to controller using STlink programmer, Controller is not entering in sleep mode LED will be keep on blinking. If I remove the power and connect it back, Controller is entering sleep mode and waking up for every 10s as expected.

we have reseted the controller using Reset button, but still controller is not entering to sleep mode.

The question here is why Controller requires  power on reset to enter power saving mode after flashing hex file to controller using STlink programmer?

 

27 REPLIES 27
darshan-ltts
Associate II

Any update on this??

BarryWhit
Senior III

Here's what you do.

 

Prepare two programs:

Program1 - which blinks the LED quickly when not sleeping

Program2 - which blinks the LED slowly when not sleeping

 

Burn Program1 to the chip and do POR.

Then, burn Program2 and use just nRST (Wild guess: Are you using a cheap st-link clone with a bunch of individual  wires instead of a single debug connector, and forgot to connect the Reset line from the programmer? if so, that's why you have to manually press reset after programming. That, or maybe someone changed some setting in CubeIDE).

 

Now, after reset, did the blinking frequency change? if it did, your new code is running, but when it tries to sleep, something is constantly waking it up.

If the blink rate doesn't change unless you cycle the power, than indeed it seems like the new code doesn't take effect until power cycle. And unless you're doing something exotic, like running from SRAM or something,

I have no idea why this is happening.

 

- If someone's post helped resolve your issue, please thank them by clicking "Accept as Solution".
- Please post an update with details once you've solved your issue. Your experience may help others.

Your issue is very simple. You prog MCU with debug in low power mode set. This config DBG register and this isnt overide with reset. Only power off or in code change register DBG... or in your IDE set no debug in low power...

BarryWhit
Senior III

Really? as far as I know, debug in low power mode can increase current consumption (until you POR), but it doesn't actually mean you take the MCU out of sleep mode. Do I have it wrong?

- If someone's post helped resolve your issue, please thank them by clicking "Accept as Solution".
- Please post an update with details once you've solved your issue. Your experience may help others.

Yes wrong


@BarryWhit wrote:

Really? as far as I know, debug in low power mode can increase current consumption (until you POR), but it doesn't actually mean you take the MCU out of sleep mode. Do I have it wrong?


It means that the clocks are not stopped during the Sleep mode - so the expected current reduction will not be seen.

But the MCU should still wait for the usual "wakeup" signal.

BarryWhit
Senior III

Right, but OP is not about current reduction, or even low power modes (non-native speaker, so admittedly hard to parse). It's about programming the chip and having the new program seemingly not taking effect even after a manual reset. Only after a POR is performed.

 

Since LP debug mode should not effect the observable runtime behavior (docs say it's there so you can set breakpoint on wakeup ISR while CPU is in low power mode), the answer given by MM..1 still makes no sense to me.

 

@MM..1  says I'm wrong. I wish he would explain why.

 

- If someone's post helped resolve your issue, please thank them by clicking "Accept as Solution".
- Please post an update with details once you've solved your issue. Your experience may help others.
Andrew Neil
Evangelist III

@darshan-ltts wrote:

controller is not entering to sleep mode.


How do you know it isn't?

If you debug in STM32CubeIDE, do you see the same behaviour after download?

Does your code contain anything to disable sleep mode when the debugger is connected?

Simply MCUs is in totaly different state

MM1_0-1719584768796.png

but in detail you dont get here info how low power mode used, Based on your code config wake is from timers systicks usw.