Main Content

Clock generator

I recently build a pulse generator and it does its job well. It produces pulses of variable length and at several frequencies. But the number of frequencies it can produce is limited and for many jobs the length of a pulse is less important than its frequency. E.g. when you are testing a clock you need a certain frequency, often 32768 Hz, but the pulsewidth (duty cycle) isn’t so important. To address this I made a clock generator, it produces squarewaves of (approx) 50% duty cycle for every frequency.

Library

The frequencies are generated with a Si5351 chip from Silicon Labs. This chip can produce frequencies from 4 kHz up to 200 MHz. Usually I read the documentation of a chip and produce the code to use it. But this chip is so complicated that I chose to use a library made by Jason Milldrum, Sebastian Hesselbarth and Rabeeh Khoury. They made an easy to use C-library with one limitation, the lowest frequency you can generate is 1 MHz. I know that there is an extended version of this library for Arduino that starts at 4 kHz, but I didn’t want to use an Arduino. And I’ll tell you why.

No Arduino but a Blue Pill

A few months ago I made a dual channel oscilloscope with a Blue Pill and it worked well. But I never used it as I have a Rigol and a Pico oscilloscope. So it just sat there, gathering dust. Therefore I decided to convert it to something else, and that something else is this project, a clock generator.

Supplies:
Hardware

Si5351 module
Blue Pill module
ST7735 TFT display
74HC00 (quad nand)
2 rotary encoders with switch
Project box
Lithium ion battery
Holtek 7333 (low dropout voltage regulator 3.3V)
Perf-board
Toggle switch
some capacitors and resistors
ST-Link module or Segger J-Link (to program the Blue Pill)

Software

STM32CubeIDE
Si5351 library (made by Jason Milldrum)
MS-Paint (yes really!)”

Link to article