ESP32 Arduino BluetoothSerial Max Speed

karunanj
Posts: 1
Joined: Wed Mar 04, 2020 1:32 pm

ESP32 Arduino BluetoothSerial Max Speed

Postby karunanj » Wed Mar 11, 2020 1:06 pm

Hi guys,

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 te time is more than average 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.


[/Codebox]
  1.   void dataFormat(record r){
  2.   serialBtPrint_dur = micros();
  3.   char msg[20];
  4.   sprintf(msg,"%04d%05d%05d%05",r.e, r.r, r.p, r.y);
  5.   SerialBT.println(msg);
  6.   serialBtPrint_dur = micros() - serialBtPrint_dur;
  7.   }
  8. }
  9.  
  10. void loop() {
  11.   char msg[20];
  12.   uint8_t testMsg[20] = "abcdefghijklmnop\n";
  13.   if(!structs.isEmpty()){
  14.     dataset[local_rd_ptr].yawData);
  15.     data::dataFormat(structs.shift());
  16.     Serial.println(serialBtPrint_dur);
  17.   }
  18. }
  19.  
Serial OUT.jpg
Serial OUT.jpg (82.49 KiB) Viewed 4613 times

Who is online

Users browsing this forum: Masoud123456 and 63 guests