English
Language : 

AN4631 Datasheet, PDF (8/30 Pages) STMicroelectronics – How to calibrate an STM32L0xx internal RC oscillator
Internal RC oscillator calibration
For the MSI oscillator, the calibration value is loaded in the MSICAL[7:0] bits after reset.
Eight trimming bits MSITRIM[7:0] are used giving a wide tuning range. The calibration is
based on adding the default MSICAL[7:0] bits (reset value) to the MSITRIM[7:0] bits.
The result is stored in MSICAL[7:0]:
MSICAL[7:0] = default MSICAL[7:0] + MSITRIM[7:0]
Example:
Assuming the default MSI calibration value MSICAL[7:0] is 0x80.
1. Writing a value between 0x01 and 0x7F in MSITRIM[7:0] leads to calibration value
MSICAL[7:0] in the range of:
MSICAL[7:0] = 0x80 + 0x01 = 0x81
and MSICAL[7:0] = 0x80 + 0x7F = 0xFF
These results are greater than 0x80 (default MSI[7:0] value) and consequently the MSI
frequency is increased by 1 step (0x81 - 0x80) to 127 steps (0xFF - 0x80).
2. Writing a value between 0x81 and 0xFF in MSITRIM[7:0] leads to calibration value
MSICAL[7:0] in the range of:
MSICAL[7:0] = 0x80 + 0x81 = 0x01
and MSICAL[7:0] = 0x80 + 0xFF = 0x7F
These results are lower than 0x80 (default MSI[7:0] value) and consequently the MSI
frequency is decreased by 1 step (0x01) to 127 steps (0x7F).
3. Writing the default calibration value (0x80) in MSITRIM[7:0] leads to calibration value
MSICAL[7:0] equal to MSICAL[7:0] = 0x80 + 0x80 = 0x00 and consequently the MSI
frequency is decreased by 128 steps (minimum frequency).
8/30
DocID027266 Rev 2