2024-08-21 01:23 PM
I have a custom board that I am getting ready to program that is using the STM32U575. I am a little confused about the clock configuration. My board has an external 32768 crystal. I am not sure I have the MX program clock configuration correct. I want the internal clocks running at full 160mhz speed with the internal clocks calibrated by the external 32768. Below is a screen shot from the MX clock configuration. I think I might not have the settings correct. Could you please check the configuration to see if I am configuring the clocks correctly.
A second minor question that I am confuzzled about. I noticed the code generated by MX program initializes SysTick. Is that the same as the SysClk?
Solved! Go to Solution.
2024-08-21 05:10 PM
Oh interesting. You are correct, apologies. That's new with the U5. So you can do it, but you will need to use the MSIS as the PLL clock source, not HSI.
And enable automatic MSIS calibration in RCC:
2024-08-21 02:14 PM
Although for a different processor this article may help you.
2024-08-21 02:43 PM - edited 2024-08-21 05:17 PM
> I want the internal clocks running at full 160mhz speed with the internal clocks calibrated by the external 32768.
There is no automatic calibration of the internal clocks to the LSE clock. If you need an accurate clock, use an HSE crystal or clock as a source.
You are using the HSI as a clock, which is okay but not super accurate. See details in the datasheet. Generally +/- 1% or so.
You can adjust the HSI by applying a trim value, but it's never going to be as accurate as an external crystal.
> I noticed the code generated by MX program initializes SysTick. Is that the same as the SysClk?
SysTick and SYSCLK are different, they have no relation to each other.
SysTick is an interrupt that happens every 1 ms (typically) and is used by HAL to keep track of time. SYSCLK is an internal clock that gets fed to HCLK before the prescaler.
2024-08-21 04:02 PM
The following is from the STM32U5 Users Manual. This seems to say that the clocks can be synchronized against the LSE. Am I misunderstanding what it states?
Hardware auto calibration with LSE (PLL-mode)
When a 32.768 kHz external oscillator is
present in the application, it is possible to
configure either the MSIS or the MSIK in a
PLL-mode. This mode is enabled:
• for MSIS by setting MSIPLLEN with MSIPLLSEL = 1 in RCC_CR
• for MSIK by setting MSIPLLEN with MSIPLLSEL = 0
In case MSIS and MSIK ranges are generated from
the same MSIRC source, the PLL-mode is applied
on both MSIS and MSIK. When configured in
PLL-mode, the MSIS or MSIK automatically
calibrates itself thanks to the LSE. This mode
is available for all MSI frequency ranges. At
48 MHz, the MSIK in PLL-mode can be used for
the OTG_FS, or the USB, avoiding the need of an
external high-speed crystal. If LSE clocks
pulses are stopped, the MSI PLL-mode is
automatically unlocked, and the MSI accuracy is
consequently degraded. On all STM32U5 devices
except STM32U575/585 rev. X, the MSI PLL-mode
unlock event is connected to an EXTI line: this
is used to generate an event or interrupt
supporting wake-up from Stop 0, Stop 1, or Stop
2 mode (see Table 118: Interrupt sources and
control and Table 187: EXTI line connections).
2024-08-21 04:59 PM - edited 2024-08-21 05:02 PM
@TDK wrote:SysTick is an interrupt that happens every 1 ms (typically)
Well, SysTick is a counter (or "timer") - it can be used to generate an interrupt, if required.
The clock source for this counter can be HCLK, or HCLK/8, or LSE, or LSI:
2024-08-21 05:10 PM
Oh interesting. You are correct, apologies. That's new with the U5. So you can do it, but you will need to use the MSIS as the PLL clock source, not HSI.
And enable automatic MSIS calibration in RCC:
2024-08-22 01:56 AM
Not so new, inherited from L4 series. ;)
2024-08-22 10:33 AM
One more thing I noticed. I have used various M4 and M7 microcontrollers over the years. The peripheral clock is usually SysClk/2. The clocks going out to the UART, I2C,... are 160mhz. Does the M33 core allow the full sysclk speed, or should those clocks be sysclk/2? The configurator does not seem to be balking at the 160 value.
2024-08-22 10:37 AM - edited 2024-08-22 10:38 AM
Maximum clock speeds of internal buses and peripherals do not depend on the processor core used in a microcontroller. They are the features of a particular STM32 family. In L4 family (CM4-based) all peripherals may run at core clock.
See the datasheet or CubeMX clock configuration tab for details - max. frequencies are shown there (most of them correctly). ;)