AnsweredAssumed Answered

ADC Accuracy in MKE04

Question asked by Prasanna Naik on Jul 10, 2019
Latest reply on Jul 11, 2019 by Jing Pan

Hi,

   I am using MKE04Z64VLH4 in a control application. The ADC output is fluctuating a lot (Variation of 20 counts at DC input of 1.65V with only 3mV ripple in VDD and ADC input). 

While debugging, we have observed a note in datasheet to operate ADC in stop mode or wait state to get desired accuracy. I am trying to use wait state instruction in a PIT timer(625usec) but the controller gets stuck at that instruction whereas when i am using the same instruction in while(1), the controller works fine.

 

What exactly is the problem when shifting the controller to wait state inside PIT's ISR?

 

Also, Is there any other way wherein i don't have to stop or put the controller in wait state to get the desired accuracy as this wait/stop time is reducing the CPU utilization.

 

Please refer following code where i am facing the problem:

 

void PIT_Task_Channel0(void)

{

      ADC_SetChannel(ADC,ADC_CHANNEL_AD9);

      ADC_SetChannel(ADC,ADC_CHANNEL_AD13);

      asm("wfi");

}/*Code gets stuck at this brace*/

 

Thanks and best regards,

Prasanna

Outcomes