2020-07-15 05:53 AM
Hi
I tried to use ADC 2 Channel Scan Mode with DMA circular but it didn't work...and very strange point is when i init DAC with DMA , ADC works. |:
anybody knows why?
how i use ADC DMA without DAC initialize?
thanks for your help.
the ADC configurations :
hadc1.Instance = ADC1;
hadc1.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV2;
hadc1.Init.Resolution = ADC_RESOLUTION_8B;
hadc1.Init.ScanConvMode = ADC_SCAN_ENABLE;
hadc1.Init.ContinuousConvMode = DISABLE;
hadc1.Init.DiscontinuousConvMode = ENABLE;
hadc1.Init.NbrOfDiscConversion = 1;
hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_RISING;
hadc1.Init.ExternalTrigConv = ADC_EXTERNALTRIGCONV_T2_TRGO;
hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT;
hadc1.Init.NbrOfConversion = 2;
hadc1.Init.DMAContinuousRequests = ENABLE;
hadc1.Init.EOCSelection = ADC_EOC_SINGLE_CONV;
sConfig.Channel = ADC_CHANNEL_0;
sConfig.Rank = ADC_REGULAR_RANK_1;
sConfig.SamplingTime = ADC_SAMPLETIME_15CYCLES;
sConfig.Channel = ADC_CHANNEL_6;
sConfig.Rank = ADC_REGULAR_RANK_2;
2020-07-15 05:57 AM
Read out and compare the content of ADC and DMA (and TIM2) registers between the working and non-working cases.
JW
2020-07-15 09:12 PM
Obviously initializing the DAC is not required for the ADC DMA to function correctly. The answer must be simpler. Possibly a relevant DMA clock is initialized by the DAC initialization that is missed or incorrectly sequenced in the ADC initialization. The issue is not in the code you linked.
2020-07-15 09:41 PM
Thank you for reply ,TDK.
the ADC,DAC and DMA initialized by CubeMx.
shouldn't i trust the cube??
2020-07-15 09:51 PM