Re: [time-nuts] How to properly characterize 32kHz oscillators manually and with a microcontroller?

2016-07-04 Thread Pete Stephenson
I ended up doing just this and it worked out nicely. Using the timer hardware as a counter freed up the CPU for other tasks and could run in the background so I wouldn't miss any ticks. It turns out that using the built-in timer hardware was a lot easier than using external "jellybean" logic to

Re: [time-nuts] How to properly characterize 32kHz oscillators manually and with a microcontroller?

2016-06-29 Thread Brooke Clarke
Hi David: I built a number of clocks based on PIC uC and using interrupts. The idea is to use the output from a frequency standard as the heart beat of the clock. Depending on what the PIC was doing when interrupted the delay can different by one cycle and a simple test corrects that. Clock

Re: [time-nuts] How to properly characterize 32kHz oscillators manually and with a microcontroller?

2016-06-29 Thread Nick Sayer via time-nuts
> > For more precise stuff timing, I have a Thunderbolt and other goodies. > (Speaking of which, I really need to figure out how to use the > Thunderbolt as an external clock source for my Arduinos.) > I don’t think you can do it for an Arduino without hardware changes. The CLKI pin is shared

Re: [time-nuts] How to properly characterize 32kHz oscillators manually and with a microcontroller?

2016-06-29 Thread Van Horn, David
>That all assumes you have turned interrupts off for some reason. Common >reasons could be that you are in another interrupt service routine or that >you are executing interrupt related code. > >Bob What I saw in their interrupt routine was a "full boat" implementation, pretty typical for

Re: [time-nuts] How to properly characterize 32kHz oscillators manually and with a microcontroller?

2016-06-29 Thread Van Horn, David
O M G.. So I followed the link and saw how they do it.Wow. They write interrupts like the DMV processes applications. I can only imagine what this looks like on the PIC, where every instruction takes 4x as many cycles. All of that pushing and popping is PRECISELY what you need to avoid.

Re: [time-nuts] How to properly characterize 32kHz oscillators manually and with a microcontroller?

2016-06-29 Thread Bob Camp
Hi > On Jun 29, 2016, at 5:08 AM, Pete Stephenson wrote: > > On Tue, Jun 28, 2016 at 12:14 AM, Van Horn, David > wrote: >> >> >> p...@heypete.com said: >>> I'm a little concerned about the speed at which the pulses need to be >>>

Re: [time-nuts] How to properly characterize 32kHz oscillators manually and with a microcontroller?

2016-06-29 Thread Pete Stephenson
On Tue, Jun 28, 2016 at 12:14 AM, Van Horn, David wrote: > > > p...@heypete.com said: >> I'm a little concerned about the speed at which the pulses need to be >> counted. The 32kHz pulses come in every ~30.5 microseconds, and handling an >> interrupt on an

Re: [time-nuts] How to properly characterize 32kHz oscillators manually and with a microcontroller?

2016-06-29 Thread Scott Stobbe
For pulse counting, the timer hardware is the way to go. Setup a 16-bit timer clocked off your DUT. Then input capture on your PPS edge. This leaves you plenty of processor time for string formatting and other tasks you may wish to perform. If you do the decimation as post-processing on your PC

Re: [time-nuts] How to properly characterize 32kHz oscillators manually and with a microcontroller?

2016-06-28 Thread Hal Murray
p...@heypete.com said: > I have seen those, but I have little experience with PICs and the Wife > Acceptance Factor of buying more stuff for a one-off measurement is low. The PIC family is very similar to AVRs. The picPET and friends are 8 pin DIPs so the Wife is unlikely to notice the

Re: [time-nuts] How to properly characterize 32kHz oscillators manually and with a microcontroller?

2016-06-28 Thread Van Horn, David
p...@heypete.com said: > I'm a little concerned about the speed at which the pulses need to be > counted. The 32kHz pulses come in every ~30.5 microseconds, and handling an > interrupt on an ATmega328 running at 16MHz takes about 5.125 microseconds[1] Huh? Instruction cycle time is 62.5nS for

[time-nuts] How to properly characterize 32kHz oscillators manually and with a microcontroller?

2016-06-28 Thread Mark Sims
Back when that local high school kid was arrested for bringing his "home made" alarm clock to school, I bought a "bomb clock game" off of Ebay. It looks like 7 sticks of dynamite with a circuit board with LEDs strapped to it. The game part is you press a button and it starts counting down 10

Re: [time-nuts] How to properly characterize 32kHz oscillators manually and with a microcontroller?

