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: Diagnostics for advertisments

Part Number: CC2642R
Other Parts Discussed in Thread: ENERGYTRACE, SYSCONFIG

Is there any diagnostics/statistics provided by the BLE stack in order to understand advertisement related issue?

My code base in based on simple peripheral application from SDK v4.20. The advertisement was working fine up to few days back. However, after I have added few more code in the application code which are not related AT ALL to the advertisement or BLE stack, the advertisement does not go out from the Launchpad. 

The code is application specific and does not disable anything in the BLE Stack or interrupts.

  • Hi,

    At the moment I am not thinking of any obvious reason for this issue.

    I would recommend to leverage our Debugging Guide, check the status returned by the GAP functions, ensure that no assert is hit and verify if there is no stack/heap shortage.

    Keep us updated,

    Regards,

  • Hi Clement,

    I have checked that there is no assert hit and no issue as well with stack/heap.

    Regards,

    Mehul

  • Clement,

    Is there anyway to verify that the advertisement transmitted is not corrupted by any means? The reason I am asking about it that even tough the advertisement is not received by BTool, I can see that the peripheral is consuming energy to transmit the advertisement packet on legacy advertisement channel.

    See attached snap from EnergyTrace. The advertisment interval is 320ms.

  • Hi,

    Are you sure these are advertisements? Each "advertisement" seems to last for 100 ms (it should rather be in the order of magnitude of 100's us).

    That being said, you could use a BLE analyzer to verify the content of your advertisement.

    If you have no BLE analyzer, you can probably use a mobile phone applications (such as LightBlue).

    Best regards,

  • Hi Clement, all the high current is not only advertisement but our application specific code as well. Here is the zoomed snapshot when the advertisement is not captured by BTool.

  • Hi Clement, all the high current is not only advertisement but our application specific code as well. Here is the zoomed snapshot when the advertisement is not captured by BTool.

  • Hi,

    Thank you for the details :) Now we are agree, these are the advertisements. 

    As mentioned before, try to get some BLE traces, it will probably help.

    Regards,

  • Whether LightBlue application will be helpful? I do not have BLE analyzer.

  • Also, can you think how the data can be corrupted? 

    I believe in the case where the advertisement is not working, some of the BLE stack related pointer for drivers/overrides may be getting corrupted?

  • Hi,

    LightBlue could potentially help you to verify if the device is detected. In addition you have an option to see the content of the advertisement set.

    In your application, do you usually update the content of the advertisements?

    Regards,

  • Yes, the firmware does change the advertising data after advertisement is sent.

    The issue here is that the advertising data is not captured in the client application at all! So, not sure whether LightBlue application will be useful.

  • Hi Clement,

    Yes, we do change the advertisement data after each successful advertisement event (GAP_EVT_ADV_END). Do you think that can be an issue? We have following step for changing advertisement data:

    - GapAdv_disable()

    - GapAdv_enable() with a new handle

    I believe that the advertisement data is corrupted somehow.

    Regards,

    Mehul

  • Hi Mehul,

    Could you try to not change the advertisement or always load the same handle? The goal is really to identify where does the issue come from.

    Regards,

  • Hi Clement,

    I tried, yet it did not work. The advertisement still did not come out.

    Mehul

  • Hi Mehul,

    In summary, based on the power trace we know the advertisements are sent. However so far, no device can detect these advertisements.

    Have you considered running some test with a new launchpad?

    Could you verify using a launchpad + SmartRF Studio if you see some RF activity on advertising channels when the device is advertising?

    Make also sure you have tried all the ideas specified in our debugging guide dev.ti.com/.../debugging-index.html

    If these elements do not help then you are going to require a BLE shiffer.

    Best regards,

  • Hi Clement,

    We have Ellisys BLE sniffer and it does not show any advertisement packets from the BLE TI launchpad.

    Also, there is not assert() from any of the modules (Heap, BLE stack, TI RTOS (XDC), etc.).

    I have got the binary from C:\Program Files (x86)\Texas Instruments\SmartRF Tools\SmartRF Packet Sniffer 2\sniffer_fw\bin\cc26x2r1lp. Will try using RF Sniffer now.

    Mehul

  • Hi Mehul,

    Mehul Dalal said:
    We have Ellisys BLE sniffer and it does not show any advertisement packets from the BLE TI launchpad.

    Ok, then this is problematic. I don't think RF Sniffer would manage a better job here - but, please prove me I am wrong :)

    You may want to provide a more detailed view of the power trace. I can try to review it and try to find something but I do not promise anything.

    Regards,

  • Hi Clement, 

    What do you need in "more detailed view of the power trace"?

    Mehul

  • Clement,

    I verified that SmartRF Sniffer as well is not helpful. 

    Regards,
    Mehul

  • Mehul Dalal said:
    What do you need in "more detailed view of the power trace"?

    A "zoom" on the advertisement it self may help.

  • Clement,

    I have got the trace for working advertisement as well. I can see a difference in there with once energy trace section highlighted below. In case where advertisement is not working, the highlighted section is missing:

  • Hi Clement,

    One more thought. I believe that missing energy trace is about the time the peripheral is in receiver mode (for scan request or connection request) after advertisement data is sent. In other words, what I believe in case of issue is that the BLE stack is not going into receiver mode at all after advertisement (which is also not appearing on sniffer as well).

    Something is really going wrong in the BLE stack itself I believe. Our advertisement data are always connectable and scannable.

    Mehul

  • Hi Mehul,

    I agree the power trace is not as expected. Yours makes me think of extended advertisements - because of the 4 spikes and because the other devices are  struggling to scan them. That being said it is always difficult to be 100% sure.

    Could you please provide me the advertisement parameters you are using?

    Best regards,

  • Clement,

    I have verified that the trace is for legacy advertisement as well. In what case we really can see 4 spikes in extended advertisement? The BLE stack Transmits the advertisement data in all advertising channel i.e. 37, 38 and 39. 3 Spikes should observed after an advertisement start event.

    Can there be a possibility that the device is sending advertising data other than advertising channel?

    Here are various parameters:

    // Legacy Advertising Parameters for Advertisement Set
    #define GAPADV_PARAMS_EMR_LEGACY_SCAN_CONN (GapAdv_params_t){ \
    .eventProps = GAP_ADV_PROP_CONNECTABLE | GAP_ADV_PROP_SCANNABLE | \
    GAP_ADV_PROP_LEGACY, \
    .primIntMin = EMR_ADV_PRIM_INT_MIN, \
    .primIntMax = EMR_ADV_PRIM_INT_MAX, \
    .primChanMap = GAP_ADV_CHAN_ALL, \
    .peerAddrType = PEER_ADDRTYPE_PUBLIC_OR_PUBLIC_ID, \
    .peerAddr = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* peerAddr is not used since we're not using directed advertisements */ \
    .filterPolicy = GAP_ADV_WL_POLICY_ANY_REQ, \
    .txPower = GAP_ADV_TX_POWER_NO_PREFERENCE, \
    .primPhy = GAP_ADV_PRIM_PHY_1_MBPS, \
    .secPhy = GAP_ADV_SEC_PHY_1_MBPS, \
    .sid = 0 \
    }

    // Extended Advertising Parameters
    #define GAPADV_PARAMS_EMR_EXTENDED (GapAdv_params_t){ \
    .eventProps = EMR_ADV_MODE_NON_CONN_NON_SCAN, \
    .primIntMin = EMR_ADV_PRIM_INT_MIN, \
    .primIntMax = EMR_ADV_PRIM_INT_MAX, \
    .primChanMap = GAP_ADV_CHAN_ALL, \
    .peerAddrType = PEER_ADDRTYPE_PUBLIC_OR_PUBLIC_ID, \
    .peerAddr = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* peerAddr is not used since we're not using directed advertisements */ \
    .filterPolicy = GAP_ADV_WL_POLICY_ANY_REQ, \
    .txPower = GAP_ADV_TX_POWER_NO_PREFERENCE, \
    .primPhy = GAP_ADV_PRIM_PHY_1_MBPS, \
    .secPhy = GAP_ADV_SEC_PHY_2_MBPS, \
    .sid = 0 \
    }

  • Hi,

    Could you add screen shots from SysConfig, and code snippet showing how you are setting advertisements? (To keep it simple, you can share a snippet showing the code related to GapAdv_xxx functions)

    In addition, it might be interesting to apply the exact same configurations on the simple_peripheral example to see if some problems may appear there too.

    Regards,

  • Hi Clement,

    The exact code was working earlier and it was not possible to replicate the same issue in simple peripheral firmware from SDK.

    Note that in our application, we have just added 4 byte of static variable and added that into an array and we have started seeing this issue. The variable has nothing to do with advertising or modules associated with it. Having it added also has changed the MAP file completely.

    We do not have SysCfg in our project. Instead, we have included files created through SysCfg in our project and disabled SysCfg. Which specific file do you want?

    Here are various GapAdv_ code snippets:

    // Create and Initialize the advertising handle with the advertising set parameters
    ALLEGE(GapAdv_create(advertisingCallback, advParm, advHandle), SUCCESS);

    if (advHandle != NULL)

    {
    // Set event mask for Advertisement set
    ALLEGE(GapAdv_setEventMask(*advHandle,
    GAP_ADV_EVT_MASK_START_AFTER_ENABLE | /* GAP_EVT_ADV_START_AFTER_ENABLE - after the first advertisement after a GapAdv_enable */ \
    GAP_ADV_EVT_MASK_END_AFTER_DISABLE | /* GAP_EVT_ADV_END_AFTER_DISABLE - after advertising stops due to a GapAdv_disable*/ \
    GAP_ADV_EVT_MASK_SET_TERMINATED | /* GAP_EVT_ADV_SET_TERMINATED - after an advertisement set is terminated due to a connection establishment */ \
    GAP_ADV_EVT_MASK_END), /* GAP_EVT_ADV_END - after each advertising set ends */
    SUCCESS);
    }

    /* loading handle */

    ALLEGE(GapAdv_loadByHandle(advHandleLegacySet0, GAP_ADV_DATA_TYPE_ADV, sizeof(advertDataLegacySet0), (uint8 *)&advertDataLegacySet0), SUCCESS);

    ALLEGE(GapAdv_loadByHandle(advHandleLegacySet0, GAP_ADV_DATA_TYPE_SCAN_RSP, sizeof(scanRspData), (uint8 *)&scanRspData), SUCCESS);

    /* for changing advertising and scan response data */

    // Call GapAdv_prepareLoadByHandle() on the legacy advertising handle
    // Option GAP_ADV_FREE_OPTION_DONT_FREE = Don't free anything since we're going to use the same buffer to re-load
    ALLEGE(GapAdv_prepareLoadByHandle(advHandleLegacySet0, GAP_ADV_FREE_OPTION_DONT_FREE), SUCCESS);
    // Call GapAdv_loadByHandle() on the legacy advertising handle
    ALLEGE(GapAdv_loadByHandle(advHandleLegacySet0, GAP_ADV_DATA_TYPE_ADV, sizeof(advertDataLegacySet0), (uint8 *)&advertDataLegacySet0), SUCCESS);

    ALLEGE(GapAdv_prepareLoadByHandle(advHandleLegacySet0, GAP_ADV_FREE_OPTION_DONT_FREE), SUCCESS);
    ALLEGE(GapAdv_loadByHandle(advHandleLegacySet0, GAP_ADV_DATA_TYPE_SCAN_RSP, sizeof(scanRspData), (uint8 *)&scanRspData), SUCCESS);

    /* Enable a specific adv handle */

        bStatus_t status = (status_t)GapAdv_enable(advHandle, GAP_ADV_ENABLE_OPTIONS_USE_MAX, 0);

    /* Disable a specific adv handle */

        bStatus_t status = (status_t)GapAdv_disable(advHandle);

  • Hi Mehul,

    I did not spot problem in the code you have shared.

    It would be nice to confirm if the "4 bytes of static variable" you mentioned are causing the issue.

    Regards,