2023-08-17 09:08 AM
Hi,
The LSI clock speed changes by 200..300Hz when the voltage regulator switches (ie., when the MCU enters stop 1 mode). Since I calibrate this clock to the 32MHz HSE in running mode (with the normal voltage regulator), it causes an inaccuracy in stop mode (when it uses the low power voltage regulator).
Is there any hint on the difference, how it behaves vs. temperature, or any methods how to calibrate LSI to HSE so that the former turns to be accurate in sleep 1 mode?
MCU: STM32WLE
Thanks in advance!
2023-08-17 10:05 AM - edited 2023-08-17 10:05 AM
Hello @DHoll.1,
One way to calibrate the LSI clock is to use a timer to measure the actual frequency and then adjust the calibration accordingly.
1. Configure Timer input capture to capture the output frequency of LSI over a known period of time.
2. Configure Timer capture compare to compare the measured value based on HSE.
There is an IWDG example in the STM32CubeF4 examples that perform LSI calibration based on PCLK with the above method.
Hope that helps!
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-08-18 04:39 AM
Hi Sarra,
Thank you for replying.
I calibrate the LSI to HSE, however that needs the normal voltage regulator to be active. Then, when the MCU goes to stop 1, the low power voltage regulator gets activated and the LSI frequency changes (possibly due to the voltage inaccuracy between the voltage regulators).
Any idea how to overcome this inaccuracy? It causes > 6000ppm difference.
2023-08-18 04:56 AM - edited 2023-08-18 04:57 AM
Unfortunately, your primary premise is incorrect - beyond the basic operational frequency range, ST gives no promises as per LSI stability (in time, operation context such as other circuitry activity, temperature, supply voltage, etc.), so you are not supposed to use it as a precision time source. Its only specified performance is given by datasheet, and it's a much higher range than you're reporting.
You may try to contact ST directly, through FAE or web support form, and request tighter specifications than that together with procedures to achieve them; but I wouldn't hold my breath. You may want to consider using LSE if you wish to have a more precise clock source.
JW
2023-08-18 09:25 AM
Hi Waclawek,
Yes, it's clear that the LSI is unstable, however, if calibrated often enough to the HSE (such as every minute or on temperature changes, etc.) a reasonable accuracy is achieved: In fact, it works well and highly accurate until I switch the power regulators... I don't currently have LSE in the design so have to take the most out of the LSI..
Yours, Daniel