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.

CC1310 TI RTOS Timer ID mapping

Other Parts Discussed in Thread: CC1310, SYSBIOS, CC2650, CC1350

I am just picked up a CC1310RF06 evaluation board to lean TI-RTOS. I am following TI video tutorials.


I was trying to experiment on my own by setting up a timer and then a hwi to serve the periodic interrupts from that timer. I had couple of questions and I hope someone more experienced than me can help me

1. As per CC1310 TRM, it has 4 GPTM which can either be used at 2 16 bit timer (a & b) or 1 32 bit timer

When setting up a timer configuration statically in TI RTOS, how is the timer ID field mapped to the GPTM blocks in CC1310?

Thanks !

  • Hi Ankit,

    This is what the mapping looks like on that device:

    Thanks,
    Gerardo

  • Hi Gerardo,

    thank you for your reply. This is my first time using an RTOS and a TI processor, so excuse me if my questions seems "dumb".

    What I am trying to achieve is to have a timer in my BIOS config with a set period and have an attached hwi that would be attached to this timer overflow interrupt and would toggle an led. Just a simple exercise to help me understand the basics.

    I am getting confused on several fronts here :

    1. CC1310 has 4 GPTM blocks. Each block has 2 16 bit timers that can either be used individually in 16 bit mode or combined 32 bit mode. During timer configuration in BIOS, under timerID I get the option to select 0-8. Does that mean BIOS only support the individual 16 bit timer mode and not the combined 32 bit mode for the timers with mapping

    0 - GPTM 0A
    1 - GPTM 0B
    ...
    7 - GPTM 3B

    With the mapping that you have provided, it would seem that there is no mention of timer A or B, just the GPTM module. Does that mean that the BIOS only supports using timers in combined 32 bit mode and not in individual 16 bit mode.

    In that case, what interrupt number do I attach the hwi to? As per the ISR table in the technical reference manual

    31 15 0x0000 007C GPTimer 0A
    32 16 0x0000 0080 GPTimer 0B
    33 17 0x0000 0084 GPTimer 1A
    34 18 0x0000 0088 GPTimer 1B
    35 19 0x0000 008C GPTimer 2A
    36 20 0x0000 0090 GPTimer 2B
    37 21 0x0000 0094 GPTimer 3A
    38 22 0x0000 0098 GPTimer 3B

    there is no vector for overflow in the combined 32 bit mode, just individual 16 bit mode.

    2. What if I do not want to use the overflow mode of a timer. Is there an option to have a compare / match interrupt?

    3. When I setup a timer in BIOS, it provides me with a field for 'Timer ISR function'. This is the function the BIOS would call on timer overflow event. What happens when I want a hwi to be called on timer overflow? In hwi I would mention the timer interrupt number so that it knows what interrupt it needs to react to (timer overflow). what happens to the timer ISR function in this case? Do I set it to null ? What if I do not set it to null ? In such case would both functions be called (one specified in timer and the other one specified in hwi) ?
  • Now I am getting "invalid Timer ID" when I select some of the timer id values from 0 to 8

    Below is my configuration file

    /*
    * Copyright (c) 2015-2016, Texas Instruments Incorporated
    * All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *
    * * Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    *
    * * Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the distribution.
    *
    * * Neither the name of Texas Instruments Incorporated nor the names of
    * its contributors may be used to endorse or promote products derived
    * from this software without specific prior written permission.
    *
    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
    * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
    * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    */



    /* ================ Boot configuration ================ */
    var Boot = xdc.useModule('ti.sysbios.family.arm.cc26xx.Boot');
    var LoggingSetup = xdc.useModule('ti.uia.sysbios.LoggingSetup');
    var halHwi = xdc.useModule('ti.sysbios.hal.Hwi');



    /* ================ Defaults (module) configuration ================ */
    var Defaults = xdc.useModule('xdc.runtime.Defaults');
    var Idle = xdc.useModule('ti.sysbios.knl.Idle');
    var Timer = xdc.useModule('ti.sysbios.hal.Timer');
    /*
    * A flag to allow module names to be loaded on the target. Module name
    * strings are placed in the .const section for debugging purposes.
    *
    * Pick one:
    * - true (default)
    * Setting this parameter to true will include name strings in the .const
    * section so that Errors and Asserts are easier to debug.
    * - false
    * Setting this parameter to false will reduce footprint in the .const
    * section. As a result, Error and Assert messages will contain an
    * "unknown module" prefix instead of the actual module name.
    *
    * When using BIOS in ROM:
    * This option must be set to false.
    */
    //Defaults.common$.namedModule = true;
    Defaults.common$.namedModule = false;



    /* ================ Error configuration ================ */
    var Error = xdc.useModule('xdc.runtime.Error');
    /*
    * This function is called to handle all raised errors, but unlike
    * Error.raiseHook, this function is responsible for completely handling the
    * error with an appropriately initialized Error_Block.
    *
    * Pick one:
    * - Error.policyDefault (default)
    * Calls Error.raiseHook with an initialized Error_Block structure and logs
    * the error using the module's logger.
    * - Error.policySpin
    * Simple alternative that traps on a while(1) loop for minimized target
    * footprint.
    * Using Error.policySpin, the Error.raiseHook will NOT called.
    */
    //Error.policyFxn = Error.policyDefault;
    Error.policyFxn = Error.policySpin;

    /*
    * If Error.policyFxn is set to Error.policyDefault, this function is called
    * whenever an error is raised by the Error module.
    *
    * Pick one:
    * - Error.print (default)
    * Errors are formatted and output via System_printf() for easier
    * debugging.
    * - null
    * Errors are not formatted or logged. This option reduces code footprint.
    * - non-null function
    * Errors invoke custom user function. See the Error module documentation
    * for more details.
    */
    //Error.raiseHook = Error.print;
    Error.raiseHook = null;
    //Error.raiseHook = "&myErrorFxn";

    /*
    * If Error.policyFxn is set to Error.policyDefault, this option applies to the
    * maximum number of times the Error.raiseHook function can be recursively
    * invoked. This option limits the possibility of an infinite recursion that
    * could lead to a stack overflow.
    * The default value is 16.
    */
    Error.maxDepth = 2;
    /*
    * The Idle module is used to specify a list of functions to be called when no
    * other tasks are running in the system.
    *
    * Functions added here will be run continuously within the idle task.
    *
    * Function signature:
    * Void func(Void);
    */
    //Idle.addFunc("&myIdleFunc");



    /* ================ Kernel (SYS/BIOS) configuration ================ */
    var BIOS = xdc.useModule('ti.sysbios.BIOS');
    /*
    * Enable asserts in the BIOS library.
    *
    * Pick one:
    * - true (default)
    * Enables asserts for debugging purposes.
    * - false
    * Disables asserts for a reduced code footprint and better performance.
    *
    * When using BIOS in ROM:
    * This option must be set to false.
    */
    //BIOS.assertsEnabled = true;
    BIOS.assertsEnabled = false;

    /*
    * Specify default heap size for BIOS.
    */
    BIOS.heapSize = 1024;

    /*
    * Specify default CPU Frequency.
    */
    BIOS.cpuFreq.lo = 48000000;

    /*
    * A flag to determine if xdc.runtime sources are to be included in a custom
    * built BIOS library.
    *
    * Pick one:
    * - false (default)
    * The pre-built xdc.runtime library is provided by the respective target
    * used to build the application.
    * - true
    * xdc.runtime library sources are to be included in the custom BIOS
    * library. This option yields the most efficient library in both code
    * footprint and runtime performance.
    */
    //BIOS.includeXdcRuntime = false;
    BIOS.includeXdcRuntime = true;

    /*
    * The SYS/BIOS runtime is provided in the form of a library that is linked
    * with the application. Several forms of this library are provided with the
    * SYS/BIOS product.
    *
    * Pick one:
    * - BIOS.LibType_Custom
    * Custom built library that is highly optimized for code footprint and
    * runtime performance.
    * - BIOS.LibType_Debug
    * Custom built library that is non-optimized that can be used to
    * single-step through APIs with a debugger.
    *
    */
    BIOS.libType = BIOS.LibType_Custom;
    //BIOS.libType = BIOS.LibType_Debug;

    /*
    * Runtime instance creation enable flag.
    *
    * Pick one:
    * - true (default)
    * Allows Mod_create() and Mod_delete() to be called at runtime which
    * requires a default heap for dynamic memory allocation.
    * - false
    * Reduces code footprint by disallowing Mod_create() and Mod_delete() to
    * be called at runtime. Object instances are constructed via
    * Mod_construct() and destructed via Mod_destruct().
    *
    * When using BIOS in ROM:
    * This option must be set to true.
    */
    BIOS.runtimeCreatesEnabled = true;
    //BIOS.runtimeCreatesEnabled = false;

    /*
    * Enable logs in the BIOS library.
    *
    * Pick one:
    * - true (default)
    * Enables logs for debugging purposes.
    * - false
    * Disables logging for reduced code footprint and improved runtime
    * performance.
    *
    * When using BIOS in ROM:
    * This option must be set to false.
    */
    //BIOS.logsEnabled = true;
    BIOS.logsEnabled = false;



    /* ================ Memory configuration ================ */
    var Memory = xdc.useModule('xdc.runtime.Memory');
    /*
    * The Memory module itself simply provides a common interface for any
    * variety of system and application specific memory management policies
    * implemented by the IHeap modules(Ex. HeapMem, HeapBuf).
    */



    /* ================ Program configuration ================ */
    /*
    * Program.stack is ignored with IAR. Use the project options in
    * IAR Embedded Workbench to alter the system stack size.
    */
    if (!Program.build.target.$name.match(/iar/)) {
    /*
    * Reducing the system stack size (used by ISRs and Swis) to reduce
    * RAM usage.
    */
    Program.stack = 768;
    }



    /*
    * Uncomment to enable Semihosting for GNU targets to print to the CCS console.
    * Please read the following TIRTOS Wiki page for more information on Semihosting:
    * processors.wiki.ti.com/.../TI-RTOS_Examples_SemiHosting
    */

    if (Program.build.target.$name.match(/gnu/)) {
    //var SemiHost = xdc.useModule('ti.sysbios.rts.gnu.SemiHostSupport');
    }

    /* ================ ROM configuration ================ */
    /*
    * To use BIOS in flash, comment out the code block below.
    */
    var ROM = xdc.useModule('ti.sysbios.rom.ROM');
    if (Program.cpu.deviceName.match(/CC26/)) {
    ROM.romName = ROM.CC2650;
    }
    else if (Program.cpu.deviceName.match(/CC13/)) {
    ROM.romName = ROM.CC1350;
    }



    /* ================ Semaphore configuration ================ */
    var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
    /*
    * Enables global support for Task priority pend queuing.
    *
    * Pick one:
    * - true (default)
    * This allows pending tasks to be serviced based on their task priority.
    * - false
    * Pending tasks are services based on first in, first out basis.
    *
    * When using BIOS in ROM:
    * This option must be set to false.
    */
    //Semaphore.supportsPriority = true;
    Semaphore.supportsPriority = false;

    /*
    * Allows for the implicit posting of events through the semaphore,
    * disable for additional code saving.
    *
    * Pick one:
    * - true
    * This allows the Semaphore module to post semaphores and events
    * simultaneously.
    * - false (default)
    * Events must be explicitly posted to unblock tasks.
    *
    * When using BIOS in ROM:
    * This option must be set to false.
    */
    //Semaphore.supportsEvents = true;
    Semaphore.supportsEvents = false;



    /* ================ System configuration ================ */
    var System = xdc.useModule('xdc.runtime.System');
    /*
    * The Abort handler is called when the system exits abnormally.
    *
    * Pick one:
    * - System.abortStd (default)
    * Call the ANSI C Standard 'abort()' to terminate the application.
    * - System.abortSpin
    * A lightweight abort function that loops indefinitely in a while(1) trap
    * function.
    * - A custom abort handler
    * A user-defined function. See the System module documentation for
    * details.
    */
    //System.abortFxn = System.abortStd;
    System.abortFxn = System.abortSpin;
    //System.abortFxn = "&myAbortSystem";

    /*
    * The Exit handler is called when the system exits normally.
    *
    * Pick one:
    * - System.exitStd (default)
    * Call the ANSI C Standard 'exit()' to terminate the application.
    * - System.exitSpin
    * A lightweight exit function that loops indefinitely in a while(1) trap
    * function.
    * - A custom exit function
    * A user-defined function. See the System module documentation for
    * details.
    */
    //System.exitFxn = System.exitStd;
    System.exitFxn = System.exitSpin;
    //System.exitFxn = "&myExitSystem";

    /*
    * Minimize exit handler array in the System module. The System module includes
    * an array of functions that are registered with System_atexit() which is
    * called by System_exit(). The default value is 8.
    */
    System.maxAtexitHandlers = 0;

    /*
    * The System.SupportProxy defines a low-level implementation of System
    * functions such as System_printf(), System_flush(), etc.
    *
    * Pick one pair:
    * - SysMin
    * This module maintains an internal configurable circular buffer that
    * stores the output until System_flush() is called.
    * The size of the circular buffer is set via SysMin.bufSize.
    * - SysCallback
    * SysCallback allows for user-defined implementations for System APIs.
    * The SysCallback support proxy has a smaller code footprint and can be
    * used to supply custom System_printf services.
    * The default SysCallback functions point to stub functions. See the
    * SysCallback module's documentation.
    */
    //var SysMin = xdc.useModule('xdc.runtime.SysMin');
    //SysMin.bufSize = 128;
    //System.SupportProxy = SysMin;
    var SysCallback = xdc.useModule('xdc.runtime.SysCallback');
    System.SupportProxy = SysCallback;



    /* ================ Text configuration ================ */
    var Text = xdc.useModule('xdc.runtime.Text');
    /*
    * These strings are placed in the .const section. Setting this parameter to
    * false will save space in the .const section. Error, Assert and Log messages
    * will print raw ids and args instead of a formatted message.
    *
    * Pick one:
    * - true (default)
    * This option loads test string into the .const for easier debugging.
    * - false
    * This option reduces the .const footprint.
    */
    //Text.isLoaded = true;
    Text.isLoaded = false;



    /* ================ Types configuration ================ */
    var Types = xdc.useModule('xdc.runtime.Types');
    /*
    * This module defines basic constants and types used throughout the
    * xdc.runtime package.
    */



    /* ================ TI-RTOS middleware configuration ================ */
    var mwConfig = xdc.useModule('ti.mw.Config');
    /*
    * Include TI-RTOS middleware libraries
    */



    /* ================ TI-RTOS drivers' configuration ================ */
    var driversConfig = xdc.useModule('ti.drivers.Config');
    /*
    * Include TI-RTOS drivers
    *
    * Pick one:
    * - driversConfig.LibType_NonInstrumented (default)
    * Use TI-RTOS drivers library optimized for footprint and performance
    * without asserts or logs.
    * - driversConfig.LibType_Instrumented
    * Use TI-RTOS drivers library for debugging with asserts and logs enabled.
    */
    driversConfig.libType = driversConfig.LibType_NonInstrumented;
    var halHwi0Params = new halHwi.Params();
    halHwi0Params.instance.name = "my_hwi_0";
    halHwi0Params.maskSetting = xdc.module("ti.sysbios.interfaces.IHwi").MaskingOption_ALL;
    Program.global.my_hwi_0 = halHwi.create(38, "&my_hwi_0_fn", halHwi0Params);
    BIOS.clockEnabled = true;
    var timer0Params = new Timer.Params();
    timer0Params.instance.name = "timer0";
    timer0Params.period = 1000;
    Program.global.timer0 = Timer.create(3, null, timer0Params);
  • Hi Ankit,

    You need to add the following to your .cfg file:

    var Timer = xdc.useModule('ti.sysbios.family.arm.lm4.Timer');

    And in Timer.create instead of an ID (3 in your code), add the following:

    Timer_ANY

    And in your .c file add:

    #include <ti/sysbios/family/arm/lm4/Timer.h>

    Let me know if this works for you.

    Thanks,
    Gerardo

  • There was a suggested answer and since there has been no active on this thread for more than a week, the suggested answer was marked as verify. Please feel free to select the "Reject Answer" button and reply with more details.
  • FYI: Starting with TI RTOS 2.20, there is a dedicated GPTimer driver and PWM driver for the CC26 / CC13XX.
    The GPTimer driver is found at the default install path C:\ti\tirtos_cc13xx_cc26xx_2_20_00_06\products\tidrivers_cc13xx_cc26xx_2_20_00_08\packages\ti\drivers\timer

    The LM4 Timer module should not be used, this is a kernel Timer module from the Stellaris LM4 devices which has the same GPTimer as CC26/CC13XX.

    Regards,
    Svend