Temperature Sensor

Introduction

The thermal meter of the chip is used to monitor the temperature inside the chip, and provide low-temperature warning, high-temperature warning and over-temperature protection.

  • When the temperature exceeds the limit high-temperature threshold, an interrupt will be sent to the CPU, and the CPU can reduce the frequency.

  • When the temperature exceeds the limit low-temperature threshold, an interrupt will be sent to the CPU, and the CPU can increase the frequency.

  • When the temperature exceeds the limit over-temperature protection threshold, the hardware will automatically power down for over-temperature protection.

Features

  • No calibration

  • Measurement range: -40°C ~ 125°C

  • Variation: ±1.5°C (typical), ±5°C (worst)

  • Resolution: 0.0125°C

  • Clock: 2MHz

  • 19-bit thermal temperature value: 1 signed bit, 8 integer bits, and 10 decimal bits

  • Provides low-temperature warning, high-temperature warning and over-temperature protection

  • Provides access protection for thermal enable bit and over-temperature enable bit

Block Diagram

The thermal block diagram is shown in the following figure.

../../_images/thermal_block_diagram.svg

The thermal module includes the following sub-modules:

  • Bias circuit

    • Generates bias current for bipolar core.

  • Bipolar core

    • Generates temperature-dependent voltages ΔV_BE and V_BE.

  • ∑-∆ ADC

    • Contains a ∑-∆ modulator and a decimation filter.

    • Outputs a temperature-dependent digital value.

  • Controller

    • Controls and manages the interrupts.

    • Controls low-temperature warning, high-temperature warning, and over-temperature protection.

  • Register

    • Contains configuration registers, result registers, and interrupt registers.

    • Provides the interface to software.

    • Allows the measured temperature to be read directly from the registers.

Bipolar Core

To produce a digital temperature reading, a ratio-metric measurement has to be performed: a temperature-dependent signal has to be compared to a reference signal.

While virtually every device has temperature-dependent characteristics, two diode-connected substrate PNP transistors are used to generate two voltages: one with a negative temperature coefficient (V_BE) and one with a positive temperature coefficient (ΔV_BE). They can be used to generate both a voltage that is accurately proportional to absolute temperature (PTAT), and a temperature-independent bandgap reference voltage.

The block diagram of the substrate PNP transistors is shown in the following figure.

../../_images/substrate_pnp_transistors_block_diagram.svg

The relationship between temperature, V_BE, and ΔV_BE is shown in the following figure.

../../_images/temperature_dependency_of_key_voltages.jpeg
μ = (α * ΔV_BE) / (V_BE + α * ΔV_BE) = V_PTAT / V_REF
  • V_PTAT = α * ΔV_BE, which is proportional to absolute temperature.

  • V_REF = V_BE + α * ΔV_BE, which is a conventional bandgap reference voltage (around 1.2V), with a zero temperature coefficient.

  • μ is proportional to temperature; α should be chosen reasonably to achieve the target V_REF.

∑-∆ ADC

The ∑-∆ ADC contains a ∑-∆ modulator and a decimation filter. V_BE and ΔV_BE are input to a ∑-∆ modulator, which produces a bitstream bs, of which the average value μ is equal to the ratio of α * ΔV_BE and V_REF. A decimation filter is used to filter the quantization noise from the bitstream bs and perform the required scaling to obtain the ADC output Dout.

The block diagram of the ∑-∆ modulator is shown in the following figure.

../../_images/sigma_delta_modulator_block_diagram.jpeg

The ∑-∆ modulator consists of a loop filter and a clocked comparator. For simplicity, only a first-order loop filter is shown. In the actual modulator, a second-order filter is used. Every clock cycle, the comparator produces a bit of the bitstream bs based on the polarity of the output Vint of the loop filter. The feedback is arranged to drive the output of the integrator to zero.

If the bitstream in a given clock cycle is zero, α * ΔV_BE is integrated, while -V_BE is integrated if the bitstream is one. This can be expressed as follows:

../../_images/integration_bs_equation.png

As a result of the feedback in the modulator, the average input to the integrator is zero. In other words, the charge added by α * ΔV_BE is balanced by the charge removed by -V_BE.

../../_images/charge_equation.png

So ∑-∆ modulator realizes the quantization of μ.

Functional Description

Operation Flow

The operation flow of the thermal sensor is shown in the following figure.

../../_images/thermal_handle_flow.svg

The operation flow is mainly divided into an initialization phase and a continuous monitoring phase. The system continuously compares the sensor output temperature ( TM_OUT ) with three predefined thresholds to adopt different software and hardware protection mechanisms. The specific flow is as follows:

Initialization Phase

After the system starts, it first enters the initialization flow. During this phase, the system executes the following operations sequentially:

  • Configure the relevant parameters of the Analog-to-Digital Converter (ADC).

  • Set temperature thresholds and enable the threshold comparison function. The temperature threshold is a two's complement value corresponding to the Celsius temperature (1 sign bit + 8 integer bits); for example, the threshold for 125°C is 0x7D, and the threshold for -40°C is 0x1D8.

  • Enable the temperature sensor module (this function is enabled by default in the MP version).

  • Enable interrupts to prepare for subsequent temperature warnings and protective actions.

Continuous Monitoring Phase

After initialization is complete, the system enters a continuous temperature threshold determination loop, sequentially performing the following three state detections according to priority:

  1. Over-Temperature Protection Determination (TM_OUT >= TM_HIGH_PT_THR)

The system first determines whether the sensor output temperature ( TM_OUT ) is greater than or equal to the over-temperature protection threshold ( TM_HIGH_PT_THR ).

  • If the condition is met: Trigger a thermal reset.

    • Hardware behavior: The hardware automatically loads the timing period value in TM_TIMER into the AON timer, with the timer unit being 0.65 s. The AON timer is started after the thermal reset is executed, and the system is rebooted after the timer expires.

    • Software behavior: The system will continue to monitor the temperature after rebooting. If the temperature drops below the user-configured safe threshold, all cores will resume normal operation; otherwise, the Application Processor (AP) will remain in a halted state.

  • If the condition is not met: Proceed to the next level of determination.

  1. High-Temperature Warning Determination (TM_OUT >= TM_HIGH_WT_THR)

If a thermal reset is not triggered, the system then determines whether the temperature is greater than or equal to the high-temperature warning threshold ( TM_HIGH_WT_THR ).

  • If the condition is met: Trigger a high-temperature warning interrupt. The system will issue an interrupt request to the CPU, and it is recommended that the user implement strategies such as lowering the main frequency or reducing the operating speed to achieve physical cooling of the system.

  • If the condition is not met: Proceed to the next level of determination.

  1. Low-Temperature Warning Determination (TM_OUT <= TM_LOW_THR)

If no high-temperature protection mechanisms are triggered, the system further determines whether the temperature is less than or equal to the low-temperature warning threshold ( TM_LOW_THR ).

  • If the condition is met: Trigger a low-temperature warning interrupt, issue an interrupt to the CPU, and report the low-temperature warning.

  • If the condition is not met: The system performs no action and directly returns to the starting point of the monitoring loop to restart the next round of TM_OUT threshold determination.

The entire process loops repeatedly to ensure reliable operation of the system within the set safe temperature range.

Acquiring Temperature

When TM_BIT_EN_LATCH is 0, the Celsius temperature measurement result of the thermal sensor is typically stored in the TM_RESULT register in two's complement format, with an effective data width of 19 bits, including 1 sign bit, 8 integer bits, and 10 fractional bits.

Data Conversion Process in Positive Temperature Zone

When the original data is in the [0, 0x3FFFF] range, the Celsius temperature value is non-negative. The conversion rules are as follows:

  • Integer part extraction: [17:10] represents the integer part of the Celsius temperature value.

  • Fractional part extraction: [9:0] represents the fractional part of the Celsius temperature value, which is cast to a floating-point type and divided by 1024.0 to obtain the true fractional value.

  • Result synthesis: Directly add the above integer part and fractional part to obtain the actual floating-point Celsius temperature value.

Data Conversion Process in Negative Temperature Zone

When the original data is in the [0x40000, 0x7FFFF] range, the Celsius temperature value is negative. The conversion rules are as follows:

  • Inverse two's complement operation: Calculate the absolute value according to abs_val = 0x80000 - result.

  • Absolute value separation: After obtaining the absolute value abs_val, reuse the data separation logic from the positive temperature zone to extract its integer part and fractional part respectively.

  • Negative sign restoration: Add the integer and fractional parts together, then prepend a negative sign to the sum to obtain the actual floating-point Celsius temperature value.

Interrupt

The thermal sensor supports the following interrupts:

  • High-temperature warning interrupt (TM_BIT_IMR_TM_HIGH_WT): Generated when the thermal sensor detects that the temperature reaches or exceeds the high-temperature warning threshold. This interrupt is maskable and is disabled by default.

  • Low-temperature warning interrupt (TM_BIT_IMR_TM_LOW_WT): Generated when the thermal sensor detects that the temperature reaches or drops below the low-temperature warning threshold. This interrupt is maskable and is disabled by default.

