Telink TLSR8232 BLE SDK Developer Handbook
AN-19112700-E1
125
Ver.1.0.0
4.4
“latency_use” Configuration and Calculation
As introduced in working mechanism of low power management (section 4.3.4), if the
“suspendMask” is set as “SUSPEND_CONN” in Conn state Slave role, the actual
wakeup time should be:
wakeup_tick = T_brx + (late1) * conn_interval;
“T_brx”: Brx Event Rx time during current interval.
If
“latency_use” is 0, MCU must be woke up during next interval to listen for packets; if
“latency_use” is not 0, MCU can skip “latency_use” intervals to save power.
latency_use = bls_calculateLatency();
The calculation o
f “latency_use” involves “user_latency” which users can configure. The
API and source code are as below:
void
bls_pm_setManualLatency
(
u16
latency)
{
user_latency
= latency;
}
The following shows how to calculate
“latency_use”:
First calculate system latency:
1) If connection latency in current connection parameters is 0, system latency would be
0.
2) If connection latency in current connection parameters is not 0:
a) If current system has unfinished task (e.g. there are data to be sent, or there are
data received from Master to be processed), MCU must be woke up during next
interval to continue the task, so system latency should be 0.
b) If current system has no task to process, system latency should equal
connection latency
except in the case below: If “update map request” or “update
connection parameter request
” is received from Master, and the actual update
moment is earlier than (connection 1) intervals, the actual system
latency would ensure MCU is woke up during the interval before the actual
update moment, so as not to disturb BLE timing sequence.
Actually the eventual latency_use equals min(system latency, user_latency), i.e. the
minimum value of system latency and user_latency.
If the latency
manually configured by invoking “bls_pm_setManualLatency” during UI
entry is smaller than system latency, it can be used as the eventual latency_use. It only
applies to non-zero system latency.
Note that the final sentence of each “blt_sdk_main_loop” will set “user_latency” as
“0xffff”. Therefore, the user latency configured by calling “bls_pm_setManualLatency”
only applies to the current suspend.
4.5 Other APIs
This section provides descriptions of other APIs except the APIs introduced above.