AnsweredAssumed Answered

STM8 internal temperature sensor

Question asked by mielczarek.jakub on Sep 6, 2016
Latest reply on Nov 24, 2016 by John7
I am working on a project, which is based on STM8 MCU.
I am using ADC to read the ambient temperature. Sometimes I am getting temperature ADC readings which are greater than the usual ones. Most of the time the samples are 608-611, and sometimes they reach value as high as 620 (in the same ambient temperature).
I reproduced this in a simple program, which has the following loop:

configure RTC to wakeup every 100ms;
initialize ADC;
enable interrupts;
while (1) {
  rtc wakeup enable;
  rtc wakeup disable;
  read ADC temperature value;

I have the following ADC configuration for reading temperature:

ADC_Init(ADC1, ADC_ConversionMode_Continuous, ADC_Resolution_12Bit, ADC_Prescaler_2);
ADC_SamplingTimeConfig(ADC1, ADC_Group_FastChannels, ADC_SamplingTime_96Cycles);
STM8 clock external is 12MHz, VDD=3.3V.

What could the reason of such differing values?