Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BLE connection fails when WiFi coexistence is enabled for ESP32-C3 (IDFGH-9999) #11280

Closed
3 tasks done
ynormend opened this issue Apr 27, 2023 · 13 comments
Closed
3 tasks done
Assignees
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Bug bugs in IDF

Comments

@ynormend
Copy link

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

v4.4.4

Operating System used.

macOS

How did you build your project?

Command line with idf.py

If you are using Windows, please specify command line type.

None

Development Kit.

ESP32-C3-DevKitM-1 v1.0

Power Supply used.

USB

What is the expected behavior?

Any BLE central can connect to the board configured as BLE peripheral then interact with the GATT server.

What is the actual behavior?

The connection fails right after having been established.

Steps to reproduce.

  1. Build and flash the bluetooth/nimble/bleprph_wifi_coex example
  2. Wait for the board to start BLE advertisement after it has connected to the WiFi AP.
  3. Use a BLE utility tool to discover the board and connect to it. I'm using the "BLE Scanner 4.0" app on macOS 13 (Apple M1 chip). The connection is established then fails immediately after (it repeats until the utility tool gives up).

Debug Logs.

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd5810,len:0x16b8
load:0x403cc710,len:0x944
load:0x403ce710,len:0x2dfc
entry 0x403cc710
I (30) boot: ESP-IDF v4.4.4 2nd stage bootloader
I (30) boot: compile time 10:03:18
I (30) boot: chip revision: v0.3
I (32) boot.esp32c3: SPI Speed      : 80MHz
I (37) boot.esp32c3: SPI Mode       : DIO
I (42) boot.esp32c3: SPI Flash Size : 2MB
I (46) boot: Enabling RNG early entropy source...
I (52) boot: Partition Table:
I (55) boot: ## Label            Usage          Type ST Offset   Length
I (63) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (70) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (78) boot:  2 factory          factory app      00 00 00010000 00100000
I (85) boot: End of partition table
I (89) esp_image: segment 0: paddr=00010020 vaddr=3c0b0020 size=181a0h ( 98720) map
I (113) esp_image: segment 1: paddr=000281c8 vaddr=3fc92c00 size=03538h ( 13624) load
I (116) esp_image: segment 2: paddr=0002b708 vaddr=40380000 size=04910h ( 18704) load
I (123) esp_image: segment 3: paddr=00030020 vaddr=42000020 size=a1644h (661060) map
I (233) esp_image: segment 4: paddr=000d166c vaddr=40384910 size=0e19ch ( 57756) load
I (250) boot: Loaded app from partition at offset 0x10000
I (250) boot: Disabling RNG early entropy source...
I (262) cpu_start: Pro cpu up.
I (271) cpu_start: Pro cpu start user code
I (271) cpu_start: cpu freq: 160000000
I (271) cpu_start: Application information:
I (274) cpu_start: Project name:     bleprph_wifi_coex
I (279) cpu_start: App version:      v4.4.4
I (284) cpu_start: Compile time:     Apr 27 2023 10:03:13
I (290) cpu_start: ELF file SHA256:  4d444ea5c6a329e4...
I (296) cpu_start: ESP-IDF:          v4.4.4
I (301) heap_init: Initializing. RAM available for dynamic allocation:
I (308) heap_init: At 3FC9B9B0 len 00040D60 (259 KiB): DRAM
I (315) heap_init: At 3FCDC710 len 00002950 (10 KiB): STACK/DRAM
I (321) heap_init: At 50000020 len 00001FE0 (7 KiB): RTCRAM
I (328) spi_flash: detected chip: generic
I (332) spi_flash: flash io: dio
W (336) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (350) sleep: Configure to isolate all GPIO pins in sleep state
I (356) sleep: Enable automatic switching of GPIO sleep configuration
I (363) coexist: coexist rom version 9387209
I (368) cpu_start: Starting scheduler.
I (378) wifi_prph_coex: ESP_WIFI_MODE_STA
I (378) pp: pp rom version: 9387209
I (378) net80211: net80211 rom version: 9387209
I (398) wifi:wifi driver task: 3fca47fc, prio:23, stack:6656, core=0
I (398) system_api: Base MAC address is not set
I (398) system_api: read default base MAC address from EFUSE
I (408) wifi:wifi firmware version: 6567a16
I (408) wifi:wifi certification version: v7.0
I (408) wifi:config NVS flash: enabled
I (418) wifi:config nano formating: disabled
I (418) wifi:Init data frame dynamic rx buffer num: 32
I (428) wifi:Init management frame dynamic rx buffer num: 32
I (428) wifi:Init management short buffer num: 32
I (438) wifi:Init dynamic tx buffer num: 32
I (438) wifi:Init static tx FG buffer num: 2
I (438) wifi:Init static rx buffer size: 1600
I (448) wifi:Init static rx buffer num: 10
I (448) wifi:Init dynamic rx buffer num: 32
I (458) wifi_init: rx ba win: 6
I (458) wifi_init: tcpip mbox: 32
I (458) wifi_init: udp mbox: 6
I (468) wifi_init: tcp mbox: 6
I (468) wifi_init: tcp tx win: 5744
I (478) wifi_init: tcp rx win: 5744
I (478) wifi_init: tcp mss: 1440
I (478) wifi_init: WiFi IRAM OP enabled
I (488) wifi_init: WiFi RX IRAM OP enabled
I (488) phy_init: phy_version 950,11a46e9,Oct 21 2022,08:56:12
I (528) wifi:mode : sta (7c:df:a1:76:53:84)
I (538) wifi:enable tsf
I (538) wifi_prph_coex: wifi_init_sta finished.
I (538) wifi:new:<1,0>, old:<1,0>, ap:<255,255>, sta:<1,0>, prof:1
I (538) wifi:state: init -> auth (b0)
I (548) wifi:state: auth -> assoc (0)
I (558) wifi:state: assoc -> run (10)
I (598) wifi:connected with nami, aid = 5, channel 1, BW20, bssid = 24:5a:4c:56:a4:e9
I (598) wifi:security: WPA2-PSK, phy: bgn, rssi: -59
I (598) wifi:pm start, type: 1