Power-on Flow

Since the thermal sensor mainly uses an analog circuit to measure temperature, and the analog circuit takes a while to stabilize after power on, additional operations are needed to get the correct temperature.

The thermal sensor keeps power on in default state. When the system powers on, the thermal sensor is on too. But the analog circuit is not stable now, so the current temperature is not correct. To fix this problem, latch is configured to enable by default. After 10 cycles, latch is disabled automatically.

The power-on flow of thermal can be described as the following figure.

../../_images/power_on_flow_of_thermal.svg

Power-on temperature (temp_out_poweron) is the first temperature measured after latch disabled with thermal stabilized. Also tm_max and tm_min start recording only after thermal is stable.

Registers Access Control

The values of thermal registers can be obtained directly by reading the registers' addresses. Also, most of the thermal registers' bits can be programmed by writing values to the registers' addresses directly.

The write access for five specific fields is different from that of other fields. The fields include tm_pow, tm_powcut, tm_rstb, tm_highcmp_pt_en and tm_high_pt_thr. Write flow of these fields is illustrated in the following figure.

../../_images/thermal_special_bits_access_flow.svg

The grant code protects write access to special fields to prevent incorrect operations from disabling the thermal sensor, deactivating over-temperature protection, or setting an incorrect high-temperature protection threshold.

备注

Configuration with TM OSR greater than or equal to three is not supported.

Registers

Base Address: 0x4101D000

Name

Address offset

Access

Description

REG_TM_GAIN

000h

R/W

Thermal parameter a

REG_TM_OFFSET

004h

R/W

Thermal parameter b

REG_TM_CTRL

008h

R/W

Thermal control register,config thermal parameter

REG_TM_TH_CTRL

00Ch

R/W

Thermal threshold control register,config warning and low temperature threshold

REG_TM_RESULT

010h

R

Thermal result register

REG_TM_ADC_RESULT

014h

R

Thermal ADC result register,for debug

REG_TM_MAX_CTRL

018h

R/W

Record thermal max temperature

REG_TM_MIN_CTRL

01Ch

R/W

Record thermal min temperature

REG_TM_OUT_PWR_ON

020h

R

Record thermal output temperature when power on reset

REG_TM_INTR_CTRL

024h

R/W

Thermal interrupt control register

REG_TM_INTR_STS

028h

R/W

Thermal interrupt status register

REG_TM_TIMER

02Ch

R/W

Thermal time register,when over protect temperature,time count value

REG_TM_DUMMY

030h

R/W

REG_TM_GAIN

  • Name: Thermal Meter Gain Register

  • Size: 32

  • Address offset: 000h

  • Read/write access: R/W

Thermal parameter a

31:29 RSVD 28:0 TM_A

Bit

Symbol

Access

INI

Description

31:29

RSVD

R

-

Reserved

28:0

TM_A

R/W

0x08284000

This bit defines thermal meter gain.

  • Bit[28:14]: Integer part

  • Bit[13:0]: Decimal part

REG_TM_OFFSET

  • Name: Thermal Meter Offset Register

  • Size: 32

  • Address offset: 004h

  • Read/write access: R/W

Thermal parameter b

31:22 RSVD 21:0 TM_B

Bit

Symbol

Access

INI

Description

31:22

RSVD

R

-

Reserved

21:0

TM_B

R/W

0x00371700

This bit defines thermal meter offset.

  • Bit21: Signed bit

  • Bit[20:11]: Integer part

  • Bit[10:0]: Decimal part

REG_TM_CTRL

  • Name: Thermal Meter Control Register

  • Size: 32

  • Address offset: 008h

  • Read/write access: R/W

Thermal control register,config thermal parameter

31:24 TM_PWR 23:22 RSVD 21 TM_POW 20 TM_POWCUT 19 TM_CLK_INV_SEL 18 TM_RSTB 17:14 TM_CHOPFREQSEL 13:11 TM_OSR 10 TM_HOLD_EN 9:8 TM_HOLD_DLY 7 TM_CHOP_EN 6 TM_EN_LATCH 5:4 TM_BIAS_SEL 3 TM_BIASDEM_EN 2:1 RSVD 0 TM_ADCCKSEL

Bit

Symbol

Access

INI

Description

31:24

TM_PWR

R/W

0x69

Thm protect password.

Tm_pow,tm_powcut,tm_rstb,tm_highcmp_pt_en,tm_high_pt_thr, iso_thm can be programed only when this value is 8'h69.

23:22

RSVD

R

-

Reserved

21

TM_POW

R/W

0x1

