BLE Peripheral disconnects every 30 seconds when reading notification

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
5 posts / 0 new
Last post
BVR
Offline
Last seen:1 year 9 months ago
Joined:2017-09-15 11:04
BLE Peripheral disconnects every 30 seconds when reading notification

Hi,

I have a BLE characteristic that is available in READ / NOTIFY mode.

我使用一个定制的ble_peripheral_app的基地my tests.

//characteristic
ble_uuid_from_string(xxx_UUID, &uuid);
ble_gatts_add_characteristic(&uuid, GATT_PROP_NOTIFY | GATT_PROP_READ, ATT_PERM_READ,
xxx_SIZE, 0, NULL, &service->xxx);
//descriptor
ble_uuid_create16(UUID_GATT_CLIENT_CHAR_CONFIGURATION, &uuid);
ble_gatts_add_descriptor(&uuid, ATT_PERM_RW, sizeof(uint16_t), 0,
&service->xxx_desc);

On a regular basis I am updating this value

if (m_conn_idx != BLE_CONN_IDX_INVALID) {
ble_gatts_send_event(m_conn_idx, type, GATT_EVENT_NOTIFICATION,
xxx_SIZE, &data);
}

Notification and read are working well for the first 30 seconds then my android application is disconnected.

I am using a setup similar to wrbl project for BLE configuration
#define BLE_ADV_INTERVAL (320)
#define BLE_CONN_FAST_INTV_MAX (15)
#define BLE_CONN_FAST_INTV_MIN (15)
#define BLE_CONN_SLOW_INTV_MAX (520)
#define BLE_CONN_SLOW_INTV_MIN (480)
#define BLE_MTU_SIZE (131)

Any idea on which setting I need to modify to ensure I can read my notification more than 30 seconds?

Thanks a lot,

Device:
MT_dialog
Offline
Last seen:2 months 2 days ago
Staff
Joined:2015-06-08 11:34
Hi BVR,

Hi BVR,

If you android device gets disconnected then you will have to check the reason of the disconnection, for starters, you will have to check if the device is still operational when you get the disconnection. Are you able to see the device advertising right after the disconnection from the device occurs ? If the device is still operational you will have to check the reason of the disconnection, so when the disconnection occurs you should get a BLE_EVT_GAP_DISCONNECTED the event comes with a reason for the disconnection, so checking the reason is a start to debug this.

Thanks MT_dialog

BVR
Offline
Last seen:1 year 9 months ago
Joined:2017-09-15 11:04
Thanks for your reply.

Thanks for your reply.

Based on the following test:
- ble_peripheral project from DA1468x_DA15xxx_SDK_1.0.12.1078.zip
- DA14681 Development Kit - Pro
- updates as in ble_peripheral_task.c (see attachment). Custom part is in the #if CFG_USER_SERVICE part to ease the debug + handle_evt_gap_connected method
- notification reader application : B-BLE android (https://play.google.com/store/apps/details?id=com.billy.billylightblue) for testing my characteristic (also tested with our own software).
- I do not have the problem with the notifications from wrbl firmware.

I still have the disconnect issue 0x13 :

Name : evt
Details:0x7fd36f0
Hex:0x7fd36f0

Name : hdr
Details:{evt_code = 258, length = 10}

Name : evt_code
Details:258
Hex:0x102

Name : length
Details:10
Hex:0xa

Name : conn_idx
Details:0
Hex:0x0

Name : address
Details:{addr_type = PRIVATE_ADDRESS, addr = "çH\217xkr"}

Name : addr_type
Details:PRIVATE_ADDRESS
Hex:0x1

Name : addr
Details:"çH\217xkr"
Hex:0x7fd36f7

Name : reason
Details:19 '\023'
Hex:0x13

Of course, the device is still operational afterward and can be connected again directly.

Thanks for your support.

BVR
Offline
Last seen:1 year 9 months ago
Joined:2017-09-15 11:04
I just forgot the handle

I just forgot the handle_write_request for the descriptor at the end.

Everything's ok now.

Adding the final sample file might be useful :)

MT_dialog
Offline
Last seen:2 months 2 days ago
Staff
Joined:2015-06-08 11:34
Hi BVR,

Hi BVR,

Thank you for the indication, also you might want to have a look at the Tutorial section of the 681, there is a tutorial regarding the custom profiles on the 68x family.

Thanks MT_dialog