Device Temperature Measurement

Principle

The device has an integrated temperature sensor which is part of the Supply Controller (SUPC). The analog signal of that sensor can be converted into a digital value by the ADC. The digital value can be converted into a temperature in °C by following the steps in this section.

Configuration and Conditions

In order to conduct temperature measurements, configure the device according to these steps.
  1. 1.Configure the clocks and device frequencies according to the Electrical Characteristics.
  2. 2.Configure the Voltage References System of the Supply Controller (SUPC):
    1. 2.1.Enable the temperature sensor by writing a '1' to the Temperature Sensor Enable bit in the VREF Control register (SUPC.VREF.TSEN).
    2. 2.2.Select the required voltage for the internal voltage reference INTREF by writing to the Voltage Reference Selection bits (SUPC.VREF.SEL). The required value can be found in the Electrical Characteristics.
    3. 2.3.Enable routing INTREF to the ADC by writing a '1' to the Voltage Reference Output Enable bit (SUPC.VREF.VREFOE).
  3. 3.Configure the ADC:
    1. 3.1.Select the internal voltage reference INTREF as ADC reference voltage by writing to the Reference Control register (ADC.REFCTRL.REFSEL).
    2. 3.2.Select the temperature sensor vs. internal GND as input by writing TEMP and GND to the positive and negative MUX Input Selection bit fields (ADC.INPUTCTRL.MUXNEG and .MUXPOS, respectively).
    3. 3.3.Configure the remaining ADC parameters according to the Electrical Characteristics.
    4. 3.4.Enable the ADC and acquire a value, ADCm.

Calculation Parameter Values

The temperature sensor behavior is linear, but it is sensitive to several parameters such as the internal voltage reference - which itself depends on the temperature. To take this into account, each device contains a Temperature Log row with individual calibration data measured and written during the production tests. These calibration values are read by software to infer the most accurate temperature readings possible.

The Temperature Log Row basically contains the following parameter set for two different temperatures ("ROOM" and "HOT"):
  • Calibration temperatures in °C. One at room temperature tempR, one at a higher temperature tempH:
    • ROOM_TEMP_VAL_INT and ROOM_TEMP_VAL_DEC contain the measured temperature at room insertion, tempR, in °C, separated in integer and decimal value.

      Example: For ROOM_TEMP_VAL_INT=0x19=25 and ROOM_TEMP_VAL_DEC=2, the measured temperature at room insertion is 25.2°C.

    • HOT_TEMP_VAL_INT and HOT_TEMP_VAL_DEC contain the measured temperature at hot insertion, tempH, in °C. The integer and decimal value are also separated.
  • For each temperature, the corresponding sensor value at the ADC in 12-bit, ADCR and ADCH:
    • ROOM_ADC_VAL contains the 12-bit ADC value, ADCR, corresponding to tempR. Its conversion to Volt is denoted VADCR.
    • HOT_ADC_VAL contains the 12-bit ADC value, ADCH, corresponding to tempH. Its conversion to Volt is denoted VADCH.
  • Actual reference voltages at each calibration temperature in Volt, INT1VR and INT1VH, respectively:
    • ROOM_INT1V_VAL is the 2’s complement of the internal 1V reference value at tempR: INT1VR.
    • HOT_INT1V_VAL is the 2’s complement of the internal 1V reference value at tempH: INT1VH.
    • Both ROOM_INT1V_VAL and HOT_INT1V_VAL values are centered around 1V with a 0.001V step. In other words, the range of values [0,127] corresponds to [1V, 0.873V] and the range of values [-1, -127] corresponds to [1.001V, 1.127V]. INT1V == 1 - (VAL/1000) is valid for both ranges.

Calculating the Temperature by Linear Interpolation

Using the data pairs (tempR, VADCR) and (tempH, VADCH) for a linear interpolation, we have the following equation:

(VADCVADCRtemptempR)=(VADCHVADCRtempHtempR)

The voltages Vx are acquired as 12-bit ADC values ADCx, with respect to an internal reference voltage INT1Vx:

[Equation 1]
VADCx=ADCxINT1Vx2121

For the measured value of the temperature sensor, ADCm, the reference voltage is assumed to be perfect, i.e., INT1Vm=INT1Vc=1V. These substitutions yield a coarse value of the measured temperature tempC:

[Equation 2]

tempC=tempR+[{(ADCmINT1Vc(212-1))(ADCRINT1VR(212-1))}(tempHtempR)(ADCHINT1VH(212-1))-(ADCRINT1VR(212-1))]

Or, after eliminating the 12-bit scaling factor (212-1):

[Equation 3]

tempC=tempR+[{ADCmINT1Vc(ADCRINT1VR)}(tempHtempR){(ADCHINT1VH)-(ADCRINT1VR)}]

Equations 3 is a coarse value, because we assumed that INT1Vc=1V. To achieve a more accurate result, we replace INT1Vc with an interpolated value INT1Vm. We use the two data pairs (tempR, INT1VR) and (tempH, INT1VH) and yield:

(INT1VmINT1VRtempmtempR)=(INT1VHINT1VVRtempHtempR)

Using the coarse temperature value tempc, we can infer a more precise INT1Vm value during the ADC conversion as:

[Equation 4]

INT1Vm=INT1VR+((INT1VHINT1VR)(tempCtempR)(tempHtempR))

Back to Equation 3, we replace the simple INT1Vc=1V by the more precise INT1Vm of Equation 4, and find a more accurate temperature value tempf:

[Equation 5]

tempf=tempR+[{ADCmINT1Vm(ADCRINT1VR)}(tempHtempR){(ADCHINT1VH)-(ADCRINT1VR)}]