Hello, Could someone give me a hint with the following problem?
I am using two example projects (ble_app_uart_c, ble_app_hrs) to connect a central and a peripheral. An UUID is added to the peripheral (former ble_app_hrs) in order to support an additional service (device state). With this configuration the central is able to establish a stable connection and read the changes of the new service. The service discovery looks like this:
But when I add a second characteristic to the peripheral the connection is disconnected after the registration. The new service discovery looks like this:
When observing the central the disconnection takes place shortly after the following event(s):
…
BLE_GATTC_EVT_DESC_DISC_RSP
BLE_GATTC_EVT_WRITE_RSP
BLE_GATTC_EVT_HVX --> on_hvx(...)
… and the reason was timeout for the disconnection.
Any ideas ? I guess it’s a simple beginners error but I’ve spent many days to look through the forum and documentation but without success …
I addition I enclose the stack init function of the central:
static void ble_stack_init(void)
{
uint32_t err_code;
uint32_t app_ram_base;
// Initialize the SoftDevice handler module.
SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, NULL);
// Enable BLE stack.
ble_enable_params_t ble_enable_params;
memset(&ble_enable_params, 0, sizeof(ble_enable_params));
#if (defined(S130) || defined(S132))
// Attribute Table size in bytes. The size must be a multiple of 4. @ref BLE_GATTS_ATTR_TAB_SIZE_DEFAULT is used to set the default size.
ble_enable_params.gatts_enable_params.attr_tab_size = BLE_GATTS_ATTR_TAB_SIZE_DEFAULT;
#endif
ble_enable_params.common_enable_params.vs_uuid_count = 8; // Maximum number of 128-bit, Vendor Specific UUID bases to allocate
ble_enable_params.gatts_enable_params.service_changed = false; //IS_SRVC_CHANGED_CHARACT_PRESENT; // Include the Service Changed characteristic in the Attribute Table
ble_enable_params.gap_enable_params.central_conn_count = CENTRAL_LINK_COUNT; // Number of central links
ble_enable_params.gap_enable_params.central_sec_count = 0; // Number of SMP (Security Manager Protocol, security request) instances for all the central links
ble_enable_params.gap_enable_params.periph_conn_count = PERIPHERAL_LINK_COUNT; // Number of peripheral links
app_ram_base = __LINKER_APP_RAM_BASE;
err_code = sd_ble_enable(&ble_enable_params, &app_ram_base);
if(err_code == NRF_SUCCESS)
{
// Verify that __LINKER_APP_RAM_BASE matches the SD calculations
if(app_ram_base != __LINKER_APP_RAM_BASE)
{
#ifdef RTT_DBG
SEGGER_RTT_printf(0,"Warning: unused memory: 0x%x\r\n", __LINKER_APP_RAM_BASE - app_ram_base);
nrf_delay_ms(DEFAULT_NRF_ERROR_DELAY);
#endif
}
} else
{ if(err_code == NRF_ERROR_DATA_SIZE)
{ // Not enough memory for the SoftDevice. place a breakpoint here or output app_ram_base
#ifdef RTT_DBG
SEGGER_RTT_printf(0,"Fatal: Not enough memory for the selected configuration. Required: 0x%x\n\r", app_ram_base);
} else
{ SEGGER_RTT_printf(0,"Error: The function 'sd_ble_enable()' failed, code = %d\n\r", err_code);
}
nrf_delay_ms(DEFAULT_NRF_ERROR_DELAY);
#endif
APP_ERROR_CHECK(err_code);
}
// Register with the SoftDevice handler module for BLE events.
err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch);
APP_ERROR_CHECK(err_code);
}