On 11/04/2013 06:14 PM, Adam Jacobs wrote:
> Hi John,
>   I haven't done anything with AVR chips in a couple of years now, but I
> can only add that I've felt your pain. I built a lot of clocks using AVR
> parts, in a variety of designs and with a variety of AVR chips... and
> they all had strange repeatable timer issues. I do think that the AVR
> parts might miss interrupts on occasion... are you disabling the timer
> interrupts at any point in your code? I think that you usually need to
> disable interrupts when interacting with i2c parts, etc...
> -disable interrupt
> -dump command to peripheral part
> -enable interrupt

Ahhhh, I'm glad it's not just me and that I'm not going crazy  :-)

The only time I disable interrupts is to write to EEPROM and that's only
to store the last value for retrieval during the next power-up.

The only problem I have with the idea of random missed interrupts is
that my code will repeat, say, a 100 second interval down to fractions
of a microsecond.  May be off by a whole second but it sure repeats.

The next thing I'm going to do is to re-connect the output pin to the
CTC match interrupt and measure that with my counter.  See how much
jitter there is in that.

Grahame and others, the code as it exists right now is here:

https://dl.dropboxusercontent.com/u/81715047/jgd_timer_code_11_04_2013.zip
> 
> Like that... and that sort of thing is what I always assumed was the
> culprit. Eventually, I decided that it simply wasn't worth it for me to
> implement solid clock code in AVR and switched to using standalone clock
> chips. I like the Maxim DS1307, since it comes in 8-pin DIP package and
> is i2c. That way, I can worry about the fun functionality in my AVR code
> and leave the dreary clock accuracy optimization to the birds.

I would have put an RTC on the board but there is absolutely no space
left.  This is a retrofit to an existing product and the board is having
to use otherwise unused space on the back side of the front panel.  I
already have my board house a little miffed. :-)

> 
> FYI, I did find that my clock accuracy increased if I lowered the
> frequency of the AVR. 12mhz ATTiny2313 was much less accurate than the
> same part with the DIV8 fuse set. I assume because a 1.5mhz clock AVR
> would need to interrupt far less often in order to generate the desired
> 0.1 second resolution.

Interesting.  I had intended on running this chip at 8MHz but I couldn't
find a crystal nor an oscillator physically small enough to fit the
space available so I'm running at 16MHz.  Maybe I'll try an 8MHz part
and let it just dangle for the prototype.

Thanks to everyone who has commented so far.  You've certainly given me
some stuff to think about.

John


-- 
John DeArmond
Tellico Plains, Occupied TN
http://www.fluxeon.com      <-- THE source for induction heaters
http://www.neon-john.com    <-- email from here
http://www.johndearmond.com <-- Best damned Blog on the net
PGP key: wwwkeys.pgp.net: BCB68D77

-- 
You received this message because you are subscribed to the Google Groups 
"neonixie-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to neonixie-l+unsubscr...@googlegroups.com.
To post to this group, send an email to neonixie-l@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/neonixie-l/52783C4D.8050405%40neon-john.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to