Part Number: CC1310
Other Parts Discussed in Thread: SYSBIOS
Tool/software: TI-RTOS
I need to generate 3kHz sine using CC1310, so I am using Timer object (not a Clock) with 45uS interval. In callback function I calculate sine value and feed it to PWM. Under CCS this approach is working, I could see 3kHz sine (after RC filtering). But when I stop debug-session and let my board run alone - timer is not running properly anymore, seems like it is running chaotically, not periodically, with interval way longer then expected, sometime seconds. I have simplified callback function, leave there just led toggling, watching it with oscilloscope, but problem is still there. Code sample is below. I have no other Timers to take all resources, I have two tasks and few Clocks, but I stop them temporally to debug this issue. I am on CCS 6.1.3, trying to update now.
Are there any suggestions? Are there another timer-like objects which will let me create stable fast time reference?
#include <ti/sysbios/hal/Timer.h>
static Timer_Params timebaseTimerParams;
static Timer_Handle TimeBaseTmr_handle;
Void TimeBaseFunc(UArg arg0) //callback function
{
PIN_setOutputValue(OutputsPinHandle, Board_LED1, !PIN_getOutputValue(Board_LED1)); //debug, to estimate how fast
}
...somewhere in main()...
if (TimeBaseTmr_handle == NULL)
{
Timer_Params_init (&timebaseTimerParams);
timebaseTimerParams.period=45; //45 uS
timebaseTimerParams.periodType=Timer_PeriodType_MICROSECS;
timebaseTimerParams.arg=1;
TimeBaseTmr_handle = Timer_create(Timer_ANY, TimeBaseFunc, &timebaseTimerParams, NULL);
}
if (TimeBaseTmr_handle == NULL) {System_abort("TimeBaseTmr create failed\n");}
Timer_start(TimeBaseTmr_handle);