2013-09-13 8:54 AM
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!
#stm32f4-adc-dma2013-09-13 9:01 AM
The DMA is enabled with
/* Enable DMA request after last transfer (Multi-ADC mode) */
ADC_MultiModeDMARequestAfterLastTransferCmd(ENABLE);
My example is about five posts in here
/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/ADC%20in%20Dual%20Mode%20Simultaneously&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=235
2013-09-16 1:13 AM
Thank you very much! From your code I knew how ADC dual mode works.
2013-09-17 2:03 AM
Hello Clive1,
I run the code from you. It works very well. But I have also two questions:1. in this program the dual mode with extern trigger is used. But in main function you used also ADC_SoftwareStartConv(ADC1)is it necessary?2. In datasheet of stm32f40xx writes the maximal ADC Clock is 36 MHz. But in this case we have APB2CLK 84 MHz, use ADC_Prescaler_Div2, that means we use ADCCLK with 42 MHz. I see the example of MCD Application Team from standard peripherals library. They used also 42 MHz for the dual mode.What is the really maximal ADC clock for the stm32f4?Regards,We’re moving the ST Community to a new platform to give you a better and more reliable community experience.