Skip to content

Commit 8b13c48

Browse files
committed
Power management rework to support STOP and STDBY mode without SCM
Power management has been splitted between rf driver and system. SCM is no more used. Signed-off-by: Alessandro Manganaro <[email protected]>
1 parent 126cbbe commit 8b13c48

File tree

4 files changed

+13
-23
lines changed

4 files changed

+13
-23
lines changed

lib/stm32wba/BLE_TransparentMode/Core/Inc/app_conf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ typedef enum
370370
* System Clock Manager module configuration
371371
******************************************************************************/
372372

373-
#define CFG_SCM_SUPPORTED (1)
373+
#define CFG_SCM_SUPPORTED (0)
374374

375375
/******************************************************************************
376376
* HW RADIO configuration

lib/stm32wba/BLE_TransparentMode/STM32_WPAN/Target/linklayer_plat.c

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "app_common.h"
2727
#include "app_conf.h"
2828
#include "linklayer_plat.h"
29-
#include "scm.h"
29+
3030
#include "log_module.h"
3131
#ifndef __ZEPHYR__
3232
#if (USE_TEMPERATURE_BASED_RADIO_CALIBRATION == 1)
@@ -36,14 +36,8 @@
3636
#include "stm32_lpm.h"
3737
#include "stm32_lpm_if.h"
3838
#endif /* (CFG_LPM_LEVEL != 0) */
39+
#endif
3940

40-
/* USER CODE BEGIN Includes */
41-
42-
/* USER CODE END Includes */
43-
44-
#else
45-
#include "scm.h"
46-
#endif /* __ZEPHYR__ */
4741

4842
#ifndef __ZEPHYR__
4943
#define max(a,b) ((a) > (b) ? a : b)
@@ -457,9 +451,6 @@ void LINKLAYER_PLAT_StartRadioEvt(void)
457451
{
458452
__HAL_RCC_RADIO_CLK_SLEEP_ENABLE();
459453
NVIC_SetPriority(RADIO_INTR_NUM, RADIO_INTR_PRIO_HIGH);
460-
#if (CFG_SCM_SUPPORTED == 1)
461-
scm_notifyradiostate(SCM_RADIO_ACTIVE);
462-
#endif /* CFG_SCM_SUPPORTED */
463454
}
464455

465456
/**
@@ -471,9 +462,6 @@ void LINKLAYER_PLAT_StopRadioEvt(void)
471462
{
472463
__HAL_RCC_RADIO_CLK_SLEEP_DISABLE();
473464
NVIC_SetPriority(RADIO_INTR_NUM, RADIO_INTR_PRIO_LOW);
474-
#if (CFG_SCM_SUPPORTED == 1)
475-
scm_notifyradiostate(SCM_RADIO_NOT_ACTIVE);
476-
#endif /* CFG_SCM_SUPPORTED */
477465
}
478466

479467
/**
@@ -488,10 +476,6 @@ void LINKLAYER_PLAT_RCOStartClbr(void)
488476
/* Disabling stop mode prevents also from entering in standby */
489477
UTIL_LPM_SetStopMode(1U << CFG_LPM_LL_HW_RCO_CLBR, UTIL_LPM_DISABLE);
490478
#endif /* (CFG_LPM_LEVEL != 0) */
491-
#if (CFG_SCM_SUPPORTED == 1)
492-
scm_setsystemclock(SCM_USER_LL_HW_RCO_CLBR, HSE_32MHZ);
493-
while (LL_PWR_IsActiveFlag_VOS() == 0);
494-
#endif /* (CFG_SCM_SUPPORTED == 1) */
495479
}
496480

497481
/**
@@ -505,10 +489,6 @@ void LINKLAYER_PLAT_RCOStopClbr(void)
505489
PWR_EnableSleepMode();
506490
UTIL_LPM_SetStopMode(1U << CFG_LPM_LL_HW_RCO_CLBR, UTIL_LPM_ENABLE);
507491
#endif /* (CFG_LPM_LEVEL != 0) */
508-
#if (CFG_SCM_SUPPORTED == 1)
509-
scm_setsystemclock(SCM_USER_LL_HW_RCO_CLBR, HSE_16MHZ);
510-
while (LL_PWR_IsActiveFlag_VOS() == 0);
511-
#endif /* (CFG_SCM_SUPPORTED == 1) */
512492
}
513493
#endif /*__ZEPHYR__*/
514494

lib/stm32wba/BLE_TransparentMode/STM32_WPAN/Target/ll_sys_if.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,10 @@ void ll_sys_reset(void)
289289
#if defined(__GNUC__) && defined(DEBUG)
290290
drift_time += DRIFT_TIME_EXTRA_GCC_DEBUG;
291291
exec_time += EXEC_TIME_EXTRA_GCC_DEBUG;
292+
#endif
293+
#if defined (__ZEPHYR__)
294+
drift_time += DRIFT_TIME_EXTRA_ZEPHYR;
295+
exec_time += EXEC_TIME_EXTRA_ZEPHYR;
292296
#endif
293297
}
294298

lib/stm32wba/BLE_TransparentMode/STM32_WPAN/Target/ll_sys_if.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,16 @@ extern "C" {
4242
#define DRIFT_TIME_DEFAULT (13)
4343
#define DRIFT_TIME_EXTRA_LSI2 (9)
4444
#define DRIFT_TIME_EXTRA_GCC_DEBUG (6)
45+
#ifdef __ZEPHYR__
46+
#define DRIFT_TIME_EXTRA_ZEPHYR (7)
47+
#endif
4548

4649
#define EXEC_TIME_DEFAULT (10)
4750
#define EXEC_TIME_EXTRA_LSI2 (3)
4851
#define EXEC_TIME_EXTRA_GCC_DEBUG (4)
52+
#ifdef __ZEPHYR__
53+
#define EXEC_TIME_EXTRA_ZEPHYR (5)
54+
#endif
4955

5056
#define SCHDL_TIME_DEFAULT (20)
5157
/* USER CODE BEGIN EC */

0 commit comments

Comments
 (0)