Repository navigation
Conversation
SystemClock_Config() enabled the main PLL (HSI16 / 2 x 16 / 2 = 64 MHz) but selected HSE as SYSCLK, so the core ran at 32 MHz and the PLL output was unused. Feed the PLL from HSE / 2 = 16 MHz (N = 8, R = 2) and select it as SYSCLK: HCLK1, HCLK4, PCLK1 and PCLK2 run at 64 MHz, HCLK2 (CPU2) stays at 32 MHz (divider 2), with 3 flash wait states. The PLL input is shared with PLLSAI1, which clocks the PDM microphone on SAI1. It now comes from the HSE crystal instead of HSI16, and 16 MHz still divides 128 MHz, so PLLSAI1 can give 64 MHz to SAI1 with N = 8. Signed-off-by: Sébastien Nedjar <sebastien.nedjar@univ-amu.fr>
nedseb
marked this pull request as ready for review
November 30, 2026 02:36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #2526, which added the STeaMi board (
STEAM32_WB55RG).If I read
SystemClock_Config()correctly, the variant enables the main PLL (HSI16 / 2 x 16 / 2 = 64 MHz) but selects HSE as SYSCLK, so the core runs at 32 MHz and the PLL output is not used. This PR feeds the PLL from HSE / 2 = 16 MHz (N = 8, R = 2) and selects it as SYSCLK, so the core runs at 64 MHz. CPU2 stays at 32 MHz (HCLK2 divider 2), and the flash latency goes from 1 to 3 wait states. OnlySystemClock_Config()of this variant changes.This PR fixes/implements the following bugs/features
Motivation
The current configuration has two effects:
BLE.begin()and a scan), as it does under MicroPython.The settings are the same as
STM32WB5MM_DK(HSE / 2 = 16 MHz, N = 8, R = 2, HCLK2 / 2, 3 WS). A 16 MHz input is what the HAL recommends to limit PLL jitter (stm32wbxx_hal_rcc.h), and it still lets PLLSAI1 give 64 MHz to SAI1 with an integer N (8).The STeaMi MicroPython firmware (steamicc/micropython-steami,
ports/stm32/powerctrlboot.c) already runs this board at 64 MHz from an HSE-fed PLL, with CPU2 at 32 MHz and 3 wait states, together with the BLE stack and the microphone.Other clocks (HSE for the radio and SMPS, HSI16 for LPUART1 /
Serial, HSI48 for USB and RNG, LSE) and the CPU2 semaphores are unchanged. As far as I can see, I2C, SPI, HardwareTimer andtone()compute their dividers at run time, so they should follow the new bus clocks.Validation
Measured on a STeaMi V1c (STM32WB55RG), with the same tests at 32 MHz (before) and 64 MHz (after):
HAL_RCC_GetHCLK2Freq())One thing that might look like a regression: in full duplex at 921600 baud (an echo sketch), the host sometimes receives a 64-byte block twice at 64 MHz. This is #3125: with a 128-byte TX buffer the copies become 128 bytes, and with an atomic
write()they disappear.Sketch to check the clock tree: