Break My New Library

I know that the updates here have been extremely sparse. For that I do apologize. Things are slowly starting to settle into a new normal around here, and I’ve been able to regain the ability to put time back into work. There’s a large to do list on my whiteboard, and many of the things on that list depend on improvements and bug fixes to the Si5351 Arduino library. So that has been my first priority as I dip my toes back in the water.

There were quite a few features of the Si5351 that the older versions of the library did not support, such as all of the 8 outputs of the variants excluding the A3 and the VCXO of the B variant. Also, there is a pretty big bug in how the tuning algorithm handles multiple outputs assigned to the same PLL, which causes tuning errors to crop up.

Therefore, I decided in one fell swoop that I needed to totally rewrite the tuning algorithm and add support for as many of the neglected features as I could before moving on to other projects involving the Si5351. Over the last month, I’ve been hacking away on the code in my spare time, and I’m glad to finally be able to announce that a beta version of the Si5351 Arduino v2.0.0 library is ready for public use.

Because it’s such a drastic change to the underlying code, I’d like to have it in limited beta release before doing a final release via the Arduino Library Manager. So that means that if you would like to try it (and I encourage you to do so), then you’ll need to install it manually, which isn’t terribly difficult.

Go here and click on the green button on the upper right that says “Clone or download”. Select “Download ZIP”. Next, find where on your filesystem your Arduino libraries folder resides and delete the existing “Etherkit Si5351” folder. Inside the ZIP file you just downloaded, there is a folder entitled “Si5351Arduino-libupdate”. Unzip this folder into the Arduino libraries folder, and then restart the Arduino IDE.

Since this is a new major version release, I took the opportunity to tweak the interface a bit, which means that you’ll have to adjust your current code to work with the new library (but fortunately not too much). You’ll find the details on how to do that here.

Please check out the updated documentation on the GitHub page, as it has been greatly expanded and should explain all of the new features in detail. Also, quite a few new example sketches have been added to the library, which you can find in the usual place in the Arduino IDE. I encourage you to try the new library in your existing projects, as it should be a bit more streamlined and stable. Also, there is plenty of opportunity to make new projects with the B and C variant ICs. If you do encounter any problems with the new library version, I would like to strongly encourage you to use the Issues feature of GitHub to let me know so that I can get on to fixing it as soon as possible. When I’m satisfied that there are no big show-stopper bugs in the code, I’ll merge it to the master branch of the repository and tag it for release via the Arduino Library Manager, but I need help in testing it before I can do that.

Once there’s a stable release of this version of the library out in the wild, then I’ll be able to move forward with other projects based on this Si5351. With any luck, some more interesting things will be coming from this shack again in the near future. Thank you for all of your help and support!

Edit: an exclusive look into the development process:

