CC2651R3: Polling issue via UART communication

Part Number: CC2651R3

Tool/software:

Hi sir,

When I poll the configuration of a CC2651R3 device over Modbus at a 1-second polling interval, it works fine. However, when I attempt to poll a different CC2651R3 device over RF communication using the same Modbus poll configuration with a 1-second interval, it doesn't work. Interestingly, if I increase the polling interval to 2 seconds, the communication works correctly. What could be causing this issue?

Regards,

Reshmi.

  • Hello Reshmi,

    I hope you are doing well. Which SDK are the devices using, is this a custom board or the launchpad, and what communication (PHY) are you using?

    Thanks,
    Alex F

  • Hi Alex,

    I am working with a custom CC2651R3 board and using the SimpleLink CC13xx/CC26xx SDK version 7.10.01.24. Please find the attached PHY properties I have used.

    Thanks,

    Reshmi.

  • Hello Reshmi,

    Thank you for the extra information. I am not too sure of the current support of Modbus we have; however if we just want to look at the RCL or Radio sending/receiving packets then we should be able to consistently receive packets here (with the 1 second "polling"). Can you show a small snippet of your Radio code (should be similar or based off of the rfpacketTx and rfpacketRx examples we provide in the SDK).

    Thanks,
    Alex F

  • Hi Alex,

    I took the sample code from rfUARTBridge  as example,  please find the Radio code below

    void *mainThread(void *arg0){

       packetRxCb = NO_PACKET;

        RF_Params rfParams;
        RF_Params_init(&rfParams);

        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);
        }

        /*Modifies settings to be able to do RX*/
        /* 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;

        RF_cmdPropTx.pPkt = packet;
        RF_cmdPropTx.startTrigger.triggerType = TRIG_NOW;

        /* 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);

        rfPostHandle = RF_postCmd(rfHandle, (RF_Op*)&RF_cmdPropRx,RF_PriorityNormal, &ReceivedOnRFcallback, RF_EventRxEntryDone);

      while(1){

     //My application code

     }

    }

    void ReceivedOnRFcallback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e)
    {
        if (e & RF_EventRxEntryDone)
        {
            /* Get current unhandled data entry */
            currentDataEntry = RFQueue_getDataEntry(); //loads data from entry

            /* Handle the  data, located at &currentDataEntry->data:
             * - Length is the first byte with the current configuration
             * - Data starts from the second byte */
            Length      = *(uint8_t*)(&currentDataEntry->data); //gets the  length (send over with )
            DataPointer = (uint8_t*)(&currentDataEntry->data + 1); //data starts from 2nd byte

            /* Copy the payload + the status byte to the  variable */
            memcpy(testbuff, DataPointer, (Length + 1));
            totalBytes = Length;

            /* Move read entry pointer to next entry */
            RFQueue_nextEntry();
             RxCb = PACKET_RECEIVED;
        }
    }

    Thanks,

    Reshmi.

  • Hello Reshmi,

    From a first look your code looks good, though I will doubble check with the example code next! 

    Thanks,
    Alex F

  • Hello Reshmi,

    Your code also includes something along the lines of the following after the rfPostHandle line correct?:

        while(1)
        {
            /* Check if anything has been received via RF*/
            if(packetRxCb)
            {
                memcpy(input, packet, (packetLength));
                size_t bytesWritten = 0;
                while (bytesWritten == 0)
                {
                    status = UART2_write(uart, &input, packetLength, &bytesWritten);
                    if (status != UART2_STATUS_SUCCESS)
                    {
                        /* UART2_write() failed */
                        while (1);
                    }
                }
    
                /* Reset RF RX callback flag */
                packetRxCb = NO_PACKET;
            }
    
            /* Check if anything has been received via UART*/
            if (bytesReadCount != 0)
            {
                /*The packet length is set to the number of
                 * bytes read by UART2_read() */
                RF_cmdPropTx.pktLen = bytesReadCount;
                int i;
                for (i=0; i<bytesReadCount; i++)
                {
                    uint8_t* buffer8 = (uint8_t*) input;
                    packet[i] = buffer8[i];
                }
    
                /*Cancel the ongoing command*/
                RF_cancelCmd(rfHandle, rfPostHandle, 1);
    
                /*Send packet*/
                RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropTx, RF_PriorityNormal, NULL, 0);
    
                /* Toggle green led to indicate TX */
                GPIO_toggle(CONFIG_GPIO_GLED);
    
                /* Resume RF RX */
                rfPostHandle = RF_postCmd(rfHandle, (RF_Op*)&RF_cmdPropRx,
                                                                     RF_PriorityNormal, &ReceivedOnRFcallback,
                                                                     RF_EventRxEntryDone);
                bytesReadCount = 0;
    
                /* Resume UART read */
                status = UART2_read(uart, &input, bytesToRead, NULL);
            }
        }
    }

    Thanks,
    Alex F