Skip to main content
Visitor II
May 22, 2024
Question

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

  • May 22, 2024
  • 8 replies
  • 5592 views

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?

 

    This topic has been closed for replies.

    8 replies

    Visitor II
    May 31, 2024

    Any update on this??

    Graduate II
    June 27, 2024

    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...

    Graduate II
    June 27, 2024

    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.

     

    Graduate II
    June 27, 2024

    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?

    Graduate II
    June 28, 2024

    Yes wrong

    Graduate II
    June 28, 2024

    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.

     

    Graduate II
    June 28, 2024

    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.

     

    Super User
    June 28, 2024

    So the MCU does still behave the same as if went to sleep - you just don't get the power reduction.

    So this doesn't explain why @darshan-ltts does see different behaviour.

    Super User
    June 28, 2024

    @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?

    Graduate II
    June 28, 2024

    @darshan-ltts , the real problem here is that none of us can be sure we understand what problem you're describing due to language barrier. Please make an effort to be as clear as possible.

     

    My initial post suggested a very quick and concrete test for you to make, which would clarify things.  Have you done the test I described? what are the results?

    Graduate II
    June 28, 2024

    I'm out.

    Graduate II
    June 29, 2024

    @darshan-ltts wrote:

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

     


    This isnt question, this is knowledge. Learn how states after flashing hex with different sw exist. I know around more as 10 variants... 

    Visitor II
    June 29, 2024

    Exactly.I need to understand this part after flashing the hex file.