I (598) wifi:set rx beacon pti, rx_bcn_pti: 14, bcn_timeout: 14, mt_pti: 25000, mt_time: 10000
I (628) wifi:<ba-add>idx:0 (ifx:0, 24:5a:4c:56:a4:e9), tid:6, ssn:1, winSize:64
I (678) wifi:AP's beacon interval = 102400 us, DTIM period = 1
I (1608) esp_netif_handlers: sta ip: 192.168.1.91, mask: 255.255.255.0, gw: 192.168.1.1
I (1608) wifi_prph_coex: got ip:192.168.1.91
I (1608) wifi_prph_coex: connected to ap SSID:nami password:nami-ai-pebble
I (1618) BTDM_INIT: BT controller compile version [02bfb7f]
I (1618) BTDM_INIT: Bluetooth MAC: 7c:df:a1:76:53:86

I (1628) wifi:<ba-add>idx:1 (ifx:0, 24:5a:4c:56:a4:e9), tid:0, ssn:1, winSize:64
I (1638) wifi_prph_coex: BLE Host Task Started
I (1638) NimBLE: GAP procedure initiated: stop advertising.

I (1648) wifi_prph_coex: Device Address:7c:df:a1:76:53:86
I (1648) NimBLE: GAP procedure initiated: advertise;
I (1658) NimBLE: disc_mode=2
I (1658) NimBLE:  adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=0 adv_itvl_max=0
I (1668) NimBLE:

