cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to enter Standby mode on STM32F030

h23
Associate II
Posted on August 06, 2014 at 16:35

Hello,

I have a board equipped with a STM32F030R8T6. It runs for app. 0.1 s and then goes into StandBy (or should) for 10 seconds. It is woken up by IWDG. It looks like it is working OK,  it executes and goes to _some_ kind of low power mode for 10 seconds, and looking at the reset reason in RCC_CSR it is reset by IWDG.

However when looking at the PWR_CSR the SBF bit, it is never set.

Further, when experimenting with the different Option Byte settings for whether a reset should be done instead of entering standby or stop (nRST_STOP for doing reset instead of entering STOP mode and nRST_STDBY for doing reset instead of entering Standby mode) I get the impression that it is really not entering Standby mode but Stop mode.

The reason I get this impression is that if I reset the nRST_STDBY bit in the option byte field, that makes no difference, it still goes to some kind of low power mode for 10 seconds, and then it is woken up by IWDG.

But if I reset the nRST_STOP bit, there is no sleep period of 10 seconds, it immediately resets, and the Low Power Reset flag in RCC_CSR is set.

I use the PWR_EnterSTANDBYMode() -function provided with the ST-lib to enter Standby mode, and when looking at that code it looks correct according to the reference manual.

Anyone else that recognizes this behavior ?

br H�kan

#stm32f030-standby
5 REPLIES 5
h23
Associate II
Posted on August 06, 2014 at 18:20

One more thing that confirms my suspicion that it does not go to standby mode. In standby mode RAM memory should be cleared since power supply to RAM is switched off to save power. However if I create a static variable in a .noinit segment, which is not zeroed out as the .bss segment, that variable only contains random data after a true power on, not after the low power state that is supposed to be standby. I think this confirms that it is not entering standby mode. So how can I make it enter standby mode if PWR_EnterSTANDBYMode() is not doing the job ?

br HÃ¥kan
Posted on August 06, 2014 at 22:51

No specific experience with STANDBY on the F0, just other STM32 parts.

You're not trying to do this attached to a debugger, right?

Having an LED toggle under interrupt might be illustrative.

RAM may be uninitialized, doesn't mean it's cleared or randomized. The C startup code may explicitly zero or copy statics at reset.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
h23
Associate II
Posted on August 07, 2014 at 09:38

Hi,

Regarding debugger; no I don't have any debugger attached.

It does go to STOP mode, so a LED in interrupt context stops flashing.

Maybe I was not clear what I did with RAM. I created a section in the linker script which is _not_ zero'ed as the ordinary bss segment. I can see that it works since the static variable put in this segment is uninitialized after a POR, different random value after each POR. After that I write a known value to it, set the IWDG to 10 secs and call PWR_EnterSTANDBYMode()

What I would  expect is that I would wake up after 10 secs and have the static variable in the noinit -segment uninitialized again, but what happens is that I wake up after 10 secs and the known value is seen in the variable. My conclusion is that the device has been in 

STOP mode, not STANDBY since the power to the RAM is switched off in STANDBY and thus I would have uninitialized content in the variable if I had been in STANDBY.

Yes, I've checked the startup code and of course it does initialize the .bss segment to zero at startup, but not the new .noinit segment that I created.

br HÃ¥kan

h23
Associate II
Posted on August 12, 2014 at 17:10

Hi,

Still having problems with this. Anyone that can confirm that they've actually had a STM32F0xx in standby mode ? It is not obvious to see that it has been in Standby and not Stop mode. I can think of three different ways. All these alternatives indicate that my device goes to Stop mode and not Standby:

1. Check if nRST_STANDBY or n RST_STOP (option byte) prevents the power mode to be entered. If nRST_STANDBY makes no difference, the device is not entering Standby mode.

2. Look at the SBF bit in PWR_CSR register after wakeup.

3. Have a section in RAM which is not set to zero during reset/power on (requires a little fiddling with the linker script). Put a variable in that section and give it a known value before entering Standby mode. If the value is still there after waking up, it has not been in Standby since the RAM has no power in Standby mode as far as I understand.

Any help on this matter is appreciated.

br Håkan
h23
Associate II
Posted on August 13, 2014 at 13:34

Hi,

My bad :(

I had forgotten to enable the PWR clock in the ABP1ENR register.

My guess is, when I'm doing this without enabling the PWR clock, the cortexM core goes to deepsleep, but the ST-specific Standby mode is not entered. It looks like it enters Stop mode, but when measuring power consumption it is still way too high, ~600 uA while it should be less than 10 uA.

Anyway, when enabling the PWR clock it works as expected, SBF bit is set when waking up, RAM contains random value in a noinit-section.

I think it could be a bit more clear in the reference manual that the PWR clock must be enabled, but maybe it is too obvious.

br Håkan