Skip to main content
AlexandrX
Associate II
May 13, 2022
Question

STM32L151CBT6A MCU, Enter stop mode have biggest power consumption - above 960uA, but datasheet is ~2..10uA ? And MCU not wake up from STOP by RTC WKUP

  • May 13, 2022
  • 6 replies
  • 2422 views

Code of main cycle:

// Some "works"...
ipf("Works 5 sec\n\r");
HAL_Delay(5000);
 
// Prepare...
ipf("Power save STOP mode 5 sec\n\r");
double CounterVal = 5000 * 2.3125;
if (HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, (uint32_t)CounterVal, RTC_WAKEUPCLOCK_RTCCLK_DIV16) != HAL_OK)
{
	Error_Handler();
}
HAL_SuspendTick();
 
// Enter STOP
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
 
// Exit, reconfig clocks & resume tick timer
SystemClock_Config();
HAL_ResumeTick();

LSI used by 37.0 KHz.

1. After HAL_PWR_EnterSTOPMode CPU goes to STOP, but POWER consumption ~960uA, why??

2. Why MCU not wakeup from RTC WKUP? Interrupt does not works...

This topic has been closed for replies.

6 replies

waclawek.jan
Super User
May 13, 2022

If you have debugger connected, the processor core continues to run, consuming power, see DBGMCU_CR.

For wakeup, make sure you follow all these steps:

0693W00000NpvQZQAZ.pngi.e. read out and check all relevant RTC and EXTI registers content.

JW

AlexandrX
AlexandrXAuthor
Associate II
May 13, 2022

If debugger connected power 960uA, after disconnect debugger - 810uA, bot not 2..10uA

RTC wake-up EXTI line 20 is Enabled.

RTC CR->WUTIE setted

RTC CR->WUTE setted

But not works...

And RTC Wake-up configured time to to wake-up by HAL_RTCEx_SetWakeUpTimer_IT

Andrew Neil
Super User
May 13, 2022

Do you have peripherals still active?

Are you sure that's all coming from the STM32 chip?

What else is on your board?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
AlexandrX
AlexandrXAuthor
Associate II
May 13, 2022

SPI Flash Winbond W25Q127 onboard, and its all..

Andrew Neil
Super User
May 13, 2022

so what current is that drawing?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
AlexandrX
AlexandrXAuthor
Associate II
May 13, 2022

Unsolder Winbond, and 4-8uA, supply Flash separately and 956uA...

Andrew Neil
Super User
May 13, 2022

@AlexandrX​ "Unsolder Winbond, and 4-8uA, supply Flash separately and 956uA."

Sorry, not quite clear what you mean by that?

With just the STM32 chip alone - no Winbond - you get 4-8uA ?

So the STM32 itself is actually going into low-power correctly, and your problem is something to do with the Winbond?

"supply Flash separately and 956uA."

I don't understand that bit - may be easier to describe with a diagram.

Maybe you you have problems with floating lines, leakage, back-feeding, or the like.

You need to be careful to put IO lines into appropriate states...

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
waclawek.jan
Super User
May 13, 2022

> If debugger connected power 960uA, after disconnect debugger - 810uA, bot not 2..10uA

Did you power-reset after disconnecting debugger?

> And RTC Wake-up configured time to to wake-up by HAL_RTCEx_SetWakeUpTimer_IT

It's irrelevant that you've used some "library" function - since you've used it, it's part of your code thus your responsibility. Cube/HAL is open source so you can look at it, and you can check the registers content it changes.

Does the wakeup interrupt work without going to sleep?

JW

AlexandrX
AlexandrXAuthor
Associate II
May 13, 2022

I now check this...

Interesting, I set, for example 5 sec for WKUP, 5 sec power consumption is 4.5uA, after 5 sec some thing happens and current up to 145uA, but MCU not wake-up. If set 10 sec, then 10 sec 4.5uA and after 145uA, but, MCU not wake up...

AlexandrX
AlexandrXAuthor
Associate II
May 13, 2022

Without STOP WKAP still not works. REGs cheked all OK :(, ideas?

waclawek.jan
Super User
May 14, 2022

How do you observe whether wakeup works or not?

Toggle a pin in the ISR and observe it using oscilloscope/LA. If it toggles, wakeup worked, and you have some other problem.

JW

AlexandrX
AlexandrXAuthor
Associate II
May 14, 2022

At the moment it is known:

1. WKUP IT works in normal mode (IT priority 0)

2. WKUP IT works in SLEEP mode (IT priority 0)

3. WKUP IT NOT works in STOP mode (IT priority 0)

4. Try to enter in stanby mode leads to immediate reboot...

No need toggle pin, terminal shows data...

Why SLEEP mode WKAP IT works, but in STOP NOT works, ideas?

AlexandrX
AlexandrXAuthor
Associate II
May 14, 2022

Solved:

// wait for TIM6 (HAL timebase) complite current IT (if pending)
while (0 != TIM6->SR) { }
// clear WU flag
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
// Go to stop mode
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);

__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);

But without works correctly in SLEEP mode...