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 do I cancel GAPCentralRole_EstablishLink request?

Other Parts Discussed in Thread: CC2640

Hi,

I am working for a project based on simpleBleCentral with cc2640,It would connect to 2 peripherals.

I set the connect timeout 1.5 second,It usually works well, but sometimes(about 10%),when I turn off the power of one peripheral

then turn on ,the stack(version 2.1.0) can not generate the GAP_LINK_TERMINATED_EVENT after 1.5 second,It can generate the GAP_LINK_TERMINATED_EVENT after about 60 second.that is too long,I try to started discovery,I would find the advertisement of the peripheral,but when I call the function of GAPCentralRole_EstablishLink(), it returns a value of 0x15 that means "bleNoResources (0x15): too many links",so:

1.I tried to terminate the connecton(it is actually disconnect),but no effect.

2.I want ot cancel a establish request that has been sent by calling GAPCentralRole_EstablishLink(),but the link has not been established. How do I do this ?

  • I'm not sure what the "connect timeout" is that you are referring to.  In the case you are describing where you are causing a supervision timeout by powering off the peripheral, when you receive the GAP_LINK_TERMINATED_EVENT will depend on what the supervision timeout is. You can not expect this to be any constant value (i.e. 1.5 seconds) as it is negotiated at connection establishment and any subsequent parameter updates.

    In any case, you can cancel a link establishment request by using the 0xFFFE connection handle with the following command (from SDG: http://www.ti.com/lit/pdf/swru393):

  • Hi Tim, thanks
    1.I have 2 peripherals ,for the 1st I set the connection param as:
    MIN_CONN_INTERVAL:40,MAX_CONN_INTERVAL:40,SLAVE_LATENCY:9,CONN_TIMEOUT:150.
    the 2nd:
    MIN_CONN_INTERVAL:80,MAX_CONN_INTERVAL:80,SLAVE_LATENCY:4,CONN_TIMEOUT:200.
    Everytime after I establish a link ,I will receive the connection param which just as my set in GAP_LINK_ESTABLISHED_EVENT,
    but just as I have described ,somtimes I can not receive GAP_LINK_TERMINATED_EVENT after 1.5 seconds (power off the 1st)
    !!!I modified the 2nd peripheral's connection param as:
    MIN_CONN_INTERVAL:400,MAX_CONN_INTERVAL:400,SLAVE_LATENCY:0,CONN_TIMEOUT:200.
    now I can receive the GAP_LINK_TERMINATED_EVENT evrytime.I guess if the mcu is too weak to process the tasks so frequently.
    2.After I call GAPCentralRole_TerminateLink(0XFFFE),How can I receive the feed back infomation,if the cancelling operation has finished?
  • 1. I don't think this is a function of the processor speed. You could profile this by using the range extender controls (http://processors.wiki.ti.com/index.php/CC26xx_Range_Extender_Control) to see when the device stops showing up for connection events to the second peripheral (i.e. when the supervision timeout occurs). You could then toggle a GPIO when  you receive the link termination event in the applicaiton.

    2. You will receive a GAP_LINK_ESTABLISHED_EVENT with status 0x31 (bleGAPConnNotAcceptable)

  • Hi Tim:Thanks for your reply.I will do a test.Best regardsDan
  • Hi Dan,

    I was wondering, did the proposed solution work for you?.

    Did you recieve a bleGAPConnNotAcceptable event on your Central device?.

    Thanks