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.

RTOS: Implementation of LED to RFPacket example

Other Parts Discussed in Thread: CC1310

Tool/software: TI-RTOS

Hi, 

I'm trying some examples of the CC1310 with the TI cards that I bought recently. I have tried the RFPacketTX / RX examples that are implemented in the SDK folder. I have various questions about this:

1) Is it possible to turn on the red led of the transmitter, when there is no receiver?
2) How can I change the RF configuration? I would like to apply the long range. Is this possible through the configuration I find in the smartrf-setting folder?

Regards

  • You can modify the code and turn on and off the LEDs whenever you want to.
    To change RF settings, please go through the following:

    dev.ti.com/.../node

    Siri
  • - Have a look at the rfEchoTx(RFPacketTx with acknowledgement) in which red led blinks if there's no receiver.
    - To change RF setting(for Long Range) - Open the smartRF studio -Change the setting as your requirement in SmartRf studio and generate .c and .h file add those files to smartrf-setting folder of css.
  • I tried to insert the piece of code for the LED inside my transmitter but it doesn't work. For the LongRange I knew I had to change the RF configuration setting. But you can call the function within my project and change the LongRange mode using a jumper. That is, if I put the jumper it works with the long range otherwise not
  • Not sure what you mean by inserting code inside my transmitter. You need to show what modifications you have done to the example if we shall be able to tell you why it does not work. You can off course have two sets of register settings in your application, and then implement some code that read an input to determine which settings you want to use.

    Siri
  • I implement this in callbackFx();

    memcpy(rxPacket, packetDataPointer, (packetLength + 1));

    /* Check the packet against what was transmitted */
    int16_t status = memcmp(txPacket, rxPacket, packetLength);

    if(status == 0)
    {
    /* Toggle LED1, clear LED2 to indicate RX */
    PIN_setOutputValue(ledPinHandle, Board_PIN_LED1,
    !PIN_getOutputValue(Board_PIN_LED1));
    PIN_setOutputValue(ledPinHandle, Board_PIN_LED2, 0);
    }
    else
    {
    /* Error Condition: set both LEDs */
    PIN_setOutputValue(ledPinHandle, Board_PIN_LED1, 1);
    PIN_setOutputValue(ledPinHandle, Board_PIN_LED2, 1);
    }

    RFQueue_nextEntry();
    }
    else if((e & RF_EventLastCmdDone) && !(e & RF_EventRxEntryDone))
    {
    if(bRxSuccess == true)
    {
    /* Received packet successfully but RX command didn't complete at
    * the same time RX_ENTRY_DONE event was raised. Reset the flag
    */
    bRxSuccess = false;
    }
    else
    {
    /* RX timed out */
    /* Set LED2, clear LED1 to indicate TX */
    PIN_setOutputValue(ledPinHandle, Board_PIN_LED1, 0);
    PIN_setOutputValue(ledPinHandle, Board_PIN_LED2, 1);
    }
    }
    else
    {
    /* Error Condition: set both LEDs */
    PIN_setOutputValue(ledPinHandle, Board_PIN_LED1, 1);
    PIN_setOutputValue(ledPinHandle, Board_PIN_LED2, 1);
    }

    But when I test the my project, not works
  • - No it won't work because it's just a Tx and doesn't know whether receiver received or not. For your application you have to use ack based.
    You have to use rfEchoTx and rfEchoRx.
    - i didn't understand your 2nd case. you have the LaunchPad or custom board.
  • Hi what parts of RFechoTX / RX should I implement in the code?
    I use LaunchPad and I want to change the configuration setting through the jumper.
  • - Just import rfEchoTx, flash on to Tx Board and import rfEchoRx flash on to other Board.
    - I'm not sure about your 2nd case, Siri might suggest you about this.
  • Thanks for your support , The communication part rx-tx is already present on my project. I just have to implement the LED part.
  • @user6050344

    Yea that's what I'm saying..If you flash the rfEchoTx the code itself does the job for you. i.e when there's no receiver it'll  blink red LED.

  • This is a part of my code for to control the turn on/off led: 

    void call_RF_RX(RF_Handle h, RF_CmdHandle ch, RF_EventMask e)
    {
    
        if((e & RF_EventCmdDone) && !(e & RF_EventLastCmdDone))
            {
                /* Successful TX */
                /* Toggle LED1, clear LED2 to indicate TX */
            PIN_setOutputValue(pinHandle, LED1, !PIN_getOutputValue(LED1));
            PIN_setOutputValue(pinHandle, LED2, 0);
            }
             else if (e & RF_EventRxEntryDone)
            {
    	    bRxSuccess = true;
    
            /* Get current unhandled data entry */
            currentDataEntry = RFQueue_getDataEntry();
            /* Handle the packet data, located at &currentDataEntry->data:
             * - Length is the first byte with the current configuration
             * - Data starts from the second byte */
            packetLength      = *(uint8_t*)(&currentDataEntry->data);
            packetDataPointer = (uint8_t*)(&currentDataEntry->data + 1);
    
            rssiDataPointer = (uint8_t*)(&currentDataEntry->data + packetLength + 1);
            rssi = (int8_t) *rssiDataPointer;
    
            rssi = rxStatistics.lastRssi;
    
    /* Copy the payload + the status byte to the packet variable */
            memcpy(rxpacket, packetDataPointer, (packetLength));
    
            RFQueue_nextEntry();
        }
        else if((e & RF_EventLastCmdDone) && !(e & RF_EventRxEntryDone))
        {
            if(bRxSuccess == true)
            {
                /* Received packet successfully but RX command didn't complete at
                 * the same time RX_ENTRY_DONE event was raised. Reset the flag
                 */
                bRxSuccess = false;
            }
            else
            {
                /* RX timed out */
                /* Set LED2, clear LED1 to indicate TX */
                PIN_setOutputValue(pinHandle, LED1, 1);
                PIN_setOutputValue(pinHandle, LED2, 1);
            }
        }
        else
        {
            /* Error Condition: set both LEDs */
            PIN_setOutputValue(pinHandle, LED1, 1);
            PIN_setOutputValue(pinHandle, LED2, 1);
        }
    }

    It the same of rfechoTx but not works. Why?

  • You have copied above code from rfEcoTx to rfTx ?
    You said it's not working. Are you getting an error?
    as am not thorough with code i may not be able to help with that.
    Someone from the TI will guide you.
  • Hi @Siri I modify the part of "request access to radio" for to implement the lrm and I change the smartrf-setting.c and .h
  • I did not understand the last post. Have you questions about the LRM settings or are you just stating that you re using them?
    As far as I can see from all your post is your problem related to the LED. Since you have posted a new request about this (e2e.ti.com/.../807106), I will close this one.

    Siri
  • Hi Siri, As I said in previous posts, I would like to use the LRM. But with a condition. By default my code works without LRM, by using a jumper on my device, I use the LRM. So I created another smart-setting and recall that code when I lower the pin. Can it work?
  • AS I said in one of my previous posts (Thu, May 30 2019 4:35 AM), this is off course possible.

    Siri