void ADC1_DMA_Config (void) { GPIO_InitTypeDef GPIO_InitStructure; DMA_InitTypeDef DMA_InitStructure; ADC_InitTypeDef ADC_InitStructure; RCC->APB2RSTR |= RCC_APB2Periph_ADC1; // przywrocenie wartosci domyslnych RCC->APB2RSTR &= (~RCC_APB2Periph_ADC1); RCC->AHBENR |=RCC_AHBPeriph_GPIOC; // na wypadek gdyby tak jeszcze nie byl wlaczony RCC->APB2ENR |= RCC_APB2Periph_ADC1; // taktowanie dla ADC1 RCC->AHBENR |= RCC_AHBPeriph_DMA1; // taktowanie dla DMA1 GPIO_StructInit(&GPIO_InitStructure); // PC0 - ADC_IN10 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 ; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ; GPIO_Init(GPIOC, &GPIO_InitStructure); GPIO_StructInit(&GPIO_InitStructure); // PC1 - ADC_IN11 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 ; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ; GPIO_Init(GPIOC, &GPIO_InitStructure); GPIO_StructInit(&GPIO_InitStructure); // PC2 - ADC_IN12 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2 ; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ; GPIO_Init(GPIOC, &GPIO_InitStructure); GPIO_StructInit(&GPIO_InitStructure); // PC3 - ADC_IN13 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3 ; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ; GPIO_Init(GPIOC, &GPIO_InitStructure); // DMA1 Channel1 Config DMA_DeInit(DMA1_Channel1); DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)ADC1_DR_Address; DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)(&ADC_DATA[mbrm_adc_val_0]); DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC; DMA_InitStructure.DMA_BufferSize = adc_val_len; adc_val_len=7 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; DMA_InitStructure.DMA_Mode = DMA_Mode_Circular; DMA_InitStructure.DMA_Priority = DMA_Priority_High; DMA_InitStructure.DMA_M2M = DMA_M2M_Disable; DMA_Init(DMA1_Channel1, &DMA_InitStructure); DMA1_Channel1->CCR |= DMA_CCR_EN; // Channel1 enable ADC_DMARequestModeConfig(ADC1, ADC_DMAMode_Circular); // ADC DMA request in circular mode ADC1->CFGR1 |= (uint32_t)ADC_CFGR1_DMAEN; // Enable ADC_DMA ADC_StructInit(&ADC_InitStructure); ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b; ADC_InitStructure.ADC_ContinuousConvMode = ENABLE; ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None; ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; //ADC_InitStructure.ADC_ScanDirection = ADC_ScanDirection_Backward; ADC_InitStructure.ADC_ScanDirection = ADC_ScanDirection_Upward; ADC_Init(ADC1, &ADC_InitStructure); ADC_ChannelConfig(ADC1, ADC_Channel_10 , ADC_SampleTime_55_5Cycles); ADC_ChannelConfig(ADC1, ADC_Channel_11 , ADC_SampleTime_55_5Cycles); ADC_ChannelConfig(ADC1, ADC_Channel_12 , ADC_SampleTime_55_5Cycles); ADC_ChannelConfig(ADC1, ADC_Channel_13 , ADC_SampleTime_55_5Cycles); ADC_ChannelConfig(ADC1, ADC_Channel_TempSensor , ADC_SampleTime_55_5Cycles);//Convert the ADC1 temperature sensor with 55.5 Cycles as sampling time ADC_ChannelConfig(ADC1, ADC_Channel_Vrefint , ADC_SampleTime_55_5Cycles); // Convert the ADC1 Vref with 55.5 Cycles as sampling time ADC_ChannelConfig(ADC1, ADC_Channel_Vbat , ADC_SampleTime_55_5Cycles); // Convert the ADC1 Vbat with 55.5 Cycles as sampling time ADC->CCR |= (uint32_t) (ADC_CCR_TSEN|ADC_CCR_VREFEN|ADC_CCR_VBATEN); ADC_GetCalibrationFactor(ADC1); // ADC Calibration (funkcja od razu sprawdza calibration status) // Enable ADC1 ADC1->CR |= (uint32_t)ADC_CR_ADEN; //ADC_Cmd(ADC1, ENABLE); // Wait the ADCEN falg while(!ADC_GetFlagStatus(ADC1, ADC_FLAG_ADEN)); // ADC1 regular Software Start Conv ADC1->CR |= (uint32_t)ADC_CR_ADSTART; //ADC_StartOfConversion(ADC1); } Board STM32F0 Discovery, measurment on 4 analog inputs: PC0 - ADC_IN10 PC1 - ADC_IN11 PC2 - ADC_IN12 PC3 - ADC_IN13 and Vbat, Vref, Vtemp. Configuration of ADC1 and DMA is shown in attachment. for "ADC_InitStructure.ADC_ScanDirection = ADC_ScanDirection_Upward" content of table looks like below: ADC_DATA[0]=2034 ADC_DATA[1]=2273 - PC0 ADC_DATA[2]=2069 - PC1 ADC_DATA[3]=2000 - PC2 ADC_DATA[4]=2225 - PC3 ADC_DATA[5]=1950 ADC_DATA[6]=1695 for: "ADC_InitStructure.ADC_ScanDirection = ADC_ScanDirection_Backward" content of table looks like below: ADC_DATA[0]=2135 - PC0 ADC_DATA[1]=2051 ADC_DATA[2]=1702 ADC_DATA[3]=1945 ADC_DATA[4]=2251 - PC3 ADC_DATA[5]=2078 - PC2 ADC_DATA[6]=2071 - PC1 results of measurements are transmitted via uart every 1 second (pure ascii string). place of result of measurement of PC0, PC1, PC2 and PC3 i'm sure because it is zero when i shorted to gnd Which index of array contains measurements of channel 16, 17 and 18 (Vbat, Vref and Vtemp)? Why data are mixed? In manual, on page 201, bit SCANDIR decides of direction of scanning, from CHSEL0 to CHSEL16 or opposite direction. What about chanels 17(Vref) and 18(Vbat)? Where i'm doing wrong?