Skip to content

Commit 3a4b521

Browse files
asm5878erwango
authored andcommitted
stm32wbax pm reworked to support STOP/STDBY mode without SCM
Power management has been split between BLE HCI driver and system. Power management has been reworked to remove dependency on ST system clock manager (SCM) module. Signed-off-by: Alessandro Manganaro <[email protected]>
1 parent d3ff6cb commit 3a4b521

File tree

8 files changed

+13
-1190
lines changed

8 files changed

+13
-1190
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 (15)
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 (15)
54+
#endif
4955

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

lib/stm32wba/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ zephyr_sources(BLE_TransparentMode/STM32_WPAN/Target/power_table.c)
3131
zephyr_sources(Common/WPAN/Modules/Log/log_module.c)
3232
zephyr_sources(Common/WPAN/Interfaces/hw_pka.c)
3333
zephyr_sources(Common/WPAN/Interfaces/hw_pka_p256.c)
34-
zephyr_sources(Common/WPAN/Modules/scm.c)
3534
zephyr_sources(Common/WPAN/Modules/RTDebug/RTDebug.c)
3635
zephyr_sources(STM32_WPAN/link_layer/ll_sys/src/ll_sys_cs.c)
3736
zephyr_sources(STM32_WPAN/link_layer/ll_sys/src/ll_sys_dp_slp.c)

0 commit comments

Comments
 (0)