64 bytes from 93.184.216.34 icmp_seq=1 ttl=49 time=191 ms
64 bytes from 93.184.216.34 icmp_seq=2 ttl=49 time=218 ms
I (3698) wifi_prph_coex: connection established; status=0
I (3698) wifi_prph_coex: handle=1 our_ota_addr_type=0 our_ota_addr=7c:df:a1:76:53:86
I (3698) wifi_prph_coex: our_id_addr_type=0 our_id_addr=7c:df:a1:76:53:86
I (3708) wifi_prph_coex: peer_ota_addr_type=0 peer_ota_addr=a0:78:17:99:84:db
I (3718) wifi_prph_coex: peer_id_addr_type=0 peer_id_addr=a0:78:17:99:84:db
I (3728) wifi_prph_coex: conn_itvl=12 conn_latency=0 supervision_timeout=36 encrypted=0 authenticated=0 bonded=0
64 bytes from 93.184.216.34 icmp_seq=3 ttl=49 time=245 ms
I (4758) wifi_prph_coex: disconnect; reason=520
I (4758) wifi_prph_coex: handle=1 our_ota_addr_type=0 our_ota_addr=7c:df:a1:76:53:86
I (4758) wifi_prph_coex: our_id_addr_type=0 our_id_addr=7c:df:a1:76:53:86
I (4768) wifi_prph_coex: peer_ota_addr_type=0 peer_ota_addr=a0:78:17:99:84:db
I (4778) wifi_prph_coex: peer_id_addr_type=0 peer_id_addr=a0:78:17:99:84:db
I (4778) wifi_prph_coex: conn_itvl=12 conn_latency=0 supervision_timeout=36 encrypted=0 authenticated=0 bonded=0
I (4788) NimBLE: GAP procedure initiated: advertise;
I (4798) NimBLE: disc_mode=2
I (4798) NimBLE:  adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=0 adv_itvl_max=0
I (4808) NimBLE:

64 bytes from 93.184.216.34 icmp_seq=4 ttl=49 time=218 ms
I (5018) wifi_prph_coex: connection established; status=0
I (5018) wifi_prph_coex: handle=1 our_ota_addr_type=0 our_ota_addr=7c:df:a1:76:53:86
I (5018) wifi_prph_coex: our_id_addr_type=0 our_id_addr=7c:df:a1:76:53:86
I (5028) wifi_prph_coex: peer_ota_addr_type=0 peer_ota_addr=a0:78:17:99:84:db
I (5038) wifi_prph_coex: peer_id_addr_type=0 peer_id_addr=a0:78:17:99:84:db
I (5048) wifi_prph_coex: conn_itvl=12 conn_latency=0 supervision_timeout=36 encrypted=0 authenticated=0 bonded=0
64 bytes from 93.184.216.34 icmp_seq=5 ttl=49 time=189 ms
I (6038) wifi_prph_coex: disconnect; reason=520
I (6038) wifi_prph_coex: handle=1 our_ota_addr_type=0 our_ota_addr=7c:df:a1:76:53:86
I (6038) wifi_prph_coex: our_id_addr_type=0 our_id_addr=7c:df:a1:76:53:86
I (6048) wifi_prph_coex: peer_ota_addr_type=0 peer_ota_addr=a0:78:17:99:84:db
I (6058) wifi_prph_coex: peer_id_addr_type=0 peer_id_addr=a0:78:17:99:84:db
I (6068) wifi_prph_coex: conn_itvl=12 conn_latency=0 supervision_timeout=36 encrypted=0 authenticated=0 bonded=0
I (6078) NimBLE: GAP procedure initiated: advertise;
I (6078) NimBLE: disc_mode=2
I (6088) NimBLE:  adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=0 adv_itvl_max=0
I (6098) NimBLE:

I (6358) wifi_prph_coex: connection established; status=0
I (6358) wifi_prph_coex: handle=1 our_ota_addr_type=0 our_ota_addr=7c:df:a1:76:53:86
I (6358) wifi_prph_coex: our_id_addr_type=0 our_id_addr=7c:df:a1:76:53:86
I (6368) wifi_prph_coex: peer_ota_addr_type=0 peer_ota_addr=a0:78:17:99:84:db
I (6378) wifi_prph_coex: peer_id_addr_type=0 peer_id_addr=a0:78:17:99:84:db
I (6388) wifi_prph_coex: conn_itvl=12 conn_latency=0 supervision_timeout=36 encrypted=0 authenticated=0 bonded=0
64 bytes from 93.184.216.34 icmp_seq=6 ttl=49 time=213 ms
I (7308) wifi_prph_coex: disconnect; reason=520
I (7308) wifi_prph_coex: handle=1 our_ota_addr_type=0 our_ota_addr=7c:df:a1:76:53:86
I (7308) wifi_prph_coex: our_id_addr_type=0 our_id_addr=7c:df:a1:76:53:86
I (7318) wifi_prph_coex: peer_ota_addr_type=0 peer_ota_addr=a0:78:17:99:84:db
I (7328) wifi_prph_coex: peer_id_addr_type=0 peer_id_addr=a0:78:17:99:84:db
I (7328) wifi_prph_coex: conn_itvl=12 conn_latency=0 supervision_timeout=36 encrypted=0 authenticated=0 bonded=0
I (7338) NimBLE: GAP procedure initiated: advertise;
I (7348) NimBLE: disc_mode=2
I (7348) NimBLE:  adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=0 adv_itvl_max=0
I (7358) NimBLE:

