AnsweredAssumed Answered

fast ADC conversion for more than one channel

Question asked by Heinz Roitner on Sep 26, 2014
Latest reply on Oct 3, 2014 by Heinz Roitner


Hi Rene Kolarik,

 

I would like to continue the discussion of thread 329507. We are looking for a fast sample conversion on the internal ADC for 8 channels (for the history of this problem please see threads 317871 and 328250).  Previous implementations using LWADC were either very slow

(450 us) or they did not give 8 different samples.

 

So we implemented a solution along the description in thread 329507 which is fast and gives different samples. But the debugger shows all kinds of strange behavior as soon as more than one channel is converted.

 

So the question is: is MQX somehow affected when more channels are converted ? If yes, can you think of another way of implementation ?

 

Our ISR is:

 

 

void iADC_ISR (void * adc_ch)

 

{

 

 

// get last sample

 

ADC_MemMapPtr adc_ptr = adc_base[current_conv_ch];

 

uint32_t temp = adc_ptr->R1;

 

temp = temp & ADC_CDR_CDATA_MASK;

 

g_iADC0_values[current_conv_ch] = (float)(temp);

 

// start next conversion

 

current_conv_ch = (current_conv_ch + 1) % noChannels;

 

if (current_conv_ch == 0)

 

{

 

// stop sampling

 

}

 

else

 

{

 

adc_ptr = adc_base[current_conv_ch];

 

uint_32 channel = ADC_CHANNEL(inputs[current_conv_ch]);

 

adc_base[current_conv_ch]->HC1 = channel | (1 << ADC_HC1_AIEN1_SHIFT);

 

}

 

 

 

}

 

 

We are using the twrvf65gs10 BSP.

 

Thanks, Heinz

Outcomes