ATxmega256A3BU-xplained / clk_per selection

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

I am using ATxmega256A3BU-xplained. I select 32MHz internal oscillator for clock (ClkPER) of the timer and avr core by modifying conf_clock.h as follow.

#define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_RC32MHZ
#define CONFIG_SYSCLK_PSADIV SYSCLK_PSADIV_1
#define CONFIG_SYSCLK_PSBCDIV SYSCLK_PSBCDIV_1_1

In addtion, for using USB, I added below.

#define CONFIG_USBCLK_SOURCE USBCLK_SRC_RCOSC
#define CONFIG_OSC_RC32_CAL 48000000UL
#define CONFIG_OSC_AUTOCAL_RC32MHZ_REF_OSC OSC_ID_USBSOF

I ran TCC0 as single slope PWM mode and noticed the timer was running based on 48MHz clock. I checked the system clock selection and prescaler registers' values on Studio 6 while debugging. But they showed the values as set in the conf_clock.h file. If I use PLL as system clock source and set PLL output to 32MHz, the timer run based on 32MHz. So this may be a chip design error? By the way, if the timer runs based on 48MHz clock, does it mean that AVR core runs at 48MHz?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
#define CONFIG_OSC_RC32_CAL 48000000UL

The above line causes the RC32M to run at 48MHz and, since you aren't prescaling this value, the CPU and peripherals are also running at 48MHz, well beyond their rated top speed of 32MHz.

To run the CPU within spec, you can set PSA, PSB or PSC to divide by 2 yielding a 24MHz for the CPU and peripherals. Or you can feed the RC2M into the PLL and multiply by 15, yielding a 30 MHz clock.

Note that most peripherals are spec'd to run at a max of 32MHz, while the AweX/HiRes (64MHz) and EBI (128MHz) are spec'd to run faster. The multiple prescalers allow you to clock all peripherals and the CPU at their respective maxima by configuring the PLL to output 128MHz and setting the prescalers accordingly.

It's surprising the A3BU runs at 50% over its spec'd clock rate. Apart from the timer running faster than you expected, does you application appear to be working? Does the MCU chip feel warmer than ambient temperature?

Gamu The Killer Narwhal
Portland, OR, US
_________________
Atmel Studio 6.2
Windows 8.1 Pro
Xplained boards mostly

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

I got it! By the way, the chip is not hot at all for at least my application. Anyway, thank you for your response.