2023-03-01 10:19 PM
Case 1: without STOP2 mode UTIL_SEQ_SetTask or HW_TS_Start working fine.
Case 2: without UTIL_SEQ_SetTask or HW_TS_Start calling, the device can go to sleep and wake up without any problem.
case 3: when the device wakes up and after the device wakeup, if I use UTIL_SEQ_SetTask or HW_TS_Start device hangs up, and I am unable to debug also.
================Sleep code==========================
while (1)
{
/* USER CODE END WHILE */
MX_APPE_Process();
/* USER CODE BEGIN 3 */
if(Go_TO_SLEEP)
{
Go_TO_SLEEP = false;
HAL_GPIO_WritePin(MY_LED_GPIO_Port, MY_LED_Pin,1);
HAL_Delay(5000);
HAL_GPIO_WritePin(MY_LED_GPIO_Port, MY_LED_Pin,0);
GPIO_InitStructure.Pin = GPIO_PIN_All;
GPIO_InitStructure.Mode = GPIO_MODE_ANALOG;
GPIO_InitStructure.Pull = GPIO_NOPULL;
// HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
// HAL_GPIO_Init(GPIOB, &GPIO_InitStructure);
HAL_GPIO_Init(GPIOC, &GPIO_InitStructure);
HAL_GPIO_Init(GPIOD, &GPIO_InitStructure);
HAL_GPIO_Init(GPIOE, &GPIO_InitStructure);
HAL_GPIO_Init(GPIOH, &GPIO_InitStructure);
// __HAL_RCC_GPIOA_CLK_DISABLE();
// __HAL_RCC_GPIOB_CLK_DISABLE();
__HAL_RCC_GPIOC_CLK_DISABLE();
__HAL_RCC_GPIOD_CLK_DISABLE();
__HAL_RCC_GPIOE_CLK_DISABLE();
__HAL_RCC_GPIOH_CLK_DISABLE();
DBGMCU->CR = 0;
HAL_SuspendTick();
LL_C2_PWR_SetPowerMode(LL_PWR_MODE_STOP2);
HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);
}
=================================================================
==============EXTI Wakeup code===============================
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
SystemClock_Config();
HAL_ResumeTick();
UTIL_SEQ_SetTask(1 << CFG_TASK_ISR_CALLBACK, CFG_SCH_PRIO_0);
HAL_GPIO_WritePin(MY_LED_GPIO_Port, MY_LED_Pin,1);
Go_TO_SLEEP = true;
}
==========================================
Without sleep modes my implementation works fine, when i use sleep modes, once device wakeup's not able to use UTIL_SEQ_SetTask or HW_TS_Start.
Can someone please help me with my problem
Thank you,
2023-04-21 09:23 AM
Hello,
You can look BLE_HeartRate example available in STM32CubeWB package that allow to perform stop2 low power mode using low power manager.
Best Regards