I (7688) wifi_prph_coex: connection established; status=0
I (7688) wifi_prph_coex: handle=1 our_ota_addr_type=0 our_ota_addr=7c:df:a1:76:53:86
I (7688) wifi_prph_coex: our_id_addr_type=0 our_id_addr=7c:df:a1:76:53:86
I (7698) wifi_prph_coex: peer_ota_addr_type=0 peer_ota_addr=a0:78:17:99:84:db
I (7708) wifi_prph_coex: peer_id_addr_type=0 peer_id_addr=a0:78:17:99:84:db
I (7718) wifi_prph_coex: conn_itvl=12 conn_latency=0 supervision_timeout=36 encrypted=0 authenticated=0 bonded=0
64 bytes from 93.184.216.34 icmp_seq=7 ttl=49 time=236 ms
I (8628) wifi_prph_coex: disconnect; reason=520
I (8638) wifi_prph_coex: handle=1 our_ota_addr_type=0 our_ota_addr=7c:df:a1:76:53:86
I (8638) wifi_prph_coex: our_id_addr_type=0 our_id_addr=7c:df:a1:76:53:86
I (8648) wifi_prph_coex: peer_ota_addr_type=0 peer_ota_addr=a0:78:17:99:84:db
I (8648) wifi_prph_coex: peer_id_addr_type=0 peer_id_addr=a0:78:17:99:84:db
I (8658) wifi_prph_coex: conn_itvl=12 conn_latency=0 supervision_timeout=36 encrypted=0 authenticated=0 bonded=0
I (8668) NimBLE: GAP procedure initiated: advertise;
I (8678) NimBLE: disc_mode=2
I (8678) NimBLE:  adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=0 adv_itvl_max=0
I (8688) NimBLE:

I (8698) wifi_prph_coex: connection established; status=0
I (8698) wifi_prph_coex: handle=1 our_ota_addr_type=0 our_ota_addr=7c:df:a1:76:53:86
I (8708) wifi_prph_coex: our_id_addr_type=0 our_id_addr=7c:df:a1:76:53:86
I (8718) wifi_prph_coex: peer_ota_addr_type=0 peer_ota_addr=a0:78:17:99:84:db
I (8718) wifi_prph_coex: peer_id_addr_type=0 peer_id_addr=a0:78:17:99:84:db
I (8728) wifi_prph_coex: conn_itvl=12 conn_latency=0 supervision_timeout=36 encrypted=0 authenticated=0 bonded=0
64 bytes from 93.184.216.34 icmp_seq=8 ttl=49 time=266 ms
I (9628) wifi_prph_coex: disconnect; reason=520
I (9628) wifi_prph_coex: handle=1 our_ota_addr_type=0 our_ota_addr=7c:df:a1:76:53:86
I (9638) wifi_prph_coex: our_id_addr_type=0 our_id_addr=7c:df:a1:76:53:86
I (9638) wifi_prph_coex: peer_ota_addr_type=0 peer_ota_addr=a0:78:17:99:84:db
I (9648) wifi_prph_coex: peer_id_addr_type=0 peer_id_addr=a0:78:17:99:84:db
I (9658) wifi_prph_coex: conn_itvl=12 conn_latency=0 supervision_timeout=36 encrypted=0 authenticated=0 bonded=0
I (9668) NimBLE: GAP procedure initiated: advertise;
I (9668) NimBLE: disc_mode=2
I (9678) NimBLE:  adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=0 adv_itvl_max=0
I (9688) NimBLE:

