ESP32 Bluetooth large data transfer issue

sajith1369
Posts: 3
Joined: Tue Jun 15, 2021 5:49 am

ESP32 Bluetooth large data transfer issue

Postby sajith1369 » Tue Jun 15, 2021 7:15 am

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 .

ESP_Sprite
Posts: 9769
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32 Bluetooth large data transfer issue

Postby ESP_Sprite » Wed Jun 16, 2021 6:36 am

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.

sajith1369
Posts: 3
Joined: Tue Jun 15, 2021 5:49 am

Re: ESP32 Bluetooth large data transfer issue

Postby sajith1369 » Wed Jun 16, 2021 9:41 am

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.

ESP_Sprite
Posts: 9769
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32 Bluetooth large data transfer issue

Postby ESP_Sprite » Thu Jun 17, 2021 2:27 am

Well, then, how are you receiving the data over BT?

sajith1369
Posts: 3
Joined: Tue Jun 15, 2021 5:49 am

Re: ESP32 Bluetooth large data transfer issue

Postby sajith1369 » Thu Jun 17, 2021 5:16 am

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().
Attachments
sample_code_17062021.rar
(654 Bytes) Downloaded 555 times

ESP_Sprite
Posts: 9769
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32 Bluetooth large data transfer issue

Postby ESP_Sprite » Thu Jun 17, 2021 6:26 am

Hm, no clue, sorry.

tmadushan
Posts: 5
Joined: Tue Feb 26, 2019 12:33 pm

Re: ESP32 Bluetooth large data transfer issue

Postby tmadushan » Wed Jul 14, 2021 5:30 pm

Do you still need help on this? The RAR file is corrupted and cannot be opened.
Thanks and regards,
Tharanga

ESP_Sprite
Posts: 9769
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32 Bluetooth large data transfer issue

Postby ESP_Sprite » Thu Jul 15, 2021 1:19 am

FWIW, that rar file opens perfectly fine here.

Gilbert
Posts: 41
Joined: Wed Sep 16, 2020 2:58 pm

Re: ESP32 Bluetooth large data transfer issue

Postby Gilbert » Fri Jul 16, 2021 1:48 pm

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.

Who is online

Users browsing this forum: No registered users and 43 guests