Incomplete Bluetooth Packet received

I want to use an ESP32 for serial communication over Bluetooth.

The sensor module is connected to ESP32-CAM with high baud rate transmission, so I set the baud rate to 921600.

The complete packet size of the sensor is 1048 bytes, but it sometimes receives an incomplete packet of about 8xx bytes from Bluetooth on my laptop.

What is the MTU size for ESP32 Bluetooth?

Could I modify Bluetooth with a higher baud rate as below link and how to do it?

https://github.com/espressif/esp-idf/pull/4844

#include <BluetoothSerial.h>

BluetoothSerial BT;
TaskHandle_t Task1,Task2;


void setup() 
{
	Serial.begin(921600);
	Serial.setTimeout(10);
	
	BT.begin(Eric1030);															// open bluetooth
	while(!BT.hasClient());														// wait for connect
	delay(1000);

	xTaskCreatePinnedToCore(Task1_Serial,"Task1",10000,NULL,2,&Task1,0);
	xTaskCreatePinnedToCore(Task2_BT,"Task2",10000,NULL,2,&Task2,1);
}

/*---------------------------------------------------------------------------------*/
/*                                   RTOS Tasks                                    */
/*---------------------------------------------------------------------------------*/
void Task1_Serial(void * pvParameters)
{
	while (1)
	{
		if(Serial.available()>0)
		{
			String serialData = Serial.readString();
			BT.print(serialData);
		}
		delay(1);
	}
	
}

void Task2_BT(void * pvParameters)
{
	while (1)
	{
		if(BT.available()>0)
		{
			String btData = BT.readString();
			Serial.print(btData);
		}
		delay(1);
	}
	
}

void loop() 
{

}

do you have the same problem without using tasks?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.