Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Flipper-Zero/STM32CubeWB.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Projects/P-NUCLEO-WB55.USBDongle/Applications/Thread/Thread_Coap_Generic/Core/Src/stm32_lpm_if.c')
-rw-r--r--Projects/P-NUCLEO-WB55.USBDongle/Applications/Thread/Thread_Coap_Generic/Core/Src/stm32_lpm_if.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/Projects/P-NUCLEO-WB55.USBDongle/Applications/Thread/Thread_Coap_Generic/Core/Src/stm32_lpm_if.c b/Projects/P-NUCLEO-WB55.USBDongle/Applications/Thread/Thread_Coap_Generic/Core/Src/stm32_lpm_if.c
index f024b61e3..1418e0a36 100644
--- a/Projects/P-NUCLEO-WB55.USBDongle/Applications/Thread/Thread_Coap_Generic/Core/Src/stm32_lpm_if.c
+++ b/Projects/P-NUCLEO-WB55.USBDongle/Applications/Thread/Thread_Coap_Generic/Core/Src/stm32_lpm_if.c
@@ -70,6 +70,13 @@ static void Switch_On_HSI( void );
void PWR_EnterOffMode( void )
{
/* USER CODE BEGIN PWR_EnterOffMode */
+
+ /**
+ * The systick should be disabled for the same reason than when the device enters stop mode because
+ * at this time, the device may enter either OffMode or StopMode.
+ */
+ HAL_SuspendTick();
+
/************************************************************************************
* ENTER OFF MODE
***********************************************************************************/
@@ -106,6 +113,8 @@ void PWR_ExitOffMode( void )
{
/* USER CODE BEGIN PWR_ExitOffMode */
+ HAL_ResumeTick();
+
/* USER CODE END PWR_ExitOffMode */
}
@@ -119,6 +128,16 @@ void PWR_EnterStopMode( void )
{
/* USER CODE BEGIN PWR_EnterStopMode */
/**
+ * When HAL_DBGMCU_EnableDBGStopMode() is called to keep the debugger active in Stop Mode,
+ * the systick shall be disabled otherwise the cpu may crash when moving out from stop mode
+ *
+ * When in production, the HAL_DBGMCU_EnableDBGStopMode() is not called so that the device can reach best power consumption
+ * However, the systick should be disabled anyway to avoid the case when it is about to expire at the same time the device enters
+ * stop mode ( this will abort the Stop Mode entry ).
+ */
+ HAL_SuspendTick();
+
+ /**
* This function is called from CRITICAL SECTION
*/
while( LL_HSEM_1StepLock( HSEM, CFG_HW_RCC_SEMID ) );
@@ -202,6 +221,9 @@ void PWR_ExitStopMode( void )
/* Release RCC semaphore */
LL_HSEM_ReleaseLock( HSEM, CFG_HW_RCC_SEMID, 0 );
+
+ HAL_ResumeTick();
+
/* USER CODE END PWR_ExitStopMode */
}