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

Fail to change connection timeout.

Hi,

   I want to make the slave disconnect with the master in a minute automatically.

   However, It's failure when I have motified the codes like below:

   

#define MIN_CONN_INTERVAL               MSEC_TO_UNITS(20, UNIT_1_25_MS)             /**< Minimum acceptable connection interval (20 ms), Connection interval uses 1.25 ms units. */
#define MAX_CONN_INTERVAL               MSEC_TO_UNITS(75, UNIT_1_25_MS)             /**< Maximum acceptable connection interval (75 ms), Connection interval uses 1.25 ms units. */
#define SLAVE_LATENCY                   0                                           /**< Slave latency. */
#define CONN_SUP_TIMEOUT                MSEC_TO_UNITS(4000, UNIT_10_MS)             /**< Connection supervisory timeout (4 seconds), Supervision Timeout uses 10 ms units. */
#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                                           /**< Number of attempts before giving up the connection parameter negotiation. */

   Whatever I change NEXT_CONN_PARAMS_UPDATE_DELAY to xxx value, it doesn't work.

   Q:

   1. What should I do to make the slave disconnecting automatically in a minute?

   SDK version: 16.0.0. Softdevice version:7.0.1

BR,

   Yoole

  • Hi Karl,
       Sth has come up, and time has been delayed.

       Following were two entire sniffer traces. 
       0216.std_beacon_connection_detail-1.pcapng5383.std_beacon_connection_detail-2.pcapng
       In std_beacon_connection_detail-1 and xxx-2 trace, I just use Android app, NRF CONNECT, to connect the module and wait for the disconnection happened.
       The behavior can be seen  in std_beacon_connection_detail-1 in the exchange starting at packet 20, with a sudden disconnect/termination of the link at packet 50.
       The similarity with std_beacon_connection_detail-1, xxx-2 begins at packet 12 and stops at packet 16.
       
    BR,
       Yoole
  • Hello Yoole,

    Yoole said:
    Sth has come up, and time has been delayed.

    I am sorry, but I do no understand what you mean by this.

    Yoole said:
    Following were two entire sniffer traces. 

    Thank you for providing these traces.
    In one of the traces, it seems that you do not follow into the connection ( you have not selected your device from the device menu, as shown in the included picture ).
    So, this trace did unfortunately did not provide so much information.

    In the other trace it seems that there is an abrupt end to the packet tranfers.
    Is this trace taken while pairing / bonding with an iOS device?
    It might be that the iOS devices wants to do the pairing procedure on 2 Mbps PHY, if possible.
    What device are you using to do the sniffing, does it support 2 Mbps PHY?
    Furthermore, what security are you using for your connection?

    I suspect that the connection might be terminated by either device, possibly because of a mismatch in either security or connection parameters.

    Best regards,
    Karl

  • Hi Karl,

    Karl said:
    ( you have not selected your device from the device menu, as shown in the included picture ).

    I have. And I take the same steps to capture these trace.

    Karl said:
    In the other trace it seems that there is an abrupt end to the packet tranfers.
    Is this trace taken while pairing / bonding with an iOS device?
    It might be that the iOS devices wants to do the pairing procedure on 2 Mbps PHY, if possible.
    What device are you using to do the sniffing, does it support 2 Mbps PHY?

    Android app named nRF connect.

    Sniffer version: nRF sniffer for BLE 5.0.

    Karl said:
    Furthermore, what security are you using for your connection?

    Is this?

        ble_gatts_char_md_t char_md_rw;
        ble_gatts_attr_md_t cccd_md_rw;
        ble_gatts_attr_md_t attr_md_rw;
    		
    	memset(&cccd_md_rw, 0, sizeof(cccd_md_rw));
        BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md_rw.read_perm);
        BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md_rw.write_perm);
    	cccd_md_rw.vloc = BLE_GATTS_VLOC_STACK;
    
        memset(&char_md_rw, 0, sizeof(char_md_rw)); 
    		char_md_rw.char_props.read		= 1;  
    		char_md_rw.char_props.write 	= 1;
    		char_md_rw.char_props.notify	= 0;    
    		char_md_rw.p_char_user_desc  = NULL;
    		char_md_rw.p_char_pf         = NULL;
    		char_md_rw.p_user_desc_md    = NULL;
    		char_md_rw.p_cccd_md         = &cccd_md_rw;
    		char_md_rw.p_sccd_md         = NULL;
    
    	memset(&attr_md_rw, 0, sizeof(attr_md_rw)); 
        attr_md_rw.rd_auth = 1;
        attr_md_rw.wr_auth = 1;
        BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md_rw.read_perm);
        BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md_rw.write_perm);
        attr_md_rw.vloc = BLE_GATTS_VLOC_STACK;
        attr_md_rw.vlen = 1;

    BR,

    Yoole

Related