Getting Error Responses with "Insufficient Authentication" while central sends "write requests" to peripheral.

Hello,

I have two setups both using nrf5 SDK 16.0.

One based on the "multisink_central_pca10056_s140" where I based my work (bringing up and discovering some client services successfully). 

The second setup is a "custom" application and HW which is in working order and so far it was detecting some beacons. On this setup I had to import all my work from setup 1. Upon porting, when setup 2 is trying to connect and pair (just work) and then perform some initial standard "write requests", I experience Error Responses with "Insufficient Authentication" to all my write requests.

I suspect differences in the setup of the applications hence I am sharing the sdk_config.h files for both. The initialisation and handling of the services at the client/central side is the exact same code. So it is either something different in config or perhaps something within the security, connection module but I am not able to narrow down yet. 

Could you please provide some hints?

Regards

George


6786.sdk_config - setup1.h

7367.sdk_config - setup2.h

  • Hello,

    It looks like the problem starts when central is trying to authenticate the link at connection time, at the call link_secure_authenticate() where sd_ble_gap_authenticate() returns NRF_ERROR_NO_MEM.

    My setting of NRF_SDH_BLE_CENTRAL_LINK_COUNT was set initially to 1 (where failure was found) but then increasing it to 2 made no difference.

    I am struggling to find out what is gong wrong here...

    Regards

    George

  • Hello,

    At the end of the day it looks like the issue was caused by an additional call to 

    sd_ble_cfg_set() following a call to nrf_sdh_ble_default_cfg_set() in the ble_stack_init() function. At this stage, I am not sure what was the purpose of this and if this was intentional but it looks like it was related to enabling channel survey role!

    Is this something that I need to look at of doing differently? By commenting out the following code, I can successfully discover all the services but I am not sure if the channel survey bit will work, any ideas?

    // Configure the GATTS attribute table.
    ble_cfg_t ble_cfg;
    memset(&ble_cfg, 0x00, sizeof(ble_cfg));
    ble_cfg.gap_cfg.role_count_cfg.periph_role_count = NRF_SDH_BLE_PERIPHERAL_LINK_COUNT;
    ble_cfg.gap_cfg.role_count_cfg.central_role_count = NRF_SDH_BLE_CENTRAL_LINK_COUNT;

    /* Enable channel survey role */
    ble_cfg.gap_cfg.role_count_cfg.qos_channel_survey_role_available = false;

    err_code = sd_ble_cfg_set(BLE_GAP_CFG_ROLE_COUNT, &ble_cfg, (uint32_t)&ram_start);
    if(err_code != NRF_SUCCESS){
    NRF_LOG_ERROR("sd_ble_cfg_set() returned %s when attempting to set BLE_GAP_CFG_ROLE_COUNT.",
    nrf_strerror_get(err_code));
    }

    Regards

    George

  • gliako said:
    Can nRF Connect app tell me what security level I need?

    I don't think that is broadcasted. You need to experiment. 

    gliako said:

    link_secure_authenticate() where sd_ble_gap_authenticate() returns NRF_ERROR_NO_MEM.

    According to the declaration of sd_ble_gap_authenticate in ble_gap.h, NRF_ERROR_NO_MEM means that the maximum number of authentication procedures that can run in parallel for the given role is reached. Wait for a short amount of time and try again. Could it be that you are trying to do this twice already?

    gliako said:
    Is this something that I need to look at of doing differently? By commenting out the following code, I can successfully discover all the services but I am not sure if the channel survey bit will work, any ideas?

    I have not tested that before. Does it return anything other than NRF_SUCCESS? 

    When you initialize your BLE stack, does the log say anything about adjusting the RAM parameters?

    Best regards,

    Edvin

Related