About Bluetooth connection failure (gatt error) and automatic disconnection in the middle of the connection process

Hi,

At present, our products have started production, but customers have reported three Bluetooth problems, which need technical assistance from Nordic to solve them as soon as possible.Using SDK17.1 flash_s140_nrf52_7.3.0_softdevice.

1、gatt error

For this problem, I modified xtal_accuracy according to some posts on the forum. The same is true. There will be an error 133 when the mobile phone applies for a connection, so is there any other solution for this?

2、When the Android phone is disconnected autonomously, nrf52833 does not open adv.

I explained to the customer that there is a situation where other threads of Android phones are still using Bluetooth devices and cannot advertise Bluetooth products. However, the customer used Samsung s22 to do a test. When connecting to the nrf52833 product, he directly turned off the Bluetooth of the mobile phone. After that, the Bluetooth product did not turn on the broadcast. Is there any other reason for this? The iPhone didn't have these issues in our phone tests.

3、During the Bluetooth connection process, the mobile phone will be disconnected. At present, there will be this phenomenon in my se 2020. The current connection parameters and broadcast interval have been configured according to the design requirements of ios, but there will still be disconnections.

The configuration is as follows:

#define APP_ADV_INTERVAL                874                             

#define APP_ADV_DURATION                0//18000                        

#define MIN_CONN_INTERVAL               MSEC_TO_UNITS(30, UNIT_1_25_MS) 
#define MAX_CONN_INTERVAL               MSEC_TO_UNITS(75, UNIT_1_25_MS) 
#define SLAVE_LATENCY                   0                               
#define CONN_SUP_TIMEOUT                MSEC_TO_UNITS(4000, UNIT_10_MS) 

Products are already in production, so we hope nordic will assist with these issues. thanks.

Parents
  • Today, together with nordic's technology, we solved the third problem. The time we gave for SECURITY_REQUEST_DELAY was only 400ms, which resulted in the incomplete security response of ios devices. For a normal connection, the "p_evt->evt_id" entering the pm_evt_handler() function is "1->0->9->15->2->3->9->6, 2->3->9". In the case of error disconnection, "p_evt->evt_id" is "1->0->9->15->2->3->9->6". So, how much should I adjust this time to? 1000ms and 4000ms, it has the sequence of events when it connects correctly.

    #define SECURITY_REQUEST_DELAY          APP_TIMER_TICKS(400)

  • Hi,

    1)

    There will be an error 133 when the mobile phone applies for a connection, so is there any other solution for this?

    This is something we sometimes see on lower-end phones, and is a phone-issue. What phone did you see this happening on?

    2)

    When the Android phone is disconnected autonomously, nrf52833 does not open adv.

    You need to start the advertising again in your code when you get the event BLE_GAP_EVT_DISCONNECTED 

    3)

    Today, together with nordic's technology, we solved the third problem.

    Great! Not sure if the name of that config is correct, in SDK 17 at least I believe it's called PM_HANDLER_SEC_DELAY_MS Try setting it at 4000 , ref: PM_HANDLER_SEC_DELAY_MS 

  • 1)

    This is something we sometimes see on lower-end phones, and is a phone-issue. What phone did you see this happening on?

    I found this on samsung s22, when I tested and found that s22 produced "gatt error" error, my product didn't receive connection event request. This is a problem. When I went to the nrf connect interface again, I found that the broadcast interval at that time was grayed out. I don’t know if the signal was not good, but I tested it at the same location (regardless of whether there is an error in the connection).

    2)

    You need to start the advertising again in your code when you get the event BLE_GAP_EVT_DISCONNECTED 

    In ble_advvertising.c, I added this to start broadcasting, and then I didn't add it in my ble_evt_handler.

    /**@brief Function for handling the Disconnected event.
     *
     * @param[in] p_advertising Advertising module instance.
     * @param[in] p_ble_evt Event received from the BLE stack.
     */
    static void advertising_on_disconnected(ble_advertising_t * const p_advertising, ble_evt_t const * p_ble_evt)
    {
        uint32_t ret;
    
        p_advertising->whitelist_temporarily_disabled = false;
    
        if (p_ble_evt->evt.gap_evt.conn_handle == p_advertising->current_slave_link_conn_handle &&
            p_advertising->adv_modes_config.ble_adv_on_disconnect_disabled == false)
        {
           ret = ble_advertising_start(p_advertising, BLE_ADV_MODE_DIRECTED_HIGH_DUTY);
           if ((ret != NRF_SUCCESS) && (p_advertising->error_handler != NULL))
           {
               p_advertising->error_handler(ret);
           }
        }
    }
    

    3)

    PM_HANDLER_SEC_DELAY_MS currently modifies it to 1000ms, don't know if it works. We test ok for now.

  • 1) Does it happen every time you try to connect? Could you take a sniffer trace of the behavior? https://www.nordicsemi.com/Products/Development-tools/nrf-sniffer-for-bluetooth-le
    2) So it's now working?

    3) OK, good that it's working now.

  • 1) Yes, we have technical support with nordic to capture packets and analyze this problem.There are two cases, one is that the Samsung s22 mobile phone sends a request, but it does not actually capture the connected data packets, causing nrf connect to generate a gatt error (mobile phone problem). Another situation is that the Samsung s22 initiates a connection within 200ms, but the device does not respond (this situation has not been reproduced in nordic's laboratory, so it is not resolved).

    s22 gatt normal.pcapngs22 gatt error.pcapng

    This is the packet captured in normal and error cases. Can you help us analyze it?

    2)It has been working normally, and I don't understand why the customer's mobile phone does not broadcast. So no changes, add operations.

    Thank you for your reply.

  • Mikey said:
    Another situation is that the Samsung s22 initiates a connection within 200ms, but the device does not respond

    Do you have a external LF crystal on your board?
    In sdk_config.h, what are these currently configured to?

    NRF_SDH_CLOCK_LF_SRC
    NRF_SDH_CLOCK_LF_RC_CTIV
    NRF_SDH_CLOCK_LF_RC_TEMP_CTIV
    NRF_SDH_CLOCK_LF_ACCURACY
    

    Check both application project sdk_config.h and the bootloader sdk_config.h

    As an test, could you try to set NRF_SDH_CLOCK_LF_ACCURACY to 1 (i.e. 500 ppm) ?

    If it's already set to 1 (500ppm), try set NRF_SDH_CLOCK_LF_SRC to 2(NRF_CLOCK_LF_SRC_SYNTH) as well.

Reply
  • Mikey said:
    Another situation is that the Samsung s22 initiates a connection within 200ms, but the device does not respond

    Do you have a external LF crystal on your board?
    In sdk_config.h, what are these currently configured to?

    NRF_SDH_CLOCK_LF_SRC
    NRF_SDH_CLOCK_LF_RC_CTIV
    NRF_SDH_CLOCK_LF_RC_TEMP_CTIV
    NRF_SDH_CLOCK_LF_ACCURACY
    

    Check both application project sdk_config.h and the bootloader sdk_config.h

    As an test, could you try to set NRF_SDH_CLOCK_LF_ACCURACY to 1 (i.e. 500 ppm) ?

    If it's already set to 1 (500ppm), try set NRF_SDH_CLOCK_LF_SRC to 2(NRF_CLOCK_LF_SRC_SYNTH) as well.

Children
Related