cancel
Showing results for 
Search instead for 
Did you mean: 

STM32Cube two ADC with DMA problem

bartek
Associate
Posted on November 18, 2015 at 13:33

Good morning everyone!

I've been using STM32Cube code generator for a while now. 

Yesterday I've encountered a problem, while configuring ADC converters using DMA.

When I configure one converter with DMA and few channels, everything is ok.

But when I add second converter, program eneters some kind of a loop in second converter Start function.

I have made a video of the whole process I've gone through. I hope it shows the problem clearly. 

https://youtu.be/TyPK_lmNkWA

And here is the code example:

0690X00000604szQAA.png

I've tried at least 20 different configurations, with different ADC and DMA, settings, different converters, different MCU etc.

There was always the same issue.

Can you please specify if it's me making a configuration mistake somwhere, or is it a bug in the Cube generated code?

I will appreciate your support.

Sincerely,

Bartek

1 REPLY 1
matic
Associate III
Posted on November 18, 2015 at 20:20

Why don't you check where exactly does it stuck? Those HAL functions are huge...

I use the same uC with 2 ADCs too, but I use ADC1 and ADC2 because this combination can be used in DUAL mode. Thus, you only need one DMA channel which transfers both conversions (from ADC1 and ADC2) at once. If you have 4 conversions on each AD, you would have 4 DMA transfers. I think DUAL mode is not allowed for ADC1 and ADC3 combination.

Also, in DUAL mode you have to trigger only your master AD (ADC1) and this will automatically trigger slave AD (ADC2) at the same time.