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.

[FAQ] [参考译文] [常见问题解答] CC2642R:使用 CC2642R / CC2652R7进行周期性广播

Guru**** 1709640 points
Other Parts Discussed in Thread: CC2642R, CC2652R, CC2652R7, SYSCONFIG
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/1294888/faq-cc2642r-periodic-advertising-with-cc2642r-cc2652r7

器件型号:CC2642R
主题中讨论的其他器件: CC2652RCC2652R7SysConfig

您好!

以下是在 CC2642R、CC2652R 或 CC2652R7上启用定期广播的一些步骤。

本指南假定您针对所选器件使用 simple_peripheral 示例。 本指南已在 SDK 7.10.00.98上进行了测试。

1-在 SysConfig 中启用对周期性广播的支持

2-在 SysConfig 中创建新的广播集

3-为新创建的广播集设置广播数据

4 -保存并关闭 SysConfig

5-(可选)通过注释掉找到的"GapAdv_enable"命令来禁用设置的其他广播

6-添加所需的全局数据

 // Create non connectable & non scannable advertising
#define GAPADV_PARAMS_AE_NC_NS {                                           \
  .eventProps = 0,                                                         \
  .primIntMin = 160,                                                       \
  .primIntMax = 160,                                                       \
  .primChanMap = GAP_ADV_CHAN_ALL,                                         \
  .peerAddrType = PEER_ADDRTYPE_PUBLIC_OR_PUBLIC_ID,                       \
  .peerAddr = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa },                      \
  .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 = 1                                                                 \
}

static uint8 advHandleNCNS;      // Non-Connactable & Non-Scannable

// Periodic Advertising Data

static uint8_t periodicData[] =

{
  'P',
  'e',
  'r',
  'i',
  'o',
  'd',
  'i',
  'c',
  'A',
  'd',
  'v'
};

7-在 SimplePeripheral_processGapMessage ()中处理 GAP_DEVICE_INIT_DONE_EVENT 事件结束时添加以下代码

        // Create Advertisement set #3 and assign handle
        GapAdv_params_t advParamNonConn = GAPADV_PARAMS_AE_NC_NS;

        status = GapAdv_create(&SimplePeripheral_advCallback, &advParamNonConn,
                                             &advHandleNCNS);

        // Load advertising data for set #3 that is statically allocated by the app
        status = GapAdv_loadByHandle(advHandleNCNS, GAP_ADV_DATA_TYPE_ADV,
                                     sizeof(advData3), advData3);


        // Set event mask for set #3
        status = GapAdv_setEventMask(advHandleNCNS,
                                     GAP_ADV_EVT_MASK_START_AFTER_ENABLE |
                                     GAP_ADV_EVT_MASK_END_AFTER_DISABLE |
                                     GAP_ADV_EVT_MASK_SET_TERMINATED);


        // Enable non connectable & non scannable advertising for set #3
        // This is a must in order to enable periodic advertisement
        status = GapAdv_enable(advHandleNCNS, GAP_ADV_ENABLE_OPTIONS_USE_MAX , 0);


        // Set Periodic Advertising parameters
        GapAdv_periodicAdvParams_t perParams = {240, 240, 0x40};
        status = GapAdv_SetPeriodicAdvParams(advHandleNCNS, &perParams);

8-在 SimplePeripheral_processGapMessage 中添加对 GAP_ADV_SET_PERIODICLE_ADV_PARAMS_EVENT 和 GAP_ADV_SET_PERIOD_ADV_DATA_EVENT 事件的处理

    case GAP_ADV_SET_PERIODIC_ADV_PARAMS_EVENT:
    {
        uint8_t status;
        GapAdv_periodicAdvData_t periodicDataParams = {0x03, sizeof(periodicData), periodicData};
        status = GapAdv_SetPeriodicAdvData(advHandleNCNS, &periodicDataParams);
    }
    break;

    case GAP_ADV_SET_PERIODIC_ADV_DATA_EVENT:
    {
        uint8_t status;
        status = GapAdv_SetPeriodicAdvEnable(1, advHandleNCNS);
    }
    break;

9-(可选)按照调试指南中的描述使能 RF 可观察到的内容(在没有蓝牙监听器时十分有用)。
在 main.c 中添加以下内容、其中包括:"#include "

然后在 Board_initGeneral()之后添加以下代码

  // Map LNA enable pin RFC_GPO0 to DIO6
  IOCPortConfigureSet(IOID_6, IOC_PORT_RFC_GPO0,
                      IOC_IOMODE_NORMAL);
  // Map Tx start pin RFC_GPO3 to DIO7
  IOCPortConfigureSet(IOID_7, IOC_PORT_RFC_GPO3,
                      IOC_IOMODE_NORMAL);

10 -构建代码并刷写设备

适用于支持定期广播的 CC26X2R1 LaunchPad 的 Hexfile: /cfs-file/__key/communityserver-components-multipleuploadfilemanager/d35fa551_2D00_8bfa_2D00_42ea_2D00_8c7f_2D00_ea501b1a1ce7-370266-complete/simple_5F00_peripheral_5F00_CC26X2R1_5F00_LAUNCHXL_5F00_tirtos7_5F00_ticlang.hex

用于支持定期广播的 CC2652R7 LaunchPad 的 Hexfile: /cfs-file/__key/communityserver-discussions-components-files/538/simple_5F00_peripheral_5F00_LP_5F00_CC2652R7_5F00_tirtos7_5F00_ticlang.hex

还请检查与定期广告列车同步- https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/1295835/faq-cc2642r-synchronizing-with-a-periodic-advertising-train-cc2642r-cc2652r7

我希望这将有所帮助、

此致、

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Clement、

    谢谢你的指导!

    Br、

    大卫。