针对您使用CYW20819模块的项目需求,以下是关于BLE/Classic BT断开后重连时间、自动重连支持和多设备测试文档的详细解答:
BLE重连时间:
Connection Interval(默认7.5ms~4s)影响协商速度。Connection Interval=30ms,重连可在100ms内完成。Classic BT重连时间:
CYW20819内置支持:
wiced_bt_dev_register_connection_status_cb()注册回调函数,监听断开事件。wiced_bt_dev_create_bond()或wiced_bt_gatt_connect()触发重连。简化流程示例:
// 断开事件回调
void conn_status_cb(wiced_bt_connection_status_t status, wiced_bt_device_address_t bd_addr) {
if (status == WICED_BT_CONNECTION_STATUS_DISCONNECTED) {
wiced_bt_gatt_connect(bd_addr); // 立即触发BLE重连
}
}
// 主初始化中注册回调
wiced_bt_dev_register_connection_status_cb(conn_status_cb);关键配置:
CY_BLE_CONN_CONFIG_FAST连接参数配置文件加快响应。wiced_bt_set_default_bonding_mode()启用自动配对。
文档定位:
ModusToolbox安装目录下查看:
./mtb_shared//docs/pico_api_reference.html
搜索wiced_bt_dev_create_bond或wiced_bt_gatt_connect接口说明。
官方测试报告:
| 多协议测试建议: | 测试场景 | 配置建议 | 典型结果 |
|---|---|---|---|
| 8 BLE + 1 SPP | BLE连接间隔=50ms | SPP平均延迟30ms | |
| 广播+连接模式 | 广播间隔100ms,开槽连接 | 无广播丢包 | |
| 同信道WiFi干扰 | BLE跳频Ch37-39避让WiFi | 重连成功率>99% |
重连时间优化:
Connection Interval至20ms以内。自动重连实践:
wiced_bt_gatt_connect()(BLE)或wiced_bt_dev_create_bond()(Classic BT)。多设备部署:
wiced_bt_cfg.c中扩展最大连接数(需验证内存占用)。
官方资源直达:
实际重连性能建议通过hcitool/btsnoop抓包验证射频交互耗时,结合项目具体参数配置会有差异。
举报
更多回帖