AnsweredAssumed Answered

ADC channels and GPIO pins: STM32F407xx

Question asked by zach.juergen on Sep 6, 2012
Latest reply on Sep 12, 2012 by zach.juergen
Dear colleagues,
 
       I'm presently looking at the ADC routines in the Standard Peripheral Libraries, and they're pretty well written and documented; what I'm failing to understand so far is how the GPIO pins and the ADC registers are lined up.

        To elaborate, in the example "ADC/DualADC_RegulSimu_DMAmode1", I set the pins 0,1,2 from the "C"-peripheral to analog IO using the lines

    // pins 0,1,2
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2;
    // analog mode for ADC/DAC
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;
  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ;
    // use peripheral "C"
  GPIO_Init(GPIOC, &GPIO_InitStructure);


, which sets the correct bits in the registers GPIOC_MODER, OTYPER, and OSPEEDR. So far, so good. Then, I set the up two ADC peripherals with two conversions each:

  ADC_RegularChannelConfig(ADC1, ADC_Channel_10, 1, ADC_SampleTime_3Cycles);

  ADC_RegularChannelConfig(ADC1, ADC_Channel_11, 2, ADC_SampleTime_3Cycles);


  ADC_RegularChannelConfig(ADC2, ADC_Channel_11, 1, ADC_SampleTime_3Cycles);

  ADC_RegularChannelConfig(ADC2, ADC_Channel_12, 2, ADC_SampleTime_3Cycles);


It all works fine, but I haven't found the link between the ADC channels 10,11,12 and the GPIO pins C0,1,2. Explanations either in the context of the standard peripheral library or the registers would be appreciated.

Thanks and Best Regards,

JJ

Outcomes