
Telink TLSR8232 BLE SDK Developer Handbook
AN-19112700-E1
122
Ver.1.0.0
void
bls_pm_setWakeupSource
(
u8
source);
This API sets a bottom-
layer variable “WakeupSource”. The actual variable in code is
“bls_pm.wakeup_src”.
The WakeupSource includes PM_WAKEUP_PAD, PM_WAKEUP_CORE,
PM_WAKEUP_TIMER, and their
“or” combinations.
If MCU enters suspend mode from Advertising state or Conn state Slave role, actual
system wakeup source should be:
WakeupSource | PM_WAKEUP_TIMER
The
“PM_WAKEUP_TIMER” is necessary and it does not depend on user configuration,
which ensures MCU can be woke up to process Adv Event or Brx Event.
The wakeup source conf
igured by “bls_pm_setWakeupSource” only applies to current
low power mode; once MCU is woken up from suspend or deepsleep, the
WakeupSource will be cleared in bottom layer and become invalid. The wakeup source
for suspend or deepsleep needs to be re-configured.
4.3.4 Working Mechanism of Low Power Managment
To better understand the configurations
of “SuspendMask” and “WakeupSource”, this
section introduces the principle of low power management mechanism.
In SDK, mainloop is a structure of while(1):
while(1)
{
blt_sdk_main_loop();
//UI task
}
“blt_sdk_main_loop” is being executed in while(1) all the time. As the code of BLE low
power management mechanism is in
“blt_sdk_main_loop”, it is also being executed all
the time.
Corresponding to BLE Link Layer timing sequence (section 3.2.4), two time parameters
are defined: “T_advertising” indicates the start time of Link Layer Adv Event in
Advertising state
; “T_brx” indicates the start time of Link Layer Brx Event in Conn state
Slave role.
In blt_sdk_main_loop, the pseudo code of low power management is shown as below:
int blt_sdk_main_loop (void)
{
……
if(SuspendMask == SUSPEND_DISABLE)
// SUSPEND_DISABLE, not enter low
power mode
{
return 0;
}