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.

LAUNCHXL-F28069M: How to set highest priority for ADCINT1 peripheral?

Part Number: LAUNCHXL-F28069M
Other Parts Discussed in Thread: MOTORWARE

Dear all,

I want to set ADCINT1 (which link to the mainISR() function) to the highest priority because in my project I am planning to use 3 interrupts according to the following priority:

ADCINT1 is 1st

TIMER0INT is 2nd

SCIARX is 3rd

I referred to the document "Hardware Abstraction Layer (HAL) Module of MotorWare" which is updated for MotorWare v18, and did the following setup:

/* In hal.c file */
void HAL_enableAdcInts(HAL_Handle handle)
{
     HAL_Obj *obj = (HAL_Obj *)handle;
#ifdef ADCINT1_HIGHEST_PRIORITY
     // enable the PIE interrupts associated with the ADC interrupts
     PIE_enableAdcInt(obj->pieHandle, ADC_IntNumber_1HP);

     // enable the ADC interrupts
     ADC_enableInt(obj->adcHandle, ADC_IntNumber_1HP);

     // enable the cpu interrupt for ADC interrupts
     CPU_enableInt(obj->cpuHandle, CPU_IntNumber_1);
#else
     // enable the PIE interrupts associated with the ADC interrupts
     PIE_enableAdcInt(obj->pieHandle, ADC_IntNumber_1);

     // enable the ADC interrupts
     ADC_enableInt(obj->adcHandle, ADC_IntNumber_1);

     // enable the cpu interrupt for ADC interrupts
     CPU_enableInt(obj->cpuHandle, CPU_IntNumber_10);
#endif

} // end of HAL_enableAdcInts() function

In file hal.h, in the HAL_initIntVectorTable() function, setup the interrupt vectors:

#ifdef ADCINT1_HIGHEST_PRIORITY
   pie->ADCINT1_HP = &mainISR;
#else
   pie->ADCINT1 = &mainISR;    
#endif 

and in the HAL_acqAdcInts() function:

static inline void HAL_acqAdcInts(HAL_Handle handle, const ADC_IntNumber_e intNumber)
{
    HAL_Obj *obj = (HAL_Obj *)handle;

    ADC_clearIntFlag(obj->adcHandle, intNumber);

#ifdef ADCINT1_HIGHEST_PRIORITY
    PIE_clearInt(obj->pieHandle, PIE_GroupNumber_1);
#else
    PIE_clearInt(obj->pieHandle, PIE_GroupNumber_10);
#endif

   return;
} // end of HAL_acqAdcInts() function

And in the mainISR() function, I called:

interrupt void mainISR()
{

//Acknowledge the ADC interrupts
#ifdef ADCINT1_HIGHEST_PRIORITY
   HAL_acqAdcInts(halHandle, ADC_IntNumber_1HP);
#else
   HAL_acqAdcInts(halHandle, ADC_IntNumber_1);
#endif

  //Do something in this interrupt

} //end of the mainISR() function

----

But the above settings is only run when I undefined ADCINT1_HIGHEST_PRIORITY. In other words, I could not run ADCINT1 interrupt when using  ADCINT1_HIGHEST_PRIORITY setting.

Please help me to resolve this issue,

Thanks in advance,

  • Dear all,

    I resolved my above problem. The error is here I used wrong parameter in HAL_acqAdcInts() function.

    The true setting is:

    /* In hal.c file */
    void HAL_enableAdcInts(HAL_Handle handle)
    {
         HAL_Obj *obj = (HAL_Obj *)handle;
    #ifdef ADCINT1_HIGHEST_PRIORITY
         // enable the PIE interrupts associated with the ADC interrupts
         PIE_enableAdcInt(obj->pieHandle, ADC_IntNumber_1HP);
    
         // enable the ADC interrupts
         ADC_enableInt(obj->adcHandle, ADC_IntNumber_1);
    
         // enable the cpu interrupt for ADC interrupts
         CPU_enableInt(obj->cpuHandle, CPU_IntNumber_1);
    #else
         // enable the PIE interrupts associated with the ADC interrupts
         PIE_enableAdcInt(obj->pieHandle, ADC_IntNumber_1);
    
         // enable the ADC interrupts
         ADC_enableInt(obj->adcHandle, ADC_IntNumber_1);
    
         // enable the cpu interrupt for ADC interrupts
         CPU_enableInt(obj->cpuHandle, CPU_IntNumber_10);
    #endif
    
    } // end of HAL_enableAdcInts() function

    /* In the mainISR() function */

    interrupt void mainISR() { //Acknowledge the ADC interrupts //NOTE: Always using ADC_IntNumber_1 for both cases HAL_acqAdcInts(halHandle, ADC_IntNumber_1); //Do something in this interrupt } //end of the mainISR() function

    Thanks for those who regarded to this topic.

  • Hi Tran,

    Thanks for posting the resolution to your issue