XMEGA TOSC for DFLL - Driven by accurate RTC?

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

HI, Folks.

I've a project using an XMEGA 64 (or 128) A4U.
It's gonna be subject to large temperature swings, from -40C to maybe +40C. It'll be asleep 99% of its life.

For accurate use of USB/Serial, I need the baud rate to remain pretty consistent over this swing.

To use the DFLL to get the system clock spot-on I've the choice of the 32KHz RC oscillator (RC?? At those extremes? Shudder!) or a 'watch crystal'.

Now, on the board I have a DS3232MZ 'Extremely accurate RTC'. It uses a MEMS, is temperature compensated, with correction in its EEPROM. Couple of minutes a year error, max.

 

The datasheet says that those inputs are the only choices I have. Strangely, the TOSC1 pin is the same as XTAL1, when configured thus, it can have an external clock shoved up its jacksy. BUT, configured so (EXT-Clock) DFLL isn't on offer. Crazy, but...

Unfortunately, to use an external clock to drive the PLL (as distinct from the DFLL) needs a minimum soource frequency of 0,4MHz (or, if you turn to the very next page in the datasheet, 0,44MHz...). My 'plan-B' until I saw that paragraph.

Question: Has anyone ever 'told' an XMEGA to use the TOSC as a crystal oscillator, but shoved 32,768Hz into TOSC1 instead, and used the DFLL as calibration for 32MHz osc? I'd try, but really don't wanna unsolder a 44-pin chip off the board if it causes the Blue Smoke Fairy to visit..

 

Ta Muchly!

 

EDIT: Or am I misunderstanding the A4U manual? The A4U DATASHEET has a diagram (Fig. 7.6) implying I CAN do this, but the MANUAL doesn't give this option...

Wibble....

Last Edited: Sat. Mar 7, 2015 - 06:19 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It is confusing.  Actually you are confusing me too.smiley  I think you mean Fig 7.6 in the manual, not the data sheet.

 

Also there is this in the manual, just above the figure.

 

 

In figure 7.6, the key seems to be that trapezoid named XOSCSEL.

 

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm wondering if the internal 32kHz RC oscillator might work.   It seems to be pretty stable.  Maybe I'm missing something though.

 

When I look at the graphs in the data sheet it seems to me the frequency shifts less than 1% between -40 and +40 C.  In my quick and dirty tests it seems the USART can tolerate a 2% error and the USB can tolerate a 4% error.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You're right, Steve - when both books ar open on the kitchen table, and She-Who-Must-Be-Obeyed demands space to cook, it's difficult to think which one!

Unfortunately, now Spring is here (ish)* I can't just take a trip up North and try it...We'll have to pay some serious money to use the nearest env. chamber for testing...

 

Of course, that's assuming the users laptop can tolerate such cold if they want to 'harvest' data in such conditions...If I get it spot-on, at least we can't be blamed if the guy took a 2-day snowcat trip and can't communicate to the Beast... OK, we can send by GSM, but not in the remotest places.

 

-Andy

 

* In Finland, we have four seasons. Almost Winter, Winter, Still Winter, and Roadworks....

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I believe I've uncovered the source of my confusion:

Atmel's AVR1506 (dated 06/10 - presumably June 2010) states:

The Atmel XMEGA has two built-in Digital Frequency Locked Loops (DFLLs) which
can be used to improve the accuracy of the 2 MHz and 32 MHz internal oscillators.
The DFLL compares the oscillator frequency with a more accurate reference clock to
do automatic run-time calibration of the oscillator. The choices for the reference clock
sources are:
32 kHz Calibrated Internal Oscillator
32 kHz Crystal Oscillator connected to the TOSC pins

And that's all, whereas the manual dated 04/2013) (sect. 7.7) states:

Two built-in digital frequency locked loops (DFLLs) can be used to improve the accuracy of the 2MHz and 32MHz
internal oscillators. The DFLL compares the oscillator frequency with a more accurate reference clock to do automatic
run-time calibration of the oscillator and compensate for temperature and voltage drift. The choices for the reference
clock sources are:
32.768kHz calibrated internal oscillator
32.768kHz crystal oscillator connected to the TOSC pins
External clock
USB start of frame

 

I'm going to spend today trying this out. Accuracy/certaincy of field communications is vital in this app. I'll report back my findings (I'm a 'noob' with Xmega)

-Andy

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm using the internal 32K + DFLL on xmega64d4. I have tested about twenty of them from -23 C to + 80 C and never had a single error in serial communication (RS-422 at 115200 baud). Six units were tested even to a bit below -30 C, but that's the coldest I can get with the current testing system. According to datasheet specs + typical, you should be within about +-1% from the accurate frequency from -40 to + 40 C.

I have a reservation for an external 32K, but decided not to use it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks, jmaja1! That'll do for me.
I'm still going to 'have a playaround' with the clock system, etc. Just to learn...

-Ta, Andy