Skip to main content
Graduate II
May 16, 2025
Solved

PWM jitter

  • May 16, 2025
  • 5 replies
  • 994 views

Hello, 

 

I am currently in the midst of developing a super simple system to create a varying load. It's basically to resistors in series with a transistor in parallel of the second resistor. The transistor is driven by a PWM signal to bypass the second resistor and modify the load.

I've been trying the circuit with a function generator and it's working perfectly.

I now need to switch the PWM generation to a timer of a STM32. I have a nucleog474RE.

I used one of the example code available via cubeIDE (TIM_PWMOutput) and changed the frequency to match what i need (3.2kHz) but whenever I try and use my circuit with it, the signal generated by the nucleo is nowhere near clean and smooth, there is a huge jitter that basically renders my circuit useless (I need very high precision and stability).

 

Would any one have any idea why this is happening and what to do to correct it ?

 

Thanks for the answers ! 

    This topic has been closed for replies.
    Best answer by Mike_ST

    The Nucleo G474 has an external XTAL please use it, hopefully it will improve accuracy,

    configure Crystal/ceramic for HSE as follow:

    Mike_ST_0-1747399989404.png

    Select HSE as input for the PLL and enter 170 in HCLK:

    Mike_ST_1-1747400076303.png

     

    5 replies

    EliazLBAuthor
    Graduate II
    May 16, 2025

    The jitter makes the frequency vary between 3.200kHz and 3.205kHz.

    Technical Moderator
    May 16, 2025

    Hello,

    What clock are you using as source for the PLL ?

     

    EliazLBAuthor
    Graduate II
    May 16, 2025

    Not quite sure, I think the internal clock...

    Here is a screenshot.

    I'm very new to all this so I'm not always sure about what I'm doing.

    Mike_STAnswer
    Technical Moderator
    May 16, 2025

    The Nucleo G474 has an external XTAL please use it, hopefully it will improve accuracy,

    configure Crystal/ceramic for HSE as follow:

    Mike_ST_0-1747399989404.png

    Select HSE as input for the PLL and enter 170 in HCLK:

    Mike_ST_1-1747400076303.png

     

    EliazLBAuthor
    Graduate II
    May 16, 2025

    I just changed it and it worked perfectly !

    Thanks for the advice !