cancel
Showing results for 
Search instead for 
Did you mean: 

ADC resolution for stm32f205

acihana
Associate II
Posted on December 19, 2011 at 10:40

Hi, 

ADC resolution is working for ''ADC_Resolution_6b'' and ''ADC_Resolution_12b'' but not working for ''ADC_Resolution_8b'' and ''ADC_Resolution_10b'' resolutions, they're same with 12-bit resolution. Does anyone have an idea? Here's the initilize code;

definitions;

#define ADC_Resolution_12b                         ((uint32_t)0x00000000)

#define ADC_Resolution_10b                         ((uint32_t)0x01000000)

#define ADC_Resolution_8b                          ((uint32_t)0x02000000)

#define ADC_Resolution_6b                          ((uint32_t)0x03000000)

Code;

/* ADC Common Init **********************************************************/

ADC_CommonInitStructure.ADC_Mode = ADC_Mode_Independent;

ADC_CommonInitStructure.ADC_Prescaler = ADC_Prescaler_Div8;

ADC_CommonInitStructure.ADC_DMAAccessMode = ADC_DMAAccessMode_Disabled;

ADC_CommonInitStructure.ADC_TwoSamplingDelay = ADC_TwoSamplingDelay_20Cycles;

ADC_CommonInit(&ADC_CommonInitStructure);

/* ADC1 Init ****************************************************************/

ADC_InitStructure.ADC_Resolution = ADC_Resolution_8b;

ADC_InitStructure.ADC_ScanConvMode = DISABLE;

ADC_InitStructure.ADC_ContinuousConvMode = ENABLE;

ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None;

ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;

ADC_InitStructure.ADC_NbrOfConversion = 1;

ADC_Init(ADC1, &ADC_InitStructure);

/* ADC1 regular channel7 configuration *************************************/

ADC_RegularChannelConfig(ADC1, ADC_Channel_1, 1, ADC_SampleTime_480Cycles);

/* Enable DMA request after last transfer (Single-ADC mode) */

ADC_DMARequestAfterLastTransferCmd(ADC1, ENABLE);

/* Enable ADC1 DMA */

ADC_DMACmd(ADC1, ENABLE);

/* Enable ADC1 */

ADC_Cmd(ADC1, ENABLE);

ADC_SoftwareStartConv(ADC1);

3 REPLIES 3
Nickname12657_O
Associate III
Posted on December 19, 2011 at 14:27

Hi,

Could you add in

/* ADC1 Init*/

: ''

ADC_InitStructure.ADC_ExternalTrigConv=0x00

'' and see if it is solved?

Cheers,

STOne-32

raptorhal2
Lead
Posted on December 19, 2011 at 16:27

Unfortunately, Section 10.4 of the reference manual doesn't show 10 and 8 bit data alignment in regular mode. STOne-32 - strong hint.

It might be that the most significant bit position for 10 and 8 bit is the same as 12 bit. Check if the unused 2 or 4 bits are set to zero for 10 and 8 bit conversions.

Cheers, Hal

acihana
Associate II
Posted on December 20, 2011 at 09:29

Thank you very much STOne-32 and Hal,

Problem is solved by adding 

''ADC_InitStructure.ADC_ExternalTrigConv=0x00;''

It's working for four different resolutions.