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.

How to dynamically change tx power from 10dBm to 14dBm when running CC1310 application?

Other Parts Discussed in Thread: CC1310

Hello, everyone!

   I want to dynamically change tx power of CC1310 from 10dBm to 14dBm when running application. How should I do?

   Best Regards,

   Gilbert

  • Hello Gilbert,

    When you say dynamically change txPower, I am assuming that the power switch is not with in a packet but from one packet to the next. To achieve this you can run RF_yield(rfHandle), and then set the txPower to the desired value as shown below.

    /* Set power to 10dBm */

    RF_cmdPropRadioDivSetup.txPower = 0x38D3;

    RF_EventMask result = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropTx, RF_PriorityNormal, NULL, 0);

    /* Change power to 14dBm */

    RF_yield(rfHandle);

    RF_cmdPropRadioDivSetup.txPower = 0xA73F;

    RF_EventMask result = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropTx, RF_PriorityNormal, NULL, 0);

  • Gilbert,

    There are a couple ways to do this, but the simplest would be to use RF_runImmediateCmd ( RF_Handle h, uint32_t * pCmdStruct ), and pass in the CMD_SET_TX_POWER command struct (described in detail in the reference manual). The .txpower values should be taken from SmartRF Studio. Keep in mind that you will need to define CCFG_FORCE_VDDR_HH = 1 in ccfg.c in order to set TX power to 14dBm.

    Here is an example of how you can set this up:

    // in smartrf_settings.c and .h files
    
    #define TX_POWER_14 = 0xa73f;    // define CCFG_FORCE_VDDR_HH = 1 in ccfg.c
    #define TX_POWER_10 = 0x38d3;
    
    rfc_CMD_SET_TX_POWER_t RF_cmdSetTxPower = 
    {
    	.commandNo = 0x0010,
    	.txpower = TX_POWER_14,
    };
    // in application code 
    
    RF_Handle rfHandle;
    RF_Stat rfStat;
    
    /* open radio with the setup command */ 
    
    // set TX power 
    RF_cmdSetTxPower.txpower = TX_POWER_10; 
    rfStat = RF_runImmediateCmd(rfHandle,(uint32_t*) RF_cmdSetTxPower); 
    
    /* check rfStat for command status */
    
    /* perform radio functions */


    Skyler

  • Hello PrashanthS and sls ,

    10dBm, RF_cmdSetTxPower.txpower = 0x38d3, CCFG_FORCE_VDDR_HH = 0x0 ;
    14dBm, RF_cmdSetTxPower.txpower = 0xa73f, CCFG_FORCE_VDDR_HH = 0x1 ;

    In fact, I more want to how to change the value of CCFG_FORCE_VDDR_HH when running application of CC1310.

    Best Regards,
    Gilbert
  • CCFG_FORCE_VDDR_HH is set in the CCFG and can not be changed during runtime.

    So basically you have to do:
    10dBm, RF_cmdSetTxPower.txpower = 0x2103, CCFG_FORCE_VDDR_HH = 0x1 ;
    14dBm, RF_cmdSetTxPower.txpower = 0xa73f, CCFG_FORCE_VDDR_HH = 0x1 ;

    The 10 dBm txPower value is calculated based on previously measured results.
  • Hello TER,

    Now in SmartRF Studio, I can get the values of RF_cmdSetTxPower.txpower for tx power from -10dBm to 12dBm when CCFG_FORCE_VDDR_HH = 0x0. However, where can I find the values of RF_cmdSetTxPower.txpower for every tx power(-10dBm to 12dBm)when CCFG_FORCE_VDDR_HH = 0x1 ?

    Best Regards,
    Gilbert
  • We only provide 14 dBm for CCFG_FORCE_VDDR_HH = 0x1 officially. Do you need all levels from -10 dBm to 12 dBm? I have the raw data so I can calculate the expected txPower values. The temperature compensation part of txPower is calculated and it should be checked if the compensation impact the power.
  • Hello TER,

    Thank you for your help! I think I nedd all levels from -10 dBm to 12 dBm. In addition, how does temperature compensation work? If my device is taken to lower temperature, in order to keep previous tx power (e.g. 10dBm, RF_cmdSetTxPower.txpower = 0x38d3), do I need to change the value of RF_cmdSetTxPower.txpower?

    Best Regards,
    Gilbert
  • A PA will typically give a higher output power on low temperatures than at high temperatures. To minimize the effect of temperature variations the CC1310 uses the built-in temperature sensor and adjust the bias current to the PA as a function of temperature. The amount of adjustment is set by the temperature coefficient part of txPower. (txPower[15:9]).
  • TER,

    1. Could you provide RF_cmdSetTxPower.txpower for all levels from -10 dBm to 12 dBm ?
    2. Where can I refer to the the temperature coefficient part of txPower ?

    Best Regards,
    Gilbert
  • I have looked at the data we have and we have only measured the output power for max gain in the PA when VDDR = 1.95 V (max) Basically that means that I don't have the data to calculate the temp coef for power levels under 10 dBm.

    The below is the values I calculated for VDDR max:

    txPower = 0x2103 => 10 dBm
    txPower = 0x2805 => 11 dBm
    txPower = 0x3E08 => 12 dBm
  • Hello.

    I would also like to dynamically increase the TX power after a set of packages (20 or so) in 2dBm steps from 0 (0x0041) to 12 (0xB818). 

    I tried to make a code by using the examples from this forum entry, but I am getting stuck. At the moment I can send 19 packets, and then the transmission stops.

    Would you be able to help me please? 

    This is part of the code:

    static void txTaskFunction(UArg arg0, UArg arg1)
    {
    uint32_t time;
    RF_Params rfParams;
    RF_Params_init(&rfParams);

    // Power changes

    uint8_t txpowerlevelmode;
    const uint16_t txpowerlevel[] = {0x0041,0x1042,0x18c5,0x1cc7,0x24cb,0x38d3,0xb818};

    txpowerlevelmode = 0;
    RF_cmdPropTx.pktLen = PAYLOAD_LENGTH;
    RF_cmdPropTx.pPkt = packet;
    RF_cmdPropTx.startTrigger.triggerType = TRIG_ABSTIME;
    RF_cmdPropTx.startTrigger.pastTrig = 1;
    RF_cmdPropTx.startTime = 0;

    /* Request access to the radio */
    //RF_cmdPropRadioDivSetup.txPower = txpowerlevel[txpowerlevelmode];
    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);

    /* Get current time */
    time = RF_getCurrentTime();
    while(1)
    {
    /* Create packet with incrementing sequence number and random payload */
    packet[0] = (uint8_t)(seqNumber >> 8);
    packet[1] = (uint8_t)(seqNumber++);
    uint8_t i;
    uint8_t sentence[] = {'T','E','S','T','T','E','S','T'};
    for (i = 2; i < PAYLOAD_LENGTH; i++)
    {
    packet[i] = (uint8_t)sentence[i-2];
    }

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

    /* Send packet */
    RF_EventMask result = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropTx, RF_PriorityNormal, NULL, 0);
    if (!(result & RF_EventLastCmdDone))
    {
    /* Error */
    while(1);
    }

    PIN_setOutputValue(pinHandle, Board_LED1,!PIN_getOutputValue(Board_LED1));

    if (seqNumber > 0 && seqNumber % 20 == 0 ){
    // RF_Stat rfStat;

    txpowerlevelmode = (txpowerlevelmode+1)%(sizeof(txpowerlevel)/sizeof(txpowerlevel[0]));

    // RF_cmdSetTxPower.txPower = txpowerlevel[txpowerlevelmode];
    // rfStat = RF_runImmediateCmd(rfHandle,(uint32_t*) &RF_cmdSetTxPower);
    RF_close(rfHandle);
    RF_cmdPropRadioDivSetup.txPower = txpowerlevel[txpowerlevelmode];
    rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioDivSetup, &rfParams);
    }

    }
    }

     Thank you

    Julia

  • Hello Julia, 

    I tried to reproduce the issue by starting from a rfPacketTx example and overwriting with your txTaskFunction. Tx on my boards loops forever without stopping. I am not sure what is different in your case that is causing it to halt. I am using CC1310 launchpad.

    Regards,

    Prashanth

  • Hi Prashanth.

    Is there maybe a setting in the smartRF.c file I am missing? I set the tx power to the 0x0041.

    Or does it have to do with my receiver? I am using the cc1110 as receiver and the cc1310 as transmitter.

  • Hello Julia, 

    Since you said the Tx stopped, my guess is that it has nothing to do with the receiver. Just to make sure, can you turn off the receiver and try?

    I am attaching the project that worked for me. Please compare this against your project.

    Regards,

    Prashanth

    rfPacketTx_CC1310_LAUNCHXL_TI_CC1310F128.zip

  • Hi Prashanth.

    I tried pretty much everything but it does not want to work. 

    I am having problems with CCS installations, could that have something to do with it? It's my last hope. When I imported your project, a warning appeared saying: 

    Invalid project path: Include path not found (C:\ti\tirex-content\tirtos_cc13xx_cc26xx_2_20_00_06\products\cc13xxware_2_04_03_17272). rfPacketTx_CC1310_LAUNCHXL_TI_CC1310F128 pathentry Path Entry Problem

    And when I try to install updates I am receiving error messages. But maybe this is the wrong thread.

    I still don't understand why the code compiles nicely and the first 19 packets are send, and then it stops. When you tried it with the launchpad, were you able to see an increase in signal strength?

    I am using the cc1310 5x5 chip if that helps. I made my own RF board.

    When I try my normal code with infinite packets at one power level it is also working. :(

    Cheers

    Julia

  • Hello Julia, 

    Sorry to hear about the troubles you are facing. It is probably easier for me to switch to your version and try to reproduce the issue. Can you please tell me what version of CCS TI-RTOS and version of the compiler you are using? Did you happen to try this on a Launchpad?

    Regards,

    Prashanth

  • My CCS Version: 6.2.0.00050 and the CCS TI-RTOS  2.20.0.06.

    I accidentally opened another thread, and one of your colleagues mentioned to try the easylink code. But looks so different, and I am not very talented in coding. But I guess I should try that too?

    It's strange though because the code works for you . Should I try and change to a different receiver?

  • Hello Julia,

    I tried it with your version of TI-RTOS and it did run just fine with out stopping. Can you please try this on a launchpad. I just want to rule out if it is your board specific issue.

    If you want to try the easy link example, it should not be difficult. Easylink provides a more user friendly API. In your case to change Tx power you can use EasyLink_setRfPwr(int8_t i8txPowerdBm) function.
    I am not saying easy link will fix your issue but that may be some thing you can try.

    Regards,
    Prashanth
  • Hi Prashanth.
    I tried the code with the cc1310 launchpad. It has the same issues. 19 packets are transmitted with the launchpad and then the receiver does not show any more transmitted packets. I also used the launchpad as receiver and my handmade circuit as Tx and the same happens. I will try and use a different computer now and if that still does not help, I will try the easylink example. Do you have any other ideas?
  • I have installed CCS v7 on a different computer, as I was not able to install version 6, due to error messages.

    I am now trying to debug my code, but it tells me that one version of TI RTOS is missing.  TIRTOSCC13XX_CC26XX' v2.20.0.06 is not currently installed and no compatible version is available. Please install this product or a compatible version. 

    I have installed version 2_20_00_06 and 2_21_00_06 and the error still comes up. :(

  • Hello Julia,
    CCS v7 should be fine. You can change the TI-RTOS version an installed version on your machine. Please right click on the project and choose properties and click on RTSC. Here select the latest TI-RTOS (mine is 2.21.0.6) and rebuild.
    Regards,
    Prashanth
  • Hi Prasanth. Happy new year!

    The RTOS version works now, I am using CCS v7 on my computer. So that's something.

    I am still stuck with my transmitted packets though. It runs one loop and stops. I never mentioned I am working with 433MHz.  I realised when I tried the smartRF studio with the launchpad and set the frequency to 433MHz only one power was available. But I am not sure if that matters, as I was able to use my single power level code with all different power levels available. 

    I was trying to work with the easylink example, but I could not get it to work at all. I'm not very talented in programming. 

    When you tried the code with your set up did it loop through all the power levels set in the code?

    I don't really know what else to do :(

    Cheers

    Julia

  • Hello Julia,
    Thank you and Happy New Year to you too.
    If you are using 433MHz, then you will need a board with the right matching antenna to see valid output powers. Also according to the errata www.ti.com/.../swrz062b.pdf 433MHz is only supported on revB. On the launchpad it should read PG 2.1. What PG version is your launchpad?
    Yes, when I tried my code at 868MHz, it did loop through all the power levels. Can you try this at 868MHz and not 433MHz?
    Regards,
    Prashanth
  • Julia,
    Like you noted at 433MHz, the Tx power only has one option in SmartRFStudio, but in Code composer studio project you can still use the same table as before and you should see the power change.
    Regards,
    Prashanth
  • I tested the power levels at 433MHz and noted that it is not scaling as much as at 868MHz. There is a new version on the SmartRFStudio (v2.5.0) that has about 5 options ranging from 15dBm to 6dBm at 433MHz. Please update your SmartRFStudio to create a new table for the power levels.
    Regards,
    Prashanth
  • Hi Prasanth,

    We spent the last days on getting it running with no success, so I would like to give you all the details I have as a last try. I am using the cc1310 5x5 µC with the TI reference design. It is radiating with a TI antenna of 433MHz, which is connected with a micro SMA connector. My receiver is the cc1110 (433MHz) attached to a TrxEB evaluation board. I also have one CC1310 Launchpad available, but have deactivated the on-board antenna, to be able to use the included sma connector to attach the TI 433MHz antenna.

    I would like to attach my code files to this blog. Can you let me know how to do it?

    The first project would show the constant power level, which is running nicely. I can set the power level in the smartrf_setting.c file and I can use all the power levels from -10dBm to 10dBm and every time I change it I can see the RSSI of the receiving cc1110 in SmartRf studio changing. I also tried it with the cc1310 launchpad as receiver and it is also working. I know now, that the power levels are working and that the receiver and transmitter are talking to each other.

    Now the stepwise increase of the power levels:

    The code I sent you was not working, it only was able to use the powerlevel set in the smartrf_settings.c file. So whenever I changed the power in the code, it did not change the power level, the RSSI in smart RF studio did not rise or decrease.  By moving the command RF_cmdPropRadioDivSetup.txPower = txpowerlevel[j];

    out of the if statement,  we can control the power within the code and not via the smartrf.c file. I am not sure why the .txpower cannot be controlled within the if statement, do you have any advice?

    The problem still lies within the loop, I am not sure how to increase .txpower after e.g. 20 packets to the next power level in the array? if you have any ideas at how to modify the code then it would be very much appreciated. We tried to approach the code with some logical thinking and I guess we are close, but one small thing must be missing. It only loops once and gives up.

    Would you have another look at the code from the project cc1310_5x5_pwrlevels?

    Thank you

    Julia

  • Hello Julia,
    I have sent you a friend's request. Please share the project. I will reproduce the issue here and debug.
    Regards,
    Prashanth
  • Thank you, Prashanth.

    Lets see if this upload works. the zip file might be too big, otherwise I'll send you a link to a dropbox folder.20161213_RF_code_dynamic power ccs7.zip

  • Hello Julia,

    Thank you for the zip file. I was able to test it, Since I do not have a CC1310 5x5 DK handy, I used CC1310 7x7 after switching to the correct board files.

    I tried the rfPacketTx_C1310_5x5_pwrlevels project and did notice that it is getting stuck when the sequence number is 11. I noticed that the RF_close() is missing in the new project. Essentially, it was doing an RF_open on an already open handle and is getting stuck. Please note that when ever a change in the Tx power is required, one has to run RF_close() and do a RF_open() with new Tx power value. This was present in the code snippet you shared earlier on a different thread.

    After adding RF_close(), I am now seeing that the loop runs with out halting.  

    if (seqNumber > 0 && seqNumber % 10 == 0 )
    {
    RF_close(rfHandle);         //added 
    RF_cmdPropRadioDivSetup.txPower = txpowerlevel[j]; // added

    /* Set the frequency */
    RF_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0); //added

    rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioDivSetup, &rfParams);
    }

  • Hi Prashanth.

    It still stops after the 0009 packet number on smart Rf studio. If I comment the whole if statement the 2 set power levels continue alternating with no stopping.

    // if (seqNumber > 0 && seqNumber % 10 == 0 )

    // {

    // RF_close(rfHandle);         //added

    // RF_cmdPropRadioDivSetup.txPower = txpowerlevel[j]; // added

    // rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioDivSetup, &rfParams);

    // }

    RF_cmdPropRadioDivSetup.txPower = txpowerlevel[j];   //

    I have attached the picture of what I see in smart RF studio.

    Kind regards

    Julia

  • Hello Julia, 

    Please note that the RF frequency should also be set after closing and re-opening the RF, Please add this line to your code.

    /* Set the frequency */
    RF_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);

    This is what is most likely causing the issue that you are seeing. Please add this line after RF_open and see if this fixes the problem. 

    I misunderstood earlier that your Tx program execution was getting stuck. Now I understand that it is the Rx reception is what is is halting.

    Regards,

    Prashanth

  • Thank you so much Prashanth.

    It is finally working!!!! :)  Thank you so much for your time!

    This is the final bit of the code, if anyone is interested.

    uint8_t j;
    j = 0;
    while(1)
    {
    /* Create packet with incrementing sequence number and random payload */
    packet[0] = (uint8_t)(seqNumber >> 8);
    packet[1] = (uint8_t)(seqNumber++);
    uint8_t i;
    uint8_t sentence[] = {'S','O','N','O','P','I','L','L','4'};
    for (i = 2; i < PAYLOAD_LENGTH; i++)
    {
    packet[i] = (uint8_t)sentence[i-2];
    }

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

    /* Send packet */
    RF_EventMask result = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropTx, RF_PriorityNormal, NULL, 0);

    PIN_setOutputValue(pinHandle, Board_LED1,!PIN_getOutputValue(Board_LED1));

    if (seqNumber > 0 && seqNumber % 20 == 0 )
    {
    if (++j >= sizeof(txpowerlevel)/sizeof(txpowerlevel[0])) j = 0;

    RF_close(rfHandle); //added
    RF_cmdPropRadioDivSetup.txPower = txpowerlevel[j]; // added
    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); //added
    }

    }
    }

  • Sorry, I have 2 more questions. Hope they won't take as long to answer though.

    How do I add a pause after each power level increase? I would like to send again 20 packets, then pause for 2 minutes, and after that continue with the next power level. I tried the :  void Task_sleep(UInt32 nticks) function and insert Task_sleep (500000); in the if statement. After the first loop the packet number jumps, as you can see below. It continues doing that after the next loop too.  Why is that?

    16:12:44.518 | 0000 | SONOPILL4 |  -23

    16:12:45.017 | 0001 | SONOPILL4 |  -23

    16:12:45.516 | 0002 | SONOPILL4 |  -23

    16:12:46.016 | 0003 | SONOPILL4 |  -23

    16:12:46.516 | 0004 | SONOPILL4 |  -23

    16:12:47.016 | 0005 | SONOPILL4 |  -23

    16:12:47.516 | 0006 | SONOPILL4 |  -23

    16:12:48.017 | 0007 | SONOPILL4 |  -23

    16:12:48.516 | 0008 | SONOPILL4 |  -23

    16:12:49.016 | 0009 | SONOPILL4 |  -23

    16:12:49.517 | 0010 | SONOPILL4 |  -23

    16:12:50.016 | 0011 | SONOPILL4 |  -23

    16:12:50.515 | 0012 | SONOPILL4 |  -23

    16:12:51.016 | 0013 | SONOPILL4 |  -23

    16:12:51.515 | 0014 | SONOPILL4 |  -23

    16:12:52.015 | 0015 | SONOPILL4 |  -23

    16:12:52.515 | 0016 | SONOPILL4 |  -23

    16:12:53.015 | 0017 | SONOPILL4 |  -23

    16:12:53.516 | 0018 | SONOPILL4 |  -23

    16:12:54.015 | 0019 | SONOPILL4 |  -23

    16:12:59.019 | 0020 | SONOPILL4 |  -25

    16:12:59.516 | 0030 | SONOPILL4 |  -25

    16:13:00.017 | 0031 | SONOPILL4 |  -25

    16:13:00.516 | 0032 | SONOPILL4 |  -25

    16:13:01.015 | 0033 | SONOPILL4 |  -25

    I would like to change the data rate to 500kbps. If I change the smartRF settings.c to this code below, would that give me the required data rate? Or is it only possible to use 50kbps?

    rfc_CMD_PROP_RADIO_DIV_SETUP_t RF_cmdPropRadioDivSetup =

    {

       .commandNo = 0x3807,

       .status = 0x0000,

       .pNextOp = 0, // INSERT APPLICABLE POINTER: (uint8_t*)&xxx

       .startTime = 0x00000000,

       .startTrigger.triggerType = 0x0,

       .startTrigger.bEnaCmd = 0x0,

       .startTrigger.triggerNo = 0x0,

       .startTrigger.pastTrig = 0x0,

       .condition.rule = 0x1,

       .condition.nSkip = 0x0,

       .modulation.modType = 0x1,

       .modulation.deviation = 0x64,

       .symbolRate.preScale = 0x6,

       .symbolRate.rateWord = 0x20000,

       .rxBw = 0x24,

       .preamConf.nPreamBytes = 0x4,

       .preamConf.preamMode = 0x0,

       .formatConf.nSwBits = 0x20,

       .formatConf.bBitReversal = 0x0,

       .formatConf.bMsbFirst = 0x1,

       .formatConf.fecMode = 0x0,

       .formatConf.whitenMode = 0x0,

       .config.frontEndMode = 0x0,

       .config.biasMode = 0x1,

       .config.analogCfgMode = 0x0,

       .config.bNoFsPowerUp = 0x0,

       .txPower = 0x3DCB,

       .pRegOverride = pOverrides,

       .centerFreq = 0x01B1,

       .intFreq = 0x8000,

       .loDivider = 0x0A,

    Kind regards

    Julia

  • Hello Julia, 

    1. On the first question it is not clear to me what you are printing and what you mean by packet number jumps. Can you share the code if you think that will better help us understand. 

    2. For changing the data rate, please use SmartRF studio to identify the RF parameters that will work at 500Kbps. Change the deviation to 250kHz(modulation index of 1). Then increase the Rx filter BW until, Tx/Rx work successfully. Below settings worked for me.

    Symbol Rate = 500kBaud

    Deviation = 250 kHz

    Rx Filter BW = 1243 kHz

    Once you have it working in SmartRF studio, you can click on export code in command view and overwrite the smartrfsettigs.c file with the new parameters. This way you can update your settings to do 500kbps. 

    Regards,

    Prashanth

  • Thank you Prashanth. For 2. I will do as you said. and for 1. I am showing you part of the code below.
    I only added the task_sleep function and with this 20 packets are received, break of 5s and the 21st packet with new power level is received, but then the loop or packets jump straight away to packet 31, continue rolling to 40, 5s break, and jump again. I would like it to do: packet 0-19 received, 5s break, 20-39 with new power level received, 5s break,...


    void Task_sleep(UInt32 nticks);

    static void txTaskFunction(UArg arg0, UArg arg1)
    {
    uint32_t time;
    RF_Params rfParams;
    RF_Params_init(&rfParams);

    // Power changes

    RF_cmdPropTx.pktLen = PAYLOAD_LENGTH;
    RF_cmdPropTx.pPkt = packet;
    RF_cmdPropTx.startTrigger.triggerType = TRIG_ABSTIME;
    RF_cmdPropTx.startTrigger.pastTrig = 1;
    RF_cmdPropTx.startTime = 0;

    /* Request access to the radio */
    RF_cmdPropRadioDivSetup.txPower = txpowerlevel[0];
    rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioDivSetup, &rfParams);
    // rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&EasyLink_setRfPwr, &rfParams);

    /* Set the frequency */
    RF_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);

    /* Get current time */
    time = RF_getCurrentTime();

    uint8_t j;
    j = 0;
    while(1)
    {
    /* Create packet with incrementing sequence number and random payload */
    packet[0] = (uint8_t)(seqNumber >> 8);
    packet[1] = (uint8_t)(seqNumber++);
    uint8_t i;
    uint8_t sentence[] = {'S','O','N','O','P','I','L','L','4'};
    for (i = 2; i < PAYLOAD_LENGTH; i++)
    {
    packet[i] = (uint8_t)sentence[i-2];
    }

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

    /* Send packet */
    RF_EventMask result = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropTx, RF_PriorityNormal, NULL, 0);

    PIN_setOutputValue(pinHandle, Board_LED1,!PIN_getOutputValue(Board_LED1));

    if (seqNumber > 0 && seqNumber % 20 == 0 )
    {
    if (++j >= sizeof(txpowerlevel)/sizeof(txpowerlevel[0])) j = 0;

    RF_close(rfHandle); //added
    RF_cmdPropRadioDivSetup.txPower = txpowerlevel[j]; // added
    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); //added
    Task_sleep (500000);
    }


    }
  • Thank you Prashanth.
    For 1. I will do as you said and for 2. I have attached part of the code.
    The idea was to use the task_sleep function to have 20 packets received, then a 5s break, next 20 packets with next power level, 5s break...
    Right now it does the first 20, 5s break, increases power level at packet 21, and jumps straight to number 30, does 10 packets to 40 and has the break again, then packet 41 with increased power, jumps to 50....

    Not sure if I need to use a different function.

    void Task_sleep(UInt32 nticks);

    static void txTaskFunction(UArg arg0, UArg arg1)
    {
    uint32_t time;
    RF_Params rfParams;
    RF_Params_init(&rfParams);

    // Power changes

    RF_cmdPropTx.pktLen = PAYLOAD_LENGTH;
    RF_cmdPropTx.pPkt = packet;
    RF_cmdPropTx.startTrigger.triggerType = TRIG_ABSTIME;
    RF_cmdPropTx.startTrigger.pastTrig = 1;
    RF_cmdPropTx.startTime = 0;

    /* Request access to the radio */
    RF_cmdPropRadioDivSetup.txPower = txpowerlevel[0];
    rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioDivSetup, &rfParams);
    // rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&EasyLink_setRfPwr, &rfParams);

    /* Set the frequency */
    RF_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);

    /* Get current time */
    time = RF_getCurrentTime();

    uint8_t j;
    j = 0;
    while(1)
    {
    /* Create packet with incrementing sequence number and random payload */
    packet[0] = (uint8_t)(seqNumber >> 8);
    packet[1] = (uint8_t)(seqNumber++);
    uint8_t i;
    uint8_t sentence[] = {'S','O','N','O','P','I','L','L','4'};
    for (i = 2; i < PAYLOAD_LENGTH; i++)
    {
    packet[i] = (uint8_t)sentence[i-2];
    }

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

    /* Send packet */
    RF_EventMask result = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropTx, RF_PriorityNormal, NULL, 0);

    PIN_setOutputValue(pinHandle, Board_LED1,!PIN_getOutputValue(Board_LED1));

    if (seqNumber > 0 && seqNumber % 20 == 0 )
    {
    if (++j >= sizeof(txpowerlevel)/sizeof(txpowerlevel[0])) j = 0;

    RF_close(rfHandle); //added
    RF_cmdPropRadioDivSetup.txPower = txpowerlevel[j]; // added
    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); //added
    Task_sleep (500000);
    }
  • Julia,
    You will also need to reset the time value as shown below during Tx power change. You can add this after calling Task_sleep()
    time = RF_getCurrentTime();
    Regards,
    Prashanth
  • It is working. Thank you very much. :)
  • I was trying to send and receive packets in an interval of less then 125ms. Best would be 15ms, and from what I understand that should be possible for the cc1310.
    Unfortunately the CC1110 does only show every hundreds packet for example in the smart Rf studio if I set it to a higher interval rate. Is there a way of receiving all the packets? I won't be able to program teh cc1110 though as I only have the eval module which is attached to the TrxEB board.

    Thank you for your help
    Julia
  • Due to how SmartRF Studio the communication between the PC and CC1110 is low. For this reason you should not use SmartRF studio to check how fast you manage to receive packets. To test speed you have to implement your own firmware on CC1110.
  • ok thank you.
    Is there any way of increasing the packet size to 255bytes without writing 253 letters in to the payload?
  • If you are referring to Smart RF Studio, you can use a random payload.
  • I mean for my transmitting code.
    packet[0] = (uint8_t)(seqNumber >> 8);
    packet[1] = (uint8_t)(seqNumber++);
    uint8_t i;uint8_t sentence[] = {'@','@'

    ...
  • I mean for my transmitting code.
    packet[0] = (uint8_t)(seqNumber >> 8);
    packet[1] = (uint8_t)(seqNumber++);
    uint8_t i;
    uint8_t sentence[] = {'@','@'..... //instead of writing @ 253 times?
  • It depends on the payload you want to send. In an application the payload will consist of data generated by something and you don't have to do it manually.

    What we do in the examples is:
    /* Create packet with incrementing sequence number and random payload */
    packet[0] = (uint8_t)(seqNumber >> 8);
    packet[1] = (uint8_t)(seqNumber++);
    uint8_t i;
    for (i = 2; i < PAYLOAD_LENGTH; i++)
    {
    packet[i] = rand();
    }

    You can substitute rand() with '@' as an example.