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.

CC2652R: GapAdv_enable() with duration messes up the state

Part Number: CC2652R

Hello,

If a peripheral-to-be starts advertising by GapAdv_enable() with duration and then gets connected with a central, the peripheral, for unknown reason, will become unresponsive to connection events when the duration expires, which will cause disconnection by supervision timeout. However, the peripheral doesn't even get the termination event. After that, if I call GapAdv_enable() again, I will get the result SUCCESS, but there will be no advertising. The peripheral will be in some strange state.

If an advertiser gets connected, the advertising is automatically stopped with GAP_EVT_ADV_END_AFTER_DISABLE, but the duration timer seems to keep going. What I'm observing is, GAP_EVT_ADV_END_AFTER_DISABLE, which should not occur since the advertising was already disabled upon connection establishment, comes again when the duration expires while the peripheral is in connection state. Then the peripheral becomes kind of unresponsive.

The SDK version is 2.40.

Please let me know if there is any workaround or solution. Thanks.

- Cetri

  • Hi Cetri,
    Which base application do you base this on, simple peripheral? Are you running on a TI launchpad?
  • Hi Joakim,

    I used out-of-the-box host_test on launchpads.

    - Cetri
  • Hi Cetri,

    What version of the SimpleLink CC26x2 SDK are you using?

    What is the peer device (BLE master device)?

    Can you provide me with step-by-step instructions to reproduce the issue?
  • Hi Marie,

    I already specified the SDK version. It is 2.40. Both the master and the slave are TI's out-of-the-box host_test.

    Following are the HCITester scripts I used for the test:

    <Master>

    #
    # Initialize
    #
    
    # Init as a Central
    Send_GAP_DeviceInit 8, 0x00, "00:00:00:00:00:00"
    # Wait for GAP_DeviceInit command status
    Wait_HCI_Vendor_Specific_Event 5000, 0x067F, 0x00, 0xFE00, 
    # Wait for GAP_DeviceInitDone event
    Wait_HCI_Vendor_Specific_Event 5000, 0x0600, 0x00, , , , , 
    
    #
    # Connection Setup & Start
    #
    
    # Connect to the advertiser with 5000ms timeout
    Send_GapInit_connect 0x00, "80:6F:B0:1E:35:EE", 0x01, 5000
    # Wait for GapInit_connect command status
    Wait_HCI_Vendor_Specific_Event 5000, 0x067F, 0x00, 0xFE62, 
    
    # Wait for connection establishment event
    Wait_HCI_Vendor_Specific_Event 5000, 0x0605, 0x00, , , , , , , , 
    
    # Wait for HCI_LE_Read_Remote_Feature_Support complete event
    Wait_HCI_LE_Generic_Report_Event 5000, 0x04, 0x00, , 

    <Slave>

    #
    # Initialize
    #
    
    # Init as a Peripheral
    Send_GAP_DeviceInit 0x04, 0x00, "00:00:00:00:00:00"
    # Wait for GAP_DeviceInit command status
    Wait_HCI_Vendor_Specific_Event 5000, 0x067F, 0x00, 0xFE00, 
    # Wait for GAP_DeviceInitDone event
    Wait_HCI_Vendor_Specific_Event 5000, 0x0600, 0x00, , , , , 
    
    #
    # Advertising Setup & Start
    #
    
    # Create an Advertising set. Interval = 100ms
    Send_GapAdv_create 0x0013, 160, 160, 0x07, 0x00, "00:00:00:00:00:00", 0x00, 127, 0x01, 0x01, 0
    # Wait for GapAdv_create command status
    Wait_HCI_Vendor_Specific_Event 5000, 0x067F, 0x00, 0xFE3E, 
    
    # Set event mask - only AdvStartAfterEnable and AdvEndAerDisable
    Send_GapAdv_setEventMask 0x00, 0x0090
    # Wait for GapAdv_setEventMask command status
    Wait_HCI_Vendor_Specific_Event 5000, 0x067F, 0x00, 0xFE45, 
    
    # Load Adv Data - 16 bytes
    Send_GapAdv_loadData 0x00, 0x00, 16, "00:01:02:03:04:05:06:07:08:09:0A:0B:0C:0D:0E:0F"
    # Wait for GapAdv_create command status
    Wait_HCI_Vendor_Specific_Event 5000, 0x067F, 0x00, 0xFE44, 
    
    # Start Advertising with duration
    Send_GapAdv_enable 0x00, 0x01, 500
    # Wait for GapAdv_enable command status
    Wait_HCI_Vendor_Specific_Event 5000, 0x067F, 0x00, 0xFE3F, 
    
    # Wait for AdvStartAfterEnable event
    Wait_HCI_Vendor_Specific_Event 5000, 0x0613, 0x00, 0x00000001, , 
    
    # Wait for AdvEndAfterDisable event
    Wait_HCI_Vendor_Specific_Event 10000, 0x0613, 0x00, 0x00000002, , 
    
    #
    # Connection
    #
    
    # Wait for connection establishment event
    Wait_HCI_Vendor_Specific_Event 5000, 0x0605, 0x00, , , , , , , , 
    
    # Wait for HCI_LE_Read_Remote_Feature_Support complete event
    Wait_HCI_LE_Generic_Report_Event 5000, 0x04, 0x00, , 

    Change the peer address in the master script as per your test environment.

    <Test procedure>

    1. Run the slave script on one CC26X2R launchpad.

    2. Right after step 1, run the master script on another CC26X2R launchpad

    3. You will see them connected.

    4. In about 5 seconds after the step 1, you will see GAP_EVT_ADV_END_AFTER_DISABLE event again on the slave side.

    5. In about 20 seconds after the step 4, which is the default supervision timeout, they will be disconnected. You will see a termination event only on the master side though.

    - Cetri

  • I found the problem here: https://e2e.ti.com/support/wireless-connectivity/bluetooth/f/538/t/778168

    Does the new version (3.10) come with the fix?

    - Cetri

  • Hi Cetri,

    I was able to reproduce, thank you for the scripts.

    The SimpleLink CC13x2/CC26x2 3.10 SDK still contains the bug, sadly.