Hi
I am using STM32f103 and using its internal temperature sensor to measure ambient temperature. At room temperature(25°C), i get different readings from chip to chip ranging from 23 to 39°C.
The formula to calculate temperature is as follows: Temperature (in °C) = {(V25 - VSENSE) / Avg_Slope} + 25. where, V25 = VSENSE value for 25°C Avg_Slope = Average Slope for curve between Temperature vs. VSENSE (given in mV/°C or µV/°C).
Do i need to calibrate V25 for each chip?
Regards, Jasper
That sounds like a poor idea!
The processor's internal temperature sensor is obviously going to be greatly affected by the heat generated by the processor itself!
Note that this has nothing to do with Keil
This is a specific detail of the chip hardware - so it's the ST documentation that you need to be studying.
In particular, the RM0008 Reference manual says:
"The offset of this line varies from chip to chip due to process variation (up to 45 °C from one chip to another)."
and:
"The internal temperature sensor is more suited to applications that detect temperature variations instead of absolute temperatures. If accurate temperature readings are needed, an external temperature sensor part should be used." (my emphasis)
Sorry - the chip temp sensor can not be used for measuring the ambient temperature unless you: 1) calibrate each chip 2) have a system that spends significant time in idle/shutdown so you can measure without random internal heating from varying processor load.
You can get _way_ better with an ADC input and a cheap diode junction.
"You can get _way_ better with an ADC input and a cheap diode junction."
you run into the same issues with a pn junction: it needs calibration, as the internal temp sensor is also a pn junction.
one of the earlier comments is right on: the pn junction approach is helpful for measuring temperature CHANGES, unless you calibrate the sensor before hand.
the pn junction is typically very very linear in its Vfwd vs. t relationship. the limitation (in terms of accuracy as well as resolution) is that with a 10-bit adc, your measurement is likely 1 - 2c off, assuming a single diode set-up.
It's just that an external pn junction does not suffer from the CPU load that may jump 10 degrees or more depending on how the processor is used. You just can't calibrate for that.
"It's just that an external pn junction does not suffer from the CPU load that may jump 10 degrees or more depending on how the processor is used. You just can't calibrate for that."
those are issues but not insurmountable, and the solutions are likely application dependent.