AnsweredAssumed Answered

Modified LPTIM_PWM_LSE demo does not work as expected with LPTIM2

Question asked by Geoffrey Davis on Jul 5, 2017
Latest reply on Jul 7, 2017 by Geoffrey Davis

With the STM32L476ZGT6 Evaluation board, which I've just started to use, I tried the LPTIM_PWM_LSE demo successfully (after modifying timer frequency to make LED blink at 1Hz). I then attempted to change the demo to use LPTIM2 instead. I noted that this did not produce the same result as for LPTIM1 where the LED would blink until Wkup/Tamper was triggered - the LED just stays on.

 

main.c changes:

1) RCC_PeriphCLKInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LPTIM2;

2) RCC_PeriphCLKInitStruct.Lptim2ClockSelection = RCC_LPTIM2CLKSOURCE_LSE;

3) LptimHandle.Instance = LPTIM2;

4) HAL_PWREx_EnterSTOP1Mode(PWR_STOPENTRY_WFI);  (instead of STOP2, since LPTIM2 doesn't work in STOP2)

 

stm32l4xx_hal_msp changes:

1) Changed "LPTIM1" to "LPTIM2" for all functions containing "LPTIM1" in the name

2) GPIO_InitStruct.Alternate = GPIO_AF14_LPTIM2;

 

Any insights into why I cannot substitute LPTIM2 for LPTIM1 in this demo?

 

Thanks!

Outcomes