2015-08-21 08:49 AM
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.2015-08-22 07:41 AM
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, Hal2015-08-22 11:14 AM
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 thisline 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)....
2015-08-22 12:36 PM
See the ADC TemperatureSensor project in the STM32L0xx_Snippets_Package.
The Reference Manual does discuss calibrate and wait for completion before using. Cheers, Hal2015-08-27 10:41 PM
Thank you, Hal.
I just needed to calibrate ).