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.

CC1352P: 蓝牙 使用RF发送数据包功放不能切换

Part Number: CC1352P

你好,Ti

 我使用的 simplelink_cc13x2_26x2_sdk_4_20_00_35 SDK

我通过SmartRF Studio 7 工具,导出BLE发送BT4 数据包的开关功放的配置文件。

但是我发现,当我使用开功放去发送数据包后,再去配置关功放发送数据包,使用频谱仪查看关功放去发送的数据包,射频没有任何数据发出。

但我再次切换到开功放的配置去发送数据包,数据能发送出来。

并且,在重启后第一次配置使用关功放的参数去发送数据包,射频能发送出数据,一旦切换到开功放发送数据包以后,再切换到关功放,就再也不能发送关功放的数据了。

void ble_nc_adv_tx(void)
{
    RF_Object rfObject;
    RF_Handle rfHandle;

    uint8_t chan = 17;

    RF_Params rfParams;
    RF_CmdHandle rxCmdHndl;

    RF_Params_init(&rfParams);
    if(ble_pa_ctrl == 0)
    {
        rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdBle5RadioSetup, &rfParams);
    }
    else
    {
        rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdBle5RadioSetup_PA, &rfParams);
    }
    rxCmdHndl = RF_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);
    RF_runCmd(rfHandle, (RF_Op*)&RF_cmdBleAdvNc,RF_PriorityNormal, NULL, 0);

    (void)RF_cancelCmd(rfHandle, rxCmdHndl, 0);//ABORT_ABRUPT
//    (void)RF_pendCmd(rfHandle, rxCmdHndl, 0);
    RF_close(rfHandle);
}

