AnsweredAssumed Answered

STM32Cube Triple ADC Regular Mode

Question asked by laurijssen.dennis on Apr 3, 2015
Hello all,

I am trying to get the triple ADC regular mode working on my STM32F429ZI Discovery board. I have been reading the user manual and trying to get this to work with the (new) HAL drivers in combination with auto generated code in STM32CubeMx.

Each ADC has only one channel active (ADC1 - Ch 7, ADC2 - Ch 5, ADC3 Ch3) and I would like to measure these channels simultaniously. 

The ADC configuration is (this is ADC1, but the other ADCs are simular):
/* ADC1 init function */
void MX_ADC1_Init(void)
{
 
  ADC_MultiModeTypeDef multimode;
  ADC_ChannelConfTypeDef sConfig;
 
    /**Configure the global features of the ADC (Clock, Resolution, Data Alignment and number of conversion)
    */
  hadc1.Instance = ADC1;
  hadc1.Init.ClockPrescaler = ADC_CLOCKPRESCALER_PCLK_DIV2;
  hadc1.Init.Resolution = ADC_RESOLUTION12b;
  hadc1.Init.ScanConvMode = DISABLE;
  hadc1.Init.ContinuousConvMode = DISABLE;
  hadc1.Init.DiscontinuousConvMode = DISABLE;
  hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;
  hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT;
  hadc1.Init.NbrOfConversion = 1;
  hadc1.Init.DMAContinuousRequests = DISABLE;
  hadc1.Init.EOCSelection = EOC_SINGLE_CONV;
  HAL_ADC_Init(&hadc1);
 
    /**Configure the ADC multi-mode
    */
  multimode.Mode = ADC_TRIPLEMODE_REGSIMULT;
  multimode.DMAAccessMode = ADC_DMAACCESSMODE_1;
  multimode.TwoSamplingDelay = ADC_TWOSAMPLINGDELAY_5CYCLES;
  HAL_ADCEx_MultiModeConfigChannel(&hadc1, &multimode);
 
    /**Configure for the selected ADC regular channel its corresponding rank in the sequencer and its sample time.
    */
  sConfig.Channel = ADC_CHANNEL_7;
  sConfig.Rank = 1;
  sConfig.SamplingTime = ADC_SAMPLETIME_3CYCLES;
  HAL_ADC_ConfigChannel(&hadc1, &sConfig);
 
}

In the while loop I currently have this code:
while (1)
{
  HAL_ADCEx_MultiModeStart_DMA(&hadc1, adc_dma_values, 2048);
  adc_value_1 = HAL_ADCEx_MultiModeGetValue(&hadc1);
  adc_value_2 = HAL_ADCEx_MultiModeGetValue(&hadc2);
  adc_value_3 = HAL_ADCEx_MultiModeGetValue(&hadc3);
}

I figured that since ADC1 is the master, the "HAL_ADCEx_MultiModeStart_DMA(&hadc1, adc_dma_values, 2048);" should start the other ADC conversions as well. This however does not seem to be the case.

Could anyone help me figure this out?

Kind regards,

Dennis

Outcomes