Skip to main content

Central device with custom Gatt write and notify

DA14530 and DA14531

2 months ago

Posted by saffetblt 15 points 3 replies
0 upvotes

I am using DA14531 Bluetooth module as Central Mode. I'm working through the example at "https://github.com/dialog-semiconductor/BLE_SDK6_examples/tree/main/con…". I discover the device I want to connect to and I make the connection in a healthy way. The device I am connecting to has 2 characteristics. One to write. The other is where notifications come in. I will post screenshots below. My question is: How do I write the uuid to the special characteristic I want and how do I read the data from the notification characteristic. Please help me. I wish you a good day.

Attachment Size
custom_gatt.PNG 112.01 KB

2 months ago

PM_Dialog

Hi saffetblt,

Thanks for your question online and thanks for using our SW Example.

Can you please share more info about your peripheral device? Is it another DA4531? If yes, the specific project is working with the PXP reporter example of the SDK/

All the GATT operations that the SW examples handles, exist in user_ble_gatt.c

To perform a GATT write, the user_ble_gatt_write() should be used with he proper handle.

To perform a GATT read, please use the user_gatt_read_simple().

The notifications as coming from the GAP Peripheral to the GAP Central device, so please share more info about your peripheral.

You can take a look at the ble_app_peripheral example of the SDK to check how to send notifications.

The following example might be helpful :

https://github.com/dialog-semiconductor/BLE_SDK6_examples/tree/main/connectivity/ble_Notify_button_Wakeup

Thanks, PM_Dialog

2 months ago

saffetblt 15 points

Hello, my peripheral device is another special device. DA14531 is not. I know how to send writes. I know that user_ble_gatt_write() , but I don't know what to write instead of the handle. I'm sharing a screenshot of the peripheral I'm using below. I think you will be more helpful.I have to do this development for an important project. t.

1 month ago

PM_Dialog

Hi saffetblt,

Apologies for my late response.  When the DA14531 is configured as a GAP Central device, it initiates the discovery procedure in order to discover the available services/characteristics. Once the discovery procedure is completed, then the application saves all the discovered services in a structure. That structure holds the discovered characteristics as well as the handle of each characteristic. The Central should know which handle corresponds to each characteristic.  With regards to this statement  “I don't know what to write instead of the handle”, all you need to do is to know the handle to the specific characteristic and perform a write into this.

In case you want to enable the notifications, you should write 0x01 to the CCC (Client Characteristic Configuration) of the specific notifiable characteristic in order to enable the notifications. If a characteristic is notifiable or indicatable, this descriptor (CCC) must exist. It is a two-bit value, with one bit for notifications and the other for indications. Keep in mind that notifications and Indications are complementary procedures, so it’s impossible to set both of these bits at the same time.

Thanks, PM_Dialog