Page 1 of 1

ESP32 Bluetooth large data transfer issue

Posted: Tue Jun 15, 2021 7:15 am
by sajith1369
Hi,

In ESP32-WROOM32, We are trying to send large image file (1MB+) through Bluetooth and the same will be send to UART 0. But we are not getting full data. Many data missing found. Is there any limitation ? . We also tried to save the data from Bluetooth to internal file system then later trying to send to UART 0. But the issue remains same. So what could be the reason.
Is ESP32-WROOM32 capable of doing this ?. Is there any source code or library available if possible?
So kindly help us on this .

Re: ESP32 Bluetooth large data transfer issue

Posted: Wed Jun 16, 2021 6:36 am
by ESP_Sprite
Hard to say, you could be losing data anywhere in the chain. Suggest you try to figure out where the problem is first: BT sender, BT receiver, UART sender, UART receiver.

Re: ESP32 Bluetooth large data transfer issue

Posted: Wed Jun 16, 2021 9:41 am
by sajith1369
In fact the problem is in Bluetooth receive section, When sending 1KB of .txt file to ESP32 using a mobile application (Serial Bluetooth terminal) the complete 1KB data is not receive.
The received data from ESP32 is 800bytes. Which will vary when multiple time data is sent through Bluetooth.

Re: ESP32 Bluetooth large data transfer issue

Posted: Thu Jun 17, 2021 2:27 am
by ESP_Sprite
Well, then, how are you receiving the data over BT?

Re: ESP32 Bluetooth large data transfer issue

Posted: Thu Jun 17, 2021 5:16 am
by sajith1369
The data is received in ESP32 by using Bluetooth serial library (BluetoothSerial.cpp and BluetoothSerial.h). The core version using is Ver.1.0.4. Each byte is received by using SerialBT.read().

Re: ESP32 Bluetooth large data transfer issue

Posted: Thu Jun 17, 2021 6:26 am
by ESP_Sprite
Hm, no clue, sorry.

Re: ESP32 Bluetooth large data transfer issue

Posted: Wed Jul 14, 2021 5:30 pm
by tmadushan
Do you still need help on this? The RAR file is corrupted and cannot be opened.

Re: ESP32 Bluetooth large data transfer issue

Posted: Thu Jul 15, 2021 1:19 am
by ESP_Sprite
FWIW, that rar file opens perfectly fine here.

Re: ESP32 Bluetooth large data transfer issue

Posted: Fri Jul 16, 2021 1:48 pm
by Gilbert
I had a similar problem. My ESP32 locked up after receiving 512 bytes. See my post https://www.esp32.com/viewtopic.php?f=19&t=22132. I could fix it by increasing the RX buffer size in BluetoothSerial.cpp to 2K. If you want to receive large files (like 1MB or more) I don't think that you can use this work-around. ESP32 may have enough memory on-board, but it also needs RAM for stack and heap in addition to whatever you assign for the BT RX buffer in BluetoothSerial.cpp.
It appears that the BTserial locks up when the RX buffer is full. It does not signal to the BT sender to suspend transmission and to resume when the RX buffer has been read by the application. The BT sender appears to be unaware of this limitation and just keeps sending until all data are gone, which means that all data beyond the 512 byte limit are sent into space.