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/LAUNCHXL-CC2650: Use both threads (task_construct and hwi_construct) for COMPA and other tasks

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

Tool/software: TI-RTOS

Hi,

I am using several tasks; one is heart beating example, another is COMPA interrupt.

The problem is when I added COMPA interrupt, another task is not working.

My input analog signal of COMPA is 1ms PWM signal. I expected the compa interrupt only works every 1ms at the rising time, but it keep working at the high level. 

So it goes to the compA (call function) every 20 us. I think this is the high priority than others. Right?

So my question is:

How can I only turn on INT_AUX_COMPA for the rising time so that other tasks can be working properly?

The following is my setting.

/* Construct heartBeat Task thread */
Task_Params_init(&taskParams);
taskParams.arg0 = 1000000 / Clock_tickPeriod;
taskParams.stackSize = TASKSTACKSIZE;
taskParams.stack = &task0Stack;
Task_construct(&task0Struct, (Task_FuncPtr)heartBeatFxn, &taskParams, NULL);

AUXWUCClockEnable(AUX_WUC_MODCLKEN0_ANAIF_M|AUX_WUC_MODCLKEN0_AUX_ADI4_M);
HapiSelectCompAInput(COMPA_IN_AUXIO3);
HapiSelectCompARef(COMPA_REF_AUXIO7);
HWREGB(AUX_ADI4_BASE + ADI_4_AUX_O_COMP) = ADI_4_AUX_COMP_COMPA_EN;

Hwi_Struct compaInt;
Hwi_Params hp;
Hwi_Params_init(&hp);
hp.enableInt = TRUE;
/* Construct hardware interrupt for COMPA event */
Hwi_construct(&compaInt, INT_AUX_COMPA, compA, &hp, NULL);

static void compA(UArg arg)
{

Hwi_clearInterrupt(INT_AUX_COMPA);

int compAeventAux= HWREGB(AUX_EVCTL_BASE + AUX_EVCTL_O_EVSTAT0) & AUX_EVCTL_EVSTAT0_AUX_COMPA;

if (compAeventAux > 0){
PIN_setOutputValue(ledPinHandle, Board_LED1, !PIN_getOutputValue(Board_LED1));
HWREGB(AUX_EVCTL_BASE + AUX_EVCTL_O_EVSTAT0) &= ~(AUX_EVCTL_EVSTAT0_AUX_COMPA);
}

}

Void heartBeatFxn(UArg arg0, UArg arg1)
{
while (1) {
Task_sleep((UInt)arg0);
PIN_setOutputValue(ledPinHandle, Board_LED0,
!PIN_getOutputValue(Board_LED0));

}
}

// Here I used two threads as examples.

Task_construct(&task0Struct, (Task_FuncPtr)heartBeatFxn, &taskParams, NULL);

Hwi_construct(&compaInt, INT_AUX_COMPA, compA, &hp, NULL);

BIOS_start();