Close

I've had it

A project log for GPS Disciplined xCXO

A DIY GPS disciplined 10 MHz reference clock

nick-sayerNick Sayer 02/25/2018 at 22:440 Comments

Back when the controller for the 5680/5660 board variant was the ATTiny841 the fact that the oscillator output could glitch when the !READY output wasn't on was not a problem - the ATTiny841 can alter its clock source programmatically, so you can run it from the 8 MHz internal oscillator until the oscillator comes ready, then switch.

The ATMega328PB can't do that. And I've tried a bunch of things to try and prevent glitching from affecting the controller, but it's just not working out to my satisfaction.

The next step forward is to try a variant with the ATXmega32E5. This has some positive ramifications, but some negative ones.

One big change is that the controller needs 3.3 volt power instead of 5 volt. To some extent, this makes interfacing with the GPS receiver a little easier, since it's 3.3 volts too. The 3.3 volt LDO powering the GPS receiver has plenty of capacity to power the controller as well.

One big benefit we gain is that there's no longer a need to share the programming pins with any other functional pins. This means we can get rid of the NAND gates that would disconnect the oscillator from its serial pins when !RESET was low (during programming). This is because both of the serial ports (the port C one has GPS input and diagnostic output, and the port D one has the oscillator I/O) can be dedicated to their sole task.

The downside is that two of the inputs into the controller need to be level shifted down from 5 volts. The oscillator TX output from the MAX232 can be level shifted with a simple diode+pull-up circuit, but the other signal that needs to be shifted is the 10 MHz clock from the NB3N551. Down-shifting a 10 MHz clock requires a bit more care. I'm going to try using a low value resistor divider (1kΩ/500Ω) or a low value resistor and zener pair (not yet sure which).

Another benefit we gain from this arrangement is that the XMega can run at a faster internal clock rate. We still want to clock it from the oscillator, but there's an internal PLL that we can use to triple that to 30 MHz. We can also run the internal 32 MHz oscillator instead at 30 MHz so that we can run at a consistent clock speed both before and after we switch to the external oscillator.

We also get a 12 bit ADC instead of a 10 bit one, so in principle the granularity of the phase discriminator can be 250 ps instead of 1 ns (whether it's going to be that accurate or not is questionable). For the first cut of the firmware, however, it's likely we'll just throw away the extra two bits to try and get everything running properly. There's a DAC as well, but it doesn't do us any good since the FE oscillators are serial-controlled. It won't do us any good on the OCXO/TCXO variants because 12 bits isn't enough for them.

Lastly, we no longer have to insist that programming only take place with the oscillator connected. Unfortunately, we need to use PDI to do the programming, but at least we can do that whether the oscillator is connected or not (and PDI is very fast).

The last downside, of course, is that the XMega is double the price ($2.80 vs $1.40 Q:1), but we do get to say goodbye to a couple of ICs (we do gain a couple of inexpensive diodes), which softens the blow a little. At least it's the same package as the 328PB we were using before.

Rewriting the firmware is going to be a painful operation, but I said that before doing the same thing for the GPS clock, so yeah.

Discussions