cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L433 strange temperature sensor readings

cschumann
Associate II
Posted on May 30, 2017 at 08:50

Actually I am working with a STM32L433CBY controller. When using the internal temperature sensor I got some inconsistencies and strange readings. Maybe someone can clarify the issues.

1. Reference temperature TS_CAL2

The 

http://www.st.com/content/ccc/resource/technical/document/datasheet/f7/a0/fc/27/24/4e/4f/3f/DM00257192.pdf/files/DM00257192.pdf/jcr:content/translations/en.DM00257192.pdf

 explains on page 40 both calibration points. TS_CAL2 is defined to be 130�C.

The 

http://www.st.com/content/ccc/resource/technical/document/reference_manual/group0/b0/ac/3e/8f/6d/21/47/af/DM00151940/files/DM00151940.pdf/jcr:content/translations/en.DM00151940.pdf

 introduces on page 423 (center) the formula for using the calibration points. Here TS_CAL2 is defined to be 110�C.

Any Idea which value is the correct one?

2. Oversampling

I get different values when enabling 16x oversampling for the ADC. At room temperature (~25�C, VCC=3.3V) I get an ADC reading (after a division by 16) of 0x2FE. When I deactivate oversampling I get 0x343 for the same temperature on the same hardware. Is there any limitation regarding oversampling of the internal temperature sensor? Did I miss something in the errata sheet? (PS: Tried it also on different controllers, same result.)

3. Unrealistic readings of the temperature sensor

When I fill in the values from (2) into the formula, I get quite strange results. First I converted the readings into millivolts to compare them to page 155 of the datasheet. The datasheet states that I should get about 0.76V at 30�C. 

0x02FE ==> 620mV (much too low, even for 25�C)

0x0343 ==> 670mV (better but still to low!)

When I use these values for the formula (RM0394, pp423) with the calibration values

TS_CAL1 = 1031

TS_CAL2 = 1371

I first have to normalize the readings to 3.0V (since the calibration was done at that voltage).  

TS_DATA = 0x343(=835) * 3,3V / 3,0V ==> 0x396 (=918)

T = (110�C-30�C) / (1371 - 1031) * (TS_DATA - 1031) + 30�C

= 80�C / 340 * (TS_DATA - 1031) + 30�C

= 0,235�C * (TS_DATA - 1031) + 30�C

= 0,235�C * -113 + 30�C

= 3,44�C (*brrr, coooold*)

When replacing TS_CAL2=110�C with TS_CAL2=130�C I get

T = 0,294�C * (TS_DATA - 1031) + 30�C

T = 0,294�C * -113 + 30�C

T = -3,2�C (*coooolder*)

Any ideas what's going wrong?

Carsten

#temperature-sensor #adc-stm32l4 #stm32l4
2 REPLIES 2
AvaTar
Lead
Posted on May 30, 2017 at 09:14

Can you tell what hardware (board) you are working on ?

I don't have any L4xx board, but I vividly remember some peculiarities of other discovery boards.

These boards could be powered by either USB (via the ST-Link part), external 5V, external 3.3V, and sometimes even via target USB. And all these supply sources were decoupled via Shottky diodes, which made for a 'floating' supply voltage, below the specified 3.3V.

If one used Vcc as reference for the ADC on those boards, similar problems arose. Perhaps applies to your case.

Posted on May 30, 2017 at 09:25

The board is a custom PCB. Voltage is derived from a 5V Supply (bench PSU) using a linear regulator on the board. The 3V3 is quite stable.

Analog parts are decoupled from digital parts using a ferrite. Blocking capacitors are present near the uC according to the hardware guide.

When I did the tests, the only enabled peripherals were RCC (for PLL), ADC and DMA.