2016-09-06 01:20 AM
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? #stm82016-11-24 09:05 AM
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