STM32G0B1RE ThreadX - Going to sleep
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?
