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.

CC1310: Operation at >= 1Mbps data rates.

Part Number: CC1310

Hi TI,

I'm having difficulty getting our CC1310 to operate at the advertised 1Mbps data rate. We are working at the 900MHz frequency band.

I've successfully implemented various data rates up to 500kbps, inclusive, but making that leap to 1Mbps and beyond is not working.

As required, from 1Mbps and beyond, we use the different RF core command structure RF_cmdTxHS (of type rfc_CMD_HS_TX_t) as prescribed here: https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz/f/156/p/628551/2363574#2363574

My structures:

// TI-RTOS RF Mode Object (includes patches for high speed operation)
// See e2e.ti.com/.../2363574
static const RF_Mode RfSettings_RF_prop_hs_4fsk =
{
.rfMode = RF_MODE_PROPRIETARY_SUB_1,
.cpePatchFxn = &enterGhsCpePatch,
.mcePatchFxn = &rf_patch_mce_ghs,
.rfePatchFxn = &rf_patch_rfe_ghs,
};

// CMD_PROP_RADIO_DIV_SETUP for 4FSK (1Mbps, 2Mbps)
const rfc_CMD_PROP_RADIO_DIV_SETUP_t Cc1310_Rf900vol_PHY_900M_500KSYM_4fsk_g =
{
.commandNo = 0x3807,
.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,
.modulation.modType = 0x1,
.modulation.deviation = 600,
.symbolRate.preScale = 8,
.symbolRate.rateWord = 262144,
.rxBw = 48, 
.preamConf.nPreamBytes = 0x4, // 0x6
.preamConf.preamMode = 0x0, // 0x1
.formatConf.nSwBits = 0x20,
.formatConf.bBitReversal = 0x0,
.formatConf.bMsbFirst = 0x1,
.formatConf.fecMode = 0x0, //9, 
.formatConf.whitenMode = 0x0,
.config.frontEndMode = 0x0,
.config.biasMode = 0x1,
.config.bNoFsPowerUp = 0x0,
.txPower = 0xA73F,
.pRegOverride = (uint32_t*)PHY_900M_500KSYM_4_fsk_pOverrides,
.centerFreq = 915,
.intFreq = 0x0A66, 
.loDivider = 0x05,
};

static const uint32_t PHY_900M_500KSYM_4_fsk_pOverrides[] =
{
// PHY: Use MCE RAM patch, RFE RAM patch 
MCE_RFE_OVERRIDE(1, 0, 0, 1, 0, 0),
// Rx: Set anti-aliasing filter bandwidth to Maximum
ADI_HALFREG_OVERRIDE(0,61,0xF,0x0),
// Synth: Set recommended RTRIM to 7
HW_REG_OVERRIDE(0x4038,0x0037),
// Synth: Configure fine calibration setting
HW_REG_OVERRIDE(0x4020,0x7F00),
// Synth: Configure fine calibration setting
HW_REG_OVERRIDE(0x4064,0x0040),
// Synth: Set Fref to 4 MHz
(uint32_t)0x000684A3,
// Synth: Configure fine calibration setting
(uint32_t)0xC0040141, 
(uint32_t)0x0533B107, 
// Synth: Set loop bandwidth after lock
(uint32_t)0xA480583, 
(uint32_t)0x7AB80603,
// Synth: Configure VCO LDO (in ADI1, set VCOLDOCFG=0x9F to use voltage input reference)
ADI_REG_OVERRIDE(1,4,0x9F),
// Synth: Configure synth LDO (in ADI1, set SLDOCTL0.COMP_CAP=1)
ADI_HALFREG_OVERRIDE(1,7,0x4,0x4),
// Rx: Set LNA bias current trim offset to 3
(uint32_t)0x00038883,
// Rx: Set RSSI offset to adjust reported RSSI
(uint32_t)0x00FB88A3, 
// Synth: Use 24 MHz XOSC as synth clock, enable extra PLL filtering
(uint32_t)0x02010403,
// Synth: Configure extra PLL filtering
(uint32_t)0x00108463,
// Synth: Increase synth programming timeout (0x04B0 RAT ticks = 300 us)
(uint32_t)0x04B00243,
//Configure thershold for Sync word detection
HW_REG_OVERRIDE(0x5104,0x302B),
//Set FIFO threshold
(uint32_t) 0x002C82C3, 
(uint32_t) 0x002882D3,
// Rx: Do not freeze RSSI on sync found event
HW_REG_OVERRIDE(0x6084,0x25F1),
// ****PA Ramping overrides
HW_REG_OVERRIDE(0x6088,0x4121), 
HW_REG_OVERRIDE(0x608C,0x0A12), 
// ****Length of CW tone
HW_REG_OVERRIDE(0x52B0,0x00F0), 
// DC estimation
HW_REG_OVERRIDE(0x51F8,0x0F90),
//Zero IF in TX
(uint32_t) 0x00000343, 
// Tx: Set PA trim to max (in ADI0, set PACTL0=0xF8)
ADI_REG_OVERRIDE(0,12,0xF8),

/* RF Core monitors */
(uint32_t)0x008F88B3,
HW_REG_OVERRIDE(0x1110, RFC_DBELL_SYSGPOCTL_GPOCTL0_MCEGPO0 | RFC_DBELL_SYSGPOCTL_GPOCTL1_MCEGPO1 | RFC_DBELL_SYSGPOCTL_GPOCTL3_RATGPO1),

// End Override
(uint32_t)0xFFFFFFFF, 
};

My Code:

My code (logic, flow, interrupts etc.) is identical to my working 500kbps (2-FSK) code except for the use of RF_cmdTxHS instead of RF_cmdPropTxAdv (of type rfc_CMD_PROP_TX_ADV_t). Because the structures differ, I assign my dataQueue_t* to RF_cmdTxHS.pQueue instead of the pPkt and pktLen attributes; the rest remains the same:

for(i = 0; i < TX_QUEUE_COUNT; i++)
{
TxEntryQueue[i].pNextEntry = (uint8_t*)&TxEntryQueue[(i + 1) % TX_QUEUE_COUNT];
TxEntryQueue[i].status = DATA_ENTRY_PENDING;
TxEntryQueue[i].config.type = DATA_ENTRY_TYPE_PTR;
TxEntryQueue[i].config.lenSz = 1;
TxEntryQueue[i].pData = TxBlocks[i];
TxEntryQueue[i].length = 16; //BLOCK_LENGTH;
}

if(Cc1310_RfSettings_Is4fskMode()) // >= 1Mbps
{
/* Configure high speed TX command */
RF_cmdTxHS.pQueue = &TxQueue;

/* CRC not applicable, since we are using infinite length transmission mode there is no
* automatic CRC checking for us
*/
RF_cmdTxHS.pktConf.bUseCrc = 0;

RF_cmdTxHS.startTrigger.triggerType = TRIG_NOW;
RF_cmdTxHS.startTrigger.pastTrig = 1;
RF_cmdTxHS.startTime = 0;

TxOperation = (RF_Op*)&RF_cmdTxHS;
}
else // <= 500kbps
{
/* Configure CMD_PROP_TX_ADV */
RF_cmdPropTxAdv.pPkt = (uint8_t*)&TxQueue;
RF_cmdPropTxAdv.pktLen = 0;

RF_cmdPropTxAdv.pktConf.bUseCrc = 1;

RF_cmdPropTxAdv.startTrigger.triggerType = TRIG_NOW;
RF_cmdPropTxAdv.startTrigger.pastTrig = 1;
RF_cmdPropTxAdv.startTime = 0;
RF_cmdPropTxAdv.syncWord = CC1310_BBBLOCKS_SYNC_WORD; // ### May need changing?

TxOperation = (RF_Op*)&RF_cmdPropTxAdv;
}

TxQueue.pCurrEntry = (uint8_t*)&TxEntryQueue[0];
/* pLastEntry loop is closed upon reception of LAST_BLOCK flag */
TxQueue.pLastEntry = NULL;

...

result = RF_postCmd(Cc1310_CcRf_RfHandle_g,
TxOperation,// (RF_Op*)&RF_cmdPropTxAdv,
RF_PriorityNormal,
&TxBlocksCallback,
RF_EventTxEntryDone | RF_EventLastCmdDone);

Symptoms:

I know the issue is in the Tx, not Rx, because the RF Core signal MCE_GPO0 that I've routed to the external GPIO does not behave as it should. I am aware that http://software-dl.ti.com/simplelink/esd/simplelink_cc13x0_sdk/3.20.00.23/exports/docs/proprietary-rf/proprietary-rf-users-guide/rf-core/signal-routing.html states that MCE_GPO0 and MCE_GPO1 are not supported for 4-FSK mode but I do see the correct preamble and 4 bytes of sync (I cannot control the sync, since RF_cmdTxHS does not permit this). I then expect to see 48 bytes of my data (previously buffered in TxQueue), with every 'block' of 16 bytes (the maximum permissible callback rate) triggering the callback function. Instead, following the correct preamble and (presumably) 4 bytes of sync, I see garbage (mostly zeros), a single callback, followed by the RF_EventLastCmdDone event. I also note that the bit period of MCE_GPO0 is 1.33us, not 1us.

Also, what are the necessary changes to get 2Mbps and 4Mbps working? I believe 4Mbps requires this structure:

{
.rfMode = RF_MODE_PROPRIETARY_SUB_1,
.cpePatchFxn = 0,
.mcePatchFxn = &rf_patch_mce_hsp_4mbps,
.rfePatchFxn = &rf_patch_rfe_hsp_4mbps,
};

plus different overrides and radio setup structure but are other changes also required?

Thanks in advance for your support.

Regards,

Sean.

  • Hi Sean, 

    Thanks for your question. We are looking into this and will get back to you as soon as possible. 

    Thanks, 
    Elin 

  • Hi Elin,

    Thanks for your support - any help is appreciated.

    Regards,

    Sean.

  • Hi

    Please see the attached files. You can test these files using the rfPacketRX and rfPacketTX example in  the latest SDK.

    The settings/commands with _ghs (general high speed) is for 1.5 mbps, the settings/command named _hsm_4mbps is for the 4 mbps settings.

    You can test link for both settings, you only need to run different setup commands for the different PHYs:

    // General High Speed mode (1.5 mbps)
    rfHandle = RF_open(&rfObject, &RF_prop_ghs, (RF_RadioSetup*)&RF_cmdPropRadioDivSetup_ghs, &rfParams);
    
    // 4 mbps High Speed Mode
    // rfHandle = RF_open(&rfObject, &RF_prop_hsm_4mbps, (RF_RadioSetup*)&RF_cmdRadioSetup_hsm_4mbps, &rfParams);

    
    //*********************************************************************************
    // Generated by SmartRF Studio version 2.6.0 (build #81)
    // Tested for SimpleLink SDK version: CC13x0 SDK 1.0.xx
    // Device: CC1310 Rev. 2.1
    //
    //*********************************************************************************
    
    
    #include <ti/devices/DeviceFamily.h>
    #include DeviceFamily_constructPath(driverlib/rf_mailbox.h)
    #include DeviceFamily_constructPath(driverlib/rf_hs_mailbox.h)
    #include DeviceFamily_constructPath(driverlib/rf_common_cmd.h)
    #include DeviceFamily_constructPath(driverlib/rf_hs_cmd.h)
    #include DeviceFamily_constructPath(driverlib/rf_prop_cmd.h)
    #include DeviceFamily_constructPath(rf_patches/rf_patch_mce_hsp_4mbps.h)
    #include DeviceFamily_constructPath(rf_patches/rf_patch_rfe_hsp_4mbps.h)
    #include DeviceFamily_constructPath(rf_patches/rf_patch_cpe_ghs.h)
    #include DeviceFamily_constructPath(rf_patches/rf_patch_mce_ghs.h)
    #include DeviceFamily_constructPath(rf_patches/rf_patch_rfe_ghs.h)
    
    
    #include <ti/drivers/rf/RF.h>
    #include "smartrf_settings.h"
    
    RF_Mode RF_prop_hsm_4mbps =
    {
        .rfMode = RF_MODE_PROPRIETARY_SUB_1,
        .cpePatchFxn =  0,
        .mcePatchFxn =  &rf_patch_mce_hsp_4mbps,
        .rfePatchFxn =  &rf_patch_rfe_hsp_4mbps,
    };
    
    RF_Mode RF_prop_ghs =
    {
        .rfMode       =  RF_MODE_PROPRIETARY_SUB_1,
        .cpePatchFxn  =  &rf_patch_cpe_ghs,
        .mcePatchFxn  =  &rf_patch_mce_ghs,
        .rfePatchFxn  =  &rf_patch_rfe_ghs,
    };
    
    // Overrides for CMD_RADIO_SETUP HSM (4 mbps)
    uint32_t shapeovr[] = {0x00000000, 0x00000000, 0x00000000, 0x12010000, 0x72685C43, 0x8986817A};
    
    uint32_t pOverrides_hsm_4mbps[] =
    {
        MCE_RFE_OVERRIDE(1,0,0,1,0,0),
        ADI_HALFREG_OVERRIDE(0,61,0xF,0x0),
        ADI_REG_OVERRIDE(1,4,0x9F),
        ADI_HALFREG_OVERRIDE(1,7,0x4,0x4),
        HW_REG_OVERRIDE(0x4038,0x003A),
        HW_REG_OVERRIDE(0x4020,0x7F00),
        HW_REG_OVERRIDE(0x4064,0x0040),
        0x000604A3,
        0xB1070503,
        0x05330523,
        0x0A480583,
        0x7AB80603,
        0x00108463,
        0x02010403,
        0x04B00243,
        0x00038883,
        0xC0040031,
        (uint32_t) &shapeovr[0],
        0xC0040021,
        (uint32_t) (0x00000035),
        0x000388A3,
        HW_REG_OVERRIDE(0x50B4,0x6666),
        HW_REG_OVERRIDE(0x50B8,0x000C),
        (uint32_t)0xFFFFFFFF,
    };
    
    
    
    uint32_t pOverrides_ghs[] =
    {
        // PHY: Use MCE RAM patch, RFE RAM patch
        MCE_RFE_OVERRIDE(1, 0, 0, 1, 0, 0),
        // Rx: Set anti-aliasing filter bandwidth to Maximum
        ADI_HALFREG_OVERRIDE(0,61,0xF,0x0),
        // Synth: Set recommended RTRIM to 7
        HW_REG_OVERRIDE(0x4038,0x0037),
        // Synth: Configure fine calibration setting
        HW_REG_OVERRIDE(0x4020,0x7F00),
        // Synth: Configure fine calibration setting
        HW_REG_OVERRIDE(0x4064,0x0040),
        // Synth: Set Fref to 4 MHz
        (uint32_t)0x000684A3,
        // Synth: Configure fine calibration setting
        (uint32_t)0xC0040141,
        (uint32_t)0x0533B107,
        // Synth: Set loop bandwidth after lock
        (uint32_t)0xA480583,
        (uint32_t)0x7AB80603,
        // Synth: Configure VCO LDO (in ADI1, set VCOLDOCFG=0x9F to use voltage input reference)
        ADI_REG_OVERRIDE(1,4,0x9F),
        // Synth: Configure synth LDO (in ADI1, set SLDOCTL0.COMP_CAP=1)
        ADI_HALFREG_OVERRIDE(1,7,0x4,0x4),
        // Rx: Set LNA bias current trim offset to 3
        (uint32_t)0x00038883,
        // Rx: Set RSSI offset to adjust reported RSSI
        (uint32_t)0x00FB88A3,
        // Synth: Use 24 MHz XOSC as synth clock, enable extra PLL filtering
        (uint32_t)0x02010403,
        // Synth: Configure extra PLL filtering
        (uint32_t)0x00108463,
        // Synth: Increase synth programming timeout (0x04B0 RAT ticks = 300 us)
        (uint32_t)0x04B00243,
        //Configure thershold for Sync word detection
        HW_REG_OVERRIDE(0x5104,0x302B),
        //Set FIFO threshold
        (uint32_t) 0x002C82C3,
        (uint32_t) 0x002882D3,
        // Rx: Do not freeze RSSI on sync found event
        HW_REG_OVERRIDE(0x6084,0x25F1),
        // ****PA Ramping overrides
        HW_REG_OVERRIDE(0x6088,0x4121),
        HW_REG_OVERRIDE(0x608C,0x0A12),
        // ****Length of CW tone
        HW_REG_OVERRIDE(0x52B0,0x00F0),
        // DC estimation
        HW_REG_OVERRIDE(0x51F8,0x0F90),
        //Zero IF in TX
        (uint32_t) 0x00000343,
        // TX power override
        // Tx: Set PA trim to max (in ADI0, set PACTL0=0xF8)
        ADI_REG_OVERRIDE(0,12,0xF8),
        // End Override
        (uint32_t)0xFFFFFFFF,
    };
    
    
    // CMD_RADIO_SETUP HSM
    rfc_CMD_RADIO_SETUP_t RF_cmdRadioSetup_hsm_4mbps =
    {
        .commandNo = CMD_RADIO_SETUP,
        .status = 0x0000,
        .pNextOp = 0x00000000,
        .startTime = 0x00000000,
        .startTrigger.triggerType = 0x0,
        .startTrigger.bEnaCmd = 0x0,
        .startTrigger.triggerNo = 0x0,
        .startTrigger.pastTrig = 0x0,
        .condition.rule = 0x1,
        .condition.nSkip = 0x0,
        .mode = 0x05,
        .loDivider = 5,
        .config.frontEndMode = 0x0,
        .config.biasMode = 0x1,
        .config.bNoFsPowerUp = 0,
        .txPower = 0x23F,
        .pRegOverride = pOverrides_hsm_4mbps,
    };
    
    
    // CMD_PROP_RADIO_DIV_SETUP for 4FSK
    rfc_CMD_PROP_RADIO_DIV_SETUP_t RF_cmdPropRadioDivSetup_ghs =
    {
        .commandNo = 0x3807,
        .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,
        .modulation.modType = 0x1,
        .modulation.deviation = 600,
        .symbolRate.preScale = 8,
        .symbolRate.rateWord = 262144,
        .rxBw = 48,
        .preamConf.nPreamBytes = 0x6,
        .preamConf.preamMode = 0x1,
        .formatConf.nSwBits = 0x20,
        .formatConf.bBitReversal = 0x0,
        .formatConf.bMsbFirst = 0x1,
        .formatConf.fecMode = 9,
        .formatConf.whitenMode = 0x0,
        .config.frontEndMode = 0x0,
        .config.biasMode = 0x1,
        .config.bNoFsPowerUp = 0x0,
        .txPower = 0x23F,
        .pRegOverride = pOverrides_ghs,
        .centerFreq = 915,
        .intFreq = 0x0A66,
        .loDivider = 0x05,
    };
    
    // CMD_TX_HS
    rfc_CMD_HS_TX_t RF_cmdTxHS =
    {
        .commandNo = 0x3841,
        .status = 0x0000,
        .pNextOp = 0x00000000,
        .startTime = 0x00000000,
        .startTrigger.triggerType = 0x0,
        .startTrigger.bEnaCmd = 0x0,
        .startTrigger.triggerNo = 0x0,
        .startTrigger.pastTrig = 0x0,
        .condition.rule = 0x1,
        .condition.nSkip = 0x0,
        .pktConf.bFsOff = 0x0,
        .pktConf.bUseCrc = 0x1,
        .pktConf.bVarLen = 0x1,
        .pQueue = 0,
    };
    
    // CMD_RX_HS
    rfc_CMD_HS_RX_t RF_cmdRxHS =
    {
        .commandNo = CMD_HS_RX,
        .status = 0x0000,
        .pNextOp = 0x00000000,
        .startTime = 0x00000000,
        .startTrigger.triggerType = 0x0,
        .startTrigger.bEnaCmd = 0x0,
        .startTrigger.triggerNo = 0x0,
        .startTrigger.pastTrig = 0x0,
        .condition.rule = 0x1,
        .condition.nSkip = 0x0,
        .pktConf.bFsOff = 0,
        .pktConf.bUseCrc = 1,
        .pktConf.bVarLen = 1,
        .pktConf.bRepeatOk = 0,
        .pktConf.bRepeatNok = 0,
        .pktConf.addressMode = 0,
        .rxConf.bAutoFlushCrcErr = 0,
        .rxConf.bIncludeLen = 1,
        .rxConf.bIncludeCrc = 0,
        .rxConf.bAppendStatus = 0,
        .rxConf.bAppendTimestamp = 0,
        .maxPktLen = 0,
        .address0 = 0,
        .address1 = 0,
        .__dummy0 = 0,
        .endTrigger.triggerType = 1,
        .endTrigger.bEnaCmd = 0,
        .endTrigger.triggerNo = 0,
        .endTrigger.pastTrig = 0,
        .endTime = 0,
        .pQueue = 0,
        .pOutput = 0,
    };
    
    // CMD_FS
    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 = 0x0364,
        .fractFreq = 0x0000,
        .synthConf.bTxMode = 0x0,
        .synthConf.refFreq = 0x0,
        .__dummy0 = 0x00,
        .__dummy1 = 0x00,
        .__dummy2 = 0x00,
        .__dummy3 = 0x0000,
    };
    
    
    2630.smartrf_settings.h
    /*
     * Copyright (c) 2019, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    
    /***** Includes *****/
    /* Standard C Libraries */
    #include <stdlib.h>
    #include <unistd.h>
    
    /* TI Drivers */
    #include <ti/drivers/rf/RF.h>
    #include <ti/drivers/PIN.h>
    #include <ti/drivers/pin/PINCC26XX.h>
    
    /* Driverlib Header files */
    #include DeviceFamily_constructPath(driverlib/rf_prop_mailbox.h)
    #include DeviceFamily_constructPath(driverlib/rf_hs_mailbox.h)
    
    /* Board Header files */
    #include "Board.h"
    #include "smartrf_settings/smartrf_settings.h"
    #include "RFQueue.h"
    
    
    /***** Defines *****/
    
    /* Packet TX Configuration */
    #define PAYLOAD_LENGTH          30
    #define DATA_ENTRY_HEADER_SIZE  8               // Constant header size of a Generic Data Entry
    #define MAX_LENGTH              PAYLOAD_LENGTH  // Set the length of the data entry
    #define NUM_DATA_ENTRIES_TX     1
    #define NUM_APPENDED_BYTES_TX   0
    #define PACKET_INTERVAL         50000           // Set packet interval to 50000 us or 50 ms
    
    /***** Prototypes *****/
    
    /***** Variable declarations *****/
    static RF_Object rfObject;
    static RF_Handle rfHandle;
    
    /* Pin driver handle */
    static PIN_Handle ledPinHandle;
    static PIN_State ledPinState;
    
    static uint8_t *pPacket;
    static uint16_t counter = 0;
    
    #pragma DATA_ALIGN (txDataEntryBuffer, 4);
    static uint8_t
    txDataEntryBuffer[RF_QUEUE_DATA_ENTRY_BUFFER_SIZE(NUM_DATA_ENTRIES_TX,
                                                      MAX_LENGTH,
                                                      NUM_APPENDED_BYTES_TX)];
    
    static dataQueue_t dataQueue;
    static rfc_dataEntryGeneral_t* currentDataEntry;
    
    /*
     * Application LED pin configuration table:
     *   - All LEDs board LEDs are off.
     */
    PIN_Config pinTable[] =
    {
        Board_PIN_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
        Board_PIN_LED2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
        PIN_TERMINATE
    };
    
    /***** Function definitions *****/
    
    void *mainThread(void *arg0)
    {
        RF_Params rfParams;
        RF_Params_init(&rfParams);
    
        /* Open LED pins */
        ledPinHandle = PIN_open(&ledPinState, pinTable);
        if (ledPinHandle == NULL)
        {
            while(1);
        }
    
        if( RFQueue_defineQueue(&dataQueue,
                                    txDataEntryBuffer,
                                    sizeof(txDataEntryBuffer),
                                    NUM_DATA_ENTRIES_TX,
                                    MAX_LENGTH + NUM_APPENDED_BYTES_TX))
        {
            /* Failed to allocate space for all data entries */
            while(true);
        }
    
        RF_cmdTxHS.pQueue = &dataQueue;
        RF_cmdTxHS.startTrigger.triggerType = TRIG_NOW;
    
        currentDataEntry = (rfc_dataEntryGeneral_t*)&txDataEntryBuffer;
        currentDataEntry->length = PAYLOAD_LENGTH;
        pPacket = &currentDataEntry->data;
    
        // Green LED ON while in TX
        PINCC26XX_setMux(ledPinHandle, Board_PIN_LED1, PINCC26XX_MUX_RFC_GPO1);
    
        /* Request access to the radio */
        rfHandle = RF_open(&rfObject, &RF_prop_ghs, (RF_RadioSetup*)&RF_cmdPropRadioDivSetup_ghs, &rfParams);
    
        //rfHandle = RF_open(&rfObject, &RF_prop_hsm_4mbps, (RF_RadioSetup*)&RF_cmdRadioSetup_hsm_4mbps, &rfParams);
    
        /* Set the frequency */
        RF_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);
    
        while(counter++ < 100)
        {
            /* Create packet with incrementing sequence number and random payload */
            uint8_t i;
            for (i = 0; i < PAYLOAD_LENGTH; i++)
            {
                pPacket[i] = i + 1;
            }
    
            /* Send packet */
            RF_EventMask terminationReason = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdTxHS,
                                                           RF_PriorityNormal, NULL, 0);
             switch(terminationReason)
            {
                case RF_EventLastCmdDone:
                    // A stand-alone radio operation command or the last radio
                    // operation command in a chain finished.
                    break;
                case RF_EventCmdCancelled:
                    // Command cancelled before it was started; it can be caused
                    // by RF_cancelCmd() or RF_flushCmd().
                    break;
               case RF_EventCmdAborted:
                    // Abrupt command termination caused by RF_cancelCmd() or
                    // RF_flushCmd().
                    break;
                case RF_EventCmdStopped:
                    // Graceful command termination caused by RF_cancelCmd() or
                    // RF_flushCmd().
                    break;
                default:
                    // Uncaught error event
                    while(1);
            }
    
            uint32_t cmdStatus = ((volatile RF_Op*)&RF_cmdTxHS)->status;
            switch(cmdStatus)
            {
                case HS_DONE_OK:
                    // Operation ended normally
                    break;
                case HS_DONE_TXBUF:
                    // Tx queue was empty at start of operation
                    break;
                case HS_DONE_STOPPED:
                    // Operation stopped after stop command
                    break;
                case HS_DONE_ABORT:
                    // Operation aborted by abort command
                    break;
                default:
                    // Uncaught error event
                    break;
            }
    
            //PIN_setOutputValue(ledPinHandle, Board_PIN_LED1, !PIN_getOutputValue(Board_PIN_LED1));
            //PIN_setOutputValue(ledPinHandle, Board_PIN_LED2, !PIN_getOutputValue(Board_PIN_LED2));
    
            /* Power down the radio */
            RF_yield(rfHandle);
    
            /* Sleep for PACKET_INTERVAL us */
            usleep(PACKET_INTERVAL);
        }
        while(1);
    }
    
    /*
     * Copyright (c) 2019, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    
    /***** Includes *****/
    /* Standard C Libraries */
    #include <stdlib.h>
    
    /* TI Drivers */
    #include <ti/drivers/rf/RF.h>
    #include <ti/drivers/PIN.h>
    
    /* Driverlib Header files */
    #include DeviceFamily_constructPath(driverlib/rf_prop_mailbox.h)
    #include DeviceFamily_constructPath(driverlib/rf_hs_mailbox.h)
    
    /* Board Header files */
    #include "Board.h"
    
    /* Application Header files */
    #include "RFQueue.h"
    #include "smartrf_settings/smartrf_settings.h"
    
    /***** Defines *****/
    
    /* Packet RX Configuration */
    #define DATA_ENTRY_HEADER_SIZE 8  /* Constant header size of a Generic Data Entry */
    #define MAX_LENGTH             30 /* Max length byte the radio will accept */
    #define NUM_DATA_ENTRIES       2  /* NOTE: Only two data entries supported at the moment */
    #define NUM_APPENDED_BYTES     2  /* The Data Entries data field will contain:
                                       * 1 Header byte (RF_cmdPropRx.rxConf.bIncludeHdr = 0x1)
                                       * Max 30 payload bytes
                                       * 1 status byte (RF_cmdPropRx.rxConf.bAppendStatus = 0x1) */
    
    
    
    /***** Prototypes *****/
    static void callback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e);
    
    /***** Variable declarations *****/
    static RF_Object rfObject;
    static RF_Handle rfHandle;
    
    /* Pin driver handle */
    static PIN_Handle ledPinHandle;
    static PIN_State ledPinState;
    
    /* Buffer which contains all Data Entries for receiving data.
     * Pragmas are needed to make sure this buffer is 4 byte aligned (requirement from the RF Core) */
    #pragma DATA_ALIGN (rxDataEntryBuffer, 4);
    static uint8_t
    rxDataEntryBuffer[RF_QUEUE_DATA_ENTRY_BUFFER_SIZE(NUM_DATA_ENTRIES,
                                                      MAX_LENGTH,
                                                      NUM_APPENDED_BYTES)];
    
    /* Receive dataQueue for RF Core to fill in data */
    static dataQueue_t dataQueue;
    static rfc_dataEntryGeneral_t* currentDataEntry;
    static uint8_t packetLength;
    static uint8_t* packetDataPointer;
    static rfc_propRxOutput_t rxStatistics;
    
    
    static uint8_t packet[MAX_LENGTH + NUM_APPENDED_BYTES - 1]; /* The length byte is stored in a separate variable */
    
    /*
     * Application LED pin configuration table:
     *   - All LEDs board LEDs are off.
     */
    PIN_Config pinTable[] =
    {
        Board_PIN_LED2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
    	PIN_TERMINATE
    };
    
    /***** Function definitions *****/
    
    void *mainThread(void *arg0)
    {
        RF_Params rfParams;
        RF_Params_init(&rfParams);
    
        /* Open LED pins */
        ledPinHandle = PIN_open(&ledPinState, pinTable);
        if (ledPinHandle == NULL)
        {
            while(1);
        }
    
        if( RFQueue_defineQueue(&dataQueue,
                                rxDataEntryBuffer,
                                sizeof(rxDataEntryBuffer),
                                NUM_DATA_ENTRIES,
                                MAX_LENGTH + NUM_APPENDED_BYTES))
        {
            /* Failed to allocate space for all data entries */
            while(1);
        }
    
        /* Modify CMD_RX_HS command for application needs */
        /* Set the Data Entity queue for received data */
        RF_cmdRxHS.pQueue = &dataQueue;
        /* Discard packets with CRC error from Rx queue */
        RF_cmdRxHS.rxConf.bAutoFlushCrcErr = 1;
        /* Discard packets with CRC error from Rx queue */
        RF_cmdRxHS.rxConf.bAutoFlushCrcErr = 1;
        /* Implement packet length filtering to avoid PROP_ERROR_RXBUF */
        RF_cmdRxHS.maxPktLen = MAX_LENGTH;
        RF_cmdRxHS.pktConf.bRepeatOk = 1;
        RF_cmdRxHS.pktConf.bRepeatNok = 1;
        RF_cmdRxHS.pOutput = (rfc_hsRxOutput_t*)&rxStatistics;
    
        /* Request access to the radio */
        rfHandle = RF_open(&rfObject, &RF_prop_ghs, (RF_RadioSetup*)&RF_cmdPropRadioDivSetup_ghs, &rfParams);
    
        //rfHandle = RF_open(&rfObject, &RF_prop_hsm_4mbps, (RF_RadioSetup*)&RF_cmdRadioSetup_hsm_4mbps, &rfParams);
    
        /* Set the frequency */
        RF_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);
    
        /* Enter RX mode and stay forever in RX */
            RF_EventMask terminationReason = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdRxHS,
                                                       RF_PriorityNormal, &callback,
                                                       RF_EventRxEntryDone);
    
            switch(terminationReason)
            {
                case RF_EventLastCmdDone:
                    // A stand-alone radio operation command or the last radio
                    // operation command in a chain finished.
                    break;
                case RF_EventCmdCancelled:
                    // Command cancelled before it was started; it can be caused
                    // by RF_cancelCmd() or RF_flushCmd().
                    break;
                case RF_EventCmdAborted:
                    // Abrupt command termination caused by RF_cancelCmd() or
                    // RF_flushCmd().
                    break;
                case RF_EventCmdStopped:
                    // Graceful command termination caused by RF_cancelCmd() or
                    // RF_flushCmd().
                    break;
                default:
                    // Uncaught error event
                    while(1);
            }
    
            uint32_t cmdStatus = ((volatile RF_Op*)&RF_cmdRxHS)->status;
    
            switch(cmdStatus)
            {
                case HS_DONE_OK:
                    // Operation ended normally
                    break;
                case HS_DONE_RXTIMEOUT:
                    // Operation stopped after end trigger while waiting for sync
                    break;
                case HS_DONE_RXERR:
                    // Operation ended after CRC error
                    break;
                case HS_DONE_ENDED:
                    // Operation stopped after end trigger during reception
                    break;
                case HS_DONE_STOPPED:
                    // Operation stopped after stop command
                    break;
                case HS_DONE_ABORT:
                    // Operation aborted by abort command
                    break;
                default:
                    while(1);
            }
            while(1);
        }
    
        void callback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e)
        {
            if (e & RF_EventRxEntryDone)
            {
                /* Toggle pin to indicate RX */
                PIN_setOutputValue(ledPinHandle, Board_PIN_LED2,
                                   !PIN_getOutputValue(Board_PIN_LED2));
    
                /* Get current unhandled data entry */
                currentDataEntry = RFQueue_getDataEntry();
    
                /* Handle the packet data, located at &currentDataEntry->data */
                packetLength      = ((*(uint8_t*)(&currentDataEntry->data + 1)) << 8) |
                                     (*(uint8_t*)(&currentDataEntry->data));
                packetDataPointer = (uint8_t*)(&currentDataEntry->data + 2);
    
                /* Copy the payload to the packet variable */
                memcpy(packet, packetDataPointer, packetLength);
    
                RFQueue_nextEntry();
            }
        }
    

    BR

    Siri