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

nRF52 automatically disconnects with iOS phone after 90 seconds

Hello,

I am using a custom nRF52840 ( SDK 14.2.0, SoftDevice S140) based board to connect with an iOS(v 13.3) phone. 

I am sending data continuously over BLE. However I notice that after around 90 seconds the connection automatically ends.

On the Segger Embedded Studio debug terminal, I see the following when the board disconnects:

<info> app: ble_adv_evt fast
<info> app: Disconnect Complete.
<info> app: Disconnected

Here are the connection parameters I have defined, I think I have followed the guidelines given here for connection with Apple devices. Please correct me if I'm wrong.

#define APP_ADV_INTERVAL                 244                                        
#define APP_ADV_TIMEOUT_IN_SECONDS       0                                          

#define MIN_CONN_INTERVAL                MSEC_TO_UNITS(25, UNIT_1_25_MS)           
#define MAX_CONN_INTERVAL                MSEC_TO_UNITS(1500, UNIT_1_25_MS)           
#define SLAVE_LATENCY                    0                                         
#define CONN_SUP_TIMEOUT                 MSEC_TO_UNITS(5000, UNIT_10_MS)            

#define FIRST_CONN_PARAMS_UPDATE_DELAY   APP_TIMER_TICKS(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    APP_TIMER_TICKS(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                          

Unfortunately I don't have a setup for a BLE sniffer.

Can somebody help?

Thanks 

Parents
  • sounds like it is update connection parameter fail, you need to check the reason code of disconnect.

    you can add log code at on_ble_evt() , and then check the meaning of reason at "ble_hci.h"  at line 56.

    on_ble_evt((ble_evt_t * p_ble_evt))
    {
    ...
        case BLE_GAP_EVT_DISCONNECTED:
        {
            ...
        
            NRF_LOG_RAW_INFO("disconnect reason:0x%X",p_ble_evt->evt.gap_evt.params.disconnected.reason);
    
            ...
        }
        break;
    
    ...
    
    }

  • I added the log code and I get '0x16' , which means Local host terminated connection.

    It does seem something to do with connection parameter updates.

    When I change the MAX_CONN_PARAMS_UPDATE_COUNT from 3 to 2, now the disconnections happen in 60 seconds.

    #define FIRST_CONN_PARAMS_UPDATE_DELAY   APP_TIMER_TICKS(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    APP_TIMER_TICKS(30000)                     /**< Time between each call to sd_ble_gap_conn_param_update after the first call (30 seconds). */
    #define MAX_CONN_PARAMS_UPDATE_COUNT     2  

    So what is the solution?

    Thanks

Reply
  • I added the log code and I get '0x16' , which means Local host terminated connection.

    It does seem something to do with connection parameter updates.

    When I change the MAX_CONN_PARAMS_UPDATE_COUNT from 3 to 2, now the disconnections happen in 60 seconds.

    #define FIRST_CONN_PARAMS_UPDATE_DELAY   APP_TIMER_TICKS(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    APP_TIMER_TICKS(30000)                     /**< Time between each call to sd_ble_gap_conn_param_update after the first call (30 seconds). */
    #define MAX_CONN_PARAMS_UPDATE_COUNT     2  

    So what is the solution?

    Thanks

Children
Related