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-CC1352R1: Problems with timer accuracy

Part Number: LAUNCHXL-CC1352R1
Other Parts Discussed in Thread: SYSCONFIG,

I need to create two square waves with a period of 27273 us. One square wave needs to be delayed 7955 us from the start of the other one. I have accomplished this with three timers. One for the 1st square wave, one for the 2nd, and a 3rd to start the 2nd after the 7955 us delay. 

This way was pretty easy but are there any other ways to synchronize the two wave forms as I have described?

When I measure these wave forms on the scope there is no jitter, but the timings are not quite correct. The period of the two waveforms measures 27090 to 27100 but it should be 27273. The delay measures 7880 and it should be 7955. What causes this error?

My app is based on the timerled example app in the SDK. This is a tirtos app. Would the timings be more accurate if I used nortos? Is nortos the same as bare-metal?

If I did switch to nortos, I am unsure what driverlib I should import. 

I did a web search and found something about the CC13xx library. This is a little confusing. Is this the name of the library used by the timerled example app? The CC13xx driver library has this sentence in it - “When using TI RTOS and the included RTOS drivers it is important that a user application does not "bypass" TI RTOS drivers by calling DriverLib functions directly to configure any hardware that is controlled by TI RTOS. Doing so can cause a conflict that may result in unexpected behavior by the RTOS.” 

This implies there is a driverlib for TI-RTOS and one for use when there is no RTOS. And that you must use the right one. 

So what library would I use and how would I use it if I created a nortos app to create these waveforms?

Lastly, in the timer section of SysConfig, I see there is a checkbox that says GPTimer. What does this do?

  • Hi Clark,

    Regarding driverlib, this is common for TIRTOS and nortos. You can find the documentation here. As you said, if you want to use driverlib APIs please make sure you don't create any conflicts with TI RTOS or TI drivers.

    For the rest of the questions please allow us some days to investigate.

  • Please note that with respect to accuracy, the GPTimer clock is dependent on the MCU system clock. If very high-accuracy outputs are needed, the application should request using the external HF crystal:

    #include <ti/sysbios/family/arm/cc26xx/Power.h>
    #include <ti/sysbios/family/arm/cc26xx/PowerCC2650.h>
    
    Power_setDependency(XOSC_HF);
    

    BR

    Siri

  • Hi Marie, 

    Thank you for your prompt reply!

    Unfortunately, I don't understand a couple things regarding your reply.

    1. You referenced the CC26xx driver library. This is not the same timer.h file used in the timerled example app which is a tirtos app. The CC26xx library appears to have many more features. So can I use the CC26XX driver library instead of whatever is used in the example app? Is the example app using the wrong driver library? If I can use the CC26XX library, how do I include it?

    2. You typed "if you want to use driverlib APIs please make sure you don't create any conflicts with TI RTOS or TI drivers." You also said the CC26XX driver "is common for TIRTOS and nortos". Since it is common for both, if I use this driver, how is it even possible to create a conflict?

    Obviously, I am confused! What I am trying to figure out is what driver do I use for TIRTOS and what driver do I use for nortos. And furthermore, how can I avoid creating any conflicts with TIRTOS or TI drivers?

    Thank you for your help and I look forward to your reply.

  • Thank you for this information, Siri. I will add this code today and see if it improves my accuracy. 

  • Siri

    Your advice to get the external HF crystal turned on was very helpful. Now my LaunchPad is setting the times very accurately...probably beyond the accuracy of my oscilloscope.

    I am using the following code on the LAUNCHXL-CC1352R1:

    #include <ti/drivers/Power.h>
    #include <ti/drivers/power/PowerCC26X2.h>
    #include <ti/drivers/power/PowerCC26XX.h>
    #include <ti/devices/cc13x2_cc26x2/driverlib/osc.h>
    
    // Guarantees that we are running on the external crystal
    Power_setConstraint(PowerCC26XX_DISALLOW_XOSC_HF_SWITCHING);
    Power_setDependency(PowerCC26XX_XOSC_HF);
    while(!PowerCC26XX_isStableXOSC_HF());
    PowerCC26XX_switchXOSC_HF();
    
    

    Thank you for this tip! Now I just need to get my remaining questions answered. THANK YOU AGAIN!

  • Hi Clark

    I will try to explain:

    You have the DriverLib and the TI Drivers.

    DriverLib is a set of low level drivers for accessing the registers found on the CC26xx family of ARM® Cortex™-M based devices. The DriverLib functions are grouped in APIs based on either specific on-chip peripheral module (e.g. SPI, UART, etc ) or more general functionality (e.g. system control, oscillator settings, etc). Each API uses a unique pre-fix for all the DriverLib functions in that API to indicate which module or type of functionality being accessed (with a few exceptions).

    The TI Drivers is a collective of peripheral drivers for TI's SimpleLink portfolio. The drivers are centered around a portable application programming interface (API) which enables seamless migration across the SimpleLink SDK portfolio.

    All our code examples are using the TI Drivers (which is what we recommend), and the TI Drivers use the DriverLib (I know the name DriverLib can be confusing, since this is not actual drivers, but simply an abstraction layer for accessing registers).

    For the TI Drivers, they can be used for both TI-RTOS and nortos.

    In some cases, the TI Drivers will not support the use case for a peripheral that you need (even if the HW is capable of supporting this). In these cases, it can be necessary to use DriverLib to configure the peripheral in a certain way, or simply creating your own driver by using the DriverLib API.

    When Marie said you had to be careful to avoid conflict, I think she just meant that if you start modifying registers etc. directly using DriverLib, you have to make sure that you are not getting into conflict with registers that needs to be set a certain way if you are also using the TI Drivers.

    I hope this made things a bit clearer.

    BR

    Siri

  • Siri

    That was very helpful! Only a couple remaining questions from my original post:

    1. Is NO-RTOS the same as bare metal? If not, what are the differences between NO-RTOS and bare metal?

    2. If I wanted to use TI RTOS but I did not want to use TI Drivers because a certain functionality was not supported, where are the DriverLib libraries? And where are the TI Driver libraries? I am using a LaunchXL-CC1352R1 and CCS. In the CCS Project Explorer Includes folder, there is an [SDK]/source/ti folder. Are the TI Driver and DriverLib libraries inside that folder? Where are each of them located?

    3. Similarly if I wanted to use noRTOS, where are the TI Driver and DriverLib libraries for noRTOS?

    4. Lastly, in the timer section of SysConfig, I see there is a checkbox that says Use GPTimer. What does this do?

    Clark

  • Hi Clark

    1)

    When we refer to nortos, we refer to the solution where you use the TI Drivers, but without the underlying operating system.

    We use the term bare metal, when we refer to solutions where you do not use an OS, you do not use the TI Drivers, but are writing you application based on DriverLib alone.

    2)

    DriverLib:

    C:\ti\simplelink_cc13x2_26x2_sdk_4_10_00_78\source\ti\devices\cc13x2_cc26x2\driverlib

    TI Drivers:

    C:\ti\simplelink_cc13x2_26x2_sdk_4_10_00_78\source\ti\drivers

    3)

    The DriverLib and TI Drivers are the same if you are using nortos.

    I recommend that you install the SDK and CCS and import the same project for both TI RTOS and nortos, so than you can see how they differ.

    Also see: https://dev.ti.com/tirex/explore/node?node=AE7RAnqQArlbuhRki8hahA__pTTHBmu__LATEST

    4)

    I recommend the following training to understand what sysConfig is and how it is used:

    https://dev.ti.com/tirex/explore/node?node=AIouI6g4ejAMCyOe10iMKQ__pTTHBmu__LATEST

    BR

    Siri

  • That you Siri. That was very well done. TI is an awesome company and the quality of the support is one of the reasons. 

    If you care to answer one last question... is there any performance difference between nortos and bare metal? It seems to me they are pretty close to one another since they are both using TI Drivers.

    Thanks again for your excellent reply.

    Clark