SparkFun Clock Generator 5P49V60 (Qwiic) Hookup Guide

Pages
Contributors: Elias The Sparkiest
Favorited Favorite 2

Example 4 and 5: Change Slew and Skew Clock Signals

The next two examples deal with manipulating the frequencies of the clock outputs. Click on File > Examples > SparkFun Clock 5P49V60 Arduino Library > Example4_change_skew and ... > Example5_change_slew_rate to open the examples. The body of the examples have been reduced to the relevant code blocks in this hookup guide, because the first three examples establish the steps to setup the basics of your SparkFun Clock Generator.

First, the slew rate is modified below by setting it to FAST with the function clockGen.clockOneSlew(FAST). This is one of four settings: SLOWEST, SLOW, FAST, and FASTEST that range from 2.2-2.7 V/ns; see the table above in the Hardware Overview under Clock Output Frequency, for possible settings. After setting the slew rate, the SparkFun Clock Generator is reset with clockGen.globalReset() because changing a clock output's slew rate results in a desychronization of the clock outputs. Global reset is a handy function to keep in your back pocket in case of undesired results.

language:c
// Slew rate for clock one.  
Serial.println("Setting Slew Rate.");
clockGen.clockOneSlew(FAST);
Serial.print("Slew rate set, resetting clock signals.");
clockGen.globalReset();

Secondly, the skew rate is set in the following code block. Each clock output is synchronized with each other to maintain a minimal skew rate between them by default. This however, is changed for clock one by calling clockGen.skewClockOne(). In the following code block, clock one is skewed by 10 nano-seconds relative to clock two.

language:c
// Clock One Skew------------------------------------------------
// Clocks are syncronized on every pulse - this skew will ofset clock one by
// 10ns relative to clock two. 
clockGen.skewClockOne(10); // Give values in nano seconds. 
//---------------------------------------------------------------