cancel
Showing results for 
Search instead for 
Did you mean: 

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

Beppe101
Associate III

Hi,

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

0693W000001sk41QAA.png

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.

Please help.

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

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

TDK_0-1710161093832.png

 

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

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

5 REPLIES 5
TDK
Guru

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

TDK_0-1710161093832.png

 

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

If you feel a post has answered your question, please click "Accept as Solution".
Beppe101
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 ?

 

Your actual VDDA value.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

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.

If you feel a post has answered your question, please click "Accept as Solution".
Beppe101
Associate III

Thanks for helping, the formula provided appears to be working fine.