1. Introduction
This document is providing guidance for LSE and HSE crystals selection and how to perform frequency centering.
Customers must ensure:
- No stability issue: this is mainly to ensure crystal selected is in line with our gmcrit requirement.
- LSE and HSE are properly frequency centered.
- LSE frequency must be centered to ensure RTC accuracy or avoid RF disconnection concern for example.
- HSE frequency must be centered to respect standard requirements.
- LSE frequency must be centered to ensure RTC accuracy or avoid RF disconnection concern for example.
For more details, please refer to:
- AN5042 [1] How to calibrate the HSE clock for RF applications on STM32 wireless MCUs
- AN2867 [2] Precise HSE frequency and startup time tuning for STM32 wireless MCUs Guidelines for oscillator design on STM8AF/AL/S and STM32 MCUs/MPUs
- AN5948 [3] How to develop RF hardware using STM32WBA MCUs.
2. Crystal key parameters
Crystal manufacturers usually provide main parameters shown below:
- Frequency variation
Initial offset:
This is offset at ambient temperature and provided in ppm.
+/-10 ppm in example used.
Temperature variation
This is offset over temperature range and provided in ppm.
Aging variation
This is offset over temperature range and provided in ppm.
- Electrical characteristic
The figure below shows crystal equivalent circuit.
The Main parameter to consider are load capacitance, ESR, and shunt capacitance.
The formula below can be used to define gmcrit parameter associated to a selected crystal.
3. HSE: crystal selection and center HSE frequency
3.1. Crystal selection: STM32WBA HSE requirements
High-speed external (HSE32) clock is mandatory (32 MHz crystal or external clock source).
STM32WBAx includes internal programmable capacitances to trim the crystal frequency so that no external load capacitances are needed along 32MHz crystal.
Recommended part (or equivalent): NX1612SA-32MHZ-EXS00A-CS09166.
Please refer to STM32WBA datasheet and reference manual for HSE requirements.
Key parameters are:
- Crystal load capacitance parameter
We do recommend using a 8pF Xtal.
HSE frequency tuning is achieved thanks to HSETRIM internal parameter (internal programmable capacitances)
It will allow around 70 ppm trimming capability with HSETRIM parameter.
- gmcrit
We must ensure selected crystal has 2.2mA/V max as gmcrit.
The figure below shows the maximum values for ESR, C0 and CL.
A crystal having parameters that are higher than the displayed lines shown below is not supported.
3.2. STM32WBA: tuning HSE frequency
RF frequency accuracy is directly linked to HSE accuracy.
Let's first review RF frequency accuracy requirements.
3.2.1. Bluetooth® Low Energy requirements
Bluetooth® Low Energy specification is requiring +/-150 kHz (+/-60 ppm) offset max.
Using Xtal that would have 10 ppm initial offset, 30 ppm variation over temperature and 10 ppm aging variation, we will be able to limit entire production within 60 ppm offset specification.
3.2.2. 802.15.4 requirements
802.15.4 PHY is requiring +/-40 ppm max.
3.2.3. How to center HSE with STM32WBA
HSE must be tuned to ensure an accurate 32 MHz thanks to STM32WBAx internal programmable capacitances (HSETRIM).
3.2.3.1. Needed tools
The BLE_TransparentMode application is available by downloading the STM32CubeWBA MCU Package [4].
STMicroelectronics also provides a dedicated GUI PC tool called STM32CubeWise Bluetooth® LE Explorer (STM32CubeWiSEbe) [5].
3.2.3.2. Practical example
Find below a step-by-step approach demonstrating how easy it is to define HSETRIM value.
- Step1
Use “RF Tests” panel of STM32CubeWiSEbe PC tool.
Generate a tone at wanted frequency and power.
Check frequency error on spectrum analyzer.
- Step2
Edit “HSE_tune_WBA.py” available in STM32CubeWiSEbe script folder and define new HSETRIM tested value (0x1B in below example).
- Step3
Use “scripts” panel of STM32CubeWisebe and launch “HSE_tune_WBA.py”.
Get back to “RF test” panel and generate a tone to check HSE centering.
Repeat step 2 and 3 to define optimized HSETRIM value.
- Step4
You can then use « trim_param_otp.py » script to set this HSETUNE value in OTP.
4. LSE: crystal selection and center LSE frequency
4.1. Crystal selection: STM32WBA LSE requirements
Low-speed external (LSE) clock is optional for STM32WBA5x and STM32WBA6 series.
See the dedicated wiki page for how to run an RF application on the STM32WBA without an LSE crystal: How to run an RF application on the STM32WBA without LSE crystal.
It is mandatory for STM32WBA2x series.
Please refer STM32WBA datasheet and reference manual for LSE requirements.
Key parameters are:
- gmcrit
Customer should calculate gmcrit of selected crystal.
LSE drive should then be set according below table.
For example, if you get a crystal with gmcrit of 2 uA/V, "High drive" should be selected and defined in your FW application as per below
HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_HIGH);
A crystal having a gmcrit above 2.70 mA/V cannot be supported.
- Crystal load capacitance parameter
Designs targeting low-power consumption are likely to use resonators with relatively small load capacitance.
Recommended part (or equivalent) is a 6 pF Cload crystal: NX1612SA-32MHZ-EXS00A-CS09166.NX1610SE-32.768KHZ-EXS00A-MU01501.
Such crystal is frequency centered through external 6 pF capacitors as per below picture.
4.2. STM32WBA: tuning LSE frequency
LSE must be tuned to ensure an accurate 32.768 kHz thanks to external capacitors on each side of 32 kHz crystal.
Here is simple method is to measure LSE frequency and tune it.
- Step1
Output LSE frequency on MCO or LSCO pins of STM32WBA.
As example, using below function, we will output LSE frequency on PA2 pin.
HAL_RCCEx_EnableLSCO(RCC_LSCOSOURCE_LSE);
- Step2
You can then use a frequency meter to read LSE frequency.
If LSE frequency > 32.768 kHz → increases external capacitors value.
If LSE frequency < 32.768 kHz → decreases external capacitors value.
5. References


