Hello all,
I am trying to write an TI-RTOS app for the MSP432p401R launchpad and It seems whenever I enable the ADC14 interupts my tasks stop being called at all. I am wondering what I am doing wrong.
int main(void) { /* Call board init functions. */ Board_initGeneral(); Board_initGPIO(); // Board_initI2C(); // Board_initSDSPI(); // Board_initSPI(); // Board_initUART(); // Board_initWatchdog(); // Board_initWiFi(); /* Turn on user LED */ GPIO_write(Board_LED0, Board_LED_ON); /* Halting the Watchdog */ MAP_WDT_A_holdTimer(); /* Initializing Variables */ curADCResult = 0; /* Setting DCO to 48MHz */ MAP_PCM_setPowerState(PCM_AM_LDO_VCORE1); MAP_CS_setDCOCenteredFrequency(CS_DCO_FREQUENCY_48); /* Enabling the FPU for floating point operation */ MAP_FPU_enableModule(); MAP_FPU_enableLazyStacking(); /* Initializing ADC (MCLK/1/4) */ MAP_ADC14_enableModule(); MAP_ADC14_initModule(ADC_CLOCKSOURCE_MCLK, ADC_PREDIVIDER_1, ADC_DIVIDER_4, 0); /* Configuring GPIOs (5.5 A0) */ MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P5, GPIO_PIN5, GPIO_TERTIARY_MODULE_FUNCTION); /* Configuring ADC Memory */ MAP_ADC14_configureSingleSampleMode(ADC_MEM0, true); MAP_ADC14_configureConversionMemory(ADC_MEM0, ADC_VREFPOS_AVCC_VREFNEG_VSS, ADC_INPUT_A0, false); /* Configuring Sample Timer */ MAP_ADC14_enableSampleTimer(ADC_MANUAL_ITERATION); /* Enabling/Toggling Conversion */ MAP_ADC14_enableConversion(); MAP_ADC14_toggleConversionTrigger(); /* Enabling interrupts*/ MAP_ADC14_enableInterrupt(ADC_INT0); MAP_Interrupt_enableInterrupt(INT_ADC14); MAP_Interrupt_enableMaster(); /* while (1){ * MAP_PCM_gotoLPM0(); };*/ /* Start BIOS */ BIOS_start(); return (0); } void ADCClockFXN(){}; void adc_isr(void) { uint64_t status = MAP_ADC14_getEnabledInterruptStatus(); MAP_ADC14_clearInterruptFlag(status); Semaphore_post(sem); if (ADC_INT0 & status) { curADCResult = MAP_ADC14_getResult(ADC_MEM0); normalizedADCRes = (curADCResult * 3.3) / 16384; MAP_ADC14_toggleConversionTrigger(); } } void ADCTaskFxn(){ uint8_t i; fcomplex b,c; float auc=0.0; while(1){ uint16_t currentSample = 0; Semaphore_pend(sem,BIOS_WAIT_FOREVER); while(currentSample < SAMPLECOUNT) { //Sleep IDLE mode Task_sleep(1); // Trigger ADC sampl
and so on.
I have created all of the tasks and interrupts with the Gui.
Most of the above code was from a non-RTOS example that I am trying to port into an RTOS program. So I might be trying do do the impossible.
What I did was import the ADC14_single_sample_repeat example. I then created an empty RTOS project. I then copied the code from the ADC14 sample into the RTOS project. I created the tasks for my code and got all of it to compile. The ADC ISR works greate. But the tasks never get called.
These lines:
/* Enabling interrupts*/ MAP_ADC14_enableInterrupt(ADC_INT0); MAP_Interrupt_enableInterrupt(INT_ADC14); MAP_Interrupt_enableMaster();
seem to be the culprit, particularly MAP_Interrupt_enableInterrupt(INT_ADC14);
If I comment that line the tasks run but the adc isr doesn't. If I put that line in, the adc isr runs but the tasks don't.
Thanks for any help.
JP