
Telink TLSR8232 BLE SDK Developer Handbook
AN-19112700-E1
57
Ver.1.0.0
UI task
Brx event(n)
brx
post
brx
start
brx working
RX8 TX8
RX1 TX1 RX2 TX2
RX5 TX5
UI task/sleep
wptr:2
0
1
2
3
4
5
6
7
RX3 TX3 RX4 TX4
wptr(2+
8
)&(8-1)=2
0(6)
1(7)
2
(8)
3(1)
4(2)
5(3)
6(4)
7(5)
rptr:0
If the RX fifo rptr is 0 before the
pkt is received, assuming that
there is multiple pkts in one brx
event and main_loop does process 2
RX pkts(means rptr point to 2),
then after receiving the 8th RX
data, the RX fifo wptr will cross
the rptr area, causing 2nd pkt to
be covered.
RX6 TX6 RX7 TX7
rptr:2
Figure 3-12 RX Overflow Case 2
Data loss due to overflow will bring MIC failure and disconnection for the encryption
system.
In the old SDK, during brx event Rx IRQ, since data are filled into Rx FIFO without
overflow check, if main_loop fails to process data in time, it will bring the risk of data
overflow. Therefore, Master should not send too many data in a connection interval, and
the time to process UI tasks should be as short as possible, so as to avoid blockade.
Considering this, Rx overflow check is added in the new SDK: During the brx/btx event
Rx IRQ, check whether the difference of current RX FIFO wptr and rptr exceeds Rx FIFO
number. If the check result shows current Rx FIFO
is fully occupied, the RF won’t send
ACK to the peer and BLE protocol ensures data will be re-transmitted.
Similarly, if there are more than 8 valid packets in an interval, the default number 8 is not
enough.
Default TX FIFO number is 16, which is enough to process common audio remote control
function with large data volume. User can modify this number as 8 to save FIFO space.
If it
’s set as large value (e.g. 32), it will occupy large SRAM area.
In TX FIFO, stack in SDK bottom layer needs two FIFOs, while APP layer can use the
remaing FIFOs. If TX FIFO number is 16, APP layer can use 14 FIFOs; if TX FIFO
number is 8, APP layer can use 6 FIFOs.
To send data in APP layer (e.g. call
“bls_att_pushNotifyData”), users should check
current number of TX FIFOs available for Link Layer.
The API below serves to check current occupied number of TX FIFOs
(note that it’s not
the remaining available FIFO number).
u8
bls_ll_getTxFifoNumber
(
void
);
For example, TX FIFO number is the default value 16, among which 14 FIFOs are
available for users. Therefore, as long as the return value is less than 14, there are still
FIFOs available: if the return value is 13, there is 1 FIFO remaining; if the return value is
0, there are 14 FIFOs available.