Skip to main content
Gahlen Feld
Associate III
October 19, 2020
Solved

STM32G070: calculate ambient temperature from internal temperature sensor?

  • October 19, 2020
  • 6 replies
  • 4805 views

Hello,

 

my question implies that there is no value for TS_CAL2 available for the STM32G070, although its reference manual RM0454 describes it on page 292 (14.9 Temperature sensor and internal reference voltage: Reading the temperature). Since there is also TS_CAL2 not mentioned in the data sheet, I could also ask: what is the right address in system memory for TS_CAL2? When I take the address from a STM32G071 device an calculate with this value in my STM32G070RB the temperature value makes no sense...

 

This topic has been closed for replies.
Best answer by Ozone

It depends on your device if there is any useful correlation between ambient and die temperature.

I don't know the G070 device in particular, but I would follow the usual calibration method:

Take (at least) two samples at known temperatures, and implement your own calibration function.

The datasheet formula as Imen Dahmen provided is usually an average value, and will fluctuate between different devices.

6 replies

ST Technical Moderator
October 19, 2020

Hello @Gahlen Feld​ ,

You can follow this formula:

0693W000001sk41QAA.png 

The RM0454 will be updated in coming release to add the missing information.

I hope this formula is helpful for you.

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
Gahlen Feld
Associate III
October 20, 2020

Thank you, Imen, for your quick answer.

I will implement the temperaure measurement according to your proposal.

Unfortunately, when calculating with the average slope value from the data sheet, the resulting temperature value is less accurate due to its non-linear nature compared to the method from the reference manual by applying 2 individually measured data points.

Your answer implies that there is no TS_CAL2 value stored in system memory for STM32G070 devices.

Ozone
Principal
October 20, 2020

I would consider this a bad idea.

The die temperature is influenced by the current MCU load and the ambient temperature inside the casing of your device.

Which most probably includes other nearby heat sources.

Gahlen Feld
Associate III
October 20, 2020

you are right, Ozone, fortunately our application has a constantly low MCU load -> we can assume that the measured temperature is mostly affected by the only one nearby heat source which dictates us to protect it by switching it off (but this is a very slow process)

Ozone
OzoneBest answer
Principal
October 20, 2020

It depends on your device if there is any useful correlation between ambient and die temperature.

I don't know the G070 device in particular, but I would follow the usual calibration method:

Take (at least) two samples at known temperatures, and implement your own calibration function.

The datasheet formula as Imen Dahmen provided is usually an average value, and will fluctuate between different devices.

Gahlen Feld
Associate III
October 20, 2020

>The datasheet formula ... will fluctuate between different devices.

yes I know and we are very unhappy with this for the STM32G070...

maybe we upgrade to a STM32G071 MCU which at least has 2 device specific calibration values in system memory...