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.

CCS/CC1352P: How to turn on/off WOR and packetRx

Part Number: CC1352P


Tool/software: Code Composer Studio

Hi 

Our state machine are showing below:

1. turn on WOR to listen central command

2. If receive "transfer command", turn off WOR and trun on "always RX" to receive data

3. After receive data, turn off "always RX" and turn on WOR

Please tell me how to turn on/off WOR and RX

Thank you

  • I assume that when you refer to WOR, you are referring to the sniff command (or do you mean the CS command?). You do not have to turn off the command. The normal way of configuring the command is to use endTriggers and set end times so that the command exits automatically. If you look at the WOR example in the SDK, the sniff command is configured to end "immediately" if no RSSI is present (normally a couple of hundreds us), after csEndTime if an RSSI is present but no preamble, and after endTime if both RSSI and preamble are present, but no sync word is found. If a sync word is found, the command will end when the packet is received. If you enter normal RX without an endTime, you will need to cancel the command (RF_cancelCmd()) to force it to exit. dev.ti.com/.../node dev.ti.com/.../node Siri
  • Hi Siri,
    I try to stop/restart RX by press button. But it cannot work correctly, sometimes, it enter Error_policyMin(). Do I miss anything?
    void buttonCallbackFxn(PIN_Handle handle, PIN_Id pinId) {
        static uint8_t rfRun = 0;
        if(rfRun == 1) {
            rfRun = 0;
            RF_cancelCmd(rfHandle, rfCmdHandle, 0);
        }
        else {
            rfRun = 1;
            RF_EventMask terminationReason = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropRx,
                                                       RF_PriorityNormal, &callback,
                                                       RF_EventRxEntryDone);
        }
    }
    /***** 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);
        }
        buttonPinHandle = PIN_open(&buttonPinState, buttonPinTable);
        if(!buttonPinHandle) {
            /* Error initializing button pins */
            while(1);
        }
        /* Setup callback for button pins */
        if (PIN_registerIntCb(buttonPinHandle, &buttonCallbackFxn) != 0) {
            /* Error registering button callback function */
            while(1);
        }
        PINCC26XX_setMux(ledPinHandle, CONFIG_PIN_RLED, PINCC26XX_MUX_RFC_GPO0); // LNA
        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_PROP_RX command for application needs */
        /* Set the Data Entity queue for received data */
        RF_cmdPropRx.pQueue = &dataQueue;
        /* Discard ignored packets from Rx queue */
        RF_cmdPropRx.rxConf.bAutoFlushIgnored = 1;
        /* Discard packets with CRC error from Rx queue */
        RF_cmdPropRx.rxConf.bAutoFlushCrcErr = 1;
        /* Implement packet length filtering to avoid PROP_ERROR_RXBUF */
        RF_cmdPropRx.maxPktLen = MAX_LENGTH;
        RF_cmdPropRx.pktConf.bRepeatOk = 1;
        RF_cmdPropRx.pktConf.bRepeatNok = 1;
        /* Request access to the radio */
    #if defined(DeviceFamily_CC26X0R2)
        rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioSetup, &rfParams);
    #else
        rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioDivSetup, &rfParams);
    #endif// DeviceFamily_CC26X0R2
        /* Set the frequency */
        rfCmdHandle = RF_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);
        while(1);
    }
  • Hi Kimi

    It is the RX command you want to cancel, not the FS command.

    You need to do the following changes to your code:

    void buttonCallbackFxn(PIN_Handle handle, PIN_Id pinId)
    {
        static uint8_t rfRun = 0;
    
        if(rfRun == 1)
        {
            rfRun = 0;
            RF_cancelCmd(rfHandle, rfCmdHandle, 0);
        }
        else
        {
            rfRun = 1;
            rfCmdHandle = RF_postCmd(rfHandle, (RF_Op*)&RF_cmdPropRx, RF_PriorityNormal, &callback, RF_EventRxEntryDone);
        }
    }
    
    void *mainThread(void *arg0)
    {
        RF_Params rfParams;
        RF_Params_init(&rfParams);
    
        /* Open LED pins */
        ledPinHandle = PIN_open(&ledPinState, pinTable);
        if (ledPinHandle == NULL)
        {
            while(1);
        }
    
        buttonPinHandle = PIN_open(&buttonPinState, buttonPinTable);
        
        if(!buttonPinHandle)
        {
            /* Error initializing button pins */
            while(1);
        }
    
        /* Setup callback for button pins */
        if (PIN_registerIntCb(buttonPinHandle, &buttonCallbackFxn) != 0)
        {
            /* Error registering button callback function */
            while(1);
        }
    
        PINCC26XX_setMux(ledPinHandle, CONFIG_PIN_RLED, PINCC26XX_MUX_RFC_GPO0); // LNA
    
        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_PROP_RX command for application needs */
        /* Set the Data Entity queue for received data */
        RF_cmdPropRx.pQueue = &dataQueue;
        /* Discard ignored packets from Rx queue */
        RF_cmdPropRx.rxConf.bAutoFlushIgnored = 1;
        /* Discard packets with CRC error from Rx queue */
        RF_cmdPropRx.rxConf.bAutoFlushCrcErr = 1;
        /* Implement packet length filtering to avoid PROP_ERROR_RXBUF */
        RF_cmdPropRx.maxPktLen = MAX_LENGTH;
        RF_cmdPropRx.pktConf.bRepeatOk = 1;
        RF_cmdPropRx.pktConf.bRepeatNok = 1;
    
        /* Request access to the radio */
        rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioDivSetup, &rfParams);
    
        /* Set the frequency */
        RF_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);
    
        while(1);
    }

    Siri

  • Hi Siri,

    Thank you. It works.

  • Glad to hear :-)

    Siri