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.

CC2652P: How to transmit BLE Adv signal using RF when ti15_4stack is in use?

Part Number: CC2652P
Other Parts Discussed in Thread: CC1352P

Hi, my target uses CC2652P, SimpleLink cc13x2_cc26x2 SDKv4.20, my application is based on example CC1352P_2_LAUNCHXL ti54stack sensor_2_4g.

My target works well with 15.4stack when data tx and rx.

Now I have a new task.

I need to transmit BLE adv signal based on current system.

I did an experiment.

First, I comment all my 15.4 code including 15.4 int and 15.4 task.

In the picture above, the code in red box is 15.4 init and has been comment.

Now the project will not init 15.4 stack.

In my application task, 

while (1)
{
	Clock_setTimeout(clockHandle, 500 * 100);

	Clock_start(clockHandle);

	ble_nc_adv_tx();
	
	Semaphore_pend(gSem, BIOS_WAIT_FOREVER);
}

There is only one task in my application, ble_nv_adv_tx each 500ms.

ble_nc_adv_tx() is

void ble_nc_adv_tx(void)
{
    uint8_t chan = 3;

    RF_Params rfParams;
    RF_Params_init(&rfParams);

    memset(&ble_adv_aoa_dat,0x00,sizeof(ble_adv_aoa_dat));
    ble_adv_aoa_dat.len = sizeof(ble_adv_aoa_t)-sizeof(ble_adv_aoa_dat.len);
    ble_adv_aoa_dat.hdr[0] = 0xff;
    ble_adv_aoa_dat.hdr[1] = COMPANY_ID_TEXAS_INSTRUMENTS&0xff;
    ble_adv_aoa_dat.hdr[2] = COMPANY_ID_TEXAS_INSTRUMENTS>>8;
    ble_adv_aoa_dat.hdr[3] = 0x03;
    //memset(ble_adv_aoa_dat.padding,0xaa,4/*sizeof(ble_adv_aoa_dat.padding)*/);
    memcpy(&ble_adv_aoa_dat.padding[0],&tag_id,4);
    memcpy(&ble_adv_aoa_dat.padding[4],&seq,2);
    memcpy(ble_adv_aoa_dat.tone,tone_dat[37-TONE_DAT_CHAN],sizeof(ble_adv_aoa_dat.tone));

    /* Request access to the radio */
    rfHandle = RF_open(&rfObject, &RF_prop_bt5le1m_0, (RF_RadioSetup*)&RF_cmdBle5RadioSetup_bt5le1m_0, &rfParams);

    /* Set the frequency */
    RF_cmdFs_bt5le1m_0.frequency = RFfrequencyTable_ble[chan].frequency;
    RF_cmdFs_bt5le1m_0.fractFreq = RFfrequencyTable_ble[chan].fractFreq;
    RF_runCmd(rfHandle, (RF_Op*)&RF_cmdFs_bt5le1m_0, RF_PriorityNormal, NULL, 0);

    RF_cmdBleAdvNc_bt5le1m_0.pParams->advLen        = sizeof(ble_adv_aoa_t);
    RF_cmdBleAdvNc_bt5le1m_0.pParams->pAdvData      = (uint8_t *)&ble_adv_aoa_dat;
    RF_cmdBleAdvNc_bt5le1m_0.startTrigger.triggerType  = 0;
    RF_cmdBleAdvNc_bt5le1m_0.startTrigger.pastTrig  = 1;
    RF_cmdBleAdvNc_bt5le1m_0.channel                = 0xff;
    RF_cmdBleAdvNc_bt5le1m_0.whitening.bOverride    = 1;
    RF_cmdBleAdvNc_bt5le1m_0.whitening.init         = RFfrequencyTable_ble[chan].whitening;
    RF_cmdBleAdvNc_bt5le1m_0.startTime              = 0;

    RF_runCmd(rfHandle, (RF_Op*)&RF_cmdBleAdvNc_bt5le1m_0, RF_PriorityNormal, NULL, 0);

    RF_close(rfHandle);
}

The RF_cmd above is 

// TI-RTOS RF Mode Object
RF_Mode RF_prop_bt5le1m_0 =
{
    .rfMode = RF_MODE_AUTO,
    .cpePatchFxn = &rf_patch_cpe_bt5,
    .mcePatchFxn = 0,
    .rfePatchFxn = 0
};

