cancel
Showing results for
Did you mean:

# Temperature and ADC temperature raw value increase but temperature from formula decreases

Associate III

Hi,

I'm using STM32G070RBTx, and I use this formula from document RM0360 to compute temeperature:

From page 56 of document https://www.st.com/resource/en/datasheet/stm32g070cb.pdf, I'm using:

Avg_Slope = 2.5 and V30 = 0.76.

The temperature converted value I obtain at ambient temperature appears reasonable ( 21 °C approx. )  but when the temperature increases the  raw value I get from ADC also increases but using formula above gives a decreasing temperature value and this is wrong.

1 ACCEPTED SOLUTION

Accepted Solutions
Guru

Perhaps you are using an older version of the RM. Here it what the current version says:

This is the same as your formula except the sign on V30 and V_SENSE has changed.

5 REPLIES 5
Guru

Perhaps you are using an older version of the RM. Here it what the current version says:

This is the same as your formula except the sign on V30 and V_SENSE has changed.

Associate III

Thanks TDK for reply, a couple of questions:

1) is VDDA in the formula the voltage power supply I use to power my board, that is 3.3 V, or is the voltage power supply used during factory calibration that is 3.0 V ?

2) in the formula provided shouldn't be Sense_DATA = TS_DATA / VDDA * 3.3 ?

ST Employee

1) "VDDA" in the calculation should be VREF+ on the board you are taking the ADC measurement on (your board).

2) No, I don't think so. But it should be 3.0 V since that's what the TS_CAL was taken at.

A better formula would be:

• TS_DATA = V_TS * 4096 / VREF+
• (TS_CAL1 = V_TS30 * 4096 / TS_CAL1_VREF+)
• SENSE_DATA = TS_DATA * VREF+ / TS_CAL1_VREF+
• TEMP_C = (SENSE_DATA - TS_CAL1) / AVG_SLOPE + TS_CAL1_TEMP

Where TS_CAL1 is read from memory, TS_CAL1_VREF+ (3.0) and TS_CAL1_TEMP (30 C) are taken from the datasheet.