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

NRF_ERROR_RESOURCES occurred when the connection is disconnected

Dear

First of all, I am so sorry because of my english skill.

I got NRF_ERROR_RESOURCES when the connection between NRF Module and mobile device is disconnected  due to the reduced signal strength because of long distance.

However, if I disconnect the connection by sending the disconnection command from mobile device, it works well without any errors.

I used app_timer_start api to send data for notification every 1s as following,

err_code = app_timer_start(m_bms_measurement1_timer_id, BMS_MEASUREMENT1_TIMER_INTERVAL, NULL);
APP_ERROR_CHECK(err_code);

I already set NRF_SDH_BLE_GAP_EVENT_LENGTH as 100 and used BLE_GATTS_EVT_HVN_TX_COMPLETE.

But I had same result as before.

Thanks in advance.

Parents
  • Thanks for quick response.

    I solved NRF_ERROR_NO_MEM problem with your recommend.

    I did the implementation as followings,

    increasing hvn_tx_queue_size = 27 with code in ble_stack_init function.

    increasing NRF_SDH_BLE_GAP_EVENT_LENGTH 235 in sdk_config.h

    didn't use  boolean ble_tx_completed in notification function for testing.

    uint32_t ble_cus_bms_measurement1_update(ble_cus_t * p_cus, struct bms_measurement1_s *m_bms_measurement, uint16_t conn_handle)
    {
        ble_gatts_hvx_params_t params;
        uint16_t len = sizeof(struct bms_measurement1_s);
    
        memset(&params, 0, sizeof(params));
        params.type   = BLE_GATT_HVX_NOTIFICATION;
        params.handle = p_cus->bms_measurement1_char_handles.value_handle;
        params.p_data = m_bms_measurement;
        params.p_len  = &len;
    
        //if(ble_tx_completed == true)
        //{
        //  ble_tx_completed = false;
        //  return sd_ble_gatts_hvx(conn_handle, &params);
        //}else return 0;
        return sd_ble_gatts_hvx(conn_handle, &params);
    }

    But I still have NRF_ERROR_RESOURCES.

    Thanks.

Reply
  • Thanks for quick response.

    I solved NRF_ERROR_NO_MEM problem with your recommend.

    I did the implementation as followings,

    increasing hvn_tx_queue_size = 27 with code in ble_stack_init function.

    increasing NRF_SDH_BLE_GAP_EVENT_LENGTH 235 in sdk_config.h

    didn't use  boolean ble_tx_completed in notification function for testing.

    uint32_t ble_cus_bms_measurement1_update(ble_cus_t * p_cus, struct bms_measurement1_s *m_bms_measurement, uint16_t conn_handle)
    {
        ble_gatts_hvx_params_t params;
        uint16_t len = sizeof(struct bms_measurement1_s);
    
        memset(&params, 0, sizeof(params));
        params.type   = BLE_GATT_HVX_NOTIFICATION;
        params.handle = p_cus->bms_measurement1_char_handles.value_handle;
        params.p_data = m_bms_measurement;
        params.p_len  = &len;
    
        //if(ble_tx_completed == true)
        //{
        //  ble_tx_completed = false;
        //  return sd_ble_gatts_hvx(conn_handle, &params);
        //}else return 0;
        return sd_ble_gatts_hvx(conn_handle, &params);
    }

    But I still have NRF_ERROR_RESOURCES.

    Thanks.

Children
  • Hello,

    EarlBread said:
    Thanks for quick response.

    No problem at all, I am happy to help!

    EarlBread said:
    I solved NRF_ERROR_NO_MEM problem with your recommend.

    Great, I am glad to hear that it resolved your issue.

    EarlBread said:

    I did the implementation as followings,

    increasing hvn_tx_queue_size = 27 with code in ble_stack_init function.

    increasing NRF_SDH_BLE_GAP_EVENT_LENGTH 235 in sdk_config.h

    didn't use  boolean ble_tx_completed in notification function for testing.

    EarlBread said:
    But I still have NRF_ERROR_RESOURCES.

    Thank you for clarifying. If you are still getting NRF_ERROR_RESOURCES with a queue size of 27 we will need to take a look at how often notifications are queued for sending.
    How many notifications do you intend to send each connection event? You're current connection interval is between 400 and 650 ms - how many notifications do you expect to send in this period, and how often is the ble_cus_bms_measurement1_update function called in your program?

    Best regards,
    Karl

Related