cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H573 not reaching 250 MHz

Dimlite
Associate II

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;

}

1 ACCEPTED SOLUTION

Accepted Solutions

Not really looking to pick through your bare metal code.

I would suggest more effective ways of masking on data to registers, and watch particularly blind writes to registers, like VOS

Check with HAL examples, see if those work. Even if that's not what you want to use in the end, it establishes a situation others might care to look into or replicate.

For custom board check VCAP, and supplies in general

Watch wait states in FLASH

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

4 REPLIES 4

Not really looking to pick through your bare metal code.

I would suggest more effective ways of masking on data to registers, and watch particularly blind writes to registers, like VOS

Check with HAL examples, see if those work. Even if that's not what you want to use in the end, it establishes a situation others might care to look into or replicate.

For custom board check VCAP, and supplies in general

Watch wait states in FLASH

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
SofLit
ST Employee

Hello,

As stated by Tesla, start by using the HAL. If it does not reach the frequency, indeed, there is an issue otherwise you need to check your code and inspire from the HAL to access to the registers.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

I agree with you that HAL might be useful for finding working examples, but the HAL code is terrible in terms of readability and ruins the understanding of the MCU by adding an intermediate layer. I want to master the MCU, not the HAL.

Anyway, increasing the flash wait state did the trick.

Thank you very much!

Dimlite
Associate II

For those interested, here is the working code.