2020-04-01 10:41 PM
Hi, I have an STM32L072 micro. I need to count the transitions on two IO pins.
I would like to do it while the MCU is in sleep mode and periodically wake to process the results.
In this MCU there is only one LPTIMer . Is it possible to configure the other timers to capture the transitions in counter mode without waking the MCU?
Thank You
Regards
2020-04-02 06:48 AM
> The devices feature five low-power modes:
> • Low-power run mode: regulator in low-power mode, limited clock frequency, limited
> number of peripherals running (refer to Section 6.3.4)
> • Sleep mode: Cortex®-M0+ core stopped, peripherals kept running (refer to
> Section 6.3.7)
> • Low-power sleep mode: Cortex®-M0+core stopped, limited clock frequency, limited
> number of peripherals running, regulator in low-power mode, Flash stopped ((refer to
> Section 6.3.8))
> • Stop mode (all clocks are stopped, regulator running, regulator in low-power mode
> (refer to Section 6.3.9)
> • Standby mode: VCORE domain powered off ((refer to Section 6.3.10))
You can keep peripherals active during sleep mode, not just the LP ones.
2020-04-02 07:55 AM
All peripherals continue working in sleep mode by default, only code execution is stopped. Just configure two timers in ECM1 or ECM2 to count edges.
The RCC can shut down selected peripherals automatically when in sleep mode, see the description of the RCC_AHBSMENR / RCC_APBxSMENR registers in the reference manual.
LPTIM is different because it can run in stop mode as well.
2020-04-02 09:12 AM
Sleep vs deep sleep. WFI saves a little power, Deep sleep much more. Low power run mode should also get considered.
2020-04-02 09:34 AM
Deep sleep is stop or standby, where normal timers are stopped, so it won't work.
Low power run or sleep would work, just one should mind the minimum pulse width of the input signal wrt the timer clock in order to not miss any pulses.