cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4xx DISCOVERY multiple ADC with DMA

bmarguerite19
Associate II
Posted on December 29, 2013 at 17:13

Hi

I want to use ADC-DMA to read 4 input of voltage. PA0, PA1, PA2 and PA4 on ADC3 IN0, IN1, IN2 and IN4.

I try to modify the code samples founded in STM32F4xx-Discovery_FW_V1.0.0 for STM32F4-DISCOVERY or for STM32F429-DISCOVERY but both don't work (my code) on theses boards.

In final i must read this four ADC inputs with a stable frequency, i want to use a Timer.

Someone can help me with sources please?

Thanks

I'm leaving in France
6 REPLIES 6
Posted on December 29, 2013 at 20:22

Continuous mode, two channels.

[DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Discovery/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Discovery/Multi%20Channel%20ADC%20reading&FolderCTID=0x01200200770978C69A1141439FE559EB459D75800084C20D8867EAD444A5987D47BE638E0F&currentviews=365]https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Discovery/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2FSTM32Discovery%2FMulti%20Channel%20ADC%20reading&FolderCTID=0x01200200770978C69A1141439FE559EB459D75800084C20D8867EAD444A5987D47BE638E0F¤tviews=365

Two channels, simultaneously, against timebase

[DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/stm32f207%20ADC%2BTIMER%2BDMA%20%20Poor%20Peripheral%20Library%20Examples&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=1573]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2Fcortex_mx_stm32%2Fstm32f207%20ADC%2BTIMER%2BDMA%20%20Poor%20Peripheral%20Library%20Examples&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=1573

Single channel, using timer/dma

https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/ADC%20trigger%20on%20timer%20update&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=88

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
bmarguerite19
Associate II
Posted on January 07, 2014 at 23:46

Happy New Year

I try your links and now the code works fine alone.

But when i want to read 4 ADC3 channels synchronized with TIM4, it don't work.

TIM4 is configuring to trig at frequency f2 TIM12 used for 1 PWM channel and it works. 

How configure one TIMx to trig the read of4 ADC3 channels at frequency f1 and TIM12 at frequency f2 ?  f1 = 80x f2  with f2 = 1/60µs = 8,333 337 KHz

Thanks

Posted on January 08, 2014 at 00:49

I don't have the time/resources to code this from scratch, post your semi-working example code framework and I'll see if I can understand it well enough to get it to working.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
bmarguerite19
Associate II
Posted on January 08, 2014 at 13:00

Hi CLive1

I prepare the project and take contact

raptorhal2
Lead
Posted on January 08, 2014 at 18:01

There are two more problems you need to consider:

PA4 is ADC12_IN4. PA4 is not connected to ADC3. And if you switch to ADC1 or ADC2, PA4 is also connected to the on board CS43L22 peripheral.

PA0 (ADC123_IN0) is also connected to the board pushbutton.

The discovery board User Manual has an MCU Pin Description table that identifies which pins are free for the user.

Cheers, Hal

bmarguerite19
Associate II
Posted on December 30, 2013 at 13:14

Hi clive1

Thank you for your reply

I'm looking the links and try to remake them

A+