// Overrides for CMD_BLE5_RADIO_SETUP
uint32_t pOverrides_bt5le1m_0Common[] =
{
    // override_ble5_setup_override_common.json
    // DC/DC regulator: In Tx, use DCDCCTL5[3:0]=0x3 (DITHER_EN=0 and IPEAK=3).
    (uint32_t)0x00F388D3,
    // Bluetooth 5: Set pilot tone length to 20 us Common
    HW_REG_OVERRIDE(0x6024,0x2E20),
    // Bluetooth 5: Compensate for reduced pilot tone length
    (uint32_t)0x01280263,
    // 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 gain -5% for 1 Mbps
    (uint32_t)0x00E787E3,
    // Bluetooth 5: Set DTX threshold 1 Mbps
    (uint32_t)0x00950803,
    // Bluetooth 5: Set DTX gain -2.5% for 2 Mbps
    (uint32_t)0x00F487F3,
    // 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,
    // Bluetooth 5: Set enhanced TX shape
    (uint32_t)0x000D8C73,
    (uint32_t)0xFFFFFFFF
};

// Overrides for CMD_BLE5_RADIO_SETUP
uint32_t pOverrides_bt5le1m_01Mbps[] =
{
    // override_ble5_setup_override_1mbps.json
    // Bluetooth 5: Set pilot tone length to 20 us
    HW_REG_OVERRIDE(0x5320,0x03C0),
    // Bluetooth 5: Compensate syncTimeadjust
    (uint32_t)0x015302A3,
    (uint32_t)0xFFFFFFFF
};

// Overrides for CMD_BLE5_RADIO_SETUP
uint32_t pOverrides_bt5le1m_02Mbps[] =
{
    // override_ble5_setup_override_2mbps.json
    // Bluetooth 5: Set pilot tone length to 20 us
    HW_REG_OVERRIDE(0x5320,0x03C0),
    // Bluetooth 5: Compensate syncTimeAdjust
    (uint32_t)0x00F102A3,
    // Bluetooth 5: increase low gain AGC delay for 2 Mbps
    HW_REG_OVERRIDE(0x60A4,0x7D00),
    (uint32_t)0xFFFFFFFF
};

// Overrides for CMD_BLE5_RADIO_SETUP
uint32_t pOverrides_bt5le1m_0Coded[] =
{
    // override_ble5_setup_override_coded.json
    // Bluetooth 5: Set pilot tone length to 20 us
    HW_REG_OVERRIDE(0x5320,0x03C0),
    // Bluetooth 5: Compensate syncTimeadjust
    (uint32_t)0x07A902A3,
    // Rx: Set AGC reference level to 0x1B (default: 0x2E)
    HW_REG_OVERRIDE(0x609C,0x001B),
    (uint32_t)0xFFFFFFFF
};



// CMD_BLE5_RADIO_SETUP
// Bluetooth 5 Radio Setup Command for all PHYs
rfc_CMD_BLE5_RADIO_SETUP_t RF_cmdBle5RadioSetup_bt5le1m_0 =
{
    .commandNo = 0x1820,
    .status = 0x0000,
    .pNextOp = 0,
    .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,
    .config.bSynthNarrowBand = 0x0,
    .txPower = 0x7217,
    .pRegOverrideCommon = pOverrides_bt5le1m_0Common,
    .pRegOverride1Mbps = pOverrides_bt5le1m_01Mbps,
    .pRegOverride2Mbps = pOverrides_bt5le1m_02Mbps,
    .pRegOverrideCoded = pOverrides_bt5le1m_0Coded
};

// CMD_FS
// Frequency Synthesizer Programming Command
rfc_CMD_FS_t RF_cmdFs_bt5le1m_0 =
{
    .commandNo = 0x0803,
    .status = 0x0000,
    .pNextOp = 0,
    .startTime = 0x00000000,
    .startTrigger.triggerType = 0x0,
    .startTrigger.bEnaCmd = 0x0,
    .startTrigger.triggerNo = 0x0,
    .startTrigger.pastTrig = 0x0,
    .condition.rule = 0x1,
    .condition.nSkip = 0x0,
    .frequency = 0x0962,
    .fractFreq = 0x0000,
    .synthConf.bTxMode = 0x0,
    .synthConf.refFreq = 0x0,
    .__dummy0 = 0x00,
    .__dummy1 = 0x00,
    .__dummy2 = 0x00,
    .__dummy3 = 0x0000
};

// Structure for CMD_BLE_ADV_NC.pParam
rfc_bleAdvPar_t bleAdv_bt5le1m_0Par =
{
    .pRxQ = 0,
    .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,
    .pScanRspData = 0,
    .pDeviceAddress = 0,
    .pWhiteList = 0,
    .behConfig.scanRspEndType = 0x0,
    .__dummy0 = 0x0000,
    .endTrigger.triggerType = 0x0,
    .endTrigger.bEnaCmd = 0x0,
    .endTrigger.triggerNo = 0x0,
    .endTrigger.pastTrig = 0x0,
    .endTime = 0x00000000
};

// CMD_BLE_ADV_NC
// BLE Non-Connectable Advertiser Command
rfc_CMD_BLE_ADV_NC_t RF_cmdBleAdvNc_bt5le1m_0 =
{
    .commandNo = 0x1805,
    .status = 0x0000,
    .pNextOp = 0,
    .startTime = 0x00000000,
    .startTrigger.triggerType = 0x0,
    .startTrigger.bEnaCmd = 0x0,
    .startTrigger.triggerNo = 0x0,
    .startTrigger.pastTrig = 0x0,
    .condition.rule = 0x1,
    .condition.nSkip = 0x0,
    .channel = 0x66,
    .whitening.init = 0x51,
    .whitening.bOverride = 0x1,
    .pParams = &bleAdv_bt5le1m_0Par,
    .pOutput = 0
};

When I run this project, the program died when run ble_nc_adv_tx(), and system reset.

So, how to run this ble_nv_adv_tx() in my application, thank you.

  • Hi,

    You can refer to "simplelink_cc13x2_26x2_sdk_4_20_01_04\examples\rtos\CC1352P_2_LAUNCHXL\drivers\rfDualModeTx", it shows how to send ble_adv and proprietary packet on the same project.

  • Thank you very much.

    This rfDualModeTx example uses ble_adv and proprietary packet, both of them use low level RF drivers.

    But in my application, I need to use ti15_4stack.

    Based on this stack, how to use RF driver to tx BLE Adv?

    And I have tried according to the example above, it also failed.

    void ble_nc_adv_tx(void)
    {
        uint8_t chan = 3;
    
        RF_ScheduleCmdParams schParams;
        schParams.endTime = 0;
        // TODO: Need to replace with updated parameters from RFLIB-107
        // schParams.priority = RF_PriorityNormal;
        schParams.allowDelay = RF_AllowDelayAny;
        schParams.activityInfo = 0;
        schParams.duration = 0;
        schParams.endType = RF_EndNotSpecified;
        schParams.startTime = 0;
        schParams.startType = RF_StartNotSpecified;
    
        memset(&ble_adv_aoa_dat,0x00,sizeof(ble_adv_aoa_dat));
        ble_adv_aoa_dat.len = sizeof(ble_adv_aoa_t)-sizeof(ble_adv_aoa_dat.len);
        ble_adv_aoa_dat.hdr[0] = 0xff;
        ble_adv_aoa_dat.hdr[1] = COMPANY_ID_TEXAS_INSTRUMENTS&0xff;
        ble_adv_aoa_dat.hdr[2] = COMPANY_ID_TEXAS_INSTRUMENTS>>8;
        ble_adv_aoa_dat.hdr[3] = 0x03;
        //memset(ble_adv_aoa_dat.padding,0xaa,4/*sizeof(ble_adv_aoa_dat.padding)*/);
        memcpy(&ble_adv_aoa_dat.padding[0],&tag_id,4);
        memcpy(&ble_adv_aoa_dat.padding[4],&seq,2);
        memcpy(ble_adv_aoa_dat.tone,tone_dat[37-TONE_DAT_CHAN],sizeof(ble_adv_aoa_dat.tone));
    
        RF_Params rfParams;
        RF_Params_init(&rfParams);
    
        debug_printf("XX2\n");
    
        /* Request access to the radio */
        rfHandle = RF_open(&rfObject, &RF_prop_bt5le1m_0, (RF_RadioSetup*)&RF_cmdBle5RadioSetup_bt5le1m_0, &rfParams);
    
        debug_printf("XX3\n");
    
        /* Set the frequency */
        RF_cmdFs_bt5le1m_0.frequency = RFfrequencyTable_ble[chan].frequency;
        RF_cmdFs_bt5le1m_0.fractFreq = RFfrequencyTable_ble[chan].fractFreq;
        (void)RF_scheduleCmd(rfHandle, (RF_Op*) &RF_cmdFs_bt5le1m_0, &schParams, NULL, 0);
    
        debug_printf("XX4\n");
    
        rfc_ble5ExtAdvEntry_t ble5ExtAdvPacket;
    
        #define EXTENDED_HEADER_LENGTH            9
    
        /* Packet TX Configuration */
        #define PACKET_DATA_LENGTH                    27 /* Packet for BLE5 cannot exceed 37 with header (10) */
    
        static uint8_t packet[PACKET_DATA_LENGTH] = {0x11, 0x22};
    
        RF_ble_cmdBle5AdvAux.pParams->pAdvPkt = (uint8_t *)&ble5ExtAdvPacket;
        ble5ExtAdvPacket.extHdrInfo.length = EXTENDED_HEADER_LENGTH;
        ble5ExtAdvPacket.advDataLen = PACKET_DATA_LENGTH;
        ble5ExtAdvPacket.pAdvData = packet;
        RF_ble_cmdBle5AdvAux.startTrigger.triggerType = TRIG_NOW;
        RF_ble_cmdBle5AdvAux.startTrigger.pastTrig = 0;
        RF_ble_cmdBle5AdvAux.startTime = 0;
    
        RF_runScheduleCmd(rfHandle, (RF_Op*)&RF_ble_cmdBle5AdvAux, &schParams, NULL, 0);
    
        RF_cmdBleAdvNc_bt5le1m_0.pParams->advLen        = sizeof(ble_adv_aoa_t);
        RF_cmdBleAdvNc_bt5le1m_0.pParams->pAdvData      = (uint8_t *)&ble_adv_aoa_dat;
        RF_cmdBleAdvNc_bt5le1m_0.startTrigger.triggerType  = 0;
        RF_cmdBleAdvNc_bt5le1m_0.startTrigger.pastTrig  = 1;
        RF_cmdBleAdvNc_bt5le1m_0.channel                = 0xff;
        RF_cmdBleAdvNc_bt5le1m_0.whitening.bOverride    = 1;
        RF_cmdBleAdvNc_bt5le1m_0.whitening.init         = RFfrequencyTable_ble[chan].whitening;
        RF_cmdBleAdvNc_bt5le1m_0.startTime              = 0;
    
        //RF_runScheduleCmd(rfHandle, (RF_Op*)&RF_cmdBleAdvNc_bt5le1m_0, &schParams, NULL, 0);
    
        debug_printf("XX5\n");
    
        RF_close(rfHandle);
    }

    I tried two ble_adv cmd, RF_ble_cmdBle5AdvAux(0x1824) and RF_cmdBleAdvNc_bt5le1m_0(0x1805), and both die. When the program runs RF_runScheduleCmd(), it dies, and system reset.

    So, help me please.

  • Hi yingtao,

    Please correct me if I am mistaken, but this appears to be the ideal situation for which to use DMM.  You are attempting to access two different underlying MACs (BLE and 802.15.4) while the rfDualModeTx uses the same underlying radio PHY.  Please refer to the dmm_154sensor_remote_display_app_2_4g example to get started.

    Regards,
    Ryan

  • Hi Ryan,

    If I use DMM, it means I will use two different MACs (BLE and 802.15.4), 

    But there is a difficult about develop time.

    Now, my application uses 802.15.4 MAC based on 15.4 sensor example.

    If I use DMM, I need to develop my 15.4 application again on DMM example, and also, I need to develop BLE application based on BLE MAC on this DMM example, both of them will cost a lot of time.

    And, I don't need complex BLE application, I just need to tx some BLE adv data under non-connect mode. It doesn't even have to be a BLE receiver. So, if I don't use BLE MAC, things will be simple.

    I want to know, if there is a simple method.

    To be specific, based on my current application (application based on 802.15.4 sensor example), Can I use low level RF drivers to tx BLE adv data.

    In this case, I don't need to use BLE MAC, and I can save development time.

    Thanks.

  • Hi Ryan.

    After some experiment, now I have a progress.

    Based on my application (based on 802.15.4 sensor example), I can tx BLE adv data. Code is as below : 

    void ble_nc_adv_tx(void)
    {
        RF_Object rfObject;
        RF_Handle rfHandle;
    
        uint8_t chan = 1;
    
        RF_Params rfParams;
        RF_Params_init(&rfParams);
    
        memset(&ble_adv_aoa_dat,0x00,sizeof(ble_adv_aoa_dat));
        ble_adv_aoa_dat.len = sizeof(ble_adv_aoa_t)-sizeof(ble_adv_aoa_dat.len);
        ble_adv_aoa_dat.hdr[0] = 0xff;
        ble_adv_aoa_dat.hdr[1] = COMPANY_ID_TEXAS_INSTRUMENTS&0xff;
        ble_adv_aoa_dat.hdr[2] = COMPANY_ID_TEXAS_INSTRUMENTS>>8;
        ble_adv_aoa_dat.hdr[3] = 0x03;
        //memset(ble_adv_aoa_dat.padding,0xaa,4/*sizeof(ble_adv_aoa_dat.padding)*/);
        memcpy(&ble_adv_aoa_dat.padding[0],&tag_id,4);
        memcpy(&ble_adv_aoa_dat.padding[4],&seq,2);
        memcpy(ble_adv_aoa_dat.tone,tone_dat[37-TONE_DAT_CHAN],sizeof(ble_adv_aoa_dat.tone));
    
        /* Request access to the radio */
        rfHandle = RF_open(&rfObject, &RF_prop_bt5le1madvnc_0, (RF_RadioSetup*)&RF_cmdBle5RadioSetup_bt5le1madvnc_0, &rfParams);
    
        /* Set the frequency */
        RF_cmdFs_bt5le1madvnc_0.frequency = RFfrequencyTable_ble[chan].frequency;
        RF_cmdFs_bt5le1madvnc_0.fractFreq = RFfrequencyTable_ble[chan].fractFreq;
        RF_runCmd(rfHandle, (RF_Op*)&RF_cmdFs_bt5le1madvnc_0, RF_PriorityNormal, NULL, 0);
    
        RF_cmdBleAdvNc_bt5le1madvnc_0.pParams->advLen        = sizeof(ble_adv_aoa_t);
        RF_cmdBleAdvNc_bt5le1madvnc_0.pParams->pAdvData      = (uint8_t *)&ble_adv_aoa_dat;
        RF_cmdBleAdvNc_bt5le1madvnc_0.startTrigger.triggerType  = 0;
        RF_cmdBleAdvNc_bt5le1madvnc_0.startTrigger.pastTrig  = 1;
        RF_cmdBleAdvNc_bt5le1madvnc_0.channel                = 0xff;
        RF_cmdBleAdvNc_bt5le1madvnc_0.whitening.bOverride    = 1;
        RF_cmdBleAdvNc_bt5le1madvnc_0.whitening.init         = RFfrequencyTable_ble[chan].whitening;
        RF_cmdBleAdvNc_bt5le1madvnc_0.startTime              = 0;
    
        RF_runCmd(rfHandle, (RF_Op*)&RF_cmdBleAdvNc_bt5le1madvnc_0, RF_PriorityNormal, NULL, 0);
    
        RF_close(rfHandle);
    }

    This function uses 3 RF cmd : RF_cmdBle5RadioSetup_bt5le1madvnc_0, RF_cmdFs_bt5le1madvnc_0, RF_cmdBleAdvNc_bt5le1madvnc_0.

    This cmd is as below:

    // TI-RTOS RF Mode Object
    static RF_Mode RF_prop_bt5le1madvnc_0 =
    {
        .rfMode = RF_MODE_AUTO,
        .cpePatchFxn = &rf_patch_cpe_bt5,
        .mcePatchFxn = 0,
        .rfePatchFxn = 0
    };
    
    // Overrides for CMD_BLE5_RADIO_SETUP_PA
    static uint32_t pOverrides_bt5le1madvnc_0Common[] =
    {
        // override_ble5_setup_override_common_hpa.json
        // 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,
        (uint32_t)0xFFFFFFFF
    };
    
    // Overrides for CMD_BLE5_RADIO_SETUP_PA
    static uint32_t pOverrides_bt5le1madvnc_01Mbps[] =
    {
        // override_ble5_setup_override_1mbps_hpa.json
        // 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 pOverrides_bt5le1madvnc_02Mbps[] =
    {
        // override_ble5_setup_override_2mbps_hpa.json
        // 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 pOverrides_bt5le1madvnc_0Coded[] =
    {
        // override_ble5_setup_override_coded_hpa.json
        // 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_bt5le1madvnc_0 =
    {
        .commandNo = 0x1820,
        .status = 0x0000,
        .pNextOp = 0,
        .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 = pOverrides_bt5le1madvnc_0Common,
        .pRegOverride1Mbps = pOverrides_bt5le1madvnc_01Mbps,
        .pRegOverride2Mbps = pOverrides_bt5le1madvnc_02Mbps,
        .pRegOverrideCoded = pOverrides_bt5le1madvnc_0Coded,
        .pRegOverrideTxStd = 0,
        .pRegOverrideTx20 = 0
    };
    
    // CMD_FS
    // Frequency Synthesizer Programming Command
    static rfc_CMD_FS_t RF_cmdFs_bt5le1madvnc_0 =
    {
        .commandNo = 0x0803,
        .status = 0x0000,
        .pNextOp = 0,
        .startTime = 0x00000000,
        .startTrigger.triggerType = 0x0,
        .startTrigger.bEnaCmd = 0x0,
        .startTrigger.triggerNo = 0x0,
        .startTrigger.pastTrig = 0x0,
        .condition.rule = 0x1,
        .condition.nSkip = 0x0,
        .frequency = 0x0962,
        .fractFreq = 0x0000,
        .synthConf.bTxMode = 0x0,
        .synthConf.refFreq = 0x0,
        .__dummy0 = 0x00,
        .__dummy1 = 0x00,
        .__dummy2 = 0x00,
        .__dummy3 = 0x0000
    };
    
    // Structure for CMD_BLE_ADV_NC.pParam
    static rfc_bleAdvPar_t bleAdv_bt5le1madvnc_0Par =
    {
        .pRxQ = 0,
        .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,
        .pScanRspData = 0,
        .pDeviceAddress = 0,
        .pWhiteList = 0,
        .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_bt5le1madvnc_0 =
    {
        .commandNo = 0x1805,
        .status = 0x0000,
        .pNextOp = 0,
        .startTime = 0x00000000,
        .startTrigger.triggerType = 0x0,
        .startTrigger.bEnaCmd = 0x0,
        .startTrigger.triggerNo = 0x0,
        .startTrigger.pastTrig = 0x0,
        .condition.rule = 0x1,
        .condition.nSkip = 0x0,
        .channel = 0x66,
        .whitening.init = 0x51,
        .whitening.bOverride = 0x1,
        .pParams = &bleAdv_bt5le1madvnc_0Par,
        .pOutput = 0
    };

    Now. I can call ble_nc_adv_tx() to tx ble adv data only if I don't call any 15.4 task. 

    If I call 15.4 task for example ApiMac_mlmeScanReq after ble tx, then, program halt, and system reset.

    I guess, this is because after I call ble_nc_adv_tx(), the radio PHY has been changed to BLE, so, in this case, 15.4 task ApiMac_mlmeScanReq fails.

    So, I guess, if I change radio PHY back to 15.4 after each time ble tx, then, maybe 15.4 task can work.

    So, I did experiment, I reconfig RF after each time ble tx as below:

    RF_Object rfObject;
        RF_Handle rfHandle;
    
        RF_Params rfParams;
        RF_Params_init(&rfParams);
    
        rfHandle = RF_open(&rfObject, &RF_prop_ieee154, (RF_RadioSetup*)&RF_cmdRadioSetup_ieee154, &rfParams);
    
        RF_close(rfHandle);

    When I do this, things get better.

    I can tx 15.4 data using ApiMac_mcpsDataReq(), but it seems have some error. But,  ApiMac_mlmeScanReq still fails.

    I think, the frequency is also changed by ble cmd Fs, so the frequency also need to be changed back.

    But it's difficult to change back frequency, because 15.4 channel can change during work.

    To summarize, now the question is, after I tx ble data, 15.4 task fails. How to recover 15.4 after each time tx ble?

  • Hey yingtao,

    I'm glad to hear you are making progress.  For this specific application to work you probably need to re-initialize both the 15.4-Stack RF and MAC, see ApiMac_init from the sensor.c file.  At this point, would it be possible to consider intentionally resetting the device after the BLE command to initialize the device once more for 15.4 operation?

    Regards,
    Ryan

  • Hi Ryan,

    If I use DMM, can I tx ble adv data in non-adv channel(not 37, 38, 39 channel)?

  • BLE operation and limitations will be the same for DMM applications as standalone.  You may want to start a new thread if you have more questions which a BLE expert should address.

    Regards,
    Ryan