cancel
Showing results for 
Search instead for 
Did you mean: 

How can I use an external clock generator to generate PWM signals?

Simecrafter
Associate III

I need to generate 4 different PWM signals simultaniously, I tried it with STM32F746G-DISCO but the screen of it just goes blank after a bit, I then tried it with Nucleo-144 F767ZI and it sort of worked for 50 kHz and 1 MHz however when going down like 750 kHz or some different frequency the generated signal is just a little inconsistent, like there are a few nano seconds of inconsistency between the signals.

Therefore I want to experiment with an external clock generator, precisely Si5351 Clock Generator, however I just don't know how to use an external clock generator, how do I connect it to my board, make them communicate etc etc

I didn't really end up finding much of an explanation on this topic either so any help is appreciated as a newcomer.

4 REPLIES 4
AScha.3
Chief III

Just use a precision clock (Sixxxx, whatever) as master clock for the cpu (HSE -> bypass setting in Cube),

then all timing is coming from this clock.

But with the "standard" crystal on your board, you already have about 10 exp -5 "precision" clock.

And down to ps precision you cannot go with a cpu and PLL inside, see ds for jitter levels.

AScha3_0-1741944944005.png

...no matter, what clock you use for the cpu.

Other way: let cpu run on its clock as it is, but use external clock input only for the timer, then it might be close to few ps jitter. (if your extra oscillator is good enough...)

AScha3_1-1741945199294.png

btw 

Si5351

->  100ps pp low output period jitter .

If you feel a post has answered your question, please click "Accept as Solution".

Do you want to use this external Clock Generator as the clock source for the entire processor, or just for the timers doing the PWM ?

Just the timers for the PWM

TDK
Guru

> however when going down like 750 kHz or some different frequency the generated signal is just a little inconsistent, like there are a few nano seconds of inconsistency between the signals.

The PWM generation on the STM32 is bulletproof. It runs its own hardware state machine that creates the signals. The accuracy will be as good as the accuracy of your clock, which is generally quite good.

> I didn't really end up finding much of an explanation on this topic either so any help is appreciated as a newcomer.

Here is an explanation of one breakout for the chip. Also example code there, but not for STM32CubeIDE.

Overview | Adafruit Si5351 Clock Generator Breakout | Adafruit Learning System

It communicates over I2C. There are tons of resources on I2C communication. Here is one example from CubeMX.

STM32CubeF7/Projects/STM32F722ZE-Nucleo/Examples/I2C/I2C_TwoBoards_ComPolling/Src/main.c at 18642033f376dead4f28f09f21b5ae75abb4020e · STMicroelectronics/STM32CubeF7

If you feel a post has answered your question, please click "Accept as Solution".