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

NRF_ERROR_RESOURCES when calling sd_ble_gap_data_length_update()

Hi 

The Product (NRF52832) was upgraded from SD 4.0.2 to the SD6.1.1.

During the pairing procedure the sd_ble_gap_data_length_update() returns a NRF_ERROR_RESOURCES  error. I read some tickets from earlier SD, but it seems that the bug was fixed for the SD6.1.1. Do I have to configure something special that it works?

Log Snippet:
<debug> app: connState: onConnect, with CB:8C:14:DD:2A:50
<debug> app: Address Type: BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE PeerID: 0
<debug> app: BleAdv: device connected -> stop Advertising.
<debug> nrf_ble_gatt: Updating data length to 251 on connection 0x0.
<error> nrf_ble_gatt: sd_ble_gap_data_length_update() (request) on connection 0x0 returned NRF_ERROR_RESOURCES.
<error> nrf_ble_gatt: The requested TX/RX packet length is too long by 224/224 octets.

 

Thanks in advance 

Parents
  • Hello,

    Have you looked at the documentation for sd_ble_gap_data_length_update()?

    Look at ble_gap.h line 2598-2630.

    @retval ::NRF_ERROR_RESOURCES The connection event length configured for this link is not sufficient for the requested parameters.
    * Use @ref sd_ble_cfg_set with @ref BLE_CONN_CFG_GAP to increase the connection event length.
    * Inspect p_dl_limitation to see where the limitation is.

    Have you tried to debug the sd_ble_cfg_set() and look at the p_dl_limitation pointer that was returned by sd_ble_gap-data_length_update(). What was it set to? This gives the maximum available data length with the current settings.

    In order to increase the data length, you probably need to increase NRF_SDH_BLE_GAP_EVENT_LENGTH in sdk_config.h.

    Best regards,

    Edvin

  • Hi

    Thanks for the Input.

    I tried to change the "NRF_SDH_BLE_GAP_EVENT_LENGTH" but nothing happened. The I saw that the NRF_SDH_BLE_GAP_EVENT_LENGTH was never used, so I am trying to add it to the BLEStackInit. But with this Code Snippet (se below) I get the NRF_ERROR_INVALID_PARAM Error. But I dont get which Param is faulty.

        ret_code_t err_code;
    
        err_code = nrf_sdh_enable_request();
        APP_ERROR_CHECK(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_app_ram_start_get(&ram_start);
        APP_ERROR_CHECK(err_code);
    
        // Overwrite some of the default configurations for the BLE stack.
        ble_cfg_t ble_cfg;
    
        // Configure the number of custom UUIDS.
        memset(&ble_cfg, 0, sizeof(ble_cfg));
        ble_cfg.common_cfg.vs_uuid_cfg.vs_uuid_count = 11;
        err_code = sd_ble_cfg_set(BLE_COMMON_CFG_VS_UUID, &ble_cfg, ram_start);
        APP_ERROR_CHECK(err_code);
    
        // Configure the maximum number of connections.
        memset(&ble_cfg, 0, sizeof(ble_cfg));
        ble_cfg.gap_cfg.role_count_cfg.periph_role_count  = 1;  //!< must certainly be increased later, default is 1
        ble_cfg.gap_cfg.role_count_cfg.central_role_count = 0;
        ble_cfg.gap_cfg.role_count_cfg.central_sec_count  = 0;
        err_code = sd_ble_cfg_set(BLE_GAP_CFG_ROLE_COUNT, &ble_cfg, ram_start);
        APP_ERROR_CHECK(err_code);
    
        //Configure HVN (Handle Value Notification) Queue length
        /* set HVN queue size */
        memset(&ble_cfg, 0, sizeof(ble_cfg));
        ble_cfg.conn_cfg.params.gatts_conn_cfg.hvn_tx_queue_size = BLESTACK_CONFIG_HVN_QUEUE;
        sd_ble_cfg_set(BLE_CONN_CFG_GATTS, &ble_cfg, ram_start);
        APP_ERROR_CHECK(err_code);
    
        //Configure GAP
        memset(&ble_cfg, 0, sizeof(ble_cfg));
        ble_cfg.conn_cfg.conn_cfg_tag = BLE_CONN_CFG_TAG_DEFAULT;
        ble_cfg.conn_cfg.params.gap_conn_cfg.event_length = NRF_SDH_BLE_GAP_EVENT_LENGTH;
        err_code = sd_ble_cfg_set(BLE_CONN_CFG_GAP, &ble_cfg, ram_start);
        APP_ERROR_CHECK(err_code);
    
        // Enable BLE stack.
        err_code = nrf_sdh_ble_enable(&ram_start);
        APP_ERROR_CHECK(err_code);

  • is used in

    err_code = nrf_sdh_ble_default_cfg_set(APP_BLE_CONN_CFG_TAG, &ram_start);

    in several examples in our SDK. Please check out e.g. the ble_app_uart example.

    As you can see from your last screenshot, you request 0xfb (251), but with the current settings, it can only give 0xe0 (224).

Reply Children
No Data
Related