Skip to main content
FAlpa.1
Associate
August 3, 2024
Solved

STM32WLE5 EndNode Application Always Wake Up from SHUTDOWN Mode

  • August 3, 2024
  • 1 reply
  • 829 views

Hello everyone , I am try to learn lorawan on a STM32WLE5 module, I am using this repository(https://github.com/Seeed-Studio/LoRaWan-E5-Node/tree/main/Projects/Applications/LoRaWAN/LoRaWAN_End_Node) for developing lorawan application. It works well but I need put device into shutdown mode after a lorawan communication. But when I use  

HAL_SuspendTick();
HAL_PWREx_EnterSHUTDOWNMode();

commands it always restarts immediately. 

 

Best Regards

My code 

int main(void)
{
/* USER CODE BEGIN 1 */

/* USER CODE END 1 */

/* MCU Configuration--------------------------------------------------------*/

/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();

/* USER CODE BEGIN Init */

/* USER CODE END Init */

/* Configure the system clock */
SystemClock_Config();

/* USER CODE BEGIN SysInit */

/* USER CODE END SysInit */

/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_DMA_Init();
MX_USART1_UART_Init();
MX_LoRaWAN_Init();
/* USER CODE BEGIN 2 */

/* USER CODE END 2 */

/* Infinite loop */
/* USER CODE BEGIN WHILE */

while (1)
{
/* USER CODE END WHILE */
MX_LoRaWAN_Process();
HAL_SuspendTick();
HAL_PWREx_EnterSHUTDOWNMode();
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}

Best answer by STTwo-32

Hello @FAlpa.1 

In fact, the "MX_LoRaWAN_Process();" is starting a sequencer that run all configured tasks and enter an IDLE task (to set a stop mode) if there is no task ready to run. So, the "HAL_SuspendTick();" and the "HAL_PWREx_EnterSHUTDOWNMode();" never get executed since the "MX_LoRaWAN_Process();" never ends. 

So, to enter a Low power mode, you have to set a task that enter and exit the Low power mode and add it to the program sequencer.

Best Regards.

STTwo-32

 

1 reply

STTwo-32
STTwo-32Best answer
Technical Moderator
August 9, 2024

Hello @FAlpa.1 

In fact, the "MX_LoRaWAN_Process();" is starting a sequencer that run all configured tasks and enter an IDLE task (to set a stop mode) if there is no task ready to run. So, the "HAL_SuspendTick();" and the "HAL_PWREx_EnterSHUTDOWNMode();" never get executed since the "MX_LoRaWAN_Process();" never ends. 

So, to enter a Low power mode, you have to set a task that enter and exit the Low power mode and add it to the program sequencer.

Best Regards.

STTwo-32