cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WL LPTIM2 and LPTIM3 Not working

Karthi
Associate II

Hi

When LPTIM2 and LPTIM3 enabled with "Count Extenal Clock with internal sync" with LPTIM2 Global interupt Enabled, it is not calling void HAL_LPTIM_AutoReloadMatchCallback(LPTIM_HandleTypeDef *hlptim)

But LPTIM1 is working perfectly as expected , it is calling  HAL_LPTIM_AutoReloadMatchCallback(LPTIM_HandleTypeDef *hlptim)

 

Karthi_0-1729928311003.png

Karthi_1-1729928328754.png



 

 /* USER CODE END LPTIM2_Init 1 */
  hlptim2.Instance = LPTIM2;
  hlptim2.Init.Clock.Source = LPTIM_CLOCKSOURCE_APBCLOCK_LPOSC;
  hlptim2.Init.Clock.Prescaler = LPTIM_PRESCALER_DIV1;
  hlptim2.Init.UltraLowPowerClock.Polarity = LPTIM_CLOCKPOLARITY_FALLING;
  hlptim2.Init.UltraLowPowerClock.SampleTime = LPTIM_CLOCKSAMPLETIME_DIRECTTRANSITION;
  hlptim2.Init.Trigger.Source = LPTIM_TRIGSOURCE_SOFTWARE;
  hlptim2.Init.OutputPolarity = LPTIM_OUTPUTPOLARITY_HIGH;
  hlptim2.Init.UpdateMode = LPTIM_UPDATE_IMMEDIATE;
  hlptim2.Init.CounterSource = LPTIM_COUNTERSOURCE_EXTERNAL;
  hlptim2.Init.Input1Source = LPTIM_INPUT1SOURCE_GPIO;
  hlptim2.Init.Input2Source = LPTIM_INPUT2SOURCE_GPIO;
  if (HAL_LPTIM_Init(&hlptim2) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN LPTIM2_Init 2 */
  HAL_LPTIM_Counter_Start_IT(&hlptim2,PULSE_WAUP_COUNT);
   

 

  


Exmaple used was LoRaWAN_End_Node, STteam Please check and update

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
STTwo-32
ST Employee

Hello @Karthi 

In fact, the LPTIM1 can be configured to wakeup the MCU from STOP2 mode but the LPTIM2 & 3 can't wakeup the MCU from STOP2 mode. On the LoRaWAN_End_Node example, the #define LOW_POWER_DISABLE is set to 0 as a default value, that means the MCU can enter STOP2 mode. So, the LPM (Low Power Manager) will put the MCU to STOP2 mode on the sequencer IDLE task. If you want to use the LPTIM2 & 3, you have to set the #define LOW_POWER_DISABLE to 1 so on the IDLE task, the MCU is putted to SLEEP mode.

Best Regards.

STTwo-32 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

3 REPLIES 3
STTwo-32
ST Employee

Hello @Karthi 

In fact, the LPTIM1 can be configured to wakeup the MCU from STOP2 mode but the LPTIM2 & 3 can't wakeup the MCU from STOP2 mode. On the LoRaWAN_End_Node example, the #define LOW_POWER_DISABLE is set to 0 as a default value, that means the MCU can enter STOP2 mode. So, the LPM (Low Power Manager) will put the MCU to STOP2 mode on the sequencer IDLE task. If you want to use the LPTIM2 & 3, you have to set the #define LOW_POWER_DISABLE to 1 so on the IDLE task, the MCU is putted to SLEEP mode.

Best Regards.

STTwo-32 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Let us try, Will provide you feedback @STTwo-32 

Karthi
Associate II

Hi @STTwo-32 

LPTIM2 & 3, is working with #define LOW_POWER_DISABLE to 1

Thanks