Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for clock 1 and clock 2 to both run, but at the same frequency and different phase settings #11

Open
wa2mze opened this issue Sep 28, 2021 · 6 comments

Comments

@wa2mze
Copy link

wa2mze commented Sep 28, 2021

It should be possible to run both clock 1 and clock 2 at the same time if they are set to the same frequency. Why do this? So they can be run 90 degrees apart in phase to drive an I/Q demodulator. It seems that just loading the phase registers with the correct constant and having the PLL run at an even multiple of the desired frequency should do this according the the eitherkit library readme file.

@wa2mze
Copy link
Author

wa2mze commented Sep 30, 2021

I'm experimenting with code to limit the divisor to 126, and as an even number. A minimum PLL frequency of 400 mhz will allow for I/Q outputs as low as 3mhz (with a 25mhz crystal). (technically out of spec, but proven to work). I will then provide a set_frequency method that will program clk1 and clk2 to run with the same PLL, at the same frequency. The phase_offset register for one of these channels will be set to the divisor value (4-126) to set that clk channel to a 90 degree phase offset. Another method will allow changing the offset from 90 to 270 degrees (invert phase output) for use in sideband selection with I/Q (de)modulators. The enable method will now allow both clks 1 and 2 to be enabled, or just one of them. If only one channel is enabled, it will (must) be the Inphase output and not the Quadature output. The PLL will ONLY be reset during the set_frequency method if the divisor has changed since the last set_frequency request.

@motorist828
Copy link

Hello, I have a similar suggestion.
For my project, the second output needs an inverted signal with the same frequency, can this be done somehow?

@wa2mze
Copy link
Author

wa2mze commented Jun 27, 2022

If the phase of the second output is set to 180 degrees instead of 90, that would be an inverted output. I'm not exactly sure how to set the phase register for this, but suspect that it should be a specific multiple of the divisor.

@sbridger
Copy link

Quadrature outputs are also important for me.

As an aside, I would also note that having a third output sometimes is useful for built-in self-test. It has no requirement to be click free, or even have fine frequency resolution, it just allows use as a BIST signal generator.

@koendv
Copy link

koendv commented Jun 14, 2024

Inverting a clock (e.g. for differential output) is done in CLK0_INV and CLK1_INV, register 16 and 17, bit 4.

@koendv
Copy link

koendv commented Jun 23, 2024

I add C source that configures CLK1 to be the inverse of CLK0. Uses include file from milldrum to keep code legible.

si5351mcu_diff.txt

This code sets CLK1_INV to set CLK1 to the inverse of CLK0. You can get a 90 degree phase shift in a similar way.
[Edit: tweaked source to show clk0 needs to be initialized first.]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants