SPC58xx Temperature Sensor: Technical Note
SPC58xx Temperature Sensor: Technical Note
Technical note
Introduction
The aim of this document is to detail the usage of the temperature sensor on SCP58xx microcontroller family.
The document provides the necessary information about the hardware and a reference code to calculate the temperature.
All the microcontrollers (MCU) listed in Table 1. Devices list include a temperature sensor (TSENS) that monitors device junction
temperature.
More details about the TSENS can be found in the device's reference manual (see Section Appendix B Reference documents).
Note: SPC582Bx MCU does not support TSENS.
Table 1. Devices list
1 Overview
SPC58xx MCUs include an onboard temperature sensor that monitors device temperature and delivers two
analog outputs signals and three digital output signals. The analog outputs consist of two voltage signals which
vary linearly with the internal junction temperature:
• a voltage signal that is linearly increasing (PTAT: Proportional to absolute temperature)
• a voltage signal that is linearly decreasing (CTAT: Complementary to absolute temperature).
The analog outputs are connected to an input channel of an ADC on the device. The internal junction temperature
must be calculated by software based on the converted temperature values. The three digital outputs, connected
to the PMC module, are used to signal under- and over-temperature operating conditions. These signals notify the
device to take action to appropriately adjust the device temperature in response to an out of specification low or
high temperature operating condition. Calibration parameter values, associated with the temperature threshold
detection feature, are determined and stored in internal flash memory during production testing at the factory.
2 Temperature formula
The Table 2. Calibration constants shows the addresses of the calibration parameters associated to the
temperature sensor in the internal UTEST memory.
P1 Code from the ADC converting PTAT output voltage at 150ºC 0x400004
P2 Code from the ADC converting PTAT output voltage at -40ºC 0x400000
C1 Code from the ADC converting CTAT output voltage at 150ºC 0x400006
C2 Code from the ADC converting CTAT output voltage at -40ºC 0x400002
After the conversion is performed on a test channel the converted data is stored at two CDR locations at the end
of conversion, first location is the CDR belonging to the test channel on which conversion is performed and
second location is the CDR belonging to internal channel on which test channel is mapped.
The C code below is a part of the SPC5Studio temperature sensor component and shows how to calculate the
junction temperature in SPC58xx devices.
int16_t p1,p2,c1,c2;
uint16_t px,cx;
float a,b;
float t1 = (float)150;
float t2 = (float)-40;
/* calculate temperature */
temperature = t2 + (((t1-t2)*a)/(a+b));
where:
tsens_config.constants_address = 0x00400000
tsens_config.vbg_channel = 121U
tsens_config.tsens_channel = 120U
Table 4. Acronyms
Revision history
Contents
1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2
1.1 Linear temperature sensor (analog output generation) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2 Temperature formula . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3 Example code for temperature calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Appendix A Acronyms and abbreviations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Appendix B Reference documents. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7
Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8