Reguarding mouse HID example code.

Hello Developers,

                           my name is K.hemasundar, Here i am using nRF52833 micro controller with segger embedded stdui IDE. I have a problem with the Ble_HID_Mouse example code. the code is succefully flashed into the micro-controller and here i am using my laptop has a central device and android mobile with "nrf connect application". The problem is when i switch ON the periphral(nrf52833) the advertisment is doing well i am able to see the device name in the central devices. So, when i am trying to connect eith the peripheral it is not connecting.

static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
{
ret_code_t err_code;
printf("\npwr_mgmt_err=%d",err_code);
switch (p_ble_evt->header.evt_id)
{
case BLE_GAP_EVT_CONNECTED:
NRF_LOG_INFO("Connected");
err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
APP_ERROR_CHECK(err_code);

m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;

err_code = nrf_ble_qwr_conn_handle_assign(&m_qwr, m_conn_handle);
APP_ERROR_CHECK(err_code);
break;

case BLE_GAP_EVT_DISCONNECTED:
NRF_LOG_INFO("Disconnected");
// LED indication will be changed when advertising starts.

m_conn_handle = BLE_CONN_HANDLE_INVALID;
break;

case BLE_GAP_EVT_PHY_UPDATE_REQUEST:
{
NRF_LOG_DEBUG("PHY update request.");
ble_gap_phys_t const phys =
{
.rx_phys = BLE_GAP_PHY_AUTO,
.tx_phys = BLE_GAP_PHY_AUTO,
};
err_code = sd_ble_gap_phy_update(p_ble_evt->evt.gap_evt.conn_handle, &phys);
APP_ERROR_CHECK(err_code);
} break;

case BLE_GATTC_EVT_TIMEOUT:
// Disconnect on GATT Client timeout event.
NRF_LOG_DEBUG("GATT Client Timeout.");
err_code = sd_ble_gap_disconnect(p_ble_evt->evt.gattc_evt.conn_handle,
BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
APP_ERROR_CHECK(err_code);
break;

case BLE_GATTS_EVT_TIMEOUT:
// Disconnect on GATT Server timeout event.
NRF_LOG_DEBUG("GATT Server Timeout.");
err_code = sd_ble_gap_disconnect(p_ble_evt->evt.gatts_evt.conn_handle,
BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
APP_ERROR_CHECK(err_code);
break;

default:
// No implementation needed.
break;
}
}


/**@brief Function for initializing the BLE stack.
*
* @details Initializes the SoftDevice and the BLE event interrupt.
*/
static void ble_stack_init(void)
{

printf("\n in the ble_stack_init function\n");
ret_code_t err_code;

err_code = nrf_sdh_enable_request();
APP_ERROR_CHECK(err_code);
printf("\nnrf_sdh_enable_err=%d\n",err_code);
// Configure the BLE stack using the default settings.
// Fetch the start address of the application RAM.
uint32_t ram_start = 0;
err_code = nrf_sdh_ble_default_cfg_set(APP_BLE_CONN_CFG_TAG, &ram_start);
APP_ERROR_CHECK(err_code);
printf("\nsdh_def_enable_err=%d\n",err_code);
// Enable BLE stack.
err_code = nrf_sdh_ble_enable(&ram_start);
APP_ERROR_CHECK(err_code);
printf("\nsdh_ble_enable_err=%d\n",err_code);
// Register a handler for BLE events.
NRF_SDH_BLE_OBSERVER(m_ble_observer, APP_BLE_OBSERVER_PRIO, ble_evt_handler, NULL);
}

the above figure indicated that each function is working properly with returning 0 (0= NRF_SUCCESS). in the code RED line indicates this is the observer fucntion when advertising, this fucntion will monitor is there any request event from the central device. Here i am sending the connect request by clicking the device name in my central device but the event is not triggring here and the ble_evt_handler function not execuite. I don't know what's the reason behind this i am following example code but is not working. 
here i am using pca10100 with S140 softdevice and i tried with S113 too but nit working. please give me any suggestion or any information regurading this problem.

Best Regards,
k.hemasundar

Related