Question
ADC in Dual Mode Simultaneously
Posted on July 22, 2013 at 15:27
Hi everyones,
I am stuying the example from STM32 libraries (ADC_DualModeRegulSimu). I understand how the whole program works but I need some information and I have few questions about this code confronting to my project.First of all, I need to convert 2 analog values simultaneously because I plan to compute a phase correlation (that's why I need the simultaneously conversion).In the code, the converted value are put in a word of length 32 bits : extern __IO uint16_t aADCDualConvertedValue[2];I want to stock the first and second value (half-word) in two vector that I have defined. I first decided to create a while statement like this :while(counter<Max && ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC && ADC_GetFlagStatus(ADC2, ADC_FLAG_EOC)) { vector1[counter] = aADCDualConvertedValue[0]; vector2[counter] = aADCDualConvertedValue[1]; counter++;}But, this method seems to be unsafe because, we can't be certain that aADCDualConvertedValue[0] and aADCDualConvertedValue[1] are sampled at the same time owing to the number of cycles taken by while conditions.So, what's the best way to stock the simultaneously data safely ?Another problem, the conversion starts like this (after initializing the two ADC) : ADC_SoftwareStartConv(ADC1);ADC_SoftwareStartConv(ADC2);
Does-it mean that ADC2 starts to convert one cycle after ADC1, thus first both samples are not converted simultaneously ?Thks. #adc #stm32
