2023-12-20 11:15 AM
Currently having some issues getting a ThreadX stack (ThreadX/NetX/USBX) to play nice and go to sleep after a certain timeout period on a nucleo board. I'm hoping to get some guidance on what might be causing my issues. I'm able to get sleep to work w/o TX just fine but with it, simply doing:
void App_ThreadX_LowPower_Enter(void)
{
HAL_SuspendTick();
HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFI);
}
void App_ThreadX_LowPower_Exit(void)
{
SystemClock_Config();
HAL_ResumeTick();
}
Results in the system waking up on each SysTick. Disabling the SysTick interrupt solves this issue but once I do this, the system no longer switches between threads correctly, and tx_thread_sleep is borked as well.
void App_ThreadX_LowPower_Enter(void)
{
HAL_SuspendTick();
CLEAR_BIT(SysTick->CTRL, SysTick_CTRL_TICKINT_Msk);
HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFI);
}
void App_ThreadX_LowPower_Exit(void)
{
SystemClock_Config();
SET_BIT(SysTick->CTRL, SysTick_CTRL_TICKINT_Msk);
HAL_ResumeTick();
}
As of right now I have TX_LOW_POWER_TICKLESS defined as I don't *think* keeping track of the time in sleep is necessary. Any ideas on how to fix this?
2023-12-21 02:07 AM
2023-12-21 06:02 AM
Hey! So I was able to get stop mode working which is good, but from what I've read, the high speed clocks and timers are shut off in this mode, which I don't think is compatible with my use case. I need to be able to be able to wake up from sleep when either data is received over SPI or when a network packet is received over USB, which I believe requires the clocks and timers to keep running. Its the fact that stop mode works while sleep doesn't that leads me to believe that the issue stems from Systick, but I could be mistaken.
2023-12-21 08:57 AM
Hi @pm4321
The forum moderator had marked your post as needing a little more investigation and direct support. An online support case has been created on your behalf, please stand by for just a moment and you will hear from us.
Regards,
Billy
2023-12-21 06:46 PM
And why exactly are you calling the SystemClock_Config() after the Sleep mode?
2023-12-22 07:03 AM
Hi @pm4321
Could you modify the example above and add your App_ThreadX_LowPower_Enter()/App_ThreadX_LowPower_Exit() and confirm whether it works or not?
regards
Haithem.