Telink TLSR8232 BLE SDK Developer Handbook
AN-19112700-E1
54
Ver.1.0.0
In ConnSlaveRole
, “blt_sdk_main_loop” needs to process the data received during the
brx process. During the brx working phase, the data packet received from Master will be
copied out during RX interrupt irq handler; these data won’t be processed immediately,
but buffered in software RX FIFO (corresponding to my_fifo_t blt_rxfifo in code).
F
unction “blt_sdk_main_loop” will check if there are data in software RX fifo, and process
the detected data packets correspondingly. The processing includes:
1) Decrypt data packet
2) Analyze data packet
If the analyzed data belongs to the control command sent by Master to Link Layer,
this command will be executed immediately; if it’s the data sent by Master to Host
layer, the data will be transferred to L2CAP layer via HCI interface.
3.2.4.4 Conn State Slave Role Timing Protection
In ConnSlaveRole state, each interval contains a Brx Event to transfer BLE RF packets.
In 5316 SDK, since Brx Event
is triggered by interrupt, it’s needed to enable MCU system
interrupt all the time. If user needs to process some time-consuming tasks and must
disable system interrupt in Conn state (e.g. erase Flash), Brx Event will be stopped, BLE
timing sequence will be disturbed, thus connection is terminated.
A timing sequence protection mechanism is provided in 5316 SDK. Users should strictly
follow this mechanism, so that BLE timing sequence won’t be disturbed when Brx Event
is stopped. Corresponding APIs are shown as below:
int
bls_ll_requestConnBrxEventDisable
(
void
);
void
bls_ll_disableConnBrxEvent
(
void
);
void
bls_ll_restoreConnBrxEvent
(
void
);
API “bls_ll_requestConnBrxEventDisable” serves to send a request to disable Brx Event.
1) If the return value is 0, it indicates the request to disable Brx Event is rejected.
During Brx working phase in Conn state, the return value must be 0; this request
won’t be accepted until a whole Brx Event is finished, i.e. it can be accepted only
during the remaining UI task/suspend duration.
2) If the return value is not zero, it indicates this request can be accepted, and the
returned non-zero value indicates the time (unit: ms) allowed to stop Brx Event.
a) If Link Layer is in Advertising state or Idle state without Brx Event, the return
value is “0xffff”. In this case, user can disable system interrupt at will.
b) If Link Layer is in Conn state
, and Slave receives “update map” or “update
connection parameter
” request from Master but does not start updating yet, the
return value should be the difference value of the time to start updating and
current time, i.e. it’s only allowed to stop Brx Event before the time to start
updating, otherwise all following packets won' be received and it will result in
disconnection.
c) If Link Layer is in Conn state, and no update request is received from Master,
the return value should be half of the current connection supervision timeout
value. For example, suppose current timeout is 1s, the return value should be
500ms.