Skip to main content
Visitor II
September 6, 2016
Question

STM8 internal temperature sensor

  • September 6, 2016
  • 1 reply
  • 746 views
Posted on September 06, 2016 at 10:20

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:

Init;

configure RTC to wakeup every 100ms;

initialize ADC;

enable interrupts;

while (1) {

  rtc wakeup enable;

  halt;

  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?

#stm8
    This topic has been closed for replies.

    1 reply

    Visitor II
    November 24, 2016
    Posted on November 24, 2016 at 18:05

    Hi,

    Just guessing as you did not provide info about the temperature sensor hardware.

    Possible causes for deviating ADC values:

     - Ripple / disturbance / noise / hum on ADC reference voltage if external.

     - Ripple / disturbance / noise / hum on MPU Vdd if ref. voltage internal.

     - Ripple / disturbance / noise / hum on temperature sensor signal.

     - Current Injection into other ADC-channels.

    HTH,

    John7