STM32H573 not reaching 250 MHz
Hi,
using the code below, the device will not run when set to 250 MHz (PLL1DIVR = 99). It works fine at 200 MHz, and slightly above.
HSE is a 25 MHz crystal.
What am I missing?
static void SystemClockConfig(void)
{
// Must set Vcore to max before we can run at 250 MHz.
PWR->VOSCR = 0b11 << 4;
while ((PWR->VOSSR & BIT(3)) == 0)
;
// Enable HSE.
RCC->CR &= ~BIT(18); // HSE oscillator is not bypassed.
RCC->CR |= BIT(16); // HSE on.
// Wait for HSE stable.
while ((RCC->CR & BIT(17)) == 0)
;
// Setup PLL1
// Set prescaler clock source = HSE.
// Set input frequency range to 4-8 MHz.
// Set FRACEN = 0;
// Set VCOSEL = 0 (192 to 836 MHz)
// Set input prescaler to divide by 5 (25 MHz / 5 = 5 MHz). Allowed input range is 1 to 16 MHz.
// Enable output P.
RCC->PLL1CFGR = 0b00000000000000010000010100001011;
// Set SH_REG = 0 to operate in integer mode.
RCC->PLL1FRACR = 0;
// Fractional latch enable. 0->1 latches the content of FRACN1 into the modulator.
RCC->PLL1CFGR |= BIT(4);
// Set DIV to 80 (5 * 80 = 400 MHz). Set post-divider P = 1, equals / 2 which is minimum. This yields PLL1_P_CK = 200 MHz.
RCC->PLL1DIVR &= 0b11111111111111111111111000000000;
RCC->PLL1DIVR |= 79; // +1 is added to value.
// Enable PLL and wait for lock.
RCC->CR |= BIT(24);
while ((RCC->CR & BIT(25)) == 0)
;
// Set SYSCLK = PLL1.
RCC->CFGR1 = (RCC->CFGR1 & 0xFFFFFFFC) | 0b11;
}
