Skip to main content
patrick_hofstetter
Visitor II
September 19, 2016
Question

STM32l4 LPTimer and Stop mode

  • September 19, 2016
  • 1 reply
  • 1313 views
Posted on September 19, 2016 at 17:13

Hi,

I am new to programming the stm32 chips and I want to use the LPTimer to wake up from Stop mode. I used CubeMX to initialize the timer with interrupt. I use the LSI with no prescaler (I can change this of course), so the clock period would be 31,25 us. Now I want to do something in the while loop of the main function and go into stop mode. After x*32,25 microseconds the chip should wake up with a lptimer interrupt.

With the normal timers there was no problem doing this (tim6 and sleep mode) with the HAL_base_IT function. But there is no such HAL-function with the LPTimer.

I would be happy, if you could help me here,

Greetings

 
    This topic has been closed for replies.

    1 reply

    Nesrine M_O
    Associate
    September 20, 2016
    Posted on September 20, 2016 at 10:37

    Hi Yellowchip,

    I suggest you to have a look to this example under the STM32L4 cube firmware package:

    STM32Cube_FW_L4_V1.5.0\Projects\STM32L476RG-Nucleo\Examples\LPTIM\LPTIM_PulseCounter

    This example describes how to configure and use LPTIM to count pulses through the LPTIM HAL API.

    To reduce power consumption, MCU enters stop mode after starting counting. Each time the counter reachs the maximum value (Period/Autoreload), an interruption is generated, the MCU is woke up from stop mode and LED2 toggles the last state.

    -Syrine-