2016-06-28 Thread Tom Van Baak
: "Pete Stephenson" <p...@heypete.com> To: "Discussion of precise time and frequency measurement" <time-nuts@febo.com> Sent: Tuesday, June 28, 2016 1:47 AM Subject: Re: [time-nuts] How to properly characterize 32kHz oscillators manually and with a microcontroller?

Re: [time-nuts] How to properly characterize 32kHz oscillators manually and with a microcontroller?

2016-06-28 Thread Pete Stephenson
On Mon, Jun 27, 2016 at 10:51 PM, Hal Murray wrote: > > I assume you are doing this for fun. That means you get to do whatever you > think will be fun. Indeed, this is strictly for fun. I have strange values for "fun". > The DS3231 is pretty crappy by time nuts

Re: [time-nuts] How to properly characterize 32kHz oscillators manually and with a microcontroller?

2016-06-28 Thread Pete Stephenson
Hi Nigel, Using the internal timer as a divide-by-256 counter is a clever way of doing things. Thanks! I'm not familiar with using the timers as an input, so it looks like I need to do some light, relaxing reading of the datasheet. From what I can tell, using timer2 as an input ("asynchronously

Re: [time-nuts] How to properly characterize 32kHz oscillators manually and with a microcontroller?

2016-06-27 Thread Hal Murray
dan...@verizon.net said: > Maybe, but simply by adjusting mine by measuring the 32 kHz output with an > accurate counter I can get them to keep to within about one second a month. What did you adjust? I assume it's software. How well do typical VCO adjustments work with tuning forks? My

Re: [time-nuts] How to properly characterize 32kHz oscillators manually and with a microcontroller?

2016-06-27 Thread Dan Rae
On 6/27/2016 1:51 PM, Hal Murray wrote: I assume you are doing this for fun. That means you get to do whatever you think will be fun. The DS3231 is pretty crappy by time nuts standards. Maybe, but simply by adjusting mine by measuring the 32 kHz output with an accurate counter I can get them

Re: [time-nuts] How to properly characterize 32kHz oscillators manually and with a microcontroller?

2016-06-27 Thread Hal Murray
t...@patoka.org said: > For very long time, may be Main Frequency (60 Hz) could be utilised. Say, > MCU could count and compare Zero-Crossings and impulses from DS32xx chips. > After several days, you'll see where it goes. Power in Silicon Valley isn't stable enough to make that approach

Re: [time-nuts] How to properly characterize 32kHz oscillators manually and with a microcontroller?

2016-06-27 Thread Hal Murray
I assume you are doing this for fun. That means you get to do whatever you think will be fun. The DS3231 is pretty crappy by time nuts standards. If you can also measure the temperature, you should be able to make neat graphs. If you watch it as the temperature ramps up slowly, you should

Re: [time-nuts] How to properly characterize 32kHz oscillators manually and with a microcontroller?

2016-06-27 Thread Nick Sayer via time-nuts
> On Jun 27, 2016, at 1:34 PM, Nick Sayer wrote: > > > In the firmware, the timer that has the input capture ability is set to > free-run at the system clock frequency. The ICP interrupt reports back the > timer delta from the last interrupt. Nominally, you’d expect 16,384

Re: [time-nuts] How to properly characterize 32kHz oscillators manually and with a microcontroller?

2016-06-27 Thread Vlad
For very long time, may be Main Frequency (60 Hz) could be utilised. Say, MCU could count and compare Zero-Crossings and impulses from DS32xx chips. After several days, you'll see where it goes. On 2016-06-27 11:22, Pete Stephenson wrote: Hi all, I have a few Maxim DS3231

Re: [time-nuts] How to properly characterize 32kHz oscillators manually and with a microcontroller?

2016-06-27 Thread Nick Sayer via time-nuts
I went through this exercise some time ago with my Crazy Clock. The Crazy Clock is itself an ATTiny45 clocked with a 32 kHz crystal. I desired to determine the accuracy of the oscillator. I wound up making a purpose-built frequency counter. First, the device under test gets special firmware

Re: [time-nuts] How to properly characterize 32kHz oscillators manually and with a microcontroller?

2016-06-27 Thread Nigel Vander Houwen
Pete, Instead of doing this in an ISR, feed the 32KHz into one of the timer/counter inputs, and clock the timer off of that (probably TIMER2), then just have an ISR for the overflow vector. So, when your X bit timer overflows, you can just add that to your total, when you reach your 1000s (or

[time-nuts] How to properly characterize 32kHz oscillators manually and with a microcontroller?

2016-06-27 Thread Pete Stephenson
Hi all, I have a few Maxim DS3231 temperature-compensated real-time clock chips I use for various embedded hobby projects. They're specced to have an accuracy +/-2ppm between 0 Celsius and 40 Celsius. One is from a standard, reputable vendor, while a few are from somewhat more dubious internet