cancel
Showing results for 
Search instead for 
Did you mean: 

Can't exit Stopmode using Threadx and NetxDuo on STM32 microcontroller

CostaMH
Associate
I'm working on a project where we have to program an STM32 board to enter stop mode and only wake up when an Ethernet packet is received (wake-on-lan function). I started by installing the ThreadX OS with NetX Duo and simply enabling stop mode, but it doesn't wake up! I programmed the user button to generate EXTI interrupts, but nothing happens. I tried this same strategy without NetX Duo, and it seems to work fine.
  • used borad: NUCLEO - H563ZI

this is what i do to start StopMode (this code is the NetxDuo thread function):

static VOID nx_app_thread_entry (ULONG thread_input)
{
  /* USER CODE BEGIN Nx_App_Thread_Entry 0 */

    HAL_SuspendTick();
    HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);

  /* USER CODE END Nx_App_Thread_Entry 0 */

}

and this is how i setup the controller:

CostaMH_0-1716732617075.png

 

I tried what's shown in the figure, i was expecting the execution to continue after pressing the button. If it worked i would have start to work on the Ethernet wake up.

if more information are needed i will provide them as soon as i can.

 
1 ACCEPTED SOLUTION

Accepted Solutions
STea
ST Employee

Hello @CostaMH ,

I think that you are missing some steps to be able to enter and exit stop mode in a safe way, so my recommendations are to follow the example implemented in Repository\STM32Cube_FW_U5_V1.4.0\Projects\NUCLEO-U5A5ZJ-Q\Applications\ThreadX\Tx_LowPower and adapt it to the stm32H563.

  • In fact, you need to do the following steps before entering:
  • Enable Power Clock 
  •  Switch to SMPS
  •  Configuration of the LPM read mode
  • Set all GPIO in analog state to reduce power consumption except GPIOC to keep user button interrupt enabled
  • Disable AHB APB Peripheral Clock

on exit you should:

  • Enable AHB APB Peripheral Clock
  • Reconfigure the system clock
  • reinitialize the GPIO

another Tips in trying to visualize the signals CSLEEP and CSTOP pins to know the state of your device and if it really entered a stop mode.
here is the snippet describing the state of this pins from STM32H523/33xx, STM32H562/63xx, and STM32H573xx Arm<Sup>®</Sup>-based 32-bit MCUs - Reference manual

STea_0-1716809198275.png

 

BR

In order 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

4 REPLIES 4
STea
ST Employee

Hello @CostaMH ,

I think that you are missing some steps to be able to enter and exit stop mode in a safe way, so my recommendations are to follow the example implemented in Repository\STM32Cube_FW_U5_V1.4.0\Projects\NUCLEO-U5A5ZJ-Q\Applications\ThreadX\Tx_LowPower and adapt it to the stm32H563.

  • In fact, you need to do the following steps before entering:
  • Enable Power Clock 
  •  Switch to SMPS
  •  Configuration of the LPM read mode
  • Set all GPIO in analog state to reduce power consumption except GPIOC to keep user button interrupt enabled
  • Disable AHB APB Peripheral Clock

on exit you should:

  • Enable AHB APB Peripheral Clock
  • Reconfigure the system clock
  • reinitialize the GPIO

another Tips in trying to visualize the signals CSLEEP and CSTOP pins to know the state of your device and if it really entered a stop mode.
here is the snippet describing the state of this pins from STM32H523/33xx, STM32H562/63xx, and STM32H573xx Arm<Sup>®</Sup>-based 32-bit MCUs - Reference manual

STea_0-1716809198275.png

 

BR

In order 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.

Hi, sorry to bother you again. Our problem has changed. It seems that if we use NetxDuo, our board doesn't enter sleep mode anymore; it just bypasses the HAL_PWR_EnterSTOPMode function without stopping. This happens only when we use NetxDuo. Do you have any idea why this happens?

 

Hello @CostaMH ,

try implementing the steps as described and as found in the example and give us the status of CSLEEP and CSTOP pins if it is not working as expected. 
know on what is happening the behavior is not clear so we need to get results after following those steps to be able to analyze it would help if you can share you code to have a look at it.

BR

In order 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.

Hello @CostaMH ,

Yes, it is possible, for visibility purposes I will be closing the following request and open a new one with the new question.

BR

In order 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.