AnsweredAssumed Answered

[S12ZVC] Stucked in ADC0CONIF loop after wake-up

Question asked by daehyeon kim on May 7, 2017
Latest reply on May 9, 2017 by Radek Sestak

Hello,

 

I always appreciate your help on this community.

(Because my country's NXP distributors they answer is really slow and

not good as here)

I have one more question here.

My application has ADC and wake-up function using HVI interrupt,

can be shown in this simple flow,

 

// =================================================

void main(void) {

   Initialize();

 

   while(1) {

      ADConverter();

      if(CONDITION)

         asm_STOP;

      ADC0FLWCTL_TRIG = 1; 

   }

}

 

void ADConverter(void) {

   while (!(ADC0CONIF)){    // <= stucked in here

      // Toggling output pin for test

   }
   ADC0CONIF = ADC0CONIF;

   // ... using ADC //   

}

 

void interrupt 12 TIM_OutputCompare_ISR(void) {

   // ... Timer //

   if(m_sec == 100) {

      m_sec = 0;

      CAN_send();

   }

}

 

void interrupt 79 HVI_ISR(void)
{
 PIFL = 0x02;
 while(CPMUIFLG_UPOSC == 0) {}
}

// =================================================

 

normally, it works well but after wake up,

the program is stucked in the ADC flag check loop.

For preventing collision with STOP function,

I have turned ADC enable bit to disable just before STOP mode

and turn it back to enable after STOP mode line.

but it dosen't work yet.

Do you have any idea with this?

Outcomes