Skip to content

ESP32 BLE Write Characteristic Not Updating

DodaTech Updated 2026-06-26 1 min read

In this tutorial, you'll learn about ESP32 BLE Write Characteristic Not Updating. We cover key concepts, practical examples, and best practices.

The Problem

ESP32 BLE server does not update characteristic value when client writes to it.

Quick Fix

Wrong

class MyCallbacks: public BLECharacteristicCallbacks {
  void onWrite(BLECharacteristic* pChar) {}
};
pChar->setCallbacks(new MyCallbacks());
Client writes new value. No update occurs. Old value persists.
class MyCallbacks: public BLECharacteristicCallbacks {
  void onWrite(BLECharacteristic* pChar) {
    std::string val = pChar->getValue();
    Serial.printf("Received: %s", val.c_str());
  }
};
BLECharacteristic* pChar = pService->createCharacteristic(
  "beb5483e-36e1-4688-b7f5-ea07361b26a8",
  BLECharacteristic::PROPERTY_WRITE | BLECharacteristic::PROPERTY_READ
);
pChar->setCallbacks(new MyCallbacks());
Received: hello_from_client
Characteristic value updated successfully

Prevention

Register a BLECharacteristicCallbacks subclass on write-capable characteristics. Use PROPERTY_WRITE flag. Always call getValue() in the onWrite callback. Respond with a notification after write for confirmation. Handle long writes with PROPERTY_WRITE_NR.

DodaTech engineers apply these same patterns across Doda Browser, DodaZIP, and Durga Antivirus Pro for production IoT reliability.

FAQ

### How do I handle long BLE writes?

Use PROPERTY_WRITE_NR (Write Without Response) for large payloads. The ESP32 splits writes automatically but expects the client to handle flow control.

Can I reject a BLE write?

Yes. In onWrite(), check the value and return early without updating if it fails validation. Send an error indication to the client.

What is the maximum BLE write size?

With standard MTU (23 bytes), max write is 20 bytes. With MTU extension up to 512 bytes, longer writes are possible.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro