你好,我们是一家设计生产智能柜锁的企业,现在正在使用贵公司的ESP32芯片开发BLE-WIFI网关项目。在使用ESP32芯片作为主机同时连接4把蓝牙锁从机的时候容易出错,导致数据不能下发,开不了锁。
在BLE连接建立后发现服务时有打印
[0;33mW (77463) BT_GATT: gatt_rsp_timeout retry discovery primary service[0m
[0;33mW (107463) BT_GATT: gatt_rsp_timeout disconnecting...[0m
这时候如果调用esp_ble_gap_disconnect(inst->remote_bda);想将BLE连接断开也不行。这种有时候只影响这个链路,有时候整个蓝牙模块都会崩溃,机器重启。我配置的连接蓝牙锁的连接参数
esp_ble_gap_set_prefer_conn_params(inst->peeraddr, 12, 14, 0, 400);
esp_ble_gattc_open(inst->gattc_if, inst->peeraddr, BLE_ADDR_TYPE_PUBLIC, true);
这种错误在单独连接一把锁的时候没有出现过。请问有什么可以改进的吗?
我们使用的ESP32模组是ESP32-WROVER-E,开发所用的软硬件环境见下面的开机打印
[2024-10-19 08:24:38.044]# RECV ASCII>
[0;32mI (13) boot: ESP-IDF v5.3-dev-1978-g4fb231088d-dirty 2nd stage bootloader[0m
[0;32mI (13) boot: compile time Mar 2 2024 16:05:26[0m
[0;32mI (14) boot: Multicore bootloader[0m
[0;32mI (18) boot: chip revision: v3.0[0m
[0;32mI (22) boot.esp32: SPI Speed : 40MHz[0m
[0;32mI (27) boot.esp32: SPI Mode : DIO[0m
[0;32mI (31) boot.esp32: SPI Flash Size : 8MB[0m
[0;32mI (36) boot: Enabling RNG early entropy source...[0m
[0;32mI (42) boot: Partition Table:[0m
[0;32mI (45) boot: ## Label Usage Type ST Offset Length[0m
[0;32mI (53) boot: 0 nvs WiFi data 01 02 00011000 00004000[0m
[0;32mI (60) boot: 1 otadata OTA data 01 00 00015000 00002000[0m
[0;32mI (68) boot: 2 phy_init RF data 01 01 00017000 00001000[0m
[0;32mI (75) boot: 3 factory factory app 00 00 00020000 00200000[0m
[0;32mI (82) boot: 4 ota_0 OTA app 00 10 00220000 00200000[0m
[0;32mI (90) boot: 5 ota_1 OTA app 00 11 00420000 00200000[0m
[0;32mI (97) boot: End of partition table[0m
[0;32mI (102) esp_image: segment 0: paddr=00420020 vaddr=3f400020 size=5ac74h (371828) map[0m
[2024-10-19 08:24:38.184]# RECV ASCII>
[0;32mI (238) esp_image: segment 1: paddr=0047ac9c vaddr=3ffbdb60 size=0537ch ( 21372) load[0m
[0;32mI (246) esp_image: segment 2: paddr=00480020 vaddr=400d0020 size=11ecb8h (1174712) map[0m
[2024-10-19 08:24:38.589]# RECV ASCII>
[0;32mI (648) esp_image: segment 3: paddr=0059ece0 vaddr=3ffc2edc size=031d0h ( 12752) load[0m
[0;32mI (653) esp_image: segment 4: paddr=005a1eb8 vaddr=40080000 size=1ff80h (130944) load[0m
[2024-10-19 08:24:38.684]# RECV ASCII>
[0;32mI (722) boot: Loaded app from partition at offset 0x420000[0m
[0;32mI (722) boot: Disabling RNG early entropy source...[0m
[0;32mI (734) cpu_start: Multicore app[0m
[0;32mI (734) quad_psram: This chip is ESP32-D0WD[0m
[0;32mI (736) esp_psram: Found 8MB PSRAM device[0m
[0;32mI (736) esp_psram: Speed: 40MHz[0m
[0;32mI (740) esp_psram: PSRAM initialized, cache is in low/high (2-core) mode.[0m
[0;33mW (748) esp_psram: Virtual address not enough for PSRAM, map as much as we can. 4MB is mapped[0m
[2024-10-19 08:24:39.636]# RECV ASCII>
[0;32mI (1662) esp_psram: SPI SRAM memory test OK[0m
[0;32mI (1673) cpu_start: Pro cpu start user code[0m
[0;32mI (1673) cpu_start: cpu freq: 160000000 Hz[0m
[0;32mI (1673) cpu_start: Application information:[0m
[0;32mI (1676) cpu_start: Project name: WIFI+BLE[0m
[0;32mI (1681) cpu_start: App version: d92179e-dirty[0m
[0;32mI (1687) cpu_start: Compile time: Oct 16 2024 16:40:44[0m
[0;32mI (1693) cpu_start: ELF file SHA256: da49ee1bc...[0m
[0;32mI (1698) cpu_start: ESP-IDF: v5.3-dev-1978-g4fb231088d-dirty[0m
[0;32mI (1705) cpu_start: Min chip rev: v0.0[0m
[0;32mI (1710) cpu_start: Max chip rev: v3.99 [0m
[0;32mI (1715) cpu_start: Chip rev: v3.0[0m
[0;32mI (1720) heap_init: Initializing. RAM available for dynamic allocation:[0m
[0;32mI (1728) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM[0m
[0;32mI (1733) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM[0m
[0;32mI (1740) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM[
[2024-10-19 08:24:39.796]# RECV ASCII>
0m
[0;32mI (1746) heap_init: At 3FFC7E00 len 00018200 (96 KiB): DRAM[0m
[0;32mI (1752) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM[0m
[0;32mI (1758) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM[0m
[0;32mI (1765) heap_init: At 4009FF80 len 00000080 (0 KiB): IRAM[0m
[0;32mI (1772) esp_psram: Adding pool of 4068K of PSRAM memory to heap allocator[0m
[0;32mI (1781) spi_flash: detected chip: generic[0m
[0;32mI (1783) spi_flash: flash io: dio[0m
[0;32mI (1789) coexist: coex firmware version: 77cd7f8[0m
[0;32mI (1794) main_task: Started on CPU0[0m
[0;32mI (1804) esp_psram: Reserving pool of 32K of internal memory for DMA/internal allocations[0m
[0;32mI (1804) main_task: Calling app_main()[0m
[0;31mE (1864) esp_timer: Task is already initialized[0m
[2024-10-19 08:24:39.890]# RECV ASCII>
[0;32mI (1914) eth_phy_802_3: reset_hw: (io 5) 150 us[0m
[0;32mI (1924) eth_phy_802_3: to detect phy addr[0m
[0;32mI (1924) eth_phy_802_3: IDR1 reg_value: 0007[0m
[0;32mI (1924) eth_phy_802_3: IDR2 reg_value: c0f1[0m
[0;32mI (1924) eth_phy_802_3: BMCR reg_value: 3000[0m
[0;32mI (1924) eth_phy_802_3: BMSR reg_value: 7809[0m
[0;32mI (1934) eth_phy_802_3: Found PHY address: 1[0m
[0;32mI (1954) esp_eth.netif.netif_glue: 48:55:19:b0:3e:43[0m
[0;32mI (1954) esp_eth.netif.netif_glue: ethernet attached to netif[0m
[2024-10-19 08:24:43.939]# RECV ASCII>
[0;32mI (5954) USER_WIFI: this is a version to save wifi ap info
[0m
[0;32mI (5954) USER_ETH: Ethernet Started[0m
I (5964) wifi:wifi driver task: 3ffd5634, prio:23, stack:6656, core=0
I (5984) wifi:wifi firmware version: 55adff8
I (5984) wifi:wifi certification version: v7.0
I (5984) wifi:config NVS flash: enabled
I (5984) wifi:config nano formating: disabled
I (5994) wifi:Init data frame dynamic rx buffer num: 32
I (5994) wifi:Init static rx mgmt buffer num: 5
I (6004) wifi:Init management short buffer num: 32
I (6004) wifi:Init static tx buffer num: 16
I (6014) wifi:Init tx cache buffer num: 32
I (6014) wifi:Init static rx buffer size: 1600
I (6014) wifi:Init static rx buffer num: 10
I (6024) wifi:Init dynamic rx buffer num: 32
[0;32mI (6024) wifi_init: rx ba win: 6[0m
[0;32mI (6024) wifi_init: accept mbox: 6[0m
[0;32mI (6034) wifi_init: tcpip mbox: 32[0m
[0;32mI (6034) wifi_init: udp mbox: 6[0m
[0;32mI (6044) wifi_init: tcp mbox: 6[0m
[0;32mI (6044) wifi_init: tcp tx win
[2024-10-19 08:24:44.029]# RECV ASCII>
: 5744[0m
[0;32mI (6044) wifi_init: tcp rx win: 5744[0m
[0;32mI (6054) wifi_init: tcp mss: 1440[0m
[0;32mI (6054) wifi_init: WiFi/LWIP prefer SPIRAM[0m
[0;32mI (6064) USER_WIFI: wifi_init_softap finished. SSID:WTGWAP_B03E41 password: channel:10[0m
[0;33mW (6074) event: handler already registered, overwriting[0m
[0;32mI (6074) phy_init: phy_version 4791,2c4672b,Dec 20 2023,16:06:06[0m
[2024-10-19 08:24:44.144]# RECV ASCII>
I (6164) wifi:mode : sta (48:55:19:b0:3e:40) + softAP (48:55:19:b0:3e:41)
I (6164) wifi:enable tsf
I (6174) wifi:Total power save buffer number: 8
I (6174) wifi:Init max length of beacon: 752/752
I (6174) wifi:Init max length of beacon: 752/752
ESP32芯片多路BLE连接易出错
Re: ESP32芯片多路BLE连接易出错
我现在在出现
BT_GATT: gatt_rsp_timeout retry discovery primary service
BT_GATT: gatt_rsp_timeout disconnecting...
打印的时候将esp_ble_gap_disconnect(inst->remote_bda);换成esp_ble_gattc_close(inst->gattc_if, inst->conn_id);,从打印的log来看,确实是closed了,但是后面想再调用esp_ble_gattc_open()就不会成功了。
BT_GATT: gatt_rsp_timeout retry discovery primary service
BT_GATT: gatt_rsp_timeout disconnecting...
打印的时候将esp_ble_gap_disconnect(inst->remote_bda);换成esp_ble_gattc_close(inst->gattc_if, inst->conn_id);,从打印的log来看,确实是closed了,但是后面想再调用esp_ble_gattc_open()就不会成功了。
Who is online
Users browsing this forum: No registered users and 20 guests