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.

RTOS/CC3220SF-LAUNCHXL: Multiple times

Part Number: CC3220SF-LAUNCHXL
Other Parts Discussed in Thread: CC3220SF

Tool/software: TI-RTOS

I am trying to use two different timers. I used gpiointerrupt project and added the code from Timer.h in the driver/timer.h from the

C:\ti\simplelink_cc32xx_sdk_1_50_00_06\source\ti\drivers library.

I can always start the timer associated with  Board_TIMER0; I believe it maps to a 32bit timer;

I want to use 2 and 3, which are 16 bit timers. Both fail with same exact code as using Board_TIMER0 ;

I use the exact code from the exmple in Timer.h and I  do call Timer_Init(); It fails the open call;

void gpiotimer0(Timer_Handle myHandle)
{
    /* Clear the GPIO interrupt and toggle an LED */
    GPIO_toggle(Board_GPIO_LED0);
}
................ from main as part of gpiointerrup.c - I removed all the GPIO interrupt stuff to use the platform for a test

   Timer_Params params;
    Timer_Params params1;
    volatile Timer_Handle g_timer_heartbeat1;;
    volatile Timer_Handle g_timer_heartbeat2;;

    Timer_init();

    /* Setting up the timer in continuous callback mode that calls the callback
     * function every 1,000,000 microseconds, or 1 second.
     */
    Timer_Params_init(&params);
    params.period = 1000000;
    params.periodUnits = Timer_PERIOD_US;
    params.timerMode = Timer_CONTINUOUS_CALLBACK;
    params.timerCallback = gpiotimer0;

    g_timer_heartbeat1 = Timer_open(Board_TIMER2, &params);

    if (g_timer_heartbeat1 == NULL)
    {
        /* Failed to initialized timer */
        while (1)
            ;
    }
*******************************************************************************

From Board.h

#define Board_TIMER0                 CC3220SF_LAUNCHXL_TIMER0
#define Board_TIMER1                 CC3220SF_LAUNCHXL_TIMER1
#define Board_TIMER2                 CC3220SF_LAUNCHXL_TIMER2

           From the CC3220SF_LAUNCHXL.H


typedef enum CC3220SF_LAUNCHXL_TimerName {
    CC3220SF_LAUNCHXL_TIMER0 = 0,
    CC3220SF_LAUNCHXL_TIMER1,
    CC3220SF_LAUNCHXL_TIMER2,

    CC3220SF_LAUNCHXL_TIMERCOUNT
} CC3220SF_LAUNCHXL_TimerName;

****************************************************

From the CC3220SF_LAUNCHXL.C


TimerCC32XX_Object timerCC3220SFObjects[CC3220SF_LAUNCHXL_TIMERCOUNT];

const TimerCC32XX_HWAttrs timerCC3220SFHWAttrs[CC3220SF_LAUNCHXL_TIMERCOUNT] = {
    {
        .baseAddress = TIMERA0_BASE,
        .subTimer = TimerCC32XX_timer32,
        .intNum = INT_TIMERA0A,
        .intPriority = ~0
    },
    {
        .baseAddress = TIMERA1_BASE,
        .subTimer = TimerCC32XX_timer16A,
        .intNum = INT_TIMERA1A,
        .intPriority = ~0
    },
    {
         .baseAddress = TIMERA1_BASE,
         .subTimer = TimerCC32XX_timer16B,
         .intNum = INT_TIMERA1B,
         .intPriority = ~0
    },
};

const Timer_Config Timer_config[CC3220SF_LAUNCHXL_TIMERCOUNT] = {
    {
        .fxnTablePtr = &TimerCC32XX_fxnTable,
        .object = &timerCC3220SFObjects[CC3220SF_LAUNCHXL_TIMER0],
        .hwAttrs = &timerCC3220SFHWAttrs[CC3220SF_LAUNCHXL_TIMER0]
    },
    {
        .fxnTablePtr = &TimerCC32XX_fxnTable,
        .object = &timerCC3220SFObjects[CC3220SF_LAUNCHXL_TIMER1],
        .hwAttrs = &timerCC3220SFHWAttrs[CC3220SF_LAUNCHXL_TIMER1]
    },
    {
        .fxnTablePtr = &TimerCC32XX_fxnTable,
        .object = &timerCC3220SFObjects[CC3220SF_LAUNCHXL_TIMER2],
        .hwAttrs = &timerCC3220SFHWAttrs[CC3220SF_LAUNCHXL_TIMER2]
    },
};

const uint_least8_t Timer_count = CC3220SF_LAUNCHXL_TIMERCOUNT;

  • Hi,

    What error are you getting when you try debugging? I believe you are not configuring timer 2 properly before trying to open it. 

    Please review the TimerLED example and then replicate it for timer 2.

    Regards,

    Charles O

  • Charles,

    First,  thanx for your time.

    I want to keep it as simple as possible. I built the timerled example and ran it without any changes. Board_TIMER0 works fine. I then changed only Board_TIMER0 to Board_TIMER1  in the open call and it fails. Same happens to Board_TIMER2;

    Shouldn't I be able to use one of the 16 bit timers (Board_TIMER1 or Board_TIMER2, or both ) in  this configuration. In this use case,I changed nothing from the build settings. I used the Ti-rtos version.

    Thanx,

    Mark

  • Hi,

    Simply changing that does not set all the other configurations that need to be set from TImer0 to timer 1. There is a bit more to it than that.

    Please go through the example to understand how it works and then make the needed changes.

    Regards,
    Charles O
  • Charles,

    I need to be clear. I am using the timer led example and changing the Board_TIMER0 to Board_TIMER1.

    No other changes.
    It appears when I debug that the Board_TIMER1 open call fails.

    In the Timer_Open() call, I check the Timer_config table and the three entries are all valid, function pointers are all the same for the open, close, etc.;

    It returns an invalid handle on the return from the open call.

    What configuration do I need to make to get the timerled example to use any other timer than Board_TIMER0? I you would explain that to me, I can go from there on my own app.