如何提高esp_ble_get_cur_sendable_packets_num返回数

qiuyonggang
Posts: 11
Joined: Tue Feb 07, 2023 6:26 am

如何提高esp_ble_get_cur_sendable_packets_num返回数

Postby qiuyonggang » Mon Aug 28, 2023 10:54 am

我们使用的芯片是esp32-C3
IDF版本版本:2.8.1
Build id:20230207-1119
我们的产品使用的是BLE Mesh的组网方式,两块板子之间通过通过gatt做ota功能测试的时候,如果板子进行了fast ble mesh prov的初始化,那么ota的过程中esp_ble_get_cur_sendable_packets_num返回的结果中,36次只有3次返回数据1,其他都是返回的数据0,而如果不进行fast ble mesh prov的初始化,那么esp_ble_get_cur_sendable_packets_num返回的结果中,36次只有9次返回的结果是0,其他是1~3的数,这两者的传输速率也是相差了十几倍。
想请教一下,通过什么方式或者配置,能够增加esp_ble_get_cur_sendable_packets_num?

qiuyonggang
Posts: 11
Joined: Tue Feb 07, 2023 6:26 am

Re: 如何提高esp_ble_get_cur_sendable_packets_num返回数

Postby qiuyonggang » Tue Aug 29, 2023 2:52 am

经过进一步测试发现,esp_ble_get_cur_sendable_packets_num的值在刚开始的时候是一样的,只是进行了fast ble mesh prov的初始化的程序在开始调用了esp_ble_gattc_write_char的方法发送数据后,esp_ble_get_cur_sendable_packets_num恢复的慢,应该就是发送的慢,两者对比的打印日志如下:
进行了fast ble mesh prov的初始化的程序的OTA打印:
I (27839) hyz_gattc.c: [106] gattc_profile_event_handler event 9
I (27849) hyz_gattc.c: [288] write descr success
E (27929) hyz_ble_ota_svr.c: [87] free_buff_num 10
E (27929) hyz_ble_ota_svr.c: [87] free_buff_num 4
E (27939) hyz_ble_ota_svr.c: [87] free_buff_num 0
E (27949) hyz_ble_ota_svr.c: [87] free_buff_num 0
E (27959) hyz_ble_ota_svr.c: [87] free_buff_num 1
E (27959) hyz_ble_ota_svr.c: [87] free_buff_num 0
E (27969) hyz_ble_ota_svr.c: [87] free_buff_num 0
E (27979) hyz_ble_ota_svr.c: [87] free_buff_num 0
E (27989) hyz_ble_ota_svr.c: [87] free_buff_num 0
E (27999) hyz_ble_ota_svr.c: [87] free_buff_num 0
E (28009) hyz_ble_ota_svr.c: [87] free_buff_num 0
E (28019) hyz_ble_ota_svr.c: [87] free_buff_num 0
E (28029) hyz_ble_ota_svr.c: [87] free_buff_num 0
E (28039) hyz_ble_ota_svr.c: [87] free_buff_num 1
E (28039) hyz_ble_ota_svr.c: [87] free_buff_num 0
E (28049) hyz_ble_ota_svr.c: [87] free_buff_num 0
E (28059) hyz_ble_ota_svr.c: [87] free_buff_num 0
E (28069) hyz_ble_ota_svr.c: [87] free_buff_num 0
E (28079) hyz_ble_ota_svr.c: [87] free_buff_num 0
E (28089) hyz_ble_ota_svr.c: [87] free_buff_num 0
E (28099) hyz_ble_ota_svr.c: [87] free_buff_num 0
E (28109) hyz_ble_ota_svr.c: [87] free_buff_num 0
E (28119) hyz_ble_ota_svr.c: [87] free_buff_num 1

未进行fast ble mesh prov的初始化的程序的OTA打印:
I (5600) hyz_gattc.c: [288] write descr success
E (5970) hyz_ble_ota_svr.c: [87] free_buff_num 10
E (5970) hyz_ble_ota_svr.c: [87] free_buff_num 4
E (5980) hyz_ble_ota_svr.c: [87] free_buff_num 0
E (5990) hyz_ble_ota_svr.c: [87] free_buff_num 1
E (5990) hyz_ble_ota_svr.c: [87] free_buff_num 0
E (6000) hyz_ble_ota_svr.c: [87] free_buff_num 1
E (6000) hyz_ble_ota_svr.c: [87] free_buff_num 1
E (6000) hyz_ble_ota_svr.c: [87] free_buff_num 0
E (6010) hyz_ble_ota_svr.c: [87] free_buff_num 1
E (6010) hyz_ble_ota_svr.c: [87] free_buff_num 1
E (6010) hyz_ble_ota_svr.c: [87] free_buff_num 1
E (6020) hyz_ble_ota_svr.c: [87] free_buff_num 1
E (6020) hyz_ble_ota_svr.c: [87] free_buff_num 0
E (6040) hyz_ble_ota_svr.c: [87] free_buff_num 2
E (6040) hyz_ble_ota_svr.c: [87] free_buff_num 1
E (6040) hyz_ble_ota_svr.c: [87] free_buff_num 0
E (6050) hyz_ble_ota_svr.c: [87] free_buff_num 1
E (6050) hyz_ble_ota_svr.c: [87] free_buff_num 1
E (6060) hyz_ble_ota_svr.c: [87] free_buff_num 1
E (6060) hyz_ble_ota_svr.c: [87] free_buff_num 1
E (6070) hyz_ble_ota_svr.c: [87] free_buff_num 0
E (6080) hyz_ble_ota_svr.c: [87] free_buff_num 2
send.png
发送部分代码
send.png (58.38 KiB) Viewed 2731 times

wmswms
Posts: 1
Joined: Fri Aug 04, 2023 6:10 am

Re: 如何提高esp_ble_get_cur_sendable_packets_num返回数

Postby wmswms » Tue Sep 05, 2023 12:40 pm

你好,使用fast mesh prov之后,会占用一定底层的资源,所以空闲buffer的数量会恢复得比较慢。

lxlxlx
Posts: 1
Joined: Tue Oct 31, 2023 11:18 am

Re: 如何提高esp_ble_get_cur_sendable_packets_num返回数

Postby lxlxlx » Tue Oct 31, 2023 11:38 am

你好,如wmswms回复的那样,使能fast mesh prov后,会占用底层的资源,因此esp_ble_cur_sendable_packets_nums返回的数据会比较小。当前底层buffer的数量个数是不可更改的,因此无法增加剩余buffer个数,但我注意到你目的是提高OTA的速度,那么建议你参考 examples/bluetooth/bluedroid/ble/ble_throughput,将MTU Size设置成ESP_GATT_MAX_MTU_SIZE,然后每次下发的数据包大小尽量为MTU Size,以最大化地利用每个buffer。

Who is online

Users browsing this forum: Bing [Bot], sanmaodeai and 53 guests