I am trying to understand the maximum BT SPP transmission speed that can be achieved using ESP32.

What my project requires is to send 2bytes of data every 200us (5kHz) AND additional 15bytes of data every 50ms(20Hz) via BT.

I am trying to achieve that using BT SPP, however, I could not understand the speed of BluetoothSerial::write AND BluetoothSerial::print.

Based on my testing for 5kHz, the BluetoothSerial::write freezes after 2-3 seconds of connection.

BluetoothSerial::println function doesn't seem to freeze, however, the time taken for the function to complete doesn't seem to be constant. Please refer to the code below on how I measure the time taken for the function to complete.

The picture below shows the time in microseconds each time the function (dataFormat()) takes place. If you look through, there are 2 instances where the time duration is more than an average 0f 80us.

I would like to know, ESP32 BT SPP can achieve such a speed or there is another way I could achieve this.

Thank you for your time and assistance in this matter. I have asked the same question in ESP32 Forum as well here.

void dataFormat(record r){
  serialBtPrint_dur = micros();
  char msg[20];
  sprintf(msg,"%04d%05d%05d%05",r.e, r.r, r.p, r.y);
  serialBtPrint_dur = micros() - serialBtPrint_dur;

void loop() {
  char msg[20];
  uint8_t testMsg[20] = "abcdefghijklmnop\n";

duration for each fuction call of dataFormat in us

1 Answer 1


This seems more like an overflow issue with something than an actual delay. If you look at the time in the log, it seems you aren't skipping seconds in the log (aka, 19:12:32.234 in two sequential log entries when you claim a delay). I think it's an error of working with larger than 8-bit data sizes. I know this is an old question, but I was looking for info and came upon it and figured I'd ask.

  • Thanks actually for having a thought on this. It has not been solved which lead me to use a different mechanism. For this particular scenario, the overflow would only happen if the micros difference is bigger than 8bit data size, which in theory shouldn't happen. Commented Jan 15, 2021 at 18:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.