sd_ble_gatts_hvx returns NRF ERROR RESOURCES while transferring bytes

Hi Team ,

      After a few transmission of data i m getting continuously  NRF ERROR RESOURCES , i have referred few of links which suggested to increase the  NRF_SDH_BLE_GAP_EVENT_LENGTH which internally increase the softdevice buffer  and i have done changes that too. still i am getting the same after exactly 5-7 packets continuously getting the same error.  I m using ble_app_hrs_rscs_relay_pca10056_s140  [ softdevice 140] and sdk 15.2

// <i> Requested BLE GAP data length to be negotiated.

#ifndef NRF_SDH_BLE_GAP_DATA_LENGTH
#define NRF_SDH_BLE_GAP_DATA_LENGTH  251   
#endif

// <o> NRF_SDH_BLE_PERIPHERAL_LINK_COUNT - Maximum number of peripheral links. 
#ifndef NRF_SDH_BLE_PERIPHERAL_LINK_COUNT
#define NRF_SDH_BLE_PERIPHERAL_LINK_COUNT 1
#endif

// <o> NRF_SDH_BLE_CENTRAL_LINK_COUNT - Maximum number of central links. 
#ifndef NRF_SDH_BLE_CENTRAL_LINK_COUNT
#define NRF_SDH_BLE_CENTRAL_LINK_COUNT 5
#endif

// <o> NRF_SDH_BLE_TOTAL_LINK_COUNT - Total link count. 
// <i> Maximum number of total concurrent connections using the default configuration.

#ifndef NRF_SDH_BLE_TOTAL_LINK_COUNT
#define NRF_SDH_BLE_TOTAL_LINK_COUNT 6
#endif

// <o> NRF_SDH_BLE_GAP_EVENT_LENGTH - GAP event length. 
// <i> The time set aside for this connection on every connection interval in 1.25 ms units.

#ifndef NRF_SDH_BLE_GAP_EVENT_LENGTH
#define NRF_SDH_BLE_GAP_EVENT_LENGTH  400     
#endif

// <o> NRF_SDH_BLE_GATT_MAX_MTU_SIZE - Static maximum MTU size. 
#ifndef NRF_SDH_BLE_GATT_MAX_MTU_SIZE
#define NRF_SDH_BLE_GATT_MAX_MTU_SIZE 247              
#endif

// <o> NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE - Attribute Table size in bytes. The size must be a multiple of 4. 
#ifndef NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE
#define NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE   1408
#endif

if its the Queue issue  So how to set the queue size ? would you suggest the ideas what is the issue here 

Thanks in advance ,

Sowmiya

Parents
  • Hi Sowmiya, 

    When you receive NRF ERROR RESOURCES you should follow what suggested in the documentation of sd_ble_gatts_hvx() : "Too many notifications queued. Wait for a @ref BLE_GATTS_EVT_HVN_TX_COMPLETE event and retry."

    Increasing NRF_SDH_BLE_GAP_EVENT_LENGTH  won't help fix the issue, especially if the connection interval is smaller than NRF_SDH_BLE_GAP_EVENT_LENGTH . 


Reply
  • Hi Sowmiya, 

    When you receive NRF ERROR RESOURCES you should follow what suggested in the documentation of sd_ble_gatts_hvx() : "Too many notifications queued. Wait for a @ref BLE_GATTS_EVT_HVN_TX_COMPLETE event and retry."

    Increasing NRF_SDH_BLE_GAP_EVENT_LENGTH  won't help fix the issue, especially if the connection interval is smaller than NRF_SDH_BLE_GAP_EVENT_LENGTH . 


Children
  • is there a way to check queue size of notifications  in BLE_GATTS_EVT_HVN_TX_COMPLETE ?

  • I'm afraid not. You may need to count the number of available buffer by using the BLE_GATTS_EVT_HVN_TX_COMPLETE  event and the number of packet sent provided in the callback event: 

    * @note The application can keep track of the available queue element count for notifications by following the procedure below:
    * - Store initial queue element count in a variable.
    * - Decrement the variable, which stores the currently available queue element count, by one when a call to this function returns @ref NRF_SUCCESS.
    * - Increment the variable, which stores the current available queue element count, by the count variable in @ref BLE_GATTS_EVT_HVN_TX_COMPLETE event.

Related