cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to wakeup from stop mode with LPTIM

HDIA.1
Associate III

Hello,

I have a STM32WLE5JB, and a want to wakeup the chip from sleep mode to have multiple task. (Read a sensor every x sec) externally from the RTC that is tied to the lora TX delay.

So i have the code that include the lora stack without any modifications.

Just setting the LPTIM module (counter mode), enable the IRQ in NVIC tab and setting the clock source : LSE / LSI ( multiple tries ).

But the chip is unable to wakeup with the callback function. (Tested with a LED).

With the low power disabled the LPTIM work as intended.

Below the zip containing the project.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
HDIA.1
Associate III

@Louis AUDOLY​ 

The issue for this topic was that LPTIM2, and 3 can only work in stop mode 0 and 1 (in datasheet).

Do you know how to force the generation of the code to set the function "PWR_EnterStopMode(void)" to generate only "HAL_PWREx_EnterSTOP1Mode(PWR_STOPENTRY_WFI)" , and not "HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI)"

void PWR_EnterStopMode(void)
{
  /* USER CODE BEGIN EnterStopMode_1 */
 
  /* USER CODE END EnterStopMode_1 */
  HAL_SuspendTick();
  /* Clear Status Flag before entering STOP/STANDBY Mode */
  LL_PWR_ClearFlag_C1STOP_C1STB();
 
  /* USER CODE BEGIN EnterStopMode_2 */
  HAL_PWREx_EnterSTOP1Mode(PWR_STOPENTRY_WFI);
  /* USER CODE END EnterStopMode_2 */
  HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);
  /* USER CODE BEGIN EnterStopMode_3 */
 
  /* USER CODE END EnterStopMode_3 */
}

Thanks for the help.

View solution in original post

9 REPLIES 9
Louis AUDOLY
ST Employee

Hello @HDIA.1​ ,

There is an example using the LPTIM in Stop mode that you can find in the STM32Cube_FW_WL_V1.3.0, under "Projects\NUCLEO-WL55JC\Examples\LPTIM\LPTIM_PulseCounter".

Could you test this example and compare your config with this one ?

I hope this will help you.

Rgards

Louis

HDIA.1
Associate III

Hello @Louis AUDOLY​ 

With the exemple given in STM32Cube_FW_WL_V1.3.0, Just by adding a GPIO toggle on the "HAL_LPTIM_AutoReloadMatchCallback" ISR and "HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);" in the main loop the LPTIM work as intended.

It seems that the LoRa stack " end_node" exemple the way that the low power is managed create a issue with LPTIM.

Louis AUDOLY
ST Employee

Hello @HDIA.1​ ,

So you never reach the callback function in your example ?

Regards

Louis

HDIA.1
Associate III

@Louis AUDOLY​ 

Exactly. in low power mode with the end node exemple i never reach the ISR for LPTIM

HDIA.1
Associate III

@Louis AUDOLY​ 

So i found a issue.

Only the module LPTIM1 is able to trigger the ISR in stop mode.

Here the zip file of the code.

Thanks

HDIA.1
Associate III

@Louis AUDOLY​ 

The issue for this topic was that LPTIM2, and 3 can only work in stop mode 0 and 1 (in datasheet).

Do you know how to force the generation of the code to set the function "PWR_EnterStopMode(void)" to generate only "HAL_PWREx_EnterSTOP1Mode(PWR_STOPENTRY_WFI)" , and not "HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI)"

void PWR_EnterStopMode(void)
{
  /* USER CODE BEGIN EnterStopMode_1 */
 
  /* USER CODE END EnterStopMode_1 */
  HAL_SuspendTick();
  /* Clear Status Flag before entering STOP/STANDBY Mode */
  LL_PWR_ClearFlag_C1STOP_C1STB();
 
  /* USER CODE BEGIN EnterStopMode_2 */
  HAL_PWREx_EnterSTOP1Mode(PWR_STOPENTRY_WFI);
  /* USER CODE END EnterStopMode_2 */
  HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);
  /* USER CODE BEGIN EnterStopMode_3 */
 
  /* USER CODE END EnterStopMode_3 */
}

Thanks for the help.

Louis AUDOLY
ST Employee

@HDIA.1​ ,

Perfect if you manage to solve your issue.

In CubeMx you go on the tab "Tools" on the right and you can modify the stop mode you want for your project

Regards

Louis

HDIA.1
Associate III

@Louis AUDOLY​ 

I Changed the stop mode in the PCC on tool menu but the generation of the code still keep the stop mode 2.

Thanks

Louis AUDOLY
ST Employee

Hello @HDIA.1​ 

That's true, I just notice the "Sequence Information Notes" in the PCC tab on the Tools menu specify "The PCC sequence has no impact on code generation." It just do some simulation but does not allows you to modify code.

You have to do it by hand, sorry for the wrong information.

Regards

Louis