XMEGA RC Accuracy?

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

I have an XMEGA A3BU xplained development board. I want to use this chip because it can do hardware quadrature decoding and I'm using a motor with very high encoder tick frequency (250KHz).

For my PID loop I want to have a fixed controller frequency of 500Hz so I am using software interrupts on TC0.

I can't seem to get my ISR to fire at the right frequency. I expect a period of 2ms but I'm getting 1.93ms. The default clock is the on-chip 2MHz RC. I've also tried using the on-chip 32MHz RC. Both RC clocks give me this same weird ~4% discrepancy in frequency.

I'd expect the RC clock to not be perfect, but better than 4%. I'd also expect the two RC clock's not to have the exact same discrepancy.

The dev board only has a 32768Hz external crystal, which isn't fast enough to use with PLL to get a good system clock.

Am I missing something? Does anyone have advice?

I'm using a modified form of the ASF quickstart code from "TC Example 1 - XMEGA-A3BU Xplained" in Atmel Studio 6. I can post my code if necessary.

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

If you have an external 32768Hz crystal, you can use "DFLL" to increase the accuracy of 32MHzRC.

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


Well, that doesn't seem too bad....here is the mega88PA,  the results for your Xmega chip may be tighter; have you tried doing a cal?

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

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

XMega is supposed to be good enough for async serial without calibration.

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

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

I have been using USART without external crystals since xmega was released.

It uses a DFLL with an internal 32768Hz and has shipped a lot as a product but has not reported any communication errors.

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

Digging up that datasheet shows your chip should be within +/-1.5%.  Are you using a decent freq counter with a solid timebase to measure?  Also, be careful you are not "off by one" in some counter/divider setting, especially if working with a small number

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!