SD GATT procedure failed on Central device.

Hi All,

         I am using NRF52840 in my project and working on SDK 17.0.2. I have one central device and 2 Peripherals. The peripherals are connected to the central properly after power ON. Now let's say I Power OFF the central device for sometime. The peripherals are still kept ON and they keep advertising continuously. Let's say after after sometime I powered ON the central device, it should be able to connect to both the peripherals. What I am observing is sometimes it goes for connection but it gets "SD GATT procedure failed on Central device." and disconnects from that peripheral. The log I observed on central device is as follows:-

00> <error> nrf_ble_gq: SD GATT procedure (2) failed on connection handle 1 with error: 0x0000000D.
00>
00> <info> app: BLE_GATTC_EVT_TIMEOUT
00>
00> <info> app: CENTRAL: Disconnected, handle: 1, reason: 0x16

Also when a peripheral is disconnected it gets hanged and I have to reboot it to connect again.

Is this central device firmware issue or the peripheral device firmware issue? How to solve this issue?

Thanks & Regards,

Snehal Bundele.

  • Hi Susheel, 

                     I have solved the GATT error. But still if there are 2 peripherals sometimes only one gets connected to the central. My configuration for central is as follows:-

    #define APP_BLE_OBSERVER_PRIO               3                                       /**< Application's BLE observer priority. You shouldn't need to modify this value. */
    #define APP_BLE_CONN_CFG_TAG                1                                       /**< A tag identifying the SoftDevice BLE configuration. */
    
    #define APP_ADV_INTERVAL                    300                                     /**< The advertising interval (in units of 0.625 ms. This value corresponds to 187.5 ms). */
    #define APP_ADV_DURATION                    0                                       /**< The advertising duration (180 seconds) in units of 10 milliseconds. */
    
    #define RTC_INTERVAL                        1000                                    /**< RTC interval (ms). */
    
    #define MIN_CONN_INTERVAL                   MSEC_TO_UNITS(200, UNIT_1_25_MS)        /**< Minimum acceptable connection interval (0.4 seconds). */
    #define MAX_CONN_INTERVAL                   MSEC_TO_UNITS(300, UNIT_1_25_MS)        /**< Maximum acceptable connection interval (0.65 second). */
    
    
    
    #define SLAVE_LATENCY                       4                                       /**< Slave latency. */
    #define CONN_SUP_TIMEOUT                    MSEC_TO_UNITS(5000, UNIT_10_MS)         /**< Connection supervisory time-out (4 seconds). */
    
    #define FIRST_CONN_PARAMS_UPDATE_DELAY      5000                                    /**< Time from initiating event (connect or start of notification) to first time sd_ble_gap_conn_param_update is called (5 seconds). */
    #define NEXT_CONN_PARAMS_UPDATE_DELAY       30000                                   /**< Time between each call to sd_ble_gap_conn_param_update after the first call (30 seconds). */
    #define MAX_CONN_PARAMS_UPDATE_COUNT        3                                       /**< Number of attempts before giving up the connection parameter negotiation. */
    
    
    
    #define NRF_BLE_SCAN_SCAN_INTERVAL 160
    #define NRF_BLE_SCAN_SCAN_DURATION 0
    #define NRF_BLE_SCAN_SCAN_WINDOW 80
    #define NRF_BLE_SCAN_MIN_CONNECTION_INTERVAL 7.5
    #define NRF_BLE_SCAN_MAX_CONNECTION_INTERVAL 30
    #define NRF_BLE_SCAN_SLAVE_LATENCY 0
    #define NRF_BLE_SCAN_SUPERVISION_TIMEOUT 4000
    

    Can we modify any config to get a stable connection from all peripherals?

  • That is not easy to answer without knowing why the other peripheral does not connect. Do you have any error code when the central sends a connect request or is it just a connect request timed out?

    Are you sending the connect request from the central on receiving the adv packet or is there different logic on how you send the connect request?

  • Hi Susheel,

    Actually I have identified the issue. I have set scan name filter in my central firmware. Name filter includes 2 peripheral devices. Now the problem is when the scanning starts, the central device scans both and tries to connect to both of them at a time. During this process some packets of one of the peripheral device  are lost and it doesn't complete full cycle of connection due to this only pne peripheral is connected properly. In the central logs it shows me that both peripherals initiated connection but no packets are received from the peripheral 2. I can see only peripheral 1 packets. 

    Can we handle this? Can we set some interval somewhere so that connection to peripherals happen one by one?

    Thanks & Regards,

    Snehal

  • sne_333 said:
    Can we handle this? Can we set some interval somewhere so that connection to peripherals happen one by one?

    When two devices are connected then the connection events will be multiplexed over time. Also it should not be possible to lose packets in a connection in BLE. So the main question here is that if the central 2 is transmitting the data in the connection2 and the peripheral2 is not able to process it or if the central2 is not able to transmit data at all?

    You need to see the sniffer log to get the answer to the above questions.

    If the central2 is transmitting data, then there is some issue with the context in which peripheral2 is processing data. Maybe there is a deadlock or peripheral1 data processing is startving peripheral2 data processing? 

Related