STM32 gotchas
102. STLink-V3 8MHz MCO output is not derived from crystal

On development boards like Nucleo and Disco, for target processor a HSE crystal is usually not populated. For a more precise clock source than the internal HSI, these boards rely on the MCO output of the on-board STLink, which in its V2 (and V2-1) variants outputs a precise 8MHz based on its own crystal/HSE oscillator.

In the newer V3 version of STLink, instead of the venerable STM32F103 used in older versions, the STM32F723 is used. The main reason for this change is, that STM32F723 is the only STM32 model which features a High-Speed USB interface with an on-chip High-Speed USB PHY. This allows higher download speeds, which becomes increasingly important with STM32 models featuring extensive LCD/GUI support, as graphical assets stored typically in external (usually SPI/QSPI-connected FLASH) memories are relatively large.

However, using the on-chip HS PHY requires usage of crystal in HSE oscillator with one of few particular frequencies. ST made a relatively bad decision, choosing 25MHz, probably because that crystal has been already used in many of their ETH-enabled devboards.

Unfortunately, the clock tree on STM32F723 does not allow to generate 8MHz from the 25MHz HSE onto its MCO pin. So, what it does instead is, that it uses its HSI RC oscillator to output a - not very precise and relatively jittery - 8MHz onto the MCO pin, which is then fed to the HSE input of target processor.

This is an unpleasant surprise for users, which on related Nucleo or Disco boards wish to develop an application which requires precise primary clock.

As a partial workaround, using the STLink update feature in CubeProgrammer, the MCO pin on STLink-V3 can be switched to a mode where it outputs 25MHz/3 = 8.333MHz.


This issue came up in this thread, but has been discussed on the STM32 forum several times since.