2022-12-06 12:54 PM
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
Solved! Go to Solution.
2022-12-08 06:19 AM
@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.
2022-12-07 07:27 AM
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
2022-12-08 12:41 AM
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.
2022-12-08 05:38 AM
Hello @HDIA.1 ,
So you never reach the callback function in your example ?
Regards
Louis
2022-12-08 05:45 AM
@Louis AUDOLY
Exactly. in low power mode with the end node exemple i never reach the ISR for LPTIM
2022-12-08 06:06 AM
2022-12-08 06:19 AM
@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.
2022-12-08 06:34 AM
@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
2022-12-08 07:22 AM
@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
2022-12-12 09:47 AM
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