18 thoughts on “Break My New Library

  1. Hi Jason, Thanks very much for your work on your excellent si5351 library, I’ve just used it for Yet Another si5351 DDS VFO project, see

    https://vk3hn.wordpress.com/2017/02/02/arduino-and-si5351-dds-vfobfo/

    I am trying to work out what the *default* output level on the clocks … is it SI5351_DRIVE_2MA ?

    I’ll set it to SI5351_DRIVE_6MA tonight when I get home, I assume that is about right for driving the LO port of an SBL-1, which needs +7dbm. 73 Paul vk3hn.

  2. Hi Paul,

    Yes, the IC itself defaults to 2 mA drive, so that’s what you’ll get out if you don’t specify otherwise in your code. I think that either 4 or 6 mA drive would be a good choice. 6 mA is probably closest to +7 dBm, but 4 mA has a bit less spurious output and you probably wouldn’t noticed much difference in your receiver. It’s worth experimenting with.

    Good luck!
    Jason NT7S

  3. Tnx Jason, the receiver was working, but low in output and various spuglies across the band, I think I was under driving the sbl1. I will up the drive tonight and hopefully the rx will sound livelier. 73 vk3hn.

  4. Hi again, I just realised that ‘spuglies’ is a common name in the US for imperfect potatoes. I was using it to refer to apparently random carriers in a receiver’s tuning range due to unwanted mixing products. To close out that observation, I had been running my newly built receiver without its 2.4kHz SSB crystal filter, and when I added it, my ‘spuglies’ mostly disappeared. Also, I have tried driving my receiver’s SBL-1 mixer with and without a Low Pass Filter on the si5351 clock, and also at 2, 6 and 8MA drive levels, all with no noticeable difference. Regards, Paul VK3HN.

  5. Hi Jason (again),
    I can’t get all three clocks running. Here’s the background. After getting my si5351/Nano DDS VFO (CLK0, 5-5.5MHz) and BFO (CLK2, 9MHz) working in a basic superhet, the time came to add extra HF band converters onto the front end. This results in a dual conversion multiband receiver (think Wes Hayward W7ZOI’s Progressive Receiver from back in 1981). Each HF band requires a different fixed signal to heterodyne the band of interest onto the tuneable IF (3.5-4MHz).

    So I added set_freq() and enable_output() calls to start CLK1 (in the 2 – 12MHz range) for the hererodyne oscillator. No joy, no sound of a signal at the programmed frequency. After reading the library documentation I am not sure if I need to do anything to set PLLs or dividers to get all 3 clocks going at relatively low (sub 20MHz) frequencies. I checked your examples but I cannot see one that illustrates this. If I look through my script, the sequence of calls (‘…’ replaces some actual args for simplicity) is:

    si5351.set_correction(…);
    si5351.set_pll(SI5351_PLL_FIXED, SI5351_PLLA);
    si5351.set_freq(…, SI5351_CLK0); // VFO
    si5351.set_freq(…, SI5351_CLK2); // BFO
    .
    .
    .
    si5351.enable_output(SI5351_CLK1, 1);
    set_freq(…, SI5351_CLK1); // fixed heterodyne (converter) frequency

    What am I not doing?

    Thanks for your help again Jason, your library is opening up a new world for us homebrewers. Paul VK3HN.

  6. Hi Paul, it would be best if I could see your entire sketch and try to run it here, so could you please use a service such as GitHub Gist or PasteBin or the like to give me a full copy of your code? Thanks

  7. Jason, problem solved, your library is working fine. On Saturday I sourced a second Nano, breadboarded it with my standby Adafruit si5351 breakout, and wrote a simple script to initialise and turn on all 3 clocks. Worked a treat! Back to my receiver, when I disconnect the SMA plug that connects CLK1 to my SBL-1 first mixer, it springs to life. There is something outside the DDS module loading down, possibly even shorting the CLK1 oscillator output. Further diagnostic time needed. Thanks for your generous offer to look at my script. I’ll let you know how it all works out.

  8. Jason,
    Do you mind if I modify JTEncode to do a FSQ Beacon for the Bitx40? And put it on github. I know it’s open software but thought I’d ask anyway.
    They are already using your Si5351 library.

  9. Not at all, that’s why it’s open source, but I appreciate you letting me know. Would love it if you let me know when you have it working.

  10. Jason,
    My JTEncode/Si5351A FSQ Beacon for the Bitx40:
    https://github.com/bobh/Bitx40FSQdemo

    One thing I don’t understand is
    //*** #define FSQ_DEFAULT_FREQ 7105350UL // Base freq is 1350 Hz higher than dial freq in USB
    #define FSQ_DEFAULT_FREQ 7103865UL // Base freq is 1350 Hz lower than dial freq in LSB ?????????

    The Bitx40 is LSB but I’m injecting a signal direct from the Si5351A. No mixing. I don’t know where the sideband inversion is coming from? I’ll have to get a spectrum analyzer someday.

    Thank you for you libraries.

    wm6h

  11. My understanding is that you should be in USB, even when on 40 and 80 meters. That’s what the library assumes, as the​ tones would have to be reversed if you were in LSB.

  12. Thank you, I’m most definitely interested. I’m going to make a short post calling attention to it. I appreciate you choosing my board!

Leave a Reply