cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to use ThreadX with LSE

Chamo
Associate II

Hello, I'm using the demoboard B-U585-I-IOT02A with ThreadX. My internal clock is 160 MHz and I currently use it for ThreadX. I'm doing some tasks periodically every one threadX second but it seems that my HSI has a small inaccuracy of 0.3%. But since I want to be more precise than that, I wanted to use the threadX timer with the LSE which is much more precise. I would know if it is possible to do this? I tried basing the SysTick on the LSE and several other manipulations but I keep getting the 0.3% inaccuracy.

Thank you in advance,

1 ACCEPTED SOLUTION

Accepted Solutions
Chamo
Associate II

I just figured out why I had not a good accuracy even with the MSIS auto calibration. I obviously forgot to set MSIPLLSEL bit to use MSIS ( I thought CubeMx generated it when I chose MSIS Auto Calibration). For those who had the same problem :

  • Refer to Reference Manual section 11.4.3 - MSI (MSIS and MSIK) clocks and go to subsection Hardware auto calibration with LSE (PLL-mode).
  • If you're using HAL library, simply add this line to your project : HAL_RCCEx_EnableMSIPLLModeSelection(RCC_MSISPLL_MODE_SEL);

Thank you again Stéphane for your answer for the MSIS. It solved my problem. Have a great day

View solution in original post

4 REPLIES 4
StéphaneM
ST Employee

Hello Chamo

Here are a few suggestions.

As source clock, you may want to use either :

  • the HSE clock which has a few ppm accuracy
  • the MSI clock . The MSI has a PLL mode allowing to get the LSE accuracy on MSI.

Best regards,

Stéphane

Hello Stéphane,

Thank you very much for your time and for your answer.

Unfortunately I do not have currently HSE on the demoboard and I cannot use it for now.

For the MSI clock, I'm currently trying to use it but I keep having pretty inaccurate value (I mean not enough for me). I did set MSIS auto calibration and set MSIS to 48KHz. Do you know if there is another way to use a clock with LSE accuracy for ThreadX (to obtain the time since startup with tx_time_get function).

Once again, thank you for your answer.

Chamo
Associate II

I just figured out why I had not a good accuracy even with the MSIS auto calibration. I obviously forgot to set MSIPLLSEL bit to use MSIS ( I thought CubeMx generated it when I chose MSIS Auto Calibration). For those who had the same problem :

  • Refer to Reference Manual section 11.4.3 - MSI (MSIS and MSIK) clocks and go to subsection Hardware auto calibration with LSE (PLL-mode).
  • If you're using HAL library, simply add this line to your project : HAL_RCCEx_EnableMSIPLLModeSelection(RCC_MSISPLL_MODE_SEL);

Thank you again Stéphane for your answer for the MSIS. It solved my problem. Have a great day

Great !