Function for reading STM32F4 internal temperature

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Is there a function or code snippet that will provide the temperature of the STM32F4 internal temperature sensor?

0 Likes
1 Solution
5 Replies
Anonymous
Not applicable

This looks great... I'll try it out very soon and post more feedback.

0 Likes
Anonymous
Not applicable

So it seems to work and produce something that correlates with temperature, but the temperature provided is very inaccurate (about 20 degrees F high in one case).

I recognize that there are several issues related to this and I'll see what I can do to improve it.

Thanks very much for this code segment! This basic functionality is exactly what I wanted.

0 Likes
JacobT_81
Employee
Employee
250 replies posted 100 replies posted 50 replies posted

When I tested the code I would get something inaccurate for the very first reading that I did immediately after boot--attributed this to garbage on ADC channel after boot. After that first reading I consistently saw ~91deg F and, as expected, I could watch it jump up when radio activity occurred.

I'm curious what the difference could be on your end. Keep me posted if you figure out what's going on. And let me know if I can help out at all.

Jacob

0 Likes
Anonymous
Not applicable

I also saw something inaccurate for the first reading; so I looked at the second reading and it was also high but not as high as the first. I attribute this to MCU heating during a busy boot, maybe I'm wrong.

I'm getting 103 F but my target is in a warm location, so the combined heat could be matching yours, but probably both are higher than actual, maybe not, the die temp could really be that high.

I'm most interested in relative temperature change. So accuracy tuning has become a very low priority.

Thanks again Jake!

0 Likes