64 bytes from 93.184.216.34 icmp_seq=9 ttl=49 time=176 ms
I (9958) wifi_prph_coex: connection established; status=0
I (9958) wifi_prph_coex: handle=1 our_ota_addr_type=0 our_ota_addr=7c:df:a1:76:53:86
I (9958) wifi_prph_coex: our_id_addr_type=0 our_id_addr=7c:df:a1:76:53:86
I (9968) wifi_prph_coex: peer_ota_addr_type=0 peer_ota_addr=a0:78:17:99:84:db
I (9978) wifi_prph_coex: peer_id_addr_type=0 peer_id_addr=a0:78:17:99:84:db
I (9978) wifi_prph_coex: conn_itvl=12 conn_latency=0 supervision_timeout=36 encrypted=0 authenticated=0 bonded=0
64 bytes from 93.184.216.34 icmp_seq=10 ttl=49 time=206 ms
I (10988) wifi_prph_coex: disconnect; reason=520
I (10998) wifi_prph_coex: handle=1 our_ota_addr_type=0 our_ota_addr=7c:df:a1:76:53:86
I (10998) wifi_prph_coex: our_id_addr_type=0 our_id_addr=7c:df:a1:76:53:86
I (11008) wifi_prph_coex: peer_ota_addr_type=0 peer_ota_addr=a0:78:17:99:84:db
I (11008) wifi_prph_coex: peer_id_addr_type=0 peer_id_addr=a0:78:17:99:84:db
I (11018) wifi_prph_coex: conn_itvl=12 conn_latency=0 supervision_timeout=36 encrypted=0 authenticated=0 bonded=0
I (11028) NimBLE: GAP procedure initiated: advertise;
I (11038) NimBLE: disc_mode=2
I (11038) NimBLE:  adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=0 adv_itvl_max=0
I (11048) NimBLE:

I (11308) wifi_prph_coex: connection established; status=0
I (11308) wifi_prph_coex: handle=1 our_ota_addr_type=0 our_ota_addr=7c:df:a1:76:53:86
I (11318) wifi_prph_coex: our_id_addr_type=0 our_id_addr=7c:df:a1:76:53:86
I (11318) wifi_prph_coex: peer_ota_addr_type=0 peer_ota_addr=a0:78:17:99:84:db
I (11328) wifi_prph_coex: peer_id_addr_type=0 peer_id_addr=a0:78:17:99:84:db
I (11338) wifi_prph_coex: conn_itvl=12 conn_latency=0 supervision_timeout=36 encrypted=0 authenticated=0 bonded=0
64 bytes from 93.184.216.34 icmp_seq=11 ttl=49 time=230 ms
I (12438) wifi_prph_coex: disconnect; reason=520
I (12438) wifi_prph_coex: handle=1 our_ota_addr_type=0 our_ota_addr=7c:df:a1:76:53:86
I (12448) wifi_prph_coex: our_id_addr_type=0 our_id_addr=7c:df:a1:76:53:86
I (12448) wifi_prph_coex: peer_ota_addr_type=0 peer_ota_addr=a0:78:17:99:84:db
I (12458) wifi_prph_coex: peer_id_addr_type=0 peer_id_addr=a0:78:17:99:84:db
I (12468) wifi_prph_coex: conn_itvl=12 conn_latency=0 supervision_timeout=36 encrypted=0 authenticated=0 bonded=0
I (12478) NimBLE: GAP procedure initiated: advertise;
I (12488) NimBLE: disc_mode=2
I (12488) NimBLE:  adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=0 adv_itvl_max=0
I (12498) NimBLE:

I (12628) wifi_prph_coex: connection established; status=0
I (12628) wifi_prph_coex: handle=1 our_ota_addr_type=0 our_ota_addr=7c:df:a1:76:53:86
I (12638) wifi_prph_coex: our_id_addr_type=0 our_id_addr=7c:df:a1:76:53:86
I (12638) wifi_prph_coex: peer_ota_addr_type=0 peer_ota_addr=a0:78:17:99:84:db
I (12648) wifi_prph_coex: peer_id_addr_type=0 peer_id_addr=a0:78:17:99:84:db
I (12658) wifi_prph_coex: conn_itvl=12 conn_latency=0 supervision_timeout=36 encrypted=0 authenticated=0 bonded=0
64 bytes from 93.184.216.34 icmp_seq=12 ttl=49 time=256 ms
I (13738) wifi_prph_coex: disconnect; reason=520
I (13738) wifi_prph_coex: handle=1 our_ota_addr_type=0 our_ota_addr=7c:df:a1:76:53:86
I (13738) wifi_prph_coex: our_id_addr_type=0 our_id_addr=7c:df:a1:76:53:86
I (13748) wifi_prph_coex: peer_ota_addr_type=0 peer_ota_addr=a0:78:17:99:84:db
I (13758) wifi_prph_coex: peer_id_addr_type=0 peer_id_addr=a0:78:17:99:84:db
I (13768) wifi_prph_coex: conn_itvl=12 conn_latency=0 supervision_timeout=36 encrypted=0 authenticated=0 bonded=0
I (13778) NimBLE: GAP procedure initiated: advertise;
I (13778) NimBLE: disc_mode=2
I (13788) NimBLE:  adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=0 adv_itvl_max=0
I (13798) NimBLE:

64 bytes from 93.184.216.34 icmp_seq=13 ttl=49 time=259 ms
I (14138) wifi_prph_coex: connection established; status=0
I (14138) wifi_prph_coex: handle=1 our_ota_addr_type=0 our_ota_addr=7c:df:a1:76:53:86
I (14138) wifi_prph_coex: our_id_addr_type=0 our_id_addr=7c:df:a1:76:53:86
I (14148) wifi_prph_coex: peer_ota_addr_type=0 peer_ota_addr=a0:78:17:99:84:db
I (14158) wifi_prph_coex: peer_id_addr_type=0 peer_id_addr=a0:78:17:99:84:db
I (14168) wifi_prph_coex: conn_itvl=12 conn_latency=0 supervision_timeout=36 encrypted=0 authenticated=0 bonded=0
64 bytes from 93.184.216.34 icmp_seq=14 ttl=49 time=200 ms
I (15078) wifi_prph_coex: disconnect; reason=520
I (15078) wifi_prph_coex: handle=1 our_ota_addr_type=0 our_ota_addr=7c:df:a1:76:53:86
I (15088) wifi_prph_coex: our_id_addr_type=0 our_id_addr=7c:df:a1:76:53:86
I (15088) wifi_prph_coex: peer_ota_addr_type=0 peer_ota_addr=a0:78:17:99:84:db
I (15098) wifi_prph_coex: peer_id_addr_type=0 peer_id_addr=a0:78:17:99:84:db
I (15108) wifi_prph_coex: conn_itvl=12 conn_latency=0 supervision_timeout=36 encrypted=0 authenticated=0 bonded=0
I (15118) NimBLE: GAP procedure initiated: advertise;
I (15128) NimBLE: disc_mode=2
I (15128) NimBLE:  adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=0 adv_itvl_max=0
I (15138) NimBLE:

I (15148) wifi_prph_coex: connection established; status=0
I (15148) wifi_prph_coex: handle=1 our_ota_addr_type=0 our_ota_addr=7c:df:a1:76:53:86
I (15158) wifi_prph_coex: our_id_addr_type=0 our_id_addr=7c:df:a1:76:53:86
I (15158) wifi_prph_coex: peer_ota_addr_type=0 peer_ota_addr=a0:78:17:99:84:db
I (15168) wifi_prph_coex: peer_id_addr_type=0 peer_id_addr=a0:78:17:99:84:db
I (15178) wifi_prph_coex: conn_itvl=12 conn_latency=0 supervision_timeout=36 encrypted=0 authenticated=0 bonded=0
64 bytes from 93.184.216.34 icmp_seq=15 ttl=49 time=224 ms
I (16108) wifi_prph_coex: disconnect; reason=520
I (16108) wifi_prph_coex: handle=1 our_ota_addr_type=0 our_ota_addr=7c:df:a1:76:53:86
I (16108) wifi_prph_coex: our_id_addr_type=0 our_id_addr=7c:df:a1:76:53:86
I (16118) wifi_prph_coex: peer_ota_addr_type=0 peer_ota_addr=a0:78:17:99:84:db
I (16128) wifi_prph_coex: peer_id_addr_type=0 peer_id_addr=a0:78:17:99:84:db
I (16138) wifi_prph_coex: conn_itvl=12 conn_latency=0 supervision_timeout=36 encrypted=0 authenticated=0 bonded=0
I (16148) NimBLE: GAP procedure initiated: advertise;
I (16148) NimBLE: disc_mode=2
I (16158) NimBLE:  adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=0 adv_itvl_max=0
I (16168) NimBLE:

I (16698) wifi_prph_coex: connection established; status=0
I (16698) wifi_prph_coex: handle=1 our_ota_addr_type=0 our_ota_addr=7c:df:a1:76:53:86
I (16708) wifi_prph_coex: our_id_addr_type=0 our_id_addr=7c:df:a1:76:53:86
I (16708) wifi_prph_coex: peer_ota_addr_type=0 peer_ota_addr=a0:78:17:99:84:db
I (16718) wifi_prph_coex: peer_id_addr_type=0 peer_id_addr=a0:78:17:99:84:db
I (16728) wifi_prph_coex: conn_itvl=12 conn_latency=0 supervision_timeout=36 encrypted=0 authenticated=0 bonded=0
64 bytes from 93.184.216.34 icmp_seq=16 ttl=49 time=247 ms
I (17828) wifi_prph_coex: disconnect; reason=520
I (17838) wifi_prph_coex: handle=1 our_ota_addr_type=0 our_ota_addr=7c:df:a1:76:53:86
I (17838) wifi_prph_coex: our_id_addr_type=0 our_id_addr=7c:df:a1:76:53:86
I (17848) wifi_prph_coex: peer_ota_addr_type=0 peer_ota_addr=a0:78:17:99:84:db
I (17848) wifi_prph_coex: peer_id_addr_type=0 peer_id_addr=a0:78:17:99:84:db
I (17858) wifi_prph_coex: conn_itvl=12 conn_latency=0 supervision_timeout=36 encrypted=0 authenticated=0 bonded=0
I (17868) NimBLE: GAP procedure initiated: advertise;
I (17878) NimBLE: disc_mode=2
I (17878) NimBLE:  adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=0 adv_itvl_max=0
I (17888) NimBLE:

64 bytes from 93.184.216.34 icmp_seq=17 ttl=49 time=279 ms
64 bytes from 93.184.216.34 icmp_seq=18 ttl=49 time=305 ms
64 bytes from 93.184.216.34 icmp_seq=19 ttl=49 time=320 ms
64 bytes from 93.184.216.34 icmp_seq=20 ttl=49 time=253 ms

More Information.

The issue cannot be reproduced with an ESP32-S3 board, or without WiFi coexistence (bleprph example), or with ESP-IDF v4.4.3.

@ynormend ynormend added the Type: Bug bugs in IDF label Apr 27, 2023
@github-actions github-actions bot changed the title BLE connection fails when WiFi coexistence is enabled for ESP32-C3 BLE connection fails when WiFi coexistence is enabled for ESP32-C3 (IDFGH-9999) Apr 27, 2023
@espressif-bot espressif-bot added the Status: Opened Issue is new label Apr 27, 2023
@wmy-espressif
Copy link
Collaborator

Hi @ynormend thanks for your bug report. We have reproduced this issue locally and our engineers will investigate in this issue.
From our analysis, this issue only occurs on new version iphones that support 2Mbps PHY, BLE disconnects after the PHY rate changes from 1Mbps to 2Mbps.

You can try another old version iphone or some other Android smartphones and test whether the issue does not occur, if yes, then it is likely that we are facing the same issue.

@AxelLin
Copy link
Contributor

AxelLin commented May 4, 2023

@wmy-espressif
The report says it was working with v4.4.3 but failed with v4.4.4.
If you can reproduce the issue, use git bisect can quickly find the bad commit.

@wmy-espressif
Copy link
Collaborator

Hi @AxelLin thanks for the suggestion. In fact that we have found that it is the change in libphy.a that causes this issue, the differences are large between the two different versions for libphy.a, the changes are not visible to me. Need colleagues from RF/PHY team to take a look.

@ynormend
Copy link
Author

ynormend commented May 5, 2023

Thanks for your response @wmy-espressif ! I tried with an Android phone and it didn't occur indeed, so we're likely facing the same issue.

@kobbok
Copy link

kobbok commented May 5, 2023

I think I'm also experiencing the same issue but with the ESP32-C3-DevKitC-02 using esp-idf v5.0.1 and the same bluetooth/nimble/bleprph_wifi_coex example. Neither an iPhone 12 (iOS 16.3) nor an iPad Air (4th generation, iOS 16.2) can connect to the peripheral. In my case the iOS device never connects and stays in the "connecting" state.
Android works without any problems.
If I switch to using the Bluedroid host the device connects then the connection fails immediately.

What seems to fix the problem is adding a ~2s delay after a successful connection to the Wifi and before starting advertising.

@AxelLin
Copy link
Contributor

AxelLin commented May 18, 2023

Hi @AxelLin thanks for the suggestion. In fact that we have found that it is the change in libphy.a that causes this issue,

@wmy-espressif Any update? The stable branches have this bug now, it needs fix ASAP.

@wmy-espressif
Copy link
Collaborator

Hi @ynormend @kobbok @AxelLin , we have founded the cause of this issue, and our bugfix is merged into master branch already and it can take some days to be synchronized to esp-idf github repo, also we are preparing the backported MRs on previous release branches. Before the MRs are merged and synchronized to github, you can use the following patch in your project:

phy_lib_patch.tar.gz

To apply the patch, please use the library files in the attachment to replace the ones in esp-idf/components/esp_phy/lib.

@AxelLin
Copy link
Contributor

AxelLin commented May 18, 2023

Hi @ynormend @kobbok @AxelLin , we have founded the cause of this issue, and our bugfix is merged into master branch

@wmy-espressif
Be aware that most people don't use master for real projects.
It's important to get the fix for stable branches, which has impact on real projects.

@wmy-espressif
Copy link
Collaborator

@AxelLin thanks for the reminder, the backports are in progress.

@espressif-bot espressif-bot added Status: In Progress Work is in progress Status: Reviewing Issue is being reviewed and removed Status: Opened Issue is new Status: In Progress Work is in progress labels May 18, 2023
@ynormend
Copy link
Author

Thanks for the patch @wmy-espressif ! I noticed it contains libraries for both ESP32-C3 and ESP32-S3. Does it mean both platforms have the issue? I didn't observe it with ESP32-S3.

@wmy-espressif
Copy link
Collaborator

Hi @ynormend yes the libraries are for ESP32-C3 and ESP32-S3, the two chips have similar implementations on RF/modem. I don't know why ESP32-S3 doesn't reproduce the issue. According to our RF engineers, the cause is that the filter bandwidth configured is too narrow for BLE 2M PHY, therefore I guess this patch is good for the performance of 2M PHY.

I would like to inform you that our fixes are already merged in the following branches: master, release/v4.4, release/v5.1, but currently only release/v5.1 is updated to github with this fix, the git commit SHA is: e8dba71. It can take several days for the other branches to be synchronized.

@wmy-espressif
Copy link
Collaborator

Hi @ynormend , @kobbok , @AxelLin , for your information, the fixes for this issue have been merged into our release branches:

ESP-IDF Branch Fixed Commit ID Fixed ESP-IDF Version
master 5838c2e expected in v5.2
release/v5.1 e8dba71 expected in v5.1
release/v5.0 5a68c49 expected in v5.0.3
release/v4.4 1071b13 expected in v4.4.5
release/v4.3 3a10cc9 expected in v4.3.6

Please try out the specific commits you need.

@Alvin1Zhang
Copy link
Collaborator

Thanks for reporting.

@espressif-bot espressif-bot added Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: Reviewing Issue is being reviewed labels Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Bug bugs in IDF
Projects
None yet
Development

No branches or pull requests

6 participants