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];

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 ?


  • \$\begingroup\$ As Andy says, but if you can oversample the signal, you might be able to still use the non-simultaneous converter. You just have to take the delay between two conversions into account. Anyway to archive a good correlation value, the samples should be equidistant. This is only guarantied when using automatic conversions (triggered by a timer). \$\endgroup\$
    – Alexander
    Commented Jul 25, 2013 at 17:27
  • \$\begingroup\$ The part in question has multiple actual ADCs, and the code shown is using them. You should be able to trigger them both from a timer, and would probably want to do that to avoid the jitter of interrupt latency likely to result from using a software trigger. Once your trigger timing is hardware determined, slight variation in collecting the results shouldn't matter, as long as you don't read before they are ready or so late that you get those of the next conversion. \$\endgroup\$ Commented Jul 26, 2013 at 3:39
  • \$\begingroup\$ You should use one buffer that reads the converted values of both ADCs. my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/… \$\endgroup\$
    – user31045
    Commented Oct 29, 2013 at 19:00
  • \$\begingroup\$ I have used this DMA mode with two coupled ADC on the F3 devices (same F4 core, multiple ADC) both in simultaneous and interleved modes. RM0090 pg 290 speaks and provided you trigger per @Chris Stratton they will be simultaneous. AN3116 (st.com/web/en/resource/technical/document/application_note/…) AN4195 (st.com/web/en/resource/technical/document/application_note/…) refer \$\endgroup\$
    – ChrisR
    Commented Jan 18, 2016 at 13:50

1 Answer 1


Looking at the hardware of the basic STM unit I'd say there was one ADC and that means no simultaneous sampling. The 16 inputs are likely to be available due to it having an addressable multiplxer which can route one of the 16 to the single ADC input: -

enter image description here

EDIT However, looking at the STM34F4 device it says this (and thanks to Chris Stratton for pointing this out): -

enter image description here

Because the device can do simultaneous sample and hold then this will fit the bill.

  • \$\begingroup\$ Out of curiosity: Isn't the LTC1407 also sampling only one of the differential pairs at once? It has an input multiplexer, too. So it is not really helping in this case, I think. \$\endgroup\$
    – Alexander
    Commented Jul 25, 2013 at 17:21
  • \$\begingroup\$ @Alexander Aha! It has individual sample and hold circuits that sample together thus storing two simultaneous measurments - after that it doesn't matter how long it takes the ADC to do one channel then the other as long as the samples were taken together. \$\endgroup\$
    – Andy aka
    Commented Jul 25, 2013 at 18:25
  • \$\begingroup\$ Ah right, thanks a lot! Sampling and quantization, two steps ;-) \$\endgroup\$
    – Alexander
    Commented Jul 25, 2013 at 18:30
  • 1
    \$\begingroup\$ -1 Misleading You have posted the data sheet of an entirely different and substantially more limited stm32 series sub-family. The F4 mentioned in the question, in addition to being a Cortex-M4 rather than the Cortex-M3 STM32F101 you show has up to 3 ADCs depending on the specific device/package chosen. \$\endgroup\$ Commented Jul 26, 2013 at 2:41
  • \$\begingroup\$ @ChrisStratton thanks Chris I've amended my answer \$\endgroup\$
    – Andy aka
    Commented Jul 26, 2013 at 7:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.