2024-05-22 02:37 AM - edited 2024-05-22 02:40 AM
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?
2024-05-30 11:38 PM
Any update on this??
2024-06-27 12:53 PM - edited 2024-06-27 12:55 PM
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.
2024-06-27 01:47 PM
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...
2024-06-27 02:22 PM - edited 2024-06-27 02:22 PM
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?
2024-06-28 06:39 AM
Yes wrong
2024-06-28 06:48 AM
@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.
2024-06-28 06:56 AM - edited 2024-06-28 06:59 AM
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.
2024-06-28 07:23 AM
@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?
2024-06-28 07:28 AM
Simply MCUs is in totaly different state
but in detail you dont get here info how low power mode used, Based on your code config wake is from timers systicks usw.