Thermal poweron signal

  • 0:power down

  • 1:power on

20

TM_POWCUT

R/W

0x1

Power cut

  • 0: disable power cut

  • 1: enable power cut

19

TM_CLK_INV_SEL

R/W

0x0

Clock phase invert select when read temperature.

  • 0: not invert (sample data in rising edge)

  • 1: invert (sample data in falling edge)

18

TM_RSTB

R/W

0x1

Thermal reset signal.

  • 0: disable thermal

  • 1: enable thermal

17:14

TM_CHOPFREQSEL

R/W

0x1

Chop frequecy select

  • 0: fs/64

  • 1: fs/128

  • 3: fs/256

  • 7: fs/512

  • 15: fs/1024

13:11

TM_OSR

R/W

0x0

Deci filter DSR select

  • 0: 128

  • 1: 256

  • 2: 512

  • 3: 1024

10

TM_HOLD_EN

R/W

0x0

Hold output

9:8

TM_HOLD_DLY

R/W

0x1

Hold delay, adjust TM_CLK_OUT width

7

TM_CHOP_EN

R/W

0x1

Chop enable

6

TM_EN_LATCH

R/W

0x1

Latch thermal sensor output immediately after power on for more accurate test

5:4

TM_BIAS_SEL

R/W

0x1

Select ADC bias current

  • 0: 8μA

  • 1: 10μA

  • 2: 12μA

  • 3: 14μA

3

TM_BIASDEM_EN

R/W

0x1

Bias DEM enable

2:1

RSVD

R

-

Reserved

0

TM_ADCCKSEL

R/W

0x1

Selelct ADC fs

  • 0: clk_src/256

  • 1: clk_src/128

REG_TM_TH_CTRL

  • Name: Thermal Meter Threshold Control Register

  • Size: 32

  • Address offset: 00Ch

  • Read/write access: R/W

Thermal threshold control register,config warning and low temperature threshold

31 RSVD 30 ISO_THM 29 TM_HIGHCMP_PT_EN 28:20 TM_HIGH_PT_THR 19 TM_HIGHCMP_WT_EN 18:10 TM_HIGH_WT_THR 9 TM_LOWCMP_WT_EN 8:0 TM_LOW_WT_THR

Bit

Symbol

Access

INI

Description

31

RSVD

R

-

Reserved

30

ISO_THM

R/W

0x0

  • 1: ISO signals from thermal power domain

  • 0: Release

29

TM_HIGHCMP_PT_EN

R/W

0x0

To enable compare tm_out with over temperature protect threshold:

When tm_out[18:10] > tm_high_pt_thr, it will set aon reset.

  • 1: Enable the compare;

  • 0: Disable the compare.

28:20

TM_HIGH_PT_THR

R/W

0x07D

Set over temperature protection threshold for comparison with TEMP_OUT.

Only between 0x046 (70°C) and 0x08C (140°C) are valid.

  • Bit28: Signed bit

  • Bit[27:20]: Integer part

19

TM_HIGHCMP_WT_EN

R/W

0x0

To enable compare tm_out with over temperature warning threshold:

When tm_high_thr <= tm_out[18:10] < tm_high_pt_thr, it will set Interrupt pending flag ISR_TM_HIGH.

  • 1: Enable the compare;

  • 0: Disable the compare.

18:10

TM_HIGH_WT_THR

R/W

0x069

Set the over temperature warning threshold for comparison with TEMP_OUT.Only values greater than 0 are supported

  • Bit18: Signed bit

  • Bit[17:10]: Integer part

9

TM_LOWCMP_WT_EN

R/W

0x0

To enable compare TM_OUT with set Low threshold:

When tm_out[18:10] <= tm_low_thr, it will set Interrupt pending flag ISR_TM_LOW.

  • 1: Enable the compare

  • 0: Disable the compare

8:0

TM_LOW_WT_THR

R/W

0x1D8

Set the Low threshold for comparison with TEMP_OUT.

  • Bit8: Signed bit

  • Bit[7:0]: Integer part

REG_TM_RESULT

  • Name: Thermal Meter Temperature Result Register

  • Size: 32

  • Address offset: 010h

  • Read/write access: R

Thermal result register

31:19 RSVD 18:0 TM_OUT

Bit

Symbol

Access

INI

Description

31:19

RSVD

R

-

Reserved

18:0

TM_OUT

R

0x0

This bit defines real temperature. The result refreshes in real time.

  • Bit18: Signed bit

  • Bit[17:10]: Integer part

  • Bit[9:0]: Decimal part

REG_TM_ADC_RESULT

  • Name: Thermal Meter ADC Result Register

  • Size: 32

  • Address offset: 014h

  • Read/write access: R

Thermal ADC result register,for debug

31:22 RSVD 21:0 TM_ADC_OUT

Bit

Symbol

Access

INI

Description

31:22

RSVD

R

-

Reserved

21:0

TM_ADC_OUT

R

0x0

This bit defines thermal meter ADC output. The result refreshes in real time.

  • ADC output is a positive decimal number, real output=tm_out/2^22

REG_TM_MAX_CTRL

  • Name: Thermal Meter Max Temperature Control Register

  • Size: 32

  • Address offset: 018h

  • Read/write access: R/W

Record thermal max temperature

31:20 RSVD 19 TM_MAX_CLR 18:0 TM_MAX

Bit

Symbol

Access

INI

Description

31:20

RSVD

R

-

Reserved

19

TM_MAX_CLR

R/W

0x0

This bit defines clear max temperature

  • 0: not clear

  • 1: clear tm_max value

18:0

TM_MAX

R

0x40000

These bits define max temperature.

REG_TM_MIN_CTRL

  • Name: Thermal Meter Min Temperature Control Register

  • Size: 32

  • Address offset: 01Ch

  • Read/write access: R/W

Record thermal min temperature

31:20 RSVD 19 TM_MIN_CLR 18:0 TM_MIN

Bit

Symbol

Access

INI

Description

31:20

RSVD

R

-

Reserved

19

TM_MIN_CLR

R/W

0x0

This bit defines clear min temperature

  • 0: not clear

  • 1: clear tm_min value

18:0

TM_MIN

R

0x3FFFF

These bits define min temperature.

REG_TM_OUT_PWR_ON

  • Name: Thermal Meter Power On Temperature Register

  • Size: 32

  • Address offset: 020h

  • Read/write access: R

Record thermal output temperature when power on reset

31:19 RSVD 18:0 TEMP_OUT_POWERON

Bit

Symbol

Access

INI

Description

31:19

RSVD

R

-

Reserved

18:0

TEMP_OUT_POWERON

R

0x0

This bit defines output temperature when power on reset.

  • Bit18: Signed bit

  • Bit[17:10]: Integer part

  • Bit[9:0]: Decimal part

REG_TM_INTR_CTRL

  • Name: Thermal Meter Interrupt Control Register

  • Size: 32

  • Address offset: 024h

  • Read/write access: R/W

Thermal interrupt control register

31:2 RSVD 1 IMR_TM_LOW_WT 0 IMR_TM_HIGH_WT

Bit

Symbol

Access

INI

Description

31:2

RSVD

R

-

Reserved

1

IMR_TM_LOW_WT

R/W

0x0

Interrupt control for thermal meter detect low temperature.

  • 0: Disable low temperature detect interrupt

  • 1: Enable low temperature detect interrupt

0

IMR_TM_HIGH_WT

R/W

0x0

Interrupt control for thermal meter detect over temperature warning.

  • 0: Disable over temperature warning detect interrupt

  • 1: Enable over temperature warning detect interrupt

REG_TM_INTR_STS

  • Name: Thermal Meter Interrupt Status Register

  • Size: 32

  • Address offset: 028h

  • Read/write access: R/W

Thermal interrupt status register

31:2 RSVD 1 ISR_TM_LOW_WT 0 ISR_TM_HIGH_WT

Bit

Symbol

Access

INI

Description

31:2

RSVD

R

-

Reserved

1

ISR_TM_LOW_WT

R/W

0x0

Interrupt pending flag for thermal meter detect low temperature.

  • 0: normal

  • 1: interrupt pending

0

ISR_TM_HIGH_WT

R/W

0x0

Interrupt pending flag for thermal meter detect over temperature warning.

  • 0: normal

  • 1: interrupt pending

REG_TM_TIMER

  • Name: Thermal Meter Timer Register

  • Size: 32

  • Address offset: 02Ch

  • Read/write access: R/W

Thermal time register,when over protect temperature,time count value

31:8 RSVD 7:0 TIME_PERIOD

Bit

Symbol

Access

INI

Description

31:8

RSVD

R

-

Reserved

7:0

TIME_PERIOD

R/W

0x0F

Time period of auto power on

REG_TM_DUMMY

  • Name: Thermal Dummy Register

  • Size: 32

  • Address offset: 030h

  • Read/write access: R/W

31:16 RSVD 15:0 DUMMY

Bit

Symbol

Access

INI

Description

31:16

RSVD

R

-

Reserved

15:0

DUMMY

R/W

0x0

Rsvd for hw