cancel
Showing results for 
Search instead for 
Did you mean: 

PWM jitter

EliazLB
Associate II

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 ! 

1 ACCEPTED SOLUTION

Accepted Solutions
Mike_ST
ST Employee

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

 

View solution in original post

5 REPLIES 5
EliazLB
Associate II

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

Mike_ST
ST Employee

Hello,

What clock are you using as source for the PLL ?

 

EliazLB
Associate II

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_ST
ST Employee

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

 

EliazLB
Associate II

I just changed it and it worked perfectly !

Thanks for the advice !