cancel
Showing results for 
Search instead for 
Did you mean: 

ADC1 in STM8s003F3 can not work with clock near 6MHz as mentioned in its datasheet

abbas
Associate II
Posted on February 26, 2014 at 19:48

Hello everyone

I  am using ADC1 with the following config:

ADC1_Init ( ADC1_CONVERSIONMODE_SINGLE, ADC1_CHANNEL_6,   ADC1_PRESSEL_FCPU_D6,  ADC1_EXTTRIG_TIM , ENABLE,  ADC1_ALIGN_RIGHT, ADC1_SCHMITTTRIG_ALL, DISABLE );

ADC1_ScanModeCmd ( ENABLE );

ADC1_ITConfig ( ADC1_IT_EOCIE, ENABLE );

ADC1_DataBufferCmd ( ENABLE );

ADC1_Cmd ( ENABLE );

with the following clock config:

CLK_SYSCLKConfig(CLK_PRESCALER_HSIDIV1); //select Clock = 16 MHz

CLK_HSICmd(ENABLE);

The device is running correctly at start, but after a short while, say 1 minute, the interrupt handler of ADC1 seems not working, I mean it returns 0. all other functions are doing their job correctly at the same time. When I enter debug mode, ADC1 buffered values works correctly. I changed

ADC1_PRESSEL_FCPU_D6

to

ADC1_PRESSEL_FCPU_D18

and the problem disappeared. It is mentioned in the datasheet that the ADC clock can be increased up to 6MHz, and this is considered by the value ADC1_PRESSEL_FCPU_D6

So what is the problem? have you had such experience?

#adc-stm8
0 REPLIES 0