STM32 Clock Systems Explained: HSI vs. HSE Selection Guide
STM32 Clock Systems Explained: HSI vs. HSE
In the world of embedded systems, the clock is the heartbeat of your microcontroller. If you are reviewing your flashcards or preparing for an embedded interview, you might have come across the terms HSI and HSE.
While the basic definition is simple—Internal vs. External—the engineering reality involves trade-offs between precision, cost, and power consumption. Let’s decode the “Battle of the Clocks” on the STM32 platform.
1. The Source: Where does the pulse come from?
The fundamental difference lies in physical origin.
HSI (High Speed Internal)
- What it is: An RC Oscillator (Resistor-Capacitor) circuit integrated directly into the silicon die of the microcontroller.
- Mechanism: It generates frequency by charging and discharging via internal resistors and capacitors.
- Pros: It is free (no external components), saves PCB space, and has a very fast startup time (wakes up instantly).
- Typical Value: On an STM32F4, this defaults to 16 MHz.
HSE (High Speed External)
- What it is: An external clock source. This can be a Crystal/Ceramic Resonator connected to the
OSC_INandOSC_OUTpins, or a bypass clock source (like an external oscillator chip). - Pros: It provides superior stability and precision.

2. Accuracy: The Critical Factor
This is usually the deciding factor for engineers.
- HSI (The Drifter): Because it relies on R and C components inside the chip, HSI is sensitive to temperature. At room temperature (25°C), it has about 1% deviation. However, as the chip heats up during operation, this can drift by 2-3%.
- HSE (The Sniper): A Quartz Crystal is incredibly stable. Its accuracy is measured in ppm (parts per million). It is virtually immune to the temperature swings that affect the HSI.
3. Usage Scenarios: Which one to choose?
Choose HSI when:
- You are building simple applications (LED blinking, reading buttons, driving simple motors).
- PCB Space and Cost are critical constraints.
- You need the device to wake up from Sleep Mode and execute code immediately (HSI starts much faster than a Crystal).
Choose HSE when:
- USB Communication: High-Speed USB requires tight frequency tolerance (±500 ppm). HSI is generally too unstable for reliable USB enumeration.
- Ethernet / CAN Bus: Protocols that rely on strict timing synchronization.
- Long-term Timing: If you are using the RTC (Real Time Clock) or need precise timers over long periods.
Summary
If you are updating your engineering notes, remember this rule of thumb:
“HSI is convenient, fast to start, but temperature-sensitive. HSE requires external parts but delivers the precision required for communication protocols like USB.”
Mastering the clock tree configuration in STM32CubeMX starts with understanding these hardware fundamentals. Happy coding!