This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Bluetooth disconnects when notification enabled

Hi,

I'm using SDK 15.2. The bluetooth disconnects when I enable notifications on nrfConnect. This happens only if I increase the number of bytes to be sent. I'm writing a code for custom gatt. The references I used were - 

https://github.com/maidenone/custom_ble_service_example

https://devzone.nordicsemi.com/nordic/short-range-guides/b/bluetooth-low-energy/posts/ble-characteristics-a-beginners-tutorial

My code files - 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "sdk_common.h"
#include "ble_srv_common.h"
#include "ble_cus.h"
#include <string.h>
#include "nrf_gpio.h"
#include "boards.h"
#include "nrf_log.h"
/**@brief Function for handling the Connect event.
* @param[in] p_cus Custom Service structure.
* @param[in] p_ble_evt Event received from the BLE stack. */
static void on_connect(ble_cus_t * p_cus, ble_evt_t const * p_ble_evt)
{
p_cus->conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
ble_cus_evt_t evt;
evt.evt_type = BLE_CUS_EVT_CONNECTED;
p_cus->evt_handler(p_cus, &evt);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

ble_cus.h

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/**
* Copyright (c) 2014 - 2018, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

sdk_config.h