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.

CC2642R: How to disconnect a device from the simple_peripheral example

Part Number: CC2642R


Hello,

I'm trying to get the CC2652 chip into low power mode using TI RTOS. So I believe I need to shutoff bluetooth advertising and disable any active bluetooth connections.

I successfully turned off advertising using:

bStatus_t  result1 = GapAdv_disable(advHandleLongRange);
bStatus_t  result2 = GapAdv_disable(advHandleLegacy);

However I can't see how to disconnect the client device from the simple_peripheral code. I tried:

    hciStatus_t result3 = HCI_DisconnectCmd(selfEntity, HCI_DISCONNECT_REMOTE_DEV_POWER_OFF);

Any ideas? Result return codes are all SUCCESS.

  • Actually, you don't need to disable advertising or disconnect BLE connection to enter low power mode. For BLE simple_peripheral example, the chip will enter sleeping mode automatically and wake up only when it need to do advertising or ble connection.

  • Hi Daniel,

    To complete the previous answer, you need to consider the command GAP_TerminateLinkReq()

    You can have a look to the following thread which is addressing the same kind of question.

    I hope this will help,

  • Thanks. I think that does it. I did try (first) to use this code unsuccessfully: 

    bStatus_t result3 = GAP_TerminateLinkReq(LINKDB_CONNHANDLE_ALL, HCI_DISCONNECT_REMOTE_USER_TERM);

    Then I went ahead with setting the connection handle explicitly:

    bStatus_t result3 = GAP_TerminateLinkReq(0x0000, HCI_DISCONNECT_REMOTE_USER_TERM);
     

    And that worked. So, does the special LINKDB_CONNHANDLE_ALL not work as I thought it should? 

  • Hi,

    Good to see you could find a solution. Now, it could be nice to see if there is more than one active connection and see why it is not fully working with LINKDB_CONNHANDLE_ALL.

    BTW, I am not aware about any problem with LINKDB_CONNHANDLE_ALL. This macro is used inside our simple_peripheral example and seems to do the job.

    Regards,