0
\$\begingroup\$

I am using STM32L051, our task has two requirements for clock management:

  1. Need to be running under 16Mhz or higher frequency (thus we use the MSI/HSI for Systick) for fast task processing.
  2. Need a higher precision clock source (50ppm 32khz LSE is ok; and our board has an external 20ppm 32khz crystal) to limit the clock deviation to about 100ms per 30minutes.

How can I configure the clock system to use both the MSI/HSI (for Systick) and external 32khz crystal (for lower clock deviation)?

I have searched the datasheet and google a lot, however didn't find a solution. I am not familiar with MCU development. Please kindly refer me to the datasheet section (several keyword is ok) or cortex-driver API for further research, thanks!

\$\endgroup\$
  • \$\begingroup\$ You're should look at the clock tree in the microcontroller reference. \$\endgroup\$ – Chad Kennedy Sep 29 '15 at 13:06
0
\$\begingroup\$

Of course, you able to use two clock sources. Read Reference manual (RM0377, http://www.st.com/web/en/resource/technical/document/reference_manual/DM00108282.pdf), section Reset and clock controls.

Core and peripherals will work with HSI, multiplied by PLL (if you want work on frequency, not equal to 16MHz), and RTC will be clocked by low-speed crystal.

Also, if you don't needed power saving features, you may use only one high-speed crystal (8 MHz, for example), and feed clock via PLL to core and via prescaler - to RTC. You may find details in ref.manual, figure 'Clock tree (STM32F03x and STM32F05x devices)'.

PS you may use RTC wakeup interrupt instead of systick timer. This will provide more accurate period measurements.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.