cancel
Showing results for 
Search instead for 
Did you mean: 

Getting elapsed time after stop mode

Frak.1
Associate II

Hello,

I am looking for help. I am using stm32L0. The problem is as follows:

ST goes in stop mode for example 5 seconds. After 2 second some interrupt wakes the ST. Then I want go in stop mode for the remaining time which in this case is 3 seconds. Is there any possibility to get time between entering stop mode and occuring interrupt?

Filip

6 REPLIES 6
MM..1
Chief II

RTC

You can use RTC or maybe LPTIM in STOP mode, running from LSI (if precision is enough) or LSE.

Read the "Low-power modes" subchapter of PWR chapter of RM, for details of STOP mode.

JW

Frak.1
Associate II

I forgot to mention that I'm curently using RTC for slepping defined time. The problem is that I found information that there is no possibily to read slepping timer after wakeup. Correct me if it's false.

LPTIM seems fine. I don't need high precision only more or less. So maybe I can start timer before going into stop mode and read value when interrupt comes. Then I can evaluate elapsed time.

My device has to be very low power. Does using LPTIM will consume more power?

> [RTC] I found information that there is no possibily to read slepping timer after wakeup.

Where?

You surely can re​ad RTC after wakeup. If BYPSHAD bit is cleared, it takes quite some time until the shadow registers are updated, but you can set BYPSHAD and use the appropriate procedure to read consistent data from RTC.

> Does using LPTIM will consume more power?

Every clocked circuit consumes power, see datasheet for data.

JW​

Here is where I found this information and even you have posted this answer:

https://community.st.com/s/question/0D50X00009Xke0LSAR/stm32l0-getting-rtc-wakeup-counter

I will try do some tests and figure it out with your advices.

>> [RTC] I found information that there is no possibily to read slepping timer after wakeup.

> Here is where I found this information

Ah, I see. I

t's not possible to read out the internal 16-bit wakeup counter or RTC, indeed, so you have to read TR/DR/SSR and calculate the elapsed time from them. That is not as simple as calculating time from a "linear" counter (plus the readout is not that trivial, too, see the text under link given above, i.e. BYPSHAD=1 and read-twice-and-repeat-if-not-matching), so you may want to decide whether the relative more comfortable programming of LPTIM is worth the extra current consumption.

JW