Posted by Joseph Noci 1 on 04/01/2023 07:45:44:
Posted by SillyOldDuffer on 03/01/2023 16:20:45:
Meanwhile I've cracked how to count ticks with a Nucleo F466RE hardware timer, hurrah. Looks promising. …
Dave,
I was away a day or two – did not see you plea for nucleo timer assistance..sorry – seems you sorted it though..
Dave, Allen variance/deviation is one of the tools that will lead you down that time-nuts path – it is addictive and confounding…
How did you get the Allan data you measured? The only way is two basically compare two different clocks – via an interval timer – one clock must be order(s) of mag better in phase and frequency stability than the clock under scrutiny, and accurate in frequency if you wish to know accurate freq deviation and not only stability. You can't use the same processor clock as the processor uses to generate timing control for the loop as that is somewhat incestuous…eg, if using the 1PPS from a GPS to control a GPSDO loop, you cannot use that same 1PPS as the 'accurate' clock reference for the interval timer to measure the deviation of the GPSDO's XO from the GPS 1PPS…sort of head up your own backside – you need an external STABLE signal source.
That why you will find a half-dozen or more oscillators, if not 1 or 2 ceasium standards etc, in any time-nut's garage…
This is probably the best reference to goto – Stable32 is a good SW that will allow the measurement and display of Allen dev/var info…
**LINK**
Drilling down some menu's ( look at them all if you have the time..)
**LINK**
The Nucleo board I use is the 446-RE – the osc input to the 446 can come from the on-board STLINK module – two jumpers labelled MCO (SB16 and 50) on the underside must be intact, and SB55 removed. The CPU then has the 8MHz clock as input.
I have fed 10MHz from my GPSDO into that clock for accurate timer measurments…
Welcome down the Rabbit-Hole
Joe
This gives some examples of a measurement system:
**LINK**
And this is a nice explanation of what it is all about:
**LINK**
Typo, I have a F446 too! I hadn't realised it can be clocked from the ST-link crystal, which is good news.
I'm still a bit stuck with the Nucleo timer. The STArduino package comes with a HardwareTimer class that does Input Capture, and a few examples of it in action. It doesn't support clocking timers from an external source, unless ETR can do that. The class header hides the internal detail of register settings, but I expect I can work them out from the CPP file and datasheet.
I think what I need to do is connect an external clock to a TI1 or TI2 input, but I can't see which pin they go to. A 'Blue Pill' pinout and datasheet identifies them, but not the F446. I suspect it might be the EFR pin, and its mode is switched by "Configure channel 2 to detect rising edges on the TI2 input by writing CC2S = ‘01’ in the TIMx_CCMR1 register." Or maybe it's the TIM1_CH2 pin. Worryingly, on other timers such as TIM2, TIM2_CH1/TIM2_ETR are both on pin PA15, implying Input Capture and External clocking can't both be used together. Maybe I'm not understanding the datasheets.
So not clear to me if its possible to set up an ST timer to:
- clock with an external oscillator, AND
- do Input Capture, AND
- generate overflow interrupts.
It's step 1, the external oscillator, I'm struggling with.
Any guidance on this gratefully received!
Re Allan, I'm measuring short term pendulum with timings with a 16MHz crystal, whilst the crystal is measured with a GPS pps reference. This mostly compensates for crystal instability, mostly due to temperature. Long term performance is measured relative to ordinary NTP, but I'm not using that with Allan.
The latest graph:

The tau value looks OK, and is in the right range 10⁰ to 10⁵
Not sure about 'delta f/f ppm' because the range 10-¹⁰ is tiny. The curve might be right, but what does it mean.
What it's displaying is 'Pendulum Period Time, measured in ticks with a 16MHz crystal, that's been compensated relative to a GPS pps tick, where the tick has been converted and rounded to microseconds by diciding by the crystals average frequency'. Feel free to say if this is bonkers, I don't really understand what I'm doing!
Thanks
Dave