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.

Pre-release CC26XX / CC13XX PWM and GPTimer driver

Other Parts Discussed in Thread: CC2650, BLE-STACK, SYSBIOS, CC1310

There have been a lot of requests from customers on how to use the GPTimers to generate PWM outputs on the CC26XX.

With the complexity of the devices and the power management being handled by TI RTOS this can be a bit complex and we have therefore made a PWM driver and a GPTimer driver that is posted to this thread.

These drivers will work with TI RTOS >= 2.13.00.06 and will be officially included in the TI RTOS February release (unfortunately we were to late for the December release).

Features GPTimer driver

  • Support for both split (16+8 bits) and concatenated mode (32-bit) timer usage giving you up to 8 (or 4) timers in total
  • Modes
    • Oneshot mode
    • Periodic mode
    • Edge count - capture and count number of input edges from pins (falling, rising or both)
    • Edge time - capture and store time when input edge occured (falling, rising or both)
    • PWM
  • Set load and match value of timers
  • Built-in power management
  • Interrupt generation for match, capture and timeout
  • Debug stall - halt the timer when the debugger halts

Features PWM driver

  • Generates up to 8x PWM ouputs
  • Configurable period in microseconds, Hertz or raw timer counts
  • Configurable duty cycle in microseconds, fraction of period or raw timer counts
  • Duty and period can be changed at run-time
  • Configurable Idle level (output stops at this level when timer is not running)

None of the timers support DMA at the moment as this requires changes to the current DMA driver.

Usage

  • Add the necessary hardware descriptors, objects and configuration to your board files as shown in Board.c/h.
  • Add a compiler search path to the drivers base or add the drivers to your TI RTOS installation
  • Add the driver source to your workspace
  • Follow the examples included (main_*.c)

Let us know if you have any questions / feedback in this thread and we will try our best to help out!

4760.gptimer_pwm_cc26xx_cc13xx.zip

Update 2015-12-17: Modified timer driver to compile in CCS without enabling C99 mode

Update 2016-02-16 : Needed modification for using PWM/GPTimer driver with TI-RTOS version >=2.15, red font : original content ; green font : updated content 

1. GPTimerCC26XX.h

#include <ti/sysbios/family/arm/cc26xx/Power.h>
#include <ti/sysbios/family/arm/cc26xx/PowerCC2650.h>

to

#include <ti/drivers/Power.h>
#include <ti/drivers/power/PowerCC26XX.h>

2. change Power_SB_DISALLOW to PowerCC26XX_SB_DISALLOW in GPTimerCC26xx.c

3. For board.c, change the following 

{.baseAddr = GPT0_BASE, .intNum = INT_TIMER0A, .intPriority = (~0), .powerMngrId = PERIPH_GPT0, .pinMux = GPT_PIN_0A, },

{.baseAddr = GPT0_BASE, .intNum = INT_TIMER0B, .intPriority = (~0), .powerMngrId = PERIPH_GPT0, .pinMux = GPT_PIN_0B, },

to

{.baseAddr = GPT0_BASE, .intNum = INT_GPT0A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0A, }, 

{.baseAddr = GPT0_BASE, .intNum = INT_GPT0B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0B, },

4. PWMCC26XX.c, you can either comment out the log_error or just change the duty/period to dutyValue/periodValue if you got compile error. 

Regards,
Svend

  • Can you show me how you implement your task? Did you use it on top of other project, ex :SBP?
  • yes, I use on simplePeripheral project。
  • Hi,

    If you can post your code snippet, then it's easier to help. I have no idea why it does not work for you if you don't provide more information.
    Thanks!
  • Am I correct assuming that this pre-release driver is no longer needed with the BLE Stack release 2.2.0 because the PWM driver is included in the TIRTOS version BLE Stack 2.2.0 uses? If so, could someone post a porting guide / usage example of how the use of the pre-release driver differs from the released driver (if any). Thanks.
  • Hi,

    Actually the PWM driver included in TI-RTOS version 2.18 is not the official tested version. It's still recommended to use the prelease one and port it to 2.18.
  • Oh, what a bummer, thats disappointing to hear.
  • Hi Pixbroker,

    Not sure why it was not included in the 2.16/18 release, it should have been.
    Good news it that it is included in the 2.20 version and you should be able to use it directly in your BLE 2.2.0 release which uses TI RTOS 2.18.

    I have attached an archive with the drivers/files you might need from 2.20 for your convience.

    Regards,
    Svend

    pwm_2_20.zip

  • Thank you Svend, much appreciated.

    I have 2 follow up questions:

    * I noticed that the files you sent also have some differences related to the ADC driver. Is it ok to also use these in TIRTOS 2.18 with BLE Stack 2.2.0?

    * are there any examples of how to use this PWM driver (and ADC)?

    Thanks
  • Pixbroker,

    Between v2.18 and v2.20, both drivers and examples should be OK to use with both.
    Examples for both PWM and the ADC are found at the following path:

    <ti_rtos_2_20_path>examples\IAR\CC2650_LAUNCHXL

    Regards,
    Svend

  • Hallo

    I am using the edge time mode to capture the time of external pulses, and it works fine so far.
    But my pulses can be up to 20 ms.
    In the 'GPTimerCC26XX_getValue (handle)' function, I see always 16 Bit values that rolls over and the precounter is always zero.
    As described in the Tecnical Reference manual (swcu117d, 13.3.2.3), it should be possible that the precounter extends the range to 24 bit.
    The note of the chapter says:
    "When operating in edge-time mode, the counter uses a modulo 2 24 count if prescaler is
    enabled, or 2 16 if prescaler is not enabled."

    What must be done to achieve a 24 Bit counter . Or is the an other way to extend the counting range?

    Best regards.
  • Hello Thomas,

    You are using the correct API at least, hard to say what is wrong.
    The driver will always use the prescaler so that the returned values should be 24 bits instead of 16 in the split (16 bits) modes.

    I suggest adding in the driver source:(C:\ti\tirtos_cc13xx_cc26xx_2_20_00_06\products\tidrivers_cc13xx_cc26xx_2_20_00_08\packages\ti\drivers\timer\GPTimerCC26XX.c)

    and set a breakpoint in GPTimerCC26XX_getTimerValue.

    - Check that the correct register is read (TAR). The prescaler bits should be bits 23:16 of this register in edge-time mode. By default the prescaler (configured in the TAPR register) is set to 1.
    - Enable debug stall mode when opening driver, set a breakpoint in your interrupt routine and compare the TAR register to the free-running TAV register once you halt in the breakpoint.

    Regards,
    Svend
  • Svend,

    I can't figure out how to use the prescaler in edge time mode either. I see that the GPTimerCC26XX_getTimerValue() function returns the top 24 bits (the return value is ANDed with 0xFFFFFF) but I don't see how you set the prescaler before using the timer? When setting up/opening the timer, the GPTimerCC26XX_Params declaration doesn't include a field to set the prescaler value, and I can't see where it might be accomplished?

    A short example would be really helpful here.

    Thanks, as always,

    -Ben

  • Hi Ben,

    I do not think that TI implemented a "setprescaler" API function for the GP timer.

    So you need to add it for yourself.

    I've modififed for my project the GPTimerCC26XX.h and GPTimerCC26XX.c as follows:

    Add to GPTimerCC26XX.h:

    /*!
     *  @brief
     *  Definitions for controlling prescale value for timer.
     */
    typedef enum GPTimerCC26XX_Prescale
    {
        GPTimerCC26XX_PRESCALE_1    = 0,
        GPTimerCC26XX_PRESCALE_2    = 1,
        GPTimerCC26XX_PRESCALE_3    = 2,
        GPTimerCC26XX_PRESCALE_4    = 3,
        GPTimerCC26XX_PRESCALE_5,
        GPTimerCC26XX_PRESCALE_6,
        GPTimerCC26XX_PRESCALE_7,
        GPTimerCC26XX_PRESCALE_8,
        GPTimerCC26XX_PRESCALE_9,
        GPTimerCC26XX_PRESCALE_10,
        /*..*/
        GPTimerCC26XX_PRESCALE_100  = 99,
        GPTimerCC26XX_PRESCALE_101  = 100,
        GPTimerCC26XX_PRESCALE_102  = 101,
        GPTimerCC26XX_PRESCALE_103  = 102,
        GPTimerCC26XX_PRESCALE_104  = 103,
        GPTimerCC26XX_PRESCALE_105  = 104,
        /*..*/
        GPTimerCC26XX_PRESCALE_240  = 239,
        /*..*/
        GPTimerCC26XX_PRESCALE_255  = 254,
        GPTimerCC26XX_PRESCALE_256  = 255,
    } GPTimerCC26XX_Prescale;
    
    //.....
    
    /*!
     *  @brief  Function to set the prescale of the GPTimer
     *
     *  @pre    GPTimerCC26XX_open() has to be called first successfully
     *
     *  @param  handle      A GPTimerCC26XX handle returned from GPTimerCC26XX_open
     *  @param  prescale    The prescales that should be set
     *
     *  @sa     GPTimerCC26XX_open()
     */
    extern void GPTimerCC26XX_setPrescale(GPTimerCC26XX_Handle handle, GPTimerCC26XX_Prescale prescale);
    

    and to GPTimerCC26XX.c:

    /*!
     *  @brief  Function to set prescale for the GPTimer
     */
    void GPTimerCC26XX_setPrescale(GPTimerCC26XX_Handle handle, GPTimerCC26XX_Prescale prescale)
    {
        GPTimerCC26XX_HWAttrs const *hwAttrs = handle->hwAttrs;
    
        /* Disable interrupts during RMW operation */
        uint32_t key = Hwi_disable();
    
        if (GPT_LUT[handle->timerPart].map == TIMER_A)
        {
          uint32_t tapr = HWREG(hwAttrs->baseAddr + GPT_O_TAPR);
          /* Clear old setting */
          tapr &= ~(GPT_TAPR_TAPSR_M);
          /* Apply new setting */
          HWREG(hwAttrs->baseAddr + GPT_O_TAPR) = tapr | (prescale);
        }
        else
        {
          uint32_t tbpr = HWREG(hwAttrs->baseAddr + GPT_O_TBPR);
          /* Clear old setting */
          tbpr &= ~(GPT_TBPR_TBPSR_M);
          /* Apply new setting */
          HWREG(hwAttrs->baseAddr + GPT_O_TBPR) = tbpr | (prescale);
        }
    
        /* Restore HW interrupts */
        Hwi_restore(key);
    }
    

    Example:

      GPTimerCC26XX_PinMux pinMux;
      PIN_Status pinStatus;
    
      /*
       * Setup GPT parameters
       */
      GPTimerCC26XX_Params_init(&timerParams);
      timerParams.width             = GPT_CONFIG_16BIT;
      timerParams.mode              = GPT_MODE_EDGE_TIME_UP;
      timerParams.debugStallMode    = GPTimerCC26XX_DEBUG_STALL_OFF;
      hIrDataTimer = GPTimerCC26XX_open(CC2650_GPTIMER0B, &timerParams);
    
      /*
       * Setup GPT & PIN
       */
      GPTimerCC26XX_setCaptureEdge(hIrDataTimer, GPTimerCC26XX_BOTH_EDGES);
      GPTimerCC26XX_setPrescale(hIrDataTimer, GPTimerCC26XX_PRESCALE_240);
      pinMux = GPTimerCC26XX_getPinMux(hIrDataTimer);
      pinStatus = PINCC26XX_setMux(irPinHandle, IOID_12, pinMux);
    

    Its working fine with TI-RTOS 2.16. I didn't try it on 2.20.

    You would need to read the reference manual to get it working properly.

    I hope it would help.

    Regards,

    Milorad

  • Hi Benjamin,

    When I made the driver I did not add configuration of the prescaler, therefore it is set to 1x prescaling (no prescaling) by default.

    To simplify the driver (=smaller footprint) it only supports the timer modes where the prescaler is used as a linear extension of the timer ( bits [23:16] ) and not a true prescaler (which would use the prescaler as bits [7:0]. These modes are described in the TAPR register:

    Timer A Pre-scale
    This register allows software to extend the range of the timers when they are used individually.
    When in one-shot or periodic down count modes, this register acts as a true prescaler for the timer counter.
    When acting as a true prescaler, the prescaler counts down to 0 before the value in TAR and TAV registers are incremented.
    In all other individual/split modes, this register is a linear extension of the upper range of the timer counter, holding bits 23:16 in the 16-bit modes of the 16/32-bit GPT.

    With the default settings you should be able to measure edge time up to 2^24 / 48MHz = 349ms.

    I am actually not sure how it would behave if you were to configure the prescaler when it is used as a linear extension of the timer but my guess is that the prescaler value configured through TAPR.TAPSR will simply be ignored.

    Regards,
    Svend

  • Hello Milorad,

    Thanks for your explanation.

    Does it work in edge time mode?

    For me it it not clear why to set the TxPR precount. It is (believing the ref manual) only important with the one shot or downcount modes but NOT in the capture mode. In this modes it become an extension to the TAR register. But 'GPTimerCC26XX_getValue' only reads the TAR register.

    When capturing the count on an edge, does the CC2650 move the actual counter value 16:24 (the precount extension) into the upper TAR?

    On the other hand, the manual says in chapter 13.4.3. in step 5 to write the prescale value. 

    I think the manual is a little confusing to me.

  • Hello Thomas,

    This is described in the TAR register:

    Timer A Register

    This register shows the current value of the Timer A counter in all cases except for Input Edge Count and Time modes. In the Input Edge Count mode, this register contains the number of edges that have occurred.  In the Input Edge Time mode, this register contains the time at which the last edge event took place.

    When a GPT is configured to one of the 32-bit modes, this register appears as a 32-bit register (the upper 16-bits correspond to the contents of the Timer B (TBR) register). In

    the16-bit Input Edge Count, Input Edge Time, and PWM modes, bits 15:0 contain the value of the counter and bits 23:16 contain the value of the prescaler, which is the upper 8 bits of the count. Bits 31:24 always read as 0. To read the value of the prescaler in 16-bit One-Shot and Periodic modes, read bits [23:16] in the TAV register. To read the value of the prescalar in periodic snapshot mode, read the Timer A Prescale Snapshot (TAPS) register.


    Regards,
    Svend

  • Hello Svend
    The brand-new ref manual holds this information, in the revised september 2015 version all this detailed info lacks.
    Finally, I succeed with capturing longer events!
    I wrote a value of 48 into the TxPR register to see if at least the timer retards.
    But it seems no matter what value is written, the captured value extends to 24 Bits.

    I suggest to extend the driver (GPTimerCC26xx.c) to cover this behaviour:

    static inline void TimerSetMode(uint32_t ui32Base, uint32_t timer, uint32_t mode)
    {
    uint32_t addr = ui32Base;
    uint32_t addr2 = ui32Base;

    if (timer == TIMER_B)
    {
    addr += GPT_O_TBMR;
    addr2 += GPT_O_TBPR;
    }
    else
    {
    addr += GPT_O_TAMR;
    addr2 += GPT_O_TAPR;
    }
    HWREG(addr) = mode;

    if ((mode & 3) == GPT_TAMR_TAMR_CAPTURE) {
    HWREG(addr2) = 48;
    }
    }

    Thanks a lot

    Thomas
  • You can see in the example that I'm using EDGE_TIME_UP and the capture mode is set on both edges.
    So I'm just counting the time upwards from one edge to another. It doesn’t matter which, rising or falling edge.
    If you wanted one pair of edges(like falling and rising and not vice versa), the logic would be more complex. You would need to use interrupts on rising edge and then stop the capturing process and check the time.
    You can see that I used PINCC26XX_setMux to route the pin to the capture timer.


    Regards,
    Milorad
  • Thanks again for the clarification Svend.

    I get it now. The use of the term 'prescaler' in relation to input capture edge time was confusing...but I see now it's just a way to get a 24 bit timer for 'free' essentially. I've tested it out, and it's working as expected.

    Thanks!

    -Ben

  • Hi,
    How can we set the timer interval using GP Timer?
    I want to set a Timer that generates an interrupt every 5 minutes.
    Is it possible to achieve the same using this driver?
  • Milorad,

    I ended up using your code, and just wanted to say thanks. You saved me a ton of time, and I really appreciate it.

    Thats all ;P

    -Ben

  • Glad I could help, Ben.

    Regards,

    Milorad

  • Hello everyone!

    I try to use this driver with tirtos 2.18 and BLE SDK 2.2.

    I follow guide in post to do changes for use with tirtos >=2.13.

    My project will compile successful, but OS crashes. I have the exception and looped While construction:

    /*
     *  ======== Hwi_excHandler ========
     */
    Void Hwi_excHandler(UInt *excStack, UInt lr)
    {
        Hwi_module->excActive[0] = TRUE;
    
        /* spin here if no exception handler is plugged */
        while (Hwi_excHandlerFunc == NULL) {
    	;
        }
    
        Hwi_excHandlerFunc(excStack, lr);
    }

    the study of ROV view has revealed:

    Something unknown exception.

    Please help!

  • Hi,

    Can you try to use the official release PWM driver from TI-RTOS 2.20?
  • Christin, many thanks! New driver works fine!
  • Is it possible to create a full-width PWM timer?

    Looking at the CC26xx Driver Library documentation suggests it's only possible for half-width timers: software-dl.ti.com/.../group__timer__api.html
  • Andrew,

    The timer has only PWM support in split mode. Since the prescaler is always used by the PWM driver you get 16+8= 24 bits resolution.

    Regards

    Svend

  • Thanks Svend. I managed to get the prescaler working and now have beautiful sound (at frequencies lower than 800Hz, too!) coming from my SensorTag :)
  • Do we have a pwm driver along with ble stack 2.2.0? or i need to follow these steps?
  • Yup. BLE SDK 2.2 depends on TI-RTOS 2.18.00.03, which includes a PWM driver for the CC26XX (PWMTimerCC26XX).

    Thanks,
    Tom
  • Thank you for your reply. So i will try to use pwm driver wich is available in 2.2.0 stack.  Any example project may help me. 
    What about  ADC driver? is it  available in in new stack,? 

  • Hi,

    Sorry for the confusion, the PWM driver in TI-RTOS 2.18 is not official release version.
    Please use PWM drivers from TI-RTOS 2.20 and copy the needed driver files into the corresponding folder. The modify the .c and .h files accordingly.

    Let me know if you need any help.

    BTW, in TI-RTOS 2.20, it comes together with PWM and ADC examples.
  • Thank you. Which project is pwm example? and which one is ADC example?
  • These folders are not in default ble stack . From where will I get this?
  • You have to download and install TI RTOS 2.20 from software-dl.ti.com/.../index.html
  • Hi,

    Can I use TI-RTOS 2.21.0.06 with an example project (Project Zero, imported from SimpleLink Academy 1.8)?  Is there a porting guide?  I've tried updating the path variable TI_RTOS_DRIVERS_BASE but that produces an Invalid Location error for RF.c.

    Or is the recommended approach to persist with 2.18.0.03 and copy across the driver files from 2.21.0.06?  It's all a little confusing with the TI Resource Explorer examples still using the 2.01 stack, and the RTOS still 2.20.00.06 - would hope these would be made the most up-to-date so this can become the single place of reference.  

    Regards,

    Evan

  • Hi,

    You should use TI-RTOS 2.18 with simplelink academy which uses BLE stack 2.2.

    It's recommended to copy the driver files fromTI-RTOS 2.20/2.21 to TI-RTOS 2.18 and use together with BLE stack. We are in the middle of writing a porting guide for this method, but there is not much you need to do other than modifying the board files and copying over the driver files.

    It looks like you are using CCS 6.2. In this case, you should use resource explore classic to import project for BLE stack 2.2
  • OK, thanks.  I think that's working now.

  • Hello, I use CCS 6.2 and TI-RTOS 2.18, I imported project zero and I want add PWM. I copyed drivers from TI-RTOS 2.20 like in guide : wiki.tiprocessors.com/.../CC2640_Porting_Projects
    then I modified board files.
    When compiling, I got the following error:

    Description Resource Path Location Type
    #10010 errors encountered during linking; "project_zero_app_cc2650em7id.out" not built project_zero_app_cc2650em7id C/C++ Problem
    Description Resource Path Location Type
    <a href="processors.wiki.ti.com/.../10234"> unresolved symbols remain project_zero_app_cc2650em7id C/C++ Problem
    Description Resource Path Location Type
    gmake: *** [project_zero_app_cc2650em7id.out] Error 1 project_zero_app_cc2650em7id C/C++ Problem
    Description Resource Path Location Type
    gmake: Target 'all' not remade because of errors. project_zero_app_cc2650em7id C/C++ Problem
    Description Resource Path Location Type
    unresolved symbol PWM_start, first referenced in <whole-program> project_zero_app_cc2650em7id C/C++ Problem

    Can you help me, please?
  • The problem was solved when i copied all drivers from TI-RTOS 2.20 except folder "rf"

  • Hello Sir,

    I am working with tirtos_cc13xx_cc26xx_2_20_01_08 version . I needed PWM function in my project with cc2650 lauchpad , and i have made correction as specified above in this post, but still I am getting following errors. Kindly help .

    >> Compilation failure
    gmake: *** [Drivers/timer/GPTimerCC26XX.obj] Error 1
    "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM2.h", line 577: warning #1-D: last line of file ends without a newline
    "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM2.h", line 278: error #102: "PWM_PERIOD_US" has already been declared in the current scope
    "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM2.h", line 279: error #102: "PWM_PERIOD_HZ" has already been declared in the current scope
    "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM2.h", line 280: error #102: "PWM_PERIOD_COUNTS" has already been declared in the current scope
    "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM2.h", line 290: error #102: "PWM_DUTY_US" has already been declared in the current scope
    "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM2.h", line 291: error #102: "PWM_DUTY_FRACTION" has already been declared in the current scope
    "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM2.h", line 292: error #102: "PWM_DUTY_COUNTS" has already been declared in the current scope
    "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM2.h", line 299: error #102: "PWM_IdleLevel" has already been declared in the current scope
    "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM2.h", line 301: error #102: "PWM_IDLE_LOW" has already been declared in the current scope
    "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM2.h", line 302: error #102: "PWM_IDLE_HIGH" has already been declared in the current scope
    "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM2.h", line 303: error #258: invalid redeclaration of type name "PWM_IdleLevel" (declared at line 249 of "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM.h")
    "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM2.h", line 313: error #102: "PWM_Params" has already been declared in the current scope
    "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM2.h", line 321: error #258: invalid redeclaration of type name "PWM_Params" (declared at line 267 of "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM.h")
    "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM2.h", line 327: warning #303-D: typedef name has already been declared (with same type)
    "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM2.h", line 334: warning #303-D: typedef name has already been declared (with same type)
    "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM2.h", line 340: warning #303-D: typedef name has already been declared (with same type)
    "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM2.h", line 347: warning #303-D: typedef name has already been declared (with same type)
    "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM2.h", line 353: error #258: invalid redeclaration of type name "PWM_OpenFxn" (declared at line 297 of "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM.h")
    "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM2.h", line 360: warning #303-D: typedef name has already been declared (with same type)
    "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM2.h", line 367: warning #303-D: typedef name has already been declared (with same type)
    "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM2.h", line 374: warning #303-D: typedef name has already been declared (with same type)
    "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM2.h", line 380: warning #303-D: typedef name has already been declared (with same type)
    "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM2.h", line 387: error #102: "PWM_FxnTable" has already been declared in the current scope
    "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM2.h", line 405: error #258: invalid redeclaration of type name "PWM_FxnTable" (declared at line 348 of "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM.h")
    "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM2.h", line 414: error #102: "PWM_Config" has already been declared in the current scope
    "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM2.h", line 422: error #258: invalid redeclaration of type name "PWM_Config" (declared at line 364 of "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM.h")
    "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM2.h", line 488: error #148: declaration is incompatible with "PWM_Handle PWM_open(unsigned int, PWM_Params *)" (declared at line 427 of "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM.h")
    "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM2.h", line 502: error #148: declaration is incompatible with "void PWM_Params_init(PWM_Params *)" (declared at line 441 of "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM.h")
    "C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/PWM2.h", line 577: warning #1-D: last line of file ends without a newline
    "C:/ti/simplelink/ble_sdk_2_02_01_18/src/target/board.c", line 108: error #20: identifier "CC2650_GPTIMERUNITSCOUNT" is undefined
    "C:/ti/simplelink/ble_sdk_2_02_01_18/src/target/board.c", line 108: error #150: variable "gptimerCC26xxHWAttrs" has already been initialized
    "C:/ti/simplelink/ble_sdk_2_02_01_18/src/target/board.c", line 120: error #20: identifier "CC2650_GPTIMERCOUNT" is undefined
    "C:/ti/simplelink/ble_sdk_2_02_01_18/src/target/board.c", line 123: error #150: variable "GPTimerCC26XX_config" has already been initialized
    "C:/ti/simplelink/ble_sdk_2_02_01_18/src/target/board.c", line 135: error #20: identifier "CC2650_PWMCOUNT" is undefined
    "C:/ti/simplelink/ble_sdk_2_02_01_18/src/target/board.c", line 136: error #20: identifier "CC2650_GPTIMER0A" is undefined
    "C:/ti/simplelink/ble_sdk_2_02_01_18/src/target/board.c", line 137: error #20: identifier "CC2650_GPTIMER0B" is undefined
    "C:/ti/simplelink/ble_sdk_2_02_01_18/src/target/board.c", line 152: error #150: variable "PWM_config" has already been initialized
    27 errors detected in the compilation of "C:/ti/simplelink/ble_sdk_2_02_01_18/src/target/board.c".

    >> Compilation failure
    gmake: *** [Startup/board.obj] Error 1
    'Finished building: C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages/ti/drivers/pwm/PWMCC26XX.c'
    ' '
    gmake: Target `all' not remade because of errors.

    **** Build Finished ****
  • This post is made for old BLE stack(BLE stack 2.1) to use pre-released PWM driver.

    The current BLE stack 2.2.1 already comes with TI-RTOS 2.20.01.08 which includes office released PWM drivers. You should not use the files here.
  • Hello Christin,
    I am looking at a similar problem, where I need to call ADC conversions every 10 microseconds.
    I saw that using the interrupt callback function generates a delay due to the overhead that involves.
    What did you mean by "directly output the EVENT to HW module"?

    Thank you
    Beatrice
  • Hi,

    In order to give you answer, I will need to know what are you going to do with the data. Do you need to have the data and process it at every 10us rate? Or do you just need the sampling rate to be 10us and accumulate the data to process later?
  • Hi, 

    thanks for your reply. 
    I need to process it directly (converting it to microvolts and sending it out via UART) .
    Is that doable in some way? 

  • Does it have to be real time? Is it acceptable that you process 20 samples or more at a time and send it through UART? This case the power consumption will be a lot lower and it's easier to accomplish this.
  • Hi, 

    Thanks again for your reply sending does not have to be real time although if that is possible it would be a bonus. 
    I tried processing several samples at a time and then sending them out via UART but my method still required to much power and thus the time constraints weren't met. 
    I would appreciate a suggestion on how to do this. 

    Thank you 

    Beatrice

  • It will be easier using sensor controller studio and the notify the main CPU once you collect enough data. Can you create another question based on this as I don't see this one is related to GPTimer.
  • Hi svenbt,

    I tried this with my CC2650 Launchpad + Educational Booster Pack MKII Buzzer and it works. Thanks for sharing.

    - kel