Si5351A Investigations Part 2

It has been another productive weekend with the Si5351 here in the shack. Since the last report, I've made significant progress in confirming that the Si5351 may be a good candidate for use as a LO in a radio.

After getting the most basic communications with the Si5351 going via the Bus Pirate, my next task was to find out if I could determine a calibration routine that eventually would be easy enough for anyone to do with even simple equipment like a digimode PC program and WWV. Recall from my previous post that there was quite a bit of error in the output frequency when uncorrected (over 1 kHz error at 20 MHz output frequency). According to its datasheet, the Si5351 has 0 PPM of inherent frequency error, which means that all frequency errors should result only from the attached 25/27 MHz reference crystal. Theoretically, if that can be measured, one calibration value should be good across the entire tuning range.

I added in a line of code to change the nominal 25 MHz reference frequency (called "parent_rate" in the above code snippet) based on an amount of error entered as a command line argument in parts-per-ten million. This reference frequency is the basis of the calculations of the two synthesizer values calculated in the program, so tweaking it to its actual oscillation frequency should give the proper output frequency wherever that output frequency is set.

Terminal_001

After adding this simple calibration code, I first used my tuning program to output a set of registers for 10.000000 MHz oscillation with 0 correction. These tuning registers were loaded into the Si5351 and the output was measured on my Tektronix DC 503A frequency counter at 1 Hz resolution. A difference of -887 Hz was measured between the nominal 10.000000 MHz frequency requested and the actual output frequency. Next, as you can see in the screenshot above, I entered a correction factor of -887 parts-per-ten million into the tuning program and generated a new set of tuning registers. (For those who are curious, the program prints out a variety of variables for troubleshooting, then at the end spits out the hexadecimal code for the Bus Pirate to send the registers to the Si5351. I just copy and paste that string into my serial terminal).

Happily, the Si5351 output a frequency within 1 Hz of the nominal 10.00000 MHz requested frequency. Experiments with other tuning frequencies showed similar amounts of error. Up at 50 MHz, the frequency counter only showed ~3 Hz of error. This bodes very well for the use of the 5351 in amateur radio projects.

SI5351 Test Board
SI5351 Test Board

So, with calibration seemingly under control, it was time to move everything over to a microcontroller. The above photo shows the current hardware setup. I've added my old favorite, an Atmel ATmega328P microcontroller, with a 16 MHz crystal. I have also added a USB B jack, as I intend to make this Si5351 controlled and powered exclusively via USB. Since the Si5351 operates off of 3.3 V power, I provide power to it and the '328P via a LE33CZ LDO regulator fed from the USB 5 V supply. I have also added some simple resistive voltage dividers to the AVR ISP lines to convert 5 V programming signals down to 3.3 V.

Fortunately, I now seem to have enough AVR code sitting around that a lot of these new endeavors can be launched very quickly via the application of a bit of copy-and-paste. I borrowed a bit of I2C code from some CC1 development work and pasted in the rough tuning code that I originally wrote for the Linux command line. A bit of jiggery-pokery and I was able to get the '328P sending I2C commands to the Si5351 to set various parameters and tune to a non-default frequency in order to ensure that the I2C comms were working.

Which is where I currently sit with the project. Next up on the agenda is to write a basic Si5351 library for the ATmega88/168/328 series and then paste in the V-USB code in order to get USB control up and running. After that, it will be onward with the grabber receiver portion of this experiment. Stay tuned for updates (and yes, code will be forthcoming on GitHub once it's in a decent state).

A Hellschreiber Clock!

Hellschreiber Clock Display
Hellschreiber Clock Display

I don't know if the guy who created this is a ham (he does say he's an engineer), but it's a neat application of some old-school technology. He uses a PIC 12F510 to output a Hellschreiber modulated square wave right to his PC's sound card line in port. I really get a kick out of seeing one of these "obscure" ham technologies escaping out into the Maker universe. The hardware is dead simple, as you can see in the instructions. If you wanted to try to create a Hellschreiber beacon, I don't see why you couldn't just take this same design and plug it into your rig's sound card interface instead of a PC. I'm already thinking about how cool this would be to try...there's a good chance I will give it a shot (with an AVR) after I finish up my latest DC transceiver. Watch out for more aliens infecting the bands.

