找回密码
 立即注册

微信扫码登录

查看: 400|回复: 12

[BLE SDK] Missing retransmits causing connection drops

[复制链接]

3

主题

10

回帖

115

积分

荣耀黄金

积分
115
发表于 2025-6-16 00:08:33 | 显示全部楼层 |阅读模式 来自 德国
Information
说明:   建议参照本版块置顶帖内容输入必要信息
芯片型号: TLSR8251
SDK及版本: B85m_BLE_Single_Connection_SDK_v3.4.2.4_patch0004
I am having an issue where the TLSR8251 does not retransmit packets in case they are lost. I looked at the issue using Wireshark and I can see that my central is trying to read from the device, but the response gets lost even though it is logged as "[LL][TX] Packet:". I am using a MTU of 131 and I have adjusted the buffer size accordingly:


/* CAL_LL_ACL_RX_BUF_SIZE(maxRxOct): maxRxOct + 22, then 16 byte align */
#define RX_FIFO_SIZE        160
/* must be: 2^n, (power of 2);at least 4; recommended value: 4, 8, 16 */
#define RX_FIFO_NUM                8

/* CAL_LL_ACL_TX_BUF_SIZE(maxTxOct):  maxTxOct + 10, then 4 byte align */
#define TX_FIFO_SIZE        144
/* must be: (2^n), (power of 2); at least 8; recommended value: 8, 16, 32, other value not allowed. */
#define TX_FIFO_NUM                16


AFAIK the link layer should detect the missing/dropped packets and issue a retransmission, and indeed in Wireshark I see the "Next expected sequence number" indicates that a retransmission is necessary, but it is never happening. Is this a bug in the link layer of the chip/SDK and how can this be resolved?

48

主题

207

回帖

863

积分

版主

积分
863
发表于 2025-6-18 11:12:08 | 显示全部楼层 来自 上海
本帖最后由 TL_SW 于 2025-6-18 11:14 编辑

Please commit your Wireshark capture and print log, we will confirm whether this is bug.

3

主题

10

回帖

115

积分

荣耀黄金

积分
115
 楼主| 发表于 2025-6-19 02:11:27 | 显示全部楼层 来自 德国
The log of the last 2 reads is as follows:
  1. [LL][RX]: 07 00 04 00 10 0f 00 ff ff 00 28
  2. [ATT][RX] ATT Request: 04 00 10 0f 00 ff ff 00 28 a8
  3. [ATT][TX] ATT Response: 04 00 11 14 0f 00 16 00 19 02 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 17 00 1a 00 12 19 0d 0c
  4. [LL][TX] Packet: 02 2e 2a 00 04 00 11 14 0f 00 16 00 19 02 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 17 00 1a 00


  5. [LL][RX]: 07 00 04 00 10 1b 00 ff ff 00 28
  6. [ATT][RX] ATT Request: 04 00 10 1b 00 ff ff 00 28 f7
  7. [ATT][TX] ATT Response: 04 00 01 10 1b 00 0a
  8. [LL][TX] Packet: 02 09 05 00 04 00 01 10 1b 00 0a
复制代码

The first read response is received perfectly fine, the second TX Packet can not be seen on the Central and also not on the sniffer. The pcap file from the sniffer is attached. The response was most likely after the 2 empty PDUs after the "Sent Read Group Type Request", where the Central sent 2 consecutive Empty PDUs and the second one is marked as retransmission. Unfortunately the TLSR8251 doesn't retransmit the "Rcvd Read By Group Type Response" so the connection is eventually teared down after a timeout.

ConnectionDrop.zip

1.24 KB, 下载次数: 2

48

主题

207

回帖

863

积分

版主

积分
863
发表于 2025-6-19 17:44:57 | 显示全部楼层 来自 上海
Okay, I will check. If there is any progress, I will reply to you as soon as possible.

48

主题

207

回帖

863

积分

版主

积分
863
发表于 2025-6-20 11:52:55 | 显示全部楼层 来自 上海
I don't reproduce this issue using sample code. Could you please send your code to me that can reproduce this issue? thanks

48

主题

207

回帖

863

积分

版主

积分
863
发表于 2025-6-20 16:06:56 | 显示全部楼层 来自 上海
hi, Flole
Could you help to confirm whether there are other IRQ task or other task that disable IRQ? If have and exceed to 200us, RF IRQ may be delayed and receive packet incorrectly.

3

主题

10

回帖

115

积分

荣耀黄金

积分
115
 楼主| 发表于 2025-6-21 23:07:40 | 显示全部楼层 来自 德国
本帖最后由 Flole 于 2025-6-22 00:06 编辑

I have disabled most of my custom code and the issue remains. I was using interrupts and disabling IRQ but that has been disabled for testing now. I think I was doing it properly by checking if it can be done at that point in time:

while(bls_ll_requestConnBrxEventDisable() < 50) {
    };
    bls_ll_disableConnBrxEvent();
    unsigned char r = irq_disable();
...

    irq_restore(r);
    bls_ll_restoreConnBrxEvent();


The issue only appears when packets are lost, so if you have no packet loss you will not see it. Have you simulated packet loss and seen the TLSR8251 retransmit packets?

Should the retransmission be also logged by the TLSR8251?

I will try to reproduce it with one of the examples.

3

主题

10

回帖

115

积分

荣耀黄金

积分
115
 楼主| 发表于 2025-6-25 21:53:31 | 显示全部楼层 来自 德国
It seems like the examples are doing the exact same thing: If there is RF interference or packets are corrupted there is no retransmission and the connection will be dropped eventually. I tested with the b85m_ble_sample and added code to send an indication every 3 seconds. After some time the calls are failing as the indication never got acknowledged. I can also do it the other way around and send write requests from the central and eventually they will cause a disconnection if a packet gets lost as no response is received because the retransmission is missing.

48

主题

207

回帖

863

积分

版主

积分
863
发表于 2025-7-4 10:09:28 | 显示全部楼层 来自 上海
Sorry for the delay in replying to you. If possible, please upload the code. We will try to reproduce your problem.

3

主题

10

回帖

115

积分

荣耀黄金

积分
115
 楼主| 发表于 2025-7-6 20:55:11 | 显示全部楼层 来自 德国
The code is the example code from the b85m_ble_sample project and added this:


  1. if(clock_time_exceed(repeat_tick, 200000)) {
  2.     ble_sts_t err;
  3.    char* data = "Hello";
  4.    int len = 5;
  5.     if((err = blc_gatt_pushHandleValueIndicate(BATT_LEVEL_INPUT_CD_H, data, len)) != BLE_SUCCESS) {
  6.         printf("Push failed: %d\n", err);
  7.     }
  8. repeat_tick = clock_time();
  9. }
复制代码

and I changed the CHAR_PROP_NOTIFY in my_batCharVal to CHAR_PROP_INDICATE.

My central sets the interval to 2750 msec and the latency to 7 and timeout to 32 seconds when establishing the connection. When there is interference it fails at some point. Sometimes it takes a long time, but it will always fail sooner or later.

If you don't see this behaviour, could you please send me the bin or elf file that you are flashing? Then I can check with the exact same code in my environment.
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Telink forum ( 沪ICP备17008231号-1 )

GMT+8, 2025-7-15 20:35 , Processed in 0.102185 second(s), 23 queries .

Powered by Telink 隐私政策

泰凌微电子版权所有 © 。保留所有权利。 2024

快速回复 返回顶部 返回列表