Skip to content

Instantly share code, notes, and snippets.

/*
si5351 divider finder function
Copywrite (C) 2021, Scott Howard KD9PDP
License:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

Is your feature request related to a problem? Please describe. The current method for finding the PLL and multisync ratios for register values are based on some hardcoded values that leads to (rounding) errors between the desired frequency and what gets set. Enclosed is a computationally cheap approach to find values for the dividers that (1) allow you to set the integer bit on the output divider and (2) give you the exact values needed for a given frequency. It works for one or two clocks on a PLL.

Describe the solution you'd like Either update the functions the calculate the PLL and multisync values, or add a new function for "enhanced_accuracy_set_freq" or something like that.

The current method sets the PLL to 800 MHz then finds approximate values for the A+B/C output divider ratios to set the correct frequency by setting C=RFRAC_DENOM. That can work for many situations, but introduces error on the order of Vxtal/RFRAC_DENOM. For the same computational effort, you can find exact solutions. Bel

@maqifrnswa
maqifrnswa / linearlocatortest.py
Last active March 29, 2016 20:39
script to test difference between linear locator scripts
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 29 15:49:38 2016
@author: showard
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import matplotlib.ticker