Supported ICs
Ameba SoC |
RTL8721Dx |
RTL8720E |
RTL8726E |
RTL8713E |
RTL8730E |
RTL8721F |
---|---|---|---|---|---|---|
Supported |
N |
Y |
Y |
Y |
Y |
Y |
Introduction
SoC has integrated a thermal sensor, which can be used to detect and monitor the real-time temperature inside the chip. It has the following features:
Measurement range: -40°C ~ 125°C
Variation: ±1°C (typical), ±3°C (worst)
Provides low-temperature warning, high-temperature warning and over-temperature protection
Provides thermal enable and over-temperature protection enable write access control
Configurable reboot time interval
Records maximum and mininal temperature
Temperature Protection
The temperature protection mechanism is an important feature provided by the thermal sensor, and is implemented as follows:
When the temperature exceeds the configured high-temperature threshold, an interrupt is sent to the CPU, allowing it to decrease its frequency.
When the temperature drops below the configured low-temperature threshold, an interrupt is sent to the CPU, allowing it to increase its frequency.
When the temperature exceeds the configured over-temperature protection threshold, the hardware will automatically shut down the power for over-temperature protection.
Note
By default, the SDK does not automatically adjust the CPU frequency based on the temperature detected by the thermal sensor. If users need to use this feature, please call thermal related APIs to configure the temperature threshold according to the actual application conditions.
After power-off caused by over-temperature protection, the chip will automatically reboot in a predefined time interval and
BOOT REASON: THM
will be displayed in the boot log.
Low Power Mode
When the chip enters deep sleep mode or PG sleep mode, power domain of the thermal sensor is shut down and thermal sensor cannot work.
When the chip enters CG sleep mode, the SDK will disable the thermal sensor by default, making it unable to function as well.
Note
Once the chip enters deep sleep mode or PG sleep mode, the records of maximum and mininal temperature will be lost.
The SDK will enable the thermal sensor again by default after the chip exits CG sleep mode.
Usage
The steps of using thermal to get current temperature are as below:
Set default parameters.
After that, thermal threshold, down sample rate and other parameters can be modified in
TM_InitStruct()
if needed.TM_StructInit(TM_InitTypeDef *TM_InitStruct);
Initialize the thermal.
TM_Init(TM_InitTypeDef *TM_InitStruct);
Configure interrupt and register interrupt callback function.
InterruptRegister((IRQ_FUN)TMIrqHandler, TmIrqNum[CPUID], NULL, 10); InterruptEn(TmIrqNum[CPUID], 10);
Enable the thermal.
TM_Cmd(ENABLE);
Enable the thermal interrupt.
TM_INTConfig(TM_BIT_IMR_TM_HIGH_WT | TM_BIT_IMR_TM_LOW_WT, ENABLE);