cancel
Showing results for 
Search instead for 
Did you mean: 

Some Problems with triple Channel ADC -- STM32f4

breibold
Associate II
Posted on April 11, 2014 at 14:46

Hello Together,

I have a problem with my ADC. I tried to search through the Forum but I couldn't find a similar problem.

My plan is to read 6 different Analog Digital Channel on STM32F407 therefore I use ADC1, ADC2 and ADC3. On each of the ADC there are two input Channels. Now I tried to read out the Data in 1Mhz frequency. Therefore I configured my ADCs and my DMA2. The code of my initiation see below.

Now to the description of my Problem, I read out the 6 Channels, but only the first 3 Channels, 1 Channel of each ADC is updated in the Array “ADCConvertedValue[6]�? the other 3 Channels would not be read.

I am looking forward to read your answers and wish you a nice Weekend

Best Regards

Benjamin

5 REPLIES 5
Posted on April 11, 2014 at 15:39

I don't think you have the DMA set up correctly wrt the common ADC data register. I don't believe it packs the 8-bit pairs as a half word.

There is a triple mode example at the

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/Problem%20with%20ADC%20DMA%20and%20timer&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=1...

.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
breibold
Associate II
Posted on April 14, 2014 at 10:03

Hi Clive1, 

thank you for your request and the nice example. I changed the DMA Setup now but I don't understand, why the ADC is not using my second channel. Do you have some idea regarding to this?

I changed the DMA setup like your exampe to this:

  DMA_InitStructure.DMA_Channel = DMA_Channel_0;  

  DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)ADC_CDR_ADDRESS;

  DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)&ADCConvertedValue[0];

  DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralToMemory;

  DMA_InitStructure.DMA_BufferSize = (ADCSENSORn*MEASUREDDATA);

  DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;

  DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;

  DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Word;

  DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Word;

  DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;

  DMA_InitStructure.DMA_Priority = DMA_Priority_High;

  DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable;         

  DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_HalfFull;

  DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;

  DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;

  DMA_Init(DMA2_Stream0, &DMA_InitStructure);

Thank you very much.

Benjamin

Posted on April 15, 2014 at 03:19

but I don't understand, why the ADC is not using my second channel. Do you have some idea regarding to this?

Well it's got to SCAN the channels, and you have that disabled. ScanConvMode is disabled for a single channel, for multiple channels it would need to be enabled.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on April 15, 2014 at 03:21

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6jd&d=%2Fa%2F0X0000000buF%2F3SpNrJub_6K__z7JpoBTnaHN0VXkZPO2OkNFzo__YG0&asPdf=false
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
breibold
Associate II
Posted on April 15, 2014 at 10:39

Hi clive1,

thank you very much for your support! Now it is working fine :)

cheers

Benjamin