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

Speed / baudrate of the BLE connection?

Open pvonmoradi opened this issue 3 years ago • 0 comments

I'm using the UART over BLE example. It seems there is a "delay" somewhere between sending packets. Is it possible to make the transmission faster? Currently it looks like the Tx packets are saved in a buffer and are send periodically. Here is the code:

#include <Arduino.h>
#include "BLESerial.h"
#include "variant.h"
BLESerial bleSerial;

int32_t count = 5;
#define LED_DELAY 10

void setupBLE() {
    bleSerial.setLocalName("UART over BLE!");
    bleSerial.begin();
}
void printBLE() {
    if (bleSerial) {
        bleSerial.println(count);
    }
}

void setup() {
    Serial.setPins(PIN_SERIAL_RX, PIN_SERIAL_TX);

    Serial.begin(115200);
    Serial.println("Hi Pooya from nRF52832!");

    pinMode(BLUE_LED, OUTPUT);
    pinMode(GREEN_LED, OUTPUT);

    setupBLE();

}
void loop() {
    if (count > 0) {
        digitalWrite(BLUE_LED, HIGH);
        delay(LED_DELAY);
        digitalWrite(BLUE_LED, LOW);
        delay(LED_DELAY);
        digitalWrite(GREEN_LED, HIGH);
        delay(LED_DELAY);
        digitalWrite(GREEN_LED, LOW);
        delay(LED_DELAY);
    }
    count++;
    printBLE();
}

Note that the transmission delay doesn't seem to be around 4*LED_DELAY but much longer ~800ms.

pvonmoradi avatar Jan 20 '21 19:01 pvonmoradi