Adafruit Si5351 Clock Generator Breakout: Created by Lady Ada
Adafruit Si5351 Clock Generator Breakout: Created by Lady Ada
Adafruit Si5351 Clock Generator Breakout: Created by Lady Ada
Never hunt around for another crystal again, with the Si5351 clock generator breakout from Adafruit! This chip has a
precision 25MHz crystal reference and internal PLL and dividers so it can generate just about any frequency, from
<8KHz up to 150+ MHz.
The Si5351 clock generator is an I2C controller clock generator. It uses the onboard precision clock to drive multiple
PLL's and clock dividers using I2C instructions. By setting up the PLL and dividers you can create precise and arbitrary
We put this handy little chip onto it's own breakout board PCB, with a 3.3V LDO regulator so it can be powered from 3-
5VDC. We also put level shifting circuitry on the I2C lines so you can use this chip safely with 3V or 5V logic.
Best of all, we even have a great tutorial and library to get you started! Our code is designed for use with the Arduino
microcontroller and IDE but is easily ported to your favorite platform with I2C support
Power Pins
The clock generator on the breakout requires 3V power. Since many customers have 5V microcontrollers like Arduino,
we tossed a 3.3V regulator on the board. Its ultra-low dropout so you can power it from 3.3V-5V just fine.
Vin - this is the power pin. Since the chip uses 3 VDC, we have included a voltage regulator on board that will
take 3-5VDC and safely convert it down. To power the board, give it the same power as the logic level of your
microcontroller - e.g. for a 5V micro like Arduino, use 5V
GND - common ground for power and logic
I2C Pins
SCL - I2C clock pin, connect to your microcontrollers I2C clock line. This pin is level shifted so you can use 3-5V
logic, and there's a 10K pullup on this pin.
SDA - I2C data pin, connect to your microcontrollers I2C data line. This pin is level shifted so you can use 3-5V
logic, and there's a 10K pullup on this pin.
Clock Out Pins
0, 1, and 2 - These are the 3 independent clock generated outputs. They are square waves, from 0-3V.
The clock out pins are also brought out to SMA edge-launch connectors on the other side of the PCB. You can
purchase and solder on some edge-launch SMA connectors (https://adafru.it/dPr) if you want to pipe the signal into an
RF cable.
If you have the breadboard version of this sensor, you'll want to solder some header onto the sensor so it can be used
in a breadboard.
And Solder!
Be sure to solder all pins for reliable electrical contact.
(https://adafru.it/dPs)
(https://adafru.it/pBC)
Connect Vin to the power supply, 3-5V is fine. Use the same voltage that the microcontroller logic is based off of.
For most Arduinos, that is 5V
Connect GND to common power/data ground
Connect the SCL pin to the I2C clock SCL pin on your Arduino. On an UNO & '328 based Arduino, this is also
known as A5, on a Mega it is also known as digital 21 and on a Leonardo/Micro, digital 3
Connect the SDA pin to the I2C data SDA pin on your Arduino. On an UNO & '328 based Arduino, this is also
known as A4, on a Mega it is also known as digital 20 and on a Leonardo/Micro, digital 2
Download Adafruit_Si5351
To begin reading sensor data, you will need to download the Adafruit Si5351 library from the Arduino library manager.
Now you can use your oscilloscope to probe the #0, #1 and #2 outputs
Depending on your oscillioscope make and model, it may not be possible for you to verify the 112.5MHz
output frequency!
Begin!
To initialize the chip, call clockgen.begin() which will check that it can be found. Begin() returns true/false depending
on these checks. We suggest you wrap begin() in a statement that will check if the chip was located:
if (clockgen.begin() != ERROR_NONE)
{
/* There was a problem detecting the IC ... check your connections */
Serial.print("Ooops, no Si5351 detected ... Check your wiring or I2C ADDR!");
while(1);
}
By noodling with the multiplier and divider you can generate just about any clock frequency!
There are two PLL multipliers (A and B), so if you want to have three outputs, two outputs will have to share one PLL.
This sets PLL_A or PLL_B to be 25MHz * m and m (the integer multipler) can range from 15 to 90!
Each output has its own divider. You can use the cleaner Integer-only divider:
Again, integer output will give you the cleanest clock. If you need more flexibility, use the fractional generator/divider:
Additional R Divider
If you need to divide even more, to get to the < 100 KHz frequencies, there's an additional R divider, that divides the
output once more by a fixed number:
clockgen.setupRdiv(output, SI5351_R_DIV_x);
Software
As you can see, the annoying part here is figuring out the best choice for PLL multipler & divider! SiLabs has a desktop
application called ClockBuilder (https://adafru.it/dPj) that can do some calculation of the PLL divider/multiplier for you.
It's windows only, but you only need to use it once for calculation.
Enable the output you want, and set the frequency as floating point or fraction
You can use this sensor with any CircuitPython microcontroller board or with a computer that has GPIO and Python
thanks to Adafruit_Blinka, our CircuitPython-for-Python compatibility library (https://adafru.it/BSN).
First make sure you are running the latest version of Adafruit CircuitPython (https://adafru.it/Amd) for your board.
Next you'll need to install the necessary libraries to use the hardware--carefully follow the steps to find and install these
libraries from Adafruit's CircuitPython library bundle (https://adafru.it/zdx). Our introduction guide has a great page on
how to install the library bundle (https://adafru.it/ABU) for both express and non-express boards.
adafruit_si5351.mpy
adafruit_bus_device
Before continuing make sure your board's lib folder or root filesystem has
the adafruit_si5351.mpy, and adafruit_bus_device files and folders copied over.
Next connect to the board's serial REPL (https://adafru.it/Awz) so you are at the CircuitPython >>> prompt.
Once that's done, from your command line run the following command:
If your default Python is version 3 you may need to run 'pip' instead. Just make sure you aren't trying to use
CircuitPython on Python 2.x, it isn't supported!
import board
import busio
import adafruit_si5351
i2c = busio.I2C(board.SCL, board.SDA)
si5351 = adafruit_si5351.SI5351(i2c)
Now you're ready to configure the PLLs and clock outputs on the chip. The SI5351 is somewhat complex and allows
quite many configurations to balance the accuracy and range of clock output values. You'll want to review the
datasheet (https://adafru.it/C5E) to understand the capabilities and features of the chip.
You can configure each PLL's multiplier by calling the configure_integer or configure_fractional function. The integer
configuration lets you set an integer multiplier for the 25 MHz base crystal frequency. This is the most accurate way to
control frequency but you can only set integer multiples. For example to set PLL A to 500 MHz you'd set an integer
si5351.pll_a.configure_integer(20)
Don't forget, if you read the datasheet you'll see the Si5351 only supports a PLL multiple of 15-90!
If you're curious you can read the frequency property of the PLL to read back what frequency it is configured to use:
The other way to configure a PLL is with a fractional multiplier. This allows you to set both the integer multiple and a
fractional multiple (specified by a numerator and denominator). Fractional multipliers can let you specify an even
greater range of frequencies, but they might not be accurate and could be susceptible to jitter over time.
For example to configure PLL B to 512.5 MHz you can specify a multiplier of 20.5 by calling:
si5351.pll_b.configure_fractional(20, 1, 2)
Notice the configure_fractional function takes in again the integer multiple (20) but also adds a numerator (1) and
denominator (2) value. The actual multiplier will be the combination of the integer multiplier plus the
numerator/denominator. In this case 20.5 or 20 1/2 is the multiplier.
Again you can read the frequency property to confirm the value that was set.
Just like configuring the PLLs you can configure the clock divider with a configure_integer and configure_fractional
function. Again the same trade-off of precision vs. range applies for integer vs. fractional dividers applies. For
example to set clock 0 to use PLL A as a source (running at 500 MHz as configured above) and a divider of 4 you
si5351.clock_0.configure_integer(si5351.pll_a, 4)
Notice you tell the configure_integer function both the PLL to use and the integer divider value. You can point at
either of the pll_a or pll_b objects on the Si5351 to use a specific PLL as the source.
The final frequency set by the clock will then be configured as the PLL source frequency (500 MHz here) divided by
the divider value (4), or 125 MHz. You can check by reading the frequency property of the clock:
Like the PLL configuration you can also set a fractional divider with the configure_fractional function on the clock.
Let's set clock 1 to have PLL B as the source and a divider of 4.5:
si5351.clock_1.configure_fractional(si5351.pll_b, 4, 1, 2)
If you do the math you should expect a source PLL of 512.5 MHz divided by 4.5 would yield a clock output of 113.8889
MHz. Check the frequency property to be sure:
Enabling Outputs
There's one last thing to do before the clock outputs will actually work, you need to enable them. You can enable all
the clock outputs by setting the outputs_enabled property to True :
si5351.outputs_enabled = True
Now the clock 0, 1, 2 outputs should output a square wave at the configured frequency based on their PLL and
multipliers & dividers. You might need to use an oscilloscope that's very fast to measure some of these outputs as the
Si5351 can generate quite high clockspeeds well above 100 MHz!
That's all there is to using the Si5351 clock generator with CircuitPython! Here's a complete example that will
configure all 3 clocks in various ways. Save this as code.py on your board and read the comments to see how it
configures each clock.
import adafruit_si5351
# Initialize SI5351.
si5351 = adafruit_si5351.SI5351(i2c)
# Alternatively you can specify the I2C address if it has been changed:
#si5351 = adafruit_si5351.SI5351(i2c, address=0x61)
# Now configure the clock outputs. Each is driven by a PLL frequency as input
# and then further divides that down to a specific frequency.
# Configure clock 0 output to be driven by PLL A divided by 8, so an output
# of 112.5mhz (900mhz / 8). Again this uses the most precise integer division
# but can't set as wide a range of values.
si5351.clock_0.configure_integer(si5351.pll_a, 8)
print('Clock 0: {0}mhz'.format(si5351.clock_0.frequency/1000000))
Datasheet
Si5351 Datasheet (https://adafru.it/dPk)
Fritzing object in Adafruit Fritzing library (https://adafru.it/aP3)
EagleCAD PCB files on GitHub (https://adafru.it/pBD)