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

Classical Bluetooth SPP send throughput is very slow to Android (IDFGH-466) #2725

Closed
copercini opened this issue Nov 21, 2018 · 4 comments
Closed

Comments

@copercini
Copy link

copercini commented Nov 21, 2018

When sending data using esp_spp_write() at more than ~ 5KB/s to an Android phone, it triggers a lot of ESP_SPP_CONG_EVT events and the communication slow down, this problem doesn't occur in other systems, like a Windows PC with the same ESP code

Commenting out this line as proposed by Markus Becker, this issue seems less frequent and no more ESP_SPP_CONG_EVT events with a high throughput

More discussion about this problem, and workaround: https://www.esp32.com/viewtopic.php?t=5613

@Alvin1Zhang Alvin1Zhang changed the title Classical Bluetooth SPP send throughput is very slow to Android [TW#27549] Classical Bluetooth SPP send throughput is very slow to Android Nov 22, 2018
@blueMoodBHD
Copy link
Collaborator

Hi @copercini , There is one thing that needs attention here. We can't call esp_spp_write() multiple times in succession. We should wait for ESP_SPP_WRITE_EVT, then call esp_spp_write() again.
So, when do you call esp_spp_write()?If you call it multiple times in succession, please change it and test again.
Thanks.

@copercini
Copy link
Author

@blueMoodBHD it's already implemented here and here, the packets are queued and only written after get the previous packet ESP_SPP_WRITE_EVT and check if ESP_SPP_CONG_EVT is free to send

If you use arduino core for ESP32, you can test it using this simple code:

#include "BluetoothSerial.h"

BluetoothSerial SerialBT;

void setup() {
  Serial.begin(115200);
  SerialBT.begin("ESP32test"); //Bluetooth device name
  Serial.println("The device started, now you can pair it with bluetooth!");
}

void loop() {
  SerialBT.printf("abcdefghjklmnopqrstuvxwyz");
  delay(10); //If this delay is lower, the data rate if faster, causing a lot of transmission issues to Android, but not to others systems like Windows
}

@projectgus projectgus changed the title [TW#27549] Classical Bluetooth SPP send throughput is very slow to Android Classical Bluetooth SPP send throughput is very slow to Android (IDFGH-466) Mar 12, 2019
@ghost
Copy link

ghost commented Nov 2, 2020

Hi @copercini

Please pull the latest IDF and have a try. We have merged two MR related to SPP flow control. It will take several days to sync on Github.

Thanks
Weitianhua

@Alvin1Zhang
Copy link
Collaborator

Thanks for reporting and sorry for slow turnaround, the fix has been available at 8e4b919, feel free to reopen if the issue still happens. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants