AnsweredAssumed Answered

ADC conversion does not complete

Question asked by Gaston Schelotto on Jul 29, 2015
Latest reply on Sep 4, 2015 by Gaston Schelotto

Hello,

 

I've configured 5 ADC0 channels (ADC interrupt disabled) on KE02Z+KDS v3.0 as shown:

Untitled.png

and defined 2 groups (1st of channel 0 and 2nd of channel 1 to 4)

Untitled2.png

 

The goal is to get 1 ADC channel sample every 1ms (timer0 triggered) and 4 ADC channel samples every 10ms (timer1 triggered). Here's the initialization code:

 

LDD_ADC_TSample samplegroup[AD1_CHANNEL_COUNT] = {AD1_ADC0_SE2, AD1_ADC0_SE0, AD1_ADC0_SE1, AD1_ADC0_SE3, AD1_ADC0_SE6};
word acqValueGroup0[AD1_STATIC_GROUP_0_SAMPLE_COUNT];
word acqValueGroup1[AD1_STATIC_GROUP_1_SAMPLE_COUNT];
AD1_CreateSampleGroup(AD1_DeviceData, samplegroup, AD1_CHANNEL_COUNT);

 

for the first ADC channel (Timer0 ISR):

 

AD1_SelectSampleGroup(AD1_DeviceData, 0U);
AD1_StartSingleMeasurement(AD1_DeviceData);
while (!AD1_GetMeasurementCompleteStatus(AD1_DeviceData)) {}; // Wait for conversion completeness
AD1_GetMeasuredValues(AD1_DeviceData, acqValueGroup0);

 

and for the left 4 channels (Timer1 ISR):

 

AD1_SelectSampleGroup(AD1_DeviceData, 1U);
AD1_StartSingleMeasurement(AD1_DeviceData);
while (!AD1_GetMeasurementCompleteStatus(AD1_DeviceData));     // Wait for conversion completeness
AD1_GetMeasuredValues(AD1_DeviceData, acqValueGroup1);

 

The problem is the execution stuck in the while loop (conversion never ends). What I am missing?

 

regards,

gaston

Outcomes