[time-nuts] Generating a solid PPS from 10Mhz source

Robert Darby bobdarby at triad.rr.com
Thu Jan 14 13:19:14 EST 2016


I and others have written divider routines in assembler for the ATtiny25 
etc.  The version I have is crude but divides by 10, 100, and 1000.  I 
also have a version that divides by 1E4, 1E5, and 1E6.  I also have a 
version that generates 3 pps outputs, one with a 50% duty cycle plus 
positive and negative short duration pulses.

All three sync up to the 10 MHz clock using a pps input.  The sync takes 
about 2 to 3 s, is within several clock cycles (adjustable) but always 
has one clock cycle  uncertainty.  Basically we look for an interrupt on 
the pps input and if one occurs we poll the pin to find the next one.  
This leads to the one cycle uncertainty.  I tried interrupts but had 
more variance than polling - ymmv. If there is no pps interrupt the wdt 
times out and we jump into the main loop.

I'm working from memory but I seem to recall there's several ns 
variation between the three outputs and they change about 14 to 16 ns 
after the clock.

I'm happy to email the assembler code to anyone who wants to start from 
it.  Its crude and will need testing/tweeking.  I have several chips in 
use that work well but I just changed a few things and have not burned 
and tested the changes in a circuit.

Drop me a line if you want the sources.

bob



On 1/14/2016 7:20 AM, Daniel Watson wrote:
> I'm curious if that code will perform the intended function (down to the clock cycle) when compiled. A check in the simulator would be a good idea while the TIA is busy.
>
> If it doesn't give you the performance you are looking for, try programming it in assembly, as was done for the PicDiv.
>
> Dan
>
>> On Jan 13, 2016, at 9:35 PM, Nick Sayer via time-nuts <time-nuts at febo.com> wrote:
>>
>> The code is at
>>
>> https://github.com/nsayer/GPS-disciplined-OXCO/blob/master/tiny_divider.c
>>
>> It’s a first cut. The code at the moment will just divide the input clock by 10 million, so you get a 1 PPS 50% duty square wave out. It should run on any ATTinyx5 model - it certainly will fit on at ATTiny25 if you wish.
>>
>> I’ve not exhaustively tested it yet. I need to feed it into my TIA to make sure it’s exactly 1 Hz - it’s conceivable I’ve committed a fencepost error that would make it off enough that my scope can’t tell (my TIA is busy at the moment).
>>
>> I believe the code won’t do the math properly below 10 MHz. You’d need to select the next lower prescale setting and change a couple of the formulae, but I don’t foresee an issue with doing so.
>>
>> I’ll come back with an exhaustive test report (and any bug fixes) when I get my TIA back from GPSDO ADEV duty. :)
>>
>>> On Jan 13, 2016, at 12:12 PM, Nick Sayer <nsayer at kfu.com> wrote:
>>>
>>> Just shy of a half dozen folks have asked, so I'll post here as soon as I finish cleaning it up. I'll put it on Github when it's ready. I just need a day or two.
>>>
>>> Sent from my iPhone
>>>
>>>> On Jan 13, 2016, at 6:43 AM, Nick Sayer via time-nuts <time-nuts at febo.com> wrote:
>>>>
>>>> If anyone is interested in the equivalent functionality using an ATTiny25 (for instance, if you’re already heavily invested in AVR instead of PIC, like I am), ping me. I’ve privately written code to solve almost the same problem and it could easily be adapted into doing the same job.
>>>>
>>>>> On Jan 13, 2016, at 5:23 AM, Edesio Costa e Silva <time-nuts at tardis.net.br> wrote:
>>>>>
>>>>> Hi!
>>>>>
>>>>> Try TVB's picDiv at http://www.leapsecond.com/pic/picdiv.htm
>>>>>
>>>>> Edésio
>>>>>
>>>>>> On Wed, Jan 13, 2016 at 09:22:09AM +0000, Jerome Blaha wrote:
>>>>>> Hey Guys,
>>>>>>
>>>>>> Is there an easy circuit to build that can consistently deliver a 1 PPS from a 10MHz source with excellent resolution and repeatability?  My first application is to test different 10MHz oscillators without a TIC always attached and then compare the PPS output change over time against a master GPSDO PPS with an HP53132A.
>>>>>>
>>>>>> The circuit used for PPS generation would have to deliver consistent PPS output with preferably not more than 100ps noise or jitter, assuming a perfect source.  I'm totally guessing that for this resolution, the PPS would have to be generated and accurate to within 0.001Hz every second.  If this is too difficult, maybe the integration time can be increased to generate one pulse every 10second or every 100,000,000.00 cycles?
>>>>>>
>>>>>> Finally, is a square 10Mhz reference any better in this case than a sinusoidal input for generating the PPS?
>>>>>>
>>>>>> Thanks,
>>>>>> Jerome
>>>>>>
>>>>>> _______________________________________________
>>>>>> time-nuts mailing list -- time-nuts at febo.com
>>>>>> To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
>>>>>> and follow the instructions there.
>>>>> _______________________________________________
>>>>> time-nuts mailing list -- time-nuts at febo.com
>>>>> To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
>>>>> and follow the instructions there.
>>>> _______________________________________________
>>>> time-nuts mailing list -- time-nuts at febo.com
>>>> To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
>>>> and follow the instructions there.
>> _______________________________________________
>> time-nuts mailing list -- time-nuts at febo.com
>> To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
>> and follow the instructions there.
> _______________________________________________
> time-nuts mailing list -- time-nuts at febo.com
> To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
> and follow the instructions there.
>




More information about the time-nuts mailing list