2021-01-12 04:33 AM
Hi,
I am having problems measuring accurate temperatures with the internal temperature sensor of the STM32L011D4P7 over the full device temperature range of -40 °C to 130 °C.
What I did: Measuring the temperature as described in the Reference Manual (RM0377), Chapter 13.9 "Reading the temperature" which mentions the code example A.8.17.
There are two temperature calibration values TS_CAL1 and TS_CAL2 mentioned and used.
The two images show temperature measurements I did in a climatic chamber. The STM32 internal measurement (purple) is done as described above. Two external temperature sensors (green) controlled by additional testing hardware (not the STM32) are used to measure the ambient temperature and the case temperature on top of the STM32.
Calculation values:
Read out Calibration values from STM32 at the addresses mentioned in the example code:
TS_CAL1: 662
TS_CAL2: 940
Measured example values:
external temperature sensor in the climatic chamber:
-40 °C | 30 °C | 130 °C
meaured STM32 ADC raw value (VDDA = 3.3 V):
469 | 613 | 817
STM32 internal temperature calculated as described in A.8.17 from ADC raw values:
-21 °C | 35 °C | 117 °C
Measurements in the climatic chamber:
Measurement evaluation:
Finally my questions:
EDIT:
Many greetings
Jens
2021-01-12 04:54 AM
stm32l0xx_ll_adc. tells: /* Note: On device STM32L011, calibration parameter TS_CAL1 is not available. */
That's what you get from selecting the cheapest part!. So you have to either set up an environment to measure it yourself and track them on a per part base or select a part that exports TS_CAL1.
2021-01-12 07:15 AM
Did you perform ADC calibration as per Calibration (ADCAL) subchapter of ADC chapter of RM?
Against what reference are you measuring (i.e. is VDDA precise and stable throught the whole temperature range - I assume given mcu does not have separate VREF+ pin?)
JW
2021-01-12 11:19 PM
Yes the goal is to select the cheapest part... for obvious money reasons.
Good to know that only the generated code explicitly excludes the TS_CAL2 value while the code example in the documentation uses it!
The datasheet in the STM32xx is very short in terms of the temperature sensor. In other projects (with more expensive STM32s) the temperature measurement works just fine.
So can i generally assume if I want a precise temperature measurement I have to take a STM32 that has both calibration values?
2021-01-12 11:38 PM
Yes I did.
Yes the smallest package is used where the VDDA is the same pin as VREF+.
The VDDA is determined by measuring the internal reference V_REFINT as the reference manual states in Chapter 13.9 "Calculating the actual VDDA ..." every time before measuring the temperature.
-Jens
2021-01-13 12:31 AM
Don't you try to do this after sleep/wakeup or in continuously runing mcu?
Make sure you observe internal voltage reference and thermometer startup and sampling times.
Can you measure VDDA independently?
How do you remove readout noise?
Analyze discrepancy between stored and measured really values. The one guaranteed by the DS should match closely.
Do you have multiple specimens, perhaps also something like a Nucleo board?
JW
2021-01-14 11:51 PM
Sorry for the late response, could not log in to my ST account..
In this case the STM32 was always in run mode.
In the final application the MCU will have a sleep/run cycle. But the temp sensor will not be turned off. In my understanding it is therefore not necessary to wait for the startup time.
I did a independent VDDA measurement. The values seemed to be fine, although changing over temperature.
No care is taken of the readout noise. The measurement error does more look like some kind of gain error.
The calibration value TS_CAL2 mentioned in the datasheet matches the given tolerance on multiple boards.
I do have multiple nucleo boards with similar MCU, but only did some table measurements not in a climatic chamber. Behaviour seemed to be very similar to the detailed measurement.
-Jens
2021-01-15 01:48 AM
>> How do you remove readout noise?
> No care is taken of the readout noise.
I am asking because on the upper figure, the green and purple appear to meet at cca 30 deg. on the upward slope, but significantly higher, at cca 70 deg, on the downward slope.
So if this is not result of some filtering (i.e. processing the output of ADC, possibly introducing lags or some other errors), then I'd question the relevance of measuring the "green" temperatures for determining the internal temperature of the chip. In other words, temperature of "ambient" and "case" might be very different from internal temperature of the chip, possibly for incorrect methodology of measuring the former two (e.g. there's a significant thermal path between the chip and 20deg exterior, as compared to the termal path between "ambient"/"case" to chip.)
JW
2021-01-15 04:31 AM
I get your point. I have a simple explanation for the different temperatures at the intersections: The external sensor values and the internal measurement have different time bases and have been put together afterwards. The STM32 might count little too fast or slow in comparism to the real time.
Yes the external temperatures do not show the exact internal temperature. Still both internal+external should have the same trend and I would expect a nearly constant offset over the temperature range. Additionally I can not think of another way checking the temperature..
2021-01-15 05:05 AM
As I wrote before, there is no TS_CAL1 and to get sensible results you have to aquire this value yourself. The curves you supply have decnet tracking of temperature changes, for me. only calibration values seem off.