Advertisement
microrobotics

Si5351 clock generator module

Apr 15th, 2023
1,327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. Install the Adafruit Si5351 library from the Arduino Library Manager or download it from the GitHub repository (https://github.com/adafruit/Adafruit_Si5351_Library) and install it manually.
  3.  
  4. Connect the Si5351 module to your Arduino using the I2C interface (SDA to A4 and SCL to A5 on Arduino Uno, Nano, or Pro Mini).
  5.  
  6. This code uses the Adafruit Si5351 library to configure the Si5351 clock generator module. The output frequency is set using the outputFrequency constant (10 MHz in this example). The setup function initializes the Si5351 module, configures the output clock using the fixed PLL (800 MHz), and sets the output frequency. The output is then enabled.
  7.  
  8. Note: This example assumes you have already connected the Si5351 clock generator module to your Arduino according to the manufacturer's recommendations. Be sure to consult the Si5351 datasheet and the Adafruit Si5351 library documentation for proper wiring and usage instructions.
  9. */
  10.  
  11. #include <Wire.h>
  12. #include "Adafruit_Si5351.h"
  13.  
  14. Adafruit_Si5351 si5351 = Adafruit_Si5351();
  15.  
  16. const uint32_t outputFrequency = 10000000; // Output frequency in Hz (10 MHz)
  17.  
  18. void setup() {
  19.   Serial.begin(9600);
  20.   if (!si5351.begin()) {
  21.     Serial.println("Error: Si5351 not detected. Check wiring.");
  22.     while (1);
  23.   }
  24.  
  25.   si5351.setupPLL(SI5351_PLL_FIXED, 0, 0, 0, 0); // Use the fixed PLL (800 MHz)
  26.  
  27.   // Configure the Si5351 output clock
  28.   si5351.setupMultisynth(0, SI5351_PLL_FIXED, SI5351_MULTISYNTH_DIV_6, 0, 1);
  29.  
  30.   // Set the output frequency
  31.   si5351.setMSFrequency(0, outputFrequency);
  32.  
  33.   // Enable the output
  34.   si5351.enableOutputs(true);
  35. }
  36.  
  37. void loop() {
  38.   // Nothing to do here, the clock signal is continuously generated by the Si5351
  39. }
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement