Part Number: TI-RTOS-MCU
Tool/software: Code Composer Studio
Hello, I'm having some problems with initializing hardware with tasks. I have these two tasks which will initialize the SPI and a Timer working as a source interruption. I want to run these tasks only once, so I'm putting them at a really high priority and then calling Task_exit() in the end to delete them later on.
It's not working very well as this task is giving my a gigantic negative number for the priority of the SPI task in ROV. Also, if I run only the timer task, it never terminates and I don't know why (it should, right? Even without the Task_exit()).
I'm using the blestack with another thread with is executing with the lowest priority next to Idle, which runs my bluetooth application - that in turn relies on the timer and spi -. Can anyone help out? Thanks.
/* TIMER TASK */
#define TIMER_TASK_PRIORITY 6
#define TIMER_TASK_STACK_SIZE 512
/*SPI TASK*/
#define SPI_TASK_PRIORITY 7
#define SPI_TASK_STACK_SIZE 512
...
void spiCreateTask(void){ Task_Params taskParams; Task_Params_init(&taskParams); taskParams.stack = spiTaskStack; taskParams.stackSize = SPI_TASK_STACK_SIZE; taskParams.priority = SPI_TASK_PRIORITY; //Same as before, defaults to some value in Task_construct spiTask = Task_create((Task_FuncPtr)spiConfigTaskFunction, &taskParams, NULL); } void timerConfigTaskFunction() { DEBUG("TIMER TASK CONFIG FUNCTION"); GPTimerCC26XX_Params params; GPTimerCC26XX_Params_init(¶ms); params.width = GPT_CONFIG_16BIT; params.mode = GPT_MODE_PERIODIC_UP; params.debugStallMode = GPTimerCC26XX_DEBUG_STALL_OFF; hTimer = GPTimerCC26XX_open(Board_GPTIMER0A, ¶ms); if(hTimer == NULL) { Task_exit(); } Power_setDependency(PowerCC26XX_XOSC_HF); Types_FreqHz freq; BIOS_getCpuFreq(&freq); GPTimerCC26XX_Value loadVal = freq.lo / 10000 - 1; //47999 GPTimerCC26XX_setLoadValue(hTimer, loadVal); GPTimerCC26XX_registerInterrupt(hTimer, (GPTimerCC26XX_HwiFxn)timerCallback, GPT_INT_TIMEOUT); //GPTimerCC26XX_start(hTimer); Where to start? //System_printf("...") Task_exit(); } void timerCreateTask(void) { Task_Params taskParams; Task_Params_init(&taskParams); taskParams.stack = timerTaskStack; taskParams.stackSize = TIMER_TASK_STACK_SIZE; taskParams.priority = TIMER_TASK_PRIORITY; //Same as before, defaults to some value in Task_construct timerTask = Task_create((Task_FuncPtr)timerConfigTaskFunction, &taskParams, NULL); if (timerTask == NULL){ System_abort("Error creating timer task."); } }