2024-08-03 08:32 AM
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 */
}
Solved! Go to Solution.
2024-08-09 05:41 AM
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
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.
2024-08-09 05:41 AM
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
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.