nrf_ble_gq: SD GATT procedure (1) failed on connection handle 0 with error: 0x00000013.

NRF52840

S140

App based on ble_app_multilink_central.

I have tried to build a bridge between BLE peripheral and PC.

I have spend so many time on PC side app.

The problem is the COM port will close in the middle if there are many packets to send.I didn't think of MCU side problem,after many failure I thought of checking NRF52840,it did trigger the error in the title and reset. That close the com connection,and the com port gets ready soon before I can notice it.

I have browsered the devzone,and found many post mang years ago.

This is the solution:

//From
if (err_code == NRF_ERROR_BUSY) // Softdevice is processing another GATT request.
{
    NRF_LOG_DEBUG("SD is currently busy. The GATT request procedure will be attempted \
                          again later.");
}
//to
if (err_code == NRF_ERROR_BUSY) || (err_code == NRF_ERROR_RESOURCES) // Softdevice is processing another GATT request.
{
    NRF_LOG_DEBUG("SD is currently busy. The GATT request procedure will be attempted \
                again later.");
}

I don't want to change the SD code, it is not easy to maintain.Can I check first and then try to write? or Just not to reset system, ignore the data?

Thank you

Parents
  • Hello,

    To eliminate this problem without patching the SDK source file, I'm afraid the only option is to not use the BLE GATT Queue module for these requests and instead handle them in your application. Alternatively you can try to mitigate the problem by increasing the Softdevice queue size for GATT notifications and write commands in ble_stack_init() (write_cmd_tx_queue_size, hvn_tx_queue_size). 

    Best regards,

    Vidar

  • Thank you for reply.

    There is only 1 wireless modem for central device,so,packets to BLE peripherals should be processed one by one,I have defined queue for GATT:

    #define APP_BLE_CONN_CFG_TAG      1   //< Tag that refers to the BLE stack configuration that is set with @ref sd_ble_cfg_set. The default tag is @ref APP_BLE_CONN_CFG_TAG. 
    #define APP_BLE_OBSERVER_PRIO     3   //< BLE observer priority of the application. There is no need to modify this value. */
    
    GATEWAY_ARRAY_DEF(  
    					m_gateway_array, 
    					NRF_SDH_BLE_CENTRAL_LINK_COUNT); //< TGOI client instances. 
    
    BLE_DB_DISCOVERY_ARRAY_DEF(
    					m_db_disc_array, 
    					NRF_SDH_BLE_CENTRAL_LINK_COUNT); //< Database discovery module instances. 
    
    NRF_BLE_GQ_DEF(m_ble_gatt_queue,                     //< BLE GATT Queue instance. 
                   NRF_SDH_BLE_CENTRAL_LINK_COUNT,
                   NRF_BLE_GQ_QUEUE_SIZE);
    
    
    NRF_BLE_GATT_DEF(m_gatt);                            //< GATT module instance. 
    
    NRF_BLE_SCAN_DEF(m_scan);                            //< Scanning Module instance.

    When I try to add packets to queue, it transfers to request_process() or queue_process(), and it ignore NRF_ERROR_RESOURCES,and then reset, that is the whole story.

    I don't know  the meaning of " Softdevice queue size for GATT notifications and write commands ",you mean there is 2nd buffer  before TX modem? 

    If so,it can't solve the problem.

    Maybe it is better to change request_process() or queue_process() in nrf_ble_gq.c.

Reply
  • Thank you for reply.

    There is only 1 wireless modem for central device,so,packets to BLE peripherals should be processed one by one,I have defined queue for GATT:

    #define APP_BLE_CONN_CFG_TAG      1   //< Tag that refers to the BLE stack configuration that is set with @ref sd_ble_cfg_set. The default tag is @ref APP_BLE_CONN_CFG_TAG. 
    #define APP_BLE_OBSERVER_PRIO     3   //< BLE observer priority of the application. There is no need to modify this value. */
    
    GATEWAY_ARRAY_DEF(  
    					m_gateway_array, 
    					NRF_SDH_BLE_CENTRAL_LINK_COUNT); //< TGOI client instances. 
    
    BLE_DB_DISCOVERY_ARRAY_DEF(
    					m_db_disc_array, 
    					NRF_SDH_BLE_CENTRAL_LINK_COUNT); //< Database discovery module instances. 
    
    NRF_BLE_GQ_DEF(m_ble_gatt_queue,                     //< BLE GATT Queue instance. 
                   NRF_SDH_BLE_CENTRAL_LINK_COUNT,
                   NRF_BLE_GQ_QUEUE_SIZE);
    
    
    NRF_BLE_GATT_DEF(m_gatt);                            //< GATT module instance. 
    
    NRF_BLE_SCAN_DEF(m_scan);                            //< Scanning Module instance.

    When I try to add packets to queue, it transfers to request_process() or queue_process(), and it ignore NRF_ERROR_RESOURCES,and then reset, that is the whole story.

    I don't know  the meaning of " Softdevice queue size for GATT notifications and write commands ",you mean there is 2nd buffer  before TX modem? 

    If so,it can't solve the problem.

    Maybe it is better to change request_process() or queue_process() in nrf_ble_gq.c.

Children
No Data
Related