cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U575 Clock Configuration Confusion

ScottD
Associate II

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?

 

clockconfig.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

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.

TDK_0-1724285303880.png

 

And enable automatic MSIS calibration in RCC:

TDK_1-1724285356626.png

 

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

8 REPLIES 8
MHank.1
Associate III

Although for a different processor this article may help you.

ARM Tutorial Part 1 Clocks 

PartsBin - An Electronic Parts Organizer for Windows
TDK
Guru

> 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.

If you feel a post has answered your question, please click "Accept as Solution".
ScottD
Associate II

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).

 


@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.

AndrewNeil_0-1724284425248.png

The clock source for this counter can be HCLK, or HCLK/8, or LSE, or LSI:

AndrewNeil_2-1724284595416.png

 

AndrewNeil_3-1724284928960.png

 

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.

TDK_0-1724285303880.png

 

And enable automatic MSIS calibration in RCC:

TDK_1-1724285356626.png

 

If you feel a post has answered your question, please click "Accept as Solution".

Not so new, inherited from L4 series. ;)

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
ScottD
Associate II

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.

gbm
Lead III

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). ;)

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice