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.

CC2640R2F: How to increase Preamble on proprietary mode

Part Number: CC2640R2F
Other Parts Discussed in Thread: CC2544,

Hi team,

Customer use CC2640R2 proprietary mode with CC2544. They want to increase size of Preamble. Please help instruct.

Besides, please provide the document about the setting of overrides. Thank you.

// Overrides
static uint32_t HID_pOverrides[] =
{
//Overrides (tentative):
0x01010007, // MCE_RFE_OVERRIDE(0, 0, 1, 0, 0, 1), // Use correct RFE mode
0x013800C3, // Set 500 kHz deviation in TX
0x02080283, // SW_REG_OVERRIDE(radioPar, rxToTxRatOffset, 0x0208), // Set IFS (130 us)
//0x03000283, // SW_REG_OVERRIDE(radioPar, rxToTxRatOffset, 0x0208), // Set IFS (130 us)
0x002482d3, // SW_REG_BYTE_OVERRIDE(radioPar, txFifoThrSleep, 0x24), // Avoid FIFO underflow in TX
//0x02ad0b03, // SW_REG_OVERRIDE(propRadioPar, rxIfsTimeout, 0x02AD), // Set timeout for ACK
0x02000b03, // SW_REG_OVERRIDE(propRadioPar, rxIfsTimeout, 0x02AD), // Set timeout for ACK
0xffffffff, // END_OVERRIDE, // End of string
}; 

4401.smartrf_settings.c

//*********************************************************************************
// These settings have been generated for use with TI-RTOS and cc13xxware
//
// Generated by SmartRF Studio version 2.4.3 (build #23) and modified
// Tested for BLE SDK version 1.00.00
// Device: CC2640R2F
//
//*********************************************************************************


//*********************************************************************************
// Default parameter summary
// HID mode
// GFSK 2 Mbps
// Address: ef
// Frequency: 2440.00000 MHz
// Data Format: Serial mode disable
// Deviation: 500.000 kHz
// Packet Length Config: Variable
// Max Packet Length: 128
// Packet Length: 16
// RX Filter BW: 98 kHz
// Symbol Rate: 50.00000 kBaud
// Sync Word Length: 32 Bits
// TX Power: 0 dBm
// Whitening: No whitening

#ifdef DEVICE_FAMILY
    #undef DEVICE_FAMILY_PATH
    #define DEVICE_FAMILY_PATH(x) <ti/devices/DEVICE_FAMILY/x>
#else
    #error "You must define DEVICE_FAMILY at the project level as one of cc26x0, cc26x0r2, cc13x0, etc."
#endif

// Definitions to add new parameter for HID mode:
#define _POSITION_propRadioPar_rxIfsTimeout                     176
#define _TYPE_propRadioPar_rxIfsTimeout                         uint16_t


#include DEVICE_FAMILY_PATH(driverlib/rf_mailbox.h)
#include DEVICE_FAMILY_PATH(driverlib/rf_common_cmd.h)

#include DEVICE_FAMILY_PATH(rf_patches/rf_patch_cpe_prop.h)
#include DEVICE_FAMILY_PATH(rf_patches/rf_patch_rfe_genfsk.h)
#include DEVICE_FAMILY_PATH(rf_patches/rf_patch_mce_genfsk.h)

#include "rf_patch_cpe_hid.h"
#include "rf_hid_cmd.h"
#include "rf_hid_mailbox.h"

#include <ti/drivers/rf/RF.h>
#include "smartrf_settings.h"


// TI-RTOS RF Mode Object
RF_Mode RF_prop =
{
    .rfMode = RF_MODE_PROPRIETARY_2_4,
    .cpePatchFxn = &rf_patch_cpe_prop,
    .mcePatchFxn = &rf_patch_mce_genfsk,
    .rfePatchFxn = &rf_patch_rfe_genfsk,
};

// Overrides for CMD_PROP_RADIO_SETUP
uint32_t pOverrides[] =
{
    // override_use_patch_prop_genfsk.xml
    // PHY: Use MCE RAM patch, RFE RAM patch
    MCE_RFE_OVERRIDE(1,0,0,1,0,0),
    // override_synth_prop_2440_div2.xml
    // Synth: Set Fref to 4 MHz
    (uint32_t)0x000684A3,
    // Synth: Use 24 MHz XOSC as synth clock, enable extra PLL filtering
    (uint32_t)0x02010403,
    // Synth: Configure faster calibration
    HW32_ARRAY_OVERRIDE(0x4004, 1),
    // Synth: Configure faster calibration
    (uint32_t)0x1C0C0618,
    // Synth: Configure faster calibration
    (uint32_t)0xC00401A1,
    // Synth: Configure faster calibration
    (uint32_t)0x21010101,
    // Synth: Configure faster calibration
    (uint32_t)0xC0040141,
    // Synth: Configure faster calibration
    (uint32_t)0x00214AD3,
    // Synth: Decrease synth programming time-out by 64 us (0x0300 RAT ticks = 192 us)
    (uint32_t)0x03000243,
    // Rx: Set LNA IB offset used for automatic software compensation to 0
    (uint32_t)0x00008883,
    // Rx: Set LNA IB trim value based on the selected defaultPhy.mainMode setting.
    ADI_HALFREG_OVERRIDE(0,4,0xF,0xF),
    // Rx: Set RSSI offset to adjust reported RSSI by -1 dB (default: 0)
    (uint32_t)0x000188A3,
    // override_phy_tx_pa_ramp_gfsk_pa_ramp_12us_agc_reflevel_0x22.xml
    // Tx: Configure PA ramping setting (0x3F). Rx: Set AGC reference level to 0x22.
    HW_REG_OVERRIDE(0x6088,0x3F22),
    // Tx: Configure PA ramping setting
    HW_REG_OVERRIDE(0x608C,0x0413),
    (uint32_t)0xFFFFFFFF,
};

// CMD_PROP_RADIO_SETUP
// Proprietary Mode Radio Setup Command
rfc_CMD_PROP_RADIO_SETUP_t RF_cmdPropRadioDivSetup =
{
    .commandNo                    = 0x3806,
    .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         = 0x7D0, // default: 0x1F4 -> 125.000 kHz, 0x7D0 -> 500.000 kHz
    .symbolRate.preScale          = 0xF,
    .symbolRate.rateWord          = 0x10000,
    .symbolRate.decimMode         = 0x0,
    .rxBw                         = 0x09,
    .preamConf.nPreamBytes        = 0x4,
    .preamConf.preamMode          = 0x0,
    .formatConf.nSwBits           = 0x20,
    .formatConf.bBitReversal      = 0x0,
    .formatConf.bMsbFirst         = 0x1,
    .formatConf.fecMode           = 0x0,
    .formatConf.whitenMode        = 0x0,
    .config.frontEndMode          = 0x0,
    .config.biasMode              = 0x0,
    .config.analogCfgMode         = 0x0,
    .config.bNoFsPowerUp          = 0x0,
    .txPower                      = OEM_RF_TX_POWER,
    .pRegOverride                 = pOverrides,
};

// CMD_FS
// Frequency Synthesizer Programming Command
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,
};

// CMD_PROP_TX
// Proprietary Mode Transmit Command
rfc_CMD_PROP_TX_t RF_cmdPropTx =
{
    .commandNo                    = 0x3801,
    .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,
    .pktConf.bFsOff               = 0x0,
    .pktConf.bUseCrc              = 0x1,
    .pktConf.bVarLen              = 0x1,
    .pktLen                       = 0x14,             // SET APPLICATION PAYLOAD LENGTH
    .syncWord                     = 0x930B51DE,
    .pPkt                         = 0,                // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
};

// CMD_PROP_RX
// Proprietary Mode Receive Command
rfc_CMD_PROP_RX_t RF_cmdPropRx =
{
    .commandNo                    = 0x3802,
    .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,
    .pktConf.bFsOff               = 0x0,
    .pktConf.bRepeatOk            = 0x0,
    .pktConf.bRepeatNok           = 0x0,
    .pktConf.bUseCrc              = 0x1,
    .pktConf.bVarLen              = 0x1,
    .pktConf.bChkAddress          = 0x0,
    .pktConf.endType              = 0x0,
    .pktConf.filterOp             = 0x0,
    .rxConf.bAutoFlushIgnored     = 0x0,
    .rxConf.bAutoFlushCrcErr      = 0x0,
    .rxConf.bIncludeHdr           = 0x1,
    .rxConf.bIncludeCrc           = 0x0,
    .rxConf.bAppendRssi           = 0x0,
    .rxConf.bAppendTimestamp      = 0x0,
    .rxConf.bAppendStatus         = 0x1,
    .syncWord                     = 0x930B51DE,
    .maxPktLen                    = 0xFF,             // MAKE SURE DATA ENTRY IS LARGE ENOUGH
    .address0                     = 0xAA,
    .address1                     = 0xBB,
    .endTrigger.triggerType       = 0x1,
    .endTrigger.bEnaCmd           = 0x0,
    .endTrigger.triggerNo         = 0x0,
    .endTrigger.pastTrig          = 0x0,
    .endTime                      = 0x00000000,
    .pQueue                       = 0,                // INSERT APPLICABLE POINTER: (dataQueue_t*)&xxx
    .pOutput                      = 0,                // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
};

// CMD_TX_TEST
// Proprietary Mode Transmit Test Command
rfc_CMD_TX_TEST_t RF_cmdTxTest =
{
    .commandNo                    = 0x0808,
    .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,
    .config.bUseCw                = 0x0,
    .config.bFsOff                = 0x1,
    .config.whitenMode            = 0x2,
    .__dummy0                     = 0x00,
    .txWord                       = 0xABCD,
    .__dummy1                     = 0x00,
    .endTrigger.triggerType       = 0x1,
    .endTrigger.bEnaCmd           = 0x0,
    .endTrigger.triggerNo         = 0x0,
    .endTrigger.pastTrig          = 0x0,
    .syncWord                     = 0x930B51DE,
    .endTime                      = 0x00000000,
};

// CMD_RX_TEST
// Proprietary Mode Transmit Test Command
rfc_CMD_RX_TEST_t RF_cmdRxTest =
{
    .commandNo                    = 0x0807,
    .status                       = 0x0000,
    .pNextOp                      = 0,                // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
    .startTime                    = 0x00000000,
    .startTrigger.triggerType     = 0x0,
    .startTrigger.bEnaCmd         = 0x0,
    .startTrigger.triggerNo       = 0x0,
    .startTrigger.pastTrig        = 0x1,
    .condition.rule               = 0x1,
    .condition.nSkip              = 0x0,
    .config.bEnaFifo              = 0x0,
    .config.bFsOff                = 0x1,
    .config.bNoSync               = 0x1,
    .endTrigger.triggerType       = 0x1,
    .endTrigger.bEnaCmd           = 0x0,
    .endTrigger.triggerNo         = 0x0,
    .endTrigger.pastTrig          = 0x0,
    .syncWord                     = 0x930B51DE,
    .endTime                      = 0x00000000,
};

// TI-RTOS RF HID Mode Object
RF_Mode RF_HID =
{
    .rfMode                       = RF_MODE_PROPRIETARY_2_4,
    .cpePatchFxn                  = &rf_patch_cpe_hid,
    .mcePatchFxn                  = 0,
    .rfePatchFxn                  = 0,
};

// Overrides
static uint32_t HID_pOverrides[] =
{
    //Overrides (tentative):
    0x01010007,               // MCE_RFE_OVERRIDE(0, 0, 1, 0, 0, 1),                   // Use correct RFE mode
    0x013800C3,               // Set 500 kHz deviation in TX
    0x02080283,               // SW_REG_OVERRIDE(radioPar, rxToTxRatOffset, 0x0208),   // Set IFS (130 us)
    //0x03000283,             // SW_REG_OVERRIDE(radioPar, rxToTxRatOffset, 0x0208),   // Set IFS (130 us)
    0x002482d3,               // SW_REG_BYTE_OVERRIDE(radioPar, txFifoThrSleep, 0x24), // Avoid FIFO underflow in TX
    //0x02ad0b03,             // SW_REG_OVERRIDE(propRadioPar, rxIfsTimeout, 0x02AD),  // Set timeout for ACK
    0x02000b03,               // SW_REG_OVERRIDE(propRadioPar, rxIfsTimeout, 0x02AD),  // Set timeout for ACK
    0xffffffff,               // END_OVERRIDE,                                         // End of string
};

// Radio Setup Command
rfc_CMD_RADIO_SETUP_t cmdHIDRadioSetup =
{
    .commandNo                    = 0x0802,
    .status                       = 0x0000,
    .pNextOp                      = 0,
    .startTime                    = 0x00000000,
    .startTrigger.triggerType     = 0x0,
    .startTrigger.bEnaCmd         = 0x0,
    .startTrigger.triggerNo       = 0x0,
    .startTrigger.pastTrig        = 0x0,
    .condition.rule               = 0x1,
    .condition.nSkip              = 0x0,

    .mode                         = 0x02,             // 0x02: 2 Mbps GFSK
    .config.frontEndMode          = 0x0,
    .config.biasMode              = 0x0,              // 0: Internal bias
    .config.analogCfgMode         = 0x0,
    .config.bNoFsPowerUp          = 0x0,
    .txPower                      = OEM_RF_TX_POWER,
    .pRegOverride                 = HID_pOverrides,
};

// CMD_HID_TX
rfc_CMD_HID_TX_t RF_cmdHIDTx =
{
    .commandNo                    = 0x5801,
    .status                       = 0x0000,
    .pNextOp                      = 0,                // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
    .startTime                    = 0x00000000,
    .startTrigger.triggerType     = TRIG_NOW,
    .startTrigger.bEnaCmd         = 0x0,
    .startTrigger.triggerNo       = 0x0,
    .startTrigger.pastTrig        = 0x1,
    .condition.rule               = COND_NEVER,       // don't run any next command
    .condition.nSkip              = 0x0,

    .pktConf.bFsOff               = 0x0,              // Turn off synth after command.
    .pktConf.bAutoRetransmit      = 1,                // 0: Do not listen for ACK // 1: Listen for ACK and retransmit if missing
    .pktConf.bVarLen              = 0x1,              // 1: Variable length mode
    .pktConf.hdrMode              = 0x0,
    .pktConf.bIncludeAddr         = 0x1,
    .pktConf.hdrConf              = 0x0,
    .pktConf.bFixedTxLen          = 0x0,
    .syncWord                     = TEST_SYNCWORD,    // 0x29417471, //0x29417671
    .address                      = TEST_ADDRESS,     // 0xEF,       // set address
    .seqNo                        = 0x0,
    .maxAckLen                    = 0x20,             // 0x20,
    .pktLen                       = 0x07,             // SET APPLICATION PAYLOAD LENGTH, set in application
    .maxRetrans                   = 0x0,              // 0x1, // 0x02
    .retransDelay                 = 0x5A0,            // 0x5A0 for 360us // 0x800 for 512us //0x4b0 for 300us
    .pPkt                         = 0,                // INSERT APPLICABLE POINTER: (uint8_t*)&xxx
    .pRxQueue                     = 0,                // Pointer to receive queue for ACKs
    .pOutput                      = 0,                // Pointer to output structure
};

// Output struct
rfc_hidRxTxOutput_t output_tx_Command =
{
    .nTx                          = 0x0,
    .nRxOk                        = 0x0,
    .nRxNok                       = 0x0,
    .nRxIgnored                   = 0x0,
    .nRxBufFull                   = 0x0,
    .lastRssi                     = 0x0,
};



  • Hello Jerry,

    On the CC2544:

    preamble can be from 1 to 16 bytes. The type of preamble and the number of bytes can be set up in the MDMCTRL2 register.

    On the CC2642:

    The preamble configuration is done in the setup command and is used for both TX and RX operations. The length can be set between 1 and 30 bytes using the nPreamBytes field. Additionally, 1 bit can be programmed by nPreamBytes = 0 and 4 bits can be programmed by nPreamBytes = 31. The preamMode field controls the preamble pattern. Either 0101.. or 1010..

    rfc_CMD_PROP_RADIO_DIV_SETUP_t RF_cmdPropRadioDivSetup =
    {
        // ...
        .preamConf.nPreamBytes = 4, // 4 bytes
        .preamConf.preamMode = 0,   // 0101...
        // ...
    };

    Override documentation can be found here:

    https://dev.ti.com/tirex/explore/content/simplelink_cc13x2_26x2_sdk_5_10_00_48/docs/proprietary-rf/proprietary-rf-users-guide/proprietary-rf/packet-format.html#overrides

    Regards,

    AB

  • Hi AB,

    We are asking about CC2640R2F, not CC2642. Besides, we need this for HID mode.

  • Jerry,

    Understood, on both the 42 and 40R2 would be the same.

    Let me check internally how/if this is possible with the HID PHY

  • hello jerry,

    the preamble is controlled using overrides, The following overrides will change those values:

    (note that you need to define preamCtrl).

    (uint32_t) (preamCtrl << 16 |  0x8033),
    

    preamCtrl[3:0] represents n bits from 1 bit (0x00) to 16 bits (0x0F)

    preamCtrl[7:4] represents number of preamble repetitions of preamble pattern

  • Hi AB,

    Customer have 3 items which need your instructions.

    1. How to declare "preamCtrl " ? Is it a variable of "uint32_t" ?

    2. How to configure preamCtrl[7:4] ?Like what you define for preamCtrl[3:0]  is 0x00 (1bit) ~ 0x0F (16 bits)

    3. After modification, how to verify the modification is valid ? Can we see the change by spectrum ?

  • 1. How to declare "preamCtrl " ? Is it a variable of "uint32_t" ?

    uint32_t preamCtrl;

    2. How to configure preamCtrl[7:4] ?Like what you define for preamCtrl[3:0]  is 0x00 (1bit) ~ 0x0F (16 bits)

    Let's say you want a 32bit preamble, you would then define preamCtrl as:

    //32 bit preamble
    //we want a 16 bit pattern: preamCtrl[3:0] = 0x0F
    //we want 2 repetitions of the 16 bit pattern: preamCtrl[7:4] = 0x01
    preamCtrl = 0x001F;

    3. After modification, how to verify the modification is valid ? Can we see the change by spectrum ?

    Yes, you can look at the spectrum to validate that the change was successful.