This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28388D: Internal Temperature Sensor Calculation

Part Number: TMS320F28388D
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.

  • Hi Huey, 

    It looks like we updated the driverlibs to take in the VREF value to do the range adjustment inside the function instead of requiring the user to make the adjustment outside, but didn't update the documentation.  

    I'll submit a ticket to have the documentation updated.