cancel
Showing results for 
Search instead for 
Did you mean: 

Triple ADC sequence (6x measurements) + DMA [solved]

vincenthamp9
Associate III
Posted on March 28, 2015 at 18:54

Hello there

I'm trying to set up the triple ADC mode with DMA transfer. Sadly there is no actual HAL code example on how to achieve that. So far I've set up the ADCs in triple mode by - configuring 2x channels with rank1 and 2 for each ADC - sampletimes and delay times between consecutive samples are the same for all ADCs - set the number of conversion to 2 on all ADCs - set the EOCSelection to sequence on all ADCs (so that the EOC flag is set at the end of the sequence?) and the DMA by - using DMA2_Stream0 and channel 0 - setting peripheral increments - both data alignments to halfwords - circular mode so that the DMA counter is reset when getting continuous requests and then I started the whole thing by

HAL_ADC_Start(&hadc1);
HAL_ADC_Start(&hadc2);
HAL_ADC_Start(&hadc3);
HAL_ADCEx_MultiModeStart_DMA(&hadc1, (uint32_t*)buffer, 6);

starting each ADC and the DMA to write to my uint16_t array buffer[6]... So far so good. No inside my DMA IRQ I read the buffer content to other variables. The problem is that the array always only contains the readings from each rank1 channel. So instead of buffer = [0, 1, 2, 3, 4, 5] I get buffer = [0, 1, 2, 0, 1, 2] but with new readings. So the ADC measured channel0-2 twice instead of every channel once... Any ideas? /edit I forgot to mention that I work on an F.. if thats somehow relevant. Also if you need any code I'll gladly share it. I just figured that I probably forgot some minor thing during the initialization and dozen lines of code tend to confuse more than they help. /edit2 oh well... I forgot to set the ScanConvMode accordingly.
0 REPLIES 0