[S12ZVC] Stucked in ADC0CONIF loop after wake-up

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

[S12ZVC] Stucked in ADC0CONIF loop after wake-up

871 Views
daehyeonkim
Contributor II

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?

0 Kudos
Reply
1 Reply

514 Views
RadekS
NXP Employee
NXP Employee

Hi Daehyeon,

In fact, I am not exactly sure why it does not work.

Please check conversion flow errors in the ADCEIF register.

Please be aware that errors signalized by IA_EIF, CMD_EIF, EOL_EIF and TRIG_EIF flags must be handled by ADC Soft-Reset.

Please check also your settings of AUT_RSTA bit in ADCCTL_1 register.

Anyway, the Restart Event is expected after exiting MCU Stop Mode. See chapter 9.2.1.2 MCU Operating Modes in RM for more details.

 

Please be aware that there is e8188 errata related to ADC and stop mode:

http://www.nxp.com/assets/documents/data/en/errata/S12ZVC_0N23N.pdf

I hope it helps you.

Have a great day,
Radek

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply