Doubt about ADCConversionGroup Structure

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
sapan
Posts: 56
Joined: Sat Dec 24, 2011 1:22 pm

Doubt about ADCConversionGroup Structure

Post by sapan »

Hi,

In Sample code ADCConversionGroup is defined as follow

Code: Select all

static const ADCConversionGroup adcgrpcfg = {
  FALSE,
  ADC_GRP1_NUM_CHANNELS,
  adccb,
  NULL,
  /* HW dependent part.*/
  0,
  ADC_CR2_SWSTART,
  ADC_SMPR1_SMP_AN11(ADC_SAMPLE_56) | ADC_SMPR1_SMP_SENSOR(ADC_SAMPLE_144),
  0,
  ADC_SQR1_NUM_CH(ADC_GRP1_NUM_CHANNELS),
  0,
  ADC_SQR3_SQ2_N(ADC_CHANNEL_IN11) | ADC_SQR3_SQ1_N(ADC_CHANNEL_SENSOR)
};



Here first four fields are circular buffer enable/disable, number of channels to poll, call back function and error pointer.

In HW dependent part CR1 and CR2 are configured first.
Then Sampling time is set for Channel AN11 (56 cycles) and Temperature Sensor (144 cycles) in SMPR1 register.
SMPR2 register is defined as zero.
I am not able to understand values defined in last three registers ADC_SQR1, ADC_SQR2 and ADC_SQR3

Sapan
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Doubt about ADCConversionGroup Structure

Post by Giovanni »

SRQ1...SQR3 contain the number of channels that are part of the group (ADC_SQR1_NUM_CH(ADC_GRP1_NUM_CHANNELS)) and the channels to be converted (ADC_SQR3_SQ2_N(ADC_CHANNEL_IN11) | ADC_SQR3_SQ1_N(ADC_CHANNEL_SENSOR)), IN11 and the temperature sensor in this case.

This part is pretty low level, you should refer to the STM32 RM for a full description of the registers.

Giovanni
sapan
Posts: 56
Joined: Sat Dec 24, 2011 1:22 pm

Re: Doubt about ADCConversionGroup Structure

Post by sapan »

Got it...wanted to configure PC1 and PA0 as analog inputs...done now...:) thanks
Post Reply