Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
rmutter
PostPosted: Mar 19, 2011 - 12:55 AM
Newbie


Joined: Feb 27, 2011
Posts: 9


In a spirit of helpfulness, I've attached a short program that sets up and demnostrates the XMEGA 1 Hertz interrupt. I just finished wasting four days of my life coming up with it, so I hope it'll save someone else as much time.
 
 View user's profile Send private message  
Reply with quote Back to top
Koshchi
PostPosted: Mar 19, 2011 - 03:17 AM
10k+ Postman


Joined: Nov 17, 2004
Posts: 13960
Location: Vancouver, BC

You do realize that using the internal oscillator to run your RTC will mean that it is not very accurate, don't you?

_________________
Regards,
Steve A.

The Board helps those that help themselves.
 
 View user's profile Send private message  
Reply with quote Back to top
rmutter
PostPosted: Mar 19, 2011 - 10:11 AM
Newbie


Joined: Feb 27, 2011
Posts: 9


Indeed, it isn't at all accurate. It happens that my breadboard has a GPS receiver right next to the XMEGA32A4. The receiver has a 1 PPS LED, too. When I saw the two LEDs' blinks going from in phase to 180 degrees out of phase, then back to in phase within two or three minutes, I started to investigate.

It turns out Atmel's +/-0.5% accuracy spec for the 32.768 khz oscillator assumes a temperature of 85 C and a 3V power supply. At room temperature with a 3.3v supply, the 32.768 khz oscillator is actually running at around 32 khz.

(I only started fooling around with Atmel processors in December, and XMEGAs last month, so I'm still not up to speed.)
 
 View user's profile Send private message  
Reply with quote Back to top
GordonFreeman
PostPosted: Mar 21, 2011 - 08:46 PM
Hangaround


Joined: Oct 30, 2008
Posts: 333
Location: Minnesota, USA

cool thanks, I'll give it a try.

_________________
$12 RS-232 Level Shifter
http://www.xbitinc.com/products/RS%252d232-Level-Shifter-with-DB9-Connector.html
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
Koshchi
PostPosted: Mar 21, 2011 - 09:40 PM
10k+ Postman


Joined: Nov 17, 2004
Posts: 13960
Location: Vancouver, BC

Quote:
It turns out Atmel's +/-0.5% accuracy spec
But even if it were within the 0.5% it could still be off by 7 minutes a day. For RTC accuracy you need a crystal.

_________________
Regards,
Steve A.

The Board helps those that help themselves.
 
 View user's profile Send private message  
Reply with quote Back to top
tmwoods
PostPosted: Mar 08, 2012 - 09:28 PM
Hangaround


Joined: Jan 31, 2012
Posts: 129
Location: Vancouver, BC, Canada

I know this post is a little old, but I was wondering which XMEGA you are using. In the errata of the A3BU it says the TOSC is busted. I'm basically trying to figure out if my code is wrong is if I am trying to lock the barn after the horse escaped.

_________________
ATMega644a
XMEGA-A3BU
JTAGICE3 Programmer
AVR Studio 5.1.148
FLIP 3.4.5 Build 106
 
 View user's profile Send private message  
Reply with quote Back to top
rubenpg1
PostPosted: May 14, 2012 - 04:30 PM
Newbie


Joined: Dec 28, 2011
Posts: 10
Location: Madrid, Spain

In my case, every 50 minutes the RTC of my ATXMega128A1 is being delayed 22 seconds, aprox ... more than 10 minutes a day, or 0,6% of cumulative delay ... I am resyncing against a time server, but it is a relevant drift, more than I could imagine ...

I'm using the 1 Hz tick option.

Well, thank to rmutter I have known about the frequency drifts at normal temperature conditions, I am going to study this http://www.atmel.com/Images/doc8277.pdf.
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
clawson
PostPosted: May 14, 2012 - 04:44 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62944
Location: (using avr-gcc in) Finchingfield, Essex, England

Quote:

or 0,6% of cumulative delay

But that's well within spec. for an Xmega. It's spec'd for +/-1% so count yourself lucky that you are actually getting a more accurate result.

For 30-50ppm accuracy add quartz.

For 2-5ppm added a temperature compensated external RTC chip to the design.

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
Torby
PostPosted: May 14, 2012 - 06:23 PM
Raving lunatic


Joined: Nov 11, 2003
Posts: 4040
Location: Chicago Illinois USA

Yes, while internal RC oscillators are accurate enough for many applications, they make terrible timepieces. Even the worst watch is fantastically accurate in terms of % error.

_________________
Discursive design,

Torby

Some days, it's just not worth chewing through the restraints.
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits