I have an application which uses BT Classic (an A2DP sink) and WiFi (small webserver).
The WiFi related functionality works well when not using any Bluetooth at all.
When I enable Bluetooth Classic and even just establish a BT connection, I observe massive packet loss on the WiFi side. While streaming A2DP data it gets worse, and eventually the WiFi will even disassociate from the AP.
On the other hand the A2DP traffic does not seem to suffer from any WiFi traffic at all, so the BT Classic seems to have some form of priority over WiFi.
Questions:
- Is WiFi and BT Classic supposed to work simultaneously? I do not mean theoretically. I mean practically.
- Is this a known problem?
. Is anyone else seeing this?
Cheers,
Johannes
Simultaneous WiFi and Bluetooth: Paket loss and WiFi disconnects
-
- Posts: 13
- Joined: Tue May 02, 2017 9:33 am
Re: Simultaneous WiFi and Bluetooth: Paket loss and WiFi disconnects
I'm seeing something very similar. When I tried to start classic BT and WiFi at startup, I wouldn't get a WiFi address. If I pulled the BT out, I would. If I delayed initializing BT, the WiFi would connect. However, as soon as BT started, I received:
Wifi: bcn_timout,ap_probe_send_start
then,
wifi: ap_probe_send over, resett wifi status to disassoc
and then my WiFi connection was gone.
I'm using v2.1.
Wifi: bcn_timout,ap_probe_send_start
then,
wifi: ap_probe_send over, resett wifi status to disassoc
and then my WiFi connection was gone.
I'm using v2.1.
-
- Posts: 13
- Joined: Tue May 02, 2017 9:33 am
Re: Simultaneous WiFi and Bluetooth: Paket loss and WiFi disconnects
Yes, I am seeing the same:
- When BT is enabled I see sporadically: wifi: bcn_timout,ap_probe_send_start
- When BT is enabled but disconnected: 1% packet loss on the WiFi side.
- When BT is connected: 2-4% packet loss on the WiFi side, and random WiFi diassociations.
- When BT is streaming: 50% packet loss on the WiFi side and it quickly disassociates. BT does not seem to have any packet loss (at least on the application level). BT seems to have priority over WiFi.
In any case WiFi will not re-associate while BT is connected after the disassociation (it will try, but it will never succeed). However, once BT is disconnected, the WiFi will re-associate immediately.
The bottom line is that WiFi and BT cannot be used simultaneously at all at the ESP32. I assume that the shared radio for BT and WiFi is the problem. Can anyone from Espressif confirm this?
Cheers,
Johannes
- When BT is enabled I see sporadically: wifi: bcn_timout,ap_probe_send_start
- When BT is enabled but disconnected: 1% packet loss on the WiFi side.
- When BT is connected: 2-4% packet loss on the WiFi side, and random WiFi diassociations.
- When BT is streaming: 50% packet loss on the WiFi side and it quickly disassociates. BT does not seem to have any packet loss (at least on the application level). BT seems to have priority over WiFi.
In any case WiFi will not re-associate while BT is connected after the disassociation (it will try, but it will never succeed). However, once BT is disconnected, the WiFi will re-associate immediately.
The bottom line is that WiFi and BT cannot be used simultaneously at all at the ESP32. I assume that the shared radio for BT and WiFi is the problem. Can anyone from Espressif confirm this?
Cheers,
Johannes
Re: Simultaneous WiFi and Bluetooth: Paket loss and WiFi disconnects
I talked with the sales engineer from my distributor. He said that there is one radio. Therefore, you can not do both simultaneously, though you might be able to switch back and forth between them fairly quickly. That doesn't work for my application.
Can someone from espressif confirm/deny that there is one radio only and therefore simultaneous BT/WiFi operation isn't possible?
Can someone from espressif confirm/deny that there is one radio only and therefore simultaneous BT/WiFi operation isn't possible?
Re: Simultaneous WiFi and Bluetooth: Paket loss and WiFi disconnects
BT/wifi coexistence (Google it) probably has not been optimized for bt classic/a2dp yet. Even if it can be you may need a significant ram buffer to stream a2dp audio and use wifi with acceptable performance.
Problem on other platforms too https://github.com/raspberrypi/linux/issues/1402
Problem on other platforms too https://github.com/raspberrypi/linux/issues/1402
-
- Posts: 28
- Joined: Thu Jan 05, 2017 10:46 am
Re: Simultaneous WiFi and Bluetooth: Paket loss and WiFi disconnects
Hi, BR/EDR and WIFI coexistence performance is in optimizing on ESP32.
There's a option in menuconfig "Software controls WiFi/Bluetooth coexistence" may do something positive impact. But there's a known bug. We are doing the second phase to optimize the performance of Bluetooth & WIFI coexistence.
There's a option in menuconfig "Software controls WiFi/Bluetooth coexistence" may do something positive impact. But there's a known bug. We are doing the second phase to optimize the performance of Bluetooth & WIFI coexistence.
-
- Posts: 60
- Joined: Mon Jun 26, 2017 5:36 am
Re: Simultaneous WiFi and Bluetooth: Paket loss and WiFi disconnects
I also get similar error while I am trying to add wifi in gatts_demo with ability to set wifi and password(I know there is a blufi demo but my developers don't understand protocol so we are making our own.)
code works it tries to connect, gets connected but after few seconds it disconnect with this error and when it tries to connect nothing happen. only disconnected event.
Code: Select all
I (16242) SPEC: WIFI connection initiate.
I (16242) wifi: wifi firmware version: 407bb27
I (16242) wifi: config NVS flash: enabled
I (16242) wifi: config nano formating: disabled
I (16252) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (16262) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (16292) wifi: Init dynamic tx buffer num: 32
I (16292) wifi: Init dynamic rx buffer num: 32
I (16292) wifi: wifi driver task: 3ffd943c, prio:23, stack:4096
I (16292) wifi: Init static rx buffer num: 10
I (16302) wifi: Init dynamic rx buffer num: 32
I (16302) wifi: Init rx ampdu len mblock:7
I (16302) wifi: Init lldesc rx ampdu entry mblock:4
I (16312) wifi: wifi power manager task: 0x3ffdb944 prio: 21 stack: 2560
I (16312) SPEC: start the WIFI SSID:[UNICORN] password:[*******]
I (16322) wifi: wifi timer task: 3ffdbba4, prio:22, stack:3584
I (16342) wifi: mode : sta (30:ae:a4:05:c8:10)
I (16342) SPEC: SYSTEM_EVENT_STA_START
I (16462) wifi: n:1 0, o:1 0, ap:255 255, sta:1 0, prof:1
I (17452) wifi: state: init -> auth (b0)
I (17452) wifi: state: auth -> assoc (0)
I (17462) wifi: state: assoc -> run (10)
I (17472) wifi: connected with UNICORN, channel 1
I (18212) event: ip: 192.168.1.121, mask: 255.255.255.0, gw: 192.168.1.1
I (18212) SPEC: WIFI got ip.
I (27462) wifi: pm start, type:0
I (28062) wifi: bcn_timout,ap_probe_send_start
I (30562) wifi: ap_probe_send over, resett wifi status to disassoc
I (30562) wifi: state: run -> init (1)
I (30562) wifi: pm stop, total sleep time: 0/3105750
I (30562) wifi: n:1 0, o:1 0, ap:255 255, sta:1 0, prof:1
Thanks.
-
- Posts: 60
- Joined: Mon Jun 26, 2017 5:36 am
Re: Simultaneous WiFi and Bluetooth: Paket loss and WiFi disconnects
Ok so I think when I disconnect from esp32 via ble after it connects to wifi it does not show the above error. but if I maintain the connect via ble After it is connected to wifi it generates that above error and disconnects.
I think it is because of using BLE and wifi togather Ble as gatt server. because in as gatt client I did not get this kind of problem before so I think it is only with ble server not sure.
Connect with BLE and
write wifi ssid and password as following
write this to first characteristics with write permission.
first enter SSID
A"youwifissid"
then enter password
B"yourpass"
then initiate wifi connection with
C
I think it is because of using BLE and wifi togather Ble as gatt server. because in as gatt client I did not get this kind of problem before so I think it is only with ble server not sure.
Connect with BLE and
write wifi ssid and password as following
write this to first characteristics with write permission.
first enter SSID
A"youwifissid"
then enter password
B"yourpass"
then initiate wifi connection with
C
- Attachments
-
- gatt_server.zip
- this contains modified example for setting wifi details over BLE.
- (52.05 KiB) Downloaded 743 times
Thanks.
Who is online
Users browsing this forum: Baidu [Spider] and 201 guests