adafruit / adafruit/Adafruit_nRF52_Arduino

Can't access to Service Data in the GATT

Open
#846 1 comment 0 reactions 0 assignees View on GitHub
Bug
Dominant language
C
Stars
699
Forks
570
PR merge metrics
No merged PRs in 30d

Description

### Operating System

Windows 11

### IDE version

PlatformIO

### Board

seeed-xiao-afruitnrf52-nrf52840-sense

### BSP version

adafruit/Adafruit BluefruitLE nRF51@^1.10.0

### Sketch

This code was suggested by ChatGPT in loop ...

### Option 1

```
BLEClientService pixelService("6e400001-b5a3-f393-e0a9-e50e24dcca9e");
BLEClientCharacteristic pixelCharacteristic("6e400003-b5a3-f393-e0a9-e50e24dcca9e");

void PixelDiceManager::connectCallback(uint16_t conn_handle) {
BLEConnection* connection = Bluefruit.Connection(conn_handle);
char central_name[32] = { 0 };
connection->getPeerName(central_name, sizeof(central_name));
Serial.print("Connecté à ");
Serial.println(central_name);

delay(100);
if (pixelService.discover(conn_handle)) {
if (pixelCharacteristic.discover()) {
pixelCharacteristic.setNotifyCallback(notif_callback_wrapper);
pixelCharacteristic.enableNotify();
Serial.println("Abonné aux notifications du dé Pixel.");
} else {
Serial.println("Caractéristique non trouvée.");
Bluefruit.disconnect(conn_handle);
}
} else {
Serial.println("Service non trouvé.");
Bluefruit.disconnect(conn_handle);
}
}
```

### Option 2

```
BLEClientUart clientUart;
void bleuart_rx_callback(BLEClientUart& uart_svc) {
Serial.print("Données reçues : ");
while (uart_svc.available()) {
Serial.print((char)uart_svc.read());
}
Serial.println();
}

void PixelDiceManager::connectCallback(uint16_t conn_handle) {
Serial.println("Connecté");

if (clientUart.discover(conn_handle)) {
Serial.println("Service BLE UART trouvé");
clientUart.enableTXD();
clientUart.setRxCallback(bleuart_rx_callback);
clientUart.enableTXD();
Serial.println("Prêt à recevoir des données");
} else {
Serial.println("Service BLE UART non trouvé");
Bluefruit.disconnect(conn_handle);
}
}
```

### What happened ?

I try to read data from a BLE device using Bluefruit
- I correctly have access to Advertiser Data
- I can connect to the device
- I can't discover the Service Data
- It works with ESP-32 BLE library

The [protocol is described here](https://github.com/GameWithPixels/.github/blob/main/doc/CommunicationsProtocol.md)

According to ChatGPT
- the Service Data can't be find and should require GATT level access or something similar
- the nRF lib see the service and ESP-32 BLE library also works
- the weird things? is that ServiceUUID is same as notifUUID `6e400001-b5a3-f393-e0a9-e50e24dcca9e`

I don't know how to do to perform list services or go deeper to get that service or notification to validate if it's a bug, a limitation of the library or if a workaround is possible ?

### How to reproduce ?

It requires the PixelDice to test

### Debug Log

_No response_

### Screenshots

Here is the nRF screenshot
![Image](https://github.com/user-attachments/assets/978f1ac9-5f0b-4db6-be1f-3c7f8f0253f0)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the CommunicationsProtocol.md document and the PixelDiceManager::connectCallback examples using BLEClientService and BLEClientUart. Reproduce the service discovery attempt with the PixelDice on the seeed-xiao-afruitnrf52-nrf52840-sense, comparing the nRF52 behavior with the working ESP-32 result. Done means establishing whether the GATT service or notification characteristic can be accessed, and documenting a confirmed bug, limitation, or workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
arduino, c
Domain
embedded-iot, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.