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.

CC2640R2F: Multi Role project disconnect time

Part Number: CC2640R2F

Hi,

So I am running the multi_role example project on the CC2640R2F Launchpad board and I use a smartphone App to connect to it while it is advertising.

The connection is successful and I am able to see all the GATT characteristics on my phone. However, when I disconnect the connection using the app, the phone immediately disconnects but my CC2640R2F takes about 24 seconds before it receives the GAP_LINK_TERMINATED_EVENT.I don't see the same behavior when I use the SImplePeripheral project; the disconnection is instantaneous. How do I fix this?

Cheers,

Addarsh

  • Hi Addarsh,

    What is the reason code that is sent with the GAP_LINK_TERMINATED_EVENT?
  • The reason code prints as 0.

    I used the following line of code to print it inside the GAP_LINK_TERMINATED_EVENT switch case:

    Display_print1(dispHandle, MR_ROW_STATUS2, 0, "Reason code for disconnect: %d", pEvent->gap.hdr.status);

    What does this mean?

  • Hi Addarsh,

    Instead of checking status, can you check the reason field of the gapTerminateLinkEvent_t? 

  • Hi Rachel,

    Sorry about that. Here is the updated code:

    Display_print1(dispHandle, MR_ROW_STATUS2, 0, "Reason code for disconnect: %d", pEvent->linkTerminate.reason);

    I get a value of 19. 

  • Thanks, Addarsh.

    If you look at the HCI Vendor Specific Guide located in the docs->blestack folder of your SDK installation, you will see that that reason code (in hex: 0x13)corresponds to Peer Requested termination which is what you did.

    Because of the delay, I was expecting to see reason code 8: Supervisor Timeout which occurs when a successful connection event does not occur within a given amount of time.

    I have a few more questions now:
    1. How are you determining the amount of time it takes for the multirole app to receive the GAP_LINK_TERMINATED_EVENT?
    2. Do you have a sniffer capture of what is occurring?
    3. Is the only connection between the phone and the LaunchPad?
    4. Which SDK are you using?
    5. Did you make any changes to the project?
  • Hi Rachel,

    Here are the answers to your questions:

    1. When I am connected, this is terminal output is the following:

    When I select the disconnect option in the smartphone app, I start a stopwatch and wait for the terminal output screen to change.

    When the screen changes to the picture above, I stop the stopwatch and measure the time. The "Disconnected" print occurs in the GAP_LINK_TERMINATED_EVENT, that's how I know the event was received.

    2. No, I don't have an air sniffer.

    3. Yes, there is only 1 connection between my phone and the Launchpad.

    4. I using version 1.35.00.33 of the SDK.

    5. No, I am using the example project directly.

  • Hi Addarsh,


    Can you put  a breakpoint in multi.c in the GAP_LINK_TERMINATED_EVENT in gapRole_processGAPMsg and see how long it takes after disconnecting from the phone for the breakpoint to hit?

  • Hi Rachel,

    As I mentioned in my previous post, the print "Disconnected" is triggered when the GAP_LINK_TERMINATED_EVENT occurs. That should be a good enough measurement of the time since we are only counting in seconds.

    I also tried the breakpoint method and I still get the same result.

  • Hi Addarsh,

    The point of the breakpoint test was to make sure there wasn't a delay in the UART output. There is a difference in the connection parameters between multi role and simple peripheral but not enough to cause the amount of delay that you are reporting.

    Can you give me some information about the mobile device/app you are using? I can try to reproduce this on my end.

    Do you happen to have another LaunchPad? If you do, you could use BTool as your master device which would provide you more information about the connection.
  • Hi Rachel,

    I experimented a little bit and found out that this happens only when I use the app to connect to the multi_role code running Launchpad.

    When I have another launchpad acting as the client (instead of the app), there is no problem and the disconnection is instantaneous on either side.

    The app I am using is the nRF connect app on an Android smartphone.

    Hope this helps.

    Cheers,

    Addarsh