BCD Switch Goodness

DDS-60 Controlled by BCD Swtiches
DDS-60 Controlled by BCD Swtiches

A blog that I follow on a regular basis is from Aussie ham Peter Marks, VK2TPM. He posts from the perspective of an experienced ham who is really starting to get bitten by the homebrewing bug, so it's a real pleasure to see him discover some of the things which make that aspect of the hobby fun. In his latest post, he introduces us to his DDS-60 controlled by a bank of BCD switches. The whole shebang is tied together with an ATmega32 using C code compiled by the avr-gcc toolchain (my favorite).

I love this for a couple of reasons. First off, it reminds me of the first major homebrewing project that I attempted, the W8DIZ MultiPig. One of my favorite aspects of it was the PLL controlled by BCD switches exactly like this. As a side note, I never did successfully complete the MultiPig. Not for lack of effort (or ability, I think), but because I went and made some stupid life choices. However, I'm happy to say that I was able to cannibalize the remnants of my MultiPig for many successful homebrew projects later on. The second reason is just the cool factor. I guess it's the retro, 70s look and feel of the swtiches, but there's something alluring about the whole tactile experience of using BCD switches. FB job Peter!

Programming AVR Microcontrollers in Eclipse

Lately, I have been using my Ubuntu Hardy Heron box for coding and programming my AVR projects using the simple combination of gedit, the avr-gcc toolchain and the USBtinyISP. It's a little bit of a pain to get set up correctly, but it works very well once it's up and running. I've been pretty happy with editing code in gedit then compiling and programming the AVR via command line. It's pretty easy to quickly make changes to the code and save the C file in gedit, then use the command history of the terminal to re-run make and avrdude.

However, I recently ran across this posting when browsing the AVR Freaks forum. The author kindly gives instructions on how to set up the Eclipse IDE for use in AVR development on the Ubuntu platform. This looked really promising, since I've always been a sucker for nice IDEs (yes, I know that probably lowers my geek cred a few notches). So I gave it a go and found that the instructions worked nearly flawlessly. The only hiccup I encountered was at the very end of the build process when Eclipse was waiting for the sudo password for avrdude (oddly enough, you have to run avrdude as root to access the USB programmer, unless you implement a little workaround that I'll show you in a second). I didn't see any way to enter the root password into a terminal, so I had to cancel the whole process.

A bit of thought and much more searching brought me to the answer to the problem. There is a way to get non-root access to the USBtinyISP. You have to create a udev rule to tell the kernel to change permissions on the USBtinyISP. The documentation on the ladyada website tells you to do this, but it only gives you half of the story. First of all, it doesn't mention exactly where to place the new rule that you are creating. Her documentation stated that I needed to put the rule in a file in /etc/udev/rules.d/. The problem is that this doesn't state whether I need to place the rule in an existing file or create a new one. After a bit of trial-and-error and yet some more Google searching, I found out that I needed to create a new file for the USBtinyISP. So a new file named 50-usbtinyisp.rules was created. The other problem is that the actual rule given on the ladyada site seems to have a typo in the MODE parameter. Comparing this rule to some other rule examples, it appears that the correct rule is:

SUBSYSTEM=="usb", SYSFS{idVendor}=="1781", SYSFS{idProduct}=="0c9f", GROUP="users", MODE="0666"

Once you get the udev rule set up correctly, you no longer need root to access the USBtinyISP, and the entire build process in Eclipse works flawlessly.

So far, using Eclipse as an AVR development platform has been a real pleasure. There's a lot of nice little touches, like having quick access to all of the special function registers of each device and easy configuration of the build parameters via GUI. If you are like me and like the convenience that an IDE gives you, then the AVR/Eclipse environment is an excellent choice, and may even be better than WinAVR.