cancel
Showing results for 
Search instead for 
Did you mean: 

Stm32l052 temperature sensor calibration problem

baev_al
Associate II
Posted on August 21, 2015 at 17:49

Hi.

I am working on the temperature controller using stm32l052. I use inbuilt temperature sensor. What am I doing wrong?

TEMP130_CAL_ADDR value here is 0x0395 = 917dec

TEMP30_CAL_ADDR value here is 0x029d = 669dec

Temperature in my room is about 24 degrees celsius.

Value in the ADC_DR  = 866dec.

So using the formula of the refference manual I obtain 60 degrees celsius on the screen.

When I put the device into the fridge I see the decrease of the temperature (to about 48 degrees on the screen - and the change seems valid).

I tried to correct the value with actual power supply voltage of my device, but it is not able to correct the temperature into real value.

What is my next step to the temperature perfection?

Thanks.
4 REPLIES 4
raptorhal2
Lead
Posted on August 22, 2015 at 16:41

The data sheet gives tolerances for actual performance. Your results seem to be outside the max.

For internal ADC channels, sampling time is critical. Are you using the recommended 10 us sampling time ?

Also, does the code calibrate the ADC before using it?

Cheers, Hal

baev_al
Associate II
Posted on August 22, 2015 at 20:14

The data sheet gives tolerances for actual performance. Your results seem to be outside the max.

It seems I still have some limits...According to the Reference manual: The temperature sensor output voltage changes linearly with temperature. The offset of this

 

line varies from chip to chip due to process variation (up to 45 °C from one chip to another).

For internal ADC channels, sampling time is critical. Are you using the recommended 10 us sampling time ?

The clock for all peripherals is 2MHz. Just to be sure that measurement is correct I chose  ADC_SAMPLETIME_239CYCLES_5

Also, does the code calibrate the ADC before using it?

Can you please give me the reference how to do this? It seems I didn't do this. I didn't find anything in the manual (I'am sure that I just missed)....
raptorhal2
Lead
Posted on August 22, 2015 at 21:36

See the ADC TemperatureSensor project in the STM32L0xx_Snippets_Package.

The Reference Manual does discuss calibrate and wait for completion before using.

Cheers, Hal

baev_al
Associate II
Posted on August 28, 2015 at 07:41

Thank you, Hal.

I just needed to calibrate ).