This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How can I enter GAP_LINK_TERMINATED_EVENT immediately

Other Parts Discussed in Thread: CC2541, CC2640

I have built a connection between simpleBLEcentral and simplebleperipheral. The simplebleperipheral will delay 20 seconds to enter GAP_LINK_TERMINATED_EVENT When I power down the simpleplecentral.  I modify the value DEFAULT_DESIRED_CONN_TIMEOUT from 1000 t0 100. It also need to wait 20s to enter GAP_LINK_TERMINATED_EVENT.How can I enter GAP_LINK_TERMINATED_EVENT immediately after the link loss. Thanks.

  • Hi John,

    Try setting supervision timeout on the central device and set DEFAULT_ENABLE_UPDATE_REQUEST FALSE

    BR,

    -Greg

  • Hi Greg,

    I have set the Supervision timeout value from 600 to 100 and DEFAULT_ENABLE_UPDATE_REQUEST FALSE on the central device.But it still doesn't work.

    // Supervision timeout value (units of 10ms) if automatic parameter update request is enabled
    //#define DEFAULT_UPDATE_CONN_TIMEOUT 100

    // Whether to enable automatic parameter update request when a connection is formed
    #define DEFAULT_ENABLE_UPDATE_REQUEST FALSE

     

  • This problem is still existing. I appreciate if anyone can give me some suggestion. Thanks.

  • Hi John,

    You should to the proposed change on SimpleBLEPeripheral as well, it's the one sending a connection parameter update request. Either

    • Change the timeout value DEFAULT_DESIRED_CONN_TIMEOUT to lower value and set DEFAULT_ENABLE_UPDATE_REQUEST to TRUE
    • OR set DEFAULT_ENABLE_UPDATE_REQUEST to FALSE and let the SimpleBLECentral set the timeout from the connection request.

    Best Regards

    Joakim

  • I followed this suggestion for the peripheralObserver project, but with no success. Do you have any suggestions as to why this might be different, it takes approx, 20 seconds to Terminate Link.

    Even the GAPCentralRole_TerminateLink( simpleBLEConnHandle ); is not working for me. It seems like this should be instant termination of connection? Am I right in assuming this?

    Thanks,

    Peyton

  • The timeout multiplier is the time it takes to terminate a connection that denies your connection parameters (I think)

    Can someone elaboration on the difference between GAPROLE_TIMEOUT_MULTIPLIER and GAPROLE_CONN_TIMEOUT?

    Also keep in mind that the timeout only starts AFTER you have a missed connection. With slave latency this can take up to 6 seconds to occur

  • Thanks for the response Peter,

    I too am needing some clarification on the difference between the 2 parameters. The TIMEOUT_MULTIPLIER is set to 1000, I was thinking that was just a mS -> S conversion.

    DEFAULT_ENABLE_UPDATE_REQUEST

    I'm also still a little fuzzy on the functionality of this parameter. From my understanding by this being enabled on the peripheral side it enables the connection timing parameters to dictate the timeout conditions for the connection between the central and peripheral device.

    Is this a correct assumption?

     

     

  • Correct. You can look all these things up in the BLE_API_Guide_main html manual for many of the GAP role parameters GAPROLE_PARAM_UPDATE_ENABLE is clearly defined. The two I referenced ( GAPROLE_TIMEOUT_MULTIPLIER and GAPROLE_CONN_TIMEOUT) are not.

  • the above two methods are not setting my connection timeout value. I've DEFAULT_DESIRED_CONN_TIMEOUT as 500 to set the time of 5 seconds but it does not work. the connection terminated event is occurring approx after 30 seconds. I'm using CC2541 and BLE 1.4.0 stack.

    Thanks, Arjun
  • Hello Arjun,

    Can you take & attach a BLE air sniffer trace of the connection and timeout? This will help determine where to look next.

    Best wishes
  • Thanks for the reply JXS,

    Attached the sniffer data for your reference. The Peripheral starts advertising approximately after 20 seconds from the last heartbeat received from Master/Central.

    My Peripheral address is 0xD4F5134A1AD8.

    My Central Address is 0xA0E6F84C2B32.

    I also would like to let you know that I've explicitly added the following line in my init function of Peripheral Application -

    "GAP_SetParamValue(TGAP_CONN_EST_SUPERV_TIMEOUT, 100);"

    I've also set the following in my Peripheral's init function -

    GAPROLE_MIN_CONN_INETRVAL to 8 (10 ms)

    GAPROLE_MAX_CONN_INTERVAL to 16 (20 ms)

    GAPROLE_TIMEOUT_MULTIPLIER to 100 (1 sec)

    GAPROLE_PARAM_UPDATE_ENABLE to TRUE

    Thanks,

    Arjun

    Link_Not_Terminated_for_20Secs.psd

  • Hello,

    Your Master connects with a timeout of 0x7D0 (2000) or 20 seconds. Is this an Android phone or SimpleBLECentral?

    There is no update from the Master/Central or request to update from the Slave/Peripheral in your sniffer trace, so the 20 sec connection supervision timeout will persist and explains your 20 sec delay.

    To request an update immediately, set the following in your SimpleBLEPeripheral.c
    #define DEFAULT_ENABLE_UPDATE_REQUEST TRUE
    ..
    #define DEFAULT_DESIRED_CONN_TIMEOUT 100 // 1 sec

    // Connection Pause Peripheral time value (in seconds)
    #define DEFAULT_CONN_PAUSE_PERIPHERAL 0

    and keep your fingers crossed that the Master will accept and update the connection parameters.

    For more info, see "5.1.5 Connection Parameter Update" in the CC2640 BLE SW Dev Guide (SWRU393).

    Best wishes
  • Thanks JXS,

    My central application is based on SimpleBLECentral of CC26xx (Bluetooth 4.1) standalone hardware. It is not a Android or iOS App.

    I've one question though - If Central does not accept the update, will "GAP_SetParamValue(TGAP_CONN_EST_SUPERV_TIMEOUT, 100);" help in Peripheral to have it's own Supervision Timeout?
  • If you control the Central, then set the GAP Param Value TGAP_CONN_EST_SUPERV_TIMEOUT to 100 before the connection is established. Then you will start the connection at a 1 sec timeout. The default is 20 sec.

    Best wishes
  • Thanks a lot JXS. It worked!