Hi
I am trying to use Energia and the example for using the internal temperature sensor,
Right now, I have the example running, and the raw value I get from the ADC12 in the MPS430 5529 is about 2100, which according to the formula
"
// These steps convert the ADC reading to degrees Celsius
// Sensor spec = 3.55 mV/C deg and 986 mV = 0 Celsius
// There are 1.5V/4096 counts = 0.366 mV per count. So,
tempC = ((float)in_temp*0.366 – 986.0)/3.55;
"
gives me the following using what I consider the proper values for F5529 (see reference to datasheet below):
tempC = ((float)2100 * 0.366 - 680-0) / 2.25 = about 39 degrees C.
The room temperature is about 21 degrees C, so is the reported 39 degrees as expected ?
I have done some digging, and have some questions related to using the internal temperature sensor.
1.
Using the formula and information in
and the data from page 72 in http://www.ti.com/lit/ds/slas590l/slas590l.pdf, "TCsensor = 2.25mV/degC" and "Vsensor = 680mV at 0degC",
I have replaced the formula :
values[j] = ((uint32_t)analogRead(TEMPSENSOR)*27069 - 18169625) *10 >> 16;
with
values[j] = ((uint32_t)adcValue*10669 - 19773521) >> 16; // 1.5V ref
But that gives me temperature "3.8", so my math is wrong somewhere. Seems like I have missed by a factor of 10.
I have used V = 0.00225 * C + 0.680 as the starting point.
Can anyone spot the error I have made ?
2.
Sample time used by analogRead.
I think I will make a pull request to increase the sample interval when using the internal temperature sensors,
See my suggested code change here : https://github.com/alfh/Energia/commit/0a2f1bd1853ef3955f1922fa376cd04165cab043
This is because internal temperature sensors needs minimum 100us sample time, page 72 on http://www.ti.com/lit/ds/slas590l/slas590l.pdf.
Does this seem correct ?
Although at page 15 in http://www.ti.com/lit/ug/slau406b/slau406b.pdf it says "When using the temperature sensor, the sample period must be greater than 30 μs". Is it only the F5529 that needs more than 100us ?
3.
Does anyone know why the ADC12 code in Energia wiring_analog.c forces 1.5V internal reference to be used, while for ADC10 one can choose ?
I have not been able to find in any datasheet that 1.5V reference must be used when using the internal temperature sensor.
"
if (pin == TEMPSENSOR) {// if Temp Sensor
REFCTL0 = (INTERNAL1V5 & REF_MASK); // Set reference to internal 1.5V
ADC12MCTL0 = pin | ((INTERNAL1V5 >> 4) & REFV_MASK); // set channel and reference
} else {
REFCTL0 = (analog_reference & REF_MASK); // Set reference using masking off the SREF bits. See Energia.h.
ADC12MCTL0 = pin | ((analog_reference >> 4) & REFV_MASK); // set channel and reference
}
"
While googling this, I found : http://ece.wpi.edu/courses/ece2049smj/lecture15_A12.pdf, which has this section :
"
// This function returns the internal chip temperature, based on
// the internal temperature diode which has an
FSR = 1.5V
"
I am not sure what MPS430 variant they are using in this course, but the http://ece.wpi.edu/courses/ece2049smj/lecture14.pdf mentions F5529, so I
am assuming they are using it.
Does anyone have any reference to datasheet or similar stating that we need to use 1.5V reference when using the internal temperature sensor with MPS430
variants having the ADC12 ?
4.
I have read that the chip itself has calibration data in the "TLV".
See "24.2.2 TAG_ADC12_1 Calibration TLV Structure" on page 584 in http://www.ti.com/lit/ug/slau144j/slau144j.pdf
Would it be out of scope for the Energia to read these values ?
Would it be easy to read those values in a energia program, to use them myself in temperature calculations ?
Regards
Alf Høgemark