Trouble receiving BLE data on Bluz


I’m trying to send data from an Android app to the Bluz via BLE. I can successfully connect to the Bluz service (871e0223-38ff-77b1-ed41-9fb3aa142db2) and I can write data to the 871e0225-38ff-77b1-ed41-9fb3aa142db2 characteristic, but nothing ever happens on the BLE.registerDataCallback(dataCallbackHandler); of the Bluz. I can trigger events from the Bluz (e.g. a pin going high/low) and send them via BLE to the phone and the phone can see them coming in on the other characteristic (871e0224-38ff-77b1-ed41-9fb3aa142db2)

I also tried using Nordic’s nRF Connect app to send the data as well, but it does the same thing. Receiving works fine in this app though.

Here is the test code I am using:

int testPin = D0;
BLEState currentState;

void dataCallbackHandler(uint8_t *data, uint16_t length) {
    Serial1.print("Received ");
    Serial1.println(" bytes");
    for(int i = 0; i < length; i++) Serial1.print(data[i]);

void setup() {
  pinMode(testPin, INPUT_PULLUP);
  Serial1.print("BLUZ STARTED IN ");
  if(digitalRead(testPin)) {
      Serial1.println("AUTOMATIC MODE");
  } else {
      Serial1.println("MANUAL MODE");

void loop() {
    if(BLE.getState() != currentState) {
        currentState = BLE.getState();
        Serial1.print("BLE state changed to ");
        switch(currentState) {
            case 0:
            case 1:
            case 2:
            case 3:
            case 4:

dataCallbackHandler never seems to be called. Serial1 is hooked up to a USB/serial on my computer so I can see what is happening. I originally did not have the SYSTEM_MODE() code in but added it hoping that it would fix the problem. I’m still not certain whether it needs to be in MANUAL mode to send locally or not?

Is there something else that needs to be done in order to successfully receive data sent to the Bluz via an Android app? Thanks!

Sending data to bluz requires a bit more additional information. We implemented a simple routing and paging protocol on top of BLE to get data to the correct places.

To send data to bluz and have it get to the registered callback, you have to add a header byte to the front of your data that tells it to route to this service. To do that, simply send the byte 0x04 on the front of any data you want to send. The 0x04 won’t be sent to your callback function, only everything after it.

Further, once you have sent all your data, you should perform a second write with the 2 byte data [0x03, 0x04]. This will tell bluz that you are done transmitting data.

You can see a bit more of the details of how to do this in this post: Bluz Noble Communication

Please let me know if you have any further questions.