arduino-BLEPeripheral icon indicating copy to clipboard operation
arduino-BLEPeripheral copied to clipboard

Transmit Data As Fast As Possible

Open kevin-webster opened this issue 7 years ago • 2 comments

I've set up a UART characteristic and I'm wanting to stream data from a sensor via the BLECharacteristic.

The UART service and TX/RX characteristics are defined as follows:

BLEService uartSrv("6E400001B5A3F393E0A9E50E24DCCA9E");
BLECharacteristic rxChar("6E400002B5A3F393E0A9E50E24DCCA9E", BLEWriteWithoutResponse, 32);
BLECharacteristic txChar("6E400003B5A3F393E0A9E50E24DCCA9E", BLENotify, 32);

And I send data out via:

txChar.setValue((const unsigned char *)&data, sizeof(data));

What I've noticed is that after about 5/10 successful transmissions, the BLE engine seems to stop and no more data is transmitted.

Am I doing this correctly? What mechanism can I implement to ensure that the data is successfully sent before I can start another transmission?

kevin-webster avatar Aug 19 '18 11:08 kevin-webster

Hi webzoid,

Have you managed to solve the problem? I was looking in BLESerial.cpp and they flush the data after they send some chars. Take a look here: https://github.com/sandeepmistry/arduino-BLEPeripheral/blob/master/examples/serial/BLESerial.cpp

dots123 avatar Aug 25 '18 11:08 dots123

Hi @dots123

I haven't yet solved the issue. I call poll (as in the BLESerial.cpp flush function) after the txChar.setValue(...) function yet this doesn't seem to make a difference.

kevin-webster avatar Aug 25 '18 12:08 kevin-webster