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

BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_FOUND not found error in nrf52

Hi,

I am using NRF52840 DK in our project . I  am using 15.3.0 SDK  and soft device s140 in our project .Here the nrf52840 dk board is client and other controller bluetooth is used as slave which as 1 base uuid and 4  128 bit characteristics uuid .I am able to connect to the peripheral by scanning device name.Now  i successfully connected to the peripheral devuce. But while doing service discovery i am getting BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_FOUND  in service discovery. can you tell me  how to resolve this issue. as i know only 128 bit base uuid and i dont know the service uuid . Plz help me to resolve this issue.

  • Hi,

    The BLE_GATTS_EVT_SYS_ATTR_MISSING (MSC) event must be handled by your application if you don't use the Peer manager module. Try to include the following code in your ble_evt_handler (copied from ble_app_uart example):

    /**@brief Function for handling BLE events.
     *
     * @param[in]   p_ble_evt   Bluetooth stack event.
     * @param[in]   p_context   Unused.
     */
    static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
    {
        uint32_t err_code;
    
        switch (p_ble_evt->header.evt_id)
        {
        
         ...
        case BLE_GAP_EVT_SEC_PARAMS_REQUEST:
                // Pairing not supported
                err_code = sd_ble_gap_sec_params_reply(m_conn_handle, BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP, NULL, NULL);
                APP_ERROR_CHECK(err_code);
                break;
    
        case BLE_GATTS_EVT_SYS_ATTR_MISSING:
                // No system attributes have been stored.
                err_code = sd_ble_gatts_sys_attr_set(m_conn_handle, NULL, 0, 0);
                APP_ERROR_CHECK(err_code);
                break;
         ...

  • Thanks for the reply.

    I have tried to include the BLE_GATTS_EVT_SYS_ATTR_MISSING event but still it is getting attribute not found and service not found at the peer. Plz  help me.

  • Sorry, I misread the question, the BLE_GATTS_EVT_SYS_ATTR_MISSING event handling is not related to the error you got. Have you added the base uuid with the sd_ble_uuid_vs_add() function in your client code? Remember that the byte order is little-endian when you add you add new based UUID (opposite of what's displayed in nrf connect app)  

  • Yes,

    I have added the 128 bit base uuid and  128 bit service uuid to the function  sd_ble_uuid_vs_add()  in client. still i am getting the same error.I have attached the code below  plz check the code.

    uint32_t ble_lbs_c_init(ble_lbs_c_t * p_ble_lbs_c, ble_lbs_c_init_t * p_ble_lbs_c_init)
    {
    uint32_t err_code;
    ble_uuid_t lbs_uuid;
    ble_uuid128_t lbs_base_uuid = {LBS_UUID_BASE};
    ble_uuid128_t lbs_service_uuid = {LBS_UUID_SERVICE_UUID};

    VERIFY_PARAM_NOT_NULL(p_ble_lbs_c);
    VERIFY_PARAM_NOT_NULL(p_ble_lbs_c_init);
    VERIFY_PARAM_NOT_NULL(p_ble_lbs_c_init->evt_handler);

    p_ble_lbs_c->peer_lbs_db.button_cccd_handle = BLE_GATT_HANDLE_INVALID;
    p_ble_lbs_c->peer_lbs_db.button_handle = BLE_GATT_HANDLE_INVALID;
    p_ble_lbs_c->peer_lbs_db.led_handle = BLE_GATT_HANDLE_INVALID;
    p_ble_lbs_c->conn_handle = BLE_CONN_HANDLE_INVALID;
    p_ble_lbs_c->evt_handler = p_ble_lbs_c_init->evt_handler;

    err_code = sd_ble_uuid_vs_add(&lbs_base_uuid, &p_ble_lbs_c->uuid_type);
    if (err_code != NRF_SUCCESS)
    {
    return err_code;
    }
    VERIFY_SUCCESS(err_code);
    err_code = sd_ble_uuid_vs_add(&lbs_service_uuid, &p_ble_lbs_c->uuid_type);
    if (err_code != NRF_SUCCESS)
    {
    return err_code;
    }
    VERIFY_SUCCESS(err_code);


    lbs_uuid.type = p_ble_lbs_c->uuid_type;
    lbs_uuid.uuid = LBS_UUID_SERVICE;
    return ble_db_discovery_evt_register(&lbs_uuid);
    }

    #define LBS_UUID_BASE {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,\
    0x00, 0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb} /**< Used vendor specific UUID. **/


    #define LBS_UUID_SERVICE_UUID {0x39, 0x23, 0xcf, 0x40, 0x73, 0x16, 0x42, 0x9a, \
    0x5c, 0x41, 0x7e, 0x7d, 0xc4, 0x9a, 0x83, 0x14} /**< Used vendor specific UUID. */


    #define LBS_UUID_SERVICE 0x9AC4

    Plz check the code and plz help me.

Related