I'm using the Espressif Arduino BLE library on an ESP32C3. The ESP32 acts as a central device and connects to a peripheral Raspberry PI running Linux. I am attempting to send a relatively large amount of data through a characteristic with what is essentially this code:
for(size_t i = 0; i < num_chunks; i++) {
uint8_t* data = get_chunk_from_flash(i);
// ESP32C3 eventually hangs without delay
delay(10);
remoteCharacteristic->WriteValue(data, 512, false);
};
In each iteration I read 512 bytes from flash and write to the remote characteristic. I do manage to get some chunks sent over before the device hangs
I'm wondering if there's a callback (internal or public) that I could use to eliminate the delay and time the next call to WriteValue
I realize that BLE isn't really designed for large data transfer, but it is the only bluetooth protocol available and is less power-intensive than WiFi