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(¶ms);
params.period = 1000000;
params.periodUnits = Timer_PERIOD_US;
params.timerMode = Timer_CONTINUOUS_CALLBACK;
params.timerCallback = gpiotimer0;
g_timer_heartbeat1 = Timer_open(Board_TIMER2, ¶ms);
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;