上面的代码每次发送一次数据包后,即Close掉。一旦ble_pa_ctrl 配置为1后调用次此函数,再配置ble_pa_ctrl为0 调用次函数,射频将发送不出数据

  • // TI-RTOS RF Mode Object
    static RF_Mode RF_prop =
    {
        .rfMode = RF_MODE_AUTO,
        .cpePatchFxn = &rf_patch_cpe_bt5,
        .mcePatchFxn = 0,
        .rfePatchFxn = 0
    };
    
    
    // Overrides for CMD_BLE5_RADIO_SETUP_PA
    static uint32_t pOverridesCommon[] =
    {
        // override_ble5_setup_override_common_hpa.xml
        // Bluetooth 5: Reconfigure to 35 us pilot tone length for high output power PA
        HW_REG_OVERRIDE(0x6024,0x5B20),
        // Bluetooth 5: Compensate for 35 us pilot tone length
        (uint32_t)0x01640263,
        // Bluetooth 5: Set IPEAK = 3 and DCDC dither off for TX
        (uint32_t)0x00F388D3,
        // Bluetooth 5: Default to no CTE.
        HW_REG_OVERRIDE(0x5328,0x0000),
        // Synth: Increase mid code calibration time to 5 us
        (uint32_t)0x00058683,
        // Synth: Increase mid code calibration time to 5 us
        HW32_ARRAY_OVERRIDE(0x4004,1),
        // Synth: Increase mid code calibration time to 5 us
        (uint32_t)0x38183C30,
        // Bluetooth 5: Move synth start code
        HW_REG_OVERRIDE(0x4064,0x3C),
        // Bluetooth 5: Set DTX threshold 1 Mbps
        (uint32_t)0x00950803,
        // Bluetooth 5: Set DTX threshold 2 Mbps
        (uint32_t)0x012A0823,
        // Bluetooth 5: Set synth fine code calibration interval
        HW32_ARRAY_OVERRIDE(0x4020,1),
        // Bluetooth 5: Set synth fine code calibration interval
        (uint32_t)0x41005F00,
        // Bluetooth 5: Adapt to synth fine code calibration interval
        (uint32_t)0xC0040141,
        // Bluetooth 5: Adapt to synth fine code calibration interval
        (uint32_t)0x0007DD44,
        // override_hposc.xml
        // HPOSC frequency offset override, freqOffset=2^22*(F_nom-F_hposc)/F_hposc
        HPOSC_OVERRIDE(0),
        (uint32_t)0xFFFFFFFF
    };
    
    
    // Overrides for CMD_BLE5_RADIO_SETUP_PA
    static uint32_t pOverrides1Mbps[] =
    {
        // override_ble5_setup_override_1mbps_hpa.xml
        // Bluetooth 5: Reconfigure pilot tone length for high output power PA
        HW_REG_OVERRIDE(0x5320,0x0690),
        // Bluetooth 5: Compensate for modified pilot tone length
        (uint32_t)0x018F02A3,
        (uint32_t)0xFFFFFFFF
    };
    
    
    // Overrides for CMD_BLE5_RADIO_SETUP_PA
    static uint32_t pOverrides2Mbps[] =
    {
        // override_ble5_setup_override_2mbps_hpa.xml
        // Bluetooth 5: Reconfigure pilot tone length for high output power PA
        HW_REG_OVERRIDE(0x5320,0x0690),
        // Bluetooth 5: Compensate for modified pilot tone length
        (uint32_t)0x012D02A3,
        // Bluetooth 5: increase low gain AGC delay for 2 Mbps
        HW_REG_OVERRIDE(0x60A4,0x7D00),
        (uint32_t)0xFFFFFFFF
    };
    
    
    // Overrides for CMD_BLE5_RADIO_SETUP_PA
    static uint32_t pOverridesCoded[] =
    {
        // override_ble5_setup_override_coded_hpa.xml
        // Bluetooth 5: Reconfigure pilot tone length for high output power PA
        HW_REG_OVERRIDE(0x5320,0x0690),
        // Bluetooth 5: Compensate for modified pilot tone length
        (uint32_t)0x07E502A3,
        // Bluetooth 5: Set AGC mangnitude target to 0x1B.
        HW_REG_OVERRIDE(0x609C,0x001B),
        (uint32_t)0xFFFFFFFF
    };
    
    
    // CMD_BLE5_RADIO_SETUP_PA
    // Bluetooth 5 Radio Setup Command for all PHYs
    static rfc_CMD_BLE5_RADIO_SETUP_PA_t RF_cmdBle5RadioSetup =
    {
        .commandNo = 0x1820,
        .status = 0x0000,
        .pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
        .startTime = 0x00000000,
        .startTrigger.triggerType = 0x0,
        .startTrigger.bEnaCmd = 0x0,
        .startTrigger.triggerNo = 0x0,
        .startTrigger.pastTrig = 0x0,
        .condition.rule = 0x1,
        .condition.nSkip = 0x0,
        .defaultPhy.mainMode = 0x0,
        .defaultPhy.coding = 0x0,
        .loDivider = 0x00,
        .config.frontEndMode = 0x0,
        .config.biasMode = 0x1,
        .config.analogCfgMode = 0x0,
        .config.bNoFsPowerUp = 0x0,
        .txPower = 0x7217,
        .pRegOverrideCommon = pOverridesCommon,
        .pRegOverride1Mbps = pOverrides1Mbps,
        .pRegOverride2Mbps = pOverrides2Mbps,
        .pRegOverrideCoded = pOverridesCoded,
        .pRegOverrideTxStd = 0,
        .pRegOverrideTx20 = 0
    };
    
    
    // CMD_FS
    // Frequency Synthesizer Programming Command
    static rfc_CMD_FS_t RF_cmdFs =
    {
        .commandNo = 0x0803,
        .status = 0x0000,
        .pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
        .startTime = 0x00000000,
        .startTrigger.triggerType = 0x0,
        .startTrigger.bEnaCmd = 0x0,
        .startTrigger.triggerNo = 0x0,
        .startTrigger.pastTrig = 0x0,
        .condition.rule = 0x1,
        .condition.nSkip = 0x0,
        .frequency = 0x0988,
        .fractFreq = 0x0000,
        .synthConf.bTxMode = 0x0,
        .synthConf.refFreq = 0x0,
        .__dummy0 = 0x00,
        .__dummy1 = 0x00,
        .__dummy2 = 0x00,
        .__dummy3 = 0x0000
    };
    
    
    // Structure for CMD_BLE_ADV_NC.pParams
    static rfc_bleAdvPar_t bleAdvPar =
    {
        .pRxQ = 0, // INSERT APPLICABLE POINTER: (dataQueue_t*)&xxx
        .rxConfig.bAutoFlushIgnored = 0x0,
        .rxConfig.bAutoFlushCrcErr = 0x0,
        .rxConfig.bAutoFlushEmpty = 0x0,
        .rxConfig.bIncludeLenByte = 0x0,
        .rxConfig.bIncludeCrc = 0x0,
        .rxConfig.bAppendRssi = 0x0,
        .rxConfig.bAppendStatus = 0x0,
        .rxConfig.bAppendTimestamp = 0x0,
        .advConfig.advFilterPolicy = 0x0,
        .advConfig.deviceAddrType = 0x0,
        .advConfig.peerAddrType = 0x0,
        .advConfig.bStrictLenFilter = 0x0,
        .advConfig.chSel = 0x0,
        .advConfig.privIgnMode = 0x0,
        .advConfig.rpaMode = 0x0,
        .advLen = 0x18,
        .scanRspLen = 0x00,
        .pAdvData = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
        .pScanRspData = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
        .pDeviceAddress = 0, // INSERT APPLICABLE POINTER: (uint16_t*)&xxx
        .pWhiteList = 0, // INSERT APPLICABLE POINTER: (uint32_t*)&xxx
        .behConfig.scanRspEndType = 0x0,
        .__dummy0 = 0x0000,
        .endTrigger.triggerType = 0x1,
        .endTrigger.bEnaCmd = 0x0,
        .endTrigger.triggerNo = 0x0,
        .endTrigger.pastTrig = 0x0,
        .endTime = 0x00000000
    };
    
    
    // CMD_BLE_ADV_NC
    // BLE Non-Connectable Advertiser Command
    static rfc_CMD_BLE_ADV_NC_t RF_cmdBleAdvNc =
    {
        .commandNo = 0x1805,
        .status = 0x0000,
        .pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
        .startTime = 0x00000000,
        .startTrigger.triggerType = 0x0,
        .startTrigger.bEnaCmd = 0x0,
        .startTrigger.triggerNo = 0x0,
        .startTrigger.pastTrig = 0x0,
        .condition.rule = 0x1,
        .condition.nSkip = 0x0,
        .channel = 0x8C,
        .whitening.init = 0x51,
        .whitening.bOverride = 0x1,
        .pParams = &bleAdvPar,
        .pOutput = 0 // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
    };
    
    
    // Structure for CMD_BLE5_GENERIC_RX.pParams
    static rfc_bleGenericRxPar_t bleGenericRxPar =
    {
        .pRxQ = 0, // INSERT APPLICABLE POINTER: (dataQueue_t*)&xxx
        .rxConfig.bAutoFlushIgnored = 0x0,
        .rxConfig.bAutoFlushCrcErr = 0x0,
        .rxConfig.bAutoFlushEmpty = 0x0,
        .rxConfig.bIncludeLenByte = 0x1,
        .rxConfig.bIncludeCrc = 0x1,
        .rxConfig.bAppendRssi = 0x1,
        .rxConfig.bAppendStatus = 0x1,
        .rxConfig.bAppendTimestamp = 0x0,
        .bRepeat = 0x01,
        .__dummy0 = 0x0000,
        .accessAddress = 0x8E89BED6,
        .crcInit0 = 0x55,
        .crcInit1 = 0x55,
        .crcInit2 = 0x55,
        .endTrigger.triggerType = 0x1,
        .endTrigger.bEnaCmd = 0x0,
        .endTrigger.triggerNo = 0x0,
        .endTrigger.pastTrig = 0x0,
        .endTime = 0x00000001
    };
    
    
    // CMD_BLE5_GENERIC_RX
    // Bluetooth 5 Generic Receiver Command
    static rfc_CMD_BLE5_GENERIC_RX_t RF_cmdBle5GenericRx =
    {
        .commandNo = 0x1829,
        .status = 0x0000,
        .pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
        .startTime = 0x00000000,
        .startTrigger.triggerType = 0x0,
        .startTrigger.bEnaCmd = 0x0,
        .startTrigger.triggerNo = 0x0,
        .startTrigger.pastTrig = 0x0,
        .condition.rule = 0x1,
        .condition.nSkip = 0x0,
        .channel = 0x8C,
        .whitening.init = 0x51,
        .whitening.bOverride = 0x1,
        .phyMode.mainMode = 0x0,
        .phyMode.coding = 0x0,
        .rangeDelay = 0x00,
        .txPower = 0x0000,
        .pParams = &bleGenericRxPar,
        .pOutput = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
        .tx20Power = 0x00000000
    };
    
    // CMD_BLE5_RADIO_SETUP_PA
    // Bluetooth 5 Radio Setup Command for all PHYs
    static rfc_CMD_BLE5_RADIO_SETUP_PA_t RF_cmdBle5RadioSetup_PA =
    {
        .commandNo = 0x1820,
        .status = 0x0000,
        .pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
        .startTime = 0x00000000,
        .startTrigger.triggerType = 0x0,
        .startTrigger.bEnaCmd = 0x0,
        .startTrigger.triggerNo = 0x0,
        .startTrigger.pastTrig = 0x0,
        .condition.rule = 0x1,
        .condition.nSkip = 0x0,
        .defaultPhy.mainMode = 0x0,
        .defaultPhy.coding = 0x0,
        .loDivider = 0x00,
        .config.frontEndMode = 0x0,
        .config.biasMode = 0x1,
        .config.analogCfgMode = 0x0,
        .config.bNoFsPowerUp = 0x0,
        .txPower = 0xFFFF,
        .pRegOverrideCommon = pOverridesCommon,
        .pRegOverride1Mbps = pOverrides1Mbps,
        .pRegOverride2Mbps = pOverrides2Mbps,
        .pRegOverrideCoded = pOverridesCoded,
        .pRegOverrideTxStd = pOverridesTxStd,
        .pRegOverrideTx20 = pOverridesTx20
    };
    
    
    

    此处为SmartRF Studio 7导出的CC1352 BLE RF配置参数

  • 直接使用SmartRF Studio 7可以正常发送数据是吧?使用SmartRF Studio 7导出参数在程序中每次都要重新初始化,配置的参数才能生效

  • 比如第一次初始化为不打开功放,能正常发送,RF_Close掉,然后重新初始化为打开功放,也能发送数据,然后再次Close掉。接下来初始化为开功放的发送数据都没问题,但是再也不能初始化为不打开功放的模式(频谱仪上一点数据都没有)。除非系统重启

  • 你是在哪个例程中添加的,新的SDK应该不能直接导入smartRF studio的配置参数

    你使用smartRF studio开关PA具体是想实现什么功能?

  • 我使用的simplelink_cc13x2_26x2_sdk_4_20_00_35中 15.4 2.4G sensor 的例程,但是我已注释15.4协议栈的所有相关初始化。相当于一个空的工程中操作的BLE 的发送。

    我做工模板,只是想简单的在不同功率下发送BLE数据,不想使用协议栈。

  • 现在发送BLE数据都已完成,只是在切换到高功率发送后,就不能热切换到低功率模式。低功率能热切换到高功率

  • 我使用的simplelink_cc13x2_26x2_sdk_4_20_00_35中 15.4 2.4G sensor 的例程,但是我已注释15.4协议栈的所有相关初始化。相当于一个空的工程中操作的BLE 的发送。

    我没有这样试过,15.4和ble是不同的标准

    不过你可以参考https://dev.ti.com/tirex/explore/node?node=AJ1y3Qt11VwjrCSQsRfxXw__pTTHBmu__LATEST

    另一端连上SmartR Studio测试接收数据