Skip to main content
Graduate
May 16, 2025
Solved

Clock frequency for STM32F303

  • May 16, 2025
  • 3 replies
  • 804 views

Hi,

I used to run my STM32F303RE at 72Mhz clock from a 8Mhz CMOS oscillator. . Timers8/1 operated at 72Mhz as well. That worked fine. 

I had to change the CMOS oscillator from 8 to 24Mhz.

I tried two modifications, see attachment:

a) I changed PLLMul from x9 to x3 and left PREDiv. at /1.

b) I changed PREDiv to /3 and left PLLMul at x9.

In both cases CubeIDE clocktree was fine with the setup, 72Mhz imput clock at Timers8/1.

Eventually now the input clock of the timers is low by factor 9, it is 8Mhz. 

What did I miss?

Thank you.

Cheers

Detlef

 

    This topic has been closed for replies.
    Best answer by Tesla DeLorean

    Yes, sounds odd, not sure if we're missing some detail.

    If you're using an XO (External Oscillator), rather than a crystal, you should be using HSE_BYPASS mode.

    The Classic F3 architecture doesn't allow for different TIMCLK sources (Peripheral Clocks)

    3 replies

    Graduate II
    May 16, 2025

    Yes, sounds odd, not sure if we're missing some detail.

    If you're using an XO (External Oscillator), rather than a crystal, you should be using HSE_BYPASS mode.

    The Classic F3 architecture doesn't allow for different TIMCLK sources (Peripheral Clocks)

    Super User
    May 16, 2025

    >Eventually now the input clock of the timers is low by factor 

    I dont unterstand: how you know, what is the real timer clock now? And changing HSE and adapt divider will not change the timer clock.

    DetlefSAuthor
    Graduate
    May 16, 2025

    Hi,

    I know the real timer clock by routing the output of the timer to an output pin and hooking up an oscilloscope or a counter. This works fine since decades.

     

    I don't know how to bypass HSE input logic, this block is grayed out, maybe there are switches which are not available with CubeIDE.

     

    I just realized another weird aspekt: the baudrates for USART2 work fine, so the USART seems to have the exspected clockrate. I will check the clock frequency for the processor kernel with SYSTICKS, maybe the problem is limited to the counters.

    THX

    Cheers

    Detlef

    Technical Moderator
    May 17, 2025

    Dear @DetlefS ,

    it may happen that Timers are clocked by 72MHz directly from PLL output, but system clock mux is selecting HSI clock at 8MHz , you can check that by outputting the main MCO clock on PA8 and see the CPU and APB clocks . Hope it helps you.

    STOne-32

    DetlefSAuthor
    Graduate
    May 18, 2025

    Hi,

    bypassing HSE was the solution, thank you.

    It was grayed out in the clock tree selection window and it took me a while to find it in PinoutConfiguration -> SystemCore -> RCC  -> HSEbypass.

    Changing the clock configuration on the fly is challenging as well with PLL sync issues and CSS kicking in.

    But now it is working, thx.

    Cheers

    Detlef