cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F051R8T6 and its temperature sensor - wrong results! - SOLVED

ColdWeather
Senior
Posted on March 01, 2016 at 15:14

Hello!

Testing the MCU on F0 Discovery I read out the internal temperature, converted the ADC value by the code example (using the calibration constants) in the appendix A.7.16 of the RM Rev. 6 and obtained quite realistic values and behavour (heating the MCU up) of about room temperature.

After that I flashed the binary to some user board with the same MCU type, and obtained the temperatures of about -13C! Both MCUs have the Revision B, the only difference is, the F0 Discovery MCU has a string GH22N while the user board MCU - GH22Q. The next step I made, I applied the equation from the chapter 13.9, Page 234, - and look! - the temperature got back to its realistic range! Visa versa, flashing the new code into F0 Discovery I obtained something about +60C.

In the actual Errata to F051 I found nothing about this issue. The questions are:

1. How can I distinguish the MCUs in my code having the same revision of them to apply different equations to convert the temperature?

2. What conversion equation is correct: from the appendix A.7.16 or chapter 13.9?

Best regards.

P.S. SOLVED: the MCU supply on F0 Discovery is 3.0V, on the user board - 3.3V. The appendix in the RM gives the equation actually for F0 Discovery but saying nothing(!) about this special case. Only in the DS to F05x is mentioned, the calibration constants are obtained at 3.3V. Thus, the equation in the chapter 13.9 should be commented like ''watch 3.3V, recompute for other voltages''...

2 REPLIES 2
Amel NASRI
ST Employee
Posted on March 01, 2016 at 17:55

Hi ColdWeather,

Great to hear that you fixed the issue you faced.

But I would like to know which constants are wrong in the appendix of RM0091?

-Mayla-

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.

ColdWeather
Senior
Posted on March 01, 2016 at 20:13

All constants are correct, but in the appendix there are additional defines of 300 and 330 that have impact on the resulting value. As I later understood, the appendix gave an example of the code specially written for F0 Discovery where the MCU was supplied by 3.0V while the calibration values were fixed for 3.3V. Unfortunately, there is no notice in the RM about this, and applying the code example ''as is'' to a system with the 3.3V supply leads to a wrong result.