Skip to main content
John Hite
Associate III
February 27, 2017
Question

Single ADC/DMA multi-channel setup

  • February 27, 2017
  • 2 replies
  • 805 views
Posted on February 28, 2017 at 00:06

Device: STM32F437

The code I am working on was setup to use interleaving but after doing some reading I get the impression that interleaving is only for multiple ADCs and we are using 2 channels on ADC3. So it seems we should use ADC_Mode_Independent. It is still not working and at least 3 questions come to mind.

Is interleaving only for multiple DMAs?

Can ADC_RegularChannelConfig() be used in non-interleaved mode? I changed .ADC_Mode to ADC_Mode_Independent but the data still seems interleaved.

We are using 2 channels on ADC3 with DMA interrupts but there is only one interrupt for DMA2 stream 0. When will the interrupt occur, after one channel is transferred or both? Is this the purpose of ADC_DMARequestAfterLastTransferCmd()?

Thanks,

JH

    This topic has been closed for replies.

    2 replies

    Tesla DeLorean
    Guru
    February 27, 2017
    Posted on February 28, 2017 at 00:38

    Interleaved might be better described as overlapping, where the sampling/conversion switch between a pair of ADC so the sustained throughput increases. You'd typically use One DMA channel, Two ADC, and read both samples via the CDR (Common Data Register), so a 32-bit read of two 16-bit registers.

    Dual (ADC1 and ADC2) or Triple (ADC1, ADC2 and ADC3) mode is where the 2 or 3 samples share a common measurement epoch.

    Interleave (ADC1 and ADC2), tighter sampling than ADC with multiple channels or continuous

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    S.Ma
    Principal
    February 28, 2017
    Posted on February 28, 2017 at 07:28

    For fun, was building a different SW low level APIs for STM32F437 where the 'spec' of the peripheral was C coded and buried in the code itself, leaving the programmer to just express their needs using application level terms. Here is an extract of this effort. Consider it as pseudo code. The interleave or any ADC cascading to boost the sampling rate goes above this ADC object (and did not take the time for it). In case it helps.

    ________________

    Attachments :

    Adc.c.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hyro&d=%2Fa%2F0X0000000bDL%2FuCk3LmsQMkUbc3Jw1zsaJfVwlBk9eJamK5bmX2FAt.g&asPdf=false

    Adc.h.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hyqc&d=%2Fa%2F0X0000000bDH%2F0MAINHIWKW.CwrvV9uxfVPzCH5na352IfxqTMbkoImQ&asPdf=false