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.

LAUNCHXL-CC1350: rfEchoTx / Rx for multiple replies

Part Number: LAUNCHXL-CC1350

Hello, 

I am using the rfEcho example as a base, and have a small issue. I understand the basic example is used to send a packet from LaunchPad (LP) 1 to LP2 and back to LP1. However, i'll need LP2 & LP3 to 'reply' back to LP1. 

The following is the main portions of both sides of the code which I have edited: (I changed it this way so that LP2 & LP3 can differentiate the packets of each other from the control packet of LP1)

(LP1) rfEchoTx.c :

static uint8_t txPacket[PAYLOAD_LENGTH] = {"CTRLbikeObike"};        // Control Tx
static uint8_t returnCheck[PAYLOAD_LENGTH] = {"bikeObike"};         // Input item checking against
static uint8_t checkLength = 9;                                     // Number of characters to check against (returnCheck & rxPacket)
static uint8_t rxPacket[PAYLOAD_LENGTH + NUM_APPENDED_BYTES - 1];
...
...
int16_t status = memcmp(returnCheck, rxPacket, checkLength);

 (LP2 & LP3) rfEchoRx.c :

static uint8_t rxPacket[PAYLOAD_LENGTH];
static uint8_t txPacket[PAYLOAD_LENGTH] = {"bikeObike1"};              // Change bike serial number here
static uint8_t controlCheck[PAYLOAD_LENGTH] = {"CTRLbikeObike"};       // Control code to check against (Differentiate between bike & drone)
static uint8_t checkLength = 13;                                       // Number of characters to check against (controlCheck & rxPacket)
...
...
int16_t status = memcmp(controlCheck, rxPacket, checkLength); 

Help needed: 

1. Where is a suitable place in the code to insert a 'random delay' so that LP2 & LP3 packets don't "clash"?

2. How do I keep LP1's rx mode open to receive multiple signals within the timeout? (I want LP1 to send however many rxPacket it received out onto an external arduino board)

 

Any help would be greatly appreciated! Thank you!

  • Hello Adrian, 

    1. You can set the packet Tx time using the parameter RF_cmdPropTx.startTime

    /* Set absolute TX time to utilize automatic power management */
    curtime += PACKET_INTERVAL;
    RF_cmdPropTx.startTime = curtime;

    You can change this value to a random value that you desire. 


    2. Set RF_cmdPropRx.pktConf.bRepeatOk to 1 to go back to sync search after one packet is received. Once you receive all the packets you can use RF_cancelCmd() to cancel your Rx command.

    Regards,

    Prashanth

  • Hello Prashanth, 

    Thanks so much for the quick and helpful reply! 

    PrashanthS said:

    2. Set RF_cmdPropRx.pktConf.bRepeatOk to 1 to go back to sync search after one packet is received. Once you receive all the packets you can use RF_cancelCmd() to cancel your Rx command.

    Regards,

    Prashanth

    My aim is that I would need LP1's Rx to stay open for a set amount of time. It wouldn't know whether there's going to be 1 reply, 2, or maybe even 5 replies. So LP1 would stay in Rx for some time to receive X number of replies. It will only close Rx mode when timeout.


    Okay, sorry, i think this works. Thank you


    Another thing that's going on, LP2 & LP3 keeps 'talking' to each other when they are only supposed to 'talk' to LP1.. Any way that I can prevent this? Attached is a photo using smartrf on another LP.

    If LP2/LP3 memcmp = wrong, it should not be sending out its packet.

  • Hello Adrian,
    Glad to know that it is working now.
    You can use address filtering to let the packet be received only by the intended receiver and not others. In your screen shot, Enable "Address check" and specify the address. Also on the transmitter enable the "Address". You can get more information on Address filtering in the TRM. There is also check out EasyLink_EnableRxAddrFilter() in the easylink api.
    Regards,
    Prashanth
  • Hi Prashanth,

    Is it possible to implement this address filtering through the rfEchoTx/rfEchoRx examples in CCS?

    Regards,

    Adrian

  • Did you get the address filtering to work with SmartRF Studio? Then you can export code from SmartRF Studio and use in the rfEchoTx/ rfEchoRx examples. Remember to add the address in TX like shown in SmartRF Studio.
  • Hi TER,

    Thanks for the suggestion. I tried in SmartRF alone and it couldn't work. I encountered this same problem (https://e2e.ti.com/support/wireless_connectivity/proprietary_sub_1_ghz_simpliciti/f/156/p/601300/2211164)

    Instead, I decided to add these few lines (below) into the code. But I am not sure how to assign address for transmitting.

    Note: I added this code above into rfEchoRx.c because I can't get SmartRF to export the address settings as per below 

  • Hello Adrian,

    I tried the first default option 50kpbs, 2-GFSK, 25kHz deviation at 868 MHz and it works fine.

    Can you check the "Seq. Number included in Payload" on the Rx side and try. That is the only thing I see missing on your setup. When I tried with out checking the "Seq Number" I see packets are received but not decoded as "Test" , probably that is what you are seeing too. 

    Please note that even though the below screen shot shows the "no address check", it did work it did work with the address enabled as well. It displayed address followed by test as  "aa Test" in the receive side. I also tried changing the Tx side address to CC and the packets were not received on the Rx. 

    Regards,

    Prashanth

  • Hi Prashanth,

    All in all, this is what I am trying to achieve:

    My problem lies with LP2 and LP3 not rejecting each other's packets. 

    Sorry I didn't think of creating this flow process earlier. I hope it is easier to understand now.

    My application would require this process to be carried out once LPs are plugged to power source. (So I guess it has to be "hardcoded" within CCS and not use SmartRF?)

    Thanks in advance Prashanth and TER!

    Regards,

    Adrian

  • Hello Adrian,

    Thanks for the detailed explanation. How are you setting the addresses on the 3 LPs.

    Ideally, you should set an address for the packet coming from LP Main by setting the first byte Packet[0] to 0xAA (or any other address). Refer to TRM section 23.7.1 Packet Formats www.ti.com/.../swcu117h.pdf

    Both LP 2 and LP 3, should enable address filtering and receive packets only from LP Main. Now both LP2 and LP3 will not receive packets from each other and will receive packets coming from LP Main

    Here is what you should be doing on each of the LPs
    1. LP (Main):
    txPacket[0] = (uint8_t)(0xAA); // The first byte will be the address
    txPacket[1] = (uint8_t)(seqNumber >> 8);
    txPacket[2] = (uint8_t)(seqNumber++);
    uint8_t i;
    for (i = 3; i < PAYLOAD_LENGTH; i++)
    {
    txPacket[i] = rand();
    }

    2. LP2 and LP3 code

    RF_cmdPropRx.pktConf.bChkAddress = 1;
    RF_cmdPropRx.address0= 0xAA;
    RF_cmdPropRx.address1= 0x00;

    Regards,
    Prashanth
  • Hello Prashanth, 

    Thank you so much, thanks for all the help you provided and trying to help when I did not explain myself clearly.

    The TRM reference and this line "txPacket[0] = (uint8_t)(0xAA); // The first byte will be the address " solved it. 

    Thank you once again!

    Regards,

    Adrian

  • Hello Adrian,

    You are welcome. Glad to know it works now.

    Regards,
    Prashanth