dfannin / adf4351

Arduino library for the ADF4351 PLL Frequency Synthesizer chip
MIT License
43 stars 29 forks source link

Chinese ADF4351 able to set module to 2.401ghz but not 2.4Ghz (on board 100 Mhz crystal oscillator ) #2

Closed sriranjanr closed 5 years ago

sriranjanr commented 5 years ago

I have been working with your library and a chinese ADF4351 board which has onboard 100 Mhz crystal oscillator. I was able to set it to 2.401Ghz and the lock led lights up but when I try to set it to 2.4Ghz I get error mod out of range. When I set the ref freq to 10Mhz there is no mod error but the lock led does not light up and I think it is because there is onboard 100Mhz crystal. So since I have a 100 Mhz crystal and your library appears to work well with 10Mhz ref freq coded in, what shall I do? Is it possible that even after setting the ref freq to 100 Mhz I do not get a mod error and that I can set it to 2.4Ghz as well? Is there anything that I need to change in the code like vfo.ClkDiv = 150 ; vfo.BandSelClock = 80 ; to values other than you mentioned? Please let me know.

dfannin commented 5 years ago

send me a link to the board so I can take a look. Also, what is your freq step size?

It should work with a 100 mhz reference frequency (I use one). I tested mine by setting it to 2.401 ghz , and then 2.4 ghz, and it worked. Please let me know the exact sequence (did you use the direct entry for the frequency or a rotary encoder or the buttons?, and I'll try to duplcate it. ) . Most likely, you have a step size that may be too small, and it causes a "mod out of range" = Modulus out of range error. when trying to set the frequency directly. The nature of a Freq Sync PLL is that only certain frequencies are available, depending on the frequency, step size and reference frequency. You should not have to change the other values that you mentioned for this type of operation.

dfannin commented 5 years ago

Also, most of the Chinese ADF4351 use a 25 or 10 mhz reference oscillator, rather than 100 mhz, so check that as well. You'll need to make sure your software matches the correct reference frequency, otherwise you won't a get PLL lock, and your output frequency may be incorrect.

However, the "mod out of range" is a software error, when the modulus value range is exceeded. The mod out of range error (see code) happens when if the Mod value is less than 2 or greater than 4095. Most likely this occurs due to the desired frequency is not available at the combination of freq, step size and ref freq.