EC FW - FanControl
Fan Control – System Fan Control Mechanism
EC Firmware's control of system temperature can be divided into the following three main parts:
Temperature sensing and reading:Read real-time temperature information from the CPU chip.
Fan control logic:The system determines the most accurate or highest temperature value based
Fan operation status monitoring:Regularly check whether the actual fan speed falls within the
This article will provide a detailed explanation of the logic and implementation principles of the three
parts mentioned above.
Read system temperature: PollingThermal function PollingThermalThe main function
ReadCPUTemp – Reads CPU temperature:The real-time temperature of the CPU core or the
Validate Temperature – Temperature value check:Verify the validity of the temperature data
Trigger Notification – Exception or Change Handling:If the temperature change exceeds the
ReadCPUTemp function – Temperature reading process description
ReadCPUTempThis is the main function in EC Firmware responsible for reading CPU temperature.
Its execution logic is as follows:
- Establishing a Thermal Diode Table:
EC Firmware will predefine aThermal Diode TableThis table contains information on all
SMBusSlave Address
correspondingTemperature reading command (Command)
- Query and transmit temperature reading commands:
Before EC reads the CPU temperature through the SMBus interface, it will determine the
- Verify that the read was successful:
If the groupSlave Address and Command are correct.This will allow you to successfully
If the read fails (e.g., no response or invalid data returned), EC will automatically...
- Exception handling mechanism:
If the system still cannot obtain the temperature by trying all the supported thermal
Thermal Table as shown below –
Advanced processing flow for temperature monitoring and fan control
Phase Two: Verifying the Temperature Data from the Remote Thermal Diode
After the EC reads the CPU temperature via the Remote Thermal Diode, it first checks if the value is
within a valid range. According to the SMBus data format:
0x00 – 0x7FIndicates a positive value (corresponding to a temperature range of 0°C to 127°C).
0x80 – 0xFFThis indicates a negative value (which is not typically seen in common operating
environments).
The original settings only accepted a temperature range of 10°C to 127°C as the effective temperature
range. However,Some CPUs may have a temperature reading below 10°C when powered on at 0°C.To
ensure compatibility, most platforms adjust the effective temperature range to [specified range].
0°C to 127°C。
Overheating treatment:
If detectedCPU temperature exceeds the system-defined shutdown threshold.And this
EC Firmware will execute proactively.System shutdownThis is to avoid damage caused
by overheating.
Phase 3: Temperature Change Triggers Protection Event (Q-Event)
To enable the system to respond to thermal changes in real time, EC Firmware triggers corresponding
Q-Events based on temperature fluctuations:
When the system temperature rises or falls above a preset threshold (e.g.)±5°CWhen this happens,
The BIOS can perform corresponding protection actions based on this event (such as
adjusting power consumption mode, reducing brightness, limiting CPU functions, etc.).
As the temperature continues to rise to100°CEC will then send another Q-Event, explicitly
Fan control logic
EC Firmware employs a stepped fan control logic to respond to different temperature stages, as
detailed below:
Read fan speed setting:
from EARTHQUAKEChinaFanxStep(The maximum fan speed), and use this as the
Judgment mode and temperature parameters:
Based on the current mode (e.g.)TJ100、TJ85、Silent Mode or Performance Mode),
Controlling fan speed up/down:
If the current temperature is higher than the level of the stage...Upper limit
Fan level +1
If the current temperature is lower than the level of the stage it belongs to.Lower limit
Fan order -1
EC achieves a balance between cooling and quiet operation by precisely controlling the fan speed
through this dynamic adjustment mechanism.
Fan speed monitoring – using the Timer module
EC Firmware viaMFT16 (Multi-Function Timer 16-bit) ModuleThis is used to accurately calculatethe actual fan speed. The principle and calculation logic are as follows:
1. Obtain the pulse width.
The fan speed usually passes throughTACH feedback signal(Tachometer Feedback) is
EC uses the timing function of the Timer module to detect fromThe signal count starts
This pulse cycle corresponds to a portion of the fan's rotation (usually half a revolution,
2. Calculate the time required for one complete rotation.
Assuming the fan needs to complete one revolution...NTACH pulse wave, rule:
Time required for one rotation (seconds) = Single pulse time × N3. Convert to rotational speeds per minute (RPM)
The unit for fan speed is RPM (Revolutions Per Minute).
Therefore, the "time required for one revolution (in seconds)" needs to be converted into
Fan speed calculation and control algorithm
I. Fan Speed Calculation Formula
EC utilizes the built-in TimerModuleThe basic formula for calculating the actual fan speed is as follows:
1. Lap Time Calculation:
Time required for the fan to complete one revolution = Number of pulses per revolution ×
(132768 × (0xFFFF − TxCRA/B))
32768Timer clock frequency (Hz)
TxCRA/BThe timer count value (obtained from the MFT module).
Required per lapPulse wave numberDepending on the fan design, a common pulse
2. RPM (Rotational Speed) Calculation:
RPM = 60, the time required for the fan to complete one revolution.
II. Speed Range Table Mechanism
To ensure that the fan operates within the expected range, EC Firmware establishes a TxCRA/B upper
and lower limit comparison table based on the deviation range of every 100 RPM.
If the calculation yieldsTxCRA/BIf the value falls within the upper or lower limit range of the
If the speed deviates from this range, it indicates an abnormal fan speed, requiring voltage
III. Fan Speed Control Logic (func_FanSpeed Algorithm)
func_FanSpeedThe core function for controlling fan speed has the following logic:
1. Control condition judgment:
If the system is inDOS modeAnd executePE test program(e.g., fan verification tools), then:
EC pauses control of fan speed, allowing PE program to manage fan adjustments.
Otherwise, proceed with the normal control process:
2. Normal control logic:
EC reads the current actual fan speed and compares it with the range in the lookup table.
If the rotation speed is lower than the lower limit→ Increase the fan control voltage
If the rotation speed is higher than the upper limit value→ Reduce fan control voltage
3. Fail-safe handling:
If the fanIt remains stationary for more than 60 seconds.Even if the voltage has been adjusted:
EC will send it directlyMaximum control voltage (maximum PWM Duty)Force the fan to
If it still cannot rotate → the fan is faulty.
留言
張貼留言