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: CMD_PROP_TX_ADV Example

Part Number: CC1310

I'm struggling to find enough detail to use a TX Buffer in CMD_PROP_TX_ADV.

Is there an example that shows transmitting more than 300 or 400 bytes?

I'm using CMD_PROP_TX_ADV with no problems, just can't seem to figure out how to structure the TX Buffer.

  • Hello Chris,
    The rfWakeOnRadioTx example uses advance Tx command. You can set the RF_cmdPropTxAdv.pktLen parameter to the length of your Tx packet and you allocate a Tx buffer of that size.
    Regards,
    Prashanth
  • Yes, using TX_ADV is not a problem.  My question is specifically around sending a TX queue instead of a fixed packet buffer.  I.E. how do you structure the data to send in unlimited mode?

  • Hi Chris

    Below is some code snippets showing how to use the advanced TX function to send a packet over and over again (back-to-back).

    #define PACKET_INTERVAL         (uint32_t)(4000000*1.5f) /* Set packet interval to 1.5 s */
    
    #define TX_BUFFERS_TO_SEND      100
    
    /* The buffer below contains a packet that is sent back-to-back TX_BUFFERS_TO_SEND every PACKET_INTERVAL. */
    static uint8_t txSyncPacket[] = {
                                    /**********************************************/
                                    0x55, 0x55, 0x55, 0x55,         // Preamble
                                    0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,  
                                    0x91, 0xD3, 0x91, 0xD3,         // Sync Word
                                    0x01,                           // Length byte    
                                    0xAA,                           // 1 dummy byte payload
                                    /**********************************************/
                                };
    
    static rfc_dataEntryPointer_t txEntry;
    static dataQueue_t txQueue;
    
    static uint8_t packetCounter = 0;
    
    /***** Prototypes *****/
    static void txTaskFunction(UArg arg0, UArg arg1);
    
    /***** Variable declarations *****/
    static Task_Params txTaskParams;
    Task_Struct txTask;    /* not static so you can see in ROV */
    static uint8_t txTaskStack[TX_TASK_STACK_SIZE];
    
    static RF_Object rfObject;
    static RF_Handle rfHandle;
    
    uint32_t time;
    volatile uint8_t packetSent = false;
    
    
    static PIN_Handle pinHandle;
    
    /***** Prototypes *****/
    static void callback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e);
    
    
    /***** Function definitions *****/
    void TxTask_init(PIN_Handle inPinHandle)
    {
        pinHandle = inPinHandle;
    
        Task_Params_init(&txTaskParams);
        txTaskParams.stackSize = TX_TASK_STACK_SIZE;
        txTaskParams.priority = TX_TASK_PRIORITY;
        txTaskParams.stack = &txTaskStack;
        txTaskParams.arg0 = (UInt)1000000;
    
        Task_construct(&txTask, txTaskFunction, &txTaskParams, NULL);
    }
    
    static void txTaskFunction(UArg arg0, UArg arg1)
    {
        uint32_t time;
        RF_Params rfParams;
        RF_Params_init(&rfParams);
        
        /* Configure TX Entry */
        txEntry.pNextEntry = (uint8_t*)&txEntry;
        txEntry.status = DATA_ENTRY_PENDING;
        txEntry.config.type = DATA_ENTRY_TYPE_PTR;
        txEntry.pData = (uint8_t*)txSyncPacket;
        txEntry.length = sizeof(txSyncPacket);
        
        /* Configure CMD_PROP_TX_ADV */
        RF_cmdPropTxAdv.pPkt = (uint8_t*)&txQueue;
        RF_cmdPropTxAdv.pktLen = 0;
        RF_cmdPropTxAdv.startTrigger.triggerType = TRIG_ABSTIME;
        RF_cmdPropTxAdv.startTrigger.pastTrig = 1;
        RF_cmdPropTxAdv.startTime = 0;
        
        txQueue.pCurrEntry = (uint8_t*)&txEntry;
        txQueue.pLastEntry = NULL;
    
        /* Request access to the radio */
        rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdRadioSetup, &rfParams);
    
        /* Set the frequency */
        RF_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);
    
        /* Get current time */
        time = RF_getCurrentTime();
        while(true)
        {
            /* Set absolute TX time to utilize automatic power management */
            time += PACKET_INTERVAL;
            RF_cmdPropTxAdv.startTime = time;
            packetCounter = 0;
            txQueue.pCurrEntry = (uint8_t*)&txEntry;
    
            /* Send packet */
            RF_EventMask result = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropTxAdv, RF_PriorityNormal, &callback, RF_EventTxEntryDone);
            while(!packetSent);
            packetSent = false;
                   
            PIN_setOutputValue(pinHandle, Board_LED1,!PIN_getOutputValue(Board_LED1));
        }
    }
    
    void callback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e)
    {
        if (e & RF_EventTxEntryDone)
        {
            packetCounter++;         
            
            if (packetCounter == (TX_BUFFERS_TO_SEND - 1))
            {
                txQueue.pLastEntry = txQueue.pCurrEntry;
            }
        } 
        else if (e & RF_EventLastCmdDone)
        {
            packetSent = true;
        } 
    }

    Hopefully this can be used as a starting point for what you are trying to achieve.

    BR

    Siri

  • That did it perfectly. Thanks Siri!
  • Glad I could help :-)