cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 MSI (MSIK) PLL Mode/Auto Calibration: Frequency Error

BCowp.1
Associate II

I have a STM32U595 with a 32.768kHz LSE oscillator.

I wish to generate a 1ms/1kHz timebase with the accuracy/drift characteristics of the LSE, so naturally I went to make use of the "Hardware auto calibration with LSE (PLL-mode)" feature.

Firstly, can I say that there is generally nowhere near enough detail for this feature in the STM32U5 documentation, which is probably a contributing factor to my issue. The L4 series has some random powerpoint presentations which shed a bit more light, but that's assuming this feature works the same in the U5 series.

When I turn on MSI PLL-Mode, MSIK does not appear to lock to actual frequency specified. When I compare RTC calibration to MSIK fed to MCO on a 'scope MSIK does appear to phase lock in terms of drift. However, whereas the RTC calibration output is very very close to 1Hz, the MSIK frequency is actually worse then without the PLL-mode.

To rule out the 'scope, I used my (supposedly) PLL'd MSIK as the kernel clock for a LPTIM (to avoid clock synchronising) and generated a 1Hz PWM signal. When I do this, the RTC generated 1Hz and MSIK derived 1Hz are not the same, and can be seen to drift past each other.

I sincerely hope it isn't the case, but is it possible that a "100kHz" MSIK is in fact 98.304kHz (ie 3 x 32.768kHz) when PLL-mode is turned on? That would be very disappointing.

Could I have more (some) details regarding exactly how "PLL-Mode" works?

Edit:

I (think I) have confirmed this: If I assume the "100kHz" clock from MSIK is in fact 32.768kHz x3 = 98.204kHz, and set the timer period accordingly (to 98303 instead of 99999) to generate a 1Hz signal, I see complete phase/frequency lock between the RTC 1Hz, the MSIK MCO output and my timer generated 1Hz.

ST, I should not have to tell you this, but 100 != 98.304.

1 ACCEPTED SOLUTION

Accepted Solutions
Jaroslav JANOS
ST Employee

Hello @BCowp.1,

I am sorry you are disappointed with the documentation of STM32U5 and this feature. Could you be please more specific about what kind of information you were searching for and where?

Anyway I am afraid the typical frequency of range 15 in MSI PLL-mode, you are referring to, is clearly stated in the datasheet (link) and is 98.3 kHz. So this precisely meets your observations.

Best regards,
Jaroslav

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.

View solution in original post

3 REPLIES 3
Jaroslav JANOS
ST Employee

Hello @BCowp.1,

I am sorry you are disappointed with the documentation of STM32U5 and this feature. Could you be please more specific about what kind of information you were searching for and where?

Anyway I am afraid the typical frequency of range 15 in MSI PLL-mode, you are referring to, is clearly stated in the datasheet (link) and is 98.3 kHz. So this precisely meets your observations.

Best regards,
Jaroslav

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.

Hi Jaroslav,


I am sorry you are disappointed with the documentation of STM32U5 and this feature. Could you be please more specific about what kind of information you were searching for and where?


Have you read the STM32U5 reference manual? There is one short paragraph dedicated to PLL-Mode, and the only single sentence that begins to explain what PLL-Mode actually does/is states:
"When configured in PLL-mode, the MSIS or MSIK automatically calibrates itself thanks to the LSE."

Well, imagine you are an engineer attempting to develop a solution with your product; what would you expect? If you configure an oscillator to run at "100kHz" (or any other set frequency), you would naturally expect it to run at that frequency. If you enable a mode stated to give higher accuracy, you would naturally expect it to be more (not less) accurate, ie closer to 100kHz.

If it does not behave that way (which it doesn't), then the reference manual should mention this unexpected behaviour, don't you think?! Or even better, the reference manual could outline how the Auto-Calibration mode works. If the manual explains how the MSI frequencies are derived when in PLL-Mode, the reader might stand half a chance.  

Thank you for pointing out that table in the datasheet; I had neglected to check table 74 on page 247 out of 386 of the datasheet...

Hello @BCowp.1,

I understand your point, unfortunately it is only MSIRC3 in PLL-mode which is off by more than 1 %. Anyway I made steps to fix this in the reference manual and add there some note. Thank you for your feedback!

BR,
Jaroslav

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.