Other Parts Discussed in Thread: C2000WARE
Hi, I'm trying to calculate the Internal temperature of the TMS320F28388D on ADCA CH13.
There is some discrepancy in documentation and C2000Ware example. Can you please help clarify which is correct?
I am using 3.0 as Vref.
spruii0a.pdf: Section 20.15.5 Internal Temperature Sensor
To convert the temperature sensor reading into a temperature, pass the temperature sensor reading to the
GetTemperatureC() function in F2838x_TempSensorConv.c.
Note that this function assumes that the temperature reading was taken with VREFHI = 2.5V. If a different
reference voltage is used, the sample should be scaled appropriately before passing it to the function by
using the below formula.
adjusted sensor reading = raw sensor reading * (VREFHI / 2.5V)
C200Ware_3_01_00_00/device_support/f2838x/examples/cpu1/adc/adc_ex3_soc_epwm_tempsensor.c
InitTempSensor(3.0);
sensorSample = AdcaResultRegs.ADCRESULT0;
sensorTemp = GetTemperatureC(sensorSample);
My code:
InitTempSensor(3.0);
adc = AdcaResultRegs.ADCRESULT5;
t = GetTemperatureC(adc);
tscale = GetTemperatureC((float)adc*3.0/2.5);
t = 44.0C, tscale=110.0C
The equation inside GetTemperatureC() is effectively: tempC = ((sample * 3.0 / 4096) - offset ) / slope
With the example from ti /device_support, there is no adjustment (spruii0), but the temperature result is the most reasonable. But this calculation does not account for any 2.5V ref scaling.
The suggestion from spruii0 is to adjust the raw value by VREFHI/2.5 does not seem correct. (3.0 / 2.5 (sample * 3.0 / 4096) - offset) / slope.
Can you confirm whether to do the sample * VREFHI / 2.5 adjustment before calling GetTemperatureC() or not?
And whether spruii0 just needs to be updated.
Thanks.