AnsweredAssumed Answered

stm32f4 adc dual model with dma

Question asked by Stefan2005 on Sep 13, 2013
Latest reply on Sep 17, 2013 by Stefan2005
hello everyone,

Now I use stm32f4 discovery. I want to use ADC example "ADC_DualModeRegulSimu" from the StdPeriph_Lib_V1.1.0 Project.

I have following questions:
1. They use ADC Dual Mode with DMA, but they don't active ADC_DMA(ADC1, enable);
2. In ADCx_CH10_CH11_Config() they selected 
  ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1;
I don't know why is it? They used softwarestart of ADC, otherwise they don't active the trigger edge.

3. in DMA_Config() 
    DMA_InitStructure.DMA_Channel = DMA_Channel_0; 
  DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)&aADCDualConvertedValue;
  DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)ADC_CCR_ADDRESS;
  DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralToMemory;
  DMA_InitStructure.DMA_BufferSize = 4;
  DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
  DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
  DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;
  DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;


I think ADC_CCR should be CDR.
 But in Dual Mode high 16 Bits of CDR save ADC2 data and low 16 Bits save ADC1 data. DMA_PeripheralDataSize should be defined as Word (32Bits) or I didn't really understand the data transfer between ADC_CDR and DMA_Memory. CDR send data of CH10 (ADC1), CH11(ADC2), CH11(ADC1), CH12(ADC2) in this example, the data in CDR has to be sent two times? 
(CDR(15:0) then CDR(31:16)?).

Thank you very much for your attention and hope your answer!

Outcomes