cancel
Showing results for 
Search instead for 
Did you mean: 

Can't get Multiple ADCs working on STM32F303VCT6

davidharrison69
Associate II
Posted on April 01, 2015 at 22:11

Hi, I am using the STM32F303VCT6 chip on the STM32F3Discovery Kit. I want to use 37 of the 39 available ADC inputs for a data logger project.

I have successfully got ADC1 working with DMA1_Channel1 and ADC2 working with

DMA2_Channel1

. Each dumps 10 or so values into RAM using DMA. But I can't get either to work with their respective DMA channels 2,3 or 4. I want to effectively use all 4 ADCs simultaneously so I start each off on a single sequenced conversion and dump the 8-12 ADC values per ADC into RAM using DMA. I then wait until the next data dump period, which is 100-1000ms, log the previously converted ADC values, and start off the next conversion for each ADC.

Does anyone know why I can't effectively use DMA channels greater than 1 with the ADCs?

I have attached the source code for my ADC initialization. The GPIO pins have already been configured as Analog in pins before the ADCxInit() functions are called.

Thanks.

#dma #stm32-adc #adc
5 REPLIES 5
Posted on April 01, 2015 at 22:29

I'm not sure I have the time/patience to go through that, but my recollection (I don't use STM32F3 for anything here), is that the ADC units pair and then use 2 DMA unit to support 4x ADC. The Reference Manual no doubt details which DMA's would be workable.About 50% down the first page of this thread* is a Quad ADC F3 example, you'd need to expand the channels used, buffer sizes, etc keeping them all symmetrical. But should be serviceable.

*

 

Edit: Fixed broken link, original from 1-Apr-2015

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
davidharrison69
Associate II
Posted on April 02, 2015 at 16:36

Clive, I appreciate your input , especially knowing that STM32F3 is not your area of expertise. What I am confused about is that the

STM32F3

reference manual says that ADC Dual Mode

CAN

be used, not

Dual Mode

MUST

be used (if you want to use ADC1/2 or 3/4 together). That implies to me that Dual Mode

can optionally

be used, but is not mandatory. Surely all four ADCs can be operated independently of each other? The other strange thing I was reporting was thatthe ADCs 1/2 work independently using DMA1_Channel1and DMA2_Channel1 but not Channel2 for either DMA 1/2controller.

Anyway, I shall investigate the other thread you referred me to and try to use Dual Mode.

Thanks.

I'm not sure I have the time/patience to go through that, but my recollection (I don't use STM32F3 for anything here), is that the ADC units pair and then use 2 DMA unit to support 4x ADC. The Reference Manual no doubt details which DMA's would be workable.

About 50% down the first page of

https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Discovery/Flat.aspx?RootFolder=https%3a//my.st.com/public/STe2ecommunities/mcu/Lists/STM32Discovery/STM32F3%20Discovery%20next%20steps&FolderCTID=0x01200200770978C69A1141439FE559EB459D75800084C20D8867EAD444A5987D47BE638E0F&currentviews=3673

is a Quad ADC F3 example, you'd need to expand the channels used, buffer sizes, etc keeping them all symmetrical. But should be serviceable.

Hi, I am using the STM32F303VCT6 chip on the STM32F3Discovery Kit. I want to use 37 of the 39 available ADC inputs for a data logger project.

I have successfully got ADC1 working with DMA1_Channel1 and ADC2 working with DMA2_Channel1. Each dumps 10 or so values into RAM using DMA. But I can't get either to work with their respective DMA channels 2,3 or 4. I want to effectively use all 4 ADCs simultaneously so I start each off on a single sequenced conversion and dump the 8-12 ADC values per ADC into RAM using DMA. I then wait until the next data dump period, which is 100-1000ms,log the previously converted ADC values,and start off the next conversion for each ADC.

Does anyone know why I can't effectively use DMA channels greater than 1 with the ADCs?

I have attached the source code for my ADC initialization. The GPIO pins have already been configured as Analog in pins before the ADCxInit() functions are called.

Thanks.

raptorhal2
Lead
Posted on April 04, 2015 at 16:10

Check the DMA channels assignments at the end of the DMA Functional Description in the reference manual.

DMA1 Ch3 has no peripheral assignments. DMA1 Ch 4 is either ADC 2 or no assignments depending on processor version. I believe yo need to use DMA 2 for ADC3 & 4.

Cheers, Hal

davidharrison69
Associate II
Posted on April 04, 2015 at 18:27

Thanks, Hal. I hadn't realized until now that each peripheral must use specific DMA channels. I thought that each DMA channel was completely generic in its application.

I now have ADC1/2 working together in dual mode using DMA1_Channel1 and ADC3/4

working together in dual mode using DMA2_Channel5.

Thanks for your help.

aomri9
Associate
Posted on October 26, 2015 at 09:37

Hi David

i have problem in ADC4 configuration, 

about ADCx in STMF303RB, can i configure each ADCx (For exp ADC4) in

INDEPENDENT